feat: AR/AP aging summary report.

This commit is contained in:
a.bouhuolia
2021-01-07 16:05:32 +02:00
parent 22b2fd5918
commit 09b2aa57a0
4 changed files with 63 additions and 71 deletions

View File

@@ -52,8 +52,6 @@ export default class ARAgingSummarySheet extends AgingSummaryReport {
this.query.agingDaysBefore,
this.query.agingPeriods
);
this.initContactsAgingPeriods();
this.calcUnpaidInvoicesAgingPeriods();
}
/**
@@ -77,8 +75,8 @@ export default class ARAgingSummarySheet extends AgingSummaryReport {
* @param {ICustomer[]} customers
* @return {IARAgingSummaryCustomer[]}
*/
private customersWalker(): IARAgingSummaryCustomer[] {
return this.contacts
private customersWalker(customers: ICustomer[]): IARAgingSummaryCustomer[] {
return customers
.map((customer) => this.customerData(customer))
.filter(
(customer: IARAgingSummaryCustomer) =>
@@ -91,9 +89,12 @@ export default class ARAgingSummarySheet extends AgingSummaryReport {
* @return {IARAgingSummaryData}
*/
public reportData(): IARAgingSummaryData {
const customersAgingPeriods = this.customersWalker(this.contacts);
const totalAgingPeriods = this.getTotalAgingPeriods(customersAgingPeriods);
return {
customers: this.customersWalker(),
total: this.getTotalAgingPeriods(),
customers: customersAgingPeriods,
total: totalAgingPeriods,
};
}