@managesome/eposmatic-toolkit 0.2.430 → 0.2.432

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 (173) hide show
  1. package/lib/constants/ENUMS.d.ts +3 -285
  2. package/lib/constants/ENUMS.js +7 -387
  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/index.d.ts +1 -0
  11. package/lib/constants/index.js +1 -0
  12. package/lib/helpers/order/generate-purchase-order-rfq.d.ts +3 -3
  13. package/lib/helpers/order/generate-purchase-order-rfq.js +2 -2
  14. package/lib/helpers/order/generate-purchase-order.d.ts +8 -8
  15. package/lib/helpers/order/generate-purchase-order.js +2 -2
  16. package/lib/helpers/order/generate-warehouse-purchase-order-rfq.d.ts +3 -0
  17. package/lib/helpers/order/generate-warehouse-purchase-order-rfq.js +64 -0
  18. package/lib/helpers/order/generate-warehouse-purchase-order.d.ts +11 -0
  19. package/lib/helpers/order/generate-warehouse-purchase-order.js +196 -0
  20. package/lib/helpers/order/index.d.ts +2 -2
  21. package/lib/helpers/order/index.js +2 -2
  22. package/lib/helpers/store/all-purchase-orders-actions.d.ts +7 -7
  23. package/lib/helpers/store/all-purchase-orders-actions.js +2 -2
  24. package/lib/helpers/store/all-sale-orders-actions.d.ts +2 -2
  25. package/lib/helpers/store/all-warehouse-purchase-orders-actions.d.ts +13 -0
  26. package/lib/helpers/store/all-warehouse-purchase-orders-actions.js +56 -0
  27. package/lib/helpers/store/all-warehouse-sale-orders-actions.d.ts +2 -0
  28. package/lib/helpers/store/all-warehouse-sale-orders-actions.js +8 -0
  29. package/lib/helpers/store/common-purchase-order-actions.d.ts +15 -15
  30. package/lib/helpers/store/common-sale-order-actions.d.ts +5 -5
  31. package/lib/helpers/store/common-warehouse-purchase-order-actions.d.ts +31 -0
  32. package/lib/helpers/store/common-warehouse-purchase-order-actions.js +545 -0
  33. package/lib/helpers/store/common-warehouse-sale-order-actions.d.ts +5 -0
  34. package/lib/helpers/store/common-warehouse-sale-order-actions.js +65 -0
  35. package/lib/helpers/store/index.d.ts +6 -6
  36. package/lib/helpers/store/index.js +6 -6
  37. package/lib/helpers/store/purchase-order-rfq-cart-actions.d.ts +11 -11
  38. package/lib/helpers/store/purchase-order-rfq-cart-actions.js +3 -3
  39. package/lib/helpers/store/purchase-orders-cart-actions.d.ts +18 -18
  40. package/lib/helpers/store/purchase-orders-cart-actions.js +1 -1
  41. package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.d.ts +19 -0
  42. package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +373 -0
  43. package/lib/helpers/store/warehouse-purchase-orders-cart-actions.d.ts +57 -0
  44. package/lib/helpers/store/warehouse-purchase-orders-cart-actions.js +486 -0
  45. package/lib/helpers/types/index.d.ts +1 -1
  46. package/lib/helpers/types/index.js +1 -1
  47. package/lib/helpers/types/purchase-order-cart-actions.d.ts +2 -2
  48. package/lib/helpers/types/warehouse-purchase-order-cart-actions.d.ts +26 -0
  49. package/lib/helpers/types/warehouse-purchase-order-cart-actions.js +2 -0
  50. package/lib/helpers/types/workers.d.ts +18 -18
  51. package/lib/helpers/utils/index.d.ts +8 -8
  52. package/lib/helpers/utils/index.js +8 -11
  53. package/lib/helpers/utils/inventory.js +6 -0
  54. package/lib/helpers/utils/invoice-x-report-helpers.d.ts +2 -2
  55. package/lib/helpers/utils/invoice-x-report-helpers.js +14 -14
  56. package/lib/helpers/utils/purchase-order-engine.d.ts +4 -4
  57. package/lib/helpers/utils/purchase-order-receipt-engine.d.ts +5 -5
  58. package/lib/helpers/utils/purchase-order-receipt-engine.js +2 -2
  59. package/lib/helpers/utils/purchase-order-x-report-helpers.js +2 -2
  60. package/lib/helpers/utils/sale-x-report-helpers.js +2 -2
  61. package/lib/helpers/utils/void-purchase-order-items-helpers.d.ts +3 -3
  62. package/lib/helpers/utils/void-purchase-order-items-report-helpers.d.ts +2 -2
  63. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.d.ts +3 -3
  64. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.js +2 -2
  65. package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.d.ts +5 -5
  66. package/lib/helpers/utils/warehouse-catalog-conversion.d.ts +3 -3
  67. package/lib/helpers/utils/warehouse-catalog-conversion.js +9 -7
  68. package/lib/helpers/utils/warehouse-inventory.js +9 -0
  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/inventories.d.ts +2 -0
  145. package/lib/schemas/types/inventory_lot_serial_numbers.d.ts +5 -5
  146. package/lib/schemas/types/warehouse-activity-logs.d.ts +7 -7
  147. package/lib/schemas/types/warehouse_categories.d.ts +2 -2
  148. package/lib/schemas/types/warehouse_internal_movements.d.ts +9 -9
  149. package/lib/schemas/types/warehouse_inventory_lot_serial_numbers.d.ts +85 -0
  150. package/lib/schemas/types/warehouse_inventory_lot_serial_numbers.js +4 -0
  151. package/lib/schemas/types/warehouse_items.d.ts +5 -2
  152. package/lib/schemas/types/warehouse_purchase_order_common.d.ts +39 -0
  153. package/lib/schemas/types/warehouse_purchase_order_common.js +2 -0
  154. package/lib/schemas/types/warehouse_purchase_order_receipts.d.ts +39 -0
  155. package/lib/schemas/types/warehouse_purchase_order_receipts.js +21 -0
  156. package/lib/schemas/types/warehouse_purchase_order_rfqs.d.ts +33 -0
  157. package/lib/schemas/types/warehouse_purchase_order_rfqs.js +2 -0
  158. package/lib/schemas/types/warehouse_purchase_order_vendor_returns.d.ts +48 -0
  159. package/lib/schemas/types/warehouse_purchase_order_vendor_returns.js +2 -0
  160. package/lib/schemas/types/warehouse_purchase_orders.d.ts +33 -0
  161. package/lib/schemas/types/warehouse_purchase_orders.js +2 -0
  162. package/lib/schemas/types/warehouse_sale_deliveries.d.ts +29 -29
  163. package/lib/schemas/types/warehouse_sale_invoices.d.ts +17 -17
  164. package/lib/schemas/types/warehouse_sale_order_common.d.ts +39 -0
  165. package/lib/schemas/types/warehouse_sale_order_common.js +2 -0
  166. package/lib/schemas/types/warehouse_sale_order_rfqs.d.ts +7 -7
  167. package/lib/schemas/types/warehouse_sale_orders.d.ts +7 -7
  168. package/lib/schemas/types/warehouse_void_invoice_items.d.ts +37 -0
  169. package/lib/schemas/types/warehouse_void_invoice_items.js +2 -0
  170. package/lib/schemas/types/warehouse_void_purchase_order_items.d.ts +37 -0
  171. package/lib/schemas/types/warehouse_void_purchase_order_items.js +2 -0
  172. package/lib/schemas/types/warehouses.d.ts +2 -2
  173. package/package.json +1 -1
@@ -0,0 +1,1456 @@
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.getWarehouseSaleXReportData = void 0;
7
+ exports.getWarehouseSaleXReportHtml = getWarehouseSaleXReportHtml;
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: 6px 16px;
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>Invoice X Report</title>
837
+ </head>`;
838
+ };
839
+ function getBody({ clientWiseData, 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
+ clientWiseData.forEach(fillMainBody);
982
+ if (combinedData != null && clientWiseData.length > 1) {
983
+ fillMainBody(combinedData, clientWiseData.length);
984
+ }
985
+ return `<div class="cssc-1flmrcm-kjlask">
986
+ <div class="cssc-1qeq10-kjlask">
987
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">Invoice 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 getWarehouseSaleXReportHtml({ width, monochrome, clientWiseData, 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
+ clientWiseData,
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 CLIENT_ID = 'by_client';
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_SALE_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
+ }
1074
+ else if (channel.ref === constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS) {
1075
+ const status = subChannel.ref;
1076
+ let sortIndex = constants_1.ALL_WAREHOUSE_SALES_ORDER_STATUS_NAMES.indexOf(status);
1077
+ if (sortIndex === -1) {
1078
+ sortIndex = 200 + j;
1079
+ }
1080
+ if (status === constants_1.WAREHOUSE_SALES_ORDER_STATUS_ENUM.CANCELLED) {
1081
+ const totalIndex = channel.subChannels.findIndex((sc) => sc.ref === TOTAL_REF);
1082
+ if (totalIndex !== -1) {
1083
+ const totalAmount = channel.subChannels[totalIndex].amount;
1084
+ channel.subChannels[totalIndex].amount = (0, common_1.parseNum)(totalAmount - subChannel.amount);
1085
+ }
1086
+ subChannel.strikeThrough = true;
1087
+ }
1088
+ subChannel.sortIndex = sortIndex;
1089
+ }
1090
+ else if (channel.ref === constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.STAFF) {
1091
+ // Clients are sorted by ref (client_id)
1092
+ subChannel.sortIndex = j;
1093
+ }
1094
+ }
1095
+ usableChannels.push(channel);
1096
+ }
1097
+ const sortedChannels = usableChannels
1098
+ .map((channel) => ({
1099
+ ...channel,
1100
+ subChannels: channel.subChannels.sort((a, b) => a.sortIndex - b.sortIndex),
1101
+ }))
1102
+ .sort((a, b) => a.sortIndex - b.sortIndex);
1103
+ return sortedChannels;
1104
+ };
1105
+ const generateClientWiseData = (data, currencySymbol, gstName) => {
1106
+ const clientWiseDataMap = {};
1107
+ const clientWiseTotalSalesMap = {};
1108
+ const clientNamesMap = {};
1109
+ data[constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_SALES].forEach((item) => {
1110
+ const clientName = item.client_name ?? 'By Client';
1111
+ const clientId = item.client_id ?? CLIENT_ID;
1112
+ clientWiseTotalSalesMap[clientId] = item;
1113
+ clientNamesMap[clientId] = clientName;
1114
+ });
1115
+ // ==========>>><<<==========
1116
+ data[constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.STAFF].forEach((item) => {
1117
+ const clientId = item.client_id ?? CLIENT_ID;
1118
+ const clientName = clientNamesMap[clientId];
1119
+ if (clientName != null) {
1120
+ const amount = item.grossAmount;
1121
+ const obj = {
1122
+ _id: clientId,
1123
+ ref: item.staff_id,
1124
+ title: 'Staff',
1125
+ description: item.staff_name,
1126
+ type: constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.STAFF,
1127
+ staff_name: clientName,
1128
+ count: item.count,
1129
+ amount,
1130
+ sortIndex: 1,
1131
+ };
1132
+ if (clientWiseDataMap[clientId] != null) {
1133
+ clientWiseDataMap[clientId].push(obj);
1134
+ }
1135
+ else {
1136
+ clientWiseDataMap[clientId] = [obj];
1137
+ }
1138
+ }
1139
+ });
1140
+ data[constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS].forEach((item) => {
1141
+ const clientId = item.client_id ?? CLIENT_ID;
1142
+ const clientName = clientNamesMap[clientId];
1143
+ if (clientName != null) {
1144
+ const amount = item.grossAmount;
1145
+ const obj = {
1146
+ _id: clientId,
1147
+ ref: item.status,
1148
+ type: constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS,
1149
+ staff_name: clientName,
1150
+ title: 'Order Status',
1151
+ description: (0, common_1.sentenceCase)(item.status.replace(/_/g, ' ')),
1152
+ count: item.count,
1153
+ amount,
1154
+ sortIndex: 2,
1155
+ };
1156
+ if (clientWiseDataMap[clientId] != null) {
1157
+ clientWiseDataMap[clientId].push(obj);
1158
+ }
1159
+ else {
1160
+ clientWiseDataMap[clientId] = [obj];
1161
+ }
1162
+ }
1163
+ });
1164
+ data[constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES].forEach((item) => {
1165
+ const clientId = item.client_id ?? CLIENT_ID;
1166
+ const clientName = clientNamesMap[clientId];
1167
+ if (clientName != null) {
1168
+ const amount = item.grossAmount;
1169
+ const obj = {
1170
+ _id: clientId,
1171
+ ref: item.payment_type,
1172
+ type: constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES,
1173
+ staff_name: clientName,
1174
+ title: 'Payments',
1175
+ description: (0, common_1.sentenceCase)(item.payment_type.replace(/_/g, ' ')),
1176
+ count: item.count,
1177
+ amount,
1178
+ sortIndex: 3,
1179
+ };
1180
+ if (clientWiseDataMap[clientId] != null) {
1181
+ clientWiseDataMap[clientId].push(obj);
1182
+ }
1183
+ else {
1184
+ clientWiseDataMap[clientId] = [obj];
1185
+ }
1186
+ }
1187
+ });
1188
+ data[constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.GST].forEach((item) => {
1189
+ const clientId = item.client_id ?? CLIENT_ID;
1190
+ const clientName = clientNamesMap[clientId];
1191
+ if (clientName != null) {
1192
+ // item.gst is stored in ×100000 units (like monetary amounts);
1193
+ // convert to a plain percentage for display.
1194
+ const gst = (0, price_conversion_1.convertIntToDecimal)(item.gst);
1195
+ const amount = item.grossAmount;
1196
+ const obj = {
1197
+ _id: clientId,
1198
+ ref: gst,
1199
+ type: constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.GST,
1200
+ staff_name: clientName,
1201
+ title: gstName,
1202
+ description: `${gst}%`,
1203
+ count: item.count,
1204
+ amount,
1205
+ sortIndex: 4,
1206
+ };
1207
+ if (clientWiseDataMap[clientId] != null) {
1208
+ clientWiseDataMap[clientId].push(obj);
1209
+ }
1210
+ else {
1211
+ clientWiseDataMap[clientId] = [obj];
1212
+ }
1213
+ }
1214
+ });
1215
+ const clientWiseDataFooterDetailsMap = {};
1216
+ return {
1217
+ clientWiseDataMap,
1218
+ clientWiseTotalSalesMap,
1219
+ clientWiseDataFooterDetailsMap,
1220
+ };
1221
+ };
1222
+ const getUsableData = (data, subtitles) => {
1223
+ const defaultCombinedData = {
1224
+ _id: 'combined',
1225
+ title: 'Combined Report',
1226
+ netSale: 0,
1227
+ netWithoutGst: 0,
1228
+ totalOrders: 0,
1229
+ unpaidOrders: 0,
1230
+ unpaidAmount: 0,
1231
+ amountCollected: 0,
1232
+ itemSales: 0,
1233
+ channels: [],
1234
+ ...subtitles,
1235
+ };
1236
+ const { clientWiseDataMap, clientWiseTotalSalesMap, clientWiseDataFooterDetailsMap } = data;
1237
+ const clientWiseData = [];
1238
+ const combinedData = {
1239
+ ...defaultCombinedData,
1240
+ };
1241
+ const combinedChannelsMap = {};
1242
+ for (const staffId in clientWiseDataMap) {
1243
+ const salesData = clientWiseTotalSalesMap[staffId];
1244
+ if (!salesData)
1245
+ continue;
1246
+ const staffData = clientWiseDataMap[staffId];
1247
+ const similarTypes = {};
1248
+ for (let i = 0; i < staffData.length; i++) {
1249
+ const d = staffData[i];
1250
+ if (similarTypes[d.type] != null) {
1251
+ similarTypes[d.type].push(d);
1252
+ }
1253
+ else {
1254
+ similarTypes[d.type] = [d];
1255
+ }
1256
+ }
1257
+ const totalOrders = salesData.count;
1258
+ let totalPaymentSalesAmount = 0;
1259
+ let totalGst = 0;
1260
+ let unpaidOrders = 0;
1261
+ let unpaidAmount = 0;
1262
+ for (const type in similarTypes) {
1263
+ const firstData = similarTypes[type][0];
1264
+ if (!firstData)
1265
+ continue;
1266
+ const combinedData = similarTypes[type].reduce((acc, d) => {
1267
+ acc.count += d.count;
1268
+ acc.amount += d.amount;
1269
+ return acc;
1270
+ }, {
1271
+ count: 0,
1272
+ amount: 0,
1273
+ });
1274
+ similarTypes[type].push({
1275
+ _id: `${firstData._id}-${TOTAL_REF}`,
1276
+ ref: TOTAL_REF,
1277
+ type: firstData.type,
1278
+ staff_name: firstData.staff_name,
1279
+ title: firstData.title,
1280
+ description: 'Total',
1281
+ count: combinedData.count,
1282
+ amount: combinedData.amount,
1283
+ sortIndex: 100000,
1284
+ });
1285
+ }
1286
+ const topLevelChannels = [];
1287
+ for (const type in similarTypes) {
1288
+ const clientWiseDataArr = similarTypes[type];
1289
+ const firstData = clientWiseDataArr[0];
1290
+ const footerDetailsMap = structuredClone(clientWiseDataFooterDetailsMap[staffId]?.[type] ?? {});
1291
+ const channel = {
1292
+ _id: `${firstData._id}-${firstData.type}`,
1293
+ ref: firstData.type,
1294
+ title: firstData.title,
1295
+ subChannels: [],
1296
+ sortIndex: firstData.sortIndex,
1297
+ footerDetailsMap,
1298
+ };
1299
+ const subChannels = [];
1300
+ for (let j = 0; j < clientWiseDataArr.length; j++) {
1301
+ const d = clientWiseDataArr[j];
1302
+ if (d.type === constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.GST && d.ref !== TOTAL_REF) {
1303
+ totalGst += d.amount;
1304
+ }
1305
+ else if (d.type === constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES && d.ref !== TOTAL_REF) {
1306
+ totalPaymentSalesAmount += d.amount;
1307
+ if (String(d.description).toUpperCase() === constants_1.PAYMENT_TYPE_ENUM.UNPAID) {
1308
+ unpaidOrders += d.count;
1309
+ unpaidAmount += d.amount;
1310
+ }
1311
+ }
1312
+ const sChannel = {
1313
+ _id: `${d._id}-${d.ref}`,
1314
+ ref: d.ref,
1315
+ title: typeof d.description === 'string' ? d.description : `${d.description} ${(0, common_1.sentenceCase)(d.type)}`,
1316
+ count: d.count,
1317
+ amount: d.amount,
1318
+ sortIndex: j,
1319
+ };
1320
+ if (combinedChannelsMap[type] != null) {
1321
+ if (combinedChannelsMap[type].subChannels[d.ref] != null) {
1322
+ combinedChannelsMap[type].subChannels[d.ref].amount += d.amount;
1323
+ combinedChannelsMap[type].subChannels[d.ref].count += d.count;
1324
+ }
1325
+ else {
1326
+ combinedChannelsMap[type].subChannels[d.ref] = {
1327
+ ...sChannel,
1328
+ sortIndex: j,
1329
+ };
1330
+ }
1331
+ }
1332
+ else {
1333
+ combinedChannelsMap[type] = {
1334
+ _id: `${d._id}-${d.type}`,
1335
+ ref: d.type,
1336
+ title: d.title,
1337
+ sortIndex: d.sortIndex,
1338
+ footerDetailsMap: {},
1339
+ subChannels: {
1340
+ [d.ref]: {
1341
+ ...sChannel,
1342
+ sortIndex: j,
1343
+ },
1344
+ },
1345
+ };
1346
+ }
1347
+ if (j === 0) {
1348
+ const combinedFooterDetailsMap = structuredClone(combinedChannelsMap[type].footerDetailsMap ?? {});
1349
+ for (const key in footerDetailsMap) {
1350
+ if (combinedFooterDetailsMap[key] != null) {
1351
+ combinedFooterDetailsMap[key].amount += footerDetailsMap[key].amount;
1352
+ combinedFooterDetailsMap[key].count += footerDetailsMap[key].count;
1353
+ }
1354
+ else {
1355
+ combinedFooterDetailsMap[key] = footerDetailsMap[key];
1356
+ }
1357
+ }
1358
+ combinedChannelsMap[type].footerDetailsMap = combinedFooterDetailsMap;
1359
+ }
1360
+ sChannel.amount = (0, price_conversion_1.convertIntToDecimal)(sChannel.amount);
1361
+ subChannels.push(sChannel);
1362
+ }
1363
+ channel.subChannels = subChannels;
1364
+ topLevelChannels.push(channel);
1365
+ }
1366
+ // Derive netSale from TOTAL_PAYMENT_SALES to keep it consistent with
1367
+ // GST data (both originate from the same invoice/payment scope).
1368
+ // Fall back to TOTAL_SALES grossAmount when no payment data exists.
1369
+ const netSale = totalPaymentSalesAmount || salesData.grossAmount;
1370
+ const itemSales = salesData.totalItemSales;
1371
+ const amountCollected = netSale - unpaidAmount;
1372
+ // GST is summed from invoice-level gst_amount which may include GST on
1373
+ // unpaid invoices. The synthetic UNPAID entry in TOTAL_PAYMENT_SALES may
1374
+ // not carry the same GST treatment, causing netWithoutGst to diverge.
1375
+ // Proportionally allocate GST to the collected portion so the displayed
1376
+ // "Net Revenue excl. Tax" reflects only GST on collected amounts.
1377
+ const collectedRatio = netSale > 0 ? Math.min(1, amountCollected / netSale) : 0;
1378
+ const netWithoutGst = netSale - totalGst * collectedRatio;
1379
+ // Scale down GST subchannel amounts proportionally so unpaid
1380
+ // invoices don't inflate the GST breakdown.
1381
+ if (collectedRatio < 1) {
1382
+ for (const ch of topLevelChannels) {
1383
+ if (ch.ref === constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.GST) {
1384
+ for (const sc of ch.subChannels) {
1385
+ sc.amount = (0, common_1.parseNum)(sc.amount * collectedRatio);
1386
+ }
1387
+ }
1388
+ }
1389
+ }
1390
+ const channelData = {
1391
+ ...subtitles,
1392
+ _id: staffId,
1393
+ title: salesData.client_name,
1394
+ netSale: (0, price_conversion_1.convertIntToDecimal)(netSale),
1395
+ netWithoutGst: (0, price_conversion_1.convertIntToDecimal)(netWithoutGst),
1396
+ itemSales: (0, price_conversion_1.convertIntToDecimal)(itemSales),
1397
+ amountCollected: (0, price_conversion_1.convertIntToDecimal)(amountCollected),
1398
+ unpaidAmount: (0, price_conversion_1.convertIntToDecimal)(unpaidAmount),
1399
+ totalOrders,
1400
+ unpaidOrders,
1401
+ channels: topLevelChannels,
1402
+ };
1403
+ combinedData.netSale += channelData.netSale;
1404
+ combinedData.netWithoutGst += channelData.netWithoutGst;
1405
+ combinedData.totalOrders += channelData.totalOrders;
1406
+ combinedData.unpaidOrders += channelData.unpaidOrders;
1407
+ combinedData.unpaidAmount += channelData.unpaidAmount;
1408
+ combinedData.amountCollected += channelData.amountCollected;
1409
+ combinedData.itemSales += channelData.itemSales;
1410
+ clientWiseData.push(channelData);
1411
+ }
1412
+ const usableClientWiseData = clientWiseData
1413
+ .map((d) => ({
1414
+ ...d,
1415
+ channels: getSortedUsableChannels(d.channels),
1416
+ }))
1417
+ .sort((a, b) => b.netSale - a.netSale);
1418
+ const combinedChannels = Object.values(combinedChannelsMap).map((c) => {
1419
+ const subChannels = Object.values(c.subChannels).map((sc) => ({
1420
+ ...sc,
1421
+ amount: (0, price_conversion_1.convertIntToDecimal)(sc.amount),
1422
+ }));
1423
+ return {
1424
+ ...c,
1425
+ subChannels,
1426
+ };
1427
+ });
1428
+ const usableCombinedData = {
1429
+ ...subtitles,
1430
+ _id: combinedData._id,
1431
+ title: combinedData.title,
1432
+ channels: getSortedUsableChannels(combinedChannels),
1433
+ netSale: (0, common_1.parseNum)(combinedData.netSale),
1434
+ netWithoutGst: (0, common_1.parseNum)(combinedData.netWithoutGst),
1435
+ totalOrders: (0, common_1.parseNum)(combinedData.totalOrders),
1436
+ unpaidOrders: (0, common_1.parseNum)(combinedData.unpaidOrders),
1437
+ unpaidAmount: (0, common_1.parseNum)(combinedData.unpaidAmount),
1438
+ amountCollected: (0, common_1.parseNum)(combinedData.amountCollected),
1439
+ itemSales: (0, common_1.parseNum)(combinedData.itemSales),
1440
+ };
1441
+ return {
1442
+ clientWiseData: usableClientWiseData,
1443
+ combinedData: usableCombinedData,
1444
+ };
1445
+ };
1446
+ const getWarehouseSaleXReportData = (data, currencySymbol, countryAlpha2) => {
1447
+ const gstName = (0, common_1.getGSTName)(countryAlpha2);
1448
+ const netWithoutGstSubtitle = `excl. ${gstName}`;
1449
+ const subtitles = {
1450
+ netWithoutGstSubtitle,
1451
+ };
1452
+ const clientWiseData = generateClientWiseData(data, currencySymbol, gstName);
1453
+ const usableData = getUsableData(clientWiseData, subtitles);
1454
+ return usableData;
1455
+ };
1456
+ exports.getWarehouseSaleXReportData = getWarehouseSaleXReportData;