Skip to content

Commit b9c6dea

Browse files
author
Your Name
committed
Update PDF charges to period:amount format and fix overlap
1 parent f6fc0e3 commit b9c6dea

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

index.html

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
9292
</main>
9393

9494
<div id="modalRoot"></div>
95-
<footer>New Serchhip North Village Council · v1.29.10</footer>
95+
<footer>New Serchhip North Village Council · v1.29.10</footer>
9696

9797
<script type="module">
9898
/* ============================================================
@@ -2809,13 +2809,16 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28092809
const bal = getEffectiveBalance(c);
28102810
const entries = ledgers[c.id] || await store.getLedger(c.id);
28112811
const payments = entries.filter(e=>e.type==="payment").map(e=>fmtRs(e.amount));
2812-
const charges = entries.filter(e=>e.type==="charge" && !e.deferred).map(e=>fmtRs(e.amount));
2812+
const charges = entries.filter(e=>e.type==="charge" && !e.deferred).map(e=>{
2813+
const period = e.note && e.note.trim() ? e.note.trim() : "Charge";
2814+
return `${period}: ${fmtRs(e.amount)}`;
2815+
});
28132816
rows.push({
28142817
name: c.name || "—",
28152818
jobCard: c.jobCard || c.id,
28162819
amount: fmtRs(bal),
2817-
payments: payments.length ? "Payment: " + payments.join(", ") : "",
2818-
charges: charges.length ? "Charge: " + charges.join(", ") : ""
2820+
payments: payments.length ? "Paid: " + payments.join(", ") : "",
2821+
charges: charges.length ? charges.join(", ") : ""
28192822
});
28202823
}
28212824

@@ -2852,6 +2855,7 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28522855

28532856
// Row 2: job card (left) and charges (right, red)
28542857
y += nameLines.length * 3.8 + 1;
2858+
let rightY = y;
28552859
doc.setFont(undefined, "normal");
28562860
doc.setTextColor(120, 120, 120);
28572861
doc.setFontSize(9);
@@ -2861,22 +2865,25 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28612865
const chargeMaxW = 70;
28622866
const chargeLines = doc.splitTextToSize(r.charges, chargeMaxW);
28632867
doc.setTextColor(180, 40, 40);
2864-
doc.text(chargeLines, rightX, y, { align: "right" });
2868+
doc.text(chargeLines, rightX, rightY, { align: "right" });
2869+
rightY += chargeLines.length * 3.8;
28652870
}
28662871

28672872
// Row 3: payments (right, green)
28682873
if(r.payments){
2869-
y += 3.8;
2874+
rightY += 1;
28702875
const payMaxW = 70;
28712876
const payLines = doc.splitTextToSize(r.payments, payMaxW);
28722877
doc.setTextColor(26, 125, 66);
2873-
doc.text(payLines, rightX, y, { align: "right" });
2878+
doc.text(payLines, rightX, rightY, { align: "right" });
2879+
rightY += payLines.length * 3.8;
28742880
}
28752881

2882+
y = Math.max(y + 3.8, rightY);
28762883
doc.setFontSize(11);
2877-
y += 4;
2884+
y += 2;
28782885
doc.line(margin, y, pageW - margin, y);
2879-
y += 6;
2886+
y += 5;
28802887
}
28812888

28822889
doc.save(`owing_${todayISO()}.pdf`);

sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// install/activate a fresh worker. If it's left stale, already-installed
44
// PWAs keep serving whatever was cached under the old name indefinitely
55
// (this has silently happened before: see the v1.25.6 and v1.28.0 fixes).
6-
const CACHE_NAME = 'nsnvc-tracker-v1.29.10';
6+
const CACHE_NAME = 'nsnvc-tracker-v1.29.10';
77
const urlsToCache = [
88
'./',
99
'./index.html',

0 commit comments

Comments
 (0)