@managesome/eposmatic-toolkit 0.3.7 → 0.3.9

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