@managesome/eposmatic-toolkit 0.2.431 → 0.2.433

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 (172) hide show
  1. package/lib/constants/ENUMS.d.ts +0 -289
  2. package/lib/constants/ENUMS.js +2 -393
  3. package/lib/constants/PURCHASE_ORDER.d.ts +5 -3
  4. package/lib/constants/PURCHASE_ORDER.js +58 -20
  5. package/lib/constants/WAREHOUSE_ANALYTICS.d.ts +41 -41
  6. package/lib/constants/WAREHOUSE_ANALYTICS.js +28 -28
  7. package/lib/constants/WAREHOUSE_ENUMS.d.ts +289 -0
  8. package/lib/constants/WAREHOUSE_ENUMS.js +392 -0
  9. package/lib/constants/WAREHOUSE_INVOICE.js +10 -10
  10. package/lib/constants/WORKER_ENDPOINTS.d.ts +63 -0
  11. package/lib/constants/WORKER_ENDPOINTS.js +76 -0
  12. package/lib/constants/index.d.ts +2 -0
  13. package/lib/constants/index.js +2 -0
  14. package/lib/helpers/order/generate-purchase-order-rfq.d.ts +3 -3
  15. package/lib/helpers/order/generate-purchase-order-rfq.js +2 -2
  16. package/lib/helpers/order/generate-purchase-order.d.ts +8 -8
  17. package/lib/helpers/order/generate-purchase-order.js +2 -2
  18. package/lib/helpers/order/generate-warehouse-purchase-order-rfq.d.ts +3 -0
  19. package/lib/helpers/order/generate-warehouse-purchase-order-rfq.js +64 -0
  20. package/lib/helpers/order/generate-warehouse-purchase-order.d.ts +11 -0
  21. package/lib/helpers/order/generate-warehouse-purchase-order.js +196 -0
  22. package/lib/helpers/order/index.d.ts +2 -2
  23. package/lib/helpers/order/index.js +2 -2
  24. package/lib/helpers/store/all-purchase-orders-actions.d.ts +7 -7
  25. package/lib/helpers/store/all-purchase-orders-actions.js +2 -2
  26. package/lib/helpers/store/all-sale-orders-actions.d.ts +2 -2
  27. package/lib/helpers/store/all-warehouse-purchase-orders-actions.d.ts +13 -0
  28. package/lib/helpers/store/all-warehouse-purchase-orders-actions.js +56 -0
  29. package/lib/helpers/store/all-warehouse-sale-orders-actions.d.ts +2 -0
  30. package/lib/helpers/store/all-warehouse-sale-orders-actions.js +8 -0
  31. package/lib/helpers/store/common-purchase-order-actions.d.ts +15 -15
  32. package/lib/helpers/store/common-sale-order-actions.d.ts +5 -5
  33. package/lib/helpers/store/common-warehouse-purchase-order-actions.d.ts +31 -0
  34. package/lib/helpers/store/common-warehouse-purchase-order-actions.js +545 -0
  35. package/lib/helpers/store/common-warehouse-sale-order-actions.d.ts +5 -0
  36. package/lib/helpers/store/common-warehouse-sale-order-actions.js +65 -0
  37. package/lib/helpers/store/index.d.ts +6 -6
  38. package/lib/helpers/store/index.js +6 -6
  39. package/lib/helpers/store/purchase-order-rfq-cart-actions.d.ts +11 -11
  40. package/lib/helpers/store/purchase-order-rfq-cart-actions.js +3 -3
  41. package/lib/helpers/store/purchase-orders-cart-actions.d.ts +18 -18
  42. package/lib/helpers/store/purchase-orders-cart-actions.js +1 -1
  43. package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.d.ts +19 -0
  44. package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +373 -0
  45. package/lib/helpers/store/warehouse-purchase-orders-cart-actions.d.ts +57 -0
  46. package/lib/helpers/store/warehouse-purchase-orders-cart-actions.js +486 -0
  47. package/lib/helpers/types/index.d.ts +1 -1
  48. package/lib/helpers/types/index.js +1 -1
  49. package/lib/helpers/types/purchase-order-cart-actions.d.ts +2 -2
  50. package/lib/helpers/types/warehouse-purchase-order-cart-actions.d.ts +26 -0
  51. package/lib/helpers/types/warehouse-purchase-order-cart-actions.js +2 -0
  52. package/lib/helpers/types/workers.d.ts +39 -32
  53. package/lib/helpers/utils/index.d.ts +8 -8
  54. package/lib/helpers/utils/index.js +8 -11
  55. package/lib/helpers/utils/invoice-x-report-helpers.d.ts +2 -2
  56. package/lib/helpers/utils/invoice-x-report-helpers.js +14 -14
  57. package/lib/helpers/utils/purchase-order-engine.d.ts +4 -4
  58. package/lib/helpers/utils/purchase-order-receipt-engine.d.ts +5 -5
  59. package/lib/helpers/utils/purchase-order-receipt-engine.js +2 -2
  60. package/lib/helpers/utils/purchase-order-x-report-helpers.js +2 -2
  61. package/lib/helpers/utils/sale-x-report-helpers.js +2 -2
  62. package/lib/helpers/utils/void-purchase-order-items-helpers.d.ts +3 -3
  63. package/lib/helpers/utils/void-purchase-order-items-report-helpers.d.ts +2 -2
  64. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.d.ts +3 -3
  65. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.js +2 -2
  66. package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.d.ts +5 -5
  67. package/lib/helpers/utils/warehouse-catalog-conversion.d.ts +3 -3
  68. package/lib/helpers/utils/warehouse-catalog-conversion.js +9 -7
  69. package/lib/helpers/utils/warehouse-invoice-order-engine.js +1 -1
  70. package/lib/helpers/utils/warehouse-invoice-x-report-helpers.d.ts +58 -0
  71. package/lib/helpers/utils/warehouse-invoice-x-report-helpers.js +1432 -0
  72. package/lib/helpers/utils/warehouse-purchase-order-engine.d.ts +9 -0
  73. package/lib/helpers/utils/warehouse-purchase-order-engine.js +34 -0
  74. package/lib/helpers/utils/warehouse-purchase-order-receipt-engine.d.ts +149 -0
  75. package/lib/helpers/utils/warehouse-purchase-order-receipt-engine.js +214 -0
  76. package/lib/helpers/utils/warehouse-purchase-order-x-report-helpers.d.ts +58 -0
  77. package/lib/helpers/utils/warehouse-purchase-order-x-report-helpers.js +1440 -0
  78. package/lib/helpers/utils/warehouse-sale-order-x-report-helpers.d.ts +30 -0
  79. package/lib/helpers/utils/warehouse-sale-order-x-report-helpers.js +2 -0
  80. package/lib/helpers/utils/warehouse-sale-x-report-helpers.d.ts +58 -0
  81. package/lib/helpers/utils/warehouse-sale-x-report-helpers.js +1456 -0
  82. package/lib/helpers/utils/warehouse-void-purchase-order-items-helpers.d.ts +3 -0
  83. package/lib/helpers/utils/warehouse-void-purchase-order-items-helpers.js +38 -0
  84. package/lib/helpers/utils/warehouse-void-purchase-order-items-report-helpers.d.ts +13 -0
  85. package/lib/helpers/utils/warehouse-void-purchase-order-items-report-helpers.js +22 -0
  86. package/lib/schemas/models/gift_cards.d.ts +108 -108
  87. package/lib/schemas/models/halfhalf_setup.d.ts +3 -3
  88. package/lib/schemas/models/index.d.ts +7 -7
  89. package/lib/schemas/models/index.js +7 -7
  90. package/lib/schemas/models/internal_invoices.d.ts +6 -6
  91. package/lib/schemas/models/inventory_lot_serial_numbers.d.ts +6 -6
  92. package/lib/schemas/models/inventory_transactions.d.ts +3 -3
  93. package/lib/schemas/models/item_transactions.d.ts +6 -6
  94. package/lib/schemas/models/offers.d.ts +146 -146
  95. package/lib/schemas/models/orders.d.ts +2573 -2573
  96. package/lib/schemas/models/printer_settings.d.ts +12 -12
  97. package/lib/schemas/models/reservations.d.ts +6 -6
  98. package/lib/schemas/models/rewards_usage.d.ts +6 -6
  99. package/lib/schemas/models/riders.d.ts +3 -3
  100. package/lib/schemas/models/tenants.d.ts +135 -135
  101. package/lib/schemas/models/void_order_items.d.ts +15 -15
  102. package/lib/schemas/models/void_warehouse_invoice_items.d.ts +25 -25
  103. package/lib/schemas/models/void_warehouse_invoice_items.js +2 -2
  104. package/lib/schemas/models/vouchers.d.ts +9 -9
  105. package/lib/schemas/models/warehouse-activity-logs.d.ts +13 -13
  106. package/lib/schemas/models/warehouse-activity-logs.js +4 -4
  107. package/lib/schemas/models/warehouse_categories.d.ts +4 -4
  108. package/lib/schemas/models/warehouse_categories.js +2 -2
  109. package/lib/schemas/models/warehouse_communications.d.ts +21 -21
  110. package/lib/schemas/models/warehouse_internal_movements.d.ts +33 -33
  111. package/lib/schemas/models/warehouse_internal_movements.js +8 -8
  112. package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.d.ts +154 -0
  113. package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.js +193 -0
  114. package/lib/schemas/models/warehouse_inventory_transactions.d.ts +6 -6
  115. package/lib/schemas/models/warehouse_invoices.d.ts +351 -351
  116. package/lib/schemas/models/warehouse_item_transactions.d.ts +9 -9
  117. package/lib/schemas/models/warehouse_items.d.ts +13 -13
  118. package/lib/schemas/models/warehouse_items.js +2 -2
  119. package/lib/schemas/models/warehouse_operational_roles.d.ts +3 -3
  120. package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +165 -0
  121. package/lib/schemas/models/warehouse_purchase_order_receipts.js +151 -0
  122. package/lib/schemas/models/warehouse_purchase_order_rfqs.d.ts +1959 -0
  123. package/lib/schemas/models/warehouse_purchase_order_rfqs.js +328 -0
  124. package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +234 -0
  125. package/lib/schemas/models/warehouse_purchase_order_vendor_returns.js +188 -0
  126. package/lib/schemas/models/warehouse_purchase_orders.d.ts +2678 -0
  127. package/lib/schemas/models/warehouse_purchase_orders.js +336 -0
  128. package/lib/schemas/models/warehouse_sale_deliveries.d.ts +15 -15
  129. package/lib/schemas/models/warehouse_sale_deliveries.js +7 -4
  130. package/lib/schemas/models/warehouse_sale_invoices.d.ts +30 -30
  131. package/lib/schemas/models/warehouse_sale_invoices.js +8 -5
  132. package/lib/schemas/models/warehouse_sale_order_rfqs.d.ts +362 -362
  133. package/lib/schemas/models/warehouse_sale_order_rfqs.js +5 -5
  134. package/lib/schemas/models/warehouse_sale_orders.d.ts +367 -367
  135. package/lib/schemas/models/warehouse_sale_orders.js +5 -5
  136. package/lib/schemas/models/warehouse_void_invoice_items.d.ts +176 -0
  137. package/lib/schemas/models/warehouse_void_invoice_items.js +176 -0
  138. package/lib/schemas/models/warehouse_void_purchase_order_items.d.ts +176 -0
  139. package/lib/schemas/models/warehouse_void_purchase_order_items.js +177 -0
  140. package/lib/schemas/models/warehouses.d.ts +52 -52
  141. package/lib/schemas/models/warehouses.js +2 -2
  142. package/lib/schemas/types/index.d.ts +9 -9
  143. package/lib/schemas/types/index.js +9 -9
  144. package/lib/schemas/types/inventory_lot_serial_numbers.d.ts +5 -5
  145. package/lib/schemas/types/warehouse-activity-logs.d.ts +7 -7
  146. package/lib/schemas/types/warehouse_categories.d.ts +2 -2
  147. package/lib/schemas/types/warehouse_internal_movements.d.ts +9 -9
  148. package/lib/schemas/types/warehouse_inventory_lot_serial_numbers.d.ts +85 -0
  149. package/lib/schemas/types/warehouse_inventory_lot_serial_numbers.js +4 -0
  150. package/lib/schemas/types/warehouse_items.d.ts +2 -2
  151. package/lib/schemas/types/warehouse_purchase_order_common.d.ts +39 -0
  152. package/lib/schemas/types/warehouse_purchase_order_common.js +2 -0
  153. package/lib/schemas/types/warehouse_purchase_order_receipts.d.ts +39 -0
  154. package/lib/schemas/types/warehouse_purchase_order_receipts.js +21 -0
  155. package/lib/schemas/types/warehouse_purchase_order_rfqs.d.ts +33 -0
  156. package/lib/schemas/types/warehouse_purchase_order_rfqs.js +2 -0
  157. package/lib/schemas/types/warehouse_purchase_order_vendor_returns.d.ts +48 -0
  158. package/lib/schemas/types/warehouse_purchase_order_vendor_returns.js +2 -0
  159. package/lib/schemas/types/warehouse_purchase_orders.d.ts +33 -0
  160. package/lib/schemas/types/warehouse_purchase_orders.js +2 -0
  161. package/lib/schemas/types/warehouse_sale_deliveries.d.ts +29 -29
  162. package/lib/schemas/types/warehouse_sale_invoices.d.ts +17 -17
  163. package/lib/schemas/types/warehouse_sale_order_common.d.ts +39 -0
  164. package/lib/schemas/types/warehouse_sale_order_common.js +2 -0
  165. package/lib/schemas/types/warehouse_sale_order_rfqs.d.ts +7 -7
  166. package/lib/schemas/types/warehouse_sale_orders.d.ts +7 -7
  167. package/lib/schemas/types/warehouse_void_invoice_items.d.ts +37 -0
  168. package/lib/schemas/types/warehouse_void_invoice_items.js +2 -0
  169. package/lib/schemas/types/warehouse_void_purchase_order_items.d.ts +37 -0
  170. package/lib/schemas/types/warehouse_void_purchase_order_items.js +2 -0
  171. package/lib/schemas/types/warehouses.d.ts +2 -2
  172. package/package.json +1 -1
@@ -0,0 +1,1440 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWarehousePurchaseOrderXReportData = void 0;
7
+ exports.getWarehousePurchaseOrderXReportHtml = getWarehousePurchaseOrderXReportHtml;
8
+ const moment_1 = __importDefault(require("moment"));
9
+ const constants_1 = require("../../constants");
10
+ const common_1 = require("./common");
11
+ const price_conversion_1 = require("./price-conversion");
12
+ const getHead = (monochrome) => {
13
+ const palette = monochrome
14
+ ? {
15
+ headingBackground: '#ffffff',
16
+ headingText: '#000000',
17
+ titleBackground: '#ffffff',
18
+ titleText: '#000000',
19
+ text: '#000000',
20
+ border: '#000000',
21
+ borderRight: '#000000',
22
+ tableHeaderBackground: '#ffffff',
23
+ tableHeaderText: '#000000',
24
+ }
25
+ : {
26
+ headingBackground: '#431665',
27
+ headingText: '#ffffff',
28
+ titleBackground: '#666666',
29
+ titleText: '#ffffff',
30
+ text: '#333333',
31
+ border: '#ffffff',
32
+ borderRight: '#431665',
33
+ tableHeaderBackground: '#431665',
34
+ tableHeaderText: '#ffffff',
35
+ };
36
+ const fontLink = monochrome
37
+ ? `<link
38
+ rel="stylesheet"
39
+ href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300;400;500;700&display=swap"
40
+ crossorigin="anonymous"
41
+ />`
42
+ : `<link
43
+ rel="stylesheet"
44
+ href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&amp;display=swap"
45
+ crossorigin="anonymous"
46
+ />`;
47
+ return `<head>
48
+ <meta charset="UTF-8" />
49
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
50
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
51
+ ${fontLink}
52
+ <style>
53
+ .cssc-1flmrcm-kjlask {
54
+ -webkit-font-smoothing: antialiased;
55
+ -webkit-text-size-adjust: 100%;
56
+ color: ${palette.text};
57
+ line-height: 1.15rem;
58
+ font-size: 1rem;
59
+ font-family: Roboto, Public Sans, sans-serif;
60
+ font-weight: 400;
61
+ box-sizing: border-box;
62
+ display: flex;
63
+ flex-direction: column;
64
+ flex: 1;
65
+ margin: 0;
66
+ margin-top: 8px;
67
+ background-color: #ffffff;
68
+ }
69
+ .cssc-16f6p1q-kjlask {
70
+ -webkit-font-smoothing: antialiased;
71
+ -webkit-text-size-adjust: 100%;
72
+ color: ${palette.text};
73
+ line-height: 1.15rem;
74
+ font-size: 1rem;
75
+ font-family: Roboto, Public Sans, sans-serif;
76
+ font-weight: 400;
77
+ box-sizing: inherit;
78
+ display: flex;
79
+ flex-direction: column;
80
+ flex: 1;
81
+ margin: 0;
82
+ border: 1px solid ${palette.borderRight};
83
+ }
84
+
85
+ .cssc-1qeq10-kjlask {
86
+ display: flex;
87
+ flex-direction: column;
88
+ align-items: center;
89
+ justify-content: center;
90
+ gap: 4px;
91
+ margin-top: 8px;
92
+ margin-bottom: 8px;
93
+ }
94
+
95
+ .cssc-1owvoyj-kjhgs {
96
+ -webkit-font-smoothing: antialiased;
97
+ -webkit-text-size-adjust: 100%;
98
+ color: ${palette.text};
99
+ line-height: 1.15rem;
100
+ font-size: 1rem;
101
+ font-family: Roboto, Public Sans, sans-serif;
102
+ font-weight: 400;
103
+ box-sizing: border-box;
104
+ display: flex;
105
+ flex-wrap: wrap;
106
+ flex-direction: row;
107
+ margin-top: -32px;
108
+ width: calc(100% + 16px);
109
+ margin-left: -16px;
110
+ -webkit-box-pack: center;
111
+ justify-content: center;
112
+ }
113
+
114
+ .cssc-cjhduv-kjhgs {
115
+ -webkit-font-smoothing: antialiased;
116
+ -webkit-text-size-adjust: 100%;
117
+ color: ${palette.text};
118
+ line-height: 1.15rem;
119
+ font-size: 1rem;
120
+ font-family: Roboto, Public Sans, sans-serif;
121
+ font-weight: 400;
122
+ box-sizing: border-box;
123
+ margin: 0;
124
+ flex-direction: row;
125
+ flex-basis: 100%;
126
+ -webkit-box-flex: 0;
127
+ flex-grow: 0;
128
+ max-width: 100%;
129
+ padding-top: 32px;
130
+ padding-left: 16px;
131
+ }
132
+
133
+ .cssc-1qek100-kjlask {
134
+ -webkit-font-smoothing: antialiased;
135
+ -webkit-text-size-adjust: 100%;
136
+ color: ${palette.text};
137
+ line-height: 1.15rem;
138
+ font-size: 1rem;
139
+ font-family: Roboto, Public Sans, sans-serif;
140
+ font-weight: 400;
141
+ box-sizing: inherit;
142
+ display: flex;
143
+ flex-direction: column;
144
+ background-color: #ffffff;
145
+ overflow: hidden;
146
+ flex: 1;
147
+ scroll-margin-top: 120px;
148
+ }
149
+
150
+ .cssc-lpyf3a-skks {
151
+ -webkit-font-smoothing: antialiased;
152
+ -webkit-text-size-adjust: 100%;
153
+ position: relative;
154
+ box-sizing: border-box;
155
+ -webkit-tap-highlight-color: transparent;
156
+ outline: 0;
157
+ border: 0;
158
+ margin: 0;
159
+ border-radius: 0;
160
+ vertical-align: middle;
161
+ -webkit-appearance: none;
162
+ text-decoration: none;
163
+ text-align: center;
164
+ height: 50px;
165
+ display: flex;
166
+ -webkit-box-align: center;
167
+ align-items: center;
168
+ -webkit-box-pack: center;
169
+ justify-content: center;
170
+ padding: 15px;
171
+ background-color: ${palette.headingBackground};
172
+ color: ${palette.headingText};
173
+ border-bottom: 1px solid ${palette.borderRight};
174
+ }
175
+
176
+ .cssc-1gb95rg-oilkj {
177
+ -webkit-font-smoothing: antialiased;
178
+ -webkit-text-size-adjust: 100%;
179
+ -webkit-tap-highlight-color: transparent;
180
+ color: ${palette.headingText};
181
+ box-sizing: inherit;
182
+ margin: 0;
183
+ font-weight: 500;
184
+ line-height: 1.9500000000000002rem;
185
+ font-size: 1.5rem;
186
+ font-family: Roboto, Public Sans, sans-serif;
187
+ text-align: center;
188
+ flex: 1;
189
+ }
190
+
191
+ .cssc-rorn0c-lkask {
192
+ -webkit-font-smoothing: antialiased;
193
+ -webkit-text-size-adjust: 100%;
194
+ color: ${palette.text};
195
+ line-height: 1.15rem;
196
+ font-size: 1rem;
197
+ font-family: Roboto, Public Sans, sans-serif;
198
+ font-weight: 400;
199
+ box-sizing: inherit;
200
+ width: 100%;
201
+ overflow-x: auto;
202
+ }
203
+
204
+ .cssc-1m6vi3w-posi {
205
+ -webkit-font-smoothing: antialiased;
206
+ -webkit-text-size-adjust: 100%;
207
+ color: ${palette.text};
208
+ line-height: 1.15rem;
209
+ font-size: 1rem;
210
+ font-family: Roboto, Public Sans, sans-serif;
211
+ font-weight: 400;
212
+ box-sizing: inherit;
213
+ display: table;
214
+ width: 100%;
215
+ border-collapse: collapse;
216
+ border-spacing: 0;
217
+ }
218
+
219
+ .cssc-15wwp11-qwem {
220
+ -webkit-font-smoothing: antialiased;
221
+ -webkit-text-size-adjust: 100%;
222
+ color: ${palette.text};
223
+ line-height: 1.15rem;
224
+ font-size: 1rem;
225
+ font-family: Roboto, Public Sans, sans-serif;
226
+ font-weight: 400;
227
+ border-collapse: collapse;
228
+ border-spacing: 0;
229
+ box-sizing: inherit;
230
+ display: table-header-group;
231
+ }
232
+
233
+ .cssc-ho2sf9-sanbv {
234
+ -webkit-font-smoothing: antialiased;
235
+ -webkit-text-size-adjust: 100%;
236
+ line-height: 1.15rem;
237
+ font-size: 1rem;
238
+ font-family: Roboto, Public Sans, sans-serif;
239
+ font-weight: 400;
240
+ border-collapse: collapse;
241
+ border-spacing: 0;
242
+ box-sizing: inherit;
243
+ color: inherit;
244
+ display: table-row;
245
+ vertical-align: middle;
246
+ outline: 0;
247
+ }
248
+
249
+ .cssc-idkl0b-ssaaw {
250
+ -webkit-font-smoothing: antialiased;
251
+ -webkit-text-size-adjust: 100%;
252
+ border-collapse: collapse;
253
+ border-spacing: 0;
254
+ box-sizing: inherit;
255
+ line-height: 1.5rem;
256
+ font-size: 0.875rem;
257
+ font-family: Roboto, Public Sans, sans-serif;
258
+ font-weight: 500;
259
+ display: table-cell;
260
+ vertical-align: inherit;
261
+ text-align: left;
262
+ padding: 6px 16px;
263
+ background-color: ${palette.tableHeaderBackground};
264
+ color: ${palette.tableHeaderText};
265
+ border-right: 1px solid ${palette.border};
266
+ }
267
+
268
+ .cssc-rq2z2r-oilkj {
269
+ -webkit-font-smoothing: antialiased;
270
+ -webkit-text-size-adjust: 100%;
271
+ border-collapse: collapse;
272
+ border-spacing: 0;
273
+ text-align: left;
274
+ color: ${palette.tableHeaderText};
275
+ box-sizing: inherit;
276
+ margin: 0;
277
+ font-weight: 500;
278
+ line-height: 1.15rem;
279
+ font-size: 1rem;
280
+ font-family: Roboto, Public Sans, sans-serif;
281
+ }
282
+
283
+ .cssc-1ymm2he-ssaaw {
284
+ -webkit-font-smoothing: antialiased;
285
+ -webkit-text-size-adjust: 100%;
286
+ border-collapse: collapse;
287
+ border-spacing: 0;
288
+ box-sizing: inherit;
289
+ line-height: 1.25rem;
290
+ font-size: 0.875rem;
291
+ font-family: Roboto, Public Sans, sans-serif;
292
+ font-weight: 500;
293
+ display: table-cell;
294
+ vertical-align: inherit;
295
+ text-align: right;
296
+ padding: 4px 10px;
297
+ flex-direction: row-reverse;
298
+ background-color: ${palette.tableHeaderBackground};
299
+ color: ${palette.tableHeaderText};
300
+ border-right: 1px solid ${palette.border};
301
+ }
302
+
303
+ .cssc-eyhmry-ssaaw {
304
+ -webkit-font-smoothing: antialiased;
305
+ -webkit-text-size-adjust: 100%;
306
+ border-collapse: collapse;
307
+ border-spacing: 0;
308
+ box-sizing: inherit;
309
+ line-height: 1.25rem;
310
+ font-size: 0.875rem;
311
+ font-family: Roboto, Public Sans, sans-serif;
312
+ font-weight: 500;
313
+ display: table-cell;
314
+ vertical-align: inherit;
315
+ text-align: right;
316
+ padding: 4px 10px;
317
+ flex-direction: row-reverse;
318
+ background-color: ${palette.tableHeaderBackground};
319
+ color: ${palette.tableHeaderText};
320
+ }
321
+
322
+ .cssc-apqrd9-skjas {
323
+ -webkit-font-smoothing: antialiased;
324
+ -webkit-text-size-adjust: 100%;
325
+ color: ${palette.text};
326
+ line-height: 1.15rem;
327
+ font-size: 1rem;
328
+ font-family: Roboto, Public Sans, sans-serif;
329
+ font-weight: 400;
330
+ border-collapse: collapse;
331
+ border-spacing: 0;
332
+ box-sizing: inherit;
333
+ display: table-row-group;
334
+ }
335
+
336
+ .cssc-1qrvgoi-sanbv {
337
+ -webkit-font-smoothing: antialiased;
338
+ -webkit-text-size-adjust: 100%;
339
+ line-height: 1.15rem;
340
+ font-size: 1rem;
341
+ font-family: Roboto, Public Sans, sans-serif;
342
+ font-weight: 400;
343
+
344
+ border-collapse: collapse;
345
+ border-spacing: 0;
346
+ box-sizing: inherit;
347
+ color: inherit;
348
+ display: table-row;
349
+ vertical-align: middle;
350
+ outline: 0;
351
+ background-color: ${palette.titleBackground};
352
+ }
353
+
354
+ .cssc-gnx8yv-ssaaw {
355
+ -webkit-font-smoothing: antialiased;
356
+ -webkit-text-size-adjust: 100%;
357
+
358
+ border-collapse: collapse;
359
+ border-spacing: 0;
360
+ box-sizing: inherit;
361
+ line-height: 1.1375rem;
362
+ font-size: 0.875rem;
363
+ font-family: Roboto, Public Sans, sans-serif;
364
+ font-weight: 400;
365
+ display: table-cell;
366
+ vertical-align: inherit;
367
+ border-top: 1px solid ${palette.border};
368
+ text-align: left;
369
+ padding: 6px 16px;
370
+ color: ${palette.titleText};
371
+ }
372
+
373
+ .cssc-1b7x1hq-oilkj {
374
+ -webkit-font-smoothing: antialiased;
375
+ -webkit-text-size-adjust: 100%;
376
+
377
+ border-collapse: collapse;
378
+ border-spacing: 0;
379
+ box-sizing: inherit;
380
+ margin: 0;
381
+ font-weight: 500;
382
+ line-height: 1.54375rem;
383
+ font-size: 1.1875rem;
384
+ font-family: Roboto, Public Sans, sans-serif;
385
+ text-align: center;
386
+ color: ${palette.titleText};
387
+ }
388
+
389
+ .cssc-kkegnv-sanbv {
390
+ -webkit-font-smoothing: antialiased;
391
+ -webkit-text-size-adjust: 100%;
392
+ line-height: 1.15rem;
393
+ font-size: 1rem;
394
+ font-family: Roboto, Public Sans, sans-serif;
395
+ font-weight: 400;
396
+
397
+ border-collapse: collapse;
398
+ border-spacing: 0;
399
+ box-sizing: inherit;
400
+ color: inherit;
401
+ display: table-row;
402
+ vertical-align: middle;
403
+ outline: 0;
404
+ }
405
+
406
+ .cssc-1d7qqp0-ssaaw {
407
+ -webkit-font-smoothing: antialiased;
408
+ -webkit-text-size-adjust: 100%;
409
+
410
+ border-collapse: collapse;
411
+ border-spacing: 0;
412
+ box-sizing: inherit;
413
+ line-height: 1.1375rem;
414
+ font-size: 0.875rem;
415
+ font-family: Roboto, Public Sans, sans-serif;
416
+ font-weight: 400;
417
+ display: table-cell;
418
+ vertical-align: inherit;
419
+ border-bottom: 1px solid rgba(240, 240, 240, 1);
420
+ text-align: left;
421
+ padding: 4px 10px;
422
+ color: ${palette.text};
423
+ border-right: 1px solid ${palette.borderRight};
424
+ }
425
+
426
+ .cssc-1ebo3of-oilkj {
427
+ -webkit-font-smoothing: antialiased;
428
+ -webkit-text-size-adjust: 100%;
429
+
430
+ border-collapse: collapse;
431
+ border-spacing: 0;
432
+ text-align: left;
433
+ color: ${palette.text};
434
+ box-sizing: inherit;
435
+ margin: 0;
436
+ line-height: 1.1375rem;
437
+ font-size: 0.875rem;
438
+ font-family: Roboto, Public Sans, sans-serif;
439
+ font-weight: 400;
440
+ }
441
+
442
+ .cssc-up54xb-ssaaw {
443
+ -webkit-font-smoothing: antialiased;
444
+ -webkit-text-size-adjust: 100%;
445
+
446
+ border-collapse: collapse;
447
+ border-spacing: 0;
448
+ box-sizing: inherit;
449
+ line-height: 1.1375rem;
450
+ font-size: 0.875rem;
451
+ font-family: Roboto, Public Sans, sans-serif;
452
+ font-weight: 400;
453
+ display: table-cell;
454
+ vertical-align: inherit;
455
+ border-bottom: 1px solid rgba(240, 240, 240, 1);
456
+ text-align: right;
457
+ padding: 6px 16px;
458
+ color: ${palette.text};
459
+ flex-direction: row-reverse;
460
+ border-right: 1px solid ${palette.borderRight};
461
+ }
462
+
463
+ .cssc-v53jtm-ssaaw {
464
+ -webkit-font-smoothing: antialiased;
465
+ -webkit-text-size-adjust: 100%;
466
+
467
+ border-collapse: collapse;
468
+ border-spacing: 0;
469
+ box-sizing: inherit;
470
+ line-height: 1.1375rem;
471
+ font-size: 0.875rem;
472
+ font-family: Roboto, Public Sans, sans-serif;
473
+ font-weight: 400;
474
+ display: table-cell;
475
+ vertical-align: inherit;
476
+ border-bottom: 1px solid rgba(240, 240, 240, 1);
477
+ text-align: right;
478
+ padding: 6px 16px;
479
+ color: ${palette.text};
480
+ flex-direction: row-reverse;
481
+ }
482
+
483
+ .cssc-1ho5x3sk-kjlask {
484
+ padding: 10px;
485
+ width: 100%;
486
+ border-top: 1px solid ${palette.borderRight};
487
+ }
488
+
489
+ .cssc-1ho5x3p-kjlask {
490
+ -webkit-font-smoothing: antialiased;
491
+ -webkit-text-size-adjust: 100%;
492
+ color: ${palette.text};
493
+ line-height: 1.15rem;
494
+ font-size: 1rem;
495
+ font-family: Roboto, Public Sans, sans-serif;
496
+ font-weight: 400;
497
+ box-sizing: inherit;
498
+ display: flex;
499
+ flex-direction: column;
500
+ max-width: 400px;
501
+ gap: 5px
502
+ }
503
+
504
+ .cssc-gmwslw-kjlask {
505
+ -webkit-font-smoothing: antialiased;
506
+ -webkit-text-size-adjust: 100%;
507
+ color: ${palette.text};
508
+ line-height: 1.15rem;
509
+ font-size: 1rem;
510
+ font-family: Roboto, Public Sans, sans-serif;
511
+ font-weight: 400;
512
+ box-sizing: inherit;
513
+ display: flex;
514
+ flex-direction: row;
515
+ -webkit-box-pack: justify;
516
+ justify-content: space-between;
517
+ margin: 0;
518
+ }
519
+
520
+ .cssc-1iy4zoj-oilkj {
521
+ -webkit-font-smoothing: antialiased;
522
+ -webkit-text-size-adjust: 100%;
523
+ color: ${palette.text};
524
+ box-sizing: inherit;
525
+ margin: 0;
526
+ line-height: 1.15rem;
527
+ font-size: 1rem;
528
+ font-family: Roboto, Public Sans, sans-serif;
529
+ font-weight: 400;
530
+ }
531
+
532
+ .cssc-13sv1r4-oilkj {
533
+ -webkit-font-smoothing: antialiased;
534
+ -webkit-text-size-adjust: 100%;
535
+ color: ${palette.text};
536
+ box-sizing: inherit;
537
+ margin: 0;
538
+ line-height: 1.15rem;
539
+ font-size: 1rem;
540
+ font-family: Roboto, Public Sans, sans-serif;
541
+ font-weight: 700;
542
+ }
543
+
544
+ .cssc-1l6ueuj-sjaksl {
545
+ -webkit-font-smoothing: antialiased;
546
+ -webkit-text-size-adjust: 100%;
547
+ color: ${palette.text};
548
+ line-height: 1.15rem;
549
+ font-size: 1rem;
550
+ font-family: Roboto, Public Sans, sans-serif;
551
+ font-weight: 400;
552
+ box-sizing: inherit;
553
+ flex-shrink: 0;
554
+ border-width: 0;
555
+ border-style: solid;
556
+ border-color: #dcdcdc;
557
+ border-bottom-width: thin;
558
+ margin: 0;
559
+ margin-top: 4px;
560
+ }
561
+
562
+ .cssc-1pm8g43-kjlask {
563
+ -webkit-font-smoothing: antialiased;
564
+ -webkit-text-size-adjust: 100%;
565
+ color: ${palette.text};
566
+ line-height: 1.15rem;
567
+ font-size: 1rem;
568
+ font-family: Roboto, Public Sans, sans-serif;
569
+ font-weight: 400;
570
+ box-sizing: inherit;
571
+ display: flex;
572
+ flex-direction: column;
573
+ max-width: 400px;
574
+ margin: 0;
575
+ gap: 5px;
576
+ }
577
+
578
+ .cssc-gmwslw-kjlask {
579
+ -webkit-font-smoothing: antialiased;
580
+ -webkit-text-size-adjust: 100%;
581
+ color: ${palette.text};
582
+ line-height: 1.15rem;
583
+ font-size: 1rem;
584
+ font-family: Roboto, Public Sans, sans-serif;
585
+ font-weight: 400;
586
+ box-sizing: inherit;
587
+ display: flex;
588
+ flex-direction: row;
589
+ -webkit-box-pack: justify;
590
+ justify-content: space-between;
591
+ margin: 0;
592
+ }
593
+
594
+ .cssc-1pm8m44-kjlask {
595
+ -webkit-font-smoothing: antialiased;
596
+ -webkit-text-size-adjust: 100%;
597
+ -webkit-user-select: none;
598
+ border-collapse: collapse;
599
+ border-spacing: 0;
600
+ line-height: 1.1375rem;
601
+ font-size: 0.875rem;
602
+ font-family: Roboto,Public Sans,sans-serif;
603
+ font-weight: 400;
604
+ text-align: left;
605
+ color: ${palette.text};
606
+ box-sizing: inherit;
607
+ display: flex;
608
+ flex-direction: row;
609
+ }
610
+
611
+ .cssc-1ebo3of-gaplas {
612
+ -webkit-font-smoothing: antialiased;
613
+ -webkit-text-size-adjust: 100%;
614
+ -webkit-user-select: none;
615
+ border-collapse: collapse;
616
+ border-spacing: 0;
617
+ line-height: 1.1375rem;
618
+ font-size: 0.875rem;
619
+ font-family: Roboto,Public Sans,sans-serif;
620
+ font-weight: 400;
621
+ text-align: left;
622
+ color: ${palette.text};
623
+ box-sizing: inherit;
624
+ width: 15px;
625
+ border-left: 1px solid #DCDCDC;
626
+ border-bottom: 1px solid #DCDCDC;
627
+ margin: 0;
628
+ }
629
+
630
+ .cssc-lpyf3z-kjlask {
631
+ -webkit-font-smoothing: antialiased;
632
+ -webkit-text-size-adjust: 100%;
633
+ color: ${palette.text};
634
+ line-height: 1.15rem;
635
+ font-size: 1rem;
636
+ font-family: Roboto,Public Sans,sans-serif;
637
+ font-weight: 400;
638
+ -webkit-user-select: none;
639
+ box-sizing: inherit;
640
+ display: flex;
641
+ flex-direction: column;
642
+ align-items: flex-start;
643
+ }
644
+
645
+ .cssc-1ebo3gf-oilkj {
646
+ -webkit-font-smoothing: antialiased;
647
+ -webkit-text-size-adjust: 100%;
648
+ -webkit-user-select: none;
649
+ box-sizing: inherit;
650
+ margin: 0;
651
+ line-height: 0.975rem;
652
+ font-size: 0.75rem;
653
+ font-family: Roboto,Public Sans,sans-serif;
654
+ font-weight: 400;
655
+ color: ${palette.text};
656
+ }
657
+
658
+ ${monochrome
659
+ ? `
660
+ /* Receipt Printer Optimized Styles - Monochrome */
661
+
662
+ /* Container Styles */
663
+ .cssc-1flmrcm-kjlask {
664
+ margin-top: 4px !important;
665
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
666
+ }
667
+
668
+ .cssc-1qeq10-kjlask {
669
+ gap: 2px !important;
670
+ margin-top: 4px !important;
671
+ margin-bottom: 4px !important;
672
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
673
+ }
674
+
675
+ .cssc-1owvoyj-kjhgs {
676
+ margin-top: 0 !important;
677
+ margin-left: 0 !important;
678
+ width: 100% !important;
679
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
680
+ }
681
+
682
+ .cssc-cjhduv-kjhgs {
683
+ padding-top: 4px !important;
684
+ padding-left: 0 !important;
685
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
686
+ }
687
+
688
+ /* Header Styles */
689
+ .cssc-lpyf3a-skks {
690
+ height: 20px !important;
691
+ padding: 2px 4px !important;
692
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
693
+ }
694
+
695
+ .cssc-1gb95rg-oilkj {
696
+ font-size: 24px !important;
697
+ line-height: 26px !important;
698
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
699
+ }
700
+
701
+ .cssc-1b7x1hq-oilkj {
702
+ font-size: 22px !important;
703
+ line-height: 24px !important;
704
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
705
+ }
706
+
707
+ /* Table Cell Styles */
708
+ .cssc-idkl0b-ssaaw,
709
+ .cssc-1ymm2he-ssaaw,
710
+ .cssc-eyhmry-ssaaw {
711
+ padding: 2px 4px !important;
712
+ font-size: 17px !important;
713
+ line-height: 19px !important;
714
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
715
+ }
716
+
717
+ .cssc-gnx8yv-ssaaw,
718
+ .cssc-1d7qqp0-ssaaw,
719
+ .cssc-up54xb-ssaaw,
720
+ .cssc-v53jtm-ssaaw {
721
+ padding: 2px 4px !important;
722
+ font-size: 17px !important;
723
+ line-height: 19px !important;
724
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
725
+ }
726
+
727
+ /* Footer Styles */
728
+ .cssc-1ho5x3sk-kjlask {
729
+ padding: 4px !important;
730
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
731
+ }
732
+
733
+ .cssc-1ho5x3p-kjlask {
734
+ gap: 2px !important;
735
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
736
+ }
737
+
738
+ .cssc-1pm8g43-kjlask {
739
+ gap: 2px !important;
740
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
741
+ }
742
+
743
+ .cssc-1l6ueuj-sjaksl {
744
+ margin-top: 1px !important;
745
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
746
+ }
747
+
748
+ .cssc-gmwslw-kjlask {
749
+ font-size: 17px !important;
750
+ line-height: 19px !important;
751
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
752
+ }
753
+
754
+ .cssc-1iy4zoj-oilkj,
755
+ .cssc-13sv1r4-oilkj {
756
+ font-size: 17px !important;
757
+ line-height: 19px !important;
758
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
759
+ }
760
+
761
+ /* Subtitle and Label Styles */
762
+ .cssc-rq2z2r-oilkj {
763
+ font-size: 18px !important;
764
+ line-height: 20px !important;
765
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
766
+ }
767
+
768
+ .cssc-1ebo3of-oilkj {
769
+ font-size: 17px !important;
770
+ line-height: 19px !important;
771
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
772
+ }
773
+
774
+ .cssc-1ebo3gf-oilkj {
775
+ font-size: 16px !important;
776
+ line-height: 18px !important;
777
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
778
+ }
779
+
780
+ .cssc-1pm8m44-kjlask {
781
+ font-size: 17px !important;
782
+ line-height: 19px !important;
783
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
784
+ }
785
+
786
+ .cssc-1ebo3of-gaplas {
787
+ font-size: 17px !important;
788
+ line-height: 19px !important;
789
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
790
+ }
791
+
792
+ .cssc-lpyf3z-kjlask {
793
+ font-size: 17px !important;
794
+ line-height: 19px !important;
795
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
796
+ }
797
+
798
+ .cssc-16f6p1q-kjlask {
799
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
800
+ }
801
+
802
+ .cssc-1qek100-kjlask {
803
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
804
+ }
805
+
806
+ .cssc-rorn0c-lkask {
807
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
808
+ }
809
+
810
+ .cssc-1m6vi3w-posi {
811
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
812
+ }
813
+
814
+ .cssc-15wwp11-qwem {
815
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
816
+ }
817
+
818
+ .cssc-ho2sf9-sanbv {
819
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
820
+ }
821
+
822
+ .cssc-apqrd9-skjas {
823
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
824
+ }
825
+
826
+ .cssc-1qrvgoi-sanbv {
827
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
828
+ }
829
+
830
+ .cssc-kkegnv-sanbv {
831
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
832
+ }
833
+ `
834
+ : ''}
835
+ </style>
836
+ <title>Purchase Order X Report</title>
837
+ </head>`;
838
+ };
839
+ function getBody({ vendorWiseData, combinedData, currency_symbol, from, to, warehouseName, monochrome, isFilterApplied, }) {
840
+ let mainBodyElements = ``;
841
+ const fillMainBody = (staffData, index) => {
842
+ let mainBodyFooterElements = `<div class="cssc-gmwslw-kjlask">
843
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Total Orders</p>
844
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${staffData.totalOrders}</p>
845
+ </div>`;
846
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
847
+ <div class="cssc-gmwslw-kjlask">
848
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Item Sales</h6>
849
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${(0, common_1.localeAmount)(currency_symbol, staffData.itemSales)}</p>
850
+ </div>`;
851
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
852
+ <div class="cssc-gmwslw-kjlask">
853
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Net Sale</h6>
854
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #008000'}">${(0, common_1.localeAmount)(currency_symbol, staffData.netSale)}</p>
855
+ </div>`;
856
+ if (staffData.unpaidOrders > 0) {
857
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
858
+ <div class="cssc-gmwslw-kjlask">
859
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Amount Collected</h6>
860
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #FF6D00'}">${(0, common_1.localeAmount)(currency_symbol, staffData.amountCollected)}</p>
861
+ </div>`;
862
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
863
+ <div class="cssc-gmwslw-kjlask">
864
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">${staffData.unpaidOrders} Unpaid</h6>
865
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #FF0000'}">${(0, common_1.localeAmount)(currency_symbol, staffData.unpaidAmount)}</p>
866
+ </div>`;
867
+ }
868
+ if (staffData.netWithoutGst > 0 && staffData.netWithoutGst !== staffData.netSale) {
869
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
870
+ <div class="cssc-gmwslw-kjlask">
871
+ <div class="cssc-lpyf3z-kjlask">
872
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Net Sale (Other)</h6>
873
+ <span class="cssc-1ebo3gf-oilkj">${staffData.netWithoutGstSubtitle}</span>
874
+ </div>
875
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${(0, common_1.localeAmount)(currency_symbol, staffData.netWithoutGst)}</p>
876
+ </div>`;
877
+ }
878
+ let mainBodyTableElements = ``;
879
+ staffData.channels.forEach((channel) => {
880
+ mainBodyTableElements += `<tr class="cssc-1qrvgoi-sanbv">
881
+ <td class="cssc-gnx8yv-ssaaw" colspan="3">
882
+ <h6 class="cssc-1b7x1hq-oilkj">
883
+ ${channel.title}
884
+ </h6>
885
+ </td>
886
+ </tr>`;
887
+ channel.subChannels.forEach((subChannel) => {
888
+ mainBodyTableElements += `<tr class="cssc-kkegnv-sanbv">
889
+ <th class="cssc-1d7qqp0-ssaaw" scope="row">
890
+ <p class="cssc-1ebo3of-oilkj"
891
+ ${subChannel.bold ? `style="font-weight: bold; text-decoration: underline"` : ''}
892
+ >
893
+ ${subChannel.title}
894
+ </p>
895
+ </th>
896
+
897
+ <td class="cssc-up54xb-ssaaw" align="right">
898
+ <p class="cssc-1iy4zoj-oilkj"
899
+ ${subChannel.bold ? `style="font-weight: bold; text-decoration: underline"` : ''}
900
+ >${subChannel.count}</p>
901
+ </td>
902
+
903
+ <td class="cssc-v53jtm-ssaaw" align="right">
904
+ <p class="cssc-1iy4zoj-oilkj"
905
+ ${subChannel.strikeThrough
906
+ ? `style="text-decoration: line-through"`
907
+ : subChannel.bold
908
+ ? `style="font-weight: bold; text-decoration: underline"`
909
+ : ''}
910
+ >${(0, common_1.localeAmount)(currency_symbol, subChannel.amount)}</p>
911
+ </td>
912
+ </tr>`;
913
+ });
914
+ channel.footerDetails.forEach((row) => {
915
+ mainBodyTableElements += `<tr class="cssc-kkegnv-sanbv">
916
+ <th class="cssc-1d7qqp0-ssaaw" scope="row">
917
+ <div class="cssc-1pm8m44-kjlask" >
918
+ <div class="cssc-1ebo3of-gaplas"></div>
919
+ <span class="cssc-1ebo3of-oilkj" style="font-weight: normal">
920
+ ${row.title}
921
+ </span>
922
+ </div>
923
+ </th>
924
+
925
+ <td class="cssc-up54xb-ssaaw" align="right">
926
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: normal">${row.count}</p>
927
+ </td>
928
+
929
+ <td class="cssc-v53jtm-ssaaw" align="right">
930
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: normal">${(0, common_1.localeAmount)(currency_symbol, row.amount)}</p>
931
+ </td>
932
+ </tr>`;
933
+ });
934
+ });
935
+ let mainBodyDivider = '';
936
+ if (monochrome && index > 0) {
937
+ mainBodyDivider = `<hr style="height: 3px; color: #000000; background-color: #000000; border: none;" />`;
938
+ }
939
+ mainBodyElements += `<div class="cssc-1owvoyj-kjhgs">
940
+ <div class="cssc-cjhduv-kjhgs">
941
+ ${mainBodyDivider}
942
+ <div class="cssc-1qek100-kjlask">
943
+ <div class="cssc-lpyf3a-skks">
944
+ <h5 class="cssc-1gb95rg-oilkj">${staffData.title}</h5>
945
+ </div>
946
+
947
+ <div class="cssc-rorn0c-lkask">
948
+ <table class="cssc-1m6vi3w-posi">
949
+ <thead class="cssc-15wwp11-qwem">
950
+ <tr class="cssc-ho2sf9-sanbv">
951
+ <th class="cssc-idkl0b-ssaaw" scope="col">
952
+ <h6 class="cssc-rq2z2r-oilkj">
953
+ Description
954
+ </h6>
955
+ </th>
956
+
957
+ <th class="cssc-1ymm2he-ssaaw" scope="col" align="right">
958
+ </th>
959
+
960
+ <th class="cssc-eyhmry-ssaaw" scope="col" align="right">
961
+ <h6 class="cssc-rq2z2r-oilkj" style="text-align: right">Amount</h6>
962
+ </th>
963
+ </tr>
964
+ </thead>
965
+
966
+ <tbody class="cssc-apqrd9-skjas">
967
+ ${mainBodyTableElements}
968
+ </tbody>
969
+ </table>
970
+ </div>
971
+
972
+ <div class="cssc-1ho5x3sk-kjlask">
973
+ <div class="cssc-1ho5x3p-kjlask">
974
+ ${mainBodyFooterElements}
975
+ </div>
976
+ </div>
977
+ </div>
978
+ </div>
979
+ </div>`;
980
+ };
981
+ vendorWiseData.forEach(fillMainBody);
982
+ if (combinedData != null && vendorWiseData.length > 1) {
983
+ fillMainBody(combinedData, vendorWiseData.length);
984
+ }
985
+ return `<div class="cssc-1flmrcm-kjlask">
986
+ <div class="cssc-1qeq10-kjlask">
987
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">Purchase Order X Report</h5>
988
+ <p class="cssc-1iy4zoj-oilkj">${(0, moment_1.default)(from).format('dddd')} ${(0, moment_1.default)(from).format('MMM DD, YYYY')}</p>
989
+ <p class="cssc-1ebo3of-oilkj">${(0, moment_1.default)(from).format('h:mm a, MMM DD')} - ${(0, moment_1.default)(to).format('h:mm a, MMM DD')}</p>
990
+ </div>
991
+
992
+ <div class="cssc-16f6p1q-kjlask">
993
+ ${mainBodyElements}
994
+ </div>
995
+
996
+ <div class="cssc-1qeq10-kjlask">
997
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">${warehouseName ?? ''}</h5>
998
+ <p class="cssc-1iy4zoj-oilkj">
999
+ Exported on ${(0, moment_1.default)().format('dddd')} ${(0, moment_1.default)().format('MMM DD, YYYY')} at ${(0, moment_1.default)().format('h:mm a')}
1000
+ </p>
1001
+ ${isFilterApplied
1002
+ ? `<p class="cssc-1iy4zoj-oilkj"
1003
+ style="text-align: center; font-weight: bold; ${monochrome ? 'color: #000000' : 'color: #FF0000'}"
1004
+ >
1005
+ Note: This report is filtered. Please ensure to tally the data on your end.
1006
+ </p>`
1007
+ : ''}
1008
+ </div>
1009
+ </div>`;
1010
+ }
1011
+ function getWarehousePurchaseOrderXReportHtml({ width, monochrome, vendorWiseData, combinedData, currency_symbol, from, to, warehouseName, isFilterApplied, }) {
1012
+ const style = width ? `style=width: ${width}px; max-width: ${width}px` : '';
1013
+ const html = `
1014
+ <html lang="en" ${style}>
1015
+ ${getHead(monochrome)}
1016
+ <body translate="no"
1017
+ ${style}
1018
+ >
1019
+ ${getBody({
1020
+ vendorWiseData,
1021
+ combinedData,
1022
+ currency_symbol,
1023
+ from,
1024
+ to,
1025
+ warehouseName,
1026
+ monochrome,
1027
+ isFilterApplied,
1028
+ })}
1029
+ </body>
1030
+ </html>`;
1031
+ return html;
1032
+ }
1033
+ // ======================>>>><<<<=====================
1034
+ const TOTAL_REF = 'TOTAL';
1035
+ const VENDOR_ID = 'by_vendors';
1036
+ const getSortedUsableChannels = (channels) => {
1037
+ const usableChannels = [];
1038
+ for (let i = 0; i < channels.length; i++) {
1039
+ const c = channels[i];
1040
+ const footerDetailsMap = c.footerDetailsMap;
1041
+ const channel = {
1042
+ _id: c._id,
1043
+ title: c.title,
1044
+ ref: c.ref,
1045
+ sortIndex: c.sortIndex,
1046
+ subChannels: c.subChannels,
1047
+ footerDetails: Object.values(footerDetailsMap)
1048
+ .map((fd) => ({
1049
+ ...fd,
1050
+ amount: (0, price_conversion_1.convertIntToDecimal)(fd.amount),
1051
+ }))
1052
+ .sort((a, b) => a.sortIndex - b.sortIndex),
1053
+ };
1054
+ const subChannels = channel.subChannels;
1055
+ subChannels
1056
+ .sort((a, b) => (a.ref > b.ref ? 1 : -1))
1057
+ .forEach((sc, index) => {
1058
+ sc.sortIndex = index;
1059
+ });
1060
+ for (let j = 0; j < subChannels.length; j++) {
1061
+ const subChannel = subChannels[j];
1062
+ if (subChannel.ref === TOTAL_REF) {
1063
+ subChannel.sortIndex = 100000;
1064
+ subChannel.bold = true;
1065
+ }
1066
+ else if (channel.ref === constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES) {
1067
+ const paymentType = subChannel.ref;
1068
+ let sortIndex = constants_1.ALL_PAYMENT_TYPE_NAMES.indexOf(paymentType);
1069
+ if (sortIndex === -1) {
1070
+ sortIndex = 200 + j;
1071
+ }
1072
+ subChannel.sortIndex = sortIndex;
1073
+ if (paymentType === constants_1.PAYMENT_TYPE_ENUM.COMPLIMENTARY) {
1074
+ const totalIndex = channel.subChannels.findIndex((sc) => sc.ref === TOTAL_REF);
1075
+ if (totalIndex !== -1) {
1076
+ const totalAmount = channel.subChannels[totalIndex].amount;
1077
+ channel.subChannels[totalIndex].amount = (0, common_1.parseNum)(totalAmount - subChannel.amount);
1078
+ }
1079
+ subChannel.strikeThrough = true;
1080
+ }
1081
+ }
1082
+ else if (channel.ref === constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS) {
1083
+ const status = subChannel.ref;
1084
+ let sortIndex = constants_1.ALL_WAREHOUSE_PURCHASE_ORDER_STATUS_NAMES.indexOf(status);
1085
+ if (sortIndex === -1) {
1086
+ sortIndex = 200 + j;
1087
+ }
1088
+ if (status === constants_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.CANCELLED) {
1089
+ const totalIndex = channel.subChannels.findIndex((sc) => sc.ref === TOTAL_REF);
1090
+ if (totalIndex !== -1) {
1091
+ const totalAmount = channel.subChannels[totalIndex].amount;
1092
+ channel.subChannels[totalIndex].amount = (0, common_1.parseNum)(totalAmount - subChannel.amount);
1093
+ }
1094
+ subChannel.strikeThrough = true;
1095
+ }
1096
+ subChannel.sortIndex = sortIndex;
1097
+ }
1098
+ else if (channel.ref === constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.STAFF) {
1099
+ // Vendors are sorted by ref (vendor_id)
1100
+ subChannel.sortIndex = j;
1101
+ }
1102
+ }
1103
+ usableChannels.push(channel);
1104
+ }
1105
+ const sortedChannels = usableChannels
1106
+ .map((channel) => ({
1107
+ ...channel,
1108
+ subChannels: channel.subChannels.sort((a, b) => a.sortIndex - b.sortIndex),
1109
+ }))
1110
+ .sort((a, b) => a.sortIndex - b.sortIndex);
1111
+ return sortedChannels;
1112
+ };
1113
+ const generateVendorWiseData = (data, currencySymbol, gstName) => {
1114
+ const vendorWiseDataMap = {};
1115
+ const vendorWiseTotalSalesMap = {};
1116
+ const vendorNamesMap = {};
1117
+ data[constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_SALES].forEach((item) => {
1118
+ const vendorName = item.vendor_name ?? 'By Vendors';
1119
+ const vendorId = item.vendor_id ?? VENDOR_ID;
1120
+ vendorWiseTotalSalesMap[vendorId] = item;
1121
+ vendorNamesMap[vendorId] = vendorName;
1122
+ });
1123
+ // ==========>>><<<==========
1124
+ data[constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.STAFF].forEach((item) => {
1125
+ const vendorId = item.vendor_id ?? VENDOR_ID;
1126
+ const vendorName = vendorNamesMap[vendorId];
1127
+ if (vendorName != null) {
1128
+ const amount = item.grossAmount;
1129
+ const obj = {
1130
+ _id: vendorId,
1131
+ ref: item.staff_id,
1132
+ title: 'Staff',
1133
+ description: item.staff_name,
1134
+ type: constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.STAFF,
1135
+ staff_name: vendorName,
1136
+ count: item.count,
1137
+ amount,
1138
+ sortIndex: 1,
1139
+ };
1140
+ if (vendorWiseDataMap[vendorId] != null) {
1141
+ vendorWiseDataMap[vendorId].push(obj);
1142
+ }
1143
+ else {
1144
+ vendorWiseDataMap[vendorId] = [obj];
1145
+ }
1146
+ }
1147
+ });
1148
+ data[constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS].forEach((item) => {
1149
+ const vendorId = item.vendor_id ?? VENDOR_ID;
1150
+ const vendorName = vendorNamesMap[vendorId];
1151
+ if (vendorName != null) {
1152
+ const amount = item.grossAmount;
1153
+ const obj = {
1154
+ _id: vendorId,
1155
+ ref: item.status,
1156
+ type: constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS,
1157
+ staff_name: vendorName,
1158
+ title: 'Order Status',
1159
+ description: (0, common_1.sentenceCase)(item.status.replace(/_/g, ' ')),
1160
+ count: item.count,
1161
+ amount,
1162
+ sortIndex: 2,
1163
+ };
1164
+ if (vendorWiseDataMap[vendorId] != null) {
1165
+ vendorWiseDataMap[vendorId].push(obj);
1166
+ }
1167
+ else {
1168
+ vendorWiseDataMap[vendorId] = [obj];
1169
+ }
1170
+ }
1171
+ });
1172
+ data[constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES].forEach((item) => {
1173
+ const vendorId = item.vendor_id ?? VENDOR_ID;
1174
+ const vendorName = vendorNamesMap[vendorId];
1175
+ if (vendorName != null) {
1176
+ const amount = item.grossAmount;
1177
+ const obj = {
1178
+ _id: vendorId,
1179
+ ref: item.payment_type,
1180
+ type: constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES,
1181
+ staff_name: vendorName,
1182
+ title: 'Payments',
1183
+ description: (0, common_1.sentenceCase)(item.payment_type.replace(/_/g, ' ')),
1184
+ count: item.count,
1185
+ amount,
1186
+ sortIndex: 3,
1187
+ };
1188
+ if (vendorWiseDataMap[vendorId] != null) {
1189
+ vendorWiseDataMap[vendorId].push(obj);
1190
+ }
1191
+ else {
1192
+ vendorWiseDataMap[vendorId] = [obj];
1193
+ }
1194
+ }
1195
+ });
1196
+ data[constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.GST].forEach((item) => {
1197
+ const vendorId = item.vendor_id ?? VENDOR_ID;
1198
+ const vendorName = vendorNamesMap[vendorId];
1199
+ if (vendorName != null) {
1200
+ const gst = (0, price_conversion_1.convertIntToDecimal)(item.gst);
1201
+ const amount = item.grossAmount;
1202
+ const obj = {
1203
+ _id: vendorId,
1204
+ ref: gst,
1205
+ type: constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.GST,
1206
+ staff_name: vendorName,
1207
+ title: gstName,
1208
+ description: `${gst}%`,
1209
+ count: item.count,
1210
+ amount,
1211
+ sortIndex: 4,
1212
+ };
1213
+ if (vendorWiseDataMap[vendorId] != null) {
1214
+ vendorWiseDataMap[vendorId].push(obj);
1215
+ }
1216
+ else {
1217
+ vendorWiseDataMap[vendorId] = [obj];
1218
+ }
1219
+ }
1220
+ });
1221
+ const vendorWiseDataFooterDetailsMap = {};
1222
+ return {
1223
+ vendorWiseDataMap,
1224
+ vendorWiseTotalSalesMap,
1225
+ vendorWiseDataFooterDetailsMap,
1226
+ };
1227
+ };
1228
+ const getUsableData = (data, subtitles) => {
1229
+ const defaultCombinedData = {
1230
+ _id: 'combined',
1231
+ title: 'Combined Report',
1232
+ netSale: 0,
1233
+ netWithoutGst: 0,
1234
+ totalOrders: 0,
1235
+ unpaidOrders: 0,
1236
+ unpaidAmount: 0,
1237
+ amountCollected: 0,
1238
+ itemSales: 0,
1239
+ channels: [],
1240
+ ...subtitles,
1241
+ };
1242
+ const { vendorWiseDataMap, vendorWiseTotalSalesMap, vendorWiseDataFooterDetailsMap } = data;
1243
+ const vendorWiseData = [];
1244
+ const combinedData = {
1245
+ ...defaultCombinedData,
1246
+ };
1247
+ const combinedChannelsMap = {};
1248
+ for (const staffId in vendorWiseDataMap) {
1249
+ const salesData = vendorWiseTotalSalesMap[staffId];
1250
+ if (!salesData)
1251
+ continue;
1252
+ const staffData = vendorWiseDataMap[staffId];
1253
+ const similarTypes = {};
1254
+ for (let i = 0; i < staffData.length; i++) {
1255
+ const d = staffData[i];
1256
+ if (similarTypes[d.type] != null) {
1257
+ similarTypes[d.type].push(d);
1258
+ }
1259
+ else {
1260
+ similarTypes[d.type] = [d];
1261
+ }
1262
+ }
1263
+ const totalOrders = salesData.count;
1264
+ const netSale = salesData.grossAmount;
1265
+ let totalGst = 0;
1266
+ let unpaidOrders = 0;
1267
+ let unpaidAmount = 0;
1268
+ for (const type in similarTypes) {
1269
+ const firstData = similarTypes[type][0];
1270
+ if (!firstData)
1271
+ continue;
1272
+ const combinedData = similarTypes[type].reduce((acc, d) => {
1273
+ acc.count += d.count;
1274
+ acc.amount += d.amount;
1275
+ return acc;
1276
+ }, {
1277
+ count: 0,
1278
+ amount: 0,
1279
+ });
1280
+ similarTypes[type].push({
1281
+ _id: `${firstData._id}-${TOTAL_REF}`,
1282
+ ref: TOTAL_REF,
1283
+ type: firstData.type,
1284
+ staff_name: firstData.staff_name,
1285
+ title: firstData.title,
1286
+ description: 'Total',
1287
+ count: combinedData.count,
1288
+ amount: combinedData.amount,
1289
+ sortIndex: 100000,
1290
+ });
1291
+ }
1292
+ const topLevelChannels = [];
1293
+ for (const type in similarTypes) {
1294
+ const vendorWiseDataArr = similarTypes[type];
1295
+ const firstData = vendorWiseDataArr[0];
1296
+ const footerDetailsMap = structuredClone(vendorWiseDataFooterDetailsMap[staffId]?.[type] ?? {});
1297
+ const channel = {
1298
+ _id: `${firstData._id}-${firstData.type}`,
1299
+ ref: firstData.type,
1300
+ title: firstData.title,
1301
+ subChannels: [],
1302
+ sortIndex: firstData.sortIndex,
1303
+ footerDetailsMap,
1304
+ };
1305
+ const subChannels = [];
1306
+ for (let j = 0; j < vendorWiseDataArr.length; j++) {
1307
+ const d = vendorWiseDataArr[j];
1308
+ if (d.type === constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.GST && d.ref !== TOTAL_REF) {
1309
+ totalGst += d.amount;
1310
+ }
1311
+ else if (d.type === constants_1.WAREHOUSE_PURCHASE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES && d.ref !== TOTAL_REF) {
1312
+ if (String(d.description).toUpperCase() === constants_1.PAYMENT_TYPE_ENUM.UNPAID) {
1313
+ unpaidOrders += d.count;
1314
+ unpaidAmount += d.amount;
1315
+ }
1316
+ }
1317
+ const sChannel = {
1318
+ _id: `${d._id}-${d.ref}`,
1319
+ ref: d.ref,
1320
+ title: typeof d.description === 'string' ? d.description : `${d.description} ${(0, common_1.sentenceCase)(d.type)}`,
1321
+ count: d.count,
1322
+ amount: d.amount,
1323
+ sortIndex: j,
1324
+ };
1325
+ if (combinedChannelsMap[type] != null) {
1326
+ if (combinedChannelsMap[type].subChannels[d.ref] != null) {
1327
+ combinedChannelsMap[type].subChannels[d.ref].amount += d.amount;
1328
+ combinedChannelsMap[type].subChannels[d.ref].count += d.count;
1329
+ }
1330
+ else {
1331
+ combinedChannelsMap[type].subChannels[d.ref] = {
1332
+ ...sChannel,
1333
+ sortIndex: j,
1334
+ };
1335
+ }
1336
+ }
1337
+ else {
1338
+ combinedChannelsMap[type] = {
1339
+ _id: `${d._id}-${d.type}`,
1340
+ ref: d.type,
1341
+ title: d.title,
1342
+ sortIndex: d.sortIndex,
1343
+ footerDetailsMap: {},
1344
+ subChannels: {
1345
+ [d.ref]: {
1346
+ ...sChannel,
1347
+ sortIndex: j,
1348
+ },
1349
+ },
1350
+ };
1351
+ }
1352
+ if (j === 0) {
1353
+ const combinedFooterDetailsMap = structuredClone(combinedChannelsMap[type].footerDetailsMap ?? {});
1354
+ for (const key in footerDetailsMap) {
1355
+ if (combinedFooterDetailsMap[key] != null) {
1356
+ combinedFooterDetailsMap[key].amount += footerDetailsMap[key].amount;
1357
+ combinedFooterDetailsMap[key].count += footerDetailsMap[key].count;
1358
+ }
1359
+ else {
1360
+ combinedFooterDetailsMap[key] = footerDetailsMap[key];
1361
+ }
1362
+ }
1363
+ combinedChannelsMap[type].footerDetailsMap = combinedFooterDetailsMap;
1364
+ }
1365
+ sChannel.amount = (0, price_conversion_1.convertIntToDecimal)(sChannel.amount);
1366
+ subChannels.push(sChannel);
1367
+ }
1368
+ channel.subChannels = subChannels;
1369
+ topLevelChannels.push(channel);
1370
+ }
1371
+ const netWithoutGst = netSale - totalGst;
1372
+ const itemSales = salesData.totalItemSales;
1373
+ const amountCollected = netSale - unpaidAmount;
1374
+ const channelData = {
1375
+ ...subtitles,
1376
+ _id: staffId,
1377
+ title: salesData.vendor_name,
1378
+ netSale: (0, price_conversion_1.convertIntToDecimal)(netSale),
1379
+ netWithoutGst: (0, price_conversion_1.convertIntToDecimal)(netWithoutGst),
1380
+ itemSales: (0, price_conversion_1.convertIntToDecimal)(itemSales),
1381
+ amountCollected: (0, price_conversion_1.convertIntToDecimal)(amountCollected),
1382
+ unpaidAmount: (0, price_conversion_1.convertIntToDecimal)(unpaidAmount),
1383
+ totalOrders,
1384
+ unpaidOrders,
1385
+ channels: topLevelChannels,
1386
+ };
1387
+ combinedData.netSale += channelData.netSale;
1388
+ combinedData.netWithoutGst += channelData.netWithoutGst;
1389
+ combinedData.totalOrders += channelData.totalOrders;
1390
+ combinedData.unpaidOrders += channelData.unpaidOrders;
1391
+ combinedData.unpaidAmount += channelData.unpaidAmount;
1392
+ combinedData.amountCollected += channelData.amountCollected;
1393
+ combinedData.itemSales += channelData.itemSales;
1394
+ vendorWiseData.push(channelData);
1395
+ }
1396
+ const usableVendorWiseData = vendorWiseData
1397
+ .map((d) => ({
1398
+ ...d,
1399
+ channels: getSortedUsableChannels(d.channels),
1400
+ }))
1401
+ .sort((a, b) => b.netSale - a.netSale);
1402
+ const combinedChannels = Object.values(combinedChannelsMap).map((c) => {
1403
+ const subChannels = Object.values(c.subChannels).map((sc) => ({
1404
+ ...sc,
1405
+ amount: (0, price_conversion_1.convertIntToDecimal)(sc.amount),
1406
+ }));
1407
+ return {
1408
+ ...c,
1409
+ subChannels,
1410
+ };
1411
+ });
1412
+ const usableCombinedData = {
1413
+ ...subtitles,
1414
+ _id: combinedData._id,
1415
+ title: combinedData.title,
1416
+ channels: getSortedUsableChannels(combinedChannels),
1417
+ netSale: (0, common_1.parseNum)(combinedData.netSale),
1418
+ netWithoutGst: (0, common_1.parseNum)(combinedData.netWithoutGst),
1419
+ totalOrders: (0, common_1.parseNum)(combinedData.totalOrders),
1420
+ unpaidOrders: (0, common_1.parseNum)(combinedData.unpaidOrders),
1421
+ unpaidAmount: (0, common_1.parseNum)(combinedData.unpaidAmount),
1422
+ amountCollected: (0, common_1.parseNum)(combinedData.amountCollected),
1423
+ itemSales: (0, common_1.parseNum)(combinedData.itemSales),
1424
+ };
1425
+ return {
1426
+ vendorWiseData: usableVendorWiseData,
1427
+ combinedData: usableCombinedData,
1428
+ };
1429
+ };
1430
+ const getWarehousePurchaseOrderXReportData = (data, currencySymbol, countryAlpha2) => {
1431
+ const gstName = (0, common_1.getGSTName)(countryAlpha2);
1432
+ const netWithoutGstSubtitle = `excl. ${gstName}`;
1433
+ const subtitles = {
1434
+ netWithoutGstSubtitle,
1435
+ };
1436
+ const vendorWiseData = generateVendorWiseData(data, currencySymbol, gstName);
1437
+ const usableData = getUsableData(vendorWiseData, subtitles);
1438
+ return usableData;
1439
+ };
1440
+ exports.getWarehousePurchaseOrderXReportData = getWarehousePurchaseOrderXReportData;