@tonzxz/government-forms 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FORM_CATALOG.md +44 -0
- package/README.md +165 -0
- package/dist/definitions.d.ts +1147 -0
- package/dist/definitions.js +60 -0
- package/dist/forms/iar.d.ts +172 -0
- package/dist/forms/iar.js +6 -0
- package/dist/forms/ics.d.ts +48 -0
- package/dist/forms/ics.js +6 -0
- package/dist/forms/iirup.d.ts +54 -0
- package/dist/forms/iirup.js +6 -0
- package/dist/forms/iirusp.d.ts +32 -0
- package/dist/forms/iirusp.js +6 -0
- package/dist/forms/itr.d.ts +42 -0
- package/dist/forms/itr.js +6 -0
- package/dist/forms/par.d.ts +84 -0
- package/dist/forms/par.js +6 -0
- package/dist/forms/ppelc.d.ts +34 -0
- package/dist/forms/ppelc.js +6 -0
- package/dist/forms/pr.d.ts +27 -0
- package/dist/forms/pr.js +6 -0
- package/dist/forms/property-card.d.ts +68 -0
- package/dist/forms/property-card.js +6 -0
- package/dist/forms/ptr.d.ts +54 -0
- package/dist/forms/ptr.js +6 -0
- package/dist/forms/regspi.d.ts +32 -0
- package/dist/forms/regspi.js +6 -0
- package/dist/forms/ris.d.ts +66 -0
- package/dist/forms/ris.js +6 -0
- package/dist/forms/rlsddp.d.ts +54 -0
- package/dist/forms/rlsddp.js +6 -0
- package/dist/forms/rlsddsp.d.ts +42 -0
- package/dist/forms/rlsddsp.js +6 -0
- package/dist/forms/rpci.d.ts +32 -0
- package/dist/forms/rpci.js +6 -0
- package/dist/forms/rpcppe.d.ts +32 -0
- package/dist/forms/rpcppe.js +6 -0
- package/dist/forms/rpcsp.d.ts +32 -0
- package/dist/forms/rpcsp.js +6 -0
- package/dist/forms/rrsp.d.ts +32 -0
- package/dist/forms/rrsp.js +6 -0
- package/dist/forms/rsmi.d.ts +32 -0
- package/dist/forms/rsmi.js +6 -0
- package/dist/forms/rsmp.d.ts +33 -0
- package/dist/forms/rsmp.js +6 -0
- package/dist/forms/rspi.d.ts +32 -0
- package/dist/forms/rspi.js +6 -0
- package/dist/forms/spc.d.ts +37 -0
- package/dist/forms/spc.js +6 -0
- package/dist/forms/splc.d.ts +41 -0
- package/dist/forms/splc.js +6 -0
- package/dist/forms/stock-card.d.ts +28 -0
- package/dist/forms/stock-card.js +6 -0
- package/dist/forms/wmr.d.ts +32 -0
- package/dist/forms/wmr.js +6 -0
- package/dist/gam/components/gam-report-workbench.d.ts +40 -0
- package/dist/gam/components/gam-report-workbench.js +2 -0
- package/dist/gam/components/grand-total-computation.d.ts +10 -0
- package/dist/gam/components/grand-total-computation.js +26 -0
- package/dist/gam/components/iar-preview.d.ts +30 -0
- package/dist/gam/components/iar-preview.js +150 -0
- package/dist/gam/components/ics-preview.d.ts +31 -0
- package/dist/gam/components/ics-preview.js +114 -0
- package/dist/gam/components/iirup-preview.d.ts +42 -0
- package/dist/gam/components/iirup-preview.js +237 -0
- package/dist/gam/components/itr-preview.d.ts +31 -0
- package/dist/gam/components/itr-preview.js +180 -0
- package/dist/gam/components/par-preview.d.ts +28 -0
- package/dist/gam/components/par-preview.js +95 -0
- package/dist/gam/components/ppelc-preview.d.ts +28 -0
- package/dist/gam/components/ppelc-preview.js +128 -0
- package/dist/gam/components/property-card-preview.d.ts +21 -0
- package/dist/gam/components/property-card-preview.js +117 -0
- package/dist/gam/components/ptr-preview.d.ts +36 -0
- package/dist/gam/components/ptr-preview.js +122 -0
- package/dist/gam/components/purchase-order-page-client.d.ts +66 -0
- package/dist/gam/components/purchase-order-page-client.js +179 -0
- package/dist/gam/components/reg-spi-preview.d.ts +28 -0
- package/dist/gam/components/reg-spi-preview.js +138 -0
- package/dist/gam/components/ris-form.d.ts +13 -0
- package/dist/gam/components/ris-form.js +20 -0
- package/dist/gam/components/ris-preview.d.ts +7 -0
- package/dist/gam/components/ris-preview.js +16 -0
- package/dist/gam/components/rlsddp-preview.d.ts +34 -0
- package/dist/gam/components/rlsddp-preview.js +251 -0
- package/dist/gam/components/rlsddsp-preview.d.ts +33 -0
- package/dist/gam/components/rlsddsp-preview.js +226 -0
- package/dist/gam/components/rpci-preview.d.ts +27 -0
- package/dist/gam/components/rpci-preview.js +123 -0
- package/dist/gam/components/rpcppe-preview.d.ts +28 -0
- package/dist/gam/components/rpcppe-preview.js +133 -0
- package/dist/gam/components/rpcsp-preview.d.ts +29 -0
- package/dist/gam/components/rpcsp-preview.js +81 -0
- package/dist/gam/components/rspi-preview.d.ts +23 -0
- package/dist/gam/components/rspi-preview.js +72 -0
- package/dist/gam/components/spc-preview.d.ts +23 -0
- package/dist/gam/components/spc-preview.js +149 -0
- package/dist/gam/components/splc-entry-form.d.ts +14 -0
- package/dist/gam/components/splc-entry-form.js +6 -0
- package/dist/gam/components/splc-preview.d.ts +27 -0
- package/dist/gam/components/splc-preview.js +192 -0
- package/dist/gam/components/stock-card-preview.d.ts +14 -0
- package/dist/gam/components/stock-card-preview.js +17 -0
- package/dist/gam/config/new-report-config.d.ts +1094 -0
- package/dist/gam/config/new-report-config.js +1478 -0
- package/dist/gam/purchase-order-flow.d.ts +146 -0
- package/dist/gam/purchase-order-flow.js +173 -0
- package/dist/gam/purchase-request/workflow.d.ts +19 -0
- package/dist/gam/purchase-request/workflow.js +45 -0
- package/dist/gam/types/ris-types.d.ts +37 -0
- package/dist/gam/types/ris-types.js +1 -0
- package/dist/gam/utils/export-ics-xlsx.d.ts +28 -0
- package/dist/gam/utils/export-ics-xlsx.js +273 -0
- package/dist/gam/utils/export-par-xlsx.d.ts +18 -0
- package/dist/gam/utils/export-par-xlsx.js +181 -0
- package/dist/gam/utils/export-preview-pdf.d.ts +13 -0
- package/dist/gam/utils/export-preview-pdf.js +270 -0
- package/dist/gam/utils/export-report-xlsx.d.ts +228 -0
- package/dist/gam/utils/export-report-xlsx.js +873 -0
- package/dist/gam/utils/line-totals.d.ts +6 -0
- package/dist/gam/utils/line-totals.js +18 -0
- package/dist/gam/utils/monetary-input.d.ts +6 -0
- package/dist/gam/utils/monetary-input.js +18 -0
- package/dist/gam/utils/print-element.d.ts +8 -0
- package/dist/gam/utils/print-element.js +157 -0
- package/dist/government-form.d.ts +16 -0
- package/dist/government-form.js +45 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +50 -0
- package/dist/internal/components/configurable-form-layout.d.ts +20 -0
- package/dist/internal/components/configurable-form-layout.js +49 -0
- package/dist/internal/components/ui/badge.d.ts +7 -0
- package/dist/internal/components/ui/badge.js +34 -0
- package/dist/internal/components/ui/button.d.ts +10 -0
- package/dist/internal/components/ui/button.js +35 -0
- package/dist/internal/components/ui/calendar.d.ts +8 -0
- package/dist/internal/components/ui/calendar.js +77 -0
- package/dist/internal/components/ui/command.d.ts +19 -0
- package/dist/internal/components/ui/command.js +36 -0
- package/dist/internal/components/ui/date-input.d.ts +14 -0
- package/dist/internal/components/ui/date-input.js +33 -0
- package/dist/internal/components/ui/date-picker.d.ts +19 -0
- package/dist/internal/components/ui/date-picker.js +34 -0
- package/dist/internal/components/ui/dialog.d.ts +18 -0
- package/dist/internal/components/ui/dialog.js +38 -0
- package/dist/internal/components/ui/input-group.d.ts +18 -0
- package/dist/internal/components/ui/input-group.js +57 -0
- package/dist/internal/components/ui/input.d.ts +3 -0
- package/dist/internal/components/ui/input.js +12 -0
- package/dist/internal/components/ui/label.d.ts +3 -0
- package/dist/internal/components/ui/label.js +7 -0
- package/dist/internal/components/ui/popover.d.ts +9 -0
- package/dist/internal/components/ui/popover.js +23 -0
- package/dist/internal/components/ui/select.d.ts +17 -0
- package/dist/internal/components/ui/select.js +35 -0
- package/dist/internal/components/ui/switch.d.ts +5 -0
- package/dist/internal/components/ui/switch.js +8 -0
- package/dist/internal/components/ui/table.d.ts +10 -0
- package/dist/internal/components/ui/table.js +28 -0
- package/dist/internal/components/ui/tabs.d.ts +10 -0
- package/dist/internal/components/ui/tabs.js +29 -0
- package/dist/internal/components/ui/textarea.d.ts +3 -0
- package/dist/internal/components/ui/textarea.js +7 -0
- package/dist/internal/components/ui/tooltip.d.ts +6 -0
- package/dist/internal/components/ui/tooltip.js +17 -0
- package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.d.ts +112 -0
- package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.js +91 -0
- package/dist/internal/hooks/use-form-field-order.d.ts +7 -0
- package/dist/internal/hooks/use-form-field-order.js +43 -0
- package/dist/internal/lib/utils.d.ts +2 -0
- package/dist/internal/lib/utils.js +3 -0
- package/dist/inventory/components/inventory-item-form.d.ts +7 -0
- package/dist/inventory/components/inventory-item-form.js +5 -0
- package/dist/inventory/components/inventory-item-preview.d.ts +6 -0
- package/dist/inventory/components/inventory-item-preview.js +5 -0
- package/dist/inventory/iar.d.ts +4 -0
- package/dist/inventory/iar.js +4 -0
- package/dist/inventory/ics.d.ts +2 -0
- package/dist/inventory/ics.js +3 -0
- package/dist/inventory/iirup.d.ts +2 -0
- package/dist/inventory/iirup.js +3 -0
- package/dist/inventory/iirusp.d.ts +4 -0
- package/dist/inventory/iirusp.js +4 -0
- package/dist/inventory/index.d.ts +3 -0
- package/dist/inventory/index.js +4 -0
- package/dist/inventory/item.d.ts +3 -0
- package/dist/inventory/item.js +3 -0
- package/dist/inventory/itr.d.ts +4 -0
- package/dist/inventory/itr.js +4 -0
- package/dist/inventory/par.d.ts +2 -0
- package/dist/inventory/par.js +3 -0
- package/dist/inventory/po.d.ts +2 -0
- package/dist/inventory/po.js +2 -0
- package/dist/inventory/ppelc.d.ts +2 -0
- package/dist/inventory/ppelc.js +3 -0
- package/dist/inventory/pplc.d.ts +2 -0
- package/dist/inventory/pplc.js +4 -0
- package/dist/inventory/pr.d.ts +4 -0
- package/dist/inventory/pr.js +4 -0
- package/dist/inventory/property-card.d.ts +2 -0
- package/dist/inventory/property-card.js +3 -0
- package/dist/inventory/ptr.d.ts +2 -0
- package/dist/inventory/ptr.js +3 -0
- package/dist/inventory/regspi.d.ts +4 -0
- package/dist/inventory/regspi.js +4 -0
- package/dist/inventory/ris.d.ts +4 -0
- package/dist/inventory/ris.js +4 -0
- package/dist/inventory/rlsddp.d.ts +4 -0
- package/dist/inventory/rlsddp.js +4 -0
- package/dist/inventory/rlsddsp.d.ts +2 -0
- package/dist/inventory/rlsddsp.js +3 -0
- package/dist/inventory/rpci.d.ts +2 -0
- package/dist/inventory/rpci.js +3 -0
- package/dist/inventory/rpcppe.d.ts +2 -0
- package/dist/inventory/rpcppe.js +3 -0
- package/dist/inventory/rpcsp.d.ts +2 -0
- package/dist/inventory/rpcsp.js +3 -0
- package/dist/inventory/rrsp.d.ts +2 -0
- package/dist/inventory/rrsp.js +3 -0
- package/dist/inventory/rsmi.d.ts +4 -0
- package/dist/inventory/rsmi.js +4 -0
- package/dist/inventory/rsmp.d.ts +4 -0
- package/dist/inventory/rsmp.js +4 -0
- package/dist/inventory/rspi.d.ts +2 -0
- package/dist/inventory/rspi.js +3 -0
- package/dist/inventory/spc.d.ts +2 -0
- package/dist/inventory/spc.js +3 -0
- package/dist/inventory/splc.d.ts +3 -0
- package/dist/inventory/splc.js +4 -0
- package/dist/inventory/stock-card.d.ts +4 -0
- package/dist/inventory/stock-card.js +4 -0
- package/dist/inventory/types.d.ts +11 -0
- package/dist/inventory/types.js +1 -0
- package/dist/inventory/wmr.d.ts +4 -0
- package/dist/inventory/wmr.js +4 -0
- package/dist/lib/rpcsp-accountable-person.d.ts +1 -0
- package/dist/lib/rpcsp-accountable-person.js +10 -0
- package/dist/reports/iar/_components/create-form.d.ts +13 -0
- package/dist/reports/iar/_components/create-form.js +92 -0
- package/dist/reports/iar/_components/document-preview.d.ts +11 -0
- package/dist/reports/iar/_components/document-preview.js +131 -0
- package/dist/reports/iar/types.d.ts +97 -0
- package/dist/reports/iar/types.js +24 -0
- package/dist/reports/iirusp/_components/create-form.d.ts +17 -0
- package/dist/reports/iirusp/_components/create-form.js +118 -0
- package/dist/reports/iirusp/_components/document-preview.d.ts +8 -0
- package/dist/reports/iirusp/_components/document-preview.js +389 -0
- package/dist/reports/iirusp/types.d.ts +134 -0
- package/dist/reports/iirusp/types.js +29 -0
- package/dist/reports/iirusp/utils.d.ts +29 -0
- package/dist/reports/iirusp/utils.js +488 -0
- package/dist/reports/itr/_components/create-form.d.ts +28 -0
- package/dist/reports/itr/_components/create-form.js +90 -0
- package/dist/reports/itr/_components/document-preview.d.ts +6 -0
- package/dist/reports/itr/_components/document-preview.js +7 -0
- package/dist/reports/itr/types.d.ts +68 -0
- package/dist/reports/itr/types.js +27 -0
- package/dist/reports/itr/utils.d.ts +24 -0
- package/dist/reports/itr/utils.js +76 -0
- package/dist/reports/pr/_components/create-form.d.ts +16 -0
- package/dist/reports/pr/_components/create-form.js +52 -0
- package/dist/reports/pr/_components/document-preview.d.ts +7 -0
- package/dist/reports/pr/_components/document-preview.js +9 -0
- package/dist/reports/pr/types.d.ts +69 -0
- package/dist/reports/pr/types.js +1 -0
- package/dist/reports/pr/utils.d.ts +72 -0
- package/dist/reports/pr/utils.js +572 -0
- package/dist/reports/regspi/_components/create-form.d.ts +19 -0
- package/dist/reports/regspi/_components/create-form.js +33 -0
- package/dist/reports/regspi/_components/document-preview.d.ts +6 -0
- package/dist/reports/regspi/_components/document-preview.js +7 -0
- package/dist/reports/regspi/types.d.ts +29 -0
- package/dist/reports/regspi/types.js +24 -0
- package/dist/reports/regspi/utils.d.ts +48 -0
- package/dist/reports/regspi/utils.js +98 -0
- package/dist/reports/ris/_components/create-form.d.ts +36 -0
- package/dist/reports/ris/_components/create-form.js +149 -0
- package/dist/reports/ris/_components/document-preview.d.ts +8 -0
- package/dist/reports/ris/_components/document-preview.js +31 -0
- package/dist/reports/ris/types.d.ts +93 -0
- package/dist/reports/ris/types.js +1 -0
- package/dist/reports/rlsddp/_components/create-form.d.ts +11 -0
- package/dist/reports/rlsddp/_components/create-form.js +165 -0
- package/dist/reports/rlsddp/_components/document-preview.d.ts +8 -0
- package/dist/reports/rlsddp/_components/document-preview.js +15 -0
- package/dist/reports/rlsddp/types.d.ts +105 -0
- package/dist/reports/rlsddp/types.js +31 -0
- package/dist/reports/rrsp/components/rrsp-preview.d.ts +21 -0
- package/dist/reports/rrsp/components/rrsp-preview.js +155 -0
- package/dist/reports/rsmi/components/rsmi-create-form.d.ts +20 -0
- package/dist/reports/rsmi/components/rsmi-create-form.js +8 -0
- package/dist/reports/rsmi/components/rsmi-document-body.d.ts +15 -0
- package/dist/reports/rsmi/components/rsmi-document-body.js +12 -0
- package/dist/reports/rsmi/components/rsmi-types.d.ts +45 -0
- package/dist/reports/rsmi/components/rsmi-types.js +1 -0
- package/dist/reports/rsmi/components/rsmi-utils.d.ts +2 -0
- package/dist/reports/rsmi/components/rsmi-utils.js +18 -0
- package/dist/reports/rsmp/components/rsmp-create-modal.d.ts +5 -0
- package/dist/reports/rsmp/components/rsmp-create-modal.js +7 -0
- package/dist/reports/rsmp/components/rsmp-preview-modal.d.ts +11 -0
- package/dist/reports/rsmp/components/rsmp-preview-modal.js +47 -0
- package/dist/reports/rsmp/components/rsmp-types.d.ts +44 -0
- package/dist/reports/rsmp/components/rsmp-types.js +1 -0
- package/dist/reports/rsmp/components/rsmp-utils.d.ts +5 -0
- package/dist/reports/rsmp/components/rsmp-utils.js +41 -0
- package/dist/reports/rsmp/lib/rsmp-grouping.d.ts +14 -0
- package/dist/reports/rsmp/lib/rsmp-grouping.js +75 -0
- package/dist/reports/stock-card/_components/create-form.d.ts +13 -0
- package/dist/reports/stock-card/_components/create-form.js +39 -0
- package/dist/reports/stock-card/_components/document-preview.d.ts +7 -0
- package/dist/reports/stock-card/_components/document-preview.js +29 -0
- package/dist/reports/stock-card/types.d.ts +31 -0
- package/dist/reports/stock-card/types.js +1 -0
- package/dist/reports/stock-card/utils.d.ts +32 -0
- package/dist/reports/stock-card/utils.js +248 -0
- package/dist/reports/wmr/_components/create-form.d.ts +22 -0
- package/dist/reports/wmr/_components/create-form.js +61 -0
- package/dist/reports/wmr/_components/document-preview.d.ts +10 -0
- package/dist/reports/wmr/_components/document-preview.js +59 -0
- package/dist/reports/wmr/types.d.ts +45 -0
- package/dist/reports/wmr/types.js +1 -0
- package/dist/reports/wmr/utils.d.ts +32 -0
- package/dist/reports/wmr/utils.js +343 -0
- package/dist/styles.css +4492 -0
- package/extraction-manifest.json +620 -0
- package/package.json +197 -0
|
@@ -0,0 +1,873 @@
|
|
|
1
|
+
import * as XLSX from "xlsx-js-style";
|
|
2
|
+
const BLACK = { rgb: "000000" };
|
|
3
|
+
function fileToken(value) {
|
|
4
|
+
return value.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
5
|
+
}
|
|
6
|
+
function display(value) {
|
|
7
|
+
return value?.trim() ?? "";
|
|
8
|
+
}
|
|
9
|
+
function fmtDate(value) {
|
|
10
|
+
if (!value)
|
|
11
|
+
return "";
|
|
12
|
+
const date = new Date(value);
|
|
13
|
+
return Number.isNaN(date.getTime()) ? value : date.toLocaleDateString("en-PH");
|
|
14
|
+
}
|
|
15
|
+
function fmtQty(value) {
|
|
16
|
+
if (!value || value.trim() === "")
|
|
17
|
+
return "";
|
|
18
|
+
const n = Number(value);
|
|
19
|
+
if (Number.isNaN(n))
|
|
20
|
+
return value;
|
|
21
|
+
return n === 0 ? "" : Number.isInteger(n) ? n.toString() : n.toFixed(2);
|
|
22
|
+
}
|
|
23
|
+
function fmtAmount(value) {
|
|
24
|
+
if (!value || value.trim() === "")
|
|
25
|
+
return "";
|
|
26
|
+
const n = Number(value);
|
|
27
|
+
if (Number.isNaN(n))
|
|
28
|
+
return value;
|
|
29
|
+
return n === 0
|
|
30
|
+
? ""
|
|
31
|
+
: n.toLocaleString("en-PH", {
|
|
32
|
+
minimumFractionDigits: 2,
|
|
33
|
+
maximumFractionDigits: 2,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function mm(value) {
|
|
37
|
+
return value * 2.83465;
|
|
38
|
+
}
|
|
39
|
+
function border(style = "thin") {
|
|
40
|
+
const side = { style, color: BLACK };
|
|
41
|
+
return { top: side, right: side, bottom: side, left: side };
|
|
42
|
+
}
|
|
43
|
+
function style(options = {}) {
|
|
44
|
+
return {
|
|
45
|
+
font: {
|
|
46
|
+
name: "Times New Roman",
|
|
47
|
+
sz: options.size ?? 10,
|
|
48
|
+
bold: options.bold,
|
|
49
|
+
italic: options.italic,
|
|
50
|
+
underline: options.underline,
|
|
51
|
+
color: BLACK,
|
|
52
|
+
},
|
|
53
|
+
alignment: {
|
|
54
|
+
horizontal: options.horizontal ?? "left",
|
|
55
|
+
vertical: options.vertical ?? "center",
|
|
56
|
+
wrapText: options.wrap ?? true,
|
|
57
|
+
},
|
|
58
|
+
border: options.borderStyle === false ? undefined : border(options.borderStyle ?? "thin"),
|
|
59
|
+
fill: options.fill ? { fgColor: { rgb: options.fill }, patternType: "solid" } : undefined,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const noBorder = style({ borderStyle: false });
|
|
63
|
+
const titleStyle = style({ size: 14, bold: true, horizontal: "center", borderStyle: false });
|
|
64
|
+
const annexStyle = style({ size: 9, italic: true, horizontal: "right", borderStyle: false });
|
|
65
|
+
const labelStyle = style({ size: 10, bold: true, borderStyle: false });
|
|
66
|
+
const metaStyle = style({ size: 9.5, bold: true });
|
|
67
|
+
const tableHeaderStyle = style({ size: 9, bold: true, horizontal: "center", borderStyle: "medium" });
|
|
68
|
+
const bodyStyle = style({ size: 8, vertical: "center" });
|
|
69
|
+
const bodyCenterStyle = style({ size: 8, horizontal: "center" });
|
|
70
|
+
const bodyRightStyle = style({ size: 8, horizontal: "right" });
|
|
71
|
+
function makeRows(rowCount, colCount, cellStyle = noBorder) {
|
|
72
|
+
return Array.from({ length: rowCount }, () => Array.from({ length: colCount }, () => ({ value: "", style: cellStyle })));
|
|
73
|
+
}
|
|
74
|
+
function setCell(rows, row, col, value, cellStyle) {
|
|
75
|
+
rows[row][col] = { value, style: cellStyle ?? rows[row][col].style };
|
|
76
|
+
}
|
|
77
|
+
function styleRange(rows, startRow, startCol, endRow, endCol, cellStyle) {
|
|
78
|
+
for (let r = startRow; r <= endRow; r++) {
|
|
79
|
+
for (let c = startCol; c <= endCol; c++) {
|
|
80
|
+
rows[r][c] = { ...rows[r][c], style: cellStyle };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function merge(merges, startRow, startCol, endRow, endCol) {
|
|
85
|
+
merges.push({ s: { r: startRow, c: startCol }, e: { r: endRow, c: endCol } });
|
|
86
|
+
}
|
|
87
|
+
function writeWorkbook(spec) {
|
|
88
|
+
const ws = {};
|
|
89
|
+
let maxCol = 0;
|
|
90
|
+
spec.rows.forEach((row, rowIndex) => {
|
|
91
|
+
row.forEach((cell, colIndex) => {
|
|
92
|
+
const ref = XLSX.utils.encode_cell({ r: rowIndex, c: colIndex });
|
|
93
|
+
ws[ref] = {
|
|
94
|
+
v: cell.value,
|
|
95
|
+
t: typeof cell.value === "number" ? "n" : "s",
|
|
96
|
+
s: cell.style,
|
|
97
|
+
};
|
|
98
|
+
maxCol = Math.max(maxCol, colIndex);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
ws["!ref"] = XLSX.utils.encode_range({
|
|
102
|
+
s: { r: 0, c: 0 },
|
|
103
|
+
e: { r: spec.rows.length - 1, c: maxCol },
|
|
104
|
+
});
|
|
105
|
+
ws["!cols"] = spec.cols.map(wch => ({ wch }));
|
|
106
|
+
ws["!rows"] = spec.rowHeights.map(hpt => ({ hpt }));
|
|
107
|
+
ws["!merges"] = spec.merges;
|
|
108
|
+
ws["!margins"] =
|
|
109
|
+
spec.orientation === "landscape"
|
|
110
|
+
? { left: 0.25, right: 0.25, top: 0.35, bottom: 0.35, header: 0, footer: 0 }
|
|
111
|
+
: { left: 0.25, right: 0.25, top: 0.35, bottom: 0.35, header: 0, footer: 0 };
|
|
112
|
+
ws["!pageSetup"] = {
|
|
113
|
+
orientation: spec.orientation,
|
|
114
|
+
paperSize: 9,
|
|
115
|
+
fitToPage: true,
|
|
116
|
+
fitToWidth: 1,
|
|
117
|
+
fitToHeight: 1,
|
|
118
|
+
};
|
|
119
|
+
ws["!protect"] = undefined;
|
|
120
|
+
const wb = XLSX.utils.book_new();
|
|
121
|
+
XLSX.utils.book_append_sheet(wb, ws, spec.name);
|
|
122
|
+
XLSX.writeFile(wb, spec.filename, { bookType: "xlsx", cellStyles: true });
|
|
123
|
+
}
|
|
124
|
+
function buildIarSpec(data, filename) {
|
|
125
|
+
const colCount = 4;
|
|
126
|
+
const itemRows = 14;
|
|
127
|
+
const rows = makeRows(1 + 1 + 1 + 1 + itemRows + 1 + 1, colCount);
|
|
128
|
+
const rowHeights = [
|
|
129
|
+
mm(26),
|
|
130
|
+
mm(8.2),
|
|
131
|
+
mm(26),
|
|
132
|
+
mm(10.5),
|
|
133
|
+
...Array.from({ length: itemRows }, () => mm(7.55)),
|
|
134
|
+
mm(7),
|
|
135
|
+
mm(47),
|
|
136
|
+
];
|
|
137
|
+
const merges = [];
|
|
138
|
+
const thickCell = style({ size: 11, borderStyle: "medium", vertical: "top" });
|
|
139
|
+
merge(merges, 0, 0, 0, 3);
|
|
140
|
+
merge(merges, 1, 0, 1, 1);
|
|
141
|
+
merge(merges, 1, 2, 1, 3);
|
|
142
|
+
merge(merges, 2, 0, 2, 1);
|
|
143
|
+
merge(merges, 2, 2, 2, 3);
|
|
144
|
+
styleRange(rows, 0, 0, 0, 3, style({ size: 16, bold: true, horizontal: "center", borderStyle: "medium" }));
|
|
145
|
+
setCell(rows, 0, 0, "INSPECTION AND ACCEPTANCE REPORT");
|
|
146
|
+
styleRange(rows, 1, 0, 1, 3, style({ size: 12, bold: true, borderStyle: "medium" }));
|
|
147
|
+
setCell(rows, 1, 0, `Entity Name : ${display(data.entityName)}`);
|
|
148
|
+
setCell(rows, 1, 2, `Fund Cluster : ${display(data.fundCluster)}`);
|
|
149
|
+
styleRange(rows, 2, 0, 2, 3, thickCell);
|
|
150
|
+
setCell(rows, 2, 0, [
|
|
151
|
+
`Supplier : ${display(data.supplier)}`,
|
|
152
|
+
`Requisitioning Office/Dept.: ${display(data.requestingOffice)}`,
|
|
153
|
+
`Responsibility Center Code : ${display(data.responsibilityCenterCode)}`,
|
|
154
|
+
].join("\n"));
|
|
155
|
+
setCell(rows, 2, 2, [
|
|
156
|
+
`IAR No.: ${display(data.iarNo)}`,
|
|
157
|
+
`Date : ${fmtDate(data.iarDate)}`,
|
|
158
|
+
`CR/SI No.: ${display(data.crsiNo)}`,
|
|
159
|
+
`Date : ${fmtDate(data.crsiDate)}`,
|
|
160
|
+
].join("\n"));
|
|
161
|
+
styleRange(rows, 3, 0, 3, 3, tableHeaderStyle);
|
|
162
|
+
setCell(rows, 3, 0, "Stock/\nProperty No.");
|
|
163
|
+
setCell(rows, 3, 1, "Description");
|
|
164
|
+
setCell(rows, 3, 2, "Unit");
|
|
165
|
+
setCell(rows, 3, 3, "Quantity");
|
|
166
|
+
const visibleItems = data.items.filter(item => [item.stockNo, item.description, item.unit, item.quantity].some(value => display(value).length > 0));
|
|
167
|
+
const nothingIndex = Math.min(Math.max(visibleItems.length, 2), itemRows - 1);
|
|
168
|
+
for (let i = 0; i < itemRows; i++) {
|
|
169
|
+
const rowIndex = 4 + i;
|
|
170
|
+
const item = visibleItems[i];
|
|
171
|
+
styleRange(rows, rowIndex, 0, rowIndex, 3, bodyCenterStyle);
|
|
172
|
+
setCell(rows, rowIndex, 0, display(item?.stockNo));
|
|
173
|
+
setCell(rows, rowIndex, 1, item?.description ? item.description : i === nothingIndex ? "***NOTHING FOLLOWS***" : "", item?.description ? bodyCenterStyle : style({ size: 8, italic: true, horizontal: "center" }));
|
|
174
|
+
setCell(rows, rowIndex, 2, display(item?.unit));
|
|
175
|
+
setCell(rows, rowIndex, 3, display(item?.quantity));
|
|
176
|
+
}
|
|
177
|
+
const footerHeadRow = 4 + itemRows;
|
|
178
|
+
styleRange(rows, footerHeadRow, 0, footerHeadRow, 3, style({ size: 11, bold: true, italic: true, horizontal: "center", borderStyle: "medium" }));
|
|
179
|
+
merge(merges, footerHeadRow, 0, footerHeadRow, 1);
|
|
180
|
+
merge(merges, footerHeadRow, 2, footerHeadRow, 3);
|
|
181
|
+
setCell(rows, footerHeadRow, 0, "Inspection");
|
|
182
|
+
setCell(rows, footerHeadRow, 2, "Complete");
|
|
183
|
+
const footerRow = footerHeadRow + 1;
|
|
184
|
+
styleRange(rows, footerRow, 0, footerRow, 3, style({ size: 11, vertical: "top", borderStyle: "medium" }));
|
|
185
|
+
merge(merges, footerRow, 0, footerRow, 1);
|
|
186
|
+
merge(merges, footerRow, 2, footerRow, 3);
|
|
187
|
+
setCell(rows, footerRow, 0, [
|
|
188
|
+
`Date Inspected : ${fmtDate(data.dateInspected)}`,
|
|
189
|
+
"",
|
|
190
|
+
"☐ Inspected, verified and found in order as to",
|
|
191
|
+
" quantity and specifications",
|
|
192
|
+
"",
|
|
193
|
+
display(data.inspectionOfficer) || "Inspection Officer",
|
|
194
|
+
].join("\n"));
|
|
195
|
+
const complete = data.isComplete !== false;
|
|
196
|
+
setCell(rows, footerRow, 2, [
|
|
197
|
+
`Date Inspected : ${fmtDate(data.dateReceived)}`,
|
|
198
|
+
"",
|
|
199
|
+
`${complete ? "☑" : "☐"} Complete`,
|
|
200
|
+
`${complete ? "☐" : "☑"} Partial (pls. specify quantity)`,
|
|
201
|
+
"",
|
|
202
|
+
display(data.supplyCustodian) || "Supply and/or Property Custodian",
|
|
203
|
+
].join("\n"));
|
|
204
|
+
return {
|
|
205
|
+
name: "IAR",
|
|
206
|
+
filename: filename ?? `${fileToken(display(data.iarNo) || "IAR")}.xlsx`,
|
|
207
|
+
orientation: "portrait",
|
|
208
|
+
cols: [16.4, 53, 14, 16.6],
|
|
209
|
+
rows,
|
|
210
|
+
rowHeights,
|
|
211
|
+
merges,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function buildItrSpec(data, filename) {
|
|
215
|
+
const colCount = 5;
|
|
216
|
+
const itemRows = 22;
|
|
217
|
+
const rows = makeRows(1 + 1 + 1 + 1 + 1 + itemRows + 1 + 1, colCount);
|
|
218
|
+
const rowHeights = [
|
|
219
|
+
mm(24),
|
|
220
|
+
mm(8),
|
|
221
|
+
mm(15),
|
|
222
|
+
mm(20),
|
|
223
|
+
mm(10.5),
|
|
224
|
+
...Array.from({ length: itemRows }, () => mm(5.35)),
|
|
225
|
+
mm(16),
|
|
226
|
+
mm(31),
|
|
227
|
+
];
|
|
228
|
+
const merges = [];
|
|
229
|
+
merge(merges, 0, 0, 0, 4);
|
|
230
|
+
styleRange(rows, 0, 0, 0, 4, style({ size: 16, bold: true, horizontal: "center", borderStyle: "medium" }));
|
|
231
|
+
setCell(rows, 0, 0, "INVENTORY TRANSFER REPORT");
|
|
232
|
+
merge(merges, 1, 0, 1, 2);
|
|
233
|
+
merge(merges, 1, 3, 1, 4);
|
|
234
|
+
styleRange(rows, 1, 0, 1, 4, style({ size: 12, bold: true, borderStyle: "medium" }));
|
|
235
|
+
setCell(rows, 1, 0, `Entity Name : ${display(data.entityName)}`);
|
|
236
|
+
setCell(rows, 1, 3, `Fund Cluster : ${display(data.fundCluster)}`);
|
|
237
|
+
merge(merges, 2, 0, 2, 2);
|
|
238
|
+
merge(merges, 2, 3, 2, 4);
|
|
239
|
+
styleRange(rows, 2, 0, 2, 4, style({ size: 11, vertical: "top", borderStyle: "medium" }));
|
|
240
|
+
setCell(rows, 2, 0, [
|
|
241
|
+
`From Accountable Person : ${display(data.fromAccountablePerson || data.fromAccountableOfficer)}`,
|
|
242
|
+
`Section/Division : ${display(data.fromDivisionSection)}`,
|
|
243
|
+
`To Accountable Person : ${display(data.toAccountablePerson || data.toAccountableOfficer)}`,
|
|
244
|
+
`Section/Division : ${display(data.toDivisionSection)}`,
|
|
245
|
+
].join("\n"));
|
|
246
|
+
setCell(rows, 2, 3, `ITR No. : ${display(data.itrNo)}\nDate : ${fmtDate(data.transferDate)}`);
|
|
247
|
+
merge(merges, 3, 0, 3, 4);
|
|
248
|
+
styleRange(rows, 3, 0, 3, 4, style({ size: 11, vertical: "top", borderStyle: "medium" }));
|
|
249
|
+
setCell(rows, 3, 0, [
|
|
250
|
+
"Transfer Type: (check only one)",
|
|
251
|
+
` ${data.transferType === "Donation" ? "☑" : "☐"} Donation ${data.transferType === "Relocate" ? "☑" : "☐"} Relocate`,
|
|
252
|
+
` ${data.transferType === "Reassignment" ? "☑" : "☐"} Reassignment ${data.transferType === "Others" ? "☑" : "☐"} Others (Specify) ${data.transferType === "Others" ? display(data.transferTypeOthers) : "____________________"}`,
|
|
253
|
+
].join("\n"));
|
|
254
|
+
styleRange(rows, 4, 0, 4, 4, tableHeaderStyle);
|
|
255
|
+
setCell(rows, 4, 0, "Date Acquired");
|
|
256
|
+
setCell(rows, 4, 1, "Property No.");
|
|
257
|
+
setCell(rows, 4, 2, "Description");
|
|
258
|
+
setCell(rows, 4, 3, "Amount");
|
|
259
|
+
setCell(rows, 4, 4, "Property\nCondition");
|
|
260
|
+
const visibleItems = data.items.filter(item => [
|
|
261
|
+
item.dateAcquired,
|
|
262
|
+
item.itemNo,
|
|
263
|
+
item.propertyNo,
|
|
264
|
+
item.description,
|
|
265
|
+
item.conditionOfInventory,
|
|
266
|
+
item.conditionOfPPE,
|
|
267
|
+
Number(item.amount) !== 0 ? item.amount : "",
|
|
268
|
+
].some(value => display(String(value ?? "")).length > 0));
|
|
269
|
+
const nothingIndex = Math.min(Math.max(visibleItems.length, 3), itemRows - 1);
|
|
270
|
+
for (let i = 0; i < itemRows; i++) {
|
|
271
|
+
const rowIndex = 5 + i;
|
|
272
|
+
const item = visibleItems[i];
|
|
273
|
+
styleRange(rows, rowIndex, 0, rowIndex, 4, bodyStyle);
|
|
274
|
+
setCell(rows, rowIndex, 0, item ? fmtDate(item.dateAcquired) : "");
|
|
275
|
+
setCell(rows, rowIndex, 1, display(item?.propertyNo || item?.itemNo));
|
|
276
|
+
setCell(rows, rowIndex, 2, item?.description ? item.description : i === nothingIndex ? "***nothing follows***" : "", item?.description ? bodyCenterStyle : style({ size: 8, italic: true, horizontal: "center" }));
|
|
277
|
+
setCell(rows, rowIndex, 3, item ? fmtAmount(item.amount) : "", bodyRightStyle);
|
|
278
|
+
setCell(rows, rowIndex, 4, display(item?.conditionOfPPE || item?.conditionOfInventory), bodyCenterStyle);
|
|
279
|
+
}
|
|
280
|
+
const reasonRow = 5 + itemRows;
|
|
281
|
+
merge(merges, reasonRow, 0, reasonRow, 4);
|
|
282
|
+
styleRange(rows, reasonRow, 0, reasonRow, 4, style({ size: 11, vertical: "top", borderStyle: "medium" }));
|
|
283
|
+
setCell(rows, reasonRow, 0, `Reason for Transfer: ${display(data.reasonForTransfer || data.reason)}\n\n TRANSFER TO NEW ACCOUNTABLE PERSON`);
|
|
284
|
+
const sigStart = reasonRow + 1;
|
|
285
|
+
merge(merges, sigStart, 0, sigStart, 4);
|
|
286
|
+
styleRange(rows, sigStart, 0, sigStart, 4, style({ size: 11, vertical: "top", borderStyle: "medium" }));
|
|
287
|
+
setCell(rows, sigStart, 0, [
|
|
288
|
+
" Approved by: Released/Issued by: Received by:",
|
|
289
|
+
"",
|
|
290
|
+
"Signature :",
|
|
291
|
+
`Name : ${display(data.approvedBy).padEnd(24)}${display(data.releasedIssuedBy).padEnd(30)}${display(data.receivedBy)}`,
|
|
292
|
+
"Date :",
|
|
293
|
+
].join("\n"));
|
|
294
|
+
return {
|
|
295
|
+
name: "ITR",
|
|
296
|
+
filename: filename ?? `ITR-${fileToken(display(data.itrNo) || "preview")}.xlsx`,
|
|
297
|
+
orientation: "portrait",
|
|
298
|
+
cols: [15.4, 19.7, 35.4, 14.1, 15.4],
|
|
299
|
+
rows,
|
|
300
|
+
rowHeights,
|
|
301
|
+
merges,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function buildRegSpiSpec(data, filename) {
|
|
305
|
+
const colCount = 15;
|
|
306
|
+
const bodyRows = 20;
|
|
307
|
+
const rows = makeRows(6 + 2 + bodyRows, colCount);
|
|
308
|
+
const rowHeights = [
|
|
309
|
+
mm(8),
|
|
310
|
+
mm(10),
|
|
311
|
+
mm(13),
|
|
312
|
+
mm(8),
|
|
313
|
+
mm(8),
|
|
314
|
+
mm(4),
|
|
315
|
+
mm(4.2),
|
|
316
|
+
mm(11.5),
|
|
317
|
+
...Array.from({ length: bodyRows }, () => mm(5.8)),
|
|
318
|
+
];
|
|
319
|
+
const merges = [];
|
|
320
|
+
setCell(rows, 0, 14, "Annex A.4", annexStyle);
|
|
321
|
+
merge(merges, 1, 0, 1, 14);
|
|
322
|
+
setCell(rows, 1, 0, "REGISTRY OF SEMI-EXPENDABLE PROPERTY ISSUED", titleStyle);
|
|
323
|
+
merge(merges, 3, 0, 4, 5);
|
|
324
|
+
merge(merges, 3, 11, 4, 14);
|
|
325
|
+
setCell(rows, 3, 0, `Entity Name: ${display(data.entityName)}\nSemi-Expendable Property: ${display(data.semiExpendableProperty)}`, labelStyle);
|
|
326
|
+
setCell(rows, 3, 11, `Fund Cluster : ${display(data.fundCluster)}`, labelStyle);
|
|
327
|
+
const headerRow = 6;
|
|
328
|
+
styleRange(rows, headerRow, 0, headerRow + 1, 14, tableHeaderStyle);
|
|
329
|
+
merge(merges, headerRow, 0, headerRow + 1, 0);
|
|
330
|
+
merge(merges, headerRow, 1, headerRow, 2);
|
|
331
|
+
merge(merges, headerRow, 3, headerRow + 1, 3);
|
|
332
|
+
merge(merges, headerRow, 4, headerRow + 1, 4);
|
|
333
|
+
merge(merges, headerRow, 5, headerRow, 6);
|
|
334
|
+
merge(merges, headerRow, 7, headerRow, 8);
|
|
335
|
+
merge(merges, headerRow, 9, headerRow, 10);
|
|
336
|
+
merge(merges, headerRow, 13, headerRow + 1, 13);
|
|
337
|
+
merge(merges, headerRow, 14, headerRow + 1, 14);
|
|
338
|
+
setCell(rows, headerRow, 0, "Date");
|
|
339
|
+
setCell(rows, headerRow, 1, "Reference");
|
|
340
|
+
setCell(rows, headerRow, 3, "Item Description");
|
|
341
|
+
setCell(rows, headerRow, 4, "Estimated\nUseful Life");
|
|
342
|
+
setCell(rows, headerRow, 5, "Issued");
|
|
343
|
+
setCell(rows, headerRow, 7, "Returned");
|
|
344
|
+
setCell(rows, headerRow, 9, "Re-issued");
|
|
345
|
+
setCell(rows, headerRow, 11, "Disposed");
|
|
346
|
+
setCell(rows, headerRow, 12, "Balance");
|
|
347
|
+
setCell(rows, headerRow, 13, "Amount");
|
|
348
|
+
setCell(rows, headerRow, 14, "Remarks");
|
|
349
|
+
setCell(rows, headerRow + 1, 1, "ICS/RRSP No.");
|
|
350
|
+
setCell(rows, headerRow + 1, 2, "Semi-\nExpendable\nProperty No.");
|
|
351
|
+
setCell(rows, headerRow + 1, 5, "Qty.");
|
|
352
|
+
setCell(rows, headerRow + 1, 6, "Office/Officer");
|
|
353
|
+
setCell(rows, headerRow + 1, 7, "Qty.");
|
|
354
|
+
setCell(rows, headerRow + 1, 8, "Office/Officer");
|
|
355
|
+
setCell(rows, headerRow + 1, 9, "Qty.");
|
|
356
|
+
setCell(rows, headerRow + 1, 10, "Office/Officer");
|
|
357
|
+
setCell(rows, headerRow + 1, 11, "Qty.");
|
|
358
|
+
setCell(rows, headerRow + 1, 12, "Qty.");
|
|
359
|
+
const bodyStart = headerRow + 2;
|
|
360
|
+
for (let i = 0; i < bodyRows; i++) {
|
|
361
|
+
const rowIndex = bodyStart + i;
|
|
362
|
+
const entry = data.entries[i];
|
|
363
|
+
styleRange(rows, rowIndex, 0, rowIndex, 14, bodyStyle);
|
|
364
|
+
setCell(rows, rowIndex, 0, entry ? fmtDate(entry.entryDate) : "", bodyCenterStyle);
|
|
365
|
+
setCell(rows, rowIndex, 1, display(entry?.iicRrspNo || entry?.reference));
|
|
366
|
+
setCell(rows, rowIndex, 2, display(entry?.semiExpendablePropertyNo));
|
|
367
|
+
setCell(rows, rowIndex, 3, display(entry?.itemDescription));
|
|
368
|
+
setCell(rows, rowIndex, 4, display(entry?.estimatedUsefulLife), bodyCenterStyle);
|
|
369
|
+
setCell(rows, rowIndex, 5, fmtQty(entry?.issuedQty), bodyCenterStyle);
|
|
370
|
+
setCell(rows, rowIndex, 6, display(entry?.issuedOfficeOfficer));
|
|
371
|
+
setCell(rows, rowIndex, 7, fmtQty(entry?.returnedQty), bodyCenterStyle);
|
|
372
|
+
setCell(rows, rowIndex, 8, display(entry?.returnedOfficeOfficer));
|
|
373
|
+
setCell(rows, rowIndex, 9, fmtQty(entry?.reissuedQty), bodyCenterStyle);
|
|
374
|
+
setCell(rows, rowIndex, 10, display(entry?.reissuedOfficeOfficer));
|
|
375
|
+
setCell(rows, rowIndex, 11, fmtQty(entry?.disposedQty), bodyCenterStyle);
|
|
376
|
+
setCell(rows, rowIndex, 12, fmtQty(entry?.balance), bodyCenterStyle);
|
|
377
|
+
setCell(rows, rowIndex, 13, fmtAmount(entry?.amount), bodyRightStyle);
|
|
378
|
+
setCell(rows, rowIndex, 14, display(entry?.remarks));
|
|
379
|
+
}
|
|
380
|
+
return {
|
|
381
|
+
name: "RegSPI",
|
|
382
|
+
filename: filename ?? `RegSPI-${fileToken(display(data.regSpiNo) || "preview")}.xlsx`,
|
|
383
|
+
orientation: "landscape",
|
|
384
|
+
cols: [8, 13, 11, 24, 7, 4, 23, 4, 13, 4, 13, 6, 6, 8, 15],
|
|
385
|
+
rows,
|
|
386
|
+
rowHeights,
|
|
387
|
+
merges,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function buildSplcSpec(data, filename) {
|
|
391
|
+
const colCount = 10;
|
|
392
|
+
const bodyRows = Math.max(20, data.entries.length);
|
|
393
|
+
const rows = makeRows(5 + 4 + bodyRows, colCount);
|
|
394
|
+
const rowHeights = [
|
|
395
|
+
mm(6),
|
|
396
|
+
mm(10),
|
|
397
|
+
mm(9),
|
|
398
|
+
mm(8),
|
|
399
|
+
mm(8),
|
|
400
|
+
mm(7.2),
|
|
401
|
+
mm(8),
|
|
402
|
+
...Array.from({ length: bodyRows + 2 }, () => mm(5)),
|
|
403
|
+
];
|
|
404
|
+
const merges = [];
|
|
405
|
+
setCell(rows, 0, 9, "Annex A.2", annexStyle);
|
|
406
|
+
merge(merges, 1, 0, 1, 9);
|
|
407
|
+
setCell(rows, 1, 0, "SEMI-EXPENDABLE PROPERTY LEDGER CARD", style({ size: 14, bold: true, horizontal: "center", borderStyle: false }));
|
|
408
|
+
merge(merges, 2, 0, 2, 5);
|
|
409
|
+
merge(merges, 2, 6, 2, 9);
|
|
410
|
+
setCell(rows, 2, 0, `Entity Name : ${display(data.entityName)}`, labelStyle);
|
|
411
|
+
setCell(rows, 2, 6, `Fund Cluster : ${display(data.fundCluster)}`, labelStyle);
|
|
412
|
+
styleRange(rows, 3, 0, 4, 9, metaStyle);
|
|
413
|
+
merge(merges, 3, 0, 3, 5);
|
|
414
|
+
merge(merges, 3, 6, 3, 9);
|
|
415
|
+
merge(merges, 4, 0, 4, 5);
|
|
416
|
+
merge(merges, 4, 6, 4, 7);
|
|
417
|
+
merge(merges, 4, 8, 4, 9);
|
|
418
|
+
setCell(rows, 3, 0, `Semi-expendable Property: ${display(data.semiExpendableProperty)}`);
|
|
419
|
+
setCell(rows, 3, 6, `Semi-expendable Property No.: ${display(data.semiExpendablePropertyNumber)}`);
|
|
420
|
+
setCell(rows, 4, 0, `Description: ${display(data.description)}`);
|
|
421
|
+
setCell(rows, 4, 6, `UACS Object Code: ${display(data.uacsObjectCode)}`);
|
|
422
|
+
setCell(rows, 4, 8, `Repair History ${display(data.repairHistory)}`);
|
|
423
|
+
const headerRow = 5;
|
|
424
|
+
styleRange(rows, headerRow, 0, headerRow + 1, 9, tableHeaderStyle);
|
|
425
|
+
merge(merges, headerRow, 0, headerRow + 1, 0);
|
|
426
|
+
merge(merges, headerRow, 1, headerRow + 1, 1);
|
|
427
|
+
merge(merges, headerRow, 2, headerRow, 4);
|
|
428
|
+
merge(merges, headerRow, 5, headerRow + 1, 5);
|
|
429
|
+
merge(merges, headerRow, 6, headerRow + 1, 6);
|
|
430
|
+
merge(merges, headerRow, 7, headerRow + 1, 7);
|
|
431
|
+
merge(merges, headerRow, 8, headerRow, 9);
|
|
432
|
+
setCell(rows, headerRow, 0, "Date");
|
|
433
|
+
setCell(rows, headerRow, 1, "Reference");
|
|
434
|
+
setCell(rows, headerRow, 2, "Receipt");
|
|
435
|
+
setCell(rows, headerRow, 5, "Issues/Transfers/\nAdjustment/s");
|
|
436
|
+
setCell(rows, headerRow, 6, "Accumulated\nImpairment Losses");
|
|
437
|
+
setCell(rows, headerRow, 7, "Adjusted\nCost");
|
|
438
|
+
setCell(rows, headerRow, 8, "Repair History");
|
|
439
|
+
setCell(rows, headerRow + 1, 2, "Qty.");
|
|
440
|
+
setCell(rows, headerRow + 1, 3, "Unit\nCost");
|
|
441
|
+
setCell(rows, headerRow + 1, 4, "Total\nCost");
|
|
442
|
+
setCell(rows, headerRow + 1, 8, "Nature of\nRepair");
|
|
443
|
+
setCell(rows, headerRow + 1, 9, "Amount");
|
|
444
|
+
const bodyStart = headerRow + 2;
|
|
445
|
+
for (let i = 0; i < bodyRows; i++) {
|
|
446
|
+
const rowIndex = bodyStart + i;
|
|
447
|
+
const entry = data.entries[i];
|
|
448
|
+
styleRange(rows, rowIndex, 0, rowIndex, 9, bodyStyle);
|
|
449
|
+
setCell(rows, rowIndex, 0, entry ? fmtDate(entry.entryDate) : "", bodyCenterStyle);
|
|
450
|
+
setCell(rows, rowIndex, 1, display(entry?.reference));
|
|
451
|
+
setCell(rows, rowIndex, 2, fmtQty(entry?.receiptQty), bodyCenterStyle);
|
|
452
|
+
setCell(rows, rowIndex, 3, fmtAmount(entry?.unitCost), bodyRightStyle);
|
|
453
|
+
setCell(rows, rowIndex, 4, fmtAmount(entry?.totalCost), bodyRightStyle);
|
|
454
|
+
setCell(rows, rowIndex, 5, display(entry?.issuesTransfersAdjustments));
|
|
455
|
+
setCell(rows, rowIndex, 6, fmtAmount(entry?.accumulatedImpairmentLosses), bodyRightStyle);
|
|
456
|
+
setCell(rows, rowIndex, 7, fmtAmount(entry?.adjustedCost), bodyRightStyle);
|
|
457
|
+
setCell(rows, rowIndex, 8, display(entry?.natureOfRepair));
|
|
458
|
+
setCell(rows, rowIndex, 9, fmtAmount(entry?.amount), bodyRightStyle);
|
|
459
|
+
}
|
|
460
|
+
return {
|
|
461
|
+
name: "SPLC",
|
|
462
|
+
filename: filename ?? `SPLC-${fileToken(display(data.semiExpendablePropertyNumber) || "preview")}.xlsx`,
|
|
463
|
+
orientation: "landscape",
|
|
464
|
+
cols: [10, 16, 8, 11, 14, 19, 16, 19, 10, 11],
|
|
465
|
+
rows,
|
|
466
|
+
rowHeights,
|
|
467
|
+
merges,
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function buildSpcSpec(data, filename) {
|
|
471
|
+
const colCount = 12;
|
|
472
|
+
const bodyRows = Math.max(27, data.entries.length);
|
|
473
|
+
const rows = makeRows(5 + 4 + bodyRows, colCount);
|
|
474
|
+
const rowHeights = [
|
|
475
|
+
mm(7),
|
|
476
|
+
mm(11),
|
|
477
|
+
mm(10),
|
|
478
|
+
mm(8),
|
|
479
|
+
mm(7.8),
|
|
480
|
+
mm(7.8),
|
|
481
|
+
mm(5.8),
|
|
482
|
+
mm(5.6),
|
|
483
|
+
...Array.from({ length: bodyRows + 1 }, () => mm(5)),
|
|
484
|
+
];
|
|
485
|
+
const merges = [];
|
|
486
|
+
setCell(rows, 0, 11, "Annex A.1", annexStyle);
|
|
487
|
+
merge(merges, 1, 0, 1, 11);
|
|
488
|
+
setCell(rows, 1, 0, "SEMI-EXPENDABLE PROPERTY CARD", style({ size: 13, bold: true, horizontal: "center", borderStyle: false }));
|
|
489
|
+
merge(merges, 3, 0, 3, 7);
|
|
490
|
+
merge(merges, 3, 9, 3, 11);
|
|
491
|
+
setCell(rows, 3, 0, `Entity Name : ${display(data.entityName)}`, labelStyle);
|
|
492
|
+
setCell(rows, 3, 9, `Fund Cluster: ${display(data.fundCluster)}`, labelStyle);
|
|
493
|
+
styleRange(rows, 4, 0, 5, 11, metaStyle);
|
|
494
|
+
merge(merges, 4, 0, 4, 9);
|
|
495
|
+
merge(merges, 4, 10, 5, 11);
|
|
496
|
+
merge(merges, 5, 0, 5, 9);
|
|
497
|
+
setCell(rows, 4, 0, `Semi-Expendable Property : ${display(data.semiExpendableProperty)}`);
|
|
498
|
+
setCell(rows, 4, 10, `Semi-Expendable Property Number: ${display(data.semiExpendablePropertyNumber)}`);
|
|
499
|
+
setCell(rows, 5, 0, `Description : ${display(data.description)}`);
|
|
500
|
+
const headerRow = 6;
|
|
501
|
+
styleRange(rows, headerRow, 0, headerRow + 1, 11, tableHeaderStyle);
|
|
502
|
+
merge(merges, headerRow, 0, headerRow + 1, 0);
|
|
503
|
+
merge(merges, headerRow, 1, headerRow + 1, 1);
|
|
504
|
+
merge(merges, headerRow, 2, headerRow, 4);
|
|
505
|
+
merge(merges, headerRow, 6, headerRow, 8);
|
|
506
|
+
merge(merges, headerRow, 10, headerRow + 1, 10);
|
|
507
|
+
merge(merges, headerRow, 11, headerRow + 1, 11);
|
|
508
|
+
setCell(rows, headerRow, 0, "Date");
|
|
509
|
+
setCell(rows, headerRow, 1, "Reference");
|
|
510
|
+
setCell(rows, headerRow, 2, "Receipt");
|
|
511
|
+
setCell(rows, headerRow, 5, "Receipt");
|
|
512
|
+
setCell(rows, headerRow, 6, "Issue/Transfer/ Disposal");
|
|
513
|
+
setCell(rows, headerRow, 9, "Balance");
|
|
514
|
+
setCell(rows, headerRow, 10, "Amount");
|
|
515
|
+
setCell(rows, headerRow, 11, "Accountable Person");
|
|
516
|
+
setCell(rows, headerRow + 1, 2, "Qty.");
|
|
517
|
+
setCell(rows, headerRow + 1, 3, "Unit Cost");
|
|
518
|
+
setCell(rows, headerRow + 1, 4, "Total Cost");
|
|
519
|
+
setCell(rows, headerRow + 1, 5, "Qty.");
|
|
520
|
+
setCell(rows, headerRow + 1, 6, "Item No.");
|
|
521
|
+
setCell(rows, headerRow + 1, 7, "Qty.");
|
|
522
|
+
setCell(rows, headerRow + 1, 8, "Office/Officer");
|
|
523
|
+
setCell(rows, headerRow + 1, 9, "Qty.");
|
|
524
|
+
const bodyStart = headerRow + 2;
|
|
525
|
+
for (let i = 0; i < bodyRows; i++) {
|
|
526
|
+
const rowIndex = bodyStart + i;
|
|
527
|
+
const entry = data.entries[i];
|
|
528
|
+
styleRange(rows, rowIndex, 0, rowIndex, 11, bodyStyle);
|
|
529
|
+
setCell(rows, rowIndex, 0, entry ? fmtDate(entry.entryDate) : "", bodyCenterStyle);
|
|
530
|
+
setCell(rows, rowIndex, 1, display(entry?.reference));
|
|
531
|
+
setCell(rows, rowIndex, 2, fmtQty(entry?.receiptQty), bodyCenterStyle);
|
|
532
|
+
setCell(rows, rowIndex, 3, fmtAmount(entry?.receiptUnitCost), bodyRightStyle);
|
|
533
|
+
setCell(rows, rowIndex, 4, fmtAmount(entry?.receiptTotalCost), bodyRightStyle);
|
|
534
|
+
setCell(rows, rowIndex, 5, fmtQty(entry?.receiptQty), bodyCenterStyle);
|
|
535
|
+
setCell(rows, rowIndex, 6, display(entry?.itemNo));
|
|
536
|
+
setCell(rows, rowIndex, 7, fmtQty(entry?.issueTransferDisposalQty), bodyCenterStyle);
|
|
537
|
+
setCell(rows, rowIndex, 8, display(entry?.issueTransferDisposalOfficeOfficer));
|
|
538
|
+
setCell(rows, rowIndex, 9, fmtQty(entry?.balanceQty), bodyCenterStyle);
|
|
539
|
+
setCell(rows, rowIndex, 10, fmtAmount(entry?.amount), bodyRightStyle);
|
|
540
|
+
setCell(rows, rowIndex, 11, display(entry?.remarks));
|
|
541
|
+
}
|
|
542
|
+
return {
|
|
543
|
+
name: "SPC",
|
|
544
|
+
filename: filename ?? `SPC-${fileToken(display(data.semiExpendablePropertyNumber) || "preview")}.xlsx`,
|
|
545
|
+
orientation: "landscape",
|
|
546
|
+
cols: [11, 16, 11, 9, 10, 9, 10, 13, 24, 13, 14, 16],
|
|
547
|
+
rows,
|
|
548
|
+
rowHeights,
|
|
549
|
+
merges,
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function checkbox(checked) {
|
|
553
|
+
return checked ? "[x]" : "[ ]";
|
|
554
|
+
}
|
|
555
|
+
function swornParts(value) {
|
|
556
|
+
if (!value)
|
|
557
|
+
return { day: "", monthYear: "" };
|
|
558
|
+
const date = new Date(value);
|
|
559
|
+
if (Number.isNaN(date.getTime()))
|
|
560
|
+
return { day: "", monthYear: "" };
|
|
561
|
+
return {
|
|
562
|
+
day: String(date.getDate()),
|
|
563
|
+
monthYear: date.toLocaleDateString("en-PH", { month: "long", year: "numeric" }),
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function splitLines(value, count, maxChars = 110) {
|
|
567
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
568
|
+
if (!normalized)
|
|
569
|
+
return Array.from({ length: count }, () => "");
|
|
570
|
+
const words = normalized.split(" ");
|
|
571
|
+
const lines = [];
|
|
572
|
+
let current = "";
|
|
573
|
+
for (const word of words) {
|
|
574
|
+
const next = current ? `${current} ${word}` : word;
|
|
575
|
+
if (next.length > maxChars && current) {
|
|
576
|
+
lines.push(current);
|
|
577
|
+
current = word;
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
current = next;
|
|
581
|
+
}
|
|
582
|
+
if (lines.length === count)
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
if (lines.length < count && current)
|
|
586
|
+
lines.push(current);
|
|
587
|
+
return [
|
|
588
|
+
...lines.slice(0, count),
|
|
589
|
+
...Array.from({ length: Math.max(0, count - lines.length) }, () => ""),
|
|
590
|
+
];
|
|
591
|
+
}
|
|
592
|
+
function buildRlsdReportSpec(data, config, filename) {
|
|
593
|
+
const rows = makeRows(45, 12);
|
|
594
|
+
const rowHeights = [
|
|
595
|
+
mm(12),
|
|
596
|
+
mm(8),
|
|
597
|
+
mm(10),
|
|
598
|
+
mm(7),
|
|
599
|
+
mm(6),
|
|
600
|
+
mm(5),
|
|
601
|
+
mm(5),
|
|
602
|
+
mm(5),
|
|
603
|
+
mm(5),
|
|
604
|
+
mm(6),
|
|
605
|
+
mm(5),
|
|
606
|
+
mm(5),
|
|
607
|
+
mm(7),
|
|
608
|
+
...Array.from({ length: 7 }, () => mm(4.8)),
|
|
609
|
+
mm(5),
|
|
610
|
+
mm(4.8),
|
|
611
|
+
mm(4.8),
|
|
612
|
+
mm(4.8),
|
|
613
|
+
mm(4.8),
|
|
614
|
+
mm(10),
|
|
615
|
+
mm(10),
|
|
616
|
+
mm(10),
|
|
617
|
+
mm(10),
|
|
618
|
+
mm(8),
|
|
619
|
+
mm(7),
|
|
620
|
+
mm(5),
|
|
621
|
+
mm(5),
|
|
622
|
+
mm(5),
|
|
623
|
+
mm(9),
|
|
624
|
+
mm(5),
|
|
625
|
+
mm(5),
|
|
626
|
+
mm(5),
|
|
627
|
+
mm(5),
|
|
628
|
+
mm(4),
|
|
629
|
+
mm(4),
|
|
630
|
+
mm(4),
|
|
631
|
+
mm(4),
|
|
632
|
+
mm(4),
|
|
633
|
+
];
|
|
634
|
+
const merges = [];
|
|
635
|
+
const status = display(data.statusOfProperty).toLowerCase();
|
|
636
|
+
const police = display(data.policeNotified).toLowerCase();
|
|
637
|
+
const sworn = swornParts(data.swornDate);
|
|
638
|
+
const medium = style({ size: 8, borderStyle: "medium", vertical: "top" });
|
|
639
|
+
const mediumBold = style({ size: 8, bold: true, borderStyle: "medium", vertical: "center" });
|
|
640
|
+
const thin = style({ size: 8, vertical: "top" });
|
|
641
|
+
const thinCenter = style({ size: 8, horizontal: "center", vertical: "center" });
|
|
642
|
+
setCell(rows, 1, 11, "Annex A.9", annexStyle);
|
|
643
|
+
merge(merges, 3, 0, 4, 11);
|
|
644
|
+
setCell(rows, 3, 0, config.title, style({ size: 12, bold: true, horizontal: "center", borderStyle: false }));
|
|
645
|
+
merge(merges, 6, 0, 6, 6);
|
|
646
|
+
merge(merges, 6, 7, 6, 11);
|
|
647
|
+
setCell(rows, 6, 0, `Entity Name : ${display(data.entityName)}`, labelStyle);
|
|
648
|
+
setCell(rows, 6, 7, `Fund Cluster: ${display(data.fundCluster)}`, labelStyle);
|
|
649
|
+
styleRange(rows, 7, 0, 10, 7, medium);
|
|
650
|
+
styleRange(rows, 7, 8, 10, 11, medium);
|
|
651
|
+
merge(merges, 7, 0, 7, 7);
|
|
652
|
+
merge(merges, 8, 0, 8, 7);
|
|
653
|
+
merge(merges, 9, 0, 9, 7);
|
|
654
|
+
merge(merges, 10, 0, 10, 2);
|
|
655
|
+
merge(merges, 10, 3, 10, 4);
|
|
656
|
+
merge(merges, 10, 5, 10, 7);
|
|
657
|
+
merge(merges, 7, 8, 7, 11);
|
|
658
|
+
merge(merges, 8, 8, 8, 11);
|
|
659
|
+
merge(merges, 9, 8, 9, 11);
|
|
660
|
+
merge(merges, 10, 8, 10, 11);
|
|
661
|
+
setCell(rows, 7, 0, `Department/Office : ${display(data.departmentOffice)}`, medium);
|
|
662
|
+
setCell(rows, 8, 0, `Accountable Officer : ${display(data.accountableOfficer)}`, medium);
|
|
663
|
+
setCell(rows, 9, 0, `Designation : ${display(data.designation)}`, medium);
|
|
664
|
+
setCell(rows, 10, 0, `Police Notified : ${checkbox(police === "yes")} Yes ${checkbox(police === "no")} No`, medium);
|
|
665
|
+
setCell(rows, 10, 3, `Police Station : ${display(data.policeStation)}`, medium);
|
|
666
|
+
setCell(rows, 10, 5, `Date : ${fmtDate(data.policeNotifiedDate)}`, medium);
|
|
667
|
+
setCell(rows, 7, 8, `${config.kind} No. : ${config.reportNo}`, medium);
|
|
668
|
+
setCell(rows, 8, 8, `${config.kind} Date : ${fmtDate(config.reportDate)}`, medium);
|
|
669
|
+
setCell(rows, 9, 8, `${config.kind === "RLSDDP" ? "PAR" : "ICS"} No. : ${config.refNo}`, medium);
|
|
670
|
+
setCell(rows, 10, 8, `${config.kind === "RLSDDP" ? "PAR" : "ICS"} Date : ${fmtDate(config.refDate)}`, medium);
|
|
671
|
+
styleRange(rows, 11, 0, 12, 11, medium);
|
|
672
|
+
merge(merges, 11, 0, 11, 11);
|
|
673
|
+
merge(merges, 12, 0, 12, 11);
|
|
674
|
+
setCell(rows, 11, 0, `${config.statusLabel} : (check applicable box)`, medium);
|
|
675
|
+
setCell(rows, 12, 0, ` ${checkbox(status === "lost")} Lost ${checkbox(status === "damaged")} Damaged\n ${checkbox(status === "stolen")} Stolen ${checkbox(status === "destroyed")} Destroyed`, style({ size: 8, horizontal: "center", vertical: "center", borderStyle: "medium" }));
|
|
676
|
+
styleRange(rows, 13, 0, 20, 11, thinCenter);
|
|
677
|
+
merge(merges, 13, 0, 13, 2);
|
|
678
|
+
merge(merges, 13, 3, 13, 7);
|
|
679
|
+
merge(merges, 13, 8, 13, 11);
|
|
680
|
+
setCell(rows, 13, 0, "Property No.", tableHeaderStyle);
|
|
681
|
+
setCell(rows, 13, 3, "Description", tableHeaderStyle);
|
|
682
|
+
setCell(rows, 13, 8, "Acquisition Cost", tableHeaderStyle);
|
|
683
|
+
for (let r = 14; r <= 20; r++) {
|
|
684
|
+
merge(merges, r, 0, r, 2);
|
|
685
|
+
merge(merges, r, 3, r, 7);
|
|
686
|
+
merge(merges, r, 8, r, 11);
|
|
687
|
+
}
|
|
688
|
+
setCell(rows, 14, 0, display(data.propertyNo), thin);
|
|
689
|
+
setCell(rows, 14, 3, display(data.description), thin);
|
|
690
|
+
setCell(rows, 14, 8, fmtAmount(data.acquisitionCost), style({ size: 8, horizontal: "right" }));
|
|
691
|
+
styleRange(rows, 21, 0, 25, 11, medium);
|
|
692
|
+
merge(merges, 21, 0, 21, 11);
|
|
693
|
+
setCell(rows, 21, 0, "Circumstances:", mediumBold);
|
|
694
|
+
splitLines(config.circumstance, 4).forEach((line, index) => {
|
|
695
|
+
const row = 22 + index;
|
|
696
|
+
merge(merges, row, 0, row, 11);
|
|
697
|
+
setCell(rows, row, 0, line, medium);
|
|
698
|
+
});
|
|
699
|
+
styleRange(rows, 26, 0, 34, 7, medium);
|
|
700
|
+
styleRange(rows, 26, 8, 34, 11, medium);
|
|
701
|
+
merge(merges, 26, 0, 27, 7);
|
|
702
|
+
merge(merges, 28, 0, 29, 7);
|
|
703
|
+
merge(merges, 30, 0, 30, 7);
|
|
704
|
+
merge(merges, 31, 0, 31, 7);
|
|
705
|
+
merge(merges, 32, 0, 32, 7);
|
|
706
|
+
merge(merges, 33, 0, 33, 7);
|
|
707
|
+
merge(merges, 34, 0, 34, 7);
|
|
708
|
+
merge(merges, 26, 8, 27, 11);
|
|
709
|
+
merge(merges, 28, 8, 29, 11);
|
|
710
|
+
merge(merges, 30, 8, 31, 11);
|
|
711
|
+
merge(merges, 32, 8, 32, 11);
|
|
712
|
+
setCell(rows, 26, 0, "I hereby certify that the item/s and circumstances stated above are true and correct.", medium);
|
|
713
|
+
setCell(rows, 28, 0, `${display(data.accountableOfficerSignature)}\nSignature over Printed Name of the Accountable Officer`, style({ size: 8, horizontal: "center", vertical: "bottom", borderStyle: "medium" }));
|
|
714
|
+
setCell(rows, 30, 0, `${fmtDate(data.accountableOfficerDate)}\nDate`, style({ size: 8, horizontal: "center", borderStyle: "medium" }));
|
|
715
|
+
setCell(rows, 32, 0, `Government Issued ID : ${display(data.governmentIssuedId)}`, medium);
|
|
716
|
+
setCell(rows, 33, 0, `ID No. : ${display(data.idNo)}`, medium);
|
|
717
|
+
setCell(rows, 34, 0, `Date Issued : ${fmtDate(config.idDateIssued)}`, medium);
|
|
718
|
+
setCell(rows, 26, 8, "Noted by:", medium);
|
|
719
|
+
setCell(rows, 28, 8, `${display(data.immediateSupervisorSignature)}\nSignature over Printed Name of the Immediate Supervisor`, style({ size: 8, horizontal: "center", vertical: "bottom", borderStyle: "medium" }));
|
|
720
|
+
setCell(rows, 30, 8, `${fmtDate(data.immediateSupervisorDate)}\nDate`, style({ size: 8, horizontal: "center", borderStyle: "medium" }));
|
|
721
|
+
styleRange(rows, 35, 0, 44, 11, medium);
|
|
722
|
+
merge(merges, 35, 0, 37, 11);
|
|
723
|
+
setCell(rows, 35, 0, `SUBSCRIBED AND SWORN to before me this ${sworn.day} day of ${sworn.monthYear}, affiant exhibiting the above government issued identification card.`, medium);
|
|
724
|
+
merge(merges, 38, 0, 38, 5);
|
|
725
|
+
merge(merges, 39, 0, 39, 5);
|
|
726
|
+
merge(merges, 40, 0, 40, 5);
|
|
727
|
+
merge(merges, 41, 0, 41, 5);
|
|
728
|
+
merge(merges, 38, 6, 41, 11);
|
|
729
|
+
setCell(rows, 38, 0, `Doc. No. ${display(data.docNo)}`, medium);
|
|
730
|
+
setCell(rows, 39, 0, `Page No. ${display(data.pageNo)}`, medium);
|
|
731
|
+
setCell(rows, 40, 0, `Book No. ${display(data.bookNo)}`, medium);
|
|
732
|
+
setCell(rows, 41, 0, `Series of ${display(data.seriesOf)}`, medium);
|
|
733
|
+
setCell(rows, 38, 6, `${display(data.notaryPublic)}\nNotary Public`, style({ size: 8, horizontal: "center", vertical: "center", borderStyle: "medium" }));
|
|
734
|
+
return {
|
|
735
|
+
name: config.sheetName,
|
|
736
|
+
filename: filename ?? `${config.filenamePrefix}-${fileToken(config.reportNo || "preview")}.xlsx`,
|
|
737
|
+
orientation: "portrait",
|
|
738
|
+
cols: [8, 8, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8],
|
|
739
|
+
rows,
|
|
740
|
+
rowHeights,
|
|
741
|
+
merges,
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
function buildRlsddpSpec(data, filename) {
|
|
745
|
+
return buildRlsdReportSpec(data, {
|
|
746
|
+
kind: "RLSDDP",
|
|
747
|
+
reportNo: display(data.rlsddpNo) || "Auto-generated",
|
|
748
|
+
reportDate: display(data.rlsddpDate),
|
|
749
|
+
refNo: display(data.parNo),
|
|
750
|
+
refDate: display(data.parDate),
|
|
751
|
+
title: "REPORT OF LOST, STOLEN, DAMAGED OR DESTROYED\nPROPERTY",
|
|
752
|
+
statusLabel: "Status of Property",
|
|
753
|
+
circumstance: display(data.circumstance),
|
|
754
|
+
idDateIssued: display(data.dateIssued),
|
|
755
|
+
filenamePrefix: "RLSDDP",
|
|
756
|
+
sheetName: "RLSDDP",
|
|
757
|
+
}, filename);
|
|
758
|
+
}
|
|
759
|
+
function buildRlsddspSpec(data, filename) {
|
|
760
|
+
return buildRlsdReportSpec(data, {
|
|
761
|
+
kind: "RLSDDSP",
|
|
762
|
+
reportNo: display(data.rlsddspNo) || "Auto-generated",
|
|
763
|
+
reportDate: display(data.rlsddspDate),
|
|
764
|
+
refNo: display(data.icsNo),
|
|
765
|
+
refDate: display(data.icsDate),
|
|
766
|
+
title: "REPORT OF LOST, STOLEN, DAMAGED OR DESTROYED SEMI-EXPENDABLE\nPROPERTY",
|
|
767
|
+
statusLabel: "Status of Semi-expendable Property",
|
|
768
|
+
circumstance: display(data.circumstances),
|
|
769
|
+
idDateIssued: display(data.idDateIssued),
|
|
770
|
+
filenamePrefix: "RLSDDSP",
|
|
771
|
+
sheetName: "RLSDDSP",
|
|
772
|
+
}, filename);
|
|
773
|
+
}
|
|
774
|
+
export function exportIarPreviewXlsx(data, filename) {
|
|
775
|
+
writeWorkbook(buildIarSpec(data, filename));
|
|
776
|
+
}
|
|
777
|
+
export function exportItrPreviewXlsx(data, filename) {
|
|
778
|
+
writeWorkbook(buildItrSpec(data, filename));
|
|
779
|
+
}
|
|
780
|
+
export function exportRegSpiPreviewXlsx(data, filename) {
|
|
781
|
+
writeWorkbook(buildRegSpiSpec(data, filename));
|
|
782
|
+
}
|
|
783
|
+
export function exportSplcPreviewXlsx(data, filename) {
|
|
784
|
+
writeWorkbook(buildSplcSpec(data, filename));
|
|
785
|
+
}
|
|
786
|
+
export function exportSpcPreviewXlsx(data, filename) {
|
|
787
|
+
writeWorkbook(buildSpcSpec(data, filename));
|
|
788
|
+
}
|
|
789
|
+
export function exportRlsddpPreviewXlsx(data, filename) {
|
|
790
|
+
writeWorkbook(buildRlsddpSpec(data, filename));
|
|
791
|
+
}
|
|
792
|
+
export function exportRlsddspPreviewXlsx(data, filename) {
|
|
793
|
+
writeWorkbook(buildRlsddspSpec(data, filename));
|
|
794
|
+
}
|
|
795
|
+
export function exportIirupPreviewXlsx(data, filename) {
|
|
796
|
+
const headers = [
|
|
797
|
+
"Date Acquired",
|
|
798
|
+
"Particulars / Articles",
|
|
799
|
+
"Property No.",
|
|
800
|
+
"Total Quantity",
|
|
801
|
+
"Unit Cost",
|
|
802
|
+
"Total Cost",
|
|
803
|
+
"Accumulated Depreciation",
|
|
804
|
+
"Accumulated Impairment Losses",
|
|
805
|
+
"Carrying Amount",
|
|
806
|
+
"Remarks",
|
|
807
|
+
"Disposal Sale",
|
|
808
|
+
"Transfer",
|
|
809
|
+
"Destruction",
|
|
810
|
+
"Others (Specify)",
|
|
811
|
+
"Total",
|
|
812
|
+
"Appraised Value",
|
|
813
|
+
"OR No.",
|
|
814
|
+
"Amount",
|
|
815
|
+
];
|
|
816
|
+
const rows = [
|
|
817
|
+
["INVENTORY AND INSPECTION REPORT OF UNSERVICEABLE PROPERTY"],
|
|
818
|
+
[`IIRUP No.: ${display(data.iirupNo)}`, `Date: ${fmtDate(data.date)}`],
|
|
819
|
+
[`Entity Name: ${display(data.entityName)}`, `Fund Cluster: ${display(data.fundCluster)}`],
|
|
820
|
+
[
|
|
821
|
+
`Accountable Officer: ${display(data.nameOfAccountableOfficer)}`,
|
|
822
|
+
`Designation: ${display(data.designation)}`,
|
|
823
|
+
`Station: ${display(data.station)}`,
|
|
824
|
+
],
|
|
825
|
+
[],
|
|
826
|
+
headers,
|
|
827
|
+
...data.items.map(item => [
|
|
828
|
+
fmtDate(item.dateAcquired),
|
|
829
|
+
display(item.particularsArticles),
|
|
830
|
+
display(item.propertyNo),
|
|
831
|
+
display(item.qty),
|
|
832
|
+
display(item.unitCost),
|
|
833
|
+
display(item.totalCost),
|
|
834
|
+
display(item.accumulatedDepreciation),
|
|
835
|
+
display(item.accumulatedImpairmentLosses),
|
|
836
|
+
display(item.carryingAmount),
|
|
837
|
+
display(item.remarks),
|
|
838
|
+
display(item.sale),
|
|
839
|
+
display(item.transfer),
|
|
840
|
+
display(item.destruction),
|
|
841
|
+
display(item.othersSpecify),
|
|
842
|
+
display(item.total),
|
|
843
|
+
display(item.appraisedValue),
|
|
844
|
+
display(item.orNo),
|
|
845
|
+
display(item.amount),
|
|
846
|
+
]),
|
|
847
|
+
[],
|
|
848
|
+
[
|
|
849
|
+
`Requested by: ${display(data.accountableOfficerSignatory)}`,
|
|
850
|
+
`Approved by: ${display(data.authorizedOfficialSignatory)}`,
|
|
851
|
+
`Inspected by: ${display(data.inspectionOfficerSignatory)}`,
|
|
852
|
+
`Witnessed by: ${display(data.witnessSignatory)}`,
|
|
853
|
+
],
|
|
854
|
+
];
|
|
855
|
+
const worksheet = XLSX.utils.aoa_to_sheet(rows);
|
|
856
|
+
worksheet["!merges"] = [{ s: { r: 0, c: 0 }, e: { r: 0, c: 17 } }];
|
|
857
|
+
worksheet["!cols"] = headers.map((_, index) => ({ wch: index === 1 ? 24 : index === 6 || index === 7 ? 18 : 13 }));
|
|
858
|
+
worksheet["!pageSetup"] = { orientation: "landscape", paperSize: 9, fitToPage: true, fitToWidth: 1, fitToHeight: 1 };
|
|
859
|
+
const title = worksheet.A1;
|
|
860
|
+
if (title)
|
|
861
|
+
title.s = titleStyle;
|
|
862
|
+
for (let col = 0; col < headers.length; col += 1) {
|
|
863
|
+
const cell = worksheet[XLSX.utils.encode_cell({ r: 5, c: col })];
|
|
864
|
+
if (cell)
|
|
865
|
+
cell.s = tableHeaderStyle;
|
|
866
|
+
}
|
|
867
|
+
const workbook = XLSX.utils.book_new();
|
|
868
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, "IIRUP");
|
|
869
|
+
XLSX.writeFile(workbook, filename ?? `IIRUP-${fileToken(display(data.iirupNo) || "preview")}.xlsx`, {
|
|
870
|
+
bookType: "xlsx",
|
|
871
|
+
cellStyles: true,
|
|
872
|
+
});
|
|
873
|
+
}
|