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
@@ -0,0 +1,64 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/logic/documents/builders/invoice.builder.js
module.exports = {
sheetName: "Invoice",
build: async (worksheet, data) => {
worksheet.addRow(["INVOICE"]).font = {
bold: true,
size: 18,
};
worksheet.addRow([]);
worksheet.addRow(["Invoice No", data.invoiceNo]);
worksheet.addRow(["Customer", data.customerName]);
worksheet.addRow(["Date", data.date]);
worksheet.addRow([]);
const header = worksheet.addRow([
"Description",
"Qty",
"Rate",
"Amount",
]);
header.font = { bold: true };
let total = 0;
(data.items || []).forEach((item) => {
const amount = item.qty * item.rate;
total += amount;
worksheet.addRow([
item.description,
item.qty,
item.rate,
amount,
]);
});
worksheet.addRow([]);
worksheet.addRow([
"",
"",
"TOTAL",
total,
]).font = {
bold: true,
};
},
};
@@ -0,0 +1,68 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/logic/documents/builders/precost.builder.js
module.exports = {
sheetName: "PreCost Estimate",
build: async (worksheet, data) => {
worksheet.addRow(["PreCost Estimate"]).font = {
bold: true,
size: 16,
};
worksheet.addRow([]);
worksheet.addRow([
"Customer",
data.customerName || "",
]);
worksheet.addRow([]);
const header = worksheet.addRow([
"Item",
"Description",
"Qty",
"Unit Price",
"Total",
]);
header.font = { bold: true };
let total = 0;
(data.items || []).forEach((item) => {
const rowTotal = item.quantity * item.unit_price;
total += rowTotal;
worksheet.addRow([
item.item_name,
item.customer_remark ,
item.quantity,
item.unit_price,
rowTotal,
]);
});
worksheet.addRow([]);
worksheet.addRow([
"",
"",
"",
"Grand Total",
total,
]).font = {
bold: true,
};
},
};