fix: customers/vendor reports.

This commit is contained in:
a.bouhuolia
2021-05-08 06:09:17 +02:00
parent 93dca653f9
commit 7d820c1495
6 changed files with 46 additions and 12 deletions

View File

@@ -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))
)([]),
};

View File

@@ -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))
)([]),
};