@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.
Files changed (325) hide show
  1. package/FORM_CATALOG.md +44 -0
  2. package/README.md +165 -0
  3. package/dist/definitions.d.ts +1147 -0
  4. package/dist/definitions.js +60 -0
  5. package/dist/forms/iar.d.ts +172 -0
  6. package/dist/forms/iar.js +6 -0
  7. package/dist/forms/ics.d.ts +48 -0
  8. package/dist/forms/ics.js +6 -0
  9. package/dist/forms/iirup.d.ts +54 -0
  10. package/dist/forms/iirup.js +6 -0
  11. package/dist/forms/iirusp.d.ts +32 -0
  12. package/dist/forms/iirusp.js +6 -0
  13. package/dist/forms/itr.d.ts +42 -0
  14. package/dist/forms/itr.js +6 -0
  15. package/dist/forms/par.d.ts +84 -0
  16. package/dist/forms/par.js +6 -0
  17. package/dist/forms/ppelc.d.ts +34 -0
  18. package/dist/forms/ppelc.js +6 -0
  19. package/dist/forms/pr.d.ts +27 -0
  20. package/dist/forms/pr.js +6 -0
  21. package/dist/forms/property-card.d.ts +68 -0
  22. package/dist/forms/property-card.js +6 -0
  23. package/dist/forms/ptr.d.ts +54 -0
  24. package/dist/forms/ptr.js +6 -0
  25. package/dist/forms/regspi.d.ts +32 -0
  26. package/dist/forms/regspi.js +6 -0
  27. package/dist/forms/ris.d.ts +66 -0
  28. package/dist/forms/ris.js +6 -0
  29. package/dist/forms/rlsddp.d.ts +54 -0
  30. package/dist/forms/rlsddp.js +6 -0
  31. package/dist/forms/rlsddsp.d.ts +42 -0
  32. package/dist/forms/rlsddsp.js +6 -0
  33. package/dist/forms/rpci.d.ts +32 -0
  34. package/dist/forms/rpci.js +6 -0
  35. package/dist/forms/rpcppe.d.ts +32 -0
  36. package/dist/forms/rpcppe.js +6 -0
  37. package/dist/forms/rpcsp.d.ts +32 -0
  38. package/dist/forms/rpcsp.js +6 -0
  39. package/dist/forms/rrsp.d.ts +32 -0
  40. package/dist/forms/rrsp.js +6 -0
  41. package/dist/forms/rsmi.d.ts +32 -0
  42. package/dist/forms/rsmi.js +6 -0
  43. package/dist/forms/rsmp.d.ts +33 -0
  44. package/dist/forms/rsmp.js +6 -0
  45. package/dist/forms/rspi.d.ts +32 -0
  46. package/dist/forms/rspi.js +6 -0
  47. package/dist/forms/spc.d.ts +37 -0
  48. package/dist/forms/spc.js +6 -0
  49. package/dist/forms/splc.d.ts +41 -0
  50. package/dist/forms/splc.js +6 -0
  51. package/dist/forms/stock-card.d.ts +28 -0
  52. package/dist/forms/stock-card.js +6 -0
  53. package/dist/forms/wmr.d.ts +32 -0
  54. package/dist/forms/wmr.js +6 -0
  55. package/dist/gam/components/gam-report-workbench.d.ts +40 -0
  56. package/dist/gam/components/gam-report-workbench.js +2 -0
  57. package/dist/gam/components/grand-total-computation.d.ts +10 -0
  58. package/dist/gam/components/grand-total-computation.js +26 -0
  59. package/dist/gam/components/iar-preview.d.ts +30 -0
  60. package/dist/gam/components/iar-preview.js +150 -0
  61. package/dist/gam/components/ics-preview.d.ts +31 -0
  62. package/dist/gam/components/ics-preview.js +114 -0
  63. package/dist/gam/components/iirup-preview.d.ts +42 -0
  64. package/dist/gam/components/iirup-preview.js +237 -0
  65. package/dist/gam/components/itr-preview.d.ts +31 -0
  66. package/dist/gam/components/itr-preview.js +180 -0
  67. package/dist/gam/components/par-preview.d.ts +28 -0
  68. package/dist/gam/components/par-preview.js +95 -0
  69. package/dist/gam/components/ppelc-preview.d.ts +28 -0
  70. package/dist/gam/components/ppelc-preview.js +128 -0
  71. package/dist/gam/components/property-card-preview.d.ts +21 -0
  72. package/dist/gam/components/property-card-preview.js +117 -0
  73. package/dist/gam/components/ptr-preview.d.ts +36 -0
  74. package/dist/gam/components/ptr-preview.js +122 -0
  75. package/dist/gam/components/purchase-order-page-client.d.ts +66 -0
  76. package/dist/gam/components/purchase-order-page-client.js +179 -0
  77. package/dist/gam/components/reg-spi-preview.d.ts +28 -0
  78. package/dist/gam/components/reg-spi-preview.js +138 -0
  79. package/dist/gam/components/ris-form.d.ts +13 -0
  80. package/dist/gam/components/ris-form.js +20 -0
  81. package/dist/gam/components/ris-preview.d.ts +7 -0
  82. package/dist/gam/components/ris-preview.js +16 -0
  83. package/dist/gam/components/rlsddp-preview.d.ts +34 -0
  84. package/dist/gam/components/rlsddp-preview.js +251 -0
  85. package/dist/gam/components/rlsddsp-preview.d.ts +33 -0
  86. package/dist/gam/components/rlsddsp-preview.js +226 -0
  87. package/dist/gam/components/rpci-preview.d.ts +27 -0
  88. package/dist/gam/components/rpci-preview.js +123 -0
  89. package/dist/gam/components/rpcppe-preview.d.ts +28 -0
  90. package/dist/gam/components/rpcppe-preview.js +133 -0
  91. package/dist/gam/components/rpcsp-preview.d.ts +29 -0
  92. package/dist/gam/components/rpcsp-preview.js +81 -0
  93. package/dist/gam/components/rspi-preview.d.ts +23 -0
  94. package/dist/gam/components/rspi-preview.js +72 -0
  95. package/dist/gam/components/spc-preview.d.ts +23 -0
  96. package/dist/gam/components/spc-preview.js +149 -0
  97. package/dist/gam/components/splc-entry-form.d.ts +14 -0
  98. package/dist/gam/components/splc-entry-form.js +6 -0
  99. package/dist/gam/components/splc-preview.d.ts +27 -0
  100. package/dist/gam/components/splc-preview.js +192 -0
  101. package/dist/gam/components/stock-card-preview.d.ts +14 -0
  102. package/dist/gam/components/stock-card-preview.js +17 -0
  103. package/dist/gam/config/new-report-config.d.ts +1094 -0
  104. package/dist/gam/config/new-report-config.js +1478 -0
  105. package/dist/gam/purchase-order-flow.d.ts +146 -0
  106. package/dist/gam/purchase-order-flow.js +173 -0
  107. package/dist/gam/purchase-request/workflow.d.ts +19 -0
  108. package/dist/gam/purchase-request/workflow.js +45 -0
  109. package/dist/gam/types/ris-types.d.ts +37 -0
  110. package/dist/gam/types/ris-types.js +1 -0
  111. package/dist/gam/utils/export-ics-xlsx.d.ts +28 -0
  112. package/dist/gam/utils/export-ics-xlsx.js +273 -0
  113. package/dist/gam/utils/export-par-xlsx.d.ts +18 -0
  114. package/dist/gam/utils/export-par-xlsx.js +181 -0
  115. package/dist/gam/utils/export-preview-pdf.d.ts +13 -0
  116. package/dist/gam/utils/export-preview-pdf.js +270 -0
  117. package/dist/gam/utils/export-report-xlsx.d.ts +228 -0
  118. package/dist/gam/utils/export-report-xlsx.js +873 -0
  119. package/dist/gam/utils/line-totals.d.ts +6 -0
  120. package/dist/gam/utils/line-totals.js +18 -0
  121. package/dist/gam/utils/monetary-input.d.ts +6 -0
  122. package/dist/gam/utils/monetary-input.js +18 -0
  123. package/dist/gam/utils/print-element.d.ts +8 -0
  124. package/dist/gam/utils/print-element.js +157 -0
  125. package/dist/government-form.d.ts +16 -0
  126. package/dist/government-form.js +45 -0
  127. package/dist/index.d.ts +49 -0
  128. package/dist/index.js +50 -0
  129. package/dist/internal/components/configurable-form-layout.d.ts +20 -0
  130. package/dist/internal/components/configurable-form-layout.js +49 -0
  131. package/dist/internal/components/ui/badge.d.ts +7 -0
  132. package/dist/internal/components/ui/badge.js +34 -0
  133. package/dist/internal/components/ui/button.d.ts +10 -0
  134. package/dist/internal/components/ui/button.js +35 -0
  135. package/dist/internal/components/ui/calendar.d.ts +8 -0
  136. package/dist/internal/components/ui/calendar.js +77 -0
  137. package/dist/internal/components/ui/command.d.ts +19 -0
  138. package/dist/internal/components/ui/command.js +36 -0
  139. package/dist/internal/components/ui/date-input.d.ts +14 -0
  140. package/dist/internal/components/ui/date-input.js +33 -0
  141. package/dist/internal/components/ui/date-picker.d.ts +19 -0
  142. package/dist/internal/components/ui/date-picker.js +34 -0
  143. package/dist/internal/components/ui/dialog.d.ts +18 -0
  144. package/dist/internal/components/ui/dialog.js +38 -0
  145. package/dist/internal/components/ui/input-group.d.ts +18 -0
  146. package/dist/internal/components/ui/input-group.js +57 -0
  147. package/dist/internal/components/ui/input.d.ts +3 -0
  148. package/dist/internal/components/ui/input.js +12 -0
  149. package/dist/internal/components/ui/label.d.ts +3 -0
  150. package/dist/internal/components/ui/label.js +7 -0
  151. package/dist/internal/components/ui/popover.d.ts +9 -0
  152. package/dist/internal/components/ui/popover.js +23 -0
  153. package/dist/internal/components/ui/select.d.ts +17 -0
  154. package/dist/internal/components/ui/select.js +35 -0
  155. package/dist/internal/components/ui/switch.d.ts +5 -0
  156. package/dist/internal/components/ui/switch.js +8 -0
  157. package/dist/internal/components/ui/table.d.ts +10 -0
  158. package/dist/internal/components/ui/table.js +28 -0
  159. package/dist/internal/components/ui/tabs.d.ts +10 -0
  160. package/dist/internal/components/ui/tabs.js +29 -0
  161. package/dist/internal/components/ui/textarea.d.ts +3 -0
  162. package/dist/internal/components/ui/textarea.js +7 -0
  163. package/dist/internal/components/ui/tooltip.d.ts +6 -0
  164. package/dist/internal/components/ui/tooltip.js +17 -0
  165. package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.d.ts +112 -0
  166. package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.js +91 -0
  167. package/dist/internal/hooks/use-form-field-order.d.ts +7 -0
  168. package/dist/internal/hooks/use-form-field-order.js +43 -0
  169. package/dist/internal/lib/utils.d.ts +2 -0
  170. package/dist/internal/lib/utils.js +3 -0
  171. package/dist/inventory/components/inventory-item-form.d.ts +7 -0
  172. package/dist/inventory/components/inventory-item-form.js +5 -0
  173. package/dist/inventory/components/inventory-item-preview.d.ts +6 -0
  174. package/dist/inventory/components/inventory-item-preview.js +5 -0
  175. package/dist/inventory/iar.d.ts +4 -0
  176. package/dist/inventory/iar.js +4 -0
  177. package/dist/inventory/ics.d.ts +2 -0
  178. package/dist/inventory/ics.js +3 -0
  179. package/dist/inventory/iirup.d.ts +2 -0
  180. package/dist/inventory/iirup.js +3 -0
  181. package/dist/inventory/iirusp.d.ts +4 -0
  182. package/dist/inventory/iirusp.js +4 -0
  183. package/dist/inventory/index.d.ts +3 -0
  184. package/dist/inventory/index.js +4 -0
  185. package/dist/inventory/item.d.ts +3 -0
  186. package/dist/inventory/item.js +3 -0
  187. package/dist/inventory/itr.d.ts +4 -0
  188. package/dist/inventory/itr.js +4 -0
  189. package/dist/inventory/par.d.ts +2 -0
  190. package/dist/inventory/par.js +3 -0
  191. package/dist/inventory/po.d.ts +2 -0
  192. package/dist/inventory/po.js +2 -0
  193. package/dist/inventory/ppelc.d.ts +2 -0
  194. package/dist/inventory/ppelc.js +3 -0
  195. package/dist/inventory/pplc.d.ts +2 -0
  196. package/dist/inventory/pplc.js +4 -0
  197. package/dist/inventory/pr.d.ts +4 -0
  198. package/dist/inventory/pr.js +4 -0
  199. package/dist/inventory/property-card.d.ts +2 -0
  200. package/dist/inventory/property-card.js +3 -0
  201. package/dist/inventory/ptr.d.ts +2 -0
  202. package/dist/inventory/ptr.js +3 -0
  203. package/dist/inventory/regspi.d.ts +4 -0
  204. package/dist/inventory/regspi.js +4 -0
  205. package/dist/inventory/ris.d.ts +4 -0
  206. package/dist/inventory/ris.js +4 -0
  207. package/dist/inventory/rlsddp.d.ts +4 -0
  208. package/dist/inventory/rlsddp.js +4 -0
  209. package/dist/inventory/rlsddsp.d.ts +2 -0
  210. package/dist/inventory/rlsddsp.js +3 -0
  211. package/dist/inventory/rpci.d.ts +2 -0
  212. package/dist/inventory/rpci.js +3 -0
  213. package/dist/inventory/rpcppe.d.ts +2 -0
  214. package/dist/inventory/rpcppe.js +3 -0
  215. package/dist/inventory/rpcsp.d.ts +2 -0
  216. package/dist/inventory/rpcsp.js +3 -0
  217. package/dist/inventory/rrsp.d.ts +2 -0
  218. package/dist/inventory/rrsp.js +3 -0
  219. package/dist/inventory/rsmi.d.ts +4 -0
  220. package/dist/inventory/rsmi.js +4 -0
  221. package/dist/inventory/rsmp.d.ts +4 -0
  222. package/dist/inventory/rsmp.js +4 -0
  223. package/dist/inventory/rspi.d.ts +2 -0
  224. package/dist/inventory/rspi.js +3 -0
  225. package/dist/inventory/spc.d.ts +2 -0
  226. package/dist/inventory/spc.js +3 -0
  227. package/dist/inventory/splc.d.ts +3 -0
  228. package/dist/inventory/splc.js +4 -0
  229. package/dist/inventory/stock-card.d.ts +4 -0
  230. package/dist/inventory/stock-card.js +4 -0
  231. package/dist/inventory/types.d.ts +11 -0
  232. package/dist/inventory/types.js +1 -0
  233. package/dist/inventory/wmr.d.ts +4 -0
  234. package/dist/inventory/wmr.js +4 -0
  235. package/dist/lib/rpcsp-accountable-person.d.ts +1 -0
  236. package/dist/lib/rpcsp-accountable-person.js +10 -0
  237. package/dist/reports/iar/_components/create-form.d.ts +13 -0
  238. package/dist/reports/iar/_components/create-form.js +92 -0
  239. package/dist/reports/iar/_components/document-preview.d.ts +11 -0
  240. package/dist/reports/iar/_components/document-preview.js +131 -0
  241. package/dist/reports/iar/types.d.ts +97 -0
  242. package/dist/reports/iar/types.js +24 -0
  243. package/dist/reports/iirusp/_components/create-form.d.ts +17 -0
  244. package/dist/reports/iirusp/_components/create-form.js +118 -0
  245. package/dist/reports/iirusp/_components/document-preview.d.ts +8 -0
  246. package/dist/reports/iirusp/_components/document-preview.js +389 -0
  247. package/dist/reports/iirusp/types.d.ts +134 -0
  248. package/dist/reports/iirusp/types.js +29 -0
  249. package/dist/reports/iirusp/utils.d.ts +29 -0
  250. package/dist/reports/iirusp/utils.js +488 -0
  251. package/dist/reports/itr/_components/create-form.d.ts +28 -0
  252. package/dist/reports/itr/_components/create-form.js +90 -0
  253. package/dist/reports/itr/_components/document-preview.d.ts +6 -0
  254. package/dist/reports/itr/_components/document-preview.js +7 -0
  255. package/dist/reports/itr/types.d.ts +68 -0
  256. package/dist/reports/itr/types.js +27 -0
  257. package/dist/reports/itr/utils.d.ts +24 -0
  258. package/dist/reports/itr/utils.js +76 -0
  259. package/dist/reports/pr/_components/create-form.d.ts +16 -0
  260. package/dist/reports/pr/_components/create-form.js +52 -0
  261. package/dist/reports/pr/_components/document-preview.d.ts +7 -0
  262. package/dist/reports/pr/_components/document-preview.js +9 -0
  263. package/dist/reports/pr/types.d.ts +69 -0
  264. package/dist/reports/pr/types.js +1 -0
  265. package/dist/reports/pr/utils.d.ts +72 -0
  266. package/dist/reports/pr/utils.js +572 -0
  267. package/dist/reports/regspi/_components/create-form.d.ts +19 -0
  268. package/dist/reports/regspi/_components/create-form.js +33 -0
  269. package/dist/reports/regspi/_components/document-preview.d.ts +6 -0
  270. package/dist/reports/regspi/_components/document-preview.js +7 -0
  271. package/dist/reports/regspi/types.d.ts +29 -0
  272. package/dist/reports/regspi/types.js +24 -0
  273. package/dist/reports/regspi/utils.d.ts +48 -0
  274. package/dist/reports/regspi/utils.js +98 -0
  275. package/dist/reports/ris/_components/create-form.d.ts +36 -0
  276. package/dist/reports/ris/_components/create-form.js +149 -0
  277. package/dist/reports/ris/_components/document-preview.d.ts +8 -0
  278. package/dist/reports/ris/_components/document-preview.js +31 -0
  279. package/dist/reports/ris/types.d.ts +93 -0
  280. package/dist/reports/ris/types.js +1 -0
  281. package/dist/reports/rlsddp/_components/create-form.d.ts +11 -0
  282. package/dist/reports/rlsddp/_components/create-form.js +165 -0
  283. package/dist/reports/rlsddp/_components/document-preview.d.ts +8 -0
  284. package/dist/reports/rlsddp/_components/document-preview.js +15 -0
  285. package/dist/reports/rlsddp/types.d.ts +105 -0
  286. package/dist/reports/rlsddp/types.js +31 -0
  287. package/dist/reports/rrsp/components/rrsp-preview.d.ts +21 -0
  288. package/dist/reports/rrsp/components/rrsp-preview.js +155 -0
  289. package/dist/reports/rsmi/components/rsmi-create-form.d.ts +20 -0
  290. package/dist/reports/rsmi/components/rsmi-create-form.js +8 -0
  291. package/dist/reports/rsmi/components/rsmi-document-body.d.ts +15 -0
  292. package/dist/reports/rsmi/components/rsmi-document-body.js +12 -0
  293. package/dist/reports/rsmi/components/rsmi-types.d.ts +45 -0
  294. package/dist/reports/rsmi/components/rsmi-types.js +1 -0
  295. package/dist/reports/rsmi/components/rsmi-utils.d.ts +2 -0
  296. package/dist/reports/rsmi/components/rsmi-utils.js +18 -0
  297. package/dist/reports/rsmp/components/rsmp-create-modal.d.ts +5 -0
  298. package/dist/reports/rsmp/components/rsmp-create-modal.js +7 -0
  299. package/dist/reports/rsmp/components/rsmp-preview-modal.d.ts +11 -0
  300. package/dist/reports/rsmp/components/rsmp-preview-modal.js +47 -0
  301. package/dist/reports/rsmp/components/rsmp-types.d.ts +44 -0
  302. package/dist/reports/rsmp/components/rsmp-types.js +1 -0
  303. package/dist/reports/rsmp/components/rsmp-utils.d.ts +5 -0
  304. package/dist/reports/rsmp/components/rsmp-utils.js +41 -0
  305. package/dist/reports/rsmp/lib/rsmp-grouping.d.ts +14 -0
  306. package/dist/reports/rsmp/lib/rsmp-grouping.js +75 -0
  307. package/dist/reports/stock-card/_components/create-form.d.ts +13 -0
  308. package/dist/reports/stock-card/_components/create-form.js +39 -0
  309. package/dist/reports/stock-card/_components/document-preview.d.ts +7 -0
  310. package/dist/reports/stock-card/_components/document-preview.js +29 -0
  311. package/dist/reports/stock-card/types.d.ts +31 -0
  312. package/dist/reports/stock-card/types.js +1 -0
  313. package/dist/reports/stock-card/utils.d.ts +32 -0
  314. package/dist/reports/stock-card/utils.js +248 -0
  315. package/dist/reports/wmr/_components/create-form.d.ts +22 -0
  316. package/dist/reports/wmr/_components/create-form.js +61 -0
  317. package/dist/reports/wmr/_components/document-preview.d.ts +10 -0
  318. package/dist/reports/wmr/_components/document-preview.js +59 -0
  319. package/dist/reports/wmr/types.d.ts +45 -0
  320. package/dist/reports/wmr/types.js +1 -0
  321. package/dist/reports/wmr/utils.d.ts +32 -0
  322. package/dist/reports/wmr/utils.js +343 -0
  323. package/dist/styles.css +4492 -0
  324. package/extraction-manifest.json +620 -0
  325. package/package.json +197 -0
@@ -0,0 +1,134 @@
1
+ export type IiruspStatus = "Draft" | "Submitted" | "Approved";
2
+ export type ModalMode = "create" | "view" | "edit";
3
+ export type IiruspItem = {
4
+ id?: number;
5
+ lineNo?: number;
6
+ dateAcquired?: string;
7
+ particularsArticles?: string;
8
+ propertyNo?: string;
9
+ qty: string;
10
+ unitCost: string;
11
+ totalCost: string;
12
+ accumulatedImpairmentLosses: string;
13
+ carryingAmount: string;
14
+ remarks?: string;
15
+ sale: string;
16
+ transfer: string;
17
+ destruction: string;
18
+ othersSpecify?: string;
19
+ total: string;
20
+ appraisedValue: string;
21
+ orNo?: string;
22
+ amount: string;
23
+ };
24
+ export type IiruspSignature = {
25
+ id: number;
26
+ sequenceNo: number;
27
+ label: string;
28
+ signedByUserId?: string | null;
29
+ signedByName?: string | null;
30
+ signature?: string | null;
31
+ signedAt?: string | null;
32
+ remarks?: string | null;
33
+ };
34
+ export type IiruspRecord = {
35
+ id: string;
36
+ iiruspNo: string;
37
+ documentTypeId?: number | null;
38
+ officeId?: string | null;
39
+ asAtDate?: string | null;
40
+ entityName: string;
41
+ fundCluster: string;
42
+ nameOfAccountableOfficer: string;
43
+ designation: string;
44
+ station: string;
45
+ witnessDispositionDate?: string | null;
46
+ status: IiruspStatus | string;
47
+ items: IiruspItem[];
48
+ signatures?: IiruspSignature[];
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ };
52
+ export type IiruspBasicForm = {
53
+ documentTypeId?: number;
54
+ officeId?: string;
55
+ asAtDate?: string;
56
+ entityName: string;
57
+ fundCluster: string;
58
+ nameOfAccountableOfficer: string;
59
+ designation: string;
60
+ station: string;
61
+ witnessDispositionDate?: string;
62
+ };
63
+ export type IiruspItemDraft = {
64
+ sourceIssuedItemId?: string;
65
+ dateAcquired: string;
66
+ particularsArticles: string;
67
+ propertyNo: string;
68
+ qty: string;
69
+ unitCost: string;
70
+ totalCost: string;
71
+ accumulatedImpairmentLosses: string;
72
+ carryingAmount: string;
73
+ remarks: string;
74
+ sale: string;
75
+ transfer: string;
76
+ destruction: string;
77
+ othersSpecify: string;
78
+ total: string;
79
+ appraisedValue: string;
80
+ orNo: string;
81
+ amount: string;
82
+ };
83
+ export type InspectionPendingRow = {
84
+ id: string;
85
+ risNo?: string;
86
+ stockNo?: string;
87
+ description?: string;
88
+ unit?: string;
89
+ issuedQty?: number;
90
+ amount?: string;
91
+ batchAllocations?: Array<{
92
+ batchNo: string;
93
+ qty: number;
94
+ }>;
95
+ unitIds?: string[];
96
+ unitBarcodes?: string[];
97
+ barcode?: string;
98
+ issuedAt?: string;
99
+ issuedBy?: string;
100
+ requestedById?: string | null;
101
+ requestedByEmail?: string | null;
102
+ requestedByRole?: string;
103
+ requestedByName?: string;
104
+ division?: string;
105
+ officeName?: string;
106
+ fundCluster?: string;
107
+ category?: string;
108
+ workflow?: {
109
+ stage?: string;
110
+ };
111
+ };
112
+ export type LaunchPayload = {
113
+ launchId: string;
114
+ issuedItemId: string;
115
+ reportDate: string;
116
+ entityName: string;
117
+ accountableOfficer: string;
118
+ station: string;
119
+ fundCluster: string;
120
+ actionType: string;
121
+ item: {
122
+ dateAcquired: string;
123
+ particularsArticles: string;
124
+ propertyNo: string;
125
+ qty: string;
126
+ unitCost: string;
127
+ totalCost: string;
128
+ accumulatedImpairmentLosses: string;
129
+ carryingAmount: string;
130
+ remarks: string;
131
+ };
132
+ };
133
+ export declare const EMPTY_BASIC_FORM: IiruspBasicForm;
134
+ export declare const EMPTY_ITEM_DRAFT: IiruspItemDraft;
@@ -0,0 +1,29 @@
1
+ // ─── Status ───────────────────────────────────────────────────────────────────
2
+ export const EMPTY_BASIC_FORM = {
3
+ asAtDate: "",
4
+ entityName: "",
5
+ fundCluster: "",
6
+ nameOfAccountableOfficer: "",
7
+ designation: "",
8
+ station: "",
9
+ witnessDispositionDate: "",
10
+ };
11
+ export const EMPTY_ITEM_DRAFT = {
12
+ dateAcquired: "",
13
+ particularsArticles: "",
14
+ propertyNo: "",
15
+ qty: "0",
16
+ unitCost: "0",
17
+ totalCost: "0",
18
+ accumulatedImpairmentLosses: "0",
19
+ carryingAmount: "0",
20
+ remarks: "",
21
+ sale: "0",
22
+ transfer: "0",
23
+ destruction: "0",
24
+ othersSpecify: "",
25
+ total: "0",
26
+ appraisedValue: "0",
27
+ orNo: "",
28
+ amount: "0",
29
+ };
@@ -0,0 +1,29 @@
1
+ import * as XLSX from "xlsx-js-style";
2
+ import type { IiruspItem, IiruspRecord } from "./types.js";
3
+ export declare function formatCurrency(value: number): string;
4
+ export declare function fmtNum(value: string | number | null | undefined, fraction?: number): string;
5
+ export declare function formatIiruspDate(value: string | null | undefined): string;
6
+ export declare function formatDateTime(value: string | null | undefined): string;
7
+ export declare function calcTotalCost(qty: string | number, unitCost: string | number): string;
8
+ export declare function calcCarryingAmount(totalCost: string | number, accImpair: string | number): string;
9
+ export declare function calcLineDisposalTotal(sale: string | number, transfer: string | number, destruction: string | number): string;
10
+ export declare function sumItems(items: IiruspItem[], key: keyof IiruspItem): number;
11
+ type CellKind = "title" | "subtitle" | "meta-label" | "meta-value" | "section" | "header" | "header-number" | "item-text" | "item-center" | "item-number" | "nothing" | "certification" | "signature-label" | "signature-title" | "signature-value" | "signature-line" | "total-label" | "total-number" | "blank";
12
+ export type IiruspSheetCell = {
13
+ value: string | number;
14
+ kind: CellKind;
15
+ };
16
+ export type IiruspSheetModel = {
17
+ rows: IiruspSheetCell[][];
18
+ merges: XLSX.Range[];
19
+ cols: {
20
+ wch: number;
21
+ }[];
22
+ rowHeights: {
23
+ hpt: number;
24
+ }[];
25
+ };
26
+ export declare function buildIiruspSheetModel(record: IiruspRecord): IiruspSheetModel;
27
+ export declare function getExcelPreviewCellClassName(kind: CellKind): string;
28
+ export declare function exportIiruspXlsx(record: IiruspRecord): void;
29
+ export {};
@@ -0,0 +1,488 @@
1
+ import * as XLSX from "xlsx-js-style";
2
+ // ─── Formatters ───────────────────────────────────────────────────────────────
3
+ export function formatCurrency(value) {
4
+ return new Intl.NumberFormat("en-PH", { style: "currency", currency: "PHP" }).format(value);
5
+ }
6
+ export function fmtNum(value, fraction = 2) {
7
+ const n = typeof value === "number" ? value : Number(value ?? 0);
8
+ if (Number.isNaN(n))
9
+ return "";
10
+ return n.toLocaleString("en-PH", {
11
+ minimumFractionDigits: fraction,
12
+ maximumFractionDigits: fraction,
13
+ });
14
+ }
15
+ export function formatIiruspDate(value) {
16
+ if (!value)
17
+ return "";
18
+ const d = new Date(value);
19
+ if (isNaN(d.getTime()))
20
+ return value;
21
+ return d.toLocaleDateString("en-PH", { year: "numeric", month: "long", day: "2-digit" });
22
+ }
23
+ export function formatDateTime(value) {
24
+ if (!value)
25
+ return "";
26
+ return new Date(value).toLocaleString("en-PH", {
27
+ year: "numeric",
28
+ month: "short",
29
+ day: "2-digit",
30
+ hour: "2-digit",
31
+ minute: "2-digit",
32
+ });
33
+ }
34
+ // ─── Per-row calculations (Carrying Amount has no Accumulated Depreciation
35
+ // on this Annex A.10 variant) ────────────────────────────────────────────────
36
+ export function calcTotalCost(qty, unitCost) {
37
+ const q = Number(qty);
38
+ const u = Number(unitCost);
39
+ if (Number.isNaN(q) || Number.isNaN(u))
40
+ return "0";
41
+ return String(q * u);
42
+ }
43
+ export function calcCarryingAmount(totalCost, accImpair) {
44
+ const t = Number(totalCost);
45
+ const i = Number(accImpair);
46
+ if (Number.isNaN(t) || Number.isNaN(i))
47
+ return "0";
48
+ return String(t - i);
49
+ }
50
+ export function calcLineDisposalTotal(sale, transfer, destruction) {
51
+ const s = Number(sale) || 0;
52
+ const t = Number(transfer) || 0;
53
+ const d = Number(destruction) || 0;
54
+ return String(s + t + d);
55
+ }
56
+ // ─── Item totals ─────────────────────────────────────────────────────────────
57
+ export function sumItems(items, key) {
58
+ return items.reduce((acc, item) => {
59
+ const v = Number(item[key] ?? "0");
60
+ return acc + (Number.isNaN(v) ? 0 : v);
61
+ }, 0);
62
+ }
63
+ function hasInputValue(value) {
64
+ if (value == null)
65
+ return false;
66
+ if (typeof value === "number")
67
+ return !Number.isNaN(value);
68
+ return value.trim().length > 0;
69
+ }
70
+ function fmtNumIfValue(value, fraction = 2) {
71
+ return hasInputValue(value) ? fmtNum(value, fraction) : "";
72
+ }
73
+ function hasItemValue(items, key) {
74
+ return items.some(item => hasInputValue(item[key]));
75
+ }
76
+ function cell(value, kind) {
77
+ return { value, kind };
78
+ }
79
+ const BLANK = cell("", "blank");
80
+ // 17 columns: 9 INVENTORY + 6 INSPECTION/DISPOSAL + 2 RECORD OF SALES
81
+ const COLS = 17;
82
+ const FIXED_ITEM_ROWS = 16;
83
+ const COLUMN_HEADERS = [
84
+ "Date Acquired",
85
+ "Particulars/Articles",
86
+ "Semi-expendable\nProperty No.",
87
+ "Qty",
88
+ "Unit Cost",
89
+ "Total Cost",
90
+ "Accumulated\nImpairment\nLosses",
91
+ "Carrying Amount",
92
+ "Remarks",
93
+ "Sale",
94
+ "Transfer",
95
+ "Destruction",
96
+ "Others\n(Specify)",
97
+ "Total",
98
+ "Appraised\nValue",
99
+ "OR No.",
100
+ "Amount",
101
+ ];
102
+ export function buildIiruspSheetModel(record) {
103
+ const rows = [];
104
+ const merges = [];
105
+ const rowHeights = [];
106
+ let r = 0;
107
+ const blankRow = () => Array.from({ length: COLS }, () => BLANK);
108
+ const merge = (sr, sc, er, ec) => merges.push({ s: { r: sr, c: sc }, e: { r: er, c: ec } });
109
+ // Row 0: Annex label (right)
110
+ rows.push([
111
+ ...Array.from({ length: COLS - 1 }, () => BLANK),
112
+ cell("Annex A.10", "meta-label"),
113
+ ]);
114
+ rowHeights.push({ hpt: 14 });
115
+ r++;
116
+ // Row 1: Title
117
+ const title = blankRow();
118
+ title[0] = cell("INVENTORY AND INSPECTION REPORT OF UNSERVICEABLE SEMI-EXPENDABLE PROPERTY", "title");
119
+ rows.push(title);
120
+ merge(r, 0, r, COLS - 1);
121
+ rowHeights.push({ hpt: 22 });
122
+ r++;
123
+ // Row 2: As at
124
+ const asAt = blankRow();
125
+ asAt[0] = cell(`As at ${formatIiruspDate(record.asAtDate)}`, "subtitle");
126
+ rows.push(asAt);
127
+ merge(r, 0, r, COLS - 1);
128
+ rowHeights.push({ hpt: 14 });
129
+ r++;
130
+ // Row 3: Entity Name / Fund Cluster
131
+ const meta1 = blankRow();
132
+ meta1[0] = cell(`Entity Name: ${record.entityName}`, "meta-value");
133
+ meta1[Math.floor(COLS / 2)] = cell(`Fund Cluster: ${record.fundCluster}`, "meta-value");
134
+ rows.push(meta1);
135
+ merge(r, 0, r, Math.floor(COLS / 2) - 1);
136
+ merge(r, Math.floor(COLS / 2), r, COLS - 1);
137
+ rowHeights.push({ hpt: 14 });
138
+ r++;
139
+ // Row 4: Identification row
140
+ const meta2 = blankRow();
141
+ meta2[0] = cell(`Name of Accountable Officer: ${record.nameOfAccountableOfficer}`, "meta-value");
142
+ meta2[6] = cell(`Designation: ${record.designation}`, "meta-value");
143
+ meta2[12] = cell(`Station: ${record.station}`, "meta-value");
144
+ rows.push(meta2);
145
+ merge(r, 0, r, 5);
146
+ merge(r, 6, r, 11);
147
+ merge(r, 12, r, COLS - 1);
148
+ rowHeights.push({ hpt: 14 });
149
+ r++;
150
+ // Row 5: Section header row (INVENTORY | INSPECTION AND DISPOSAL | RECORD OF SALES)
151
+ const section = blankRow();
152
+ section[0] = cell("INVENTORY", "section");
153
+ section[9] = cell("INSPECTION AND DISPOSAL", "section");
154
+ section[15] = cell("RECORD OF SALES", "section");
155
+ rows.push(section);
156
+ merge(r, 0, r, 8);
157
+ merge(r, 9, r, 14);
158
+ merge(r, 15, r, 16);
159
+ rowHeights.push({ hpt: 16 });
160
+ r++;
161
+ // Row 6: Column headers
162
+ rows.push(COLUMN_HEADERS.map(h => cell(h, "header")));
163
+ rowHeights.push({ hpt: 34 });
164
+ r++;
165
+ // Row 7: Column index row (1)-(17)
166
+ rows.push(Array.from({ length: COLS }, (_, index) => cell(`(${index + 1})`, "header-number")));
167
+ rowHeights.push({ hpt: 14 });
168
+ r++;
169
+ // Item rows — align with Annex A.10 printed grid
170
+ const items = record.items.length > 0 ? record.items : [];
171
+ const hasDisposalValues = {
172
+ sale: hasItemValue(items, "sale"),
173
+ transfer: hasItemValue(items, "transfer"),
174
+ destruction: hasItemValue(items, "destruction"),
175
+ total: hasItemValue(items, "total"),
176
+ appraisedValue: hasItemValue(items, "appraisedValue"),
177
+ amount: hasItemValue(items, "amount"),
178
+ };
179
+ const totalLineRows = Math.max(FIXED_ITEM_ROWS, items.length);
180
+ for (let i = 0; i < totalLineRows; i++) {
181
+ const item = items[i];
182
+ if (item) {
183
+ rows.push([
184
+ cell(formatIiruspDate(item.dateAcquired), "item-center"),
185
+ cell(item.particularsArticles ?? "", "item-text"),
186
+ cell(item.propertyNo ?? "", "item-text"),
187
+ cell(fmtNum(item.qty), "item-number"),
188
+ cell(fmtNum(item.unitCost), "item-number"),
189
+ cell(fmtNum(item.totalCost), "item-number"),
190
+ cell(fmtNum(item.accumulatedImpairmentLosses), "item-number"),
191
+ cell(fmtNum(item.carryingAmount), "item-number"),
192
+ cell(item.remarks ?? "", "item-text"),
193
+ cell(fmtNumIfValue(item.sale), "item-number"),
194
+ cell(fmtNumIfValue(item.transfer), "item-number"),
195
+ cell(fmtNumIfValue(item.destruction), "item-number"),
196
+ cell(item.othersSpecify ?? "", "item-text"),
197
+ cell(fmtNumIfValue(item.total), "item-number"),
198
+ cell(fmtNumIfValue(item.appraisedValue), "item-number"),
199
+ cell(item.orNo ?? "", "item-text"),
200
+ cell(fmtNumIfValue(item.amount), "item-number"),
201
+ ]);
202
+ }
203
+ else {
204
+ rows.push(blankRow());
205
+ }
206
+ // Keep rows readable while preserving fixed printed layout density.
207
+ rowHeights.push({ hpt: item ? 24 : 14 });
208
+ r++;
209
+ }
210
+ // TOTAL row
211
+ const totalRow = blankRow();
212
+ totalRow[0] = cell("TOTAL", "total-label");
213
+ totalRow[3] = cell(fmtNum(sumItems(items, "qty")), "total-number");
214
+ totalRow[5] = cell(fmtNum(sumItems(items, "totalCost")), "total-number");
215
+ totalRow[6] = cell(fmtNum(sumItems(items, "accumulatedImpairmentLosses")), "total-number");
216
+ totalRow[7] = cell(fmtNum(sumItems(items, "carryingAmount")), "total-number");
217
+ totalRow[9] = cell(hasDisposalValues.sale ? fmtNum(sumItems(items, "sale")) : "", "total-number");
218
+ totalRow[10] = cell(hasDisposalValues.transfer ? fmtNum(sumItems(items, "transfer")) : "", "total-number");
219
+ totalRow[11] = cell(hasDisposalValues.destruction ? fmtNum(sumItems(items, "destruction")) : "", "total-number");
220
+ totalRow[13] = cell(hasDisposalValues.total ? fmtNum(sumItems(items, "total")) : "", "total-number");
221
+ totalRow[14] = cell(hasDisposalValues.appraisedValue ? fmtNum(sumItems(items, "appraisedValue")) : "", "total-number");
222
+ totalRow[16] = cell(hasDisposalValues.amount ? fmtNum(sumItems(items, "amount")) : "", "total-number");
223
+ rows.push(totalRow);
224
+ merge(r, 0, r, 2);
225
+ rowHeights.push({ hpt: 16 });
226
+ r++;
227
+ // Certification block (three-pane layout in the preview)
228
+ const certificationRow = blankRow();
229
+ certificationRow[0] = cell("I HEREBY request inspection and disposition, pursuant to Section 79 of P.D. No. 1445, of the property enumerated above.", "certification");
230
+ certificationRow[9] = cell("I CERTIFY that I have inspected each and every article enumerated in this report, and that the disposition made thereof was, in my judgment, the best for the public interest.", "certification");
231
+ certificationRow[15] = cell(`I CERTIFY that I have witnessed the disposition of the articles enumerated on this report this ${formatIiruspDate(record.witnessDispositionDate)}.`, "certification");
232
+ rows.push(certificationRow);
233
+ merge(r, 0, r, 8);
234
+ merge(r, 9, r, 14);
235
+ merge(r, 15, r, 16);
236
+ rowHeights.push({ hpt: 58 });
237
+ r++;
238
+ // Signature rows — keyed by sequenceNo from document_signatures
239
+ const sigs = record.signatures ?? [];
240
+ const sigByLabel = (label) => sigs.find(s => s.label.toLowerCase() === label.toLowerCase());
241
+ const requested = sigByLabel("Requested by") ?? sigs.find(s => s.sequenceNo === 1);
242
+ const approved = sigByLabel("Approved by") ?? sigs.find(s => s.sequenceNo === 2);
243
+ const inspection = sigByLabel("Inspection Officer") ?? sigs.find(s => s.sequenceNo === 3);
244
+ const witness = sigByLabel("Witness") ?? sigs.find(s => s.sequenceNo === 4);
245
+ const sigTitleRow = blankRow();
246
+ sigTitleRow[0] = cell("Requested by:", "signature-title");
247
+ sigTitleRow[5] = cell("Approved by:", "signature-title");
248
+ sigTitleRow[9] = cell("Inspection Officer:", "signature-title");
249
+ sigTitleRow[15] = cell("Witness:", "signature-title");
250
+ rows.push(sigTitleRow);
251
+ merge(r, 0, r, 4);
252
+ merge(r, 5, r, 8);
253
+ merge(r, 9, r, 14);
254
+ merge(r, 15, r, 16);
255
+ rowHeights.push({ hpt: 14 });
256
+ r++;
257
+ const sigNameRow = blankRow();
258
+ sigNameRow[0] = cell(requested?.signedByName ?? "", "signature-value");
259
+ sigNameRow[5] = cell(approved?.signedByName ?? "", "signature-value");
260
+ sigNameRow[9] = cell(inspection?.signedByName ?? "", "signature-value");
261
+ sigNameRow[15] = cell(witness?.signedByName ?? "", "signature-value");
262
+ rows.push(sigNameRow);
263
+ merge(r, 0, r, 4);
264
+ merge(r, 5, r, 8);
265
+ merge(r, 9, r, 14);
266
+ merge(r, 15, r, 16);
267
+ rowHeights.push({ hpt: 18 });
268
+ r++;
269
+ const sigLabelRow = blankRow();
270
+ sigLabelRow[0] = cell("(Signature over Printed Name of Accountable Officer)", "signature-label");
271
+ sigLabelRow[5] = cell("(Signature over Printed Name of Authorized Official)", "signature-label");
272
+ sigLabelRow[9] = cell("(Signature over Printed Name of Inspection Officer)", "signature-label");
273
+ sigLabelRow[15] = cell("(Signature over Printed Name of Witness)", "signature-label");
274
+ rows.push(sigLabelRow);
275
+ merge(r, 0, r, 4);
276
+ merge(r, 5, r, 8);
277
+ merge(r, 9, r, 14);
278
+ merge(r, 15, r, 16);
279
+ rowHeights.push({ hpt: 24 });
280
+ r++;
281
+ const designationRow = blankRow();
282
+ designationRow[0] = cell(record.designation ?? "", "signature-value");
283
+ rows.push(designationRow);
284
+ merge(r, 0, r, 4);
285
+ merge(r, 5, r, 8);
286
+ merge(r, 9, r, 14);
287
+ merge(r, 15, r, 16);
288
+ rowHeights.push({ hpt: 16 });
289
+ r++;
290
+ const designationLabelRow = blankRow();
291
+ designationLabelRow[0] = cell("(Designation of Accountable Officer)", "signature-label");
292
+ rows.push(designationLabelRow);
293
+ merge(r, 0, r, 4);
294
+ merge(r, 5, r, 8);
295
+ merge(r, 9, r, 14);
296
+ merge(r, 15, r, 16);
297
+ rowHeights.push({ hpt: 14 });
298
+ r++;
299
+ return {
300
+ rows,
301
+ merges,
302
+ cols: [
303
+ { wch: 12 },
304
+ { wch: 28 },
305
+ { wch: 14 },
306
+ { wch: 6 },
307
+ { wch: 10 },
308
+ { wch: 10 },
309
+ { wch: 12 },
310
+ { wch: 10 },
311
+ { wch: 14 },
312
+ { wch: 9 },
313
+ { wch: 9 },
314
+ { wch: 10 },
315
+ { wch: 11 },
316
+ { wch: 9 },
317
+ { wch: 10 },
318
+ { wch: 18 },
319
+ { wch: 20 },
320
+ ],
321
+ rowHeights,
322
+ };
323
+ }
324
+ // ─── Cell class helper (used by IiruspExcelPreview) ──────────────────────────
325
+ export function getExcelPreviewCellClassName(kind) {
326
+ switch (kind) {
327
+ case "title":
328
+ return "text-center font-bold text-[12px] uppercase";
329
+ case "subtitle":
330
+ return "text-center italic text-[10px] text-slate-600";
331
+ case "meta-label":
332
+ return "text-right text-[10px] italic text-slate-500";
333
+ case "meta-value":
334
+ return "text-[10px] text-slate-800";
335
+ case "section":
336
+ return "text-center font-bold text-[10px] bg-slate-200";
337
+ case "header":
338
+ return "text-center font-bold text-[10px] bg-slate-100";
339
+ case "item-text":
340
+ return "text-[10px]";
341
+ case "item-center":
342
+ return "text-center text-[10px]";
343
+ case "item-number":
344
+ return "text-right text-[10px] font-mono";
345
+ case "nothing":
346
+ return "text-center italic text-slate-400 text-[10px]";
347
+ case "signature-label":
348
+ return "text-[10px] italic";
349
+ case "signature-value":
350
+ return "text-center text-[10px] font-medium";
351
+ case "signature-line":
352
+ return "border-t border-black text-[10px]";
353
+ case "total-label":
354
+ return "text-center font-bold text-[10px] bg-slate-100";
355
+ case "total-number":
356
+ return "text-right font-bold text-[10px] bg-slate-100 font-mono";
357
+ default:
358
+ return "";
359
+ }
360
+ }
361
+ // ─── XLSX Export ──────────────────────────────────────────────────────────────
362
+ function kindToStyle(kind) {
363
+ const base = {
364
+ font: { name: "Arial", sz: 8 },
365
+ alignment: { wrapText: true, vertical: "center" },
366
+ border: {
367
+ top: { style: "thin", color: { rgb: "000000" } },
368
+ bottom: { style: "thin", color: { rgb: "000000" } },
369
+ left: { style: "thin", color: { rgb: "000000" } },
370
+ right: { style: "thin", color: { rgb: "000000" } },
371
+ },
372
+ };
373
+ switch (kind) {
374
+ case "title":
375
+ return {
376
+ ...base,
377
+ font: { ...base.font, bold: true, sz: 11 },
378
+ alignment: { horizontal: "center", vertical: "center" },
379
+ };
380
+ case "subtitle":
381
+ return {
382
+ ...base,
383
+ font: { ...base.font, italic: true },
384
+ alignment: { horizontal: "center", vertical: "center" },
385
+ };
386
+ case "section":
387
+ return {
388
+ ...base,
389
+ font: { ...base.font, bold: true },
390
+ alignment: { horizontal: "center", vertical: "center" },
391
+ fill: { fgColor: { rgb: "DDDDDD" }, patternType: "solid" },
392
+ };
393
+ case "header":
394
+ return {
395
+ ...base,
396
+ font: { ...base.font, bold: true, sz: 7 },
397
+ alignment: { horizontal: "center", vertical: "center", wrapText: true },
398
+ fill: { fgColor: { rgb: "EEEEEE" }, patternType: "solid" },
399
+ };
400
+ case "header-number":
401
+ return {
402
+ ...base,
403
+ font: { ...base.font, italic: true, sz: 7 },
404
+ alignment: { horizontal: "center", vertical: "center" },
405
+ };
406
+ case "total-label":
407
+ return {
408
+ ...base,
409
+ font: { ...base.font, bold: true },
410
+ alignment: { horizontal: "center", vertical: "center" },
411
+ fill: { fgColor: { rgb: "EEEEEE" }, patternType: "solid" },
412
+ };
413
+ case "certification":
414
+ return {
415
+ ...base,
416
+ font: { ...base.font, sz: 9 },
417
+ alignment: { horizontal: "left", vertical: "top", wrapText: true },
418
+ };
419
+ case "signature-title":
420
+ return {
421
+ ...base,
422
+ font: { ...base.font, bold: true },
423
+ alignment: { horizontal: "left", vertical: "center" },
424
+ };
425
+ case "item-center":
426
+ case "nothing":
427
+ case "signature-value":
428
+ return { ...base, alignment: { ...base.alignment, horizontal: "center" } };
429
+ case "signature-label":
430
+ return {
431
+ ...base,
432
+ font: { ...base.font, italic: true, sz: 8 },
433
+ alignment: { horizontal: "center", vertical: "center", wrapText: true },
434
+ };
435
+ case "item-number":
436
+ return {
437
+ ...base,
438
+ alignment: { ...base.alignment, horizontal: "right" },
439
+ font: { ...base.font, name: "Courier New" },
440
+ };
441
+ case "total-number":
442
+ return {
443
+ ...base,
444
+ font: { ...base.font, bold: true, name: "Courier New" },
445
+ alignment: { ...base.alignment, horizontal: "right" },
446
+ fill: { fgColor: { rgb: "EEEEEE" }, patternType: "solid" },
447
+ };
448
+ case "blank":
449
+ return { border: base.border };
450
+ default:
451
+ return base;
452
+ }
453
+ }
454
+ export function exportIiruspXlsx(record) {
455
+ const model = buildIiruspSheetModel(record);
456
+ const ws = {};
457
+ ws["!cols"] = model.cols;
458
+ ws["!rows"] = model.rowHeights;
459
+ ws["!merges"] = model.merges;
460
+ let maxCol = 0;
461
+ model.rows.forEach((row, rowIndex) => {
462
+ row.forEach((c, colIndex) => {
463
+ const addr = XLSX.utils.encode_cell({ r: rowIndex, c: colIndex });
464
+ ws[addr] = {
465
+ v: c.value,
466
+ t: typeof c.value === "number" ? "n" : "s",
467
+ s: kindToStyle(c.kind),
468
+ };
469
+ maxCol = Math.max(maxCol, colIndex);
470
+ });
471
+ });
472
+ ws["!ref"] = XLSX.utils.encode_range({
473
+ s: { r: 0, c: 0 },
474
+ e: { r: model.rows.length - 1, c: maxCol },
475
+ });
476
+ const requiresVerticalPagination = (record.items?.length ?? 0) > FIXED_ITEM_ROWS;
477
+ ws["!margins"] = { left: 0.25, right: 0.25, top: 0.35, bottom: 0.35, header: 0, footer: 0 };
478
+ ws["!pageSetup"] = {
479
+ orientation: "landscape",
480
+ paperSize: 9,
481
+ fitToPage: true,
482
+ fitToWidth: 1,
483
+ fitToHeight: requiresVerticalPagination ? 0 : 1,
484
+ };
485
+ const wb = XLSX.utils.book_new();
486
+ XLSX.utils.book_append_sheet(wb, ws, "IIRUSP");
487
+ XLSX.writeFile(wb, `${record.iiruspNo}.xlsx`, { bookType: "xlsx", cellStyles: true });
488
+ }