first commit
This commit is contained in:
@@ -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,
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user