first commit

This commit is contained in:
Isuru Bimsara
2026-08-14 22:46:02 +05:30
commit 81d0e65686
132 changed files with 24398 additions and 0 deletions
+308
View File
@@ -0,0 +1,308 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
@page {
size: A4;
margin: 0;
}
body {
background: white;
font-family: Arial, Helvetica, sans-serif;
padding: 12px;
}
.page {
width: 100%;
margin: 0 auto;
background: white;
border: 1px solid #333;
}
.logo-section {
height: 72px;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 1px solid #c9c9c9;
}
.logo-section img {
max-height: 52px;
object-fit: contain;
}
.title-section {
text-align: center;
padding: 5px 0 4px;
border-bottom: 1px solid #333;
font-size: 22px;
font-weight: 700;
color: #2d5c96;
letter-spacing: 0.4px;
}
.top-grid {
display: grid;
grid-template-columns: 1.6fr 1fr;
min-height: 70px;
border-bottom: 1px solid #c9c9c9;
}
.top-left,
.top-right,
.mid-left,
.mid-right {
padding: 4px 6px;
font-size: 10px;
color: #111;
}
.top-left {
border-right: 1px solid #e2e2e2;
display: flex;
align-items: flex-start;
}
.bill-to-label {
font-weight: 700;
min-width: 48px;
}
.bill-to-name {
font-weight: 700;
}
.bill-to-address {
margin-top: 2px;
line-height: 1.25;
}
.top-right {
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 2px;
text-align: right;
font-weight: 700;
}
.top-right-row {
display: flex;
justify-content: flex-end;
gap: 6px;
}
.top-right-row .value {
font-weight: 400;
min-width: 110px;
text-align: left;
}
.info-grid {
display: grid;
grid-template-columns: 1.4fr 1fr;
border-bottom: 1px solid #c9c9c9;
}
.mid-left {
border-right: 1px solid #e2e2e2;
}
.mid-row {
display: flex;
justify-content: space-between;
gap: 10px;
margin-bottom: 2px;
}
.info-label {
font-weight: 700;
}
.info-value {
text-align: right;
min-width: 90px;
}
.items-wrap {
overflow-x: auto;
}
.items-table {
width: 100%;
border-collapse: collapse;
}
.items-table thead th {
background: #a8d9de;
color: #111;
font-weight: bold;
font-size: 10px;
text-align: center;
padding: 5px 4px;
border: 1px solid #4b4b4b;
}
.items-table td {
border: 1px solid #5d5d5d;
font-size: 10px;
height: 15px;
padding: 2px 4px;
vertical-align: middle;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
.col-no { width: 8%; }
.col-desc { width: 30%; }
.col-remarks { width: 24%; }
.col-qty { width: 9%; }
.col-unit { width: 9%; }
.col-price { width: 10%; }
.col-total { width: 10%; }
.spacer-row td {
height: 18px;
}
.bottom-table {
display: grid;
grid-template-columns: 1.4fr 1fr;
border-top: 1px solid #c9c9c9;
}
.bottom-left,
.bottom-right {
padding: 4px 6px;
font-size: 10px;
}
.bottom-left {
border-right: 1px solid #e2e2e2;
}
.bottom-row {
display: flex;
flex-direction: column;
gap: 2px;
}
.bottom-line {
display: flex;
justify-content: space-between;
gap: 8px;
}
.footer-row {
border-top: 1px solid #333;
text-align: right;
padding: 4px 6px;
font-size: 9px;
color: #555;
}
</style>
</head>
<body>
<%
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 : [];
%>
<div class="page">
<div class="logo-section">
<% if (logoBase64) { %>
<img src="<%= logoBase64 %>" alt="Company Logo" />
<% } %>
</div>
<div class="title-section"><%= invoiceTitle %></div>
<div class="top-grid">
<div class="top-left">
<div>
<div><span class="bill-to-label">Bill To:</span> <span class="bill-to-name"><%= invoiceBillToName %></span></div>
<div class="bill-to-address"><%= invoiceBillToAddress %></div>
</div>
</div>
<div class="top-right">
<div class="top-right-row"><span>Job Reference :</span> <span class="value"><%= invoiceJobReference %></span></div>
<div class="top-right-row"><span>PO Number :</span> <span class="value"><%= invoicePoNumber %></span></div>
<div class="top-right-row"><span>Date :</span> <span class="value"><%= invoiceDate %></span></div>
<div class="top-right-row"><span></span> <span class="value"><%= invoicePageLabel %></span></div>
</div>
</div>
<div class="info-grid">
<div class="mid-left">
<div class="mid-row"><span class="info-label">Vessel Name :</span> <span class="info-value"><%= invoiceVesselName %></span></div>
<div class="mid-row"><span class="info-label">Purpose of Call :</span> <span class="info-value"><%= invoicePurposeOfCall %></span></div>
<div class="mid-row"><span class="info-label">Supply Date :</span> <span class="info-value"><%= invoiceSupplyDate %></span></div>
</div>
<div class="mid-right">
<div class="mid-row"><span class="info-label">GRT :</span> <span class="info-value"><%= invoiceGrt %></span></div>
<div class="mid-row"><span class="info-label">IMO Number :</span> <span class="info-value"><%= invoiceImoNumber %></span></div>
<div class="mid-row"><span class="info-label">Port/Country :</span> <span class="info-value"><%= invoicePortCountry %></span></div>
</div>
</div>
<div class="items-wrap">
<table class="items-table">
<thead>
<tr>
<th class="col-no">No.</th>
<th class="col-desc">Description</th>
<th class="col-remarks">Remarks</th>
<th class="col-qty">Qty</th>
<th class="col-unit">Unit</th>
<th class="col-price">Unit Price (USD)</th>
<th class="col-total">Final Amount (USD)</th>
</tr>
</thead>
<tbody>
<% 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); %>
<tr class="spacer-row">
<td class="center"><%= index + 1 %></td>
<td><%= item.description || item.item_name || item.name || '' %></td>
<td><%= item.remarks || '' %></td>
<td class="center"><%= item.quantity || item.qty || '' %></td>
<td class="center"><%= item.unit || '' %></td>
<td class="right"><%= item.unit_price || item.unitPrice || '' %></td>
<td class="right"><%= quantity && unitPrice ? quantity * unitPrice : (item.total || item.amount || '') %></td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
</body>
</html>