@harbortouch/skytab-analytics-report-utils 0.5.1 → 0.6.0

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.
package/dist/index.cjs CHANGED
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  employeeTimecardConfig: () => employeeTimecardConfig,
62
62
  getColumnAlignment: () => getColumnAlignment,
63
63
  getColumnMetadata: () => getColumnMetadata,
64
+ getReportConfig: () => getReportConfig,
64
65
  isNumericType: () => isNumericType,
65
66
  itemTaxConfig: () => itemTaxConfig,
66
67
  modifierMixConfig: () => modifierMixConfig,
@@ -72,180 +73,915 @@ __export(index_exports, {
72
73
  });
73
74
  module.exports = __toCommonJS(index_exports);
74
75
 
75
- // src/report.ts
76
- var Report = {
77
- TICKET_LIVE: "ticket-live",
78
- TICKET_ANALYTICS: "ticket-analytics",
79
- SALES_SUMMARY: "sales-summary",
80
- PRODUCT_MIX: "product-mix",
81
- MODIFIER_MIX: "modifier-mix",
82
- ITEM_TAX: "item-tax",
83
- EMPLOYEE_TIMECARD: "employee-timecard",
84
- EMPLOYEE_TIP: "employee-tip",
85
- SALES_BY_ITEM: "sales-by-item"
86
- };
87
-
88
- // src/columns/index.ts
89
- var COLUMN_REGISTRY = {
90
- fifteenMinInterval: {
91
- titleKey: "common.report-col.fifteen-min-interval",
92
- shortTitleKey: "common.report-col.fifteen-min-interval.short",
93
- infoTextKey: "common.report-col.fifteen-min-interval.info"
94
- },
95
- adjustedTips: {
96
- titleKey: "common.report-col.adjusted-tips",
97
- shortTitleKey: "common.report-col.adjusted-tips.short",
98
- infoTextKey: "common.report-col.adjusted-tips.info"
76
+ // src/reports/salesSummary.ts
77
+ var FIRST_COLUMN_WIDTH = 240;
78
+ var FIELDS = {
79
+ groupById: { type: "number" },
80
+ groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
81
+ salesAmountNet: { type: "money", columnKey: "netSales" },
82
+ salesVarLW: { type: "money", columnKey: "salesVarLw" },
83
+ salesVarLY: { type: "money", columnKey: "salesVarLy" },
84
+ salesVarLWPct: {
85
+ type: "percent",
86
+ columnKey: "salesVarLwPct",
87
+ footerCalculation: {
88
+ type: "percentChange",
89
+ numeratorField: "salesAmountNet",
90
+ denominatorField: "salesAmountNetLastWeek"
91
+ }
99
92
  },
100
- advantageProgram: {
101
- titleKey: "common.report-col.advantage-program",
102
- shortTitleKey: "common.report-col.advantage-program.short",
103
- infoTextKey: "common.report-col.advantage-program.info"
93
+ salesVarLYPct: {
94
+ type: "percent",
95
+ columnKey: "salesVarLyPct",
96
+ footerCalculation: {
97
+ type: "percentChange",
98
+ numeratorField: "salesAmountNet",
99
+ denominatorField: "salesAmountNetLastYear"
100
+ }
104
101
  },
105
- amex: {
106
- titleKey: "common.report-col.amex",
107
- shortTitleKey: "common.report-col.amex.short",
108
- infoTextKey: "common.report-col.amex.info"
102
+ salesAmountNetLastWeek: { type: "money" },
103
+ salesAmountNetLastYear: { type: "money" },
104
+ salesAmountGross: { type: "money" },
105
+ salesAmountGrossLastWeek: { type: "money" },
106
+ salesAmountGrossLastYear: { type: "money" },
107
+ ticketsCount: { type: "number" },
108
+ ticketsCountLastWeek: { type: "number" },
109
+ ticketsCountLastYear: { type: "number" },
110
+ guestsCount: { type: "number", columnKey: "guestCount" },
111
+ guestsVarLW: { type: "number", columnKey: "guestsVarLw" },
112
+ guestsVarLY: { type: "number", columnKey: "guestsVarLy" },
113
+ guestsVarLWPct: {
114
+ type: "percent",
115
+ columnKey: "guestsVarLwPct",
116
+ footerCalculation: {
117
+ type: "percentChange",
118
+ numeratorField: "guestsCount",
119
+ denominatorField: "guestsCountLastWeek"
120
+ }
109
121
  },
110
- amexReturns: {
111
- titleKey: "common.report-col.amex-returns",
112
- shortTitleKey: "common.report-col.amex-returns.short",
113
- infoTextKey: "common.report-col.amex-returns.info"
122
+ guestsVarLYPct: {
123
+ type: "percent",
124
+ columnKey: "guestsVarLyPct",
125
+ footerCalculation: {
126
+ type: "percentChange",
127
+ numeratorField: "guestsCount",
128
+ denominatorField: "guestsCountLastYear"
129
+ }
114
130
  },
115
- attachRate: {
116
- titleKey: "common.report-col.attach-rate",
117
- shortTitleKey: "common.report-col.attach-rate.short",
118
- infoTextKey: "common.report-col.attach-rate.info"
131
+ guestsCountLastWeek: { type: "number" },
132
+ guestsCountLastYear: { type: "number" },
133
+ salesPerGuestTY: {
134
+ type: "money",
135
+ columnKey: "salesPerGuest",
136
+ footerCalculation: {
137
+ type: "average",
138
+ numeratorField: "salesAmountNet",
139
+ denominatorField: "guestsCount"
140
+ }
119
141
  },
120
- autoGratuity: {
121
- titleKey: "common.report-col.auto-gratuity",
122
- shortTitleKey: "common.report-col.auto-gratuity.short",
123
- infoTextKey: "common.report-col.auto-gratuity.info"
142
+ salesPerGuestLW: {
143
+ type: "money",
144
+ columnKey: "salesPerGuestLw",
145
+ footerCalculation: {
146
+ type: "average",
147
+ numeratorField: "salesAmountNetLastWeek",
148
+ denominatorField: "guestsCountLastWeek"
149
+ }
124
150
  },
125
- averageGrossPrice: {
126
- titleKey: "common.report-col.average-gross-price",
127
- shortTitleKey: "common.report-col.average-gross-price.short",
128
- infoTextKey: "common.report-col.average-gross-price.info"
151
+ salesPerGuestLY: {
152
+ type: "money",
153
+ columnKey: "salesPerGuestLy",
154
+ footerCalculation: {
155
+ type: "average",
156
+ numeratorField: "salesAmountNetLastYear",
157
+ denominatorField: "guestsCountLastYear"
158
+ }
159
+ }
160
+ };
161
+ var COLUMN_GROUPS = [
162
+ {
163
+ id: "sales",
164
+ headerTranslationKey: "table.groups.sales",
165
+ baseFields: ["salesAmountNet"],
166
+ lastWeekFields: ["salesVarLW", "salesVarLWPct"],
167
+ lastYearFields: ["salesVarLY", "salesVarLYPct"]
129
168
  },
130
- bankFees: {
131
- titleKey: "common.report-col.bank-fees",
132
- shortTitleKey: "common.report-col.bank-fees.short",
133
- infoTextKey: "common.report-col.bank-fees.info"
169
+ {
170
+ id: "guests",
171
+ headerTranslationKey: "table.groups.guests",
172
+ baseFields: ["guestsCount"],
173
+ lastWeekFields: ["guestsVarLW", "guestsVarLWPct"],
174
+ lastYearFields: ["guestsVarLY", "guestsVarLYPct"]
134
175
  },
135
- batchAmount: {
136
- titleKey: "common.report-col.batch-amount",
137
- shortTitleKey: "common.report-col.batch-amount.short",
138
- infoTextKey: "common.report-col.batch-amount.info"
176
+ {
177
+ id: "salesPerGuest",
178
+ headerTranslationKey: "table.groups.sales-per-guest",
179
+ baseFields: ["salesPerGuestTY"],
180
+ lastWeekFields: ["salesPerGuestLW"],
181
+ lastYearFields: ["salesPerGuestLY"]
182
+ }
183
+ ];
184
+ var SALES_SUMMARY_AVAILABLE_COLUMNS = [
185
+ "salesAmountNet",
186
+ "salesVarLW",
187
+ "salesVarLWPct",
188
+ "salesVarLY",
189
+ "salesVarLYPct",
190
+ "guestsCount",
191
+ "guestsVarLW",
192
+ "guestsVarLWPct",
193
+ "guestsVarLY",
194
+ "guestsVarLYPct",
195
+ "salesPerGuestTY",
196
+ "salesPerGuestLW",
197
+ "salesPerGuestLY"
198
+ ];
199
+ var SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS = [
200
+ "salesAmountNet",
201
+ "guestsCount",
202
+ "salesPerGuestTY"
203
+ ];
204
+ var salesSummaryConfig = {
205
+ fields: FIELDS,
206
+ availableColumns: SALES_SUMMARY_AVAILABLE_COLUMNS,
207
+ defaultVisibleColumns: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
208
+ columnGroups: COLUMN_GROUPS
209
+ };
210
+
211
+ // src/reports/ticketSummary.ts
212
+ var FIELDS2 = {
213
+ ticketId: { type: "string" },
214
+ locationId: { type: "number" },
215
+ orderName: { type: "string" },
216
+ revenueCenterName: { type: "string", columnKey: "revenueCenter" },
217
+ daypartName: { type: "string", columnKey: "daypart" },
218
+ inclusiveTaxesAmount: {
219
+ type: "money",
220
+ columnKey: "inclusiveTax",
221
+ footerCalculation: { type: "sum" }
139
222
  },
140
- batchDate: {
141
- titleKey: "common.report-col.batch-date",
142
- shortTitleKey: "common.report-col.batch-date.short",
143
- infoTextKey: "common.report-col.batch-date.info"
223
+ locationName: { type: "string", size: 240, columnKey: "locationName" },
224
+ orderNumber: { type: "number", columnKey: "ticketNumber", footerCalculation: { type: "none" } },
225
+ businessDate: { type: "date", columnKey: "date" },
226
+ ticketOpenedAt: { type: "time", columnKey: "ticketOpen" },
227
+ ticketClosedAt: { type: "time", columnKey: "ticketClosed" },
228
+ ticketTime: { type: "number", columnKey: "timeOpenMins", enableSorting: false },
229
+ ticketSubtotal: {
230
+ type: "money",
231
+ columnKey: "subtotal",
232
+ footerCalculation: { type: "sum" }
144
233
  },
145
- batchNumber: {
146
- titleKey: "common.report-col.batch-number",
147
- shortTitleKey: "common.report-col.batch-number.short",
148
- infoTextKey: "common.report-col.batch-number.info"
234
+ discountsAmount: {
235
+ type: "money",
236
+ columnKey: "discountAmount",
237
+ footerCalculation: { type: "sum" }
149
238
  },
150
- clockInTime: {
151
- titleKey: "common.report-col.clock-in-time",
152
- shortTitleKey: "common.report-col.clock-in-time.short",
153
- infoTextKey: "common.report-col.clock-in-time.info"
239
+ surchargesAmount: {
240
+ type: "money",
241
+ columnKey: "ticketFee",
242
+ footerCalculation: { type: "sum" }
154
243
  },
155
- clockOutTime: {
156
- titleKey: "common.report-col.clock-out-time",
157
- shortTitleKey: "common.report-col.clock-out-time.short",
158
- infoTextKey: "common.report-col.clock-out-time.info"
244
+ taxesAmount: {
245
+ type: "money",
246
+ columnKey: "taxCollected",
247
+ footerCalculation: { type: "sum" }
159
248
  },
160
- country: {
161
- titleKey: "common.report-col.country",
162
- shortTitleKey: "common.report-col.country.short",
163
- infoTextKey: "common.report-col.country.info"
249
+ ticketGrandTotal: {
250
+ type: "money",
251
+ columnKey: "grandTotal",
252
+ footerCalculation: { type: "sum" }
164
253
  },
165
- customerName: {
166
- titleKey: "common.report-col.customer-name",
167
- shortTitleKey: "common.report-col.customer-name.short",
168
- infoTextKey: "common.report-col.customer-name.info"
254
+ gratuitiesAmount: {
255
+ type: "money",
256
+ columnKey: "autoGratuity",
257
+ footerCalculation: { type: "sum" }
169
258
  },
170
- date: {
171
- titleKey: "common.report-col.date",
172
- shortTitleKey: "common.report-col.date.short",
173
- infoTextKey: "common.report-col.date.info"
259
+ tipAmount: {
260
+ type: "money",
261
+ columnKey: "tips",
262
+ footerCalculation: { type: "sum" }
174
263
  },
175
- dateClose: {
176
- titleKey: "common.report-col.date-close",
177
- shortTitleKey: "common.report-col.date-close.short",
178
- infoTextKey: "common.report-col.date-close.info"
179
- },
180
- daypart: {
181
- titleKey: "common.report-col.daypart",
182
- shortTitleKey: "common.report-col.daypart.short",
183
- infoTextKey: "common.report-col.daypart.info"
184
- },
185
- debit: {
186
- titleKey: "common.report-col.debit",
187
- shortTitleKey: "common.report-col.debit.short",
188
- infoTextKey: "common.report-col.debit.info"
189
- },
190
- debitReturns: {
191
- titleKey: "common.report-col.debit-returns",
192
- shortTitleKey: "common.report-col.debit-returns.short",
193
- infoTextKey: "common.report-col.debit-returns.info"
194
- },
195
- declaredTips: {
196
- titleKey: "common.report-col.declared-tips",
197
- shortTitleKey: "common.report-col.declared-tips.short",
198
- infoTextKey: "common.report-col.declared-tips.info"
199
- },
200
- department: {
201
- titleKey: "common.report-col.department",
202
- shortTitleKey: "common.report-col.department.short",
203
- infoTextKey: "common.report-col.department.info"
264
+ paymentsAmount: {
265
+ type: "money",
266
+ columnKey: "totalCollected",
267
+ footerCalculation: { type: "sum" }
204
268
  },
205
- depositCurrency: {
206
- titleKey: "common.report-col.deposit-currency",
207
- shortTitleKey: "common.report-col.deposit-currency.short",
208
- infoTextKey: "common.report-col.deposit-currency.info"
269
+ paymentTypeName: { type: "string", columnKey: "paymentType" },
270
+ guestsCount: {
271
+ type: "number",
272
+ columnKey: "guestCount",
273
+ footerCalculation: { type: "sum" }
209
274
  },
210
- depositDate: {
211
- titleKey: "common.report-col.deposit-date",
212
- shortTitleKey: "common.report-col.deposit-date.short",
213
- infoTextKey: "common.report-col.deposit-date.info"
275
+ employeeName: { type: "string", columnKey: "employeeName" },
276
+ orderTypeName: { type: "string", columnKey: "orderType" }
277
+ };
278
+ var TICKET_SUMMARY_AVAILABLE_COLUMNS = [
279
+ "locationName",
280
+ "orderNumber",
281
+ "businessDate",
282
+ "ticketOpenedAt",
283
+ "ticketClosedAt",
284
+ "ticketTime",
285
+ "ticketSubtotal",
286
+ "discountsAmount",
287
+ "surchargesAmount",
288
+ "taxesAmount",
289
+ "ticketGrandTotal",
290
+ "gratuitiesAmount",
291
+ "tipAmount",
292
+ "paymentsAmount",
293
+ "paymentTypeName",
294
+ "guestsCount",
295
+ "employeeName",
296
+ "orderTypeName"
297
+ ];
298
+ var TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS = TICKET_SUMMARY_AVAILABLE_COLUMNS;
299
+ var ticketSummaryConfig = {
300
+ fields: FIELDS2,
301
+ availableColumns: TICKET_SUMMARY_AVAILABLE_COLUMNS,
302
+ defaultVisibleColumns: TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS
303
+ };
304
+
305
+ // src/reports/ticketLive.ts
306
+ var FIELDS3 = {
307
+ locationName: { type: "string", columnKey: "locationName" },
308
+ orderNumber: {
309
+ type: "number",
310
+ columnKey: "ticketNumber",
311
+ footerCalculation: { type: "none" }
214
312
  },
215
- discountAmount: {
216
- titleKey: "common.report-col.discount-amount",
217
- shortTitleKey: "common.report-col.discount-amount.short",
218
- infoTextKey: "common.report-col.discount-amount.info"
313
+ dateOpen: { type: "string", columnKey: "date" },
314
+ timeOpen: { type: "string", columnKey: "ticketOpen" },
315
+ dateClose: { type: "string", columnKey: "dateClose" },
316
+ timeClose: { type: "string", columnKey: "ticketClosed" },
317
+ durationMinutes: { type: "number", columnKey: "timeOpenMins" },
318
+ subtotal: { type: "money", columnKey: "subtotal" },
319
+ discountTotal: { type: "money", columnKey: "discountAmount" },
320
+ surchargeTotal: { type: "money", columnKey: "ticketFee" },
321
+ taxTotal: { type: "money", columnKey: "taxCollected" },
322
+ grandTotal: { type: "money", columnKey: "grandTotal" },
323
+ gratuityTotal: { type: "money", columnKey: "autoGratuity" },
324
+ totalTips: { type: "money", columnKey: "totalTips" },
325
+ paymentsReceived: { type: "money", columnKey: "totalCollected" },
326
+ paymentTypeName: { type: "string", columnKey: "paymentType" },
327
+ guestCount: {
328
+ type: "number",
329
+ columnKey: "guestCount",
330
+ footerCalculation: { type: "sum" }
219
331
  },
220
- discountCount: {
221
- titleKey: "common.report-col.discount-count",
222
- shortTitleKey: "common.report-col.discount-count.short",
223
- infoTextKey: "common.report-col.discount-count.info"
332
+ customerName: { type: "string", columnKey: "customerName" },
333
+ employeeName: { type: "string", columnKey: "employeeName" },
334
+ orderType: { type: "string", columnKey: "orderType" }
335
+ };
336
+ var TICKET_LIVE_AVAILABLE_COLUMNS = [
337
+ "locationName",
338
+ "orderNumber",
339
+ "dateOpen",
340
+ "timeOpen",
341
+ "timeClose",
342
+ "durationMinutes",
343
+ "subtotal",
344
+ "discountTotal",
345
+ "surchargeTotal",
346
+ "taxTotal",
347
+ "grandTotal",
348
+ "gratuityTotal",
349
+ "totalTips",
350
+ "paymentsReceived",
351
+ "paymentTypeName",
352
+ "guestCount",
353
+ "employeeName",
354
+ "orderType"
355
+ ];
356
+ var TICKET_LIVE_DEFAULT_VISIBLE_COLUMNS = TICKET_LIVE_AVAILABLE_COLUMNS;
357
+ var ticketLiveConfig = {
358
+ fields: FIELDS3,
359
+ availableColumns: TICKET_LIVE_AVAILABLE_COLUMNS,
360
+ defaultVisibleColumns: TICKET_LIVE_DEFAULT_VISIBLE_COLUMNS
361
+ };
362
+
363
+ // src/reports/productMix.ts
364
+ var FIRST_COLUMN_WIDTH2 = 240;
365
+ var FIELDS4 = {
366
+ groupById: { type: "string" },
367
+ groupByName: { type: "string", size: FIRST_COLUMN_WIDTH2 },
368
+ salesAmountGross: { type: "money", columnKey: "grossSales" },
369
+ discountsAmount: { type: "money", columnKey: "discountAmount" },
370
+ inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
371
+ salesAmountNet: { type: "money", columnKey: "netSales" },
372
+ itemsQuantity: { type: "fixedNumber", columnKey: "quantity" },
373
+ avgPrice: {
374
+ type: "fixedNumber",
375
+ columnKey: "averageGrossPrice",
376
+ footerCalculation: {
377
+ type: "average",
378
+ numeratorField: "salesAmountGross",
379
+ denominatorField: "itemsQuantity"
380
+ }
224
381
  },
225
- discover: {
226
- titleKey: "common.report-col.discover",
227
- shortTitleKey: "common.report-col.discover.short",
228
- infoTextKey: "common.report-col.discover.info"
382
+ salesMixPct: { type: "percent", columnKey: "salesMixByPct" }
383
+ };
384
+ var PRODUCT_MIX_AVAILABLE_COLUMNS = [
385
+ "salesAmountGross",
386
+ "discountsAmount",
387
+ "inclusiveTaxesAmount",
388
+ "salesAmountNet",
389
+ "itemsQuantity",
390
+ "avgPrice",
391
+ "salesMixPct"
392
+ ];
393
+ var PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS = PRODUCT_MIX_AVAILABLE_COLUMNS;
394
+ var PRODUCT_MIX_CHART_FIELDS = [
395
+ "salesAmountGross",
396
+ "itemsQuantity",
397
+ "avgPrice",
398
+ "discountsAmount",
399
+ "inclusiveTaxesAmount",
400
+ "salesAmountNet",
401
+ "salesMixPct"
402
+ ];
403
+ var productMixConfig = {
404
+ fields: FIELDS4,
405
+ availableColumns: PRODUCT_MIX_AVAILABLE_COLUMNS,
406
+ defaultVisibleColumns: PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS
407
+ };
408
+
409
+ // src/reports/modifierMix.ts
410
+ var FIRST_COLUMN_WIDTH3 = 240;
411
+ var FIELDS5 = {
412
+ groupById: { type: "string", filteringAvailable: false },
413
+ groupByName: { type: "string", size: FIRST_COLUMN_WIDTH3, filteringAvailable: false },
414
+ groupById2: { type: "string", filteringAvailable: false },
415
+ groupByName2: { type: "string", size: FIRST_COLUMN_WIDTH3, filteringAvailable: false },
416
+ modifiersSales: { type: "money", columnKey: "totalModifierSales" },
417
+ modifiersQuantity: { type: "number", columnKey: "modifierQuantity" },
418
+ itemsQuantity: {
419
+ type: "number",
420
+ columnKey: "quantity",
421
+ filteringAvailable: false
229
422
  },
230
- discoverReturns: {
231
- titleKey: "common.report-col.discover-returns",
232
- shortTitleKey: "common.report-col.discover-returns.short",
233
- infoTextKey: "common.report-col.discover-returns.info"
423
+ avgGross: {
424
+ type: "money",
425
+ columnKey: "averageGrossPrice",
426
+ footerCalculation: {
427
+ type: "average",
428
+ numeratorField: "modifiersSales",
429
+ denominatorField: "modifiersQuantity"
430
+ }
234
431
  },
235
- ebt: {
236
- titleKey: "common.report-col.ebt",
237
- shortTitleKey: "common.report-col.ebt.short",
238
- infoTextKey: "common.report-col.ebt.info"
432
+ attachRate: {
433
+ type: "percent",
434
+ columnKey: "attachRate",
435
+ footerCalculation: {
436
+ type: "average",
437
+ numeratorField: "modifiersQuantity",
438
+ denominatorField: "itemsQuantity"
439
+ }
239
440
  },
240
- ebtReturns: {
241
- titleKey: "common.report-col.ebt-returns",
242
- shortTitleKey: "common.report-col.ebt-returns.short",
243
- infoTextKey: "common.report-col.ebt-returns.info"
441
+ modifiersSalesComp: { type: "money", filteringAvailable: false },
442
+ modifiersQuantityComp: { type: "number", filteringAvailable: false },
443
+ itemsQuantityComp: { type: "number", filteringAvailable: false },
444
+ attachRateComp: { type: "percent", filteringAvailable: false },
445
+ modifiersSalesVar: { type: "money", filteringAvailable: false },
446
+ modifiersSalesVarPct: {
447
+ type: "percent",
448
+ filteringAvailable: false,
449
+ footerCalculation: {
450
+ type: "percentChange",
451
+ numeratorField: "modifiersSales",
452
+ denominatorField: "modifiersSalesComp"
453
+ }
244
454
  },
245
- employeeId: {
246
- titleKey: "common.report-col.employee-id",
247
- shortTitleKey: "common.report-col.employee-id.short",
248
- infoTextKey: "common.report-col.employee-id.info"
455
+ modifiersQuantityVar: { type: "number", filteringAvailable: false },
456
+ modifiersQuantityVarPct: {
457
+ type: "percent",
458
+ filteringAvailable: false,
459
+ footerCalculation: {
460
+ type: "percentChange",
461
+ numeratorField: "modifiersQuantity",
462
+ denominatorField: "modifiersQuantityComp"
463
+ }
464
+ },
465
+ attachRateVar: { type: "percent", filteringAvailable: false },
466
+ attachRateVarPct: {
467
+ type: "percent",
468
+ filteringAvailable: false,
469
+ footerCalculation: {
470
+ type: "percentChange",
471
+ numeratorField: "attachRate",
472
+ denominatorField: "attachRateComp"
473
+ }
474
+ }
475
+ };
476
+ var MODIFIER_MIX_AVAILABLE_COLUMNS = ["modifiersSales", "modifiersQuantity", "avgGross"];
477
+ var MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS = MODIFIER_MIX_AVAILABLE_COLUMNS;
478
+ var modifierMixConfig = {
479
+ fields: FIELDS5,
480
+ availableColumns: MODIFIER_MIX_AVAILABLE_COLUMNS,
481
+ defaultVisibleColumns: MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS
482
+ };
483
+
484
+ // src/reports/itemTax.ts
485
+ var FIELDS6 = {
486
+ locationId: { type: "number", filteringAvailable: false },
487
+ taxIsFlat: { type: "boolean", filteringAvailable: false },
488
+ merchantId: { type: "string", columnKey: "locationMid", filteringAvailable: false },
489
+ locationName: { type: "string", columnKey: "locationName", filteringAvailable: false },
490
+ locationCity: { type: "string", columnKey: "locationCity", filteringAvailable: false },
491
+ locationState: { type: "string", columnKey: "locationState", filteringAvailable: false },
492
+ itemName: { type: "string", columnKey: "itemName", filteringAvailable: false },
493
+ itemPrice: { type: "money", columnKey: "itemPrice" },
494
+ departmentName: { type: "string", columnKey: "department", filteringAvailable: false },
495
+ revenueClassName: { type: "string", columnKey: "revenueClass", filteringAvailable: false },
496
+ orderTypeName: { type: "string", columnKey: "orderType", filteringAvailable: false },
497
+ taxName: { type: "string", columnKey: "taxName", filteringAvailable: false },
498
+ taxValue: { type: "money", columnKey: "taxableSales" },
499
+ taxRate: { type: "number", columnKey: "taxRate" },
500
+ recordsCount: { type: "number", columnKey: "quantity" },
501
+ taxableSales: { type: "money", columnKey: "taxableSales" },
502
+ totalCollected: { type: "money", columnKey: "totalCollected" },
503
+ itemTax: { type: "money", columnKey: "taxCollected" },
504
+ taxCollected: { type: "money", columnKey: "taxCollected" }
505
+ };
506
+ var ITEM_TAX_AVAILABLE_COLUMNS = [
507
+ "merchantId",
508
+ "locationName",
509
+ "locationCity",
510
+ "locationState",
511
+ "itemName",
512
+ "departmentName",
513
+ "revenueClassName",
514
+ "orderTypeName",
515
+ "recordsCount",
516
+ "itemPrice",
517
+ "taxName",
518
+ "taxRate",
519
+ "taxableSales",
520
+ "taxCollected"
521
+ ];
522
+ var ITEM_TAX_DEFAULT_VISIBLE_COLUMNS = ITEM_TAX_AVAILABLE_COLUMNS;
523
+ var itemTaxConfig = {
524
+ fields: FIELDS6,
525
+ availableColumns: ITEM_TAX_AVAILABLE_COLUMNS,
526
+ defaultVisibleColumns: ITEM_TAX_DEFAULT_VISIBLE_COLUMNS
527
+ };
528
+
529
+ // src/reports/dailySales.ts
530
+ var FIRST_COLUMN_WIDTH4 = 240;
531
+ var FIELDS7 = {
532
+ groupById: { type: "string" },
533
+ groupByName: { type: "string", size: FIRST_COLUMN_WIDTH4 },
534
+ itemsQuantity: { type: "number", columnKey: "quantity" },
535
+ salesAmountGross: { type: "money", columnKey: "grossSales" },
536
+ discountsAmount: { type: "money", columnKey: "discountAmount" },
537
+ inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
538
+ salesAmountNet: { type: "money", columnKey: "netSales" },
539
+ salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
540
+ avgPrice: {
541
+ type: "fixedNumber",
542
+ columnKey: "averageGrossPrice",
543
+ footerCalculation: {
544
+ type: "average",
545
+ numeratorField: "salesAmountGross",
546
+ denominatorField: "itemsQuantity"
547
+ }
548
+ },
549
+ ticketsCount: { type: "number", columnKey: "tickets" },
550
+ guestsCount: { type: "number", columnKey: "guests" },
551
+ ticketAverage: {
552
+ type: "money",
553
+ columnKey: "ticketAverage",
554
+ footerCalculation: {
555
+ type: "average",
556
+ numeratorField: "salesAmountNet",
557
+ denominatorField: "ticketsCount"
558
+ }
559
+ },
560
+ guestAverage: {
561
+ type: "money",
562
+ columnKey: "guestAverage",
563
+ footerCalculation: {
564
+ type: "average",
565
+ numeratorField: "salesAmountNet",
566
+ denominatorField: "guestsCount"
567
+ }
568
+ },
569
+ ticketAvg: {
570
+ type: "money",
571
+ columnKey: "ticketAverage",
572
+ footerCalculation: {
573
+ type: "average",
574
+ numeratorField: "salesAmountNet",
575
+ denominatorField: "ticketsCount"
576
+ }
577
+ },
578
+ guestAvg: {
579
+ type: "money",
580
+ columnKey: "guestAverage",
581
+ footerCalculation: {
582
+ type: "average",
583
+ numeratorField: "salesAmountNet",
584
+ denominatorField: "guestsCount"
585
+ }
586
+ }
587
+ };
588
+ var DAILY_SALES_AVAILABLE_COLUMNS = [
589
+ "itemsQuantity",
590
+ "salesAmountGross",
591
+ "discountsAmount",
592
+ "inclusiveTaxesAmount",
593
+ "salesAmountNet",
594
+ "salesMixPct"
595
+ ];
596
+ var DAILY_SALES_BY_GROUP_AVAILABLE_COLUMNS = [
597
+ "ticketsCount",
598
+ "guestsCount",
599
+ "ticketAverage",
600
+ "guestAverage",
601
+ "salesAmountNet"
602
+ ];
603
+ var DAILY_SALES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_AVAILABLE_COLUMNS;
604
+ var dailySalesConfig = {
605
+ fields: FIELDS7,
606
+ availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
607
+ defaultVisibleColumns: DAILY_SALES_DEFAULT_VISIBLE_COLUMNS
608
+ };
609
+ var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
610
+ "ticketsCount",
611
+ "guestsCount",
612
+ "ticketAvg",
613
+ "guestAvg",
614
+ "salesAmountNet"
615
+ ];
616
+ var dailySalesTrendsConfig = {
617
+ fields: FIELDS7,
618
+ availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
619
+ defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS
620
+ };
621
+
622
+ // src/reports/dailySalesPayments.ts
623
+ var FIRST_COLUMN_WIDTH5 = 240;
624
+ var FIELDS8 = {
625
+ paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH5 },
626
+ paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
627
+ paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
628
+ tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
629
+ totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
630
+ };
631
+ var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
632
+ "paymentsCount",
633
+ "paymentsAmount",
634
+ "tipsAmount",
635
+ "totalSales"
636
+ ];
637
+ var DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS;
638
+ var dailySalesPaymentsConfig = {
639
+ fields: FIELDS8,
640
+ availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
641
+ defaultVisibleColumns: DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS
642
+ };
643
+
644
+ // src/reports/dailySalesDiscounts.ts
645
+ var FIRST_COLUMN_WIDTH6 = 240;
646
+ var FIELDS9 = {
647
+ discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH6 },
648
+ discountsCount: { type: "number", columnKey: "discountCount", footerCalculation: { type: "sum" } },
649
+ discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
650
+ };
651
+ var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
652
+ "discountsCount",
653
+ "discountsAmount"
654
+ ];
655
+ var DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS;
656
+ var dailySalesDiscountsConfig = {
657
+ fields: FIELDS9,
658
+ availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
659
+ defaultVisibleColumns: DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS
660
+ };
661
+
662
+ // src/reports/employeeTimecard.ts
663
+ var FIRST_COLUMN_WIDTH7 = 240;
664
+ var EMPLOYEE_NAME_WIDTH = 220;
665
+ var STATUS_WIDTH = 140;
666
+ var LOOKUP_WIDTH = 160;
667
+ var PAYROLL_WIDTH = 160;
668
+ var JOB_WIDTH = 200;
669
+ var FIELDS10 = {
670
+ locationId: {
671
+ type: "number",
672
+ enableSorting: false,
673
+ filteringAvailable: false
674
+ },
675
+ locationName: {
676
+ type: "string",
677
+ size: FIRST_COLUMN_WIDTH7,
678
+ columnKey: "locationName"
679
+ },
680
+ businessDate: {
681
+ type: "date",
682
+ columnKey: "date"
683
+ },
684
+ employeeName: {
685
+ type: "string",
686
+ size: EMPLOYEE_NAME_WIDTH,
687
+ columnKey: "employeeName"
688
+ },
689
+ isActive: {
690
+ type: "string",
691
+ size: STATUS_WIDTH,
692
+ columnKey: "status",
693
+ enableSorting: false,
694
+ filteringAvailable: false
695
+ },
696
+ lookup: {
697
+ type: "string",
698
+ size: LOOKUP_WIDTH,
699
+ columnKey: "employeeId"
700
+ },
701
+ payrollCode: {
702
+ type: "string",
703
+ size: PAYROLL_WIDTH,
704
+ columnKey: "payrollId"
705
+ },
706
+ jobName: {
707
+ type: "string",
708
+ size: JOB_WIDTH,
709
+ columnKey: "employeeJob"
710
+ },
711
+ isBreak: {
712
+ type: "string",
713
+ enableSorting: false,
714
+ filteringAvailable: false
715
+ },
716
+ startTime: {
717
+ type: "string",
718
+ columnKey: "clockInTime"
719
+ },
720
+ endTime: {
721
+ type: "string",
722
+ columnKey: "clockOutTime"
723
+ },
724
+ shiftHours: {
725
+ type: "fixedNumber",
726
+ columnKey: "shiftDurationHrs",
727
+ filteringAvailable: false
728
+ }
729
+ };
730
+ var EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS = [
731
+ "locationName",
732
+ "businessDate",
733
+ "employeeName",
734
+ "isActive",
735
+ "lookup",
736
+ "payrollCode",
737
+ "jobName",
738
+ "startTime",
739
+ "endTime",
740
+ "shiftHours"
741
+ ];
742
+ var EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS = EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS;
743
+ var employeeTimecardConfig = {
744
+ fields: FIELDS10,
745
+ availableColumns: EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS,
746
+ defaultVisibleColumns: EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS,
747
+ columnGroups: []
748
+ // No column groups for this report
749
+ };
750
+
751
+ // src/reports/salesByItemDetail.ts
752
+ var FIELDS11 = {
753
+ businessDate: { type: "date", columnKey: "date", filteringAvailable: false },
754
+ ticketClosedAt: { type: "string", columnKey: "ticketClosed", filteringAvailable: false },
755
+ hourId: { type: "number", columnKey: "hour", filteringAvailable: false },
756
+ daypartName: { type: "string", columnKey: "daypart", filteringAvailable: false },
757
+ locationId: { type: "number", columnKey: "locationId", filteringAvailable: false },
758
+ locationName: { type: "string", columnKey: "locationName", filteringAvailable: false },
759
+ departmentName: { type: "string", columnKey: "department", filteringAvailable: false },
760
+ itemName: { type: "string", columnKey: "itemName", filteringAvailable: false },
761
+ revenueCenterName: { type: "string", columnKey: "revenueCenter", filteringAvailable: false },
762
+ revenueClassName: { type: "string", columnKey: "revenueClass", filteringAvailable: false },
763
+ salesAmountGross: { type: "money", columnKey: "grossSales" },
764
+ itemsQuantity: { type: "number", columnKey: "quantity" },
765
+ transactionId: { type: "string", columnKey: "ticketNumber", filteringAvailable: false },
766
+ guestsCount: { type: "number", columnKey: "guestCount" },
767
+ employeeName: { type: "string", columnKey: "employeeName", filteringAvailable: false },
768
+ orderTypeName: { type: "string", columnKey: "orderType", filteringAvailable: false },
769
+ salesType: { type: "string", columnKey: "salePaymentType", filteringAvailable: false },
770
+ itemPrice: { type: "money", columnKey: "itemPrice" }
771
+ };
772
+ var SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS = [
773
+ "businessDate",
774
+ "ticketClosedAt",
775
+ "hourId",
776
+ "daypartName",
777
+ "locationId",
778
+ "locationName",
779
+ "departmentName",
780
+ "itemName",
781
+ "revenueCenterName",
782
+ "revenueClassName",
783
+ "salesAmountGross",
784
+ "itemsQuantity",
785
+ "transactionId",
786
+ "guestsCount",
787
+ "employeeName",
788
+ "orderTypeName",
789
+ "salesType",
790
+ "itemPrice"
791
+ ];
792
+ var SALES_BY_ITEM_DETAIL_DEFAULT_VISIBLE_COLUMNS = SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS;
793
+ var salesByItemDetailConfig = {
794
+ fields: FIELDS11,
795
+ availableColumns: SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS,
796
+ defaultVisibleColumns: SALES_BY_ITEM_DETAIL_DEFAULT_VISIBLE_COLUMNS
797
+ };
798
+
799
+ // src/report.ts
800
+ var Report = {
801
+ TICKET_LIVE: "ticket-live",
802
+ TICKET_ANALYTICS: "ticket-analytics",
803
+ SALES_SUMMARY: "sales-summary",
804
+ PRODUCT_MIX: "product-mix",
805
+ MODIFIER_MIX: "modifier-mix",
806
+ ITEM_TAX: "item-tax",
807
+ EMPLOYEE_TIMECARD: "employee-timecard",
808
+ EMPLOYEE_TIP: "employee-tip",
809
+ SALES_BY_ITEM: "sales-by-item"
810
+ };
811
+ var REPORT_CONFIG_MAP = {
812
+ "sales-summary": salesSummaryConfig,
813
+ "ticket-analytics": ticketSummaryConfig,
814
+ "ticket-live": ticketLiveConfig,
815
+ "product-mix": productMixConfig,
816
+ "modifier-mix": modifierMixConfig,
817
+ "item-tax": itemTaxConfig,
818
+ "employee-timecard": employeeTimecardConfig,
819
+ "employee-tip": null,
820
+ "sales-by-item": salesByItemDetailConfig
821
+ };
822
+ var getReportConfig = (reportType) => REPORT_CONFIG_MAP[reportType];
823
+
824
+ // src/columns/index.ts
825
+ var COLUMN_REGISTRY = {
826
+ fifteenMinInterval: {
827
+ titleKey: "common.report-col.fifteen-min-interval",
828
+ shortTitleKey: "common.report-col.fifteen-min-interval.short",
829
+ infoTextKey: "common.report-col.fifteen-min-interval.info"
830
+ },
831
+ adjustedTips: {
832
+ titleKey: "common.report-col.adjusted-tips",
833
+ shortTitleKey: "common.report-col.adjusted-tips.short",
834
+ infoTextKey: "common.report-col.adjusted-tips.info"
835
+ },
836
+ advantageProgram: {
837
+ titleKey: "common.report-col.advantage-program",
838
+ shortTitleKey: "common.report-col.advantage-program.short",
839
+ infoTextKey: "common.report-col.advantage-program.info"
840
+ },
841
+ amex: {
842
+ titleKey: "common.report-col.amex",
843
+ shortTitleKey: "common.report-col.amex.short",
844
+ infoTextKey: "common.report-col.amex.info"
845
+ },
846
+ amexReturns: {
847
+ titleKey: "common.report-col.amex-returns",
848
+ shortTitleKey: "common.report-col.amex-returns.short",
849
+ infoTextKey: "common.report-col.amex-returns.info"
850
+ },
851
+ attachRate: {
852
+ titleKey: "common.report-col.attach-rate",
853
+ shortTitleKey: "common.report-col.attach-rate.short",
854
+ infoTextKey: "common.report-col.attach-rate.info"
855
+ },
856
+ autoGratuity: {
857
+ titleKey: "common.report-col.auto-gratuity",
858
+ shortTitleKey: "common.report-col.auto-gratuity.short",
859
+ infoTextKey: "common.report-col.auto-gratuity.info"
860
+ },
861
+ averageGrossPrice: {
862
+ titleKey: "common.report-col.average-gross-price",
863
+ shortTitleKey: "common.report-col.average-gross-price.short",
864
+ infoTextKey: "common.report-col.average-gross-price.info"
865
+ },
866
+ bankFees: {
867
+ titleKey: "common.report-col.bank-fees",
868
+ shortTitleKey: "common.report-col.bank-fees.short",
869
+ infoTextKey: "common.report-col.bank-fees.info"
870
+ },
871
+ batchAmount: {
872
+ titleKey: "common.report-col.batch-amount",
873
+ shortTitleKey: "common.report-col.batch-amount.short",
874
+ infoTextKey: "common.report-col.batch-amount.info"
875
+ },
876
+ batchDate: {
877
+ titleKey: "common.report-col.batch-date",
878
+ shortTitleKey: "common.report-col.batch-date.short",
879
+ infoTextKey: "common.report-col.batch-date.info"
880
+ },
881
+ batchNumber: {
882
+ titleKey: "common.report-col.batch-number",
883
+ shortTitleKey: "common.report-col.batch-number.short",
884
+ infoTextKey: "common.report-col.batch-number.info"
885
+ },
886
+ clockInTime: {
887
+ titleKey: "common.report-col.clock-in-time",
888
+ shortTitleKey: "common.report-col.clock-in-time.short",
889
+ infoTextKey: "common.report-col.clock-in-time.info"
890
+ },
891
+ clockOutTime: {
892
+ titleKey: "common.report-col.clock-out-time",
893
+ shortTitleKey: "common.report-col.clock-out-time.short",
894
+ infoTextKey: "common.report-col.clock-out-time.info"
895
+ },
896
+ country: {
897
+ titleKey: "common.report-col.country",
898
+ shortTitleKey: "common.report-col.country.short",
899
+ infoTextKey: "common.report-col.country.info"
900
+ },
901
+ customerName: {
902
+ titleKey: "common.report-col.customer-name",
903
+ shortTitleKey: "common.report-col.customer-name.short",
904
+ infoTextKey: "common.report-col.customer-name.info"
905
+ },
906
+ date: {
907
+ titleKey: "common.report-col.date",
908
+ shortTitleKey: "common.report-col.date.short",
909
+ infoTextKey: "common.report-col.date.info"
910
+ },
911
+ dateClose: {
912
+ titleKey: "common.report-col.date-close",
913
+ shortTitleKey: "common.report-col.date-close.short",
914
+ infoTextKey: "common.report-col.date-close.info"
915
+ },
916
+ daypart: {
917
+ titleKey: "common.report-col.daypart",
918
+ shortTitleKey: "common.report-col.daypart.short",
919
+ infoTextKey: "common.report-col.daypart.info"
920
+ },
921
+ debit: {
922
+ titleKey: "common.report-col.debit",
923
+ shortTitleKey: "common.report-col.debit.short",
924
+ infoTextKey: "common.report-col.debit.info"
925
+ },
926
+ debitReturns: {
927
+ titleKey: "common.report-col.debit-returns",
928
+ shortTitleKey: "common.report-col.debit-returns.short",
929
+ infoTextKey: "common.report-col.debit-returns.info"
930
+ },
931
+ declaredTips: {
932
+ titleKey: "common.report-col.declared-tips",
933
+ shortTitleKey: "common.report-col.declared-tips.short",
934
+ infoTextKey: "common.report-col.declared-tips.info"
935
+ },
936
+ department: {
937
+ titleKey: "common.report-col.department",
938
+ shortTitleKey: "common.report-col.department.short",
939
+ infoTextKey: "common.report-col.department.info"
940
+ },
941
+ depositCurrency: {
942
+ titleKey: "common.report-col.deposit-currency",
943
+ shortTitleKey: "common.report-col.deposit-currency.short",
944
+ infoTextKey: "common.report-col.deposit-currency.info"
945
+ },
946
+ depositDate: {
947
+ titleKey: "common.report-col.deposit-date",
948
+ shortTitleKey: "common.report-col.deposit-date.short",
949
+ infoTextKey: "common.report-col.deposit-date.info"
950
+ },
951
+ discountAmount: {
952
+ titleKey: "common.report-col.discount-amount",
953
+ shortTitleKey: "common.report-col.discount-amount.short",
954
+ infoTextKey: "common.report-col.discount-amount.info"
955
+ },
956
+ discountCount: {
957
+ titleKey: "common.report-col.discount-count",
958
+ shortTitleKey: "common.report-col.discount-count.short",
959
+ infoTextKey: "common.report-col.discount-count.info"
960
+ },
961
+ discover: {
962
+ titleKey: "common.report-col.discover",
963
+ shortTitleKey: "common.report-col.discover.short",
964
+ infoTextKey: "common.report-col.discover.info"
965
+ },
966
+ discoverReturns: {
967
+ titleKey: "common.report-col.discover-returns",
968
+ shortTitleKey: "common.report-col.discover-returns.short",
969
+ infoTextKey: "common.report-col.discover-returns.info"
970
+ },
971
+ ebt: {
972
+ titleKey: "common.report-col.ebt",
973
+ shortTitleKey: "common.report-col.ebt.short",
974
+ infoTextKey: "common.report-col.ebt.info"
975
+ },
976
+ ebtReturns: {
977
+ titleKey: "common.report-col.ebt-returns",
978
+ shortTitleKey: "common.report-col.ebt-returns.short",
979
+ infoTextKey: "common.report-col.ebt-returns.info"
980
+ },
981
+ employeeId: {
982
+ titleKey: "common.report-col.employee-id",
983
+ shortTitleKey: "common.report-col.employee-id.short",
984
+ infoTextKey: "common.report-col.employee-id.info"
249
985
  },
250
986
  employeeJob: {
251
987
  titleKey: "common.report-col.employee-job",
@@ -522,878 +1258,293 @@ var COLUMN_REGISTRY = {
522
1258
  shortTitleKey: "common.report-col.shift-duration-hrs.short",
523
1259
  infoTextKey: "common.report-col.shift-duration-hrs.info"
524
1260
  },
525
- salePaymentType: {
526
- titleKey: "common.report-col.sale-payment-type",
527
- shortTitleKey: "common.report-col.sale-payment-type.short",
528
- infoTextKey: "common.report-col.sale-payment-type.info"
529
- },
530
- status: {
531
- titleKey: "common.report-col.status",
532
- shortTitleKey: "common.report-col.status.short",
533
- infoTextKey: "common.report-col.status.info"
534
- },
535
- subtotal: {
536
- titleKey: "common.report-col.subtotal",
537
- shortTitleKey: "common.report-col.subtotal.short",
538
- infoTextKey: "common.report-col.subtotal.info"
539
- },
540
- taxCollected: {
541
- titleKey: "common.report-col.tax-collected",
542
- shortTitleKey: "common.report-col.tax-collected.short",
543
- infoTextKey: "common.report-col.tax-collected.info"
544
- },
545
- taxName: {
546
- titleKey: "common.report-col.tax-name",
547
- shortTitleKey: "common.report-col.tax-name.short",
548
- infoTextKey: "common.report-col.tax-name.info"
549
- },
550
- taxRate: {
551
- titleKey: "common.report-col.tax-rate",
552
- shortTitleKey: "common.report-col.tax-rate.short",
553
- infoTextKey: "common.report-col.tax-rate.info"
554
- },
555
- taxableSales: {
556
- titleKey: "common.report-col.taxable-sales",
557
- shortTitleKey: "common.report-col.taxable-sales.short",
558
- infoTextKey: "common.report-col.taxable-sales.info"
559
- },
560
- ticketClosed: {
561
- titleKey: "common.report-col.ticket-closed",
562
- shortTitleKey: "common.report-col.ticket-closed.short",
563
- infoTextKey: "common.report-col.ticket-closed.info"
564
- },
565
- ticketFee: {
566
- titleKey: "common.report-col.ticket-fee",
567
- shortTitleKey: "common.report-col.ticket-fee.short",
568
- infoTextKey: "common.report-col.ticket-fee.info"
569
- },
570
- ticketNumber: {
571
- titleKey: "common.report-col.ticket-number",
572
- shortTitleKey: "common.report-col.ticket-number.short",
573
- infoTextKey: "common.report-col.ticket-number.info"
574
- },
575
- ticketOpen: {
576
- titleKey: "common.report-col.ticket-open",
577
- shortTitleKey: "common.report-col.ticket-open.short",
578
- infoTextKey: "common.report-col.ticket-open.info"
579
- },
580
- ticketTotal: {
581
- titleKey: "common.report-col.ticket-total",
582
- shortTitleKey: "common.report-col.ticket-total.short",
583
- infoTextKey: "common.report-col.ticket-total.info"
584
- },
585
- timeOpenMins: {
586
- titleKey: "common.report-col.time-open-mins",
587
- shortTitleKey: "common.report-col.time-open-mins.short",
588
- infoTextKey: "common.report-col.time-open-mins.info"
589
- },
590
- tipPct: {
591
- titleKey: "common.report-col.tip-pct",
592
- shortTitleKey: "common.report-col.tip-pct.short",
593
- infoTextKey: "common.report-col.tip-pct.info"
594
- },
595
- tipReduction: {
596
- titleKey: "common.report-col.tip-reduction",
597
- shortTitleKey: "common.report-col.tip-reduction.short",
598
- infoTextKey: "common.report-col.tip-reduction.info"
599
- },
600
- tipShare: {
601
- titleKey: "common.report-col.tip-share",
602
- shortTitleKey: "common.report-col.tip-share.short",
603
- infoTextKey: "common.report-col.tip-share.info"
604
- },
605
- tips: {
606
- titleKey: "common.report-col.tips",
607
- shortTitleKey: "common.report-col.tips.short",
608
- infoTextKey: "common.report-col.tips.info"
609
- },
610
- tipsPerHour: {
611
- titleKey: "common.report-col.tips-per-hour",
612
- shortTitleKey: "common.report-col.tips-per-hour.short",
613
- infoTextKey: "common.report-col.tips-per-hour.info"
614
- },
615
- totalCollected: {
616
- titleKey: "common.report-col.total-collected",
617
- shortTitleKey: "common.report-col.total-collected.short",
618
- infoTextKey: "common.report-col.total-collected.info"
619
- },
620
- totalItemSales: {
621
- titleKey: "common.report-col.total-item-sales",
622
- shortTitleKey: "common.report-col.total-item-sales.short",
623
- infoTextKey: "common.report-col.total-item-sales.info"
624
- },
625
- totalModifierSales: {
626
- titleKey: "common.report-col.total-modifier-sales",
627
- shortTitleKey: "common.report-col.total-modifier-sales.short",
628
- infoTextKey: "common.report-col.total-modifier-sales.info"
629
- },
630
- totalReturns: {
631
- titleKey: "common.report-col.total-returns",
632
- shortTitleKey: "common.report-col.total-returns.short",
633
- infoTextKey: "common.report-col.total-returns.info"
634
- },
635
- totalSales: {
636
- titleKey: "common.report-col.total-sales",
637
- shortTitleKey: "common.report-col.total-sales.short",
638
- infoTextKey: "common.report-col.total-sales.info"
639
- },
640
- totalTips: {
641
- titleKey: "common.report-col.total-tips",
642
- shortTitleKey: "common.report-col.total-tips.short",
643
- infoTextKey: "common.report-col.total-tips.info"
644
- },
645
- transactionDate: {
646
- titleKey: "common.report-col.transaction-date",
647
- shortTitleKey: "common.report-col.transaction-date.short",
648
- infoTextKey: "common.report-col.transaction-date.info"
649
- },
650
- transactionType: {
651
- titleKey: "common.report-col.transaction-type",
652
- shortTitleKey: "common.report-col.transaction-type.short",
653
- infoTextKey: "common.report-col.transaction-type.info"
654
- },
655
- untaxedSales: {
656
- titleKey: "common.report-col.untaxed-sales",
657
- shortTitleKey: "common.report-col.untaxed-sales.short",
658
- infoTextKey: "common.report-col.untaxed-sales.info"
659
- },
660
- visa: {
661
- titleKey: "common.report-col.visa",
662
- shortTitleKey: "common.report-col.visa.short",
663
- infoTextKey: "common.report-col.visa.info"
664
- },
665
- visaReturns: {
666
- titleKey: "common.report-col.visa-returns",
667
- shortTitleKey: "common.report-col.visa-returns.short",
668
- infoTextKey: "common.report-col.visa-returns.info"
669
- },
670
- paymentsCount: {
671
- titleKey: "common.report-col.payments-count",
672
- shortTitleKey: "common.report-col.payments-count.short",
673
- infoTextKey: "common.report-col.payments-count.info"
674
- },
675
- paymentsAmount: {
676
- titleKey: "common.report-col.payments-amount",
677
- shortTitleKey: "common.report-col.payments-amount.short",
678
- infoTextKey: "common.report-col.payments-amount.info"
679
- },
680
- paymentsTotal: {
681
- titleKey: "common.report-col.payments-total",
682
- shortTitleKey: "common.report-col.payments-total.short",
683
- infoTextKey: "common.report-col.payments-total.info"
684
- },
685
- refundVoidDescription: {
686
- titleKey: "common.report-col.refund-void-description",
687
- shortTitleKey: "common.report-col.refund-void-description.short",
688
- infoTextKey: "common.report-col.refund-void-description.info"
689
- },
690
- refundVoidCount: {
691
- titleKey: "common.report-col.refund-void-count",
692
- shortTitleKey: "common.report-col.refund-void-count.short",
693
- infoTextKey: "common.report-col.refund-void-count.info"
694
- },
695
- refundVoidAmount: {
696
- titleKey: "common.report-col.refund-void-amount",
697
- shortTitleKey: "common.report-col.refund-void-amount.short",
698
- infoTextKey: "common.report-col.refund-void-amount.info"
699
- },
700
- refundVoidPctSales: {
701
- titleKey: "common.report-col.refund-void-pct-sales",
702
- shortTitleKey: "common.report-col.refund-void-pct-sales.short",
703
- infoTextKey: "common.report-col.refund-void-pct-sales.info"
704
- },
705
- discountName: {
706
- titleKey: "common.report-col.discount-name",
707
- shortTitleKey: "common.report-col.discount-name.short",
708
- infoTextKey: "common.report-col.discount-name.info"
709
- },
710
- tickets: {
711
- titleKey: "common.report-col.tickets",
712
- shortTitleKey: "common.report-col.tickets.short",
713
- infoTextKey: "common.report-col.tickets.info"
714
- },
715
- guests: {
716
- titleKey: "common.report-col.guests",
717
- shortTitleKey: "common.report-col.guests.short",
718
- infoTextKey: "common.report-col.guests.info"
719
- },
720
- ticketAverage: {
721
- titleKey: "common.report-col.ticket-average",
722
- shortTitleKey: "common.report-col.ticket-average.short",
723
- infoTextKey: "common.report-col.ticket-average.info"
724
- },
725
- guestAverage: {
726
- titleKey: "common.report-col.guest-average",
727
- shortTitleKey: "common.report-col.guest-average.short",
728
- infoTextKey: "common.report-col.guest-average.info"
729
- },
730
- net: {
731
- titleKey: "common.report-col.net",
732
- shortTitleKey: "common.report-col.net.short",
733
- infoTextKey: "common.report-col.net.info"
734
- }
735
- };
736
- function getColumnMetadata(key) {
737
- return COLUMN_REGISTRY[key];
738
- }
739
-
740
- // src/utils/alignment.ts
741
- function getColumnAlignment(type) {
742
- if (type === "string" || type === "date" || type === "time") {
743
- return "left";
744
- }
745
- return "right";
746
- }
747
- function isNumericType(type) {
748
- return type === "money" || type === "number" || type === "percent" || type === "fixedNumber";
749
- }
750
-
751
- // src/totals.ts
752
- function calculateReportTotals(data, fieldConfig, opts) {
753
- const rows = data;
754
- const { labelField, label } = opts;
755
- const fieldsToSum = /* @__PURE__ */ new Set();
756
- const derivedFields = [];
757
- for (const [field, config] of Object.entries(fieldConfig)) {
758
- const { type, columnKey, footerCalculation: calc } = config;
759
- if (!type || type === "string" || type === "date" || type === "time" || type === "boolean") {
760
- continue;
761
- }
762
- if (calc?.type === "none") {
763
- } else if (!calc || calc.type === "sum") {
764
- if (columnKey || calc?.type === "sum") {
765
- fieldsToSum.add(field);
766
- }
767
- } else {
768
- derivedFields.push({ field, calc });
769
- if (calc.numeratorField) fieldsToSum.add(calc.numeratorField);
770
- if (calc.denominatorField) fieldsToSum.add(calc.denominatorField);
771
- }
772
- }
773
- const sums = {};
774
- for (const field of fieldsToSum) {
775
- sums[field] = rows.reduce((acc, row) => acc + (row[field] ?? 0), 0);
776
- }
777
- const derived = {};
778
- for (const { field, calc } of derivedFields) {
779
- const num = sums[calc.numeratorField ?? ""] ?? 0;
780
- const den = sums[calc.denominatorField ?? ""] ?? 0;
781
- if (calc.type === "percentChange") {
782
- derived[field] = den ? (num - den) / den : 0;
783
- } else if (calc.type === "average") {
784
- derived[field] = den > 0 ? num / den : 0;
785
- }
786
- }
787
- const result = {};
788
- for (const [field, config] of Object.entries(fieldConfig)) {
789
- const { type } = config;
790
- if (!type || type === "string" || type === "date" || type === "time") {
791
- result[field] = "";
792
- } else if (type === "boolean") {
793
- result[field] = false;
794
- } else {
795
- result[field] = 0;
796
- }
797
- }
798
- result[labelField] = label;
799
- for (const [field, value] of Object.entries(sums)) {
800
- result[field] = value;
801
- }
802
- for (const [field, value] of Object.entries(derived)) {
803
- result[field] = value;
804
- }
805
- return result;
806
- }
807
-
808
- // src/reports/salesSummary.ts
809
- var FIRST_COLUMN_WIDTH = 240;
810
- var FIELDS = {
811
- groupById: { type: "number" },
812
- groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
813
- salesAmountNet: { type: "money", columnKey: "netSales" },
814
- salesVarLW: { type: "money", columnKey: "salesVarLw" },
815
- salesVarLY: { type: "money", columnKey: "salesVarLy" },
816
- salesVarLWPct: {
817
- type: "percent",
818
- columnKey: "salesVarLwPct",
819
- footerCalculation: {
820
- type: "percentChange",
821
- numeratorField: "salesAmountNet",
822
- denominatorField: "salesAmountNetLastWeek"
823
- }
1261
+ salePaymentType: {
1262
+ titleKey: "common.report-col.sale-payment-type",
1263
+ shortTitleKey: "common.report-col.sale-payment-type.short",
1264
+ infoTextKey: "common.report-col.sale-payment-type.info"
824
1265
  },
825
- salesVarLYPct: {
826
- type: "percent",
827
- columnKey: "salesVarLyPct",
828
- footerCalculation: {
829
- type: "percentChange",
830
- numeratorField: "salesAmountNet",
831
- denominatorField: "salesAmountNetLastYear"
832
- }
1266
+ status: {
1267
+ titleKey: "common.report-col.status",
1268
+ shortTitleKey: "common.report-col.status.short",
1269
+ infoTextKey: "common.report-col.status.info"
833
1270
  },
834
- salesAmountNetLastWeek: { type: "money" },
835
- salesAmountNetLastYear: { type: "money" },
836
- salesAmountGross: { type: "money" },
837
- salesAmountGrossLastWeek: { type: "money" },
838
- salesAmountGrossLastYear: { type: "money" },
839
- ticketsCount: { type: "number" },
840
- ticketsCountLastWeek: { type: "number" },
841
- ticketsCountLastYear: { type: "number" },
842
- guestsCount: { type: "number", columnKey: "guestCount" },
843
- guestsVarLW: { type: "number", columnKey: "guestsVarLw" },
844
- guestsVarLY: { type: "number", columnKey: "guestsVarLy" },
845
- guestsVarLWPct: {
846
- type: "percent",
847
- columnKey: "guestsVarLwPct",
848
- footerCalculation: {
849
- type: "percentChange",
850
- numeratorField: "guestsCount",
851
- denominatorField: "guestsCountLastWeek"
852
- }
1271
+ subtotal: {
1272
+ titleKey: "common.report-col.subtotal",
1273
+ shortTitleKey: "common.report-col.subtotal.short",
1274
+ infoTextKey: "common.report-col.subtotal.info"
853
1275
  },
854
- guestsVarLYPct: {
855
- type: "percent",
856
- columnKey: "guestsVarLyPct",
857
- footerCalculation: {
858
- type: "percentChange",
859
- numeratorField: "guestsCount",
860
- denominatorField: "guestsCountLastYear"
861
- }
1276
+ taxCollected: {
1277
+ titleKey: "common.report-col.tax-collected",
1278
+ shortTitleKey: "common.report-col.tax-collected.short",
1279
+ infoTextKey: "common.report-col.tax-collected.info"
862
1280
  },
863
- guestsCountLastWeek: { type: "number" },
864
- guestsCountLastYear: { type: "number" },
865
- salesPerGuestTY: {
866
- type: "money",
867
- columnKey: "salesPerGuest",
868
- footerCalculation: {
869
- type: "average",
870
- numeratorField: "salesAmountNet",
871
- denominatorField: "guestsCount"
872
- }
1281
+ taxName: {
1282
+ titleKey: "common.report-col.tax-name",
1283
+ shortTitleKey: "common.report-col.tax-name.short",
1284
+ infoTextKey: "common.report-col.tax-name.info"
873
1285
  },
874
- salesPerGuestLW: {
875
- type: "money",
876
- columnKey: "salesPerGuestLw",
877
- footerCalculation: {
878
- type: "average",
879
- numeratorField: "salesAmountNetLastWeek",
880
- denominatorField: "guestsCountLastWeek"
881
- }
1286
+ taxRate: {
1287
+ titleKey: "common.report-col.tax-rate",
1288
+ shortTitleKey: "common.report-col.tax-rate.short",
1289
+ infoTextKey: "common.report-col.tax-rate.info"
882
1290
  },
883
- salesPerGuestLY: {
884
- type: "money",
885
- columnKey: "salesPerGuestLy",
886
- footerCalculation: {
887
- type: "average",
888
- numeratorField: "salesAmountNetLastYear",
889
- denominatorField: "guestsCountLastYear"
890
- }
891
- }
892
- };
893
- var COLUMN_GROUPS = [
894
- {
895
- id: "sales",
896
- headerTranslationKey: "table.groups.sales",
897
- baseFields: ["salesAmountNet"],
898
- lastWeekFields: ["salesVarLW", "salesVarLWPct"],
899
- lastYearFields: ["salesVarLY", "salesVarLYPct"]
1291
+ taxableSales: {
1292
+ titleKey: "common.report-col.taxable-sales",
1293
+ shortTitleKey: "common.report-col.taxable-sales.short",
1294
+ infoTextKey: "common.report-col.taxable-sales.info"
900
1295
  },
901
- {
902
- id: "guests",
903
- headerTranslationKey: "table.groups.guests",
904
- baseFields: ["guestsCount"],
905
- lastWeekFields: ["guestsVarLW", "guestsVarLWPct"],
906
- lastYearFields: ["guestsVarLY", "guestsVarLYPct"]
1296
+ ticketClosed: {
1297
+ titleKey: "common.report-col.ticket-closed",
1298
+ shortTitleKey: "common.report-col.ticket-closed.short",
1299
+ infoTextKey: "common.report-col.ticket-closed.info"
907
1300
  },
908
- {
909
- id: "salesPerGuest",
910
- headerTranslationKey: "table.groups.sales-per-guest",
911
- baseFields: ["salesPerGuestTY"],
912
- lastWeekFields: ["salesPerGuestLW"],
913
- lastYearFields: ["salesPerGuestLY"]
914
- }
915
- ];
916
- var SALES_SUMMARY_AVAILABLE_COLUMNS = [
917
- "salesAmountNet",
918
- "salesVarLW",
919
- "salesVarLWPct",
920
- "salesVarLY",
921
- "salesVarLYPct",
922
- "guestsCount",
923
- "guestsVarLW",
924
- "guestsVarLWPct",
925
- "guestsVarLY",
926
- "guestsVarLYPct",
927
- "salesPerGuestTY",
928
- "salesPerGuestLW",
929
- "salesPerGuestLY"
930
- ];
931
- var SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS = [
932
- "salesAmountNet",
933
- "guestsCount",
934
- "salesPerGuestTY"
935
- ];
936
- var salesSummaryConfig = {
937
- fields: FIELDS,
938
- availableColumns: SALES_SUMMARY_AVAILABLE_COLUMNS,
939
- defaultVisibleColumns: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
940
- columnGroups: COLUMN_GROUPS
941
- };
942
-
943
- // src/reports/ticketSummary.ts
944
- var FIELDS2 = {
945
- ticketId: { type: "string" },
946
- locationId: { type: "number" },
947
- orderName: { type: "string" },
948
- revenueCenterName: { type: "string", columnKey: "revenueCenter" },
949
- daypartName: { type: "string", columnKey: "daypart" },
950
- inclusiveTaxesAmount: {
951
- type: "money",
952
- columnKey: "inclusiveTax",
953
- footerCalculation: { type: "sum" }
1301
+ ticketFee: {
1302
+ titleKey: "common.report-col.ticket-fee",
1303
+ shortTitleKey: "common.report-col.ticket-fee.short",
1304
+ infoTextKey: "common.report-col.ticket-fee.info"
1305
+ },
1306
+ ticketNumber: {
1307
+ titleKey: "common.report-col.ticket-number",
1308
+ shortTitleKey: "common.report-col.ticket-number.short",
1309
+ infoTextKey: "common.report-col.ticket-number.info"
954
1310
  },
955
- locationName: { type: "string", size: 240, columnKey: "locationName" },
956
- orderNumber: { type: "number", columnKey: "ticketNumber", footerCalculation: { type: "none" } },
957
- businessDate: { type: "date", columnKey: "date" },
958
- ticketOpenedAt: { type: "time", columnKey: "ticketOpen" },
959
- ticketClosedAt: { type: "time", columnKey: "ticketClosed" },
960
- ticketTime: { type: "number", columnKey: "timeOpenMins", enableSorting: false },
961
- ticketSubtotal: {
962
- type: "money",
963
- columnKey: "subtotal",
964
- footerCalculation: { type: "sum" }
1311
+ ticketOpen: {
1312
+ titleKey: "common.report-col.ticket-open",
1313
+ shortTitleKey: "common.report-col.ticket-open.short",
1314
+ infoTextKey: "common.report-col.ticket-open.info"
965
1315
  },
966
- discountsAmount: {
967
- type: "money",
968
- columnKey: "discountAmount",
969
- footerCalculation: { type: "sum" }
1316
+ ticketTotal: {
1317
+ titleKey: "common.report-col.ticket-total",
1318
+ shortTitleKey: "common.report-col.ticket-total.short",
1319
+ infoTextKey: "common.report-col.ticket-total.info"
970
1320
  },
971
- surchargesAmount: {
972
- type: "money",
973
- columnKey: "ticketFee",
974
- footerCalculation: { type: "sum" }
1321
+ timeOpenMins: {
1322
+ titleKey: "common.report-col.time-open-mins",
1323
+ shortTitleKey: "common.report-col.time-open-mins.short",
1324
+ infoTextKey: "common.report-col.time-open-mins.info"
975
1325
  },
976
- taxesAmount: {
977
- type: "money",
978
- columnKey: "taxCollected",
979
- footerCalculation: { type: "sum" }
1326
+ tipPct: {
1327
+ titleKey: "common.report-col.tip-pct",
1328
+ shortTitleKey: "common.report-col.tip-pct.short",
1329
+ infoTextKey: "common.report-col.tip-pct.info"
980
1330
  },
981
- ticketGrandTotal: {
982
- type: "money",
983
- columnKey: "grandTotal",
984
- footerCalculation: { type: "sum" }
1331
+ tipReduction: {
1332
+ titleKey: "common.report-col.tip-reduction",
1333
+ shortTitleKey: "common.report-col.tip-reduction.short",
1334
+ infoTextKey: "common.report-col.tip-reduction.info"
985
1335
  },
986
- gratuitiesAmount: {
987
- type: "money",
988
- columnKey: "autoGratuity",
989
- footerCalculation: { type: "sum" }
1336
+ tipShare: {
1337
+ titleKey: "common.report-col.tip-share",
1338
+ shortTitleKey: "common.report-col.tip-share.short",
1339
+ infoTextKey: "common.report-col.tip-share.info"
990
1340
  },
991
- tipAmount: {
992
- type: "money",
993
- columnKey: "tips",
994
- footerCalculation: { type: "sum" }
1341
+ tips: {
1342
+ titleKey: "common.report-col.tips",
1343
+ shortTitleKey: "common.report-col.tips.short",
1344
+ infoTextKey: "common.report-col.tips.info"
995
1345
  },
996
- paymentsAmount: {
997
- type: "money",
998
- columnKey: "totalCollected",
999
- footerCalculation: { type: "sum" }
1346
+ tipsPerHour: {
1347
+ titleKey: "common.report-col.tips-per-hour",
1348
+ shortTitleKey: "common.report-col.tips-per-hour.short",
1349
+ infoTextKey: "common.report-col.tips-per-hour.info"
1000
1350
  },
1001
- paymentTypeName: { type: "string", columnKey: "paymentType" },
1002
- guestsCount: {
1003
- type: "number",
1004
- columnKey: "guestCount",
1005
- footerCalculation: { type: "sum" }
1351
+ totalCollected: {
1352
+ titleKey: "common.report-col.total-collected",
1353
+ shortTitleKey: "common.report-col.total-collected.short",
1354
+ infoTextKey: "common.report-col.total-collected.info"
1006
1355
  },
1007
- employeeName: { type: "string", columnKey: "employeeName" },
1008
- orderTypeName: { type: "string", columnKey: "orderType" }
1009
- };
1010
- var TICKET_SUMMARY_AVAILABLE_COLUMNS = [
1011
- "locationName",
1012
- "orderNumber",
1013
- "businessDate",
1014
- "ticketOpenedAt",
1015
- "ticketClosedAt",
1016
- "ticketTime",
1017
- "ticketSubtotal",
1018
- "discountsAmount",
1019
- "surchargesAmount",
1020
- "taxesAmount",
1021
- "ticketGrandTotal",
1022
- "gratuitiesAmount",
1023
- "tipAmount",
1024
- "paymentsAmount",
1025
- "paymentTypeName",
1026
- "guestsCount",
1027
- "employeeName",
1028
- "orderTypeName"
1029
- ];
1030
- var TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS = TICKET_SUMMARY_AVAILABLE_COLUMNS;
1031
- var ticketSummaryConfig = {
1032
- fields: FIELDS2,
1033
- availableColumns: TICKET_SUMMARY_AVAILABLE_COLUMNS,
1034
- defaultVisibleColumns: TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS
1035
- };
1036
-
1037
- // src/reports/ticketLive.ts
1038
- var FIELDS3 = {
1039
- locationName: { type: "string", columnKey: "locationName" },
1040
- orderNumber: {
1041
- type: "number",
1042
- columnKey: "ticketNumber",
1043
- footerCalculation: { type: "none" }
1356
+ totalItemSales: {
1357
+ titleKey: "common.report-col.total-item-sales",
1358
+ shortTitleKey: "common.report-col.total-item-sales.short",
1359
+ infoTextKey: "common.report-col.total-item-sales.info"
1044
1360
  },
1045
- dateOpen: { type: "string", columnKey: "date" },
1046
- timeOpen: { type: "string", columnKey: "ticketOpen" },
1047
- dateClose: { type: "string", columnKey: "dateClose" },
1048
- timeClose: { type: "string", columnKey: "ticketClosed" },
1049
- durationMinutes: { type: "number", columnKey: "timeOpenMins" },
1050
- subtotal: { type: "money", columnKey: "subtotal" },
1051
- discountTotal: { type: "money", columnKey: "discountAmount" },
1052
- surchargeTotal: { type: "money", columnKey: "ticketFee" },
1053
- taxTotal: { type: "money", columnKey: "taxCollected" },
1054
- grandTotal: { type: "money", columnKey: "grandTotal" },
1055
- gratuityTotal: { type: "money", columnKey: "autoGratuity" },
1056
- totalTips: { type: "money", columnKey: "totalTips" },
1057
- paymentsReceived: { type: "money", columnKey: "totalCollected" },
1058
- paymentTypeName: { type: "string", columnKey: "paymentType" },
1059
- guestCount: {
1060
- type: "number",
1061
- columnKey: "guestCount",
1062
- footerCalculation: { type: "sum" }
1361
+ totalModifierSales: {
1362
+ titleKey: "common.report-col.total-modifier-sales",
1363
+ shortTitleKey: "common.report-col.total-modifier-sales.short",
1364
+ infoTextKey: "common.report-col.total-modifier-sales.info"
1063
1365
  },
1064
- customerName: { type: "string", columnKey: "customerName" },
1065
- employeeName: { type: "string", columnKey: "employeeName" },
1066
- orderType: { type: "string", columnKey: "orderType" }
1067
- };
1068
- var TICKET_LIVE_AVAILABLE_COLUMNS = [
1069
- "locationName",
1070
- "orderNumber",
1071
- "dateOpen",
1072
- "timeOpen",
1073
- "timeClose",
1074
- "durationMinutes",
1075
- "subtotal",
1076
- "discountTotal",
1077
- "surchargeTotal",
1078
- "taxTotal",
1079
- "grandTotal",
1080
- "gratuityTotal",
1081
- "totalTips",
1082
- "paymentsReceived",
1083
- "paymentTypeName",
1084
- "guestCount",
1085
- "employeeName",
1086
- "orderType"
1087
- ];
1088
- var TICKET_LIVE_DEFAULT_VISIBLE_COLUMNS = TICKET_LIVE_AVAILABLE_COLUMNS;
1089
- var ticketLiveConfig = {
1090
- fields: FIELDS3,
1091
- availableColumns: TICKET_LIVE_AVAILABLE_COLUMNS,
1092
- defaultVisibleColumns: TICKET_LIVE_DEFAULT_VISIBLE_COLUMNS
1093
- };
1094
-
1095
- // src/reports/productMix.ts
1096
- var FIRST_COLUMN_WIDTH2 = 240;
1097
- var FIELDS4 = {
1098
- groupById: { type: "string" },
1099
- groupByName: { type: "string", size: FIRST_COLUMN_WIDTH2 },
1100
- salesAmountGross: { type: "money", columnKey: "grossSales" },
1101
- discountsAmount: { type: "money", columnKey: "discountAmount" },
1102
- inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
1103
- salesAmountNet: { type: "money", columnKey: "netSales" },
1104
- itemsQuantity: { type: "fixedNumber", columnKey: "quantity" },
1105
- avgPrice: {
1106
- type: "fixedNumber",
1107
- columnKey: "averageGrossPrice",
1108
- footerCalculation: {
1109
- type: "average",
1110
- numeratorField: "salesAmountGross",
1111
- denominatorField: "itemsQuantity"
1112
- }
1366
+ totalReturns: {
1367
+ titleKey: "common.report-col.total-returns",
1368
+ shortTitleKey: "common.report-col.total-returns.short",
1369
+ infoTextKey: "common.report-col.total-returns.info"
1113
1370
  },
1114
- salesMixPct: { type: "percent", columnKey: "salesMixByPct" }
1115
- };
1116
- var PRODUCT_MIX_AVAILABLE_COLUMNS = [
1117
- "salesAmountGross",
1118
- "discountsAmount",
1119
- "inclusiveTaxesAmount",
1120
- "salesAmountNet",
1121
- "itemsQuantity",
1122
- "avgPrice",
1123
- "salesMixPct"
1124
- ];
1125
- var PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS = PRODUCT_MIX_AVAILABLE_COLUMNS;
1126
- var PRODUCT_MIX_CHART_FIELDS = [
1127
- "salesAmountGross",
1128
- "itemsQuantity",
1129
- "avgPrice",
1130
- "discountsAmount",
1131
- "inclusiveTaxesAmount",
1132
- "salesAmountNet",
1133
- "salesMixPct"
1134
- ];
1135
- var productMixConfig = {
1136
- fields: FIELDS4,
1137
- availableColumns: PRODUCT_MIX_AVAILABLE_COLUMNS,
1138
- defaultVisibleColumns: PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS
1139
- };
1140
-
1141
- // src/reports/modifierMix.ts
1142
- var FIRST_COLUMN_WIDTH3 = 240;
1143
- var FIELDS5 = {
1144
- groupById: { type: "string", filteringAvailable: false },
1145
- groupByName: { type: "string", size: FIRST_COLUMN_WIDTH3, filteringAvailable: false },
1146
- groupById2: { type: "string", filteringAvailable: false },
1147
- groupByName2: { type: "string", size: FIRST_COLUMN_WIDTH3, filteringAvailable: false },
1148
- modifiersSales: { type: "money", columnKey: "totalModifierSales" },
1149
- modifiersQuantity: { type: "number", columnKey: "modifierQuantity" },
1150
- itemsQuantity: {
1151
- type: "number",
1152
- columnKey: "quantity",
1153
- filteringAvailable: false
1371
+ totalSales: {
1372
+ titleKey: "common.report-col.total-sales",
1373
+ shortTitleKey: "common.report-col.total-sales.short",
1374
+ infoTextKey: "common.report-col.total-sales.info"
1375
+ },
1376
+ totalTips: {
1377
+ titleKey: "common.report-col.total-tips",
1378
+ shortTitleKey: "common.report-col.total-tips.short",
1379
+ infoTextKey: "common.report-col.total-tips.info"
1380
+ },
1381
+ transactionDate: {
1382
+ titleKey: "common.report-col.transaction-date",
1383
+ shortTitleKey: "common.report-col.transaction-date.short",
1384
+ infoTextKey: "common.report-col.transaction-date.info"
1385
+ },
1386
+ transactionType: {
1387
+ titleKey: "common.report-col.transaction-type",
1388
+ shortTitleKey: "common.report-col.transaction-type.short",
1389
+ infoTextKey: "common.report-col.transaction-type.info"
1390
+ },
1391
+ untaxedSales: {
1392
+ titleKey: "common.report-col.untaxed-sales",
1393
+ shortTitleKey: "common.report-col.untaxed-sales.short",
1394
+ infoTextKey: "common.report-col.untaxed-sales.info"
1154
1395
  },
1155
- avgGross: {
1156
- type: "money",
1157
- columnKey: "averageGrossPrice",
1158
- footerCalculation: {
1159
- type: "average",
1160
- numeratorField: "modifiersSales",
1161
- denominatorField: "modifiersQuantity"
1162
- }
1396
+ visa: {
1397
+ titleKey: "common.report-col.visa",
1398
+ shortTitleKey: "common.report-col.visa.short",
1399
+ infoTextKey: "common.report-col.visa.info"
1163
1400
  },
1164
- attachRate: {
1165
- type: "percent",
1166
- columnKey: "attachRate",
1167
- footerCalculation: {
1168
- type: "average",
1169
- numeratorField: "modifiersQuantity",
1170
- denominatorField: "itemsQuantity"
1171
- }
1401
+ visaReturns: {
1402
+ titleKey: "common.report-col.visa-returns",
1403
+ shortTitleKey: "common.report-col.visa-returns.short",
1404
+ infoTextKey: "common.report-col.visa-returns.info"
1172
1405
  },
1173
- modifiersSalesComp: { type: "money", filteringAvailable: false },
1174
- modifiersQuantityComp: { type: "number", filteringAvailable: false },
1175
- itemsQuantityComp: { type: "number", filteringAvailable: false },
1176
- attachRateComp: { type: "percent", filteringAvailable: false },
1177
- modifiersSalesVar: { type: "money", filteringAvailable: false },
1178
- modifiersSalesVarPct: {
1179
- type: "percent",
1180
- filteringAvailable: false,
1181
- footerCalculation: {
1182
- type: "percentChange",
1183
- numeratorField: "modifiersSales",
1184
- denominatorField: "modifiersSalesComp"
1185
- }
1406
+ paymentsCount: {
1407
+ titleKey: "common.report-col.payments-count",
1408
+ shortTitleKey: "common.report-col.payments-count.short",
1409
+ infoTextKey: "common.report-col.payments-count.info"
1186
1410
  },
1187
- modifiersQuantityVar: { type: "number", filteringAvailable: false },
1188
- modifiersQuantityVarPct: {
1189
- type: "percent",
1190
- filteringAvailable: false,
1191
- footerCalculation: {
1192
- type: "percentChange",
1193
- numeratorField: "modifiersQuantity",
1194
- denominatorField: "modifiersQuantityComp"
1195
- }
1411
+ paymentsAmount: {
1412
+ titleKey: "common.report-col.payments-amount",
1413
+ shortTitleKey: "common.report-col.payments-amount.short",
1414
+ infoTextKey: "common.report-col.payments-amount.info"
1196
1415
  },
1197
- attachRateVar: { type: "percent", filteringAvailable: false },
1198
- attachRateVarPct: {
1199
- type: "percent",
1200
- filteringAvailable: false,
1201
- footerCalculation: {
1202
- type: "percentChange",
1203
- numeratorField: "attachRate",
1204
- denominatorField: "attachRateComp"
1205
- }
1206
- }
1207
- };
1208
- var MODIFIER_MIX_AVAILABLE_COLUMNS = ["modifiersSales", "modifiersQuantity", "avgGross"];
1209
- var MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS = MODIFIER_MIX_AVAILABLE_COLUMNS;
1210
- var modifierMixConfig = {
1211
- fields: FIELDS5,
1212
- availableColumns: MODIFIER_MIX_AVAILABLE_COLUMNS,
1213
- defaultVisibleColumns: MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS
1214
- };
1215
-
1216
- // src/reports/itemTax.ts
1217
- var FIELDS6 = {
1218
- locationId: { type: "number", filteringAvailable: false },
1219
- taxIsFlat: { type: "boolean", filteringAvailable: false },
1220
- merchantId: { type: "string", columnKey: "locationMid", filteringAvailable: false },
1221
- locationName: { type: "string", columnKey: "locationName", filteringAvailable: false },
1222
- locationCity: { type: "string", columnKey: "locationCity", filteringAvailable: false },
1223
- locationState: { type: "string", columnKey: "locationState", filteringAvailable: false },
1224
- itemName: { type: "string", columnKey: "itemName", filteringAvailable: false },
1225
- itemPrice: { type: "money", columnKey: "itemPrice" },
1226
- departmentName: { type: "string", columnKey: "department", filteringAvailable: false },
1227
- revenueClassName: { type: "string", columnKey: "revenueClass", filteringAvailable: false },
1228
- orderTypeName: { type: "string", columnKey: "orderType", filteringAvailable: false },
1229
- taxName: { type: "string", columnKey: "taxName", filteringAvailable: false },
1230
- taxValue: { type: "money", columnKey: "taxableSales" },
1231
- taxRate: { type: "number", columnKey: "taxRate" },
1232
- recordsCount: { type: "number", columnKey: "quantity" },
1233
- taxableSales: { type: "money", columnKey: "taxableSales" },
1234
- totalCollected: { type: "money", columnKey: "totalCollected" },
1235
- itemTax: { type: "money", columnKey: "taxCollected" },
1236
- taxCollected: { type: "money", columnKey: "taxCollected" }
1237
- };
1238
- var ITEM_TAX_AVAILABLE_COLUMNS = [
1239
- "merchantId",
1240
- "locationName",
1241
- "locationCity",
1242
- "locationState",
1243
- "itemName",
1244
- "departmentName",
1245
- "revenueClassName",
1246
- "orderTypeName",
1247
- "recordsCount",
1248
- "itemPrice",
1249
- "taxName",
1250
- "taxRate",
1251
- "taxableSales",
1252
- "taxCollected"
1253
- ];
1254
- var ITEM_TAX_DEFAULT_VISIBLE_COLUMNS = ITEM_TAX_AVAILABLE_COLUMNS;
1255
- var itemTaxConfig = {
1256
- fields: FIELDS6,
1257
- availableColumns: ITEM_TAX_AVAILABLE_COLUMNS,
1258
- defaultVisibleColumns: ITEM_TAX_DEFAULT_VISIBLE_COLUMNS
1259
- };
1260
-
1261
- // src/reports/dailySales.ts
1262
- var FIRST_COLUMN_WIDTH4 = 240;
1263
- var FIELDS7 = {
1264
- groupById: { type: "string" },
1265
- groupByName: { type: "string", size: FIRST_COLUMN_WIDTH4 },
1266
- itemsQuantity: { type: "number", columnKey: "quantity" },
1267
- salesAmountGross: { type: "money", columnKey: "grossSales" },
1268
- discountsAmount: { type: "money", columnKey: "discountAmount" },
1269
- inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
1270
- salesAmountNet: { type: "money", columnKey: "netSales" },
1271
- salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
1272
- avgPrice: {
1273
- type: "fixedNumber",
1274
- columnKey: "averageGrossPrice",
1275
- footerCalculation: {
1276
- type: "average",
1277
- numeratorField: "salesAmountGross",
1278
- denominatorField: "itemsQuantity"
1279
- }
1416
+ paymentsTotal: {
1417
+ titleKey: "common.report-col.payments-total",
1418
+ shortTitleKey: "common.report-col.payments-total.short",
1419
+ infoTextKey: "common.report-col.payments-total.info"
1420
+ },
1421
+ refundVoidDescription: {
1422
+ titleKey: "common.report-col.refund-void-description",
1423
+ shortTitleKey: "common.report-col.refund-void-description.short",
1424
+ infoTextKey: "common.report-col.refund-void-description.info"
1425
+ },
1426
+ refundVoidCount: {
1427
+ titleKey: "common.report-col.refund-void-count",
1428
+ shortTitleKey: "common.report-col.refund-void-count.short",
1429
+ infoTextKey: "common.report-col.refund-void-count.info"
1430
+ },
1431
+ refundVoidAmount: {
1432
+ titleKey: "common.report-col.refund-void-amount",
1433
+ shortTitleKey: "common.report-col.refund-void-amount.short",
1434
+ infoTextKey: "common.report-col.refund-void-amount.info"
1435
+ },
1436
+ refundVoidPctSales: {
1437
+ titleKey: "common.report-col.refund-void-pct-sales",
1438
+ shortTitleKey: "common.report-col.refund-void-pct-sales.short",
1439
+ infoTextKey: "common.report-col.refund-void-pct-sales.info"
1440
+ },
1441
+ discountName: {
1442
+ titleKey: "common.report-col.discount-name",
1443
+ shortTitleKey: "common.report-col.discount-name.short",
1444
+ infoTextKey: "common.report-col.discount-name.info"
1445
+ },
1446
+ tickets: {
1447
+ titleKey: "common.report-col.tickets",
1448
+ shortTitleKey: "common.report-col.tickets.short",
1449
+ infoTextKey: "common.report-col.tickets.info"
1450
+ },
1451
+ guests: {
1452
+ titleKey: "common.report-col.guests",
1453
+ shortTitleKey: "common.report-col.guests.short",
1454
+ infoTextKey: "common.report-col.guests.info"
1280
1455
  },
1281
- ticketsCount: { type: "number", columnKey: "tickets" },
1282
- guestsCount: { type: "number", columnKey: "guests" },
1283
1456
  ticketAverage: {
1284
- type: "money",
1285
- columnKey: "ticketAverage",
1286
- footerCalculation: {
1287
- type: "average",
1288
- numeratorField: "salesAmountNet",
1289
- denominatorField: "ticketsCount"
1290
- }
1457
+ titleKey: "common.report-col.ticket-average",
1458
+ shortTitleKey: "common.report-col.ticket-average.short",
1459
+ infoTextKey: "common.report-col.ticket-average.info"
1291
1460
  },
1292
1461
  guestAverage: {
1293
- type: "money",
1294
- columnKey: "guestAverage",
1295
- footerCalculation: {
1296
- type: "average",
1297
- numeratorField: "salesAmountNet",
1298
- denominatorField: "guestsCount"
1299
- }
1300
- },
1301
- ticketAvg: {
1302
- type: "money",
1303
- columnKey: "ticketAverage",
1304
- footerCalculation: {
1305
- type: "average",
1306
- numeratorField: "salesAmountNet",
1307
- denominatorField: "ticketsCount"
1308
- }
1462
+ titleKey: "common.report-col.guest-average",
1463
+ shortTitleKey: "common.report-col.guest-average.short",
1464
+ infoTextKey: "common.report-col.guest-average.info"
1309
1465
  },
1310
- guestAvg: {
1311
- type: "money",
1312
- columnKey: "guestAverage",
1313
- footerCalculation: {
1314
- type: "average",
1315
- numeratorField: "salesAmountNet",
1316
- denominatorField: "guestsCount"
1317
- }
1318
- }
1319
- };
1320
- var DAILY_SALES_AVAILABLE_COLUMNS = [
1321
- "itemsQuantity",
1322
- "salesAmountGross",
1323
- "discountsAmount",
1324
- "salesAmountNet",
1325
- "salesMixPct"
1326
- ];
1327
- var DAILY_SALES_BY_GROUP_AVAILABLE_COLUMNS = [
1328
- "ticketsCount",
1329
- "guestsCount",
1330
- "ticketAverage",
1331
- "guestAverage",
1332
- "salesAmountNet"
1333
- ];
1334
- var DAILY_SALES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_AVAILABLE_COLUMNS;
1335
- var dailySalesConfig = {
1336
- fields: FIELDS7,
1337
- availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
1338
- defaultVisibleColumns: DAILY_SALES_DEFAULT_VISIBLE_COLUMNS
1339
- };
1340
- var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
1341
- "ticketsCount",
1342
- "guestsCount",
1343
- "ticketAvg",
1344
- "guestAvg",
1345
- "salesAmountNet"
1346
- ];
1347
- var dailySalesTrendsConfig = {
1348
- fields: FIELDS7,
1349
- availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
1350
- defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS
1466
+ net: {
1467
+ titleKey: "common.report-col.net",
1468
+ shortTitleKey: "common.report-col.net.short",
1469
+ infoTextKey: "common.report-col.net.info"
1470
+ }
1351
1471
  };
1472
+ function getColumnMetadata(key) {
1473
+ return COLUMN_REGISTRY[key];
1474
+ }
1352
1475
 
1353
- // src/reports/dailySalesPayments.ts
1354
- var FIRST_COLUMN_WIDTH5 = 240;
1355
- var FIELDS8 = {
1356
- paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH5 },
1357
- paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
1358
- paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
1359
- tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
1360
- totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
1361
- };
1362
- var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
1363
- "paymentsCount",
1364
- "paymentsAmount",
1365
- "tipsAmount",
1366
- "totalSales"
1367
- ];
1368
- var DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS;
1369
- var dailySalesPaymentsConfig = {
1370
- fields: FIELDS8,
1371
- availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
1372
- defaultVisibleColumns: DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS
1373
- };
1476
+ // src/utils/alignment.ts
1477
+ function getColumnAlignment(type) {
1478
+ if (type === "string" || type === "date" || type === "time") {
1479
+ return "left";
1480
+ }
1481
+ return "right";
1482
+ }
1483
+ function isNumericType(type) {
1484
+ return type === "money" || type === "number" || type === "percent" || type === "fixedNumber";
1485
+ }
1374
1486
 
1375
- // src/reports/dailySalesDiscounts.ts
1376
- var FIRST_COLUMN_WIDTH6 = 240;
1377
- var FIELDS9 = {
1378
- discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH6 },
1379
- discountsCount: { type: "number", columnKey: "discountCount", footerCalculation: { type: "sum" } },
1380
- discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
1381
- };
1382
- var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
1383
- "discountsCount",
1384
- "discountsAmount"
1385
- ];
1386
- var DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS;
1387
- var dailySalesDiscountsConfig = {
1388
- fields: FIELDS9,
1389
- availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
1390
- defaultVisibleColumns: DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS
1391
- };
1487
+ // src/totals.ts
1488
+ function calculateReportTotals(data, fieldConfig, opts) {
1489
+ const rows = data;
1490
+ const { labelField, label } = opts;
1491
+ const fieldsToSum = /* @__PURE__ */ new Set();
1492
+ const derivedFields = [];
1493
+ for (const [field, config] of Object.entries(fieldConfig)) {
1494
+ const { type, columnKey, footerCalculation: calc } = config;
1495
+ if (!type || type === "string" || type === "date" || type === "time" || type === "boolean") {
1496
+ continue;
1497
+ }
1498
+ if (calc?.type === "none") {
1499
+ } else if (!calc || calc.type === "sum") {
1500
+ if (columnKey || calc?.type === "sum") {
1501
+ fieldsToSum.add(field);
1502
+ }
1503
+ } else {
1504
+ derivedFields.push({ field, calc });
1505
+ if (calc.numeratorField) fieldsToSum.add(calc.numeratorField);
1506
+ if (calc.denominatorField) fieldsToSum.add(calc.denominatorField);
1507
+ }
1508
+ }
1509
+ const sums = {};
1510
+ for (const field of fieldsToSum) {
1511
+ sums[field] = rows.reduce((acc, row) => acc + (row[field] ?? 0), 0);
1512
+ }
1513
+ const derived = {};
1514
+ for (const { field, calc } of derivedFields) {
1515
+ const num = sums[calc.numeratorField ?? ""] ?? 0;
1516
+ const den = sums[calc.denominatorField ?? ""] ?? 0;
1517
+ if (calc.type === "percentChange") {
1518
+ derived[field] = den ? (num - den) / den : 0;
1519
+ } else if (calc.type === "average") {
1520
+ derived[field] = den > 0 ? num / den : 0;
1521
+ }
1522
+ }
1523
+ const result = {};
1524
+ for (const [field, config] of Object.entries(fieldConfig)) {
1525
+ const { type } = config;
1526
+ if (!type || type === "string" || type === "date" || type === "time") {
1527
+ result[field] = "";
1528
+ } else if (type === "boolean") {
1529
+ result[field] = false;
1530
+ } else {
1531
+ result[field] = 0;
1532
+ }
1533
+ }
1534
+ result[labelField] = label;
1535
+ for (const [field, value] of Object.entries(sums)) {
1536
+ result[field] = value;
1537
+ }
1538
+ for (const [field, value] of Object.entries(derived)) {
1539
+ result[field] = value;
1540
+ }
1541
+ return result;
1542
+ }
1392
1543
 
1393
1544
  // src/reports/dailySalesRefundsVoids.ts
1394
- var FIRST_COLUMN_WIDTH7 = 240;
1395
- var FIELDS10 = {
1396
- description: { type: "string", columnKey: "refundVoidDescription", size: FIRST_COLUMN_WIDTH7 },
1545
+ var FIRST_COLUMN_WIDTH8 = 240;
1546
+ var FIELDS12 = {
1547
+ description: { type: "string", columnKey: "refundVoidDescription", size: FIRST_COLUMN_WIDTH8 },
1397
1548
  count: { type: "number", columnKey: "refundVoidCount", footerCalculation: { type: "sum" } },
1398
1549
  amount: { type: "money", columnKey: "refundVoidAmount", footerCalculation: { type: "sum" } },
1399
1550
  pctSales: { type: "percent", columnKey: "refundVoidPctSales", footerCalculation: { type: "sum" } }
@@ -1405,15 +1556,15 @@ var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = [
1405
1556
  ];
1406
1557
  var DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS;
1407
1558
  var dailySalesRefundsVoidsConfig = {
1408
- fields: FIELDS10,
1559
+ fields: FIELDS12,
1409
1560
  availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
1410
1561
  defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS
1411
1562
  };
1412
1563
 
1413
1564
  // src/reports/dailySalesTaxes.ts
1414
- var FIRST_COLUMN_WIDTH8 = 240;
1415
- var FIELDS11 = {
1416
- taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH8 },
1565
+ var FIRST_COLUMN_WIDTH9 = 240;
1566
+ var FIELDS13 = {
1567
+ taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH9 },
1417
1568
  taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "sum" } },
1418
1569
  taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
1419
1570
  exemptSales: { type: "money", columnKey: "exemptTaxes", footerCalculation: { type: "sum" } }
@@ -1425,147 +1576,10 @@ var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = [
1425
1576
  ];
1426
1577
  var DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_TAXES_AVAILABLE_COLUMNS;
1427
1578
  var dailySalesTaxesConfig = {
1428
- fields: FIELDS11,
1579
+ fields: FIELDS13,
1429
1580
  availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
1430
1581
  defaultVisibleColumns: DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS
1431
1582
  };
1432
-
1433
- // src/reports/employeeTimecard.ts
1434
- var FIRST_COLUMN_WIDTH9 = 240;
1435
- var EMPLOYEE_NAME_WIDTH = 220;
1436
- var STATUS_WIDTH = 140;
1437
- var LOOKUP_WIDTH = 160;
1438
- var PAYROLL_WIDTH = 160;
1439
- var JOB_WIDTH = 200;
1440
- var FIELDS12 = {
1441
- locationId: {
1442
- type: "number",
1443
- enableSorting: false,
1444
- filteringAvailable: false
1445
- },
1446
- locationName: {
1447
- type: "string",
1448
- size: FIRST_COLUMN_WIDTH9,
1449
- columnKey: "locationName"
1450
- },
1451
- businessDate: {
1452
- type: "date",
1453
- columnKey: "date"
1454
- },
1455
- employeeName: {
1456
- type: "string",
1457
- size: EMPLOYEE_NAME_WIDTH,
1458
- columnKey: "employeeName"
1459
- },
1460
- isActive: {
1461
- type: "string",
1462
- size: STATUS_WIDTH,
1463
- columnKey: "status",
1464
- enableSorting: false,
1465
- filteringAvailable: false
1466
- },
1467
- lookup: {
1468
- type: "string",
1469
- size: LOOKUP_WIDTH,
1470
- columnKey: "employeeId"
1471
- },
1472
- payrollCode: {
1473
- type: "string",
1474
- size: PAYROLL_WIDTH,
1475
- columnKey: "payrollId"
1476
- },
1477
- jobName: {
1478
- type: "string",
1479
- size: JOB_WIDTH,
1480
- columnKey: "employeeJob"
1481
- },
1482
- isBreak: {
1483
- type: "string",
1484
- enableSorting: false,
1485
- filteringAvailable: false
1486
- },
1487
- startTime: {
1488
- type: "string",
1489
- columnKey: "clockInTime"
1490
- },
1491
- endTime: {
1492
- type: "string",
1493
- columnKey: "clockOutTime"
1494
- },
1495
- shiftHours: {
1496
- type: "fixedNumber",
1497
- columnKey: "shiftDurationHrs",
1498
- filteringAvailable: false
1499
- }
1500
- };
1501
- var EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS = [
1502
- "locationName",
1503
- "businessDate",
1504
- "employeeName",
1505
- "isActive",
1506
- "lookup",
1507
- "payrollCode",
1508
- "jobName",
1509
- "startTime",
1510
- "endTime",
1511
- "shiftHours"
1512
- ];
1513
- var EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS = EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS;
1514
- var employeeTimecardConfig = {
1515
- fields: FIELDS12,
1516
- availableColumns: EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS,
1517
- defaultVisibleColumns: EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS,
1518
- columnGroups: []
1519
- // No column groups for this report
1520
- };
1521
-
1522
- // src/reports/salesByItemDetail.ts
1523
- var FIELDS13 = {
1524
- businessDate: { type: "date", columnKey: "date", filteringAvailable: false },
1525
- ticketClosedAt: { type: "string", columnKey: "ticketClosed", filteringAvailable: false },
1526
- hourId: { type: "number", columnKey: "hour", filteringAvailable: false },
1527
- daypartName: { type: "string", columnKey: "daypart", filteringAvailable: false },
1528
- locationId: { type: "number", columnKey: "locationId", filteringAvailable: false },
1529
- locationName: { type: "string", columnKey: "locationName", filteringAvailable: false },
1530
- departmentName: { type: "string", columnKey: "department", filteringAvailable: false },
1531
- itemName: { type: "string", columnKey: "itemName", filteringAvailable: false },
1532
- revenueCenterName: { type: "string", columnKey: "revenueCenter", filteringAvailable: false },
1533
- revenueClassName: { type: "string", columnKey: "revenueClass", filteringAvailable: false },
1534
- salesAmountGross: { type: "money", columnKey: "grossSales" },
1535
- itemsQuantity: { type: "number", columnKey: "quantity" },
1536
- transactionId: { type: "string", columnKey: "ticketNumber", filteringAvailable: false },
1537
- guestsCount: { type: "number", columnKey: "guestCount" },
1538
- employeeName: { type: "string", columnKey: "employeeName", filteringAvailable: false },
1539
- orderTypeName: { type: "string", columnKey: "orderType", filteringAvailable: false },
1540
- salesType: { type: "string", columnKey: "salePaymentType", filteringAvailable: false },
1541
- itemPrice: { type: "money", columnKey: "itemPrice" }
1542
- };
1543
- var SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS = [
1544
- "businessDate",
1545
- "ticketClosedAt",
1546
- "hourId",
1547
- "daypartName",
1548
- "locationId",
1549
- "locationName",
1550
- "departmentName",
1551
- "itemName",
1552
- "revenueCenterName",
1553
- "revenueClassName",
1554
- "salesAmountGross",
1555
- "itemsQuantity",
1556
- "transactionId",
1557
- "guestsCount",
1558
- "employeeName",
1559
- "orderTypeName",
1560
- "salesType",
1561
- "itemPrice"
1562
- ];
1563
- var SALES_BY_ITEM_DETAIL_DEFAULT_VISIBLE_COLUMNS = SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS;
1564
- var salesByItemDetailConfig = {
1565
- fields: FIELDS13,
1566
- availableColumns: SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS,
1567
- defaultVisibleColumns: SALES_BY_ITEM_DETAIL_DEFAULT_VISIBLE_COLUMNS
1568
- };
1569
1583
  // Annotate the CommonJS export names for ESM import in node:
1570
1584
  0 && (module.exports = {
1571
1585
  COLUMN_REGISTRY,
@@ -1609,6 +1623,7 @@ var salesByItemDetailConfig = {
1609
1623
  employeeTimecardConfig,
1610
1624
  getColumnAlignment,
1611
1625
  getColumnMetadata,
1626
+ getReportConfig,
1612
1627
  isNumericType,
1613
1628
  itemTaxConfig,
1614
1629
  modifierMixConfig,