@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,273 @@
|
|
|
1
|
+
import * as XLSX from "xlsx-js-style";
|
|
2
|
+
const ICS_FIXED_ROWS = 14;
|
|
3
|
+
const ICS_TOTAL_COLUMNS = 7;
|
|
4
|
+
const BLACK = { rgb: "000000" };
|
|
5
|
+
function icsBorder(weight = "thin") {
|
|
6
|
+
const side = { style: weight, color: BLACK };
|
|
7
|
+
return { top: side, right: side, bottom: side, left: side };
|
|
8
|
+
}
|
|
9
|
+
function icsStyle(options = {}) {
|
|
10
|
+
return {
|
|
11
|
+
font: {
|
|
12
|
+
name: "Arial",
|
|
13
|
+
sz: options.size ?? 10,
|
|
14
|
+
bold: options.bold,
|
|
15
|
+
italic: options.italic,
|
|
16
|
+
color: BLACK,
|
|
17
|
+
},
|
|
18
|
+
alignment: {
|
|
19
|
+
horizontal: options.horizontal ?? "left",
|
|
20
|
+
vertical: options.vertical ?? "center",
|
|
21
|
+
wrapText: options.wrap ?? true,
|
|
22
|
+
},
|
|
23
|
+
border: options.border === "none"
|
|
24
|
+
? undefined
|
|
25
|
+
: icsBorder(options.border === "medium" ? "medium" : "thin"),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const noBorderStyle = icsStyle({ border: "none", wrap: false });
|
|
29
|
+
const titleStyle = icsStyle({
|
|
30
|
+
size: 14,
|
|
31
|
+
bold: true,
|
|
32
|
+
horizontal: "center",
|
|
33
|
+
border: "none",
|
|
34
|
+
wrap: false,
|
|
35
|
+
});
|
|
36
|
+
const appendixStyle = icsStyle({
|
|
37
|
+
size: 9,
|
|
38
|
+
italic: true,
|
|
39
|
+
horizontal: "right",
|
|
40
|
+
border: "none",
|
|
41
|
+
wrap: false,
|
|
42
|
+
});
|
|
43
|
+
const labelStyle = icsStyle({ size: 10, bold: true, border: "none", wrap: false });
|
|
44
|
+
const valueStyle = icsStyle({ size: 10, border: "none", wrap: false });
|
|
45
|
+
const headerStyle = icsStyle({ size: 9, bold: true, horizontal: "center", border: "medium" });
|
|
46
|
+
const bodyLeftStyle = icsStyle({ size: 9, border: "thin", vertical: "top" });
|
|
47
|
+
const bodyCenterStyle = icsStyle({ size: 9, horizontal: "center", border: "thin", vertical: "top" });
|
|
48
|
+
const bodyRightStyle = icsStyle({ size: 9, horizontal: "right", border: "thin", vertical: "top" });
|
|
49
|
+
const noteStyle = icsStyle({ size: 9, italic: true, horizontal: "center", border: "thin" });
|
|
50
|
+
const signHeaderStyle = icsStyle({ size: 10, bold: true, border: "medium", vertical: "top" });
|
|
51
|
+
const signValueStyle = icsStyle({ size: 10, horizontal: "center", border: "medium" });
|
|
52
|
+
const signCaptionStyle = icsStyle({ size: 9, horizontal: "center", border: "medium", wrap: true });
|
|
53
|
+
function fmtDate(value) {
|
|
54
|
+
if (!value || value.trim() === "")
|
|
55
|
+
return "";
|
|
56
|
+
const date = new Date(value);
|
|
57
|
+
return Number.isNaN(date.getTime()) ? value : date.toLocaleDateString("en-PH");
|
|
58
|
+
}
|
|
59
|
+
function fmtAmount(value) {
|
|
60
|
+
if (!value || value.trim() === "")
|
|
61
|
+
return "";
|
|
62
|
+
const parsed = Number(value);
|
|
63
|
+
if (Number.isNaN(parsed))
|
|
64
|
+
return value;
|
|
65
|
+
return parsed.toLocaleString("en-PH", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
66
|
+
}
|
|
67
|
+
function fmtQty(value) {
|
|
68
|
+
if (!value || value.trim() === "")
|
|
69
|
+
return "";
|
|
70
|
+
const parsed = Number(value);
|
|
71
|
+
if (Number.isNaN(parsed) || parsed === 0)
|
|
72
|
+
return value;
|
|
73
|
+
return parsed.toLocaleString("en-PH");
|
|
74
|
+
}
|
|
75
|
+
function fileToken(value) {
|
|
76
|
+
return value.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
77
|
+
}
|
|
78
|
+
function writeCell(ws, row, col, value, style) {
|
|
79
|
+
const ref = XLSX.utils.encode_cell({ r: row, c: col });
|
|
80
|
+
ws[ref] = { v: value, t: typeof value === "number" ? "n" : "s", s: style };
|
|
81
|
+
}
|
|
82
|
+
function styleCell(ws, row, col, style) {
|
|
83
|
+
const ref = XLSX.utils.encode_cell({ r: row, c: col });
|
|
84
|
+
const existing = ws[ref];
|
|
85
|
+
ws[ref] = { v: existing?.v ?? "", t: existing?.t ?? "s", s: style };
|
|
86
|
+
}
|
|
87
|
+
export function exportIcsXlsx(values) {
|
|
88
|
+
const entityName = values.entityName ?? "";
|
|
89
|
+
const fundCluster = values.fundCluster ?? "";
|
|
90
|
+
const icsNo = values.icsNo ?? "";
|
|
91
|
+
const purchaseOrderNo = values.purchaseOrderNo ?? "";
|
|
92
|
+
const purchaseRequestRef = values.purchaseRequestRef ?? "";
|
|
93
|
+
const supplierName = values.supplierName ?? "";
|
|
94
|
+
const invoiceNo = values.invoiceNo ?? "";
|
|
95
|
+
const deliveryReceiptNo = values.deliveryReceiptNo ?? "";
|
|
96
|
+
const procurementRemarks = values.procurementRemarks ?? "";
|
|
97
|
+
const items = values.items ?? [];
|
|
98
|
+
const receivedByName = values.receivedByName ?? "";
|
|
99
|
+
const receivedByPosition = values.receivedByPosition ?? "";
|
|
100
|
+
const receivedByDate = values.receivedByDate ?? "";
|
|
101
|
+
const receivedFromName = values.receivedFromName ?? "";
|
|
102
|
+
const receivedFromPosition = values.receivedFromPosition ?? "";
|
|
103
|
+
const receivedFromDate = values.receivedFromDate ?? "";
|
|
104
|
+
const filledItems = items.filter(it => it.description ||
|
|
105
|
+
it.inventoryItemNo ||
|
|
106
|
+
(it.quantity && Number(it.quantity) > 0) ||
|
|
107
|
+
(it.unitCost && Number(it.unitCost) > 0));
|
|
108
|
+
const dataRowCount = Math.max(ICS_FIXED_ROWS, filledItems.length + 2);
|
|
109
|
+
const titleRow = 1;
|
|
110
|
+
const entityRow = 3;
|
|
111
|
+
const fundRow = 4;
|
|
112
|
+
const procurementRow1 = 5;
|
|
113
|
+
const procurementRow2 = 6;
|
|
114
|
+
const appendixRow = 7;
|
|
115
|
+
const headerRow1 = 8;
|
|
116
|
+
const headerRow2 = 9;
|
|
117
|
+
const dataStartRow = 10;
|
|
118
|
+
const totalRow = dataStartRow + dataRowCount;
|
|
119
|
+
const signStartRow = totalRow + 2;
|
|
120
|
+
const signEndRow = signStartRow + 11;
|
|
121
|
+
const totalRows = signEndRow + 1;
|
|
122
|
+
const aoa = Array.from({ length: totalRows }, () => Array.from({ length: ICS_TOTAL_COLUMNS }, () => ""));
|
|
123
|
+
const ws = XLSX.utils.aoa_to_sheet(aoa);
|
|
124
|
+
const merges = [];
|
|
125
|
+
// Title
|
|
126
|
+
writeCell(ws, titleRow, 0, "INVENTORY CUSTODIAN SLIP", titleStyle);
|
|
127
|
+
merges.push({ s: { r: titleRow, c: 0 }, e: { r: titleRow, c: 6 } });
|
|
128
|
+
// Entity Name
|
|
129
|
+
writeCell(ws, entityRow, 0, "Entity Name :", labelStyle);
|
|
130
|
+
writeCell(ws, entityRow, 1, entityName, valueStyle);
|
|
131
|
+
merges.push({ s: { r: entityRow, c: 1 }, e: { r: entityRow, c: 4 } });
|
|
132
|
+
// Fund Cluster / ICS No
|
|
133
|
+
writeCell(ws, fundRow, 0, "Fund Cluster :", labelStyle);
|
|
134
|
+
writeCell(ws, fundRow, 1, fundCluster, valueStyle);
|
|
135
|
+
merges.push({ s: { r: fundRow, c: 1 }, e: { r: fundRow, c: 3 } });
|
|
136
|
+
writeCell(ws, fundRow, 5, "ICS No. :", labelStyle);
|
|
137
|
+
writeCell(ws, fundRow, 6, icsNo, valueStyle);
|
|
138
|
+
writeCell(ws, procurementRow1, 0, "PO No. :", labelStyle);
|
|
139
|
+
writeCell(ws, procurementRow1, 1, purchaseOrderNo, valueStyle);
|
|
140
|
+
writeCell(ws, procurementRow1, 2, "PR Ref. :", labelStyle);
|
|
141
|
+
writeCell(ws, procurementRow1, 3, purchaseRequestRef, valueStyle);
|
|
142
|
+
writeCell(ws, procurementRow1, 4, "Invoice :", labelStyle);
|
|
143
|
+
writeCell(ws, procurementRow1, 5, invoiceNo, valueStyle);
|
|
144
|
+
writeCell(ws, procurementRow1, 6, deliveryReceiptNo ? `DR: ${deliveryReceiptNo}` : "", valueStyle);
|
|
145
|
+
writeCell(ws, procurementRow2, 0, "Supplier :", labelStyle);
|
|
146
|
+
writeCell(ws, procurementRow2, 1, supplierName, valueStyle);
|
|
147
|
+
merges.push({ s: { r: procurementRow2, c: 1 }, e: { r: procurementRow2, c: 2 } });
|
|
148
|
+
writeCell(ws, procurementRow2, 3, "Procurement Remarks :", labelStyle);
|
|
149
|
+
writeCell(ws, procurementRow2, 4, procurementRemarks, valueStyle);
|
|
150
|
+
merges.push({ s: { r: procurementRow2, c: 4 }, e: { r: procurementRow2, c: 6 } });
|
|
151
|
+
// Appendix
|
|
152
|
+
writeCell(ws, appendixRow, 6, "Appendix 59", appendixStyle);
|
|
153
|
+
// Table header row 1 (merged rows for most columns)
|
|
154
|
+
writeCell(ws, headerRow1, 0, "QTY", headerStyle);
|
|
155
|
+
merges.push({ s: { r: headerRow1, c: 0 }, e: { r: headerRow2, c: 0 } });
|
|
156
|
+
writeCell(ws, headerRow1, 1, "Unit", headerStyle);
|
|
157
|
+
merges.push({ s: { r: headerRow1, c: 1 }, e: { r: headerRow2, c: 1 } });
|
|
158
|
+
writeCell(ws, headerRow1, 2, "Amount", headerStyle);
|
|
159
|
+
merges.push({ s: { r: headerRow1, c: 2 }, e: { r: headerRow1, c: 3 } });
|
|
160
|
+
writeCell(ws, headerRow1, 4, "Description", headerStyle);
|
|
161
|
+
merges.push({ s: { r: headerRow1, c: 4 }, e: { r: headerRow2, c: 4 } });
|
|
162
|
+
writeCell(ws, headerRow1, 5, "Inventory\nItem No.", headerStyle);
|
|
163
|
+
merges.push({ s: { r: headerRow1, c: 5 }, e: { r: headerRow2, c: 5 } });
|
|
164
|
+
writeCell(ws, headerRow1, 6, "Estimated\nUseful Life", headerStyle);
|
|
165
|
+
merges.push({ s: { r: headerRow1, c: 6 }, e: { r: headerRow2, c: 6 } });
|
|
166
|
+
// Table header row 2 (Amount sub-columns)
|
|
167
|
+
writeCell(ws, headerRow2, 2, "Unit Cost", headerStyle);
|
|
168
|
+
writeCell(ws, headerRow2, 3, "Total Cost", headerStyle);
|
|
169
|
+
// Data rows
|
|
170
|
+
for (let i = 0; i < dataRowCount; i++) {
|
|
171
|
+
const excelRow = dataStartRow + i;
|
|
172
|
+
const item = filledItems[i];
|
|
173
|
+
if (item) {
|
|
174
|
+
writeCell(ws, excelRow, 0, fmtQty(item.quantity), bodyCenterStyle);
|
|
175
|
+
writeCell(ws, excelRow, 1, item.unit ?? "", bodyCenterStyle);
|
|
176
|
+
writeCell(ws, excelRow, 2, fmtAmount(item.unitCost), bodyRightStyle);
|
|
177
|
+
writeCell(ws, excelRow, 3, fmtAmount(item.totalCost), bodyRightStyle);
|
|
178
|
+
writeCell(ws, excelRow, 4, item.description ?? "", bodyLeftStyle);
|
|
179
|
+
writeCell(ws, excelRow, 5, item.inventoryItemNo ?? "", bodyLeftStyle);
|
|
180
|
+
writeCell(ws, excelRow, 6, item.estimatedUsefulLife ?? "", bodyCenterStyle);
|
|
181
|
+
}
|
|
182
|
+
else if (i === filledItems.length && filledItems.length > 0) {
|
|
183
|
+
writeCell(ws, excelRow, 4, "*****nothing follows*****", noteStyle);
|
|
184
|
+
for (let c = 0; c < ICS_TOTAL_COLUMNS; c++) {
|
|
185
|
+
if (c !== 4)
|
|
186
|
+
styleCell(ws, excelRow, c, bodyCenterStyle);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
for (let c = 0; c < ICS_TOTAL_COLUMNS; c++) {
|
|
191
|
+
styleCell(ws, excelRow, c, c === 2 || c === 3 ? bodyRightStyle : c === 4 ? bodyLeftStyle : bodyCenterStyle);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Total row
|
|
196
|
+
for (let c = 0; c < ICS_TOTAL_COLUMNS; c++) {
|
|
197
|
+
styleCell(ws, totalRow, c, bodyLeftStyle);
|
|
198
|
+
}
|
|
199
|
+
const totalCost = filledItems.reduce((sum, it) => sum + (Number(it.totalCost) || 0), 0);
|
|
200
|
+
writeCell(ws, totalRow, 3, totalCost > 0 ? fmtAmount(String(totalCost)) : "-", bodyRightStyle);
|
|
201
|
+
// Signature section
|
|
202
|
+
for (let r = signStartRow; r <= signEndRow; r++) {
|
|
203
|
+
merges.push({ s: { r, c: 0 }, e: { r, c: 2 } });
|
|
204
|
+
merges.push({ s: { r, c: 3 }, e: { r, c: 3 } });
|
|
205
|
+
merges.push({ s: { r, c: 4 }, e: { r, c: 6 } });
|
|
206
|
+
for (let c = 0; c < ICS_TOTAL_COLUMNS; c++)
|
|
207
|
+
styleCell(ws, r, c, signValueStyle);
|
|
208
|
+
}
|
|
209
|
+
writeCell(ws, signStartRow, 0, "Received by:", signHeaderStyle);
|
|
210
|
+
writeCell(ws, signStartRow, 4, "Received from:", signHeaderStyle);
|
|
211
|
+
writeCell(ws, signStartRow + 3, 0, receivedByName, signValueStyle);
|
|
212
|
+
writeCell(ws, signStartRow + 3, 4, receivedFromName, signValueStyle);
|
|
213
|
+
writeCell(ws, signStartRow + 4, 0, "Signature Over Printed Name", signCaptionStyle);
|
|
214
|
+
writeCell(ws, signStartRow + 4, 4, "Signature Over Printed Name", signCaptionStyle);
|
|
215
|
+
writeCell(ws, signStartRow + 6, 0, receivedByPosition, signValueStyle);
|
|
216
|
+
writeCell(ws, signStartRow + 6, 4, receivedFromPosition, signValueStyle);
|
|
217
|
+
writeCell(ws, signStartRow + 7, 0, "Position/Office", signCaptionStyle);
|
|
218
|
+
writeCell(ws, signStartRow + 7, 4, "Position/Office", signCaptionStyle);
|
|
219
|
+
writeCell(ws, signStartRow + 9, 0, fmtDate(receivedByDate), signValueStyle);
|
|
220
|
+
writeCell(ws, signStartRow + 9, 4, fmtDate(receivedFromDate), signValueStyle);
|
|
221
|
+
writeCell(ws, signStartRow + 10, 0, "Date", signCaptionStyle);
|
|
222
|
+
writeCell(ws, signStartRow + 10, 4, "Date", signCaptionStyle);
|
|
223
|
+
ws["!merges"] = merges;
|
|
224
|
+
ws["!cols"] = [
|
|
225
|
+
{ wch: 8 },
|
|
226
|
+
{ wch: 8 },
|
|
227
|
+
{ wch: 12 },
|
|
228
|
+
{ wch: 12 },
|
|
229
|
+
{ wch: 36 },
|
|
230
|
+
{ wch: 16 },
|
|
231
|
+
{ wch: 14 },
|
|
232
|
+
];
|
|
233
|
+
ws["!rows"] = Array.from({ length: totalRows }, (_, rowIndex) => {
|
|
234
|
+
if (rowIndex === titleRow)
|
|
235
|
+
return { hpt: 24 };
|
|
236
|
+
if (rowIndex === headerRow1 || rowIndex === headerRow2)
|
|
237
|
+
return { hpt: 22 };
|
|
238
|
+
if (rowIndex >= dataStartRow && rowIndex <= totalRow)
|
|
239
|
+
return { hpt: 16 };
|
|
240
|
+
if (rowIndex >= signStartRow && rowIndex <= signEndRow)
|
|
241
|
+
return { hpt: 20 };
|
|
242
|
+
return { hpt: 14 };
|
|
243
|
+
});
|
|
244
|
+
// Fill empty cells with noBorderStyle
|
|
245
|
+
for (let rowIndex = 0; rowIndex < totalRows; rowIndex++) {
|
|
246
|
+
for (let colIndex = 0; colIndex < ICS_TOTAL_COLUMNS; colIndex++) {
|
|
247
|
+
const ref = XLSX.utils.encode_cell({ r: rowIndex, c: colIndex });
|
|
248
|
+
const existing = ws[ref];
|
|
249
|
+
if (!existing)
|
|
250
|
+
writeCell(ws, rowIndex, colIndex, "", noBorderStyle);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const printableSheet = ws;
|
|
254
|
+
printableSheet["!margins"] = {
|
|
255
|
+
left: 0.25,
|
|
256
|
+
right: 0.25,
|
|
257
|
+
top: 0.35,
|
|
258
|
+
bottom: 0.35,
|
|
259
|
+
header: 0.2,
|
|
260
|
+
footer: 0.2,
|
|
261
|
+
};
|
|
262
|
+
printableSheet["!pageSetup"] = {
|
|
263
|
+
orientation: "portrait",
|
|
264
|
+
paperSize: 9,
|
|
265
|
+
fitToWidth: 1,
|
|
266
|
+
fitToHeight: 0,
|
|
267
|
+
horizontalDpi: 300,
|
|
268
|
+
verticalDpi: 300,
|
|
269
|
+
};
|
|
270
|
+
const wb = XLSX.utils.book_new();
|
|
271
|
+
XLSX.utils.book_append_sheet(wb, ws, "ICS");
|
|
272
|
+
XLSX.writeFile(wb, `ics-${fileToken(icsNo || "ICS")}.xlsx`);
|
|
273
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ParXlsxValues = {
|
|
2
|
+
entityName?: string;
|
|
3
|
+
fundCluster?: string;
|
|
4
|
+
parNo?: string;
|
|
5
|
+
quantity?: string;
|
|
6
|
+
unit?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
propertyNumber?: string;
|
|
9
|
+
dateAcquired?: string;
|
|
10
|
+
amount?: string;
|
|
11
|
+
receivedByName?: string;
|
|
12
|
+
receivedByPosition?: string;
|
|
13
|
+
receivedByDate?: string;
|
|
14
|
+
issuedByName?: string;
|
|
15
|
+
issuedByPosition?: string;
|
|
16
|
+
issuedByDate?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function exportParXlsx(values: ParXlsxValues): void;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import * as XLSX from "xlsx-js-style";
|
|
2
|
+
const PAR_FIXED_ROWS = 28;
|
|
3
|
+
const PAR_TOTAL_COLUMNS = 6;
|
|
4
|
+
const BLACK = { rgb: "000000" };
|
|
5
|
+
function parBorder(weight = "thin") {
|
|
6
|
+
const side = { style: weight, color: BLACK };
|
|
7
|
+
return { top: side, right: side, bottom: side, left: side };
|
|
8
|
+
}
|
|
9
|
+
function parStyle(options = {}) {
|
|
10
|
+
return {
|
|
11
|
+
font: {
|
|
12
|
+
name: "Times New Roman",
|
|
13
|
+
sz: options.size ?? 10,
|
|
14
|
+
bold: options.bold,
|
|
15
|
+
italic: options.italic,
|
|
16
|
+
color: BLACK,
|
|
17
|
+
},
|
|
18
|
+
alignment: {
|
|
19
|
+
horizontal: options.horizontal ?? "left",
|
|
20
|
+
vertical: options.vertical ?? "center",
|
|
21
|
+
wrapText: options.wrap ?? true,
|
|
22
|
+
},
|
|
23
|
+
border: options.border === "none" ? undefined : parBorder(options.border === "medium" ? "medium" : "thin"),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const noBorderStyle = parStyle({ border: "none", wrap: false });
|
|
27
|
+
const titleStyle = parStyle({ size: 16, bold: true, horizontal: "center", border: "none", wrap: false });
|
|
28
|
+
const appendixStyle = parStyle({ size: 9, italic: true, horizontal: "right", border: "none", wrap: false });
|
|
29
|
+
const labelStyle = parStyle({ size: 10, bold: true, border: "none", wrap: false });
|
|
30
|
+
const valueStyle = parStyle({ size: 10, border: "none", wrap: false });
|
|
31
|
+
const headerStyle = parStyle({ size: 10, bold: true, horizontal: "center", border: "medium" });
|
|
32
|
+
const bodyLeftStyle = parStyle({ size: 10, border: "thin", vertical: "top" });
|
|
33
|
+
const bodyCenterStyle = parStyle({ size: 10, horizontal: "center", border: "thin", vertical: "top" });
|
|
34
|
+
const bodyRightStyle = parStyle({ size: 10, horizontal: "right", border: "thin", vertical: "top" });
|
|
35
|
+
const noteStyle = parStyle({ size: 10, italic: true, horizontal: "center", border: "thin" });
|
|
36
|
+
const totalLabelStyle = parStyle({ size: 10, bold: true, horizontal: "center", border: "thin" });
|
|
37
|
+
const totalAmountStyle = parStyle({ size: 10, bold: true, horizontal: "right", border: "thin" });
|
|
38
|
+
const signHeaderStyle = parStyle({ size: 10, bold: true, border: "medium", vertical: "top" });
|
|
39
|
+
const signValueStyle = parStyle({ size: 10, horizontal: "center", border: "medium" });
|
|
40
|
+
const signCaptionStyle = parStyle({ size: 10, horizontal: "center", border: "medium", wrap: true });
|
|
41
|
+
function fmtDate(value) {
|
|
42
|
+
if (!value || value.trim() === "")
|
|
43
|
+
return "";
|
|
44
|
+
const date = new Date(value);
|
|
45
|
+
return Number.isNaN(date.getTime()) ? value : date.toLocaleDateString("en-PH");
|
|
46
|
+
}
|
|
47
|
+
function fmtAmount(value) {
|
|
48
|
+
if (!value || value.trim() === "")
|
|
49
|
+
return "";
|
|
50
|
+
const parsed = Number(value);
|
|
51
|
+
if (Number.isNaN(parsed))
|
|
52
|
+
return value;
|
|
53
|
+
return parsed.toLocaleString("en-PH", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
54
|
+
}
|
|
55
|
+
function fileToken(value) {
|
|
56
|
+
return value.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
57
|
+
}
|
|
58
|
+
function writeCell(ws, row, col, value, style) {
|
|
59
|
+
const ref = XLSX.utils.encode_cell({ r: row, c: col });
|
|
60
|
+
ws[ref] = { v: value, t: typeof value === "number" ? "n" : "s", s: style };
|
|
61
|
+
}
|
|
62
|
+
function styleCell(ws, row, col, style) {
|
|
63
|
+
const ref = XLSX.utils.encode_cell({ r: row, c: col });
|
|
64
|
+
const existing = ws[ref];
|
|
65
|
+
ws[ref] = { v: existing?.v ?? "", t: existing?.t ?? "s", s: style };
|
|
66
|
+
}
|
|
67
|
+
export function exportParXlsx(values) {
|
|
68
|
+
const entityName = values.entityName ?? "";
|
|
69
|
+
const fundCluster = values.fundCluster ?? "";
|
|
70
|
+
const parNo = values.parNo ?? "";
|
|
71
|
+
const quantity = values.quantity ?? "";
|
|
72
|
+
const unit = values.unit ?? "";
|
|
73
|
+
const description = values.description ?? "";
|
|
74
|
+
const propertyNumber = values.propertyNumber ?? "";
|
|
75
|
+
const dateAcquired = values.dateAcquired ?? "";
|
|
76
|
+
const amount = values.amount ?? "";
|
|
77
|
+
const receivedByName = values.receivedByName ?? "";
|
|
78
|
+
const receivedByPosition = values.receivedByPosition ?? "";
|
|
79
|
+
const receivedByDate = values.receivedByDate ?? "";
|
|
80
|
+
const issuedByName = values.issuedByName ?? "";
|
|
81
|
+
const issuedByPosition = values.issuedByPosition ?? "";
|
|
82
|
+
const issuedByDate = values.issuedByDate ?? "";
|
|
83
|
+
const hasData = Boolean(quantity || unit || description || propertyNumber || dateAcquired || amount);
|
|
84
|
+
const hasAmount = amount.trim().length > 0;
|
|
85
|
+
const titleRow = 1;
|
|
86
|
+
const entityRow = 3;
|
|
87
|
+
const fundRow = 4;
|
|
88
|
+
const appendixRow = 5;
|
|
89
|
+
const headerRow = 6;
|
|
90
|
+
const dataStartRow = 7;
|
|
91
|
+
const totalRow = dataStartRow + PAR_FIXED_ROWS;
|
|
92
|
+
const signStartRow = totalRow + 2;
|
|
93
|
+
const signEndRow = signStartRow + 11;
|
|
94
|
+
const totalRows = signEndRow + 1;
|
|
95
|
+
const aoa = Array.from({ length: totalRows }, () => Array.from({ length: PAR_TOTAL_COLUMNS }, () => ""));
|
|
96
|
+
const ws = XLSX.utils.aoa_to_sheet(aoa);
|
|
97
|
+
const merges = [];
|
|
98
|
+
writeCell(ws, titleRow, 0, "PROPERTY ACKNOWLEDGMENT RECEIPT", titleStyle);
|
|
99
|
+
merges.push({ s: { r: titleRow, c: 0 }, e: { r: titleRow, c: 5 } });
|
|
100
|
+
writeCell(ws, entityRow, 0, "Entity Name :", labelStyle);
|
|
101
|
+
writeCell(ws, entityRow, 1, entityName, valueStyle);
|
|
102
|
+
merges.push({ s: { r: entityRow, c: 1 }, e: { r: entityRow, c: 3 } });
|
|
103
|
+
writeCell(ws, fundRow, 0, "Fund Cluster :", labelStyle);
|
|
104
|
+
writeCell(ws, fundRow, 1, fundCluster, valueStyle);
|
|
105
|
+
merges.push({ s: { r: fundRow, c: 1 }, e: { r: fundRow, c: 2 } });
|
|
106
|
+
writeCell(ws, fundRow, 4, "PAR No. :", labelStyle);
|
|
107
|
+
writeCell(ws, fundRow, 5, parNo, valueStyle);
|
|
108
|
+
writeCell(ws, appendixRow, 5, "Appendix 71", appendixStyle);
|
|
109
|
+
const tableHeaders = ["Quantity", "Unit", "Description", "Property\nNumber", "Date\nAcquired", "Amount"];
|
|
110
|
+
tableHeaders.forEach((text, idx) => writeCell(ws, headerRow, idx, text, headerStyle));
|
|
111
|
+
if (hasData) {
|
|
112
|
+
writeCell(ws, dataStartRow, 0, quantity, bodyCenterStyle);
|
|
113
|
+
writeCell(ws, dataStartRow, 1, unit, bodyCenterStyle);
|
|
114
|
+
writeCell(ws, dataStartRow, 2, description, bodyLeftStyle);
|
|
115
|
+
writeCell(ws, dataStartRow, 3, propertyNumber, bodyLeftStyle);
|
|
116
|
+
writeCell(ws, dataStartRow, 4, fmtDate(dateAcquired), bodyCenterStyle);
|
|
117
|
+
writeCell(ws, dataStartRow, 5, fmtAmount(amount), bodyRightStyle);
|
|
118
|
+
}
|
|
119
|
+
for (let i = 0; i < PAR_FIXED_ROWS; i++) {
|
|
120
|
+
const excelRow = dataStartRow + i;
|
|
121
|
+
if (hasData && i === 0)
|
|
122
|
+
continue;
|
|
123
|
+
for (let c = 0; c < PAR_TOTAL_COLUMNS; c++) {
|
|
124
|
+
styleCell(ws, excelRow, c, c === 0 || c === 1 || c === 4 ? bodyCenterStyle : c === 5 ? bodyRightStyle : bodyLeftStyle);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const nothingFollowsRow = dataStartRow + (hasData ? 2 : 1);
|
|
128
|
+
writeCell(ws, nothingFollowsRow, 2, "***nothing follows***", noteStyle);
|
|
129
|
+
for (let c = 0; c < PAR_TOTAL_COLUMNS; c++) {
|
|
130
|
+
styleCell(ws, totalRow, c, c === 5 ? totalAmountStyle : c === 3 ? totalLabelStyle : bodyLeftStyle);
|
|
131
|
+
}
|
|
132
|
+
writeCell(ws, totalRow, 3, "TOTAL", totalLabelStyle);
|
|
133
|
+
writeCell(ws, totalRow, 5, hasAmount ? fmtAmount(amount) : "-", totalAmountStyle);
|
|
134
|
+
for (let r = signStartRow; r <= signEndRow; r++) {
|
|
135
|
+
merges.push({ s: { r, c: 0 }, e: { r, c: 2 } });
|
|
136
|
+
merges.push({ s: { r, c: 3 }, e: { r, c: 5 } });
|
|
137
|
+
for (let c = 0; c < PAR_TOTAL_COLUMNS; c++)
|
|
138
|
+
styleCell(ws, r, c, signValueStyle);
|
|
139
|
+
}
|
|
140
|
+
writeCell(ws, signStartRow, 0, "Received by:", signHeaderStyle);
|
|
141
|
+
writeCell(ws, signStartRow, 3, "Issued by:", signHeaderStyle);
|
|
142
|
+
writeCell(ws, signStartRow + 3, 0, receivedByName, signValueStyle);
|
|
143
|
+
writeCell(ws, signStartRow + 3, 3, issuedByName, signValueStyle);
|
|
144
|
+
writeCell(ws, signStartRow + 4, 0, "Signature over Printed Name of End-User", signCaptionStyle);
|
|
145
|
+
writeCell(ws, signStartRow + 4, 3, "Signature over Printed Name", signCaptionStyle);
|
|
146
|
+
writeCell(ws, signStartRow + 6, 0, receivedByPosition, signValueStyle);
|
|
147
|
+
writeCell(ws, signStartRow + 6, 3, issuedByPosition, signValueStyle);
|
|
148
|
+
writeCell(ws, signStartRow + 7, 0, "Position/Office", signCaptionStyle);
|
|
149
|
+
writeCell(ws, signStartRow + 7, 3, "Position/Office", signCaptionStyle);
|
|
150
|
+
writeCell(ws, signStartRow + 9, 0, fmtDate(receivedByDate), signValueStyle);
|
|
151
|
+
writeCell(ws, signStartRow + 9, 3, fmtDate(issuedByDate), signValueStyle);
|
|
152
|
+
writeCell(ws, signStartRow + 10, 0, "Date", signCaptionStyle);
|
|
153
|
+
writeCell(ws, signStartRow + 10, 3, "Date", signCaptionStyle);
|
|
154
|
+
ws["!merges"] = merges;
|
|
155
|
+
ws["!cols"] = [{ wch: 11 }, { wch: 8 }, { wch: 39 }, { wch: 16 }, { wch: 16 }, { wch: 14 }];
|
|
156
|
+
ws["!rows"] = Array.from({ length: totalRows }, (_, rowIndex) => {
|
|
157
|
+
if (rowIndex === titleRow)
|
|
158
|
+
return { hpt: 26 };
|
|
159
|
+
if (rowIndex === headerRow)
|
|
160
|
+
return { hpt: 24 };
|
|
161
|
+
if (rowIndex >= dataStartRow && rowIndex <= totalRow)
|
|
162
|
+
return { hpt: 18 };
|
|
163
|
+
if (rowIndex >= signStartRow && rowIndex <= signEndRow)
|
|
164
|
+
return { hpt: 20 };
|
|
165
|
+
return { hpt: 16 };
|
|
166
|
+
});
|
|
167
|
+
for (let rowIndex = 0; rowIndex < totalRows; rowIndex++) {
|
|
168
|
+
for (let colIndex = 0; colIndex < PAR_TOTAL_COLUMNS; colIndex++) {
|
|
169
|
+
const ref = XLSX.utils.encode_cell({ r: rowIndex, c: colIndex });
|
|
170
|
+
const existing = ws[ref];
|
|
171
|
+
if (!existing)
|
|
172
|
+
writeCell(ws, rowIndex, colIndex, "", noBorderStyle);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const printableSheet = ws;
|
|
176
|
+
printableSheet["!margins"] = { left: 0.25, right: 0.25, top: 0.35, bottom: 0.35, header: 0.2, footer: 0.2 };
|
|
177
|
+
printableSheet["!pageSetup"] = { orientation: "portrait", paperSize: 9, fitToWidth: 1, fitToHeight: 0, horizontalDpi: 300, verticalDpi: 300 };
|
|
178
|
+
const wb = XLSX.utils.book_new();
|
|
179
|
+
XLSX.utils.book_append_sheet(wb, ws, "PAR");
|
|
180
|
+
XLSX.writeFile(wb, `par-${fileToken(parNo || "PAR")}.xlsx`);
|
|
181
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import jsPDF from "jspdf";
|
|
3
|
+
type PdfOrientation = "portrait" | "landscape";
|
|
4
|
+
export declare function resolvePdfOrientation(configured: string | undefined, width: number, height: number): PdfOrientation;
|
|
5
|
+
export declare function createDownloadablePdfBlob(pdf: jsPDF): Blob;
|
|
6
|
+
export declare function renderPreviewToCanvas(root: HTMLElement): Promise<{
|
|
7
|
+
canvas: HTMLCanvasElement;
|
|
8
|
+
orientation: PdfOrientation;
|
|
9
|
+
fitOnePage: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function exportPreviewElementToPdf(root: HTMLElement, filename: string): Promise<void>;
|
|
12
|
+
export declare function exportPreviewReactToPdf(content: ReactNode, filename: string): Promise<void>;
|
|
13
|
+
export {};
|