11/**
22 * Contractor Settlement PDF
3- * Contractor/process/period, quality & Side breakdown, row details ,
4- * adjustments, final payable, and payment reference.
3+ * Contractor/process/period, quality & Side summary, adjustments ,
4+ * final payable, and payment reference.
55 */
66
77import { getJsPDF , formatDateDDMMYYYY , formatWeight , drawHeader , drawTable , drawFooter } from './pdfHelpers.js' ;
@@ -71,7 +71,7 @@ export async function generateContractorSettlementPdf(settlement) {
7171 const adjustments = Array . isArray ( settlement . adjustments ) ? settlement . adjustments : [ ] ;
7272
7373 let y = drawHeader ( doc , {
74- title : `Contractor Settlement — ${ titleCase ( process ) } ` ,
74+ title : `Contractor Settlement - ${ titleCase ( process ) } ` ,
7575 date : settlement . paymentDate || settlement . periodTo ,
7676 pageWidth,
7777 } ) ;
@@ -94,7 +94,7 @@ export async function generateContractorSettlementPdf(settlement) {
9494 } ) ;
9595 y += Math . ceil ( info . length / 2 ) * 6 + 4 ;
9696
97- // --- Quality & Side breakdown --------------------------------------------
97+ // --- Quality & Side summary -- --------------------------------------------
9898 const groups = groupLines ( process , lines ) ;
9999 if ( groups . length ) {
100100 const showSide = process === 'coning' ;
@@ -144,36 +144,6 @@ export async function generateContractorSettlementPdf(settlement) {
144144 y = drawTable ( doc , { y, title : 'Quality & Side Breakdown' , headers, rows, colWidths, pageWidth } ) ;
145145 }
146146
147- // --- Row detail -----------------------------------------------------------
148- if ( lines . length ) {
149- const showSide = process === 'coning' ;
150- const headers = [
151- { text : 'Date' , align : 'left' } ,
152- { text : 'Barcode / Lot' , align : 'left' , wrap : true } ,
153- { text : 'Quality' , align : 'left' , wrap : true } ,
154- ...( showSide ? [ { text : 'Side' , align : 'center' } ] : [ ] ) ,
155- { text : 'Net KG' , align : 'right' } ,
156- { text : 'Rate' , align : 'right' } ,
157- { text : 'Amount' , align : 'right' } ,
158- ] ;
159- const colWidths = showSide ? [ 22 , 34 , 40 , 14 , 24 , 22 , 24 ] : [ 24 , 40 , 46 , 26 , 22 , 22 ] ;
160- const rows = lines . map ( ( l ) => {
161- const cells = [
162- { text : formatDateDDMMYYYY ( l . date ) } ,
163- { text : l . barcode || l . lotNo || '—' } ,
164- { text : [ qualityLabel ( process , l ) , l . cutName ] . filter ( Boolean ) . join ( ' · ' ) || '—' } ,
165- ] ;
166- if ( showSide ) cells . push ( { text : sideLabel ( l . side ) , align : 'center' } ) ;
167- cells . push (
168- { text : formatWeight ( l . netKg ) , align : 'right' } ,
169- { text : money ( l . ratePerKg ) , align : 'right' } ,
170- { text : money ( l . amount ) , align : 'right' } ,
171- ) ;
172- return { cells } ;
173- } ) ;
174- y = drawTable ( doc , { y, title : 'Production Rows' , headers, rows, colWidths, pageWidth } ) ;
175- }
176-
177147 // --- Adjustments ----------------------------------------------------------
178148 if ( adjustments . length ) {
179149 const headers = [
0 commit comments