feat: AR aging summary sheet frontend.

This commit is contained in:
a.bouhuolia
2021-01-13 20:58:58 +02:00
parent 7680150a31
commit 343185b8bd
27 changed files with 670 additions and 594 deletions

View File

@@ -96,12 +96,14 @@ export default class ARAgingSummarySheet extends AgingSummaryReport {
const customersAgingPeriods = this.customersWalker(this.contacts);
const totalAgingPeriods = this.getTotalAgingPeriods(customersAgingPeriods);
const totalCurrent = this.getTotalCurrent(customersAgingPeriods);
const totalCustomersTotal = this.getTotalContactsTotals(customersAgingPeriods);
return {
customers: customersAgingPeriods,
total: {
current: this.formatTotalAmount(totalCurrent),
aging: totalAgingPeriods,
total: this.formatTotalAmount(totalCustomersTotal),
}
};
}

View File

@@ -79,7 +79,6 @@ export default abstract class AgingSummaryReport extends AgingReport {
return {
...agingPeriod,
total,
formattedAmount: this.formatAmount(total),
};
});
return newAgingPeriods;
@@ -198,4 +197,11 @@ export default abstract class AgingSummaryReport extends AgingReport {
protected getAgingPeriodsTotal(agingPeriods: IAgingPeriodTotal[]): number {
return sumBy(agingPeriods, 'total');
}
protected getTotalContactsTotals(
customersSummary: IARAgingSummaryCustomer[]
): number {
return sumBy(customersSummary, (summary) => summary.total.total);
}
}

View File

@@ -220,8 +220,8 @@ export default class InventoryAdjustmentService {
/**
* Publish the inventory adjustment transaction.
* @param tenantId
* @param inventoryAdjustmentId
* @param tenantId
* @param inventoryAdjustmentId
*/
async publishInventoryAdjustment(
tenantId: number,
@@ -239,11 +239,9 @@ export default class InventoryAdjustmentService {
inventoryAdjustmentId,
});
// Publish the inventory adjustment transaction.
await InventoryAdjustment.query()
.findById(inventoryAdjustmentId)
.patch({
publishedAt: moment().toMySqlDateTime(),
});
await InventoryAdjustment.query().findById(inventoryAdjustmentId).patch({
publishedAt: moment().toMySqlDateTime(),
});
// Retrieve the inventory adjustment after the modification.
const inventoryAdjustment = await InventoryAdjustment.query()