fix: move cashflow calculations before the cashflow block reference
This commit is contained in:
parent
2a2ebd4b28
commit
a88d5c4647
|
|
@ -373,6 +373,11 @@ function getTracker(userId, query = {}, now = new Date()) {
|
|||
const periodEndDay = activeRemainingPeriod === '1st' ? 14 : lastDayOfMonth;
|
||||
const periodEndLabel = `${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][month - 1]} ${periodEndDay}`;
|
||||
|
||||
const activeTotalPaid = roundMoney(activeRows.reduce((s, r) => s + r.total_paid, 0));
|
||||
const activePaidTowardDue = roundMoney(activeRows.reduce((s, r) => s + rowPaidTowardDue(r), 0));
|
||||
const activeTotalExpected = roundMoney(activeRows.reduce((s, r) => s + rowDueAmount(r), 0));
|
||||
const activeOutstandingBalance = roundMoney(activeRows.reduce((s, r) => s + Math.max(r.balance || 0, 0), 0));
|
||||
|
||||
const periodBillsTotal = roundMoney(periodRows.reduce((s, r) => s + rowDueAmount(r), 0));
|
||||
const periodPaidCount = periodRows.filter(r => ['paid', 'autodraft'].includes(r.status)).length;
|
||||
const periodTotalCount = periodRows.length;
|
||||
|
|
@ -406,10 +411,6 @@ function getTracker(userId, query = {}, now = new Date()) {
|
|||
month_total_count: monthTotalCount,
|
||||
month_projected: monthProjected,
|
||||
};
|
||||
const activeTotalPaid = roundMoney(activeRows.reduce((s, r) => s + r.total_paid, 0));
|
||||
const activePaidTowardDue = roundMoney(activeRows.reduce((s, r) => s + rowPaidTowardDue(r), 0));
|
||||
const activeTotalExpected = roundMoney(activeRows.reduce((s, r) => s + rowDueAmount(r), 0));
|
||||
const activeOutstandingBalance = roundMoney(activeRows.reduce((s, r) => s + Math.max(r.balance || 0, 0), 0));
|
||||
const totalOverdue = roundMoney(rows
|
||||
.filter(r => !r.is_skipped && (r.status === 'late' || r.status === 'missed'))
|
||||
.reduce((s, r) => s + r.balance, 0));
|
||||
|
|
|
|||
Loading…
Reference in New Issue