fix: apply last-row rounding correction to Excel export
This commit is contained in:
@@ -456,11 +456,14 @@ function exportExcel() {
|
||||
installments.forEach((inst, i) => {
|
||||
const days = parseFloat(inst.days) || 0;
|
||||
const pct = parseFloat(inst.percent) || 0;
|
||||
const isLast = i === installments.length - 1;
|
||||
cumDays += days;
|
||||
const total = Math.round(contract * pct / 100);
|
||||
const ngpm = Math.round(total * ngpmPct / 100);
|
||||
|
||||
const total = isLast ? (contract - cumTotal) : Math.round(contract * pct / 100);
|
||||
const ngpm = isLast ? (Math.round(contract * ngpmPct / 100) - cumNgpm) : Math.round(total * ngpmPct / 100);
|
||||
const nook = total - ngpm;
|
||||
cumTotal += total; cumNgpm += ngpm; cumNook += nook;
|
||||
|
||||
const delivery = toThaiDate(addDays(startDate, cumDays));
|
||||
rows.push([i+1, days, pct, delivery, total, ngpm, nook, cumTotal, cumNgpm, cumNook]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user