From 7d820c149500a5f85f3d6018c5a658af705629db Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Sat, 8 May 2021 06:09:17 +0200 Subject: [PATCH] fix: customers/vendor reports. --- client/src/config/financialReportsMenu.js | 8 ++++---- client/src/hooks/query/types.js | 7 +++++++ client/src/routes/dashboard.js | 2 +- .../ContactsTransactions.scss | 14 ++++++++++++-- .../TransactionsByCustomersTableRows.ts | 9 +++++++-- .../TransactionsByVendorTableRows.ts | 18 +++++++++++++++--- 6 files changed, 46 insertions(+), 12 deletions(-) diff --git a/client/src/config/financialReportsMenu.js b/client/src/config/financialReportsMenu.js index fc82eef1b..06e848be2 100644 --- a/client/src/config/financialReportsMenu.js +++ b/client/src/config/financialReportsMenu.js @@ -72,22 +72,22 @@ export const SalesAndPurchasesReportMenus = [ }, { title: 'Customer Balance summary', - desc: '', + desc: 'Summerize the total amount of each customer owes your business.', link: '/financial-reports/customers-balance-summary', }, { title: 'Vendors Balance summary', - desc: '', + desc: 'Summerize the total amount your business owes each vendor.', link: '/financial-reports/vendors-balance-summary', }, { title: 'Customers Transactions', - desc: '', + desc: 'Reports every transaction going in and out of each customer.', link: '/financial-reports/transactions-by-customers', }, { title: 'Vendors Transactions', - desc: '', + desc: 'Reports every transaction going in and out of each vendor/supplier.', link: '/financial-reports/transactions-by-vendors', }, ], diff --git a/client/src/hooks/query/types.js b/client/src/hooks/query/types.js index f63e8ce7b..61db1c84e 100644 --- a/client/src/hooks/query/types.js +++ b/client/src/hooks/query/types.js @@ -14,6 +14,13 @@ const FINANCIAL_REPORTS = { JOURNAL: 'JOURNAL', AR_AGING_SUMMARY: 'AR-AGING-SUMMARY', AP_AGING_SUMMARY: 'AP-AGING-SUMMARY', + VENDORS_TRANSACTIONS: 'VENDORS_TRANSACTIONS', + CUSTOMERS_TRANSACTIONS: 'CUSTOMERS_TRANSACTIONS', + VENDORS_BALANCE_SUMMARY: 'VENDORS_BALANCE_SUMMARY', + CUSTOMERS_BALANCE_SUMMARY: 'CUSTOMERS_BALANCE_SUMMARY', + SALES_BY_ITEMS: 'SALES_BY_ITEMS', + PURCHASES_BY_ITEMS: 'PURCHASES_BY_ITEMS', + INVENTORY_VALUATION: 'INVENTORY_VALUATION' }; const BILLS = { diff --git a/client/src/routes/dashboard.js b/client/src/routes/dashboard.js index 89769bcb2..74121459a 100644 --- a/client/src/routes/dashboard.js +++ b/client/src/routes/dashboard.js @@ -244,7 +244,7 @@ export default [ ), ), breadcrumb: 'Customers Balance Summary ', - hint: '..', + hint: 'Summerize how much each customer owes your business.', pageTitle: formatMessage({ id: 'customers_balance_summary' }), backLink: true, sidebarExpand: false, diff --git a/client/src/style/pages/FinancialStatements/ContactsTransactions.scss b/client/src/style/pages/FinancialStatements/ContactsTransactions.scss index aa8591eba..ad68ae9df 100644 --- a/client/src/style/pages/FinancialStatements/ContactsTransactions.scss +++ b/client/src/style/pages/FinancialStatements/ContactsTransactions.scss @@ -1,6 +1,8 @@ .financial-sheet { &--customer-transactions, &--vendor-transactions { + width: 100%; + .financial-sheet__table { .tbody, .thead { @@ -31,7 +33,7 @@ } } .tr:not(.no-results) .td { - // border-left: 1px solid #ececec; + border-left: 1px solid #ececec; } .tr.row-type { @@ -43,7 +45,7 @@ font-weight: 500; } &.name { - border-left-color: transparent; + // border-left-color: transparent; } } &:not(:first-child).is-expanded .td { @@ -55,6 +57,14 @@ &--CLOSING_BALANCE { font-weight: 500; } + &--CUSTOMER, + &--VENDOR { + &.is-expanded{ + .td.running_balance .cell-inner{ + display: none; + } + } + } &--CUSTOMER:last-child { .td { border-bottom: 1px solid #ddd; diff --git a/server/src/services/FinancialStatements/TransactionsByCustomer/TransactionsByCustomersTableRows.ts b/server/src/services/FinancialStatements/TransactionsByCustomer/TransactionsByCustomersTableRows.ts index 505dd96b1..596c89cfb 100644 --- a/server/src/services/FinancialStatements/TransactionsByCustomer/TransactionsByCustomersTableRows.ts +++ b/server/src/services/FinancialStatements/TransactionsByCustomer/TransactionsByCustomersTableRows.ts @@ -26,8 +26,13 @@ export default class TransactionsByCustomersTableRows extends TransactionsByCont return { ...tableRowMapper(customer, columns, { rowTypes: [ROW_TYPE.CUSTOMER] }), children: R.pipe( - R.concat(this.contactTransactions(customer)), - R.prepend(this.contactOpeningBalance(customer)), + R.when( + R.always(customer.transactions.length > 0), + R.pipe( + R.concat(this.contactTransactions(customer)), + R.prepend(this.contactOpeningBalance(customer)), + ), + ), R.append(this.contactClosingBalance(customer)) )([]), }; diff --git a/server/src/services/FinancialStatements/TransactionsByVendor/TransactionsByVendorTableRows.ts b/server/src/services/FinancialStatements/TransactionsByVendor/TransactionsByVendorTableRows.ts index e54082576..ad7933429 100644 --- a/server/src/services/FinancialStatements/TransactionsByVendor/TransactionsByVendorTableRows.ts +++ b/server/src/services/FinancialStatements/TransactionsByVendor/TransactionsByVendorTableRows.ts @@ -17,13 +17,25 @@ export default class TransactionsByVendorsTableRows extends TransactionsByContac * @returns {ITableRow[]} */ private vendorDetails(vendor: ITransactionsByVendorsVendor) { - const columns = [{ key: 'vendorName', accessor: 'vendorName' }]; + const columns = [ + { key: 'vendorName', accessor: 'vendorName' }, + ...R.repeat({ key: 'empty', value: '' }, 5), + { + key: 'closingBalanceValue', + accessor: 'closingBalance.formattedAmount', + }, + ]; return { ...tableRowMapper(vendor, columns, { rowTypes: [ROW_TYPE.VENDOR] }), children: R.pipe( - R.append(this.contactOpeningBalance(vendor)), - R.concat(this.contactTransactions(vendor)), + R.when( + R.always(vendor.transactions.length > 0), + R.pipe( + R.append(this.contactOpeningBalance(vendor)), + R.concat(this.contactTransactions(vendor)) + ) + ), R.append(this.contactClosingBalance(vendor)) )([]), };