Skip to content

Commit 15e2890

Browse files
author
Your Name
committed
Fix PDF payment history overflow, use Rs., remove total
1 parent eb7a585 commit 15e2890

2 files changed

Lines changed: 9 additions & 19 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.29.5
1+
1.29.6

index.html

Lines changed: 8 additions & 18 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.5</footer>
95+
<footer>New Serchhip North Village Council · v1.29.6</footer>
9696

9797
<script type="module">
9898
/* ============================================================
@@ -2802,18 +2802,17 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28022802
.filter(c => getEffectiveBalance(c) > 0);
28032803
if(!list.length){ toast("No owing households to export"); return; }
28042804

2805+
const fmtRs = n => "Rs. " + (Number(n)||0).toLocaleString("en-IN");
28052806
const ledgers = ledgerCache.size ? Object.fromEntries(ledgerCache) : await store.getAllLedgers();
2806-
let total = 0;
28072807
const rows = [];
28082808
for(const c of list){
28092809
const bal = getEffectiveBalance(c);
2810-
total += bal;
28112810
const entries = ledgers[c.id] || await store.getLedger(c.id);
2812-
const payments = entries.filter(e=>e.type==="payment").map(e=>fmt(e.amount));
2811+
const payments = entries.filter(e=>e.type==="payment").map(e=>fmtRs(e.amount));
28132812
rows.push({
28142813
name: c.name || "—",
28152814
jobCard: c.jobCard || c.id,
2816-
amount: fmt(bal),
2815+
amount: fmtRs(bal),
28172816
payments: payments.length ? "Payment: " + payments.join(", ") : ""
28182817
});
28192818
}
@@ -2842,7 +2841,7 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28422841
doc.setFont(undefined, "bold");
28432842
doc.setTextColor(40, 40, 40);
28442843
doc.setFontSize(11);
2845-
const nameLines = doc.splitTextToSize(r.name, pageW - margin*2 - 50);
2844+
const nameLines = doc.splitTextToSize(r.name, pageW - margin*2 - 55);
28462845
doc.text(nameLines, margin, y);
28472846

28482847
const amountW = doc.getTextWidth(r.amount);
@@ -2857,10 +2856,10 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28572856
doc.text(r.jobCard, margin, y);
28582857

28592858
if(r.payments){
2860-
const payLines = doc.splitTextToSize(r.payments, pageW - margin*2 - 55);
2861-
const payW = doc.getTextWidth(payLines[payLines.length-1]);
2859+
const payMaxW = 70;
2860+
const payLines = doc.splitTextToSize(r.payments, payMaxW);
28622861
doc.setTextColor(26, 125, 66);
2863-
doc.text(payLines, rightX - payW, y);
2862+
doc.text(payLines, rightX, y, { align: "right" });
28642863
}
28652864

28662865
doc.setFontSize(11);
@@ -2869,15 +2868,6 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28692868
y += 8;
28702869
}
28712870

2872-
// Total
2873-
if(y > doc.internal.pageSize.getHeight() - 20){ doc.addPage(); y = 20; }
2874-
doc.setFont(undefined, "bold");
2875-
doc.setTextColor(40, 40, 40);
2876-
doc.text("Total", margin, y);
2877-
const totalW = doc.getTextWidth(fmt(total));
2878-
doc.setTextColor(180, 40, 40);
2879-
doc.text(fmt(total), rightX - totalW, y);
2880-
28812871
doc.save(`owing_${todayISO()}.pdf`);
28822872
toast("PDF exported");
28832873
});

0 commit comments

Comments
 (0)