feat: add cusomters & vendors balance summary.

This commit is contained in:
elforjani3
2021-05-06 18:04:17 +02:00
parent e104937258
commit b3dab3c9a1
7 changed files with 316 additions and 9 deletions

View File

@@ -287,3 +287,80 @@ export function useSalesByItems(query, props) {
}, },
); );
} }
/**
* Retrieve customers balance summary report.
*/
export function useCustomerBalanceSummaryReport(query, props) {
return useRequestQuery(
[t.FINANCIAL_REPORT, t.CUSTOMERS_BALANCE_SUMMARY, query],
{
method: 'get',
url: '/financial_statements/customer-balance-summary',
params: query,
},
{
select: (res) => ({
columns: res.data.columns,
query: res.data.query,
tableRows: res.data.table.rows,
}),
defaultData: {
tableRows: [],
query: {},
},
...props,
},
);
}
/**
* Retrieve vendors balance summary report.
*/
export function useVendorsBalanceSummaryReport(query, props) {
return useRequestQuery(
[t.FINANCIAL_REPORT, t.VENDORS_BALANCE_SUMMARY, query],
{
method: 'get',
url: '/financial_statements/vendor-balance-summary',
params: query,
},
{
select: (res) => ({
columns: res.data.columns,
query: res.data.query,
tableRows: res.data.table.rows,
}),
defaultData: {
tableRows: [],
query: {},
},
...props,
},
);
}
/**
* Retrieve customers transcations report.
*/
export function useCustomersTranscationsReport(query, props) {
return useRequestQuery(
[t.FINANCIAL_REPORT, t.CUSTOMERS_TRANSACTIONS, query],
{
method: 'get',
url: '/financial_statements/transactions-by-customers',
params: query,
},
{
select: (res) => ({
data: res.data.table,
tableRows: res.data.table.rows,
}),
defaultData: {
tableRows: [],
data: [],
},
...props,
},
);
}

View File

@@ -112,7 +112,8 @@ export default [
import('containers/FinancialStatements/GeneralLedger/GeneralLedger'), import('containers/FinancialStatements/GeneralLedger/GeneralLedger'),
), ),
breadcrumb: 'General Ledger', breadcrumb: 'General Ledger',
hint: "Reports every transaction going in and out of your accounts and organized by accounts and date to monitoring activity of accounts.", hint:
'Reports every transaction going in and out of your accounts and organized by accounts and date to monitoring activity of accounts.',
hotkey: 'shift+4', hotkey: 'shift+4',
pageTitle: formatMessage({ id: 'general_ledger' }), pageTitle: formatMessage({ id: 'general_ledger' }),
backLink: true, backLink: true,
@@ -124,7 +125,8 @@ export default [
import('containers/FinancialStatements/BalanceSheet/BalanceSheet'), import('containers/FinancialStatements/BalanceSheet/BalanceSheet'),
), ),
breadcrumb: 'Balance Sheet', breadcrumb: 'Balance Sheet',
hint: "Reports a company's assets, liabilities and shareholders' equity at a specific point in time with comparison period(s).", hint:
"Reports a company's assets, liabilities and shareholders' equity at a specific point in time with comparison period(s).",
hotkey: 'shift+1', hotkey: 'shift+1',
pageTitle: formatMessage({ id: 'balance_sheet' }), pageTitle: formatMessage({ id: 'balance_sheet' }),
backLink: true, backLink: true,
@@ -138,7 +140,8 @@ export default [
), ),
), ),
breadcrumb: 'Trial Balance Sheet', breadcrumb: 'Trial Balance Sheet',
hint: "Summarizes the credit and debit balance of each account in your chart of accounts at a specific point in time. ", hint:
'Summarizes the credit and debit balance of each account in your chart of accounts at a specific point in time. ',
hotkey: 'shift+5', hotkey: 'shift+5',
pageTitle: formatMessage({ id: 'trial_balance_sheet' }), pageTitle: formatMessage({ id: 'trial_balance_sheet' }),
backLink: true, backLink: true,
@@ -150,7 +153,8 @@ export default [
import('containers/FinancialStatements/ProfitLossSheet/ProfitLossSheet'), import('containers/FinancialStatements/ProfitLossSheet/ProfitLossSheet'),
), ),
breadcrumb: 'Profit Loss Sheet', breadcrumb: 'Profit Loss Sheet',
hint: "Reports the revenues, costs and expenses incurred during a specific point in time with comparison period(s).", hint:
'Reports the revenues, costs and expenses incurred during a specific point in time with comparison period(s).',
hotkey: 'shift+2', hotkey: 'shift+2',
pageTitle: formatMessage({ id: 'profit_loss_sheet' }), pageTitle: formatMessage({ id: 'profit_loss_sheet' }),
backLink: true, backLink: true,
@@ -162,7 +166,8 @@ export default [
import('containers/FinancialStatements/ARAgingSummary/ARAgingSummary'), import('containers/FinancialStatements/ARAgingSummary/ARAgingSummary'),
), ),
breadcrumb: 'Receivable Aging Summary', breadcrumb: 'Receivable Aging Summary',
hint: "Summarize total unpaid balances of customers invoices with number of days the unpaid invoice is overdue.", hint:
'Summarize total unpaid balances of customers invoices with number of days the unpaid invoice is overdue.',
pageTitle: formatMessage({ id: 'receivable_aging_summary' }), pageTitle: formatMessage({ id: 'receivable_aging_summary' }),
backLink: true, backLink: true,
sidebarExpand: false, sidebarExpand: false,
@@ -173,7 +178,8 @@ export default [
import('containers/FinancialStatements/APAgingSummary/APAgingSummary'), import('containers/FinancialStatements/APAgingSummary/APAgingSummary'),
), ),
breadcrumb: 'Payable Aging Summary', breadcrumb: 'Payable Aging Summary',
hint: "Summarize total unpaid balances of vendors purchase invoices with the number of days the unpaid invoice is overdue.", hint:
'Summarize total unpaid balances of vendors purchase invoices with the number of days the unpaid invoice is overdue.',
pageTitle: formatMessage({ id: 'payable_aging_summary' }), pageTitle: formatMessage({ id: 'payable_aging_summary' }),
backLink: true, backLink: true,
sidebarExpand: false, sidebarExpand: false,
@@ -184,7 +190,8 @@ export default [
import('containers/FinancialStatements/Journal/Journal'), import('containers/FinancialStatements/Journal/Journal'),
), ),
breadcrumb: 'Journal Sheet', breadcrumb: 'Journal Sheet',
hint: "The debit and credit entries of system transactions, sorted by date.", hint:
'The debit and credit entries of system transactions, sorted by date.',
hotkey: 'shift+3', hotkey: 'shift+3',
pageTitle: formatMessage({ id: 'journal_sheet' }), pageTitle: formatMessage({ id: 'journal_sheet' }),
sidebarExpand: false, sidebarExpand: false,
@@ -210,7 +217,8 @@ export default [
), ),
breadcrumb: 'Sales by Items', breadcrumb: 'Sales by Items',
pageTitle: formatMessage({ id: 'sales_by_items' }), pageTitle: formatMessage({ id: 'sales_by_items' }),
hint: 'Summarize the businesss sold items quantity, income and average income rate of each item during a specific point in time.', hint:
'Summarize the businesss sold items quantity, income and average income rate of each item during a specific point in time.',
backLink: true, backLink: true,
sidebarExpand: false, sidebarExpand: false,
}, },
@@ -222,11 +230,64 @@ export default [
), ),
), ),
breadcrumb: 'Inventory Valuation ', breadcrumb: 'Inventory Valuation ',
hint: 'Summerize your transactions for each inventory item and how they affect quantity, valuation and weighted average.', hint:
'Summerize your transactions for each inventory item and how they affect quantity, valuation and weighted average.',
pageTitle: formatMessage({ id: 'inventory_valuation' }), pageTitle: formatMessage({ id: 'inventory_valuation' }),
backLink: true, backLink: true,
sidebarExpand: false, sidebarExpand: false,
}, },
{
path: `/financial-reports/customers-balance-summary`,
component: lazy(() =>
import(
'containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummary'
),
),
breadcrumb: 'Customers Balance Summary ',
hint: '..',
pageTitle: formatMessage({ id: 'customers_balance_summary' }),
backLink: true,
sidebarExpand: false,
},
{
path: `/financial-reports/vendors-balance-summary`,
component: lazy(() =>
import(
'containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummary'
),
),
breadcrumb: 'Vendors Balance Summary ',
hint: '..',
pageTitle: formatMessage({ id: 'vendors_balance_summary' }),
backLink: true,
sidebarExpand: false,
},
{
path: `/financial-reports/transactions-by-customers`,
// component: lazy(() =>
// import(
// 'containers/FinancialStatements/CustomersTransactions/CustomersTransactions'
// ),
// ),
breadcrumb: 'Customers Transactions ',
hint: '..',
pageTitle: formatMessage({ id: 'customers_transactions' }),
backLink: true,
sidebarExpand: false,
},
{
path: `/financial-reports/vendors-transactions`,
// component: lazy(() =>
// import(
// 'containers/FinancialStatements/'
// ),
// ),
breadcrumb: 'Vendors Transactions ',
hint: '..',
pageTitle: formatMessage({ id: 'vendors_transactions' }),
backLink: true,
sidebarExpand: false,
},
{ {
path: '/financial-reports', path: '/financial-reports',
component: lazy(() => component: lazy(() =>

View File

@@ -128,3 +128,54 @@ export function toggleInventoryValuationFilterDrawer(toggle) {
}, },
}; };
} }
/**
* Toggles display of the customers balance summary filter drawer.
* @param {boolean} toggle
*/
export function toggleCustomersBalanceSummaryFilterDrawer(toggle) {
return {
type: `${t.CUSTOMERS_BALANCE_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
payload: {
toggle,
},
};
}
/**
* Toggles display of the vendors balance summary filter drawer.
* @param {boolean} toggle
*/
export function toggleVendorsBalanceSummaryFilterDrawer(toggle) {
return {
type: `${t.VENDORS_BALANCE_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
payload: {
toggle,
},
};
}
/**
* Toggles display of the customers transactions filter drawer.
* @param {boolean} toggle
*/
export function toggleCustomersTransactionsFilterDrawer(toggle) {
return {
type: `${t.CUSTOMERS_TRANSACTIONS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
payload: {
toggle,
},
};
}
// /**
// * Toggles display of the vendors transactions filter drawer.
// * @param {boolean} toggle
// */
// export function toggleVendorsTransactionsFilterDrawer(toggle) {
// return {
// type: `${t.VENDORS_TRANSACTIONS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
// payload: {
// toggle,
// },
// };
// }

View File

@@ -33,6 +33,18 @@ const initialState = {
inventoryValuation: { inventoryValuation: {
displayFilterDrawer: false, displayFilterDrawer: false,
}, },
customersBalanceSummary: {
displayFilterDrawer: false,
},
vendorsBalanceSummary: {
displayFilterDrawer: false,
},
customersTransactions: {
displayFilterDrawer: false,
},
vendorsTransactions: {
displayFilterDrawer: false,
},
}; };
/** /**
@@ -63,4 +75,20 @@ export default createReducer(initialState, {
t.INVENTORY_VALUATION, t.INVENTORY_VALUATION,
'inventoryValuation', 'inventoryValuation',
), ),
...financialStatementFilterToggle(
t.CUSTOMERS_BALANCE_SUMMARY,
'customersBalanceSummary',
),
...financialStatementFilterToggle(
t.VENDORS_BALANCE_SUMMARY,
'vendorsBalanceSummary',
),
...financialStatementFilterToggle(
t.CUSTOMERS_TRANSACTIONS,
'customersTransactions',
),
...financialStatementFilterToggle(
t.VENDORS_TRANSACTIONS,
'vendorsTransactions',
),
}); });

View File

@@ -49,6 +49,22 @@ export const inventoryValuationFilterDrawerSelector = (state) => {
return filterDrawerByTypeSelector('inventoryValuation')(state); return filterDrawerByTypeSelector('inventoryValuation')(state);
}; };
export const customerBalanceSummaryFilterDrawerSelector = (state) => {
return filterDrawerByTypeSelector('customersBalanceSummary')(state);
};
export const vendorsBalanceSummaryFilterDrawerSelector = (state) => {
return filterDrawerByTypeSelector('vendorsBalanceSummary')(state);
};
export const customersTransactionsFilterDrawerSelector = (state) => {
return filterDrawerByTypeSelector('customersTransactions')(state);
};
export const vendorsTransactionsFilterDrawerSelector = (state) => {
return filterDrawerByTypeSelector('vendorsTransactions')(state);
};
/** /**
* Retrieve balance sheet filter drawer. * Retrieve balance sheet filter drawer.
*/ */
@@ -156,3 +172,42 @@ export const getInventoryValuationFilterDrawer = createSelector(
return isOpen; return isOpen;
}, },
); );
/**
* Retrieve customers balance summary filter drawer.
*/
export const getCustomersBalanceSummaryFilterDrawer = createSelector(
customerBalanceSummaryFilterDrawerSelector,
(isOpen) => {
return isOpen;
},
);
/**
* Retrieve vendors balance summary filter drawer.
*/
export const getVendorsBalanceSummaryFilterDrawer = createSelector(
vendorsBalanceSummaryFilterDrawerSelector,
(isOpen) => {
return isOpen;
},
);
/**
* Retrieve customers transactions filter drawer.
*/
export const getCustomersTransactionsFilterDrawer = createSelector(
customersTransactionsFilterDrawerSelector,
(isOpen) => {
return isOpen;
},
);
/**
* Retrieve vendors transactions filter drawer.
*/
export const getVendorsTransactionsFilterDrawer = createSelector(
vendorsTransactionsFilterDrawerSelector,
(isOpen) => {
return isOpen;
},
);

View File

@@ -10,4 +10,8 @@ export default {
PURCHASES_BY_ITEMS: 'PURCHASES_BY_ITEMS', PURCHASES_BY_ITEMS: 'PURCHASES_BY_ITEMS',
SALES_BY_ITEMS: 'SALES_BY_ITEMS', SALES_BY_ITEMS: 'SALES_BY_ITEMS',
INVENTORY_VALUATION: 'INVENTORY_VALUATION', INVENTORY_VALUATION: 'INVENTORY_VALUATION',
CUSTOMERS_BALANCE_SUMMARY: 'CUSTOMERS BALANCE SUMMARY',
VENDORS_BALANCE_SUMMARY: 'VENDORS BALANCE SUMMARY',
CUSTOMERS_TRANSACTIONS: 'CUSTOMERS TRANSACTIONS',
// VENDORS_TRANSACTIONS: 'CUSTOMERS TRANSACTIONS',
}; };

View File

@@ -0,0 +1,31 @@
.financial-sheet {
&--customers-balance-summary,
&--vendors-balance-summary {
.financial-sheet__table {
.thead,
.tbody {
.tr .td.customer_name ~ .td,
.tr .th.customer_name ~ .th {
text-align: right;
}
}
.tbody {
.tr:not(.no-results) {
.td {
border-bottom: 0;
padding-top: 0.4rem;
padding-bottom: 0.4rem;
}
&.row-type--TOTAL {
font-weight: 500;
.td {
border-top: 1px solid #bbb;
border-bottom: 3px double #333;
}
}
}
}
}
}
}