<% const invoiceTitle = typeof title !== 'undefined' && title ? title : 'INVOICE'; const invoiceJobReference = typeof jobReference !== 'undefined' && jobReference ? jobReference : 'N/A'; const invoicePoNumber = typeof poNumber !== 'undefined' && poNumber ? poNumber : 'N/A'; const invoiceDate = typeof date !== 'undefined' && date ? date : 'N/A'; const invoicePageLabel = typeof pageLabel !== 'undefined' && pageLabel ? pageLabel : 'Page 01 of 02'; const invoiceBillToName = typeof billToName !== 'undefined' && billToName ? billToName : 'Client Name'; const invoiceBillToAddress = typeof billToAddress !== 'undefined' && billToAddress ? billToAddress : 'Address'; const invoiceVesselName = typeof vesselName !== 'undefined' && vesselName ? vesselName : 'N/A'; const invoicePurposeOfCall = typeof purposeOfCall !== 'undefined' && purposeOfCall ? purposeOfCall : 'N/A'; const invoiceSupplyDate = typeof supplyDate !== 'undefined' && supplyDate ? supplyDate : 'N/A'; const invoiceGrt = typeof grt !== 'undefined' && grt ? grt : 'N/A'; const invoiceImoNumber = typeof imoNumber !== 'undefined' && imoNumber ? imoNumber : 'N/A'; const invoicePortCountry = typeof portCountry !== 'undefined' && portCountry ? portCountry : 'N/A'; const invoiceItems = typeof items !== 'undefined' && Array.isArray(items) ? items : []; %>
<% if (logoBase64) { %> Company Logo <% } %>
<%= invoiceTitle %>
Bill To: <%= invoiceBillToName %>
<%= invoiceBillToAddress %>
Job Reference : <%= invoiceJobReference %>
PO Number : <%= invoicePoNumber %>
Date : <%= invoiceDate %>
<%= invoicePageLabel %>
Vessel Name : <%= invoiceVesselName %>
Purpose of Call : <%= invoicePurposeOfCall %>
Supply Date : <%= invoiceSupplyDate %>
GRT : <%= invoiceGrt %>
IMO Number : <%= invoiceImoNumber %>
Port/Country : <%= invoicePortCountry %>
<% const rows = Math.max(10, invoiceItems.length); %> <% for (let index = 0; index < rows; index++) { %> <% const item = invoiceItems[index] || {}; %> <% const quantity = Number(item.quantity || item.qty || 0); %> <% const unitPrice = Number(item.unit_price || item.unitPrice || 0); %> <% } %>
No. Description Remarks Qty Unit Unit Price (USD) Final Amount (USD)
<%= index + 1 %> <%= item.description || item.item_name || item.name || '' %> <%= item.remarks || '' %> <%= item.quantity || item.qty || '' %> <%= item.unit || '' %> <%= item.unit_price || item.unitPrice || '' %> <%= quantity && unitPrice ? quantity * unitPrice : (item.total || item.amount || '') %>