@@ -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.4 </ footer >
95+ < footer > New Serchhip North Village Council · v1.29.5 </ footer >
9696
9797< script type ="module ">
9898/* ============================================================
@@ -2802,12 +2802,21 @@ <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 ledgers = ledgerCache . size ? Object . fromEntries ( ledgerCache ) : await store . getAllLedgers ( ) ;
28052806 let total = 0 ;
2806- const rows = list . map ( c => {
2807+ const rows = [ ] ;
2808+ for ( const c of list ) {
28072809 const bal = getEffectiveBalance ( c ) ;
28082810 total += bal ;
2809- return { name : c . name || "—" , jobCard : c . jobCard || c . id , amount : fmt ( bal ) } ;
2810- } ) ;
2811+ const entries = ledgers [ c . id ] || await store . getLedger ( c . id ) ;
2812+ const payments = entries . filter ( e => e . type === "payment" ) . map ( e => fmt ( e . amount ) ) ;
2813+ rows . push ( {
2814+ name : c . name || "—" ,
2815+ jobCard : c . jobCard || c . id ,
2816+ amount : fmt ( bal ) ,
2817+ payments : payments . length ? "Payment: " + payments . join ( ", " ) : ""
2818+ } ) ;
2819+ }
28112820
28122821 const doc = new jsPDF ( { orientation : "portrait" , unit : "mm" , format : "a4" } ) ;
28132822 const pageW = doc . internal . pageSize . getWidth ( ) ;
@@ -2826,26 +2835,35 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
28262835 y += 14 ;
28272836
28282837 doc . setDrawColor ( 230 , 230 , 230 ) ;
2829- doc . setFontSize ( 11 ) ;
28302838 for ( const r of rows ) {
2831- if ( y > doc . internal . pageSize . getHeight ( ) - 24 ) { doc . addPage ( ) ; y = 20 ; }
2839+ if ( y > doc . internal . pageSize . getHeight ( ) - 28 ) { doc . addPage ( ) ; y = 20 ; }
28322840
2841+ // Row 1: name (left) and amount (right)
28332842 doc . setFont ( undefined , "bold" ) ;
28342843 doc . setTextColor ( 40 , 40 , 40 ) ;
2835- const nameLines = doc . splitTextToSize ( r . name , pageW - margin * 2 - 45 ) ;
2844+ doc . setFontSize ( 11 ) ;
2845+ const nameLines = doc . splitTextToSize ( r . name , pageW - margin * 2 - 50 ) ;
28362846 doc . text ( nameLines , margin , y ) ;
28372847
28382848 const amountW = doc . getTextWidth ( r . amount ) ;
28392849 doc . setTextColor ( 180 , 40 , 40 ) ;
28402850 doc . text ( r . amount , rightX - amountW , y ) ;
28412851
2852+ // Row 2: job card (left) and payment history (right)
2853+ y += nameLines . length * 4.5 + 1 ;
28422854 doc . setFont ( undefined , "normal" ) ;
28432855 doc . setTextColor ( 120 , 120 , 120 ) ;
28442856 doc . setFontSize ( 9 ) ;
2845- y += nameLines . length * 4.5 + 1 ;
28462857 doc . text ( r . jobCard , margin , y ) ;
2847- doc . setFontSize ( 11 ) ;
28482858
2859+ if ( r . payments ) {
2860+ const payLines = doc . splitTextToSize ( r . payments , pageW - margin * 2 - 55 ) ;
2861+ const payW = doc . getTextWidth ( payLines [ payLines . length - 1 ] ) ;
2862+ doc . setTextColor ( 26 , 125 , 66 ) ;
2863+ doc . text ( payLines , rightX - payW , y ) ;
2864+ }
2865+
2866+ doc . setFontSize ( 11 ) ;
28492867 y += 6 ;
28502868 doc . line ( margin , y , pageW - margin , y ) ;
28512869 y += 8 ;
0 commit comments