@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,1590 @@
1
+ import moment from 'moment';
2
+ import { ALL_PAYMENT_TYPE_NAMES, ALL_PLATFORMS, PAYMENT_TYPE_ENUM, RIDERS_REPORT_TYPE_ENUM, } from '../../constants';
3
+ import { 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
+ 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>Printer Receipt</title>
830
+ </head>`;
831
+ };
832
+ function getBody({ staffWiseData, combinedData, currency_symbol, from, to, tenantName, monochrome, isFilterApplied, }) {
833
+ // ======================>>>><<<<=====================
834
+ let mainBodyElements = ``;
835
+ const fillMainBody = (staffData, index) => {
836
+ const totalDistanceDisplay = staffData.totalDistanceKm.toFixed(2);
837
+ const totalDeliveryChargesDisplay = localeAmount(currency_symbol, staffData.totalDeliveryCharges ?? 0);
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">Net Sale</h6>
846
+ <span class="cssc-1ebo3gf-oilkj">${staffData.netSaleSubtitle}</span>
847
+ </div>
848
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #008000'}">${localeAmount(currency_symbol, staffData.netSale)}</p>
849
+ </div>`;
850
+ if (staffData.unpaidOrders > 0) {
851
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
852
+ <div class="cssc-gmwslw-kjlask">
853
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Amount Collected</h6>
854
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #FF6D00'}">${localeAmount(currency_symbol, staffData.amountCollected)}</p>
855
+ </div>`;
856
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
857
+ <div class="cssc-gmwslw-kjlask">
858
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">${staffData.unpaidOrders} Unpaid</h6>
859
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap;${monochrome ? '' : 'color: #FF0000'}">${localeAmount(currency_symbol, staffData.unpaidAmount)}</p>
860
+ </div>`;
861
+ }
862
+ if (staffData.netWithoutDeliveryCharges > 0 && staffData.netWithoutDeliveryCharges !== staffData.netSale) {
863
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
864
+ <div class="cssc-gmwslw-kjlask">
865
+ <div class="cssc-lpyf3z-kjlask">
866
+ <h6 class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Net Sale (Other)</h6>
867
+ <span class="cssc-1ebo3gf-oilkj">${staffData.netWithoutDeliveryCharges}</span>
868
+ </div>
869
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${localeAmount(currency_symbol, staffData.netWithoutDeliveryCharges)}</p>
870
+ </div>`;
871
+ }
872
+ // Always show Total Distance (display 0.00 KM when absent)
873
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
874
+ <div class="cssc-gmwslw-kjlask">
875
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Total Distance</p>
876
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${totalDistanceDisplay} KM</p>
877
+ </div>`;
878
+ // Always show Total Delivery Charges (display formatted 0 when absent)
879
+ mainBodyFooterElements += `<hr class="cssc-1l6ueuj-sjaksl" />
880
+ <div class="cssc-gmwslw-kjlask">
881
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: 700">Total Delivery Charges</p>
882
+ <p class="cssc-13sv1r4-oilkj" style="white-space: nowrap">${totalDeliveryChargesDisplay}</p>
883
+ </div>`;
884
+ // ======================>>>><<<<=====================
885
+ let mainBodyTableElements = ``;
886
+ staffData.channels.forEach((channel) => {
887
+ mainBodyTableElements += `<tr class="cssc-1qrvgoi-sanbv">
888
+ <td class="cssc-gnx8yv-ssaaw" colspan="3">
889
+ <h6 class="cssc-1b7x1hq-oilkj">
890
+ ${channel.title}
891
+ </h6>
892
+ </td>
893
+ </tr>`;
894
+ channel.subChannels.forEach((subChannel) => {
895
+ mainBodyTableElements += `<tr class="cssc-kkegnv-sanbv">
896
+ <th class="cssc-1d7qqp0-ssaaw" scope="row">
897
+ <p class="cssc-1ebo3of-oilkj"
898
+ ${subChannel.bold ? `style="font-weight: bold; text-decoration: underline"` : ''}
899
+ >
900
+ ${subChannel.title}
901
+ </p>
902
+ </th>
903
+
904
+ <td class="cssc-up54xb-ssaaw" align="right">
905
+ <p class="cssc-1iy4zoj-oilkj"
906
+ ${subChannel.bold ? `style="font-weight: bold; text-decoration: underline"` : ''}
907
+ >${subChannel.count}</p>
908
+ </td>
909
+
910
+ <td class="cssc-v53jtm-ssaaw" align="right">
911
+ <div style="display:flex; flex-direction:row; justify-content:flex-end; align-items:center; gap:6px;">
912
+ ${subChannel.additionalInfo ? `<span class="cssc-1ebo3gf-oilkj">(${subChannel.additionalInfo})</span>` : ''}
913
+ <p class="cssc-1iy4zoj-oilkj"${subChannel.strikeThrough
914
+ ? ' style="text-decoration: line-through"'
915
+ : subChannel.bold
916
+ ? ' style="font-weight: bold; text-decoration: underline"'
917
+ : ''}>${localeAmount(currency_symbol, subChannel.amount)}</p>
918
+ </div>
919
+ </td>
920
+ </tr>`;
921
+ });
922
+ channel.footerDetails.forEach((row) => {
923
+ mainBodyTableElements += `<tr class="cssc-kkegnv-sanbv">
924
+ <th class="cssc-1d7qqp0-ssaaw" scope="row">
925
+ <div class="cssc-1pm8m44-kjlask" >
926
+ <div class="cssc-1ebo3of-gaplas"></div>
927
+ <span class="cssc-1ebo3of-oilkj" style="font-weight: normal">
928
+ ${row.title}
929
+ </span>
930
+ </div>
931
+ </th>
932
+
933
+ <td class="cssc-up54xb-ssaaw" align="right">
934
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: normal">${row.count}</p>
935
+ </td>
936
+
937
+ <td class="cssc-v53jtm-ssaaw" align="right">
938
+ <p class="cssc-1iy4zoj-oilkj" style="font-weight: normal">${localeAmount(currency_symbol, row.amount)}</p>
939
+ </td>
940
+ </tr>`;
941
+ });
942
+ });
943
+ // ======================>>>><<<<=====================
944
+ let mainBodyDivider = '';
945
+ if (monochrome && index > 0) {
946
+ mainBodyDivider = `<hr style="height: 3px; color: #000000; background-color: #000000; border: none;" />`;
947
+ }
948
+ mainBodyElements += `<div class="cssc-1owvoyj-kjhgs">
949
+ <div class="cssc-cjhduv-kjhgs">
950
+ ${mainBodyDivider}
951
+ <div class="cssc-1qek100-kjlask">
952
+ <div class="cssc-lpyf3a-skks">
953
+ <h5 class="cssc-1gb95rg-oilkj">${staffData.title}</h5>
954
+ </div>
955
+
956
+ <div class="cssc-rorn0c-lkask">
957
+ <table class="cssc-1m6vi3w-posi">
958
+ <thead class="cssc-15wwp11-qwem">
959
+ <tr class="cssc-ho2sf9-sanbv">
960
+ <th class="cssc-idkl0b-ssaaw" scope="col">
961
+ <h6 class="cssc-rq2z2r-oilkj">
962
+ Description
963
+ </h6>
964
+ </th>
965
+
966
+ <th class="cssc-1ymm2he-ssaaw" scope="col" align="right">
967
+ </th>
968
+
969
+ <th class="cssc-eyhmry-ssaaw" scope="col" align="right">
970
+ <h6 class="cssc-rq2z2r-oilkj" style="text-align: right">Amount</h6>
971
+ </th>
972
+ </tr>
973
+ </thead>
974
+
975
+ <tbody class="cssc-apqrd9-skjas">
976
+ ${mainBodyTableElements}
977
+ </tbody>
978
+ </table>
979
+ </div>
980
+
981
+ <div class="cssc-1ho5x3sk-kjlask">
982
+ <div class="cssc-1ho5x3p-kjlask">
983
+ ${mainBodyFooterElements}
984
+ </div>
985
+ </div>
986
+ </div>
987
+ </div>
988
+ </div>`;
989
+ };
990
+ staffWiseData.forEach(fillMainBody);
991
+ if (combinedData != null && staffWiseData.length > 1) {
992
+ fillMainBody(combinedData, staffWiseData.length);
993
+ }
994
+ return `<div class="cssc-1flmrcm-kjlask">
995
+ <div class="cssc-1qeq10-kjlask">
996
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">Riders Report</h5>
997
+ <p class="cssc-1iy4zoj-oilkj">${moment(from).format('dddd')} ${moment(from).format('MMM DD, YYYY')}</p>
998
+ <p class="cssc-1ebo3of-oilkj">${moment(from).format('h:mm a, MMM DD')} - ${moment(to).format('h:mm a, MMM DD')}</p>
999
+ </div>
1000
+
1001
+ <div class="cssc-16f6p1q-kjlask">
1002
+ ${mainBodyElements}
1003
+ </div>
1004
+
1005
+ <div class="cssc-1qeq10-kjlask" style="margin-top: 20px;">
1006
+ <h5 class="cssc-1gb95rg-oilkj" style="color: #000000">${tenantName ?? ''}</h5>
1007
+ <p class="cssc-1iy4zoj-oilkj">
1008
+ Exported on ${moment().format('dddd')} ${moment().format('MMM DD, YYYY')} at ${moment().format('h:mm a')}
1009
+ </p>
1010
+ ${isFilterApplied
1011
+ ? `<p class="cssc-1iy4zoj-oilkj"
1012
+ style="text-align: center; font-weight: bold; ${monochrome ? 'color: #000000' : 'color: #FF0000'}"
1013
+ >
1014
+ Note: This report is filtered. Please ensure to tally the data on your end.
1015
+ </p>`
1016
+ : ''}
1017
+ </div>
1018
+ </div>`;
1019
+ }
1020
+ /*
1021
+
1022
+ <div style="display: flex; justify-content: center; margin-top: 20px">
1023
+ <img
1024
+ 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"
1025
+ height="30px"
1026
+ />
1027
+ </div>
1028
+ */
1029
+ export function getRidersReportHtml({ width, monochrome, staffWiseData, combinedData, currency_symbol, from, to, tenantName, isFilterApplied, }) {
1030
+ const style = width ? `style=width: ${width}px; max-width: ${width}px` : '';
1031
+ const html = `
1032
+ <html lang="en" ${style}>
1033
+ ${getHead(monochrome)}
1034
+ <body translate="no"
1035
+ ${style}
1036
+ >
1037
+ ${getBody({
1038
+ staffWiseData,
1039
+ combinedData,
1040
+ currency_symbol,
1041
+ from,
1042
+ to,
1043
+ tenantName,
1044
+ monochrome,
1045
+ isFilterApplied,
1046
+ })}
1047
+ </body>
1048
+ </html>`;
1049
+ return html;
1050
+ }
1051
+ // ======================>>>><<<<=====================
1052
+ const uniqueTypes = [];
1053
+ const TOTAL_REF = 'TOTAL';
1054
+ const CUSTOMER_ID = 'by_customers';
1055
+ const getSortedUsableChannels = (channels) => {
1056
+ const usableChannels = [];
1057
+ for (let i = 0; i < channels.length; i++) {
1058
+ const c = channels[i];
1059
+ const footerDetailsMap = c.footerDetailsMap;
1060
+ const channel = {
1061
+ _id: c._id,
1062
+ title: c.title,
1063
+ ref: c.ref,
1064
+ sortIndex: c.sortIndex,
1065
+ subChannels: c.subChannels,
1066
+ footerDetails: Object.values(footerDetailsMap)
1067
+ .map((fd) => ({
1068
+ ...fd,
1069
+ amount: convertPriceFromCents(fd.amount),
1070
+ }))
1071
+ .sort((a, b) => a.sortIndex - b.sortIndex),
1072
+ };
1073
+ const subChannels = channel.subChannels;
1074
+ subChannels
1075
+ .sort((a, b) => (a.ref > b.ref ? 1 : -1))
1076
+ .forEach((sc, index) => {
1077
+ sc.sortIndex = index;
1078
+ });
1079
+ for (let j = 0; j < subChannels.length; j++) {
1080
+ const subChannel = subChannels[j];
1081
+ if (subChannel.ref === TOTAL_REF) {
1082
+ if (uniqueTypes.includes(channel.ref)) {
1083
+ // We will remove this subchannel
1084
+ channel.subChannels.splice(j, 1);
1085
+ }
1086
+ subChannel.sortIndex = 100000;
1087
+ subChannel.bold = true;
1088
+ }
1089
+ else if (channel.ref === RIDERS_REPORT_TYPE_ENUM.SALES_BY_PLATFORM) {
1090
+ const platform = subChannel.ref;
1091
+ let sortIndex = ALL_PLATFORMS.indexOf(platform);
1092
+ if (sortIndex === -1) {
1093
+ sortIndex = 200 + j;
1094
+ }
1095
+ subChannel.sortIndex = sortIndex;
1096
+ }
1097
+ else if (channel.ref === RIDERS_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES) {
1098
+ const paymentType = subChannel.ref;
1099
+ let sortIndex = ALL_PAYMENT_TYPE_NAMES.indexOf(paymentType);
1100
+ if (sortIndex === -1) {
1101
+ sortIndex = 200 + j;
1102
+ }
1103
+ subChannel.sortIndex = sortIndex;
1104
+ if (paymentType === PAYMENT_TYPE_ENUM.COMPLIMENTARY) {
1105
+ const totalIndex = channel.subChannels.findIndex((sc) => sc.ref === TOTAL_REF);
1106
+ if (totalIndex !== -1) {
1107
+ const totalAmount = channel.subChannels[totalIndex].amount;
1108
+ channel.subChannels[totalIndex].amount = parseNum(totalAmount - subChannel.amount);
1109
+ }
1110
+ subChannel.strikeThrough = true;
1111
+ }
1112
+ }
1113
+ }
1114
+ usableChannels.push(channel);
1115
+ }
1116
+ const sortedChannels = usableChannels
1117
+ .map((channel) => ({
1118
+ ...channel,
1119
+ subChannels: channel.subChannels.sort((a, b) => a.sortIndex - b.sortIndex),
1120
+ }))
1121
+ .sort((a, b) => a.sortIndex - b.sortIndex);
1122
+ return sortedChannels;
1123
+ };
1124
+ const generateStaffWiseData = (data, currencySymbol) => {
1125
+ const staffWiseDataMap = {};
1126
+ const saffWiseTotalSalesMap = {};
1127
+ const staffNamesMap = {};
1128
+ data[RIDERS_REPORT_TYPE_ENUM.TOTAL_SALES].forEach((item) => {
1129
+ const staffName = item.staff_name ?? 'By Customers';
1130
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1131
+ saffWiseTotalSalesMap[staffId] = item;
1132
+ staffNamesMap[staffId] = staffName;
1133
+ });
1134
+ // ==========>>><<<==========
1135
+ data[RIDERS_REPORT_TYPE_ENUM.SALES_BY_PLATFORM].forEach((item) => {
1136
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1137
+ const staffName = staffNamesMap[staffId];
1138
+ if (staffName != null) {
1139
+ const amount = item.grossAmount;
1140
+ const obj = {
1141
+ _id: staffId,
1142
+ ref: item.platform,
1143
+ title: 'Platform Sales',
1144
+ description: sentenceCase(item.platform.replace(/_/g, ' ')),
1145
+ type: RIDERS_REPORT_TYPE_ENUM.SALES_BY_PLATFORM,
1146
+ staff_name: staffName,
1147
+ count: item.count,
1148
+ amount,
1149
+ sortIndex: 1,
1150
+ };
1151
+ if (staffWiseDataMap[staffId] != null) {
1152
+ staffWiseDataMap[staffId].push(obj);
1153
+ }
1154
+ else {
1155
+ staffWiseDataMap[staffId] = [obj];
1156
+ }
1157
+ }
1158
+ });
1159
+ const discountFooterData = {};
1160
+ data[RIDERS_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES].forEach((item) => {
1161
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1162
+ const staffName = staffNamesMap[staffId];
1163
+ if (staffName != null) {
1164
+ const amount = item.grossAmount;
1165
+ const obj = {
1166
+ _id: staffId,
1167
+ ref: item.payment_type,
1168
+ type: RIDERS_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES,
1169
+ staff_name: staffName,
1170
+ title: 'Payments',
1171
+ description: sentenceCase(item.payment_type.replace(/_/g, ' ')),
1172
+ count: item.count,
1173
+ amount,
1174
+ sortIndex: 3,
1175
+ };
1176
+ if (staffWiseDataMap[staffId] != null) {
1177
+ staffWiseDataMap[staffId].push(obj);
1178
+ }
1179
+ else {
1180
+ staffWiseDataMap[staffId] = [obj];
1181
+ }
1182
+ if (discountFooterData[staffId] == null) {
1183
+ discountFooterData[staffId] = {};
1184
+ }
1185
+ if (discountFooterData[staffId][item.payment_type] != null) {
1186
+ discountFooterData[staffId][item.payment_type].amount += item.totalDiscountAmount;
1187
+ discountFooterData[staffId][item.payment_type].count += item.totalDiscountCount;
1188
+ }
1189
+ else if (item.totalDiscountAmount > 0) {
1190
+ discountFooterData[staffId][item.payment_type] = {
1191
+ amount: item.totalDiscountAmount,
1192
+ count: item.totalDiscountCount,
1193
+ sortIndex: 0,
1194
+ title: sentenceCase(item.payment_type.replace(/_/g, ' ')),
1195
+ };
1196
+ }
1197
+ }
1198
+ });
1199
+ data[RIDERS_REPORT_TYPE_ENUM.TIP].forEach((item) => {
1200
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1201
+ const staffName = staffNamesMap[staffId];
1202
+ if (staffName != null) {
1203
+ const amount = item.grossAmount;
1204
+ const obj = {
1205
+ _id: staffId,
1206
+ ref: item.tip_amount,
1207
+ type: RIDERS_REPORT_TYPE_ENUM.TIP,
1208
+ staff_name: staffName,
1209
+ title: 'Tips',
1210
+ description: localeAmount(currencySymbol, convertPriceFromCents(item.tip_amount)),
1211
+ count: item.count,
1212
+ amount,
1213
+ sortIndex: 6,
1214
+ };
1215
+ if (staffWiseDataMap[staffId] != null) {
1216
+ staffWiseDataMap[staffId].push(obj);
1217
+ }
1218
+ else {
1219
+ staffWiseDataMap[staffId] = [obj];
1220
+ }
1221
+ }
1222
+ });
1223
+ data[RIDERS_REPORT_TYPE_ENUM.DELIVERY_CHARGE].forEach((item) => {
1224
+ const staffId = item.staff_id ?? CUSTOMER_ID;
1225
+ const staffName = staffNamesMap[staffId];
1226
+ if (staffName != null) {
1227
+ const delivery_cost = convertPriceFromCents(item.delivery_cost);
1228
+ const amount = item.grossAmount;
1229
+ const description = localeAmount(currencySymbol, delivery_cost);
1230
+ const obj = {
1231
+ _id: staffId,
1232
+ ref: description,
1233
+ type: RIDERS_REPORT_TYPE_ENUM.DELIVERY_CHARGE,
1234
+ staff_name: staffName,
1235
+ title: 'Delivery Charges',
1236
+ description,
1237
+ count: item.count,
1238
+ amount,
1239
+ distanceMeters: item.delivery_distance_mtrs,
1240
+ sortIndex: 8,
1241
+ };
1242
+ if (staffWiseDataMap[staffId] != null) {
1243
+ staffWiseDataMap[staffId].push(obj);
1244
+ }
1245
+ else {
1246
+ staffWiseDataMap[staffId] = [obj];
1247
+ }
1248
+ }
1249
+ });
1250
+ const staffWiseDataFooterDetailsMap = {};
1251
+ if (Object.keys(discountFooterData).length > 0) {
1252
+ for (const staffId in discountFooterData) {
1253
+ let details = discountFooterData[staffId];
1254
+ if (Object.keys(details).length === 0) {
1255
+ continue;
1256
+ }
1257
+ if (staffWiseDataFooterDetailsMap[staffId] == null) {
1258
+ staffWiseDataFooterDetailsMap[staffId] = {};
1259
+ }
1260
+ details = structuredClone(details);
1261
+ let index = 0;
1262
+ for (const type in details) {
1263
+ let sortIndex = ALL_PAYMENT_TYPE_NAMES.indexOf(type);
1264
+ if (sortIndex === -1) {
1265
+ sortIndex = 200 + index;
1266
+ }
1267
+ details[type].sortIndex = sortIndex;
1268
+ index++;
1269
+ }
1270
+ }
1271
+ }
1272
+ return {
1273
+ staffWiseDataMap,
1274
+ saffWiseTotalSalesMap,
1275
+ staffWiseDataFooterDetailsMap,
1276
+ };
1277
+ };
1278
+ const getUsableData = (data, subtitles) => {
1279
+ const defaultCombinedData = {
1280
+ _id: 'combined',
1281
+ title: 'Combined Report',
1282
+ netSale: 0,
1283
+ netWithoutDeliveryCharges: 0,
1284
+ totalOrders: 0,
1285
+ unpaidOrders: 0,
1286
+ unpaidAmount: 0,
1287
+ taxInvoiceProviderCharges: 0,
1288
+ amountCollected: 0,
1289
+ channels: [],
1290
+ totalDistanceKm: 0,
1291
+ totalDeliveryCharges: 0,
1292
+ ...subtitles,
1293
+ };
1294
+ const { staffWiseDataMap, saffWiseTotalSalesMap, staffWiseDataFooterDetailsMap } = data;
1295
+ const staffWiseData = [];
1296
+ const combinedData = {
1297
+ ...defaultCombinedData,
1298
+ };
1299
+ const combinedChannelsMap = {};
1300
+ const uniqueCombinedDataMap = {};
1301
+ for (const staffId in staffWiseDataMap) {
1302
+ const salesData = saffWiseTotalSalesMap[staffId];
1303
+ if (!salesData)
1304
+ continue;
1305
+ const staffData = staffWiseDataMap[staffId];
1306
+ const similarTypes = {};
1307
+ for (let i = 0; i < staffData.length; i++) {
1308
+ const d = staffData[i];
1309
+ if (similarTypes[d.type] != null) {
1310
+ similarTypes[d.type].push(d);
1311
+ }
1312
+ else {
1313
+ similarTypes[d.type] = [d];
1314
+ }
1315
+ }
1316
+ const totalOrders = salesData.count;
1317
+ let netSale = salesData.grossAmount;
1318
+ let unpaidOrders = 0;
1319
+ let unpaidAmount = 0;
1320
+ let totalDeliveryCharges = 0;
1321
+ let totalDistanceMeters = 0;
1322
+ for (const type in similarTypes) {
1323
+ const firstData = similarTypes[type][0];
1324
+ if (!firstData)
1325
+ continue;
1326
+ const combinedData = similarTypes[type].reduce((acc, d) => {
1327
+ acc.count += d.count;
1328
+ acc.amount += d.amount;
1329
+ return acc;
1330
+ }, {
1331
+ count: 0,
1332
+ amount: 0,
1333
+ });
1334
+ similarTypes[type].push({
1335
+ _id: `${firstData._id}-${TOTAL_REF}`,
1336
+ ref: TOTAL_REF,
1337
+ type: firstData.type,
1338
+ staff_name: firstData.staff_name,
1339
+ title: firstData.title,
1340
+ description: 'Total',
1341
+ count: combinedData.count,
1342
+ amount: combinedData.amount,
1343
+ sortIndex: 100000,
1344
+ });
1345
+ }
1346
+ const topLevelChannels = [];
1347
+ for (const type in similarTypes) {
1348
+ // We will use it for 3rd layer
1349
+ const staffWiseDataArr = similarTypes[type];
1350
+ const firstData = staffWiseDataArr[0];
1351
+ const footerDetailsMap = structuredClone(staffWiseDataFooterDetailsMap[staffId]?.[type] ?? {});
1352
+ // Second Layer ==> Type
1353
+ const channel = {
1354
+ _id: `${firstData._id}-${firstData.type}`,
1355
+ ref: firstData.type,
1356
+ title: firstData.title,
1357
+ subChannels: [],
1358
+ sortIndex: firstData.sortIndex,
1359
+ footerDetailsMap,
1360
+ };
1361
+ // We will use it for 3rd layer
1362
+ const subChannels = [];
1363
+ for (let j = 0; j < staffWiseDataArr.length; j++) {
1364
+ const d = staffWiseDataArr[j];
1365
+ if (d.type === RIDERS_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES && d.ref !== TOTAL_REF) {
1366
+ if (String(d.description).toUpperCase() === PAYMENT_TYPE_ENUM.UNPAID) {
1367
+ unpaidOrders += d.count;
1368
+ unpaidAmount += d.amount;
1369
+ }
1370
+ else if (String(d.description).toUpperCase() === PAYMENT_TYPE_ENUM.COMPLIMENTARY) {
1371
+ netSale -= d.amount;
1372
+ }
1373
+ }
1374
+ else if (d.type === RIDERS_REPORT_TYPE_ENUM.DELIVERY_CHARGE && d.ref !== TOTAL_REF) {
1375
+ totalDeliveryCharges += d.amount;
1376
+ if (d.distanceMeters)
1377
+ totalDistanceMeters += d.distanceMeters;
1378
+ }
1379
+ const sChannel = {
1380
+ _id: `${d._id}-${d.ref}`,
1381
+ ref: d.ref,
1382
+ title: typeof d.description === 'string' ? d.description : `${d.description} ${sentenceCase(d.type)}`,
1383
+ count: d.count,
1384
+ amount: d.amount,
1385
+ sortIndex: j,
1386
+ };
1387
+ // Attach total distance (KM) as additionalInfo for delivery TOTAL rows
1388
+ // in individual rider sections only. The TOTAL_REF entry is the
1389
+ // combined subtotal row for this type inside the rider's section.
1390
+ if (d.type === RIDERS_REPORT_TYPE_ENUM.DELIVERY_CHARGE) {
1391
+ if (d.ref !== TOTAL_REF) {
1392
+ sChannel.additionalInfo = `${((d.distanceMeters ?? 0) / 1000).toFixed(2)} KM`;
1393
+ }
1394
+ else {
1395
+ sChannel.additionalInfo = `${(totalDistanceMeters / 1000).toFixed(2)} KM`;
1396
+ }
1397
+ }
1398
+ if (uniqueTypes.includes(type)) {
1399
+ if (uniqueCombinedDataMap[type] != null) {
1400
+ if (typeof d.description === 'number') {
1401
+ uniqueCombinedDataMap[type].subChannel.num += d.description;
1402
+ uniqueCombinedDataMap[type].subChannel.count += d.count;
1403
+ uniqueCombinedDataMap[type].subChannel.amount += d.amount;
1404
+ }
1405
+ }
1406
+ else {
1407
+ if (typeof d.description === 'number') {
1408
+ uniqueCombinedDataMap[type] = {
1409
+ _id: `${d._id}-${d.type}`,
1410
+ ref: d.type,
1411
+ title: d.title,
1412
+ sortIndex: d.sortIndex,
1413
+ footerDetailsMap: {},
1414
+ subChannel: {
1415
+ _id: `${d._id}-${d.ref}`,
1416
+ ref: d.ref,
1417
+ num: d.description,
1418
+ count: d.count,
1419
+ amount: d.amount,
1420
+ },
1421
+ };
1422
+ }
1423
+ }
1424
+ if (j === 0) {
1425
+ const combinedFooterDetailsMap = structuredClone(uniqueCombinedDataMap[type].footerDetailsMap ?? {});
1426
+ for (const key in footerDetailsMap) {
1427
+ if (combinedFooterDetailsMap[key] != null) {
1428
+ combinedFooterDetailsMap[key].amount += footerDetailsMap[key].amount;
1429
+ combinedFooterDetailsMap[key].count += footerDetailsMap[key].count;
1430
+ }
1431
+ else {
1432
+ combinedFooterDetailsMap[key] = footerDetailsMap[key];
1433
+ }
1434
+ }
1435
+ uniqueCombinedDataMap[type].footerDetailsMap = combinedFooterDetailsMap;
1436
+ }
1437
+ }
1438
+ else {
1439
+ // Aggregate into combinedChannelsMap for ALL types (including DELIVERY_CHARGE).
1440
+ // For combined entries we must not propagate per-rider `additionalInfo`,
1441
+ // so delete it when copying the subchannel.
1442
+ if (combinedChannelsMap[type] != null) {
1443
+ if (combinedChannelsMap[type].subChannels[d.ref] != null) {
1444
+ combinedChannelsMap[type].subChannels[d.ref].amount += d.amount;
1445
+ combinedChannelsMap[type].subChannels[d.ref].count += d.count;
1446
+ }
1447
+ else {
1448
+ const sChannelForCombined = { ...sChannel };
1449
+ delete sChannelForCombined.additionalInfo;
1450
+ combinedChannelsMap[type].subChannels[d.ref] = {
1451
+ ...sChannelForCombined,
1452
+ sortIndex: j,
1453
+ };
1454
+ }
1455
+ }
1456
+ else {
1457
+ combinedChannelsMap[type] = {
1458
+ _id: `${d._id}-${d.type}`,
1459
+ ref: d.type,
1460
+ title: d.title,
1461
+ sortIndex: d.sortIndex,
1462
+ footerDetailsMap: {},
1463
+ subChannels: {
1464
+ [d.ref]: (() => {
1465
+ const sc = { ...sChannel };
1466
+ delete sc.additionalInfo;
1467
+ sc.sortIndex = j;
1468
+ return sc;
1469
+ })(),
1470
+ },
1471
+ };
1472
+ }
1473
+ if (j === 0) {
1474
+ const combinedFooterDetailsMap = structuredClone(combinedChannelsMap[type].footerDetailsMap ?? {});
1475
+ for (const key in footerDetailsMap) {
1476
+ if (combinedFooterDetailsMap[key] != null) {
1477
+ combinedFooterDetailsMap[key].amount += footerDetailsMap[key].amount;
1478
+ combinedFooterDetailsMap[key].count += footerDetailsMap[key].count;
1479
+ }
1480
+ else {
1481
+ combinedFooterDetailsMap[key] = footerDetailsMap[key];
1482
+ }
1483
+ }
1484
+ combinedChannelsMap[type].footerDetailsMap = combinedFooterDetailsMap;
1485
+ }
1486
+ }
1487
+ sChannel.amount = convertPriceFromCents(sChannel.amount);
1488
+ subChannels.push(sChannel);
1489
+ }
1490
+ // ==================>>><<<==================
1491
+ channel.subChannels = subChannels;
1492
+ topLevelChannels.push(channel);
1493
+ }
1494
+ const netWithoutDeliveryCharges = netSale - totalDeliveryCharges;
1495
+ const amountCollected = netSale - unpaidAmount;
1496
+ const totalDistanceKm = totalDistanceMeters / 1000;
1497
+ // First Layer ==> Staff
1498
+ const channelData = {
1499
+ ...subtitles,
1500
+ _id: staffId,
1501
+ title: salesData.staff_name ?? '',
1502
+ netSale: convertPriceFromCents(netSale),
1503
+ netWithoutDeliveryCharges: convertPriceFromCents(netWithoutDeliveryCharges),
1504
+ unpaidAmount: convertPriceFromCents(unpaidAmount),
1505
+ taxInvoiceProviderCharges: convertPriceFromCents(salesData.totalTaxInvoiceProviderCharges),
1506
+ amountCollected: convertPriceFromCents(amountCollected),
1507
+ totalOrders,
1508
+ unpaidOrders,
1509
+ channels: topLevelChannels,
1510
+ totalDistanceKm,
1511
+ totalDeliveryCharges: convertPriceFromCents(totalDeliveryCharges),
1512
+ };
1513
+ combinedData.netSale += channelData.netSale;
1514
+ combinedData.netWithoutDeliveryCharges += channelData.netWithoutDeliveryCharges;
1515
+ combinedData.amountCollected += channelData.amountCollected;
1516
+ combinedData.totalOrders += channelData.totalOrders;
1517
+ combinedData.unpaidOrders += channelData.unpaidOrders;
1518
+ combinedData.unpaidAmount += channelData.unpaidAmount;
1519
+ combinedData.taxInvoiceProviderCharges += channelData.taxInvoiceProviderCharges;
1520
+ combinedData.totalDistanceKm = (combinedData.totalDistanceKm || 0) + (channelData.totalDistanceKm || 0);
1521
+ combinedData.totalDeliveryCharges =
1522
+ (combinedData.totalDeliveryCharges || 0) + (channelData.totalDeliveryCharges || 0);
1523
+ staffWiseData.push(channelData);
1524
+ }
1525
+ const usableStaffWiseData = staffWiseData
1526
+ .map((d) => ({
1527
+ ...d,
1528
+ channels: getSortedUsableChannels(d.channels),
1529
+ }))
1530
+ .sort((a, b) => b.netSale - a.netSale);
1531
+ Object.values(uniqueCombinedDataMap).forEach((d) => {
1532
+ combinedChannelsMap[d._id] = {
1533
+ _id: d._id,
1534
+ ref: d.ref,
1535
+ title: d.title,
1536
+ subChannels: {
1537
+ [d.subChannel.ref]: {
1538
+ _id: d.subChannel._id,
1539
+ ref: d.subChannel.ref,
1540
+ title: `${d.subChannel.num} ${sentenceCase(d.title)}`,
1541
+ count: d.subChannel.count,
1542
+ amount: d.subChannel.amount,
1543
+ sortIndex: 0,
1544
+ },
1545
+ },
1546
+ sortIndex: d.sortIndex,
1547
+ footerDetailsMap: d.footerDetailsMap,
1548
+ };
1549
+ });
1550
+ const combinedChannels = Object.values(combinedChannelsMap).map((c) => {
1551
+ const subChannels = Object.values(c.subChannels).map((sc) => ({
1552
+ ...sc,
1553
+ amount: convertPriceFromCents(sc.amount),
1554
+ }));
1555
+ return {
1556
+ ...c,
1557
+ subChannels,
1558
+ };
1559
+ });
1560
+ const usableCombinedData = {
1561
+ ...subtitles,
1562
+ _id: combinedData._id,
1563
+ title: combinedData.title,
1564
+ channels: getSortedUsableChannels(combinedChannels),
1565
+ netSale: parseNum(combinedData.netSale),
1566
+ netWithoutDeliveryCharges: parseNum(combinedData.netWithoutDeliveryCharges),
1567
+ totalOrders: parseNum(combinedData.totalOrders),
1568
+ unpaidAmount: parseNum(combinedData.unpaidAmount),
1569
+ unpaidOrders: parseNum(combinedData.unpaidOrders),
1570
+ taxInvoiceProviderCharges: parseNum(combinedData.taxInvoiceProviderCharges),
1571
+ amountCollected: parseNum(combinedData.amountCollected),
1572
+ totalDistanceKm: parseNum(combinedData.totalDistanceKm || 0),
1573
+ totalDeliveryCharges: parseNum(combinedData.totalDeliveryCharges || 0),
1574
+ };
1575
+ return {
1576
+ staffWiseData: usableStaffWiseData,
1577
+ combinedData: usableCombinedData,
1578
+ };
1579
+ };
1580
+ export const getRidersReportData = (data, currencySymbol) => {
1581
+ const netSaleSubtitle = 'excl. Discounts, Complimentary';
1582
+ const netWithoutDeliveryChargesSubtitle = 'excl. Delivery Charges, Discounts, Complimentary';
1583
+ const subtitles = {
1584
+ netSaleSubtitle,
1585
+ netWithoutDeliveryChargesSubtitle,
1586
+ };
1587
+ const staffWiseData = generateStaffWiseData(data, currencySymbol);
1588
+ const usableData = getUsableData(staffWiseData, subtitles);
1589
+ return usableData;
1590
+ };