@managesome/eposmatic-toolkit 0.3.8 → 0.3.10

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 (437) 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/types/api-types.d.ts +37 -0
  437. package/package.json +6 -3
@@ -0,0 +1,1850 @@
1
+ import moment from 'moment';
2
+ import { ALL_ORDER_STATUS_NAMES, ALL_PAYMENT_TYPE_NAMES, ALL_PLATFORMS, ORDER_STATUS_ENUM, PAYMENT_TYPE_ENUM, X_REPORT_TYPE_ENUM, } from '../../constants';
3
+ import { getGSTName, localeAmount, parseNum, sentenceCase } from './common';
4
+ import { convertPriceFromCents } 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: -24px;
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: 24px;
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: 40px;
158
+ display: flex;
159
+ -webkit-box-align: center;
160
+ align-items: center;
161
+ -webkit-box-pack: center;
162
+ justify-content: center;
163
+ padding: 10px;
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.25rem;
178
+ font-size: 1.25rem;
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.25rem;
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: 4px 10px;
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: 4px 10px;
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: 4px 10px;
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: 4px 10px;
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: 4px 10px;
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
+ width: 8px !important;
783
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
784
+ }
785
+
786
+ .cssc-lpyf3z-kjlask {
787
+ font-size: 17px !important;
788
+ line-height: 19px !important;
789
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
790
+ }
791
+
792
+ .cssc-16f6p1q-kjlask {
793
+ border-width: 1px !important;
794
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
795
+ }
796
+
797
+ .cssc-1qek100-kjlask {
798
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
799
+ }
800
+
801
+ .cssc-rorn0c-lkask {
802
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
803
+ }
804
+
805
+ .cssc-1m6vi3w-posi {
806
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
807
+ }
808
+
809
+ .cssc-15wwp11-qwem {
810
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
811
+ }
812
+
813
+ .cssc-ho2sf9-sanbv {
814
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
815
+ }
816
+
817
+ .cssc-apqrd9-skjas {
818
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
819
+ }
820
+
821
+ .cssc-1qrvgoi-sanbv {
822
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
823
+ }
824
+
825
+ .cssc-kkegnv-sanbv {
826
+ font-family: "Roboto Condensed", Roboto, sans-serif !important;
827
+ }
828
+ `
829
+ : ''}
830
+ </style>
831
+ <title>Printer Receipt</title>
832
+ </head>`;
833
+ };
834
+ function getBody({ staffWiseData, combinedData, currency_symbol, from, to, tenantName, monochrome, isFilterApplied, }) {
835
+ // ======================>>>><<<<=====================
836
+ let mainBodyElements = ``;
837
+ const fillMainBody = (staffData, index) => {
838
+ let mainBodyFooterElements = `<div class="cssc-gmwslw-kjlask">
839
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Total Orders</p>
840
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${staffData.totalOrders}</p>
841
+ </div>`;
842
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
843
+ <div class="cssc-gmwslw-kjlask">
844
+ <div class="cssc-lpyf3z-kjlask">
845
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Item Sales</h6>
846
+ <span class="cssc-1ebo3gf-oilkj">${staffData.itemSalesSubtitle}</span>
847
+ </div>
848
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${localeAmount(currency_symbol, staffData.itemSales)}</p>
849
+ </div>`;
850
+ if (staffData.grossSale > 0 && staffData.grossSale !== staffData.netSale) {
851
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
852
+ <div class="cssc-gmwslw-kjlask">
853
+ <div class="cssc-lpyf3z-kjlask">
854
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Gross Revenue</h6>
855
+ <span class="cssc-1ebo3gf-oilkj">${staffData.grossSaleSubtitle}</span>
856
+ </div>
857
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${localeAmount(currency_symbol, staffData.grossSale)}</p>
858
+ </div>`;
859
+ }
860
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
861
+ <div class="cssc-gmwslw-kjlask">
862
+ <div class="cssc-lpyf3z-kjlask">
863
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Net Sale</h6>
864
+ <span class="cssc-1ebo3gf-oilkj">${staffData.netSaleSubtitle}</span>
865
+ </div>
866
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #008000'}">${localeAmount(currency_symbol, staffData.netSale)}</p>
867
+ </div>`;
868
+ if (staffData.unpaidOrders > 0) {
869
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
870
+ <div class="cssc-gmwslw-kjlask">
871
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Amount Collected</h6>
872
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #FF6D00'}">${localeAmount(currency_symbol, staffData.amountCollected)}</p>
873
+ </div>`;
874
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
875
+ <div class="cssc-gmwslw-kjlask">
876
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">${staffData.unpaidOrders} Unpaid</h6>
877
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #FF0000'}">${localeAmount(currency_symbol, staffData.unpaidAmount)}</p>
878
+ </div>`;
879
+ }
880
+ if (staffData.netWithoutServiceFee > 0 && staffData.netWithoutServiceFee !== staffData.netSale) {
881
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
882
+ <div class="cssc-gmwslw-kjlask">
883
+ <div class="cssc-lpyf3z-kjlask">
884
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Net Sale (Other)</h6>
885
+ <span class="cssc-1ebo3gf-oilkj">${staffData.netWithoutServiceFeeSubtitle}</span>
886
+ </div>
887
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${localeAmount(currency_symbol, staffData.netWithoutServiceFee)}</p>
888
+ </div>`;
889
+ }
890
+ if (staffData.netWithoutGst > 0 && staffData.netWithoutGst !== staffData.netSale) {
891
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
892
+ <div class="cssc-gmwslw-kjlask">
893
+ <div class="cssc-lpyf3z-kjlask">
894
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Net Sale (Other)</h6>
895
+ <span class="cssc-1ebo3gf-oilkj">${staffData.netWithoutGstSubtitle}</span>
896
+ </div>
897
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${localeAmount(currency_symbol, staffData.netWithoutGst)}</p>
898
+ </div>`;
899
+ }
900
+ // ======================>>>><<<<=====================
901
+ let mainBodyTableElements = ``;
902
+ staffData.channels.forEach((channel) => {
903
+ mainBodyTableElements += `<tr class="cssc-1qrvgoi-sanbv">
904
+ <td class="cssc-gnx8yv-ssaaw" colspan="3">
905
+ <h6 class="cssc-1b7x1hq-oilkj">
906
+ ${channel.title}
907
+ </h6>
908
+ </td>
909
+ </tr>`;
910
+ channel.subChannels.forEach((subChannel) => {
911
+ mainBodyTableElements += `<tr class="cssc-kkegnv-sanbv">
912
+ <th class="cssc-1d7qqp0-ssaaw" scope="row">
913
+ <p class="cssc-1ebo3of-oilkj"
914
+ ${subChannel.bold ? `style="font-weight: bold; text-decoration: underline"` : ''}
915
+ >
916
+ ${subChannel.title}
917
+ </p>
918
+ </th>
919
+
920
+ <td class="cssc-up54xb-ssaaw" align="right">
921
+ <p class="cssc-1iy4zoj-oilkj"
922
+ ${subChannel.bold ? `style="font-weight: bold; text-decoration: underline"` : ''}
923
+ >${subChannel.count}</p>
924
+ </td>
925
+
926
+ <td class="cssc-v53jtm-ssaaw" align="right">
927
+ <p class="cssc-1iy4zoj-oilkj"
928
+ ${subChannel.strikeThrough
929
+ ? `style="text-decoration: line-through"`
930
+ : subChannel.bold
931
+ ? `style="font-weight: bold; text-decoration: underline"`
932
+ : ''}
933
+ >${localeAmount(currency_symbol, subChannel.amount)}</p>
934
+ </td>
935
+ </tr>`;
936
+ });
937
+ channel.footerDetails.forEach((row) => {
938
+ mainBodyTableElements += `<tr class="cssc-kkegnv-sanbv">
939
+ <th class="cssc-1d7qqp0-ssaaw" scope="row">
940
+ <div class="cssc-1pm8m44-kjlask" >
941
+ <div class="cssc-1ebo3of-gaplas"></div>
942
+ <span class="cssc-1ebo3of-oilkj" style="font-weight: normal">
943
+ ${row.title}
944
+ </span>
945
+ </div>
946
+ </th>
947
+
948
+ <td class="cssc-up54xb-ssaaw" align="right">
949
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: normal">${row.count}</p>
950
+ </td>
951
+
952
+ <td class="cssc-v53jtm-ssaaw" align="right">
953
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: normal">${localeAmount(currency_symbol, row.amount)}</p>
954
+ </td>
955
+ </tr>`;
956
+ });
957
+ });
958
+ // ======================>>>><<<<=====================
959
+ let mainBodyDivider = '';
960
+ if (monochrome && index > 0) {
961
+ mainBodyDivider = `<hr style="height: 3px; color: #000000; background-color: #000000; border: none;" />`;
962
+ }
963
+ mainBodyElements += `<div class="cssc-1owvoyj-kjhgs">
964
+ <div class="cssc-cjhduv-kjhgs">
965
+ ${mainBodyDivider}
966
+ <div class="cssc-1qek100-kjlask">
967
+ <div class="cssc-lpyf3a-skks">
968
+ <h5 class="cssc-1gb95rg-oilkj">${staffData.title}</h5>
969
+ </div>
970
+
971
+ <div class="cssc-rorn0c-lkask">
972
+ <table class="cssc-1m6vi3w-posi">
973
+ <thead class="cssc-15wwp11-qwem">
974
+ <tr class="cssc-ho2sf9-sanbv">
975
+ <th class="cssc-idkl0b-ssaaw" scope="col">
976
+ <h6 class="cssc-rq2z2r-oilkj">
977
+ Description
978
+ </h6>
979
+ </th>
980
+
981
+ <th class="cssc-1ymm2he-ssaaw" scope="col" align="right">
982
+ </th>
983
+
984
+ <th class="cssc-eyhmry-ssaaw" scope="col" align="right">
985
+ <h6 class="cssc-rq2z2r-oilkj" style="text-align: right">Amount</h6>
986
+ </th>
987
+ </tr>
988
+ </thead>
989
+
990
+ <tbody class="cssc-apqrd9-skjas">
991
+ ${mainBodyTableElements}
992
+ </tbody>
993
+ </table>
994
+ </div>
995
+
996
+ <div class="cssc-1ho5x3sk-kjlask">
997
+ <div class="cssc-1ho5x3p-kjlask">
998
+ ${mainBodyFooterElements}
999
+ </div>
1000
+ </div>
1001
+ </div>
1002
+ </div>
1003
+ </div>`;
1004
+ };
1005
+ staffWiseData.forEach(fillMainBody);
1006
+ if (combinedData != null && staffWiseData.length > 1) {
1007
+ fillMainBody(combinedData, staffWiseData.length);
1008
+ }
1009
+ return `<div class="cssc-1flmrcm-kjlask">
1010
+ <div class="cssc-1qeq10-kjlask">
1011
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">X Report</h5>
1012
+ <p class="cssc-1iy4zoj-oilkj">${moment(from).format('dddd')} ${moment(from).format('MMM DD, YYYY')}</p>
1013
+ <p class="cssc-1ebo3of-oilkj">${moment(from).format('h:mm a, MMM DD')} - ${moment(to).format('h:mm a, MMM DD')}</p>
1014
+ </div>
1015
+
1016
+ <div class="cssc-16f6p1q-kjlask">
1017
+ ${mainBodyElements}
1018
+ </div>
1019
+
1020
+ <div class="cssc-1qeq10-kjlask" style="margin-top: 20px;">
1021
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">${tenantName ?? ''}</h5>
1022
+ <p class="cssc-1iy4zoj-oilkj">
1023
+ Exported on ${moment().format('dddd')} ${moment().format('MMM DD, YYYY')} at ${moment().format('h:mm a')}
1024
+ </p>
1025
+ ${isFilterApplied
1026
+ ? `<p class="cssc-1iy4zoj-oilkj"
1027
+ style="text-align: center; font-weight: bold; ${monochrome ? 'color: #000000' : 'color: #FF0000'}"
1028
+ >
1029
+ Note: This report is filtered. Please ensure to tally the data on your end.
1030
+ </p>`
1031
+ : ''}
1032
+ </div>
1033
+ </div>`;
1034
+ }
1035
+ /*
1036
+
1037
+ <div style="display: flex; justify-content: center; margin-top: 20px">
1038
+ <img
1039
+ src="https://firebasestorage.googleapis.com/v0/b/prod-managesome.appspot.com/o/platforms%2Feposmatic%2FSIDEBAR_LOGO_LIGHT_THEME.svg?alt=media&token=b8933e6c-f559-41f8-b5b8-215b0a2a3d29"
1040
+ height="30px"
1041
+ />
1042
+ </div>
1043
+ */
1044
+ export function getXReportHtml({ width, monochrome, staffWiseData, combinedData, currency_symbol, from, to, tenantName, isFilterApplied, }) {
1045
+ const style = width ? `style=width: ${width}px; max-width: ${width}px` : '';
1046
+ const html = `
1047
+ <html lang="en" ${style}>
1048
+ ${getHead(monochrome)}
1049
+ <body translate="no"
1050
+ ${style}
1051
+ >
1052
+ ${getBody({
1053
+ staffWiseData,
1054
+ combinedData,
1055
+ currency_symbol,
1056
+ from,
1057
+ to,
1058
+ tenantName,
1059
+ monochrome,
1060
+ isFilterApplied,
1061
+ })}
1062
+ </body>
1063
+ </html>`;
1064
+ return html;
1065
+ }
1066
+ // ======================>>>><<<<=====================
1067
+ const uniqueTypes = [X_REPORT_TYPE_ENUM.COVERS];
1068
+ const TOTAL_REF = 'TOTAL';
1069
+ const ITEM_DISCOUNTS_REF = 'ITEM_DISCOUNTS';
1070
+ const CUSTOMER_ID = 'by_customers';
1071
+ const getSortedUsableChannels = (channels) => {
1072
+ const usableChannels = [];
1073
+ for (let i = 0; i < channels.length; i++) {
1074
+ const c = channels[i];
1075
+ const footerDetailsMap = c.footerDetailsMap;
1076
+ const channel = {
1077
+ _id: c._id,
1078
+ title: c.title,
1079
+ ref: c.ref,
1080
+ sortIndex: c.sortIndex,
1081
+ subChannels: c.subChannels,
1082
+ footerDetails: Object.values(footerDetailsMap)
1083
+ .map((fd) => ({
1084
+ ...fd,
1085
+ amount: convertPriceFromCents(fd.amount),
1086
+ }))
1087
+ .sort((a, b) => a.sortIndex - b.sortIndex),
1088
+ };
1089
+ const subChannels = channel.subChannels;
1090
+ subChannels
1091
+ .sort((a, b) => (a.ref > b.ref ? 1 : -1))
1092
+ .forEach((sc, index) => {
1093
+ sc.sortIndex = index;
1094
+ });
1095
+ for (let j = 0; j < subChannels.length; j++) {
1096
+ const subChannel = subChannels[j];
1097
+ if (subChannel.ref === TOTAL_REF) {
1098
+ if (uniqueTypes.includes(channel.ref)) {
1099
+ // We will remove this subchannel
1100
+ channel.subChannels.splice(j, 1);
1101
+ }
1102
+ subChannel.sortIndex = 100000;
1103
+ subChannel.bold = true;
1104
+ }
1105
+ else if (channel.ref === X_REPORT_TYPE_ENUM.SALES_BY_PLATFORM) {
1106
+ const platform = subChannel.ref;
1107
+ let sortIndex = ALL_PLATFORMS.indexOf(platform);
1108
+ if (sortIndex === -1) {
1109
+ sortIndex = 200 + j;
1110
+ }
1111
+ subChannel.sortIndex = sortIndex;
1112
+ }
1113
+ else if (channel.ref === X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES) {
1114
+ const paymentType = subChannel.ref;
1115
+ let sortIndex = ALL_PAYMENT_TYPE_NAMES.indexOf(paymentType);
1116
+ if (sortIndex === -1) {
1117
+ sortIndex = 200 + j;
1118
+ }
1119
+ subChannel.sortIndex = sortIndex;
1120
+ if (paymentType === PAYMENT_TYPE_ENUM.COMPLIMENTARY) {
1121
+ const totalIndex = channel.subChannels.findIndex((sc) => sc.ref === TOTAL_REF);
1122
+ if (totalIndex !== -1) {
1123
+ const totalAmount = channel.subChannels[totalIndex].amount;
1124
+ channel.subChannels[totalIndex].amount = parseNum(totalAmount - subChannel.amount);
1125
+ }
1126
+ subChannel.strikeThrough = true;
1127
+ }
1128
+ }
1129
+ else if (channel.ref === X_REPORT_TYPE_ENUM.ORDER_STATUS) {
1130
+ const status = subChannel.ref;
1131
+ let sortIndex = ALL_ORDER_STATUS_NAMES.indexOf(status);
1132
+ if (sortIndex === -1) {
1133
+ sortIndex = 200 + j;
1134
+ }
1135
+ if (status === ORDER_STATUS_ENUM.CANCELLED) {
1136
+ const totalIndex = channel.subChannels.findIndex((sc) => sc.ref === TOTAL_REF);
1137
+ if (totalIndex !== -1) {
1138
+ const totalAmount = channel.subChannels[totalIndex].amount;
1139
+ channel.subChannels[totalIndex].amount = parseNum(totalAmount - subChannel.amount);
1140
+ }
1141
+ subChannel.strikeThrough = true;
1142
+ }
1143
+ subChannel.sortIndex = sortIndex;
1144
+ }
1145
+ }
1146
+ usableChannels.push(channel);
1147
+ }
1148
+ const sortedChannels = usableChannels
1149
+ .map((channel) => ({
1150
+ ...channel,
1151
+ subChannels: channel.subChannels.sort((a, b) => a.sortIndex - b.sortIndex),
1152
+ }))
1153
+ .sort((a, b) => a.sortIndex - b.sortIndex);
1154
+ return sortedChannels;
1155
+ };
1156
+ const generateStaffWiseData = (data, currencySymbol, gstName) => {
1157
+ const staffWiseDataMap = {};
1158
+ const saffWiseTotalSalesMap = {};
1159
+ const staffNamesMap = {};
1160
+ data[X_REPORT_TYPE_ENUM.TOTAL_SALES].forEach((item) => {
1161
+ const staffName = item.staff_name ?? 'By Customers';
1162
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1163
+ saffWiseTotalSalesMap[staffId] = item;
1164
+ staffNamesMap[staffId] = staffName;
1165
+ });
1166
+ // ==========>>><<<==========
1167
+ data[X_REPORT_TYPE_ENUM.SALES_BY_PLATFORM].forEach((item) => {
1168
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1169
+ const staffName = staffNamesMap[staffId];
1170
+ if (staffName != null) {
1171
+ const amount = item.grossAmount;
1172
+ const obj = {
1173
+ _id: staffId,
1174
+ ref: item.platform,
1175
+ title: 'Platform Sales',
1176
+ description: sentenceCase(item.platform.replace(/_/g, ' ')),
1177
+ type: X_REPORT_TYPE_ENUM.SALES_BY_PLATFORM,
1178
+ staff_name: staffName,
1179
+ count: item.count,
1180
+ amount,
1181
+ sortIndex: 1,
1182
+ };
1183
+ if (staffWiseDataMap[staffId] != null) {
1184
+ staffWiseDataMap[staffId].push(obj);
1185
+ }
1186
+ else {
1187
+ staffWiseDataMap[staffId] = [obj];
1188
+ }
1189
+ }
1190
+ });
1191
+ data[X_REPORT_TYPE_ENUM.ORDER_STATUS].forEach((item) => {
1192
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1193
+ const staffName = staffNamesMap[staffId];
1194
+ if (staffName != null) {
1195
+ const amount = item.grossAmount;
1196
+ const obj = {
1197
+ _id: staffId,
1198
+ ref: item.status,
1199
+ type: X_REPORT_TYPE_ENUM.ORDER_STATUS,
1200
+ staff_name: staffName,
1201
+ title: 'Order Status',
1202
+ description: sentenceCase(item.status.replace(/_/g, ' ')),
1203
+ count: item.count,
1204
+ amount,
1205
+ sortIndex: 2,
1206
+ };
1207
+ if (staffWiseDataMap[staffId] != null) {
1208
+ staffWiseDataMap[staffId].push(obj);
1209
+ }
1210
+ else {
1211
+ staffWiseDataMap[staffId] = [obj];
1212
+ }
1213
+ }
1214
+ });
1215
+ const discountFooterData = {};
1216
+ data[X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES].forEach((item) => {
1217
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1218
+ const staffName = staffNamesMap[staffId];
1219
+ if (staffName != null) {
1220
+ const amount = item.grossAmount;
1221
+ const obj = {
1222
+ _id: staffId,
1223
+ ref: item.payment_type,
1224
+ type: X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES,
1225
+ staff_name: staffName,
1226
+ title: 'Payments',
1227
+ description: sentenceCase(item.payment_type.replace(/_/g, ' ')),
1228
+ count: item.count,
1229
+ amount,
1230
+ sortIndex: 3,
1231
+ };
1232
+ if (staffWiseDataMap[staffId] != null) {
1233
+ staffWiseDataMap[staffId].push(obj);
1234
+ }
1235
+ else {
1236
+ staffWiseDataMap[staffId] = [obj];
1237
+ }
1238
+ if (discountFooterData[staffId] == null) {
1239
+ discountFooterData[staffId] = {};
1240
+ }
1241
+ if (discountFooterData[staffId][item.payment_type] != null) {
1242
+ discountFooterData[staffId][item.payment_type].amount += item.totalDiscountAmount;
1243
+ discountFooterData[staffId][item.payment_type].count += item.totalDiscountCount;
1244
+ }
1245
+ else if (item.totalDiscountAmount > 0) {
1246
+ discountFooterData[staffId][item.payment_type] = {
1247
+ amount: item.totalDiscountAmount,
1248
+ count: item.totalDiscountCount,
1249
+ sortIndex: 0,
1250
+ title: sentenceCase(item.payment_type.replace(/_/g, ' ')),
1251
+ };
1252
+ }
1253
+ }
1254
+ });
1255
+ const orderDiscountsMap = {};
1256
+ data[X_REPORT_TYPE_ENUM.ORDER_DISCOUNT].forEach((item) => {
1257
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1258
+ const staffName = staffNamesMap[staffId];
1259
+ if (staffName != null) {
1260
+ const amount = item.grossAmount;
1261
+ const discount = convertPriceFromCents(item.discount);
1262
+ const description = item.is_discount_percentage ? `${discount}%` : localeAmount(currencySymbol, discount);
1263
+ const obj = {
1264
+ _id: staffId,
1265
+ ref: description,
1266
+ type: X_REPORT_TYPE_ENUM.ORDER_DISCOUNT,
1267
+ staff_name: staffName,
1268
+ title: 'Discounts',
1269
+ description,
1270
+ count: item.count,
1271
+ amount,
1272
+ sortIndex: 4,
1273
+ };
1274
+ if (staffWiseDataMap[staffId] != null) {
1275
+ if (orderDiscountsMap[staffId] == null) {
1276
+ orderDiscountsMap[staffId] = {
1277
+ count: 0,
1278
+ amount: 0,
1279
+ };
1280
+ }
1281
+ orderDiscountsMap[staffId].count = (orderDiscountsMap[staffId]?.count ?? 0) + item.count;
1282
+ orderDiscountsMap[staffId].amount = (orderDiscountsMap[staffId]?.amount ?? 0) + amount;
1283
+ staffWiseDataMap[staffId].push(obj);
1284
+ }
1285
+ else {
1286
+ orderDiscountsMap[staffId] = {
1287
+ count: item.count,
1288
+ amount,
1289
+ };
1290
+ staffWiseDataMap[staffId] = [obj];
1291
+ }
1292
+ }
1293
+ });
1294
+ data[X_REPORT_TYPE_ENUM.TOTAL_DISCOUNT].forEach((item) => {
1295
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1296
+ const staffName = staffNamesMap[staffId];
1297
+ if (staffName != null) {
1298
+ const staffDiscounts = orderDiscountsMap[staffId] ?? {
1299
+ count: 0,
1300
+ amount: 0,
1301
+ };
1302
+ const count = item.count - staffDiscounts.count;
1303
+ const amount = item.grossAmount - staffDiscounts.amount;
1304
+ if (amount > 0) {
1305
+ const obj = {
1306
+ _id: staffId,
1307
+ ref: ITEM_DISCOUNTS_REF,
1308
+ type: X_REPORT_TYPE_ENUM.ORDER_DISCOUNT,
1309
+ staff_name: staffName,
1310
+ title: 'Discounts',
1311
+ description: 'Item Discounts',
1312
+ count: count || item.count,
1313
+ amount,
1314
+ sortIndex: 5,
1315
+ };
1316
+ if (staffWiseDataMap[staffId] != null) {
1317
+ staffWiseDataMap[staffId].push(obj);
1318
+ }
1319
+ else {
1320
+ staffWiseDataMap[staffId] = [obj];
1321
+ }
1322
+ }
1323
+ }
1324
+ });
1325
+ data[X_REPORT_TYPE_ENUM.TIP].forEach((item) => {
1326
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1327
+ const staffName = staffNamesMap[staffId];
1328
+ if (staffName != null) {
1329
+ const amount = item.grossAmount;
1330
+ const obj = {
1331
+ _id: staffId,
1332
+ ref: item.tip_amount,
1333
+ type: X_REPORT_TYPE_ENUM.TIP,
1334
+ staff_name: staffName,
1335
+ title: 'Tips',
1336
+ description: localeAmount(currencySymbol, convertPriceFromCents(item.tip_amount)),
1337
+ count: item.count,
1338
+ amount,
1339
+ sortIndex: 6,
1340
+ };
1341
+ if (staffWiseDataMap[staffId] != null) {
1342
+ staffWiseDataMap[staffId].push(obj);
1343
+ }
1344
+ else {
1345
+ staffWiseDataMap[staffId] = [obj];
1346
+ }
1347
+ }
1348
+ });
1349
+ data[X_REPORT_TYPE_ENUM.SERVICE_CHARGE].forEach((item) => {
1350
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1351
+ const staffName = staffNamesMap[staffId];
1352
+ if (staffName != null) {
1353
+ const service_fee = convertPriceFromCents(item.service_fee);
1354
+ const amount = item.grossAmount;
1355
+ const description = item.is_service_fee_percentage
1356
+ ? `${service_fee}%`
1357
+ : localeAmount(currencySymbol, service_fee);
1358
+ const obj = {
1359
+ _id: staffId,
1360
+ ref: description,
1361
+ type: X_REPORT_TYPE_ENUM.SERVICE_CHARGE,
1362
+ staff_name: staffName,
1363
+ title: 'Service Charges',
1364
+ description,
1365
+ count: item.count,
1366
+ amount,
1367
+ sortIndex: 7,
1368
+ };
1369
+ if (staffWiseDataMap[staffId] != null) {
1370
+ staffWiseDataMap[staffId].push(obj);
1371
+ }
1372
+ else {
1373
+ staffWiseDataMap[staffId] = [obj];
1374
+ }
1375
+ }
1376
+ });
1377
+ data[X_REPORT_TYPE_ENUM.DELIVERY_CHARGE].forEach((item) => {
1378
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1379
+ const staffName = staffNamesMap[staffId];
1380
+ if (staffName != null) {
1381
+ const delivery_cost = convertPriceFromCents(item.delivery_cost);
1382
+ const amount = item.grossAmount;
1383
+ const description = localeAmount(currencySymbol, delivery_cost);
1384
+ const obj = {
1385
+ _id: staffId,
1386
+ ref: description,
1387
+ type: X_REPORT_TYPE_ENUM.DELIVERY_CHARGE,
1388
+ staff_name: staffName,
1389
+ title: 'Delivery Charges',
1390
+ description,
1391
+ count: item.count,
1392
+ amount,
1393
+ sortIndex: 8,
1394
+ };
1395
+ if (staffWiseDataMap[staffId] != null) {
1396
+ staffWiseDataMap[staffId].push(obj);
1397
+ }
1398
+ else {
1399
+ staffWiseDataMap[staffId] = [obj];
1400
+ }
1401
+ }
1402
+ });
1403
+ data[X_REPORT_TYPE_ENUM.SURCHARGE].forEach((item) => {
1404
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1405
+ const staffName = staffNamesMap[staffId];
1406
+ if (staffName != null) {
1407
+ const surcharge = convertPriceFromCents(item.surcharge);
1408
+ const amount = item.grossAmount;
1409
+ const description = item.is_surcharge_percentage ? `${surcharge}%` : localeAmount(currencySymbol, surcharge);
1410
+ const obj = {
1411
+ _id: staffId,
1412
+ ref: description,
1413
+ type: X_REPORT_TYPE_ENUM.SURCHARGE,
1414
+ staff_name: staffName,
1415
+ title: 'Surcharge',
1416
+ description,
1417
+ count: item.count,
1418
+ amount,
1419
+ sortIndex: 9,
1420
+ };
1421
+ if (staffWiseDataMap[staffId] != null) {
1422
+ staffWiseDataMap[staffId].push(obj);
1423
+ }
1424
+ else {
1425
+ staffWiseDataMap[staffId] = [obj];
1426
+ }
1427
+ }
1428
+ });
1429
+ data[X_REPORT_TYPE_ENUM.GST].forEach((item) => {
1430
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1431
+ const staffName = staffNamesMap[staffId];
1432
+ if (staffName != null) {
1433
+ const gst = convertPriceFromCents(item.gst);
1434
+ const amount = item.grossAmount;
1435
+ const obj = {
1436
+ _id: staffId,
1437
+ ref: gst,
1438
+ type: X_REPORT_TYPE_ENUM.GST,
1439
+ staff_name: staffName,
1440
+ title: gstName,
1441
+ description: `${gst}%`,
1442
+ count: item.count,
1443
+ amount,
1444
+ sortIndex: 10,
1445
+ };
1446
+ if (staffWiseDataMap[staffId] != null) {
1447
+ staffWiseDataMap[staffId].push(obj);
1448
+ }
1449
+ else {
1450
+ staffWiseDataMap[staffId] = [obj];
1451
+ }
1452
+ }
1453
+ });
1454
+ data[X_REPORT_TYPE_ENUM.TAX_AMOUNT].forEach((item) => {
1455
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1456
+ const staffName = staffNamesMap[staffId];
1457
+ if (staffName != null) {
1458
+ const taxAmount = convertPriceFromCents(item.grossAmount);
1459
+ const amount = item.grossAmount;
1460
+ const obj = {
1461
+ _id: staffId,
1462
+ ref: taxAmount,
1463
+ type: X_REPORT_TYPE_ENUM.TAX_AMOUNT,
1464
+ staff_name: staffName,
1465
+ title: 'Item Tax',
1466
+ description: localeAmount(currencySymbol, taxAmount),
1467
+ count: item.count,
1468
+ amount,
1469
+ sortIndex: 11,
1470
+ };
1471
+ if (staffWiseDataMap[staffId] != null) {
1472
+ staffWiseDataMap[staffId].push(obj);
1473
+ }
1474
+ else {
1475
+ staffWiseDataMap[staffId] = [obj];
1476
+ }
1477
+ }
1478
+ });
1479
+ data[X_REPORT_TYPE_ENUM.COVERS].forEach((item) => {
1480
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1481
+ const staffName = staffNamesMap[staffId];
1482
+ if (staffName != null) {
1483
+ const amount = item.grossAmount;
1484
+ const obj = {
1485
+ _id: staffId,
1486
+ ref: item.covers,
1487
+ type: X_REPORT_TYPE_ENUM.COVERS,
1488
+ staff_name: staffName,
1489
+ title: 'Covers',
1490
+ description: item.covers,
1491
+ count: item.count,
1492
+ amount,
1493
+ sortIndex: 12,
1494
+ };
1495
+ if (staffWiseDataMap[staffId] != null) {
1496
+ staffWiseDataMap[staffId].push(obj);
1497
+ }
1498
+ else {
1499
+ staffWiseDataMap[staffId] = [obj];
1500
+ }
1501
+ }
1502
+ });
1503
+ const staffWiseDataFooterDetailsMap = {};
1504
+ if (Object.keys(discountFooterData).length > 0) {
1505
+ for (const staffId in discountFooterData) {
1506
+ let details = discountFooterData[staffId];
1507
+ if (Object.keys(details).length === 0) {
1508
+ continue;
1509
+ }
1510
+ if (staffWiseDataFooterDetailsMap[staffId] == null) {
1511
+ staffWiseDataFooterDetailsMap[staffId] = {};
1512
+ }
1513
+ details = structuredClone(details);
1514
+ let index = 0;
1515
+ for (const type in details) {
1516
+ let sortIndex = ALL_PAYMENT_TYPE_NAMES.indexOf(type);
1517
+ if (sortIndex === -1) {
1518
+ sortIndex = 200 + index;
1519
+ }
1520
+ details[type].sortIndex = sortIndex;
1521
+ index++;
1522
+ }
1523
+ staffWiseDataFooterDetailsMap[staffId][X_REPORT_TYPE_ENUM.ORDER_DISCOUNT] = details;
1524
+ }
1525
+ }
1526
+ return {
1527
+ staffWiseDataMap,
1528
+ saffWiseTotalSalesMap,
1529
+ staffWiseDataFooterDetailsMap,
1530
+ };
1531
+ };
1532
+ const getUsableData = (data, subtitles) => {
1533
+ const defaultCombinedData = {
1534
+ _id: 'combined',
1535
+ title: 'Combined Report',
1536
+ netSale: 0,
1537
+ grossSale: 0,
1538
+ netWithoutGst: 0,
1539
+ totalOrders: 0,
1540
+ unpaidOrders: 0,
1541
+ unpaidAmount: 0,
1542
+ itemSales: 0,
1543
+ netWithoutServiceFee: 0,
1544
+ taxInvoiceProviderCharges: 0,
1545
+ amountCollected: 0,
1546
+ channels: [],
1547
+ ...subtitles,
1548
+ };
1549
+ const { staffWiseDataMap, saffWiseTotalSalesMap, staffWiseDataFooterDetailsMap } = data;
1550
+ const staffWiseData = [];
1551
+ const combinedData = {
1552
+ ...defaultCombinedData,
1553
+ };
1554
+ const combinedChannelsMap = {};
1555
+ const uniqueCombinedDataMap = {};
1556
+ for (const staffId in staffWiseDataMap) {
1557
+ const salesData = saffWiseTotalSalesMap[staffId];
1558
+ if (!salesData)
1559
+ continue;
1560
+ const staffData = staffWiseDataMap[staffId];
1561
+ const similarTypes = {};
1562
+ for (let i = 0; i < staffData.length; i++) {
1563
+ const d = staffData[i];
1564
+ if (similarTypes[d.type] != null) {
1565
+ similarTypes[d.type].push(d);
1566
+ }
1567
+ else {
1568
+ similarTypes[d.type] = [d];
1569
+ }
1570
+ }
1571
+ const totalOrders = salesData.count;
1572
+ let netSale = salesData.grossAmount;
1573
+ let totalDiscounts = 0;
1574
+ let totalGst = 0;
1575
+ let unpaidOrders = 0;
1576
+ let unpaidAmount = 0;
1577
+ let totalServiceFee = 0;
1578
+ let totalDeliveryCharges = 0;
1579
+ for (const type in similarTypes) {
1580
+ const firstData = similarTypes[type][0];
1581
+ if (!firstData)
1582
+ continue;
1583
+ const combinedData = similarTypes[type].reduce((acc, d) => {
1584
+ acc.count += d.count;
1585
+ acc.amount += d.amount;
1586
+ return acc;
1587
+ }, {
1588
+ count: 0,
1589
+ amount: 0,
1590
+ });
1591
+ similarTypes[type].push({
1592
+ _id: `${firstData._id}-${TOTAL_REF}`,
1593
+ ref: TOTAL_REF,
1594
+ type: firstData.type,
1595
+ staff_name: firstData.staff_name,
1596
+ title: firstData.title,
1597
+ description: 'Total',
1598
+ count: combinedData.count,
1599
+ amount: combinedData.amount,
1600
+ sortIndex: 100000,
1601
+ });
1602
+ }
1603
+ const topLevelChannels = [];
1604
+ for (const type in similarTypes) {
1605
+ // We will use it for 3rd layer
1606
+ const staffWiseDataArr = similarTypes[type];
1607
+ const firstData = staffWiseDataArr[0];
1608
+ const footerDetailsMap = structuredClone(staffWiseDataFooterDetailsMap[staffId]?.[type] ?? {});
1609
+ // Second Layer ==> Type
1610
+ const channel = {
1611
+ _id: `${firstData._id}-${firstData.type}`,
1612
+ ref: firstData.type,
1613
+ title: firstData.title,
1614
+ subChannels: [],
1615
+ sortIndex: firstData.sortIndex,
1616
+ footerDetailsMap,
1617
+ };
1618
+ // We will use it for 3rd layer
1619
+ const subChannels = [];
1620
+ for (let j = 0; j < staffWiseDataArr.length; j++) {
1621
+ const d = staffWiseDataArr[j];
1622
+ if (d.type === X_REPORT_TYPE_ENUM.GST && d.ref !== TOTAL_REF) {
1623
+ totalGst += d.amount;
1624
+ }
1625
+ else if (d.type === X_REPORT_TYPE_ENUM.ORDER_DISCOUNT && d.ref !== TOTAL_REF) {
1626
+ totalDiscounts += d.amount;
1627
+ // if (d.ref === ITEM_DISCOUNTS_REF) {
1628
+ // totalItemDiscounts += d.amount;
1629
+ // }
1630
+ }
1631
+ else if (d.type === X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES && d.ref !== TOTAL_REF) {
1632
+ if (String(d.description).toUpperCase() === PAYMENT_TYPE_ENUM.UNPAID) {
1633
+ unpaidOrders += d.count;
1634
+ unpaidAmount += d.amount;
1635
+ }
1636
+ else if (String(d.description).toUpperCase() === PAYMENT_TYPE_ENUM.COMPLIMENTARY) {
1637
+ netSale -= d.amount;
1638
+ }
1639
+ }
1640
+ else if (d.type === X_REPORT_TYPE_ENUM.SERVICE_CHARGE && d.ref !== TOTAL_REF) {
1641
+ totalServiceFee += d.amount;
1642
+ }
1643
+ else if (d.type === X_REPORT_TYPE_ENUM.DELIVERY_CHARGE && d.ref !== TOTAL_REF) {
1644
+ totalDeliveryCharges += d.amount;
1645
+ }
1646
+ const sChannel = {
1647
+ _id: `${d._id}-${d.ref}`,
1648
+ ref: d.ref,
1649
+ title: typeof d.description === 'string' ? d.description : `${d.description} ${sentenceCase(d.type)}`,
1650
+ count: d.count,
1651
+ amount: d.amount,
1652
+ sortIndex: j,
1653
+ };
1654
+ if (uniqueTypes.includes(type)) {
1655
+ if (uniqueCombinedDataMap[type] != null) {
1656
+ if (typeof d.description === 'number') {
1657
+ uniqueCombinedDataMap[type].subChannel.num += d.description;
1658
+ uniqueCombinedDataMap[type].subChannel.count += d.count;
1659
+ uniqueCombinedDataMap[type].subChannel.amount += d.amount;
1660
+ }
1661
+ }
1662
+ else {
1663
+ if (typeof d.description === 'number') {
1664
+ uniqueCombinedDataMap[type] = {
1665
+ _id: `${d._id}-${d.type}`,
1666
+ ref: d.type,
1667
+ title: d.title,
1668
+ sortIndex: d.sortIndex,
1669
+ footerDetailsMap: {},
1670
+ subChannel: {
1671
+ _id: `${d._id}-${d.ref}`,
1672
+ ref: d.ref,
1673
+ num: d.description,
1674
+ count: d.count,
1675
+ amount: d.amount,
1676
+ },
1677
+ };
1678
+ }
1679
+ }
1680
+ if (j === 0) {
1681
+ const combinedFooterDetailsMap = structuredClone(uniqueCombinedDataMap[type].footerDetailsMap ?? {});
1682
+ for (const key in footerDetailsMap) {
1683
+ if (combinedFooterDetailsMap[key] != null) {
1684
+ combinedFooterDetailsMap[key].amount += footerDetailsMap[key].amount;
1685
+ combinedFooterDetailsMap[key].count += footerDetailsMap[key].count;
1686
+ }
1687
+ else {
1688
+ combinedFooterDetailsMap[key] = footerDetailsMap[key];
1689
+ }
1690
+ }
1691
+ uniqueCombinedDataMap[type].footerDetailsMap = combinedFooterDetailsMap;
1692
+ }
1693
+ }
1694
+ else {
1695
+ if (combinedChannelsMap[type] != null) {
1696
+ if (combinedChannelsMap[type].subChannels[d.ref] != null) {
1697
+ combinedChannelsMap[type].subChannels[d.ref].amount += d.amount;
1698
+ combinedChannelsMap[type].subChannels[d.ref].count += d.count;
1699
+ }
1700
+ else {
1701
+ combinedChannelsMap[type].subChannels[d.ref] = {
1702
+ ...sChannel,
1703
+ sortIndex: j,
1704
+ };
1705
+ }
1706
+ }
1707
+ else {
1708
+ combinedChannelsMap[type] = {
1709
+ _id: `${d._id}-${d.type}`,
1710
+ ref: d.type,
1711
+ title: d.title,
1712
+ sortIndex: d.sortIndex,
1713
+ footerDetailsMap: {},
1714
+ subChannels: {
1715
+ [d.ref]: {
1716
+ ...sChannel,
1717
+ sortIndex: j,
1718
+ },
1719
+ },
1720
+ };
1721
+ }
1722
+ if (j === 0) {
1723
+ const combinedFooterDetailsMap = structuredClone(combinedChannelsMap[type].footerDetailsMap ?? {});
1724
+ for (const key in footerDetailsMap) {
1725
+ if (combinedFooterDetailsMap[key] != null) {
1726
+ combinedFooterDetailsMap[key].amount += footerDetailsMap[key].amount;
1727
+ combinedFooterDetailsMap[key].count += footerDetailsMap[key].count;
1728
+ }
1729
+ else {
1730
+ combinedFooterDetailsMap[key] = footerDetailsMap[key];
1731
+ }
1732
+ }
1733
+ combinedChannelsMap[type].footerDetailsMap = combinedFooterDetailsMap;
1734
+ }
1735
+ }
1736
+ sChannel.amount = convertPriceFromCents(sChannel.amount);
1737
+ subChannels.push(sChannel);
1738
+ }
1739
+ // ==================>>><<<==================
1740
+ channel.subChannels = subChannels;
1741
+ topLevelChannels.push(channel);
1742
+ }
1743
+ const grossSale = salesData.grossAmount + totalDiscounts;
1744
+ const netWithoutServiceFee = netSale - totalServiceFee - totalDeliveryCharges;
1745
+ const netWithoutGst = netWithoutServiceFee - totalGst;
1746
+ const itemSales = salesData.totalItemSales - totalDiscounts;
1747
+ const amountCollected = netSale - unpaidAmount;
1748
+ // First Layer ==> Staff
1749
+ const channelData = {
1750
+ ...subtitles,
1751
+ _id: staffId,
1752
+ title: salesData.staff_name ?? '',
1753
+ grossSale: convertPriceFromCents(grossSale),
1754
+ netSale: convertPriceFromCents(netSale),
1755
+ unpaidAmount: convertPriceFromCents(unpaidAmount),
1756
+ netWithoutGst: convertPriceFromCents(netWithoutGst),
1757
+ itemSales: convertPriceFromCents(itemSales),
1758
+ netWithoutServiceFee: convertPriceFromCents(netWithoutServiceFee),
1759
+ taxInvoiceProviderCharges: convertPriceFromCents(salesData.totalTaxInvoiceProviderCharges),
1760
+ amountCollected: convertPriceFromCents(amountCollected),
1761
+ totalOrders,
1762
+ unpaidOrders,
1763
+ channels: topLevelChannels,
1764
+ };
1765
+ combinedData.grossSale += channelData.grossSale;
1766
+ combinedData.netSale += channelData.netSale;
1767
+ combinedData.amountCollected += channelData.amountCollected;
1768
+ combinedData.netWithoutGst += channelData.netWithoutGst;
1769
+ combinedData.totalOrders += channelData.totalOrders;
1770
+ combinedData.unpaidOrders += channelData.unpaidOrders;
1771
+ combinedData.unpaidAmount += channelData.unpaidAmount;
1772
+ combinedData.itemSales += channelData.itemSales;
1773
+ combinedData.netWithoutServiceFee += channelData.netWithoutServiceFee;
1774
+ combinedData.taxInvoiceProviderCharges += channelData.taxInvoiceProviderCharges;
1775
+ staffWiseData.push(channelData);
1776
+ }
1777
+ const usableStaffWiseData = staffWiseData
1778
+ .map((d) => ({
1779
+ ...d,
1780
+ channels: getSortedUsableChannels(d.channels),
1781
+ }))
1782
+ .sort((a, b) => b.netSale - a.netSale);
1783
+ Object.values(uniqueCombinedDataMap).forEach((d) => {
1784
+ combinedChannelsMap[d._id] = {
1785
+ _id: d._id,
1786
+ ref: d.ref,
1787
+ title: d.title,
1788
+ subChannels: {
1789
+ [d.subChannel.ref]: {
1790
+ _id: d.subChannel._id,
1791
+ ref: d.subChannel.ref,
1792
+ title: `${d.subChannel.num} ${sentenceCase(d.title)}`,
1793
+ count: d.subChannel.count,
1794
+ amount: d.subChannel.amount,
1795
+ sortIndex: 0,
1796
+ },
1797
+ },
1798
+ sortIndex: d.sortIndex,
1799
+ footerDetailsMap: d.footerDetailsMap,
1800
+ };
1801
+ });
1802
+ const combinedChannels = Object.values(combinedChannelsMap).map((c) => {
1803
+ const subChannels = Object.values(c.subChannels).map((sc) => ({
1804
+ ...sc,
1805
+ amount: convertPriceFromCents(sc.amount),
1806
+ }));
1807
+ return {
1808
+ ...c,
1809
+ subChannels,
1810
+ };
1811
+ });
1812
+ const usableCombinedData = {
1813
+ ...subtitles,
1814
+ _id: combinedData._id,
1815
+ title: combinedData.title,
1816
+ channels: getSortedUsableChannels(combinedChannels),
1817
+ grossSale: parseNum(combinedData.grossSale),
1818
+ netSale: parseNum(combinedData.netSale),
1819
+ netWithoutGst: parseNum(combinedData.netWithoutGst),
1820
+ totalOrders: parseNum(combinedData.totalOrders),
1821
+ unpaidAmount: parseNum(combinedData.unpaidAmount),
1822
+ unpaidOrders: parseNum(combinedData.unpaidOrders),
1823
+ itemSales: parseNum(combinedData.itemSales),
1824
+ netWithoutServiceFee: parseNum(combinedData.netWithoutServiceFee),
1825
+ taxInvoiceProviderCharges: parseNum(combinedData.taxInvoiceProviderCharges),
1826
+ amountCollected: parseNum(combinedData.amountCollected),
1827
+ };
1828
+ return {
1829
+ staffWiseData: usableStaffWiseData,
1830
+ combinedData: usableCombinedData,
1831
+ };
1832
+ };
1833
+ export const getXReportData = (data, currencySymbol, countryAlpha2, taxInvoiceProvider) => {
1834
+ const gstName = getGSTName(countryAlpha2, taxInvoiceProvider);
1835
+ const itemSalesSubtitle = 'Items Amount - Discounts';
1836
+ const grossSaleSubtitle = 'incl. Discounts, Complimentary';
1837
+ const netSaleSubtitle = 'excl. Discounts, Complimentary';
1838
+ const netWithoutServiceFeeSubtitle = 'excl. Service Charges, Delivery Charges, Discounts, Complimentary';
1839
+ const netWithoutGstSubtitle = `excl. ${gstName}, Service Charges, Delivery Charges, Discounts, Complimentary`;
1840
+ const subtitles = {
1841
+ itemSalesSubtitle,
1842
+ grossSaleSubtitle,
1843
+ netSaleSubtitle,
1844
+ netWithoutServiceFeeSubtitle,
1845
+ netWithoutGstSubtitle,
1846
+ };
1847
+ const staffWiseData = generateStaffWiseData(data, currencySymbol, gstName);
1848
+ const usableData = getUsableData(staffWiseData, subtitles);
1849
+ return usableData;
1850
+ };