@harbortouch/skytab-analytics-report-utils 0.21.1 → 0.22.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/{chunk-Y7HQPSMO.js → chunk-2UW4QVTT.js} +668 -585
- package/dist/exporters/exportBuilder.cjs +2864 -2781
- package/dist/exporters/exportBuilder.d.cts +1 -1
- package/dist/exporters/exportBuilder.d.ts +1 -1
- package/dist/exporters/exportBuilder.js +5 -8
- package/dist/index.cjs +160 -104
- package/dist/index.d.cts +5 -15
- package/dist/index.d.ts +5 -15
- package/dist/index.js +4 -33
- package/dist/{report-cTbF3q_4.d.cts → report-DklnjPk7.d.cts} +12 -5
- package/dist/{report-cTbF3q_4.d.ts → report-DklnjPk7.d.ts} +12 -5
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-DklnjPk7.cjs';
|
|
2
2
|
import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.cjs';
|
|
3
3
|
|
|
4
4
|
interface ReportDocumentSection {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-DklnjPk7.js';
|
|
2
2
|
import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.js';
|
|
3
3
|
|
|
4
4
|
interface ReportDocumentSection {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
calculateReportTotals,
|
|
3
|
-
en_US_default,
|
|
4
3
|
formatFieldValue,
|
|
5
4
|
getColumnExportHeaderLabel,
|
|
6
5
|
getColumnMetadata,
|
|
7
6
|
getReportConfig,
|
|
8
7
|
getReportFormattingLocaleOptions,
|
|
9
8
|
resolveTranslate
|
|
10
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-2UW4QVTT.js";
|
|
11
10
|
|
|
12
11
|
// src/exporters/exportBuilder.ts
|
|
13
12
|
import { format, isValid, parseISO } from "date-fns";
|
|
@@ -112,8 +111,7 @@ var ExportBuilder = class {
|
|
|
112
111
|
if (!config || value === void 0 || value === null) {
|
|
113
112
|
return "";
|
|
114
113
|
}
|
|
115
|
-
|
|
116
|
-
return typeof formatted === "string" && formatted in en_US_default ? this.translate(formatted) : formatted;
|
|
114
|
+
return formatFieldValue(value, config.type, localeOption, fullRecord, config);
|
|
117
115
|
}
|
|
118
116
|
formatRow(raw, columns, columnTypes, localeConfig, fullRecord) {
|
|
119
117
|
const formatted = {};
|
|
@@ -123,22 +121,21 @@ var ExportBuilder = class {
|
|
|
123
121
|
return formatted;
|
|
124
122
|
}
|
|
125
123
|
resolveLabelField(config, columns) {
|
|
126
|
-
if ("groupByName"
|
|
124
|
+
if (columns.includes("groupByName")) {
|
|
127
125
|
return "groupByName";
|
|
128
126
|
}
|
|
129
127
|
const firstStringCol = columns.find((col) => {
|
|
130
128
|
const field = config.fields[col];
|
|
131
129
|
return field?.type === "string" && !field.footerCalculation;
|
|
132
130
|
});
|
|
133
|
-
return firstStringCol ?? columns[0]
|
|
131
|
+
return firstStringCol ?? columns[0];
|
|
134
132
|
}
|
|
135
133
|
buildTotalsRow(data, config, columns) {
|
|
136
134
|
if (data.length === 0) {
|
|
137
135
|
return null;
|
|
138
136
|
}
|
|
139
137
|
const labelField = this.resolveLabelField(config, columns);
|
|
140
|
-
|
|
141
|
-
return calculateReportTotals(data, config.fields, { labelField, label });
|
|
138
|
+
return calculateReportTotals(data, config.fields, { labelField, label: this.translate("table.total") });
|
|
142
139
|
}
|
|
143
140
|
getExtraFooterRows(data, config, sectionData, columns) {
|
|
144
141
|
if (config.extraFooterRowsKey) {
|
package/dist/index.cjs
CHANGED
|
@@ -28,12 +28,10 @@ __export(index_exports, {
|
|
|
28
28
|
TENDER_TYPE: () => TENDER_TYPE,
|
|
29
29
|
buildDailySalesCashPayments: () => buildDailySalesCashPayments,
|
|
30
30
|
buildDailySalesRevClassFooter: () => buildDailySalesRevClassFooter,
|
|
31
|
-
calculateFieldTotal: () => calculateFieldTotal,
|
|
32
31
|
calculateReportTotals: () => calculateReportTotals,
|
|
33
32
|
dailySalesCacheConfig: () => dailySalesCacheConfig,
|
|
34
33
|
dailySalesConfig: () => dailySalesConfig,
|
|
35
34
|
dailySalesDiscountsConfig: () => dailySalesDiscountsConfig,
|
|
36
|
-
dailySalesLiveConfig: () => dailySalesLiveConfig,
|
|
37
35
|
dailySalesPaymentsConfig: () => dailySalesPaymentsConfig,
|
|
38
36
|
dailySalesRefundsVoidsConfig: () => dailySalesRefundsVoidsConfig,
|
|
39
37
|
dailySalesTaxesConfig: () => dailySalesTaxesConfig,
|
|
@@ -54,6 +52,7 @@ __export(index_exports, {
|
|
|
54
52
|
getColumnExportHeaderLabel: () => getColumnExportHeaderLabel,
|
|
55
53
|
getColumnMetadata: () => getColumnMetadata,
|
|
56
54
|
getDateToFormat: () => getDateToFormat,
|
|
55
|
+
getFooterValue: () => getFooterValue,
|
|
57
56
|
getNumberToFormat: () => getNumberToFormat,
|
|
58
57
|
getReportConfig: () => getReportConfig,
|
|
59
58
|
getReportExportFileName: () => getReportExportFileName,
|
|
@@ -124,7 +123,7 @@ var FIRST_COLUMN_WIDTH = 240;
|
|
|
124
123
|
// src/reports/salesSummary.ts
|
|
125
124
|
var FIELDS2 = {
|
|
126
125
|
groupById: { type: "number" },
|
|
127
|
-
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
126
|
+
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH, footerCalculation: { type: "label", label: "table.total" } },
|
|
128
127
|
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
129
128
|
salesVarLW: { type: "money", columnKey: "salesVarLw" },
|
|
130
129
|
salesVarLY: { type: "money", columnKey: "salesVarLy" },
|
|
@@ -233,6 +232,7 @@ var COLUMN_GROUPS = [
|
|
|
233
232
|
}
|
|
234
233
|
];
|
|
235
234
|
var SALES_SUMMARY_AVAILABLE_COLUMNS = [
|
|
235
|
+
"groupByName",
|
|
236
236
|
"salesAmountNet",
|
|
237
237
|
"salesVarLW",
|
|
238
238
|
"salesVarLWPct",
|
|
@@ -258,72 +258,87 @@ var salesSummaryConfig = {
|
|
|
258
258
|
|
|
259
259
|
// src/reports/ticketSummary.ts
|
|
260
260
|
var FIELDS3 = {
|
|
261
|
-
ticketId: { type: "string" },
|
|
262
|
-
locationId: { type: "number" },
|
|
263
|
-
orderName: { type: "string" },
|
|
264
|
-
revenueCenterName: { type: "string", columnKey: "revenueCenter" },
|
|
265
|
-
daypartName: { type: "string", columnKey: "daypart" },
|
|
261
|
+
ticketId: { type: "string", filteringAvailable: false },
|
|
262
|
+
locationId: { type: "number", filteringAvailable: false },
|
|
263
|
+
orderName: { type: "string", filteringAvailable: false },
|
|
264
|
+
revenueCenterName: { type: "string", columnKey: "revenueCenter", filteringAvailable: false },
|
|
265
|
+
daypartName: { type: "string", columnKey: "daypart", filteringAvailable: false },
|
|
266
266
|
inclusiveTaxesAmount: {
|
|
267
267
|
type: "money",
|
|
268
268
|
columnKey: "inclusiveTax",
|
|
269
|
-
footerCalculation: { type: "sum" }
|
|
269
|
+
footerCalculation: { type: "sum" },
|
|
270
|
+
filteringAvailable: false
|
|
270
271
|
},
|
|
271
|
-
locationName: { type: "string", size: 240, columnKey: "locationName" },
|
|
272
|
-
orderNumber: {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
locationName: { type: "string", size: 240, columnKey: "locationName", filteringAvailable: false },
|
|
273
|
+
orderNumber: {
|
|
274
|
+
type: "string",
|
|
275
|
+
columnKey: "ticketNumber",
|
|
276
|
+
footerCalculation: { type: "label", label: "table.total" },
|
|
277
|
+
filteringAvailable: false
|
|
278
|
+
},
|
|
279
|
+
businessDate: { type: "date", columnKey: "date", filteringAvailable: false },
|
|
280
|
+
ticketOpenedAt: { type: "time", columnKey: "ticketOpen", filteringAvailable: false },
|
|
281
|
+
ticketClosedAt: { type: "time", columnKey: "ticketClosed", filteringAvailable: false },
|
|
282
|
+
ticketTime: { type: "number", columnKey: "timeOpenMins", enableSorting: false, filteringAvailable: false },
|
|
277
283
|
ticketSubtotal: {
|
|
278
284
|
type: "money",
|
|
279
285
|
columnKey: "subtotal",
|
|
280
|
-
footerCalculation: { type: "sum" }
|
|
286
|
+
footerCalculation: { type: "sum" },
|
|
287
|
+
filteringAvailable: false
|
|
281
288
|
},
|
|
282
289
|
discountsAmount: {
|
|
283
290
|
type: "money",
|
|
284
291
|
columnKey: "discountAmount",
|
|
285
|
-
footerCalculation: { type: "sum" }
|
|
292
|
+
footerCalculation: { type: "sum" },
|
|
293
|
+
filteringAvailable: false
|
|
286
294
|
},
|
|
287
295
|
surchargesAmount: {
|
|
288
296
|
type: "money",
|
|
289
297
|
columnKey: "ticketFee",
|
|
290
|
-
footerCalculation: { type: "sum" }
|
|
298
|
+
footerCalculation: { type: "sum" },
|
|
299
|
+
filteringAvailable: false
|
|
291
300
|
},
|
|
292
301
|
taxesAmount: {
|
|
293
302
|
type: "money",
|
|
294
303
|
columnKey: "taxCollected",
|
|
295
|
-
footerCalculation: { type: "sum" }
|
|
304
|
+
footerCalculation: { type: "sum" },
|
|
305
|
+
filteringAvailable: false
|
|
296
306
|
},
|
|
297
307
|
ticketGrandTotal: {
|
|
298
308
|
type: "money",
|
|
299
309
|
columnKey: "grandTotal",
|
|
300
|
-
footerCalculation: { type: "sum" }
|
|
310
|
+
footerCalculation: { type: "sum" },
|
|
311
|
+
filteringAvailable: false
|
|
301
312
|
},
|
|
302
313
|
gratuitiesAmount: {
|
|
303
314
|
type: "money",
|
|
304
315
|
columnKey: "autoGratuity",
|
|
305
|
-
footerCalculation: { type: "sum" }
|
|
316
|
+
footerCalculation: { type: "sum" },
|
|
317
|
+
filteringAvailable: false
|
|
306
318
|
},
|
|
307
319
|
tipAmount: {
|
|
308
320
|
type: "money",
|
|
309
321
|
columnKey: "tips",
|
|
310
|
-
footerCalculation: { type: "sum" }
|
|
322
|
+
footerCalculation: { type: "sum" },
|
|
323
|
+
filteringAvailable: false
|
|
311
324
|
},
|
|
312
325
|
paymentsAmount: {
|
|
313
326
|
type: "money",
|
|
314
327
|
columnKey: "totalCollected",
|
|
315
|
-
footerCalculation: { type: "sum" }
|
|
328
|
+
footerCalculation: { type: "sum" },
|
|
329
|
+
filteringAvailable: false
|
|
316
330
|
},
|
|
317
|
-
paymentTypeName: { type: "string", columnKey: "paymentType" },
|
|
331
|
+
paymentTypeName: { type: "string", columnKey: "paymentType", filteringAvailable: false },
|
|
318
332
|
guestsCount: {
|
|
319
333
|
type: "number",
|
|
320
334
|
columnKey: "guestCount",
|
|
321
|
-
footerCalculation: { type: "sum" }
|
|
335
|
+
footerCalculation: { type: "sum" },
|
|
336
|
+
filteringAvailable: false
|
|
322
337
|
},
|
|
323
|
-
employeeName: { type: "string", columnKey: "employeeName" },
|
|
324
|
-
orderTypeName: { type: "string", columnKey: "orderType" }
|
|
338
|
+
employeeName: { type: "string", columnKey: "employeeName", filteringAvailable: false },
|
|
339
|
+
orderTypeName: { type: "string", columnKey: "orderType", filteringAvailable: false }
|
|
325
340
|
};
|
|
326
|
-
var
|
|
341
|
+
var TICKET_SUMMARY_VISIBLE_COLUMNS = [
|
|
327
342
|
"locationName",
|
|
328
343
|
"businessDate",
|
|
329
344
|
"ticketOpenedAt",
|
|
@@ -342,10 +357,11 @@ var TICKET_SUMMARY_AVAILABLE_COLUMNS = [
|
|
|
342
357
|
"employeeName",
|
|
343
358
|
"orderTypeName"
|
|
344
359
|
];
|
|
360
|
+
var TICKET_SUMMARY_AVAILABLE_COLUMNS = ["orderNumber", ...TICKET_SUMMARY_VISIBLE_COLUMNS];
|
|
345
361
|
var ticketSummaryConfig = {
|
|
346
362
|
fields: FIELDS3,
|
|
347
363
|
availableColumns: TICKET_SUMMARY_AVAILABLE_COLUMNS,
|
|
348
|
-
defaultVisibleColumns:
|
|
364
|
+
defaultVisibleColumns: TICKET_SUMMARY_VISIBLE_COLUMNS,
|
|
349
365
|
hasFooter: true
|
|
350
366
|
};
|
|
351
367
|
|
|
@@ -353,9 +369,9 @@ var ticketSummaryConfig = {
|
|
|
353
369
|
var FIELDS4 = {
|
|
354
370
|
locationName: { type: "string", columnKey: "locationName" },
|
|
355
371
|
orderNumber: {
|
|
356
|
-
type: "
|
|
372
|
+
type: "string",
|
|
357
373
|
columnKey: "ticketNumber",
|
|
358
|
-
footerCalculation: { type: "
|
|
374
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
359
375
|
},
|
|
360
376
|
dateOpen: { type: "string", columnKey: "date" },
|
|
361
377
|
timeOpen: { type: "string", columnKey: "ticketOpen" },
|
|
@@ -380,9 +396,8 @@ var FIELDS4 = {
|
|
|
380
396
|
employeeName: { type: "string", columnKey: "employeeName" },
|
|
381
397
|
orderType: { type: "string", columnKey: "orderType" }
|
|
382
398
|
};
|
|
383
|
-
var
|
|
399
|
+
var TICKET_LIVE_VISIBLE_COLUMNS = [
|
|
384
400
|
"locationName",
|
|
385
|
-
"orderNumber",
|
|
386
401
|
"dateOpen",
|
|
387
402
|
"timeOpen",
|
|
388
403
|
"timeClose",
|
|
@@ -400,17 +415,18 @@ var TICKET_LIVE_AVAILABLE_COLUMNS = [
|
|
|
400
415
|
"employeeName",
|
|
401
416
|
"orderType"
|
|
402
417
|
];
|
|
418
|
+
var TICKET_LIVE_AVAILABLE_COLUMNS = ["orderNumber", ...TICKET_LIVE_VISIBLE_COLUMNS];
|
|
403
419
|
var ticketLiveConfig = {
|
|
404
420
|
fields: FIELDS4,
|
|
405
421
|
availableColumns: TICKET_LIVE_AVAILABLE_COLUMNS,
|
|
406
|
-
defaultVisibleColumns:
|
|
422
|
+
defaultVisibleColumns: TICKET_LIVE_VISIBLE_COLUMNS,
|
|
407
423
|
hasFooter: true
|
|
408
424
|
};
|
|
409
425
|
|
|
410
426
|
// src/reports/productMix.ts
|
|
411
427
|
var FIELDS5 = {
|
|
412
428
|
groupById: { type: "string" },
|
|
413
|
-
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
429
|
+
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH, footerCalculation: { type: "label", label: "table.total" } },
|
|
414
430
|
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
415
431
|
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
416
432
|
inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
|
|
@@ -427,7 +443,7 @@ var FIELDS5 = {
|
|
|
427
443
|
},
|
|
428
444
|
salesMixPct: { type: "percent", columnKey: "salesMixByPct" }
|
|
429
445
|
};
|
|
430
|
-
var
|
|
446
|
+
var PRODUCT_MIX_VISIBLE_COLUMNS = [
|
|
431
447
|
"salesAmountGross",
|
|
432
448
|
"itemsQuantity",
|
|
433
449
|
"avgPrice",
|
|
@@ -436,20 +452,31 @@ var PRODUCT_MIX_AVAILABLE_COLUMNS = [
|
|
|
436
452
|
"salesAmountNet",
|
|
437
453
|
"salesMixPct"
|
|
438
454
|
];
|
|
455
|
+
var PRODUCT_MIX_AVAILABLE_COLUMNS = ["groupByName", ...PRODUCT_MIX_VISIBLE_COLUMNS];
|
|
439
456
|
var productMixConfig = {
|
|
440
457
|
fields: FIELDS5,
|
|
441
458
|
availableColumns: PRODUCT_MIX_AVAILABLE_COLUMNS,
|
|
442
|
-
defaultVisibleColumns:
|
|
443
|
-
chartFields:
|
|
459
|
+
defaultVisibleColumns: PRODUCT_MIX_VISIBLE_COLUMNS,
|
|
460
|
+
chartFields: PRODUCT_MIX_VISIBLE_COLUMNS,
|
|
444
461
|
hasFooter: true
|
|
445
462
|
};
|
|
446
463
|
|
|
447
464
|
// src/reports/modifierMix.ts
|
|
448
465
|
var FIELDS6 = {
|
|
449
466
|
groupById: { type: "string", filteringAvailable: false },
|
|
450
|
-
groupByName: {
|
|
467
|
+
groupByName: {
|
|
468
|
+
type: "string",
|
|
469
|
+
size: FIRST_COLUMN_WIDTH,
|
|
470
|
+
filteringAvailable: false,
|
|
471
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
472
|
+
},
|
|
451
473
|
groupById2: { type: "string", filteringAvailable: false },
|
|
452
|
-
groupByName2: {
|
|
474
|
+
groupByName2: {
|
|
475
|
+
type: "string",
|
|
476
|
+
size: FIRST_COLUMN_WIDTH,
|
|
477
|
+
filteringAvailable: false,
|
|
478
|
+
footerCalculation: { type: "none" }
|
|
479
|
+
},
|
|
453
480
|
modifiersSales: { type: "money", columnKey: "totalModifierSales" },
|
|
454
481
|
modifiersQuantity: { type: "number", columnKey: "modifierQuantity" },
|
|
455
482
|
itemsQuantity: {
|
|
@@ -510,11 +537,16 @@ var FIELDS6 = {
|
|
|
510
537
|
}
|
|
511
538
|
}
|
|
512
539
|
};
|
|
513
|
-
var
|
|
540
|
+
var MODIFIER_MIX_VISIBLE_COLUMNS = ["modifiersSales", "modifiersQuantity", "avgGross"];
|
|
541
|
+
var MODIFIER_MIX_AVAILABLE_COLUMNS = [
|
|
542
|
+
"groupByName",
|
|
543
|
+
"groupByName2",
|
|
544
|
+
...MODIFIER_MIX_VISIBLE_COLUMNS
|
|
545
|
+
];
|
|
514
546
|
var modifierMixConfig = {
|
|
515
547
|
fields: FIELDS6,
|
|
516
548
|
availableColumns: MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
517
|
-
defaultVisibleColumns:
|
|
549
|
+
defaultVisibleColumns: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
518
550
|
hasFooter: true
|
|
519
551
|
};
|
|
520
552
|
|
|
@@ -596,7 +628,8 @@ var FIELDS8 = {
|
|
|
596
628
|
employeeName: {
|
|
597
629
|
type: "string",
|
|
598
630
|
size: EMPLOYEE_NAME_WIDTH,
|
|
599
|
-
columnKey: "employeeName"
|
|
631
|
+
columnKey: "employeeName",
|
|
632
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
600
633
|
},
|
|
601
634
|
isActive: {
|
|
602
635
|
type: "string",
|
|
@@ -639,7 +672,7 @@ var FIELDS8 = {
|
|
|
639
672
|
filteringAvailable: false
|
|
640
673
|
}
|
|
641
674
|
};
|
|
642
|
-
var
|
|
675
|
+
var EMPLOYEE_TIMECARD_VISIBLE_COLUMNS = [
|
|
643
676
|
"locationName",
|
|
644
677
|
"businessDate",
|
|
645
678
|
"isActive",
|
|
@@ -650,17 +683,30 @@ var EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS = [
|
|
|
650
683
|
"endTime",
|
|
651
684
|
"shiftHours"
|
|
652
685
|
];
|
|
686
|
+
var EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS = [
|
|
687
|
+
"employeeName",
|
|
688
|
+
...EMPLOYEE_TIMECARD_VISIBLE_COLUMNS
|
|
689
|
+
];
|
|
653
690
|
var employeeTimecardConfig = {
|
|
654
691
|
fields: FIELDS8,
|
|
655
692
|
availableColumns: EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS,
|
|
656
|
-
defaultVisibleColumns:
|
|
693
|
+
defaultVisibleColumns: EMPLOYEE_TIMECARD_VISIBLE_COLUMNS,
|
|
657
694
|
hasFooter: true
|
|
658
695
|
};
|
|
659
696
|
|
|
660
697
|
// src/reports/employeeTip.ts
|
|
661
698
|
var FIELDS9 = {
|
|
662
|
-
employeeName: {
|
|
663
|
-
|
|
699
|
+
employeeName: {
|
|
700
|
+
type: "string",
|
|
701
|
+
size: 220,
|
|
702
|
+
columnKey: "employeeName"
|
|
703
|
+
},
|
|
704
|
+
empId: {
|
|
705
|
+
type: "string",
|
|
706
|
+
size: 160,
|
|
707
|
+
columnKey: "employeeId",
|
|
708
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
709
|
+
},
|
|
664
710
|
payrollId: { type: "string", size: 160, columnKey: "payrollId" },
|
|
665
711
|
locationName: { type: "string", size: 220, columnKey: "locationName" },
|
|
666
712
|
status: { type: "string", size: 140, columnKey: "status" },
|
|
@@ -680,9 +726,8 @@ var FIELDS9 = {
|
|
|
680
726
|
footerCalculation: { type: "average", numeratorField: "grossTips", denominatorField: "grossSales" }
|
|
681
727
|
}
|
|
682
728
|
};
|
|
683
|
-
var
|
|
729
|
+
var VISIBLE_COLUMNS = [
|
|
684
730
|
"employeeName",
|
|
685
|
-
"empId",
|
|
686
731
|
"payrollId",
|
|
687
732
|
"locationName",
|
|
688
733
|
"status",
|
|
@@ -698,17 +743,18 @@ var AVAILABLE_COLUMNS = [
|
|
|
698
743
|
"netTips",
|
|
699
744
|
"tipPercentage"
|
|
700
745
|
];
|
|
746
|
+
var AVAILABLE_COLUMNS = ["empId", ...VISIBLE_COLUMNS];
|
|
701
747
|
var employeeTipConfig = {
|
|
702
748
|
fields: FIELDS9,
|
|
703
749
|
availableColumns: AVAILABLE_COLUMNS,
|
|
704
|
-
defaultVisibleColumns:
|
|
750
|
+
defaultVisibleColumns: VISIBLE_COLUMNS,
|
|
705
751
|
hasFooter: true
|
|
706
752
|
};
|
|
707
753
|
|
|
708
|
-
// src/reports/dailySales.ts
|
|
754
|
+
// src/reports/dailySales/dailySales.ts
|
|
709
755
|
var FIELDS10 = {
|
|
710
756
|
groupById: { type: "string" },
|
|
711
|
-
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
757
|
+
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH, footerCalculation: { type: "label", label: "table.total" } },
|
|
712
758
|
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
713
759
|
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
714
760
|
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
@@ -734,9 +780,14 @@ var dailySalesConfig = {
|
|
|
734
780
|
extraFooterRowsKey: "salesByRevClassFooter"
|
|
735
781
|
};
|
|
736
782
|
|
|
737
|
-
// src/reports/dailySalesCache.ts
|
|
783
|
+
// src/reports/dailySales/dailySalesCache.ts
|
|
738
784
|
var FIELDS11 = {
|
|
739
|
-
name: {
|
|
785
|
+
name: {
|
|
786
|
+
type: "string",
|
|
787
|
+
columnKey: "type",
|
|
788
|
+
size: FIRST_COLUMN_WIDTH,
|
|
789
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
790
|
+
},
|
|
740
791
|
amount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } }
|
|
741
792
|
};
|
|
742
793
|
var dailySalesCacheConfig = {
|
|
@@ -748,9 +799,14 @@ var dailySalesCacheConfig = {
|
|
|
748
799
|
sectionName: "common.report-section.cash"
|
|
749
800
|
};
|
|
750
801
|
|
|
751
|
-
// src/reports/dailySalesDiscounts.ts
|
|
802
|
+
// src/reports/dailySales/dailySalesDiscounts.ts
|
|
752
803
|
var FIELDS12 = {
|
|
753
|
-
discountName: {
|
|
804
|
+
discountName: {
|
|
805
|
+
type: "string",
|
|
806
|
+
columnKey: "discountName",
|
|
807
|
+
size: FIRST_COLUMN_WIDTH,
|
|
808
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
809
|
+
},
|
|
754
810
|
ticketCount: { type: "number", columnKey: "ticketCount", footerCalculation: { type: "sum" } },
|
|
755
811
|
itemCount: { type: "number", columnKey: "itemCount", footerCalculation: { type: "sum" } },
|
|
756
812
|
discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
|
|
@@ -770,9 +826,13 @@ var dailySalesDiscountsConfig = {
|
|
|
770
826
|
sectionName: "common.report-section.discounts"
|
|
771
827
|
};
|
|
772
828
|
|
|
773
|
-
// src/reports/dailySalesPayments.ts
|
|
829
|
+
// src/reports/dailySales/dailySalesPayments.ts
|
|
774
830
|
var FIELDS13 = {
|
|
775
|
-
paymentTypeName: {
|
|
831
|
+
paymentTypeName: {
|
|
832
|
+
type: "string",
|
|
833
|
+
size: FIRST_COLUMN_WIDTH,
|
|
834
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
835
|
+
},
|
|
776
836
|
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
777
837
|
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
778
838
|
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
@@ -794,9 +854,14 @@ var dailySalesPaymentsConfig = {
|
|
|
794
854
|
sectionName: "common.report-section.payments"
|
|
795
855
|
};
|
|
796
856
|
|
|
797
|
-
// src/reports/dailySalesRefundsVoids.ts
|
|
857
|
+
// src/reports/dailySales/dailySalesRefundsVoids.ts
|
|
798
858
|
var FIELDS14 = {
|
|
799
|
-
description: {
|
|
859
|
+
description: {
|
|
860
|
+
type: "string",
|
|
861
|
+
columnKey: "refundVoidDescription",
|
|
862
|
+
size: FIRST_COLUMN_WIDTH,
|
|
863
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
864
|
+
},
|
|
800
865
|
count: { type: "number", columnKey: "refundVoidCount", footerCalculation: { type: "sum" } },
|
|
801
866
|
amount: { type: "money", columnKey: "refundVoidAmount", footerCalculation: { type: "sum" } },
|
|
802
867
|
pctSales: { type: "percent", columnKey: "refundVoidPctSales", footerCalculation: { type: "sum" } }
|
|
@@ -816,9 +881,14 @@ var dailySalesRefundsVoidsConfig = {
|
|
|
816
881
|
sectionName: "common.report-section.refunds-voids"
|
|
817
882
|
};
|
|
818
883
|
|
|
819
|
-
// src/reports/dailySalesTaxes.ts
|
|
884
|
+
// src/reports/dailySales/dailySalesTaxes.ts
|
|
820
885
|
var FIELDS15 = {
|
|
821
|
-
taxName: {
|
|
886
|
+
taxName: {
|
|
887
|
+
type: "string",
|
|
888
|
+
columnKey: "taxName",
|
|
889
|
+
size: FIRST_COLUMN_WIDTH,
|
|
890
|
+
footerCalculation: { type: "label", label: "table.total" }
|
|
891
|
+
},
|
|
822
892
|
taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "none" } },
|
|
823
893
|
taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
|
|
824
894
|
exemptSales: { type: "money", columnKey: "exemptSales", footerCalculation: { type: "sum" } }
|
|
@@ -838,10 +908,14 @@ var dailySalesTaxesConfig = {
|
|
|
838
908
|
sectionName: "common.report-section.taxes"
|
|
839
909
|
};
|
|
840
910
|
|
|
841
|
-
// src/reports/dailySalesTrends.ts
|
|
911
|
+
// src/reports/dailySales/dailySalesTrends.ts
|
|
842
912
|
var FIELDS16 = {
|
|
843
913
|
groupById: { type: "string" },
|
|
844
|
-
groupByName: {
|
|
914
|
+
groupByName: {
|
|
915
|
+
type: "string",
|
|
916
|
+
size: FIRST_COLUMN_WIDTH,
|
|
917
|
+
footerCalculation: { type: "label", label: "common.report-section.trends-footer.total-sales" }
|
|
918
|
+
},
|
|
845
919
|
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
846
920
|
ticketsCount: { type: "number", columnKey: "tickets" },
|
|
847
921
|
guestsCount: { type: "number", columnKey: "guests" },
|
|
@@ -878,7 +952,6 @@ var dailySalesTrendsConfig = {
|
|
|
878
952
|
hasFooter: true,
|
|
879
953
|
dataAccessKey: "trendsByDayPart",
|
|
880
954
|
sectionName: "common.report-section.sales-by-day-part",
|
|
881
|
-
totalsLabel: "common.report-section.trends-footer.total-sales",
|
|
882
955
|
extraFooterFields: ["salesAmountNet"]
|
|
883
956
|
};
|
|
884
957
|
var dailySalesTrendsOrderTypeConfig = {
|
|
@@ -888,7 +961,6 @@ var dailySalesTrendsOrderTypeConfig = {
|
|
|
888
961
|
hasFooter: true,
|
|
889
962
|
dataAccessKey: "trendsByOrderType",
|
|
890
963
|
sectionName: "common.report-section.sales-by-order-type",
|
|
891
|
-
totalsLabel: "common.report-section.trends-footer.total-sales",
|
|
892
964
|
extraFooterFields: ["salesAmountNet"]
|
|
893
965
|
};
|
|
894
966
|
|
|
@@ -1711,12 +1783,18 @@ function isNumericType(type) {
|
|
|
1711
1783
|
|
|
1712
1784
|
// src/totals.ts
|
|
1713
1785
|
var sumField = (rows, field) => rows.reduce((acc, row) => acc + (row[field] ?? 0), 0);
|
|
1714
|
-
var
|
|
1786
|
+
var getFooterValue = (rows, field, config) => {
|
|
1715
1787
|
const { type } = config;
|
|
1716
|
-
if (!type || type === "
|
|
1788
|
+
if (!type || type === "date" || type === "time" || type === "boolean" || type === "conditional") {
|
|
1717
1789
|
return null;
|
|
1718
1790
|
}
|
|
1719
1791
|
const calc = config.footerCalculation;
|
|
1792
|
+
if (type === "string") {
|
|
1793
|
+
if (calc?.type === "label") {
|
|
1794
|
+
return calc.label;
|
|
1795
|
+
}
|
|
1796
|
+
return null;
|
|
1797
|
+
}
|
|
1720
1798
|
if (calc?.type === "none") {
|
|
1721
1799
|
return null;
|
|
1722
1800
|
}
|
|
@@ -1755,40 +1833,15 @@ var calculateReportTotals = (data, fieldConfig, opts) => {
|
|
|
1755
1833
|
const { labelField, label } = opts;
|
|
1756
1834
|
const result = {};
|
|
1757
1835
|
for (const [field, config] of Object.entries(fieldConfig)) {
|
|
1758
|
-
const total =
|
|
1836
|
+
const total = getFooterValue(data, field, config);
|
|
1759
1837
|
result[field] = total ?? "";
|
|
1760
1838
|
}
|
|
1761
|
-
result[labelField]
|
|
1839
|
+
if (result[labelField] === "" || result[labelField] === null) {
|
|
1840
|
+
result[labelField] = label;
|
|
1841
|
+
}
|
|
1762
1842
|
return result;
|
|
1763
1843
|
};
|
|
1764
1844
|
|
|
1765
|
-
// src/reports/dailySalesLive.ts
|
|
1766
|
-
var FIELDS17 = {
|
|
1767
|
-
groupById: { type: "string" },
|
|
1768
|
-
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
1769
|
-
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
1770
|
-
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
1771
|
-
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
1772
|
-
inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
|
|
1773
|
-
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
1774
|
-
salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
|
|
1775
|
-
guestsCount: { type: "number", columnKey: "guests" }
|
|
1776
|
-
};
|
|
1777
|
-
var DAILY_SALES_LIVE_AVAILABLE_COLUMNS = [
|
|
1778
|
-
"itemsQuantity",
|
|
1779
|
-
"salesAmountGross",
|
|
1780
|
-
"discountsAmount",
|
|
1781
|
-
"inclusiveTaxesAmount",
|
|
1782
|
-
"salesAmountNet",
|
|
1783
|
-
"salesMixPct"
|
|
1784
|
-
];
|
|
1785
|
-
var dailySalesLiveConfig = {
|
|
1786
|
-
fields: FIELDS17,
|
|
1787
|
-
availableColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
1788
|
-
defaultVisibleColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
1789
|
-
hasFooter: true
|
|
1790
|
-
};
|
|
1791
|
-
|
|
1792
1845
|
// src/reports/reportSection.ts
|
|
1793
1846
|
var DAILY_SALES_CASH_ROW_LABELS = {
|
|
1794
1847
|
cashPayments: "common.report-section.cash-row.cash-payments",
|
|
@@ -1917,7 +1970,7 @@ var TENDER_TYPE = {
|
|
|
1917
1970
|
UNKNOWN: "Unknown"
|
|
1918
1971
|
};
|
|
1919
1972
|
|
|
1920
|
-
// src/reports/dailySales.utils.ts
|
|
1973
|
+
// src/reports/dailySales/dailySales.utils.ts
|
|
1921
1974
|
var buildDailySalesCashPayments = (payments, paidOutAmount, gratuitiesPaidOutAmount, tipsPaidOutAmount) => [
|
|
1922
1975
|
{
|
|
1923
1976
|
name: DAILY_SALES_CASH_ROW_LABELS.cashPayments,
|
|
@@ -3498,8 +3551,12 @@ var formatMoney = (amount, options = {}) => {
|
|
|
3498
3551
|
var formatPercent = (value, decimals = 2) => `${value.toFixed(decimals)}%`;
|
|
3499
3552
|
var formatInteger = (value) => Math.round(value).toString();
|
|
3500
3553
|
var formatFixedNumber = (value, decimals = 2) => value.toFixed(decimals);
|
|
3501
|
-
var formatString = (value) => {
|
|
3502
|
-
|
|
3554
|
+
var formatString = (value, localeOptions) => {
|
|
3555
|
+
const newValue = value == null ? "" : typeof value === "string" ? value : typeof value === "number" || typeof value === "boolean" ? String(value) : "";
|
|
3556
|
+
if (newValue in en_US_default) {
|
|
3557
|
+
return resolveTranslate(newValue, localeOptions.locale);
|
|
3558
|
+
}
|
|
3559
|
+
return newValue;
|
|
3503
3560
|
};
|
|
3504
3561
|
var getNumberToFormat = (value) => typeof value === "number" ? value : 0;
|
|
3505
3562
|
var getDateToFormat = (value) => {
|
|
@@ -3535,14 +3592,14 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3535
3592
|
switch (type) {
|
|
3536
3593
|
case "conditional": {
|
|
3537
3594
|
if (!fullRecord) {
|
|
3538
|
-
return formatString(value);
|
|
3595
|
+
return formatString(value, localeOptions);
|
|
3539
3596
|
}
|
|
3540
3597
|
const conditionalConfig = fieldConfig.conditionalConfiguration;
|
|
3541
3598
|
const configType = conditionalConfig.conditionalFormat(fullRecord[conditionalConfig.conditionalField]);
|
|
3542
3599
|
return formatFieldValue(value, configType, localeOptions, fullRecord, fieldConfig);
|
|
3543
3600
|
}
|
|
3544
3601
|
case "string":
|
|
3545
|
-
return formatString(value);
|
|
3602
|
+
return formatString(value, localeOptions);
|
|
3546
3603
|
case "money":
|
|
3547
3604
|
return formatMoney(getNumberToFormat(value), { currency, locale });
|
|
3548
3605
|
case "percent":
|
|
@@ -3572,12 +3629,10 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3572
3629
|
TENDER_TYPE,
|
|
3573
3630
|
buildDailySalesCashPayments,
|
|
3574
3631
|
buildDailySalesRevClassFooter,
|
|
3575
|
-
calculateFieldTotal,
|
|
3576
3632
|
calculateReportTotals,
|
|
3577
3633
|
dailySalesCacheConfig,
|
|
3578
3634
|
dailySalesConfig,
|
|
3579
3635
|
dailySalesDiscountsConfig,
|
|
3580
|
-
dailySalesLiveConfig,
|
|
3581
3636
|
dailySalesPaymentsConfig,
|
|
3582
3637
|
dailySalesRefundsVoidsConfig,
|
|
3583
3638
|
dailySalesTaxesConfig,
|
|
@@ -3598,6 +3653,7 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3598
3653
|
getColumnExportHeaderLabel,
|
|
3599
3654
|
getColumnMetadata,
|
|
3600
3655
|
getDateToFormat,
|
|
3656
|
+
getFooterValue,
|
|
3601
3657
|
getNumberToFormat,
|
|
3602
3658
|
getReportConfig,
|
|
3603
3659
|
getReportExportFileName,
|