@harbortouch/skytab-analytics-report-utils 0.23.2 → 0.25.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-6CXSU5L4.js → chunk-SUWIUPHT.js} +8 -9
- package/dist/exporters/exportBuilder.cjs +37 -67
- package/dist/exporters/exportBuilder.d.cts +3 -4
- package/dist/exporters/exportBuilder.d.ts +3 -4
- package/dist/exporters/exportBuilder.js +30 -59
- package/dist/index.cjs +8 -9
- package/dist/index.d.cts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +1 -1
- package/dist/{report-DklnjPk7.d.cts → report-Bx5XpFQ0.d.cts} +1 -1
- package/dist/{report-DklnjPk7.d.ts → report-Bx5XpFQ0.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -160,8 +160,7 @@ var COLUMN_GROUPS = [
|
|
|
160
160
|
lastYearFields: ["salesPerGuestLY"]
|
|
161
161
|
}
|
|
162
162
|
];
|
|
163
|
-
var
|
|
164
|
-
"groupByName",
|
|
163
|
+
var SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS = [
|
|
165
164
|
"salesAmountNet",
|
|
166
165
|
"salesVarLW",
|
|
167
166
|
"salesVarLWPct",
|
|
@@ -176,11 +175,12 @@ var SALES_SUMMARY_AVAILABLE_COLUMNS = [
|
|
|
176
175
|
"salesPerGuestLW",
|
|
177
176
|
"salesPerGuestLY"
|
|
178
177
|
];
|
|
179
|
-
var
|
|
178
|
+
var SALES_SUMMARY_AVAILABLE_COLUMNS = ["groupByName", ...SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS];
|
|
180
179
|
var salesSummaryConfig = {
|
|
181
180
|
fields: FIELDS2,
|
|
182
181
|
availableColumns: SALES_SUMMARY_AVAILABLE_COLUMNS,
|
|
183
182
|
defaultVisibleColumns: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
183
|
+
chartFields: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
184
184
|
columnGroups: COLUMN_GROUPS,
|
|
185
185
|
hasFooter: true
|
|
186
186
|
};
|
|
@@ -474,6 +474,7 @@ var MODIFIER_MIX_AVAILABLE_COLUMNS = [
|
|
|
474
474
|
];
|
|
475
475
|
var modifierMixConfig = {
|
|
476
476
|
fields: FIELDS6,
|
|
477
|
+
chartFields: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
477
478
|
availableColumns: MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
478
479
|
defaultVisibleColumns: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
479
480
|
hasFooter: true
|
|
@@ -692,6 +693,7 @@ var FIELDS10 = {
|
|
|
692
693
|
salesMixPct: { type: "percent", columnKey: "salesMixByPct" }
|
|
693
694
|
};
|
|
694
695
|
var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
696
|
+
"groupByName",
|
|
695
697
|
"itemsQuantity",
|
|
696
698
|
"salesAmountGross",
|
|
697
699
|
"discountsAmount",
|
|
@@ -869,6 +871,7 @@ var FIELDS16 = {
|
|
|
869
871
|
}
|
|
870
872
|
};
|
|
871
873
|
var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
|
|
874
|
+
"groupByName",
|
|
872
875
|
"ticketsCount",
|
|
873
876
|
"guestsCount",
|
|
874
877
|
"ticketAvg",
|
|
@@ -1748,16 +1751,12 @@ var getFooterValue = (rows, field, config) => {
|
|
|
1748
1751
|
}
|
|
1749
1752
|
return 0;
|
|
1750
1753
|
};
|
|
1751
|
-
var calculateReportTotals = (data, fieldConfig
|
|
1752
|
-
const { labelField, label } = opts;
|
|
1754
|
+
var calculateReportTotals = (data, fieldConfig) => {
|
|
1753
1755
|
const result = {};
|
|
1754
1756
|
for (const [field, config] of Object.entries(fieldConfig)) {
|
|
1755
1757
|
const total = getFooterValue(data, field, config);
|
|
1756
1758
|
result[field] = total ?? "";
|
|
1757
1759
|
}
|
|
1758
|
-
if (result[labelField] === "" || result[labelField] === null) {
|
|
1759
|
-
result[labelField] = label;
|
|
1760
|
-
}
|
|
1761
1760
|
return result;
|
|
1762
1761
|
};
|
|
1763
1762
|
|
|
@@ -3020,7 +3019,7 @@ var enUS3 = {
|
|
|
3020
3019
|
"common.report-col.sales-mix-by-pct.short": "Sales Mix %",
|
|
3021
3020
|
"common.report-col.sales-mix-by-pct.info": "Percentage of total sales contributed by this item or category",
|
|
3022
3021
|
"common.report-col.sales-per-guest": "Sales/Guest",
|
|
3023
|
-
"common.report-col.sales-per-guest.short": "
|
|
3022
|
+
"common.report-col.sales-per-guest.short": "Sales/Guest",
|
|
3024
3023
|
"common.report-col.sales-per-guest.info": "Average spend per guest",
|
|
3025
3024
|
"common.report-col.sales-per-guest-lw": "Sales/Guest LW",
|
|
3026
3025
|
"common.report-col.sales-per-guest-lw.short": "Amt/Guest LW",
|
|
@@ -309,7 +309,7 @@ var enUS = {
|
|
|
309
309
|
"common.report-col.sales-mix-by-pct.short": "Sales Mix %",
|
|
310
310
|
"common.report-col.sales-mix-by-pct.info": "Percentage of total sales contributed by this item or category",
|
|
311
311
|
"common.report-col.sales-per-guest": "Sales/Guest",
|
|
312
|
-
"common.report-col.sales-per-guest.short": "
|
|
312
|
+
"common.report-col.sales-per-guest.short": "Sales/Guest",
|
|
313
313
|
"common.report-col.sales-per-guest.info": "Average spend per guest",
|
|
314
314
|
"common.report-col.sales-per-guest-lw": "Sales/Guest LW",
|
|
315
315
|
"common.report-col.sales-per-guest-lw.short": "Amt/Guest LW",
|
|
@@ -1794,8 +1794,7 @@ var COLUMN_GROUPS = [
|
|
|
1794
1794
|
lastYearFields: ["salesPerGuestLY"]
|
|
1795
1795
|
}
|
|
1796
1796
|
];
|
|
1797
|
-
var
|
|
1798
|
-
"groupByName",
|
|
1797
|
+
var SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS = [
|
|
1799
1798
|
"salesAmountNet",
|
|
1800
1799
|
"salesVarLW",
|
|
1801
1800
|
"salesVarLWPct",
|
|
@@ -1810,11 +1809,12 @@ var SALES_SUMMARY_AVAILABLE_COLUMNS = [
|
|
|
1810
1809
|
"salesPerGuestLW",
|
|
1811
1810
|
"salesPerGuestLY"
|
|
1812
1811
|
];
|
|
1813
|
-
var
|
|
1812
|
+
var SALES_SUMMARY_AVAILABLE_COLUMNS = ["groupByName", ...SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS];
|
|
1814
1813
|
var salesSummaryConfig = {
|
|
1815
1814
|
fields: FIELDS2,
|
|
1816
1815
|
availableColumns: SALES_SUMMARY_AVAILABLE_COLUMNS,
|
|
1817
1816
|
defaultVisibleColumns: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
1817
|
+
chartFields: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
1818
1818
|
columnGroups: COLUMN_GROUPS,
|
|
1819
1819
|
hasFooter: true
|
|
1820
1820
|
};
|
|
@@ -2108,6 +2108,7 @@ var MODIFIER_MIX_AVAILABLE_COLUMNS = [
|
|
|
2108
2108
|
];
|
|
2109
2109
|
var modifierMixConfig = {
|
|
2110
2110
|
fields: FIELDS6,
|
|
2111
|
+
chartFields: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
2111
2112
|
availableColumns: MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
2112
2113
|
defaultVisibleColumns: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
2113
2114
|
hasFooter: true
|
|
@@ -2326,6 +2327,7 @@ var FIELDS10 = {
|
|
|
2326
2327
|
salesMixPct: { type: "percent", columnKey: "salesMixByPct" }
|
|
2327
2328
|
};
|
|
2328
2329
|
var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
2330
|
+
"groupByName",
|
|
2329
2331
|
"itemsQuantity",
|
|
2330
2332
|
"salesAmountGross",
|
|
2331
2333
|
"discountsAmount",
|
|
@@ -2503,6 +2505,7 @@ var FIELDS16 = {
|
|
|
2503
2505
|
}
|
|
2504
2506
|
};
|
|
2505
2507
|
var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
|
|
2508
|
+
"groupByName",
|
|
2506
2509
|
"ticketsCount",
|
|
2507
2510
|
"guestsCount",
|
|
2508
2511
|
"ticketAvg",
|
|
@@ -3340,16 +3343,12 @@ var getFooterValue = (rows, field, config) => {
|
|
|
3340
3343
|
}
|
|
3341
3344
|
return 0;
|
|
3342
3345
|
};
|
|
3343
|
-
var calculateReportTotals = (data, fieldConfig
|
|
3344
|
-
const { labelField, label } = opts;
|
|
3346
|
+
var calculateReportTotals = (data, fieldConfig) => {
|
|
3345
3347
|
const result = {};
|
|
3346
3348
|
for (const [field, config] of Object.entries(fieldConfig)) {
|
|
3347
3349
|
const total = getFooterValue(data, field, config);
|
|
3348
3350
|
result[field] = total ?? "";
|
|
3349
3351
|
}
|
|
3350
|
-
if (result[labelField] === "" || result[labelField] === null) {
|
|
3351
|
-
result[labelField] = label;
|
|
3352
|
-
}
|
|
3353
3352
|
return result;
|
|
3354
3353
|
};
|
|
3355
3354
|
|
|
@@ -3374,31 +3373,33 @@ var ExportBuilder = class {
|
|
|
3374
3373
|
translate(messageKey) {
|
|
3375
3374
|
return resolveTranslate(messageKey, this.locale);
|
|
3376
3375
|
}
|
|
3377
|
-
|
|
3378
|
-
const
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3376
|
+
getFixedColFromConfig(config, parameters) {
|
|
3377
|
+
const visibleColumns = new Set(config.defaultVisibleColumns ?? []);
|
|
3378
|
+
const fixedCols = config.availableColumns.filter((col) => !visibleColumns.has(col));
|
|
3379
|
+
return fixedCols.filter((col) => {
|
|
3380
|
+
if (col === "groupByName2") {
|
|
3381
|
+
return !!parameters.secondGroupBy;
|
|
3382
|
+
}
|
|
3383
|
+
return true;
|
|
3384
|
+
});
|
|
3386
3385
|
}
|
|
3387
|
-
|
|
3386
|
+
sortAndAddFixedCols(config, parameters, collected) {
|
|
3387
|
+
const fixedCols = this.getFixedColFromConfig(config, parameters);
|
|
3388
|
+
const fixedColSet = new Set(fixedCols);
|
|
3388
3389
|
const orderMap = new Map(config.availableColumns.map((col, i) => [col, i]));
|
|
3389
|
-
const sorted =
|
|
3390
|
-
return [...
|
|
3390
|
+
const sorted = collected.filter((col) => !fixedColSet.has(col)).sort((a, b) => (orderMap.get(a) ?? Infinity) - (orderMap.get(b) ?? Infinity));
|
|
3391
|
+
return [...fixedCols, ...sorted];
|
|
3391
3392
|
}
|
|
3392
3393
|
resolveColumns(config, parameters) {
|
|
3393
|
-
const
|
|
3394
|
+
const selectedColumns = Array.isArray(parameters.cols) ? parameters.cols : null;
|
|
3394
3395
|
const compareToLastWeek = parameters.compareToLastWeek === true;
|
|
3395
3396
|
const compareToLastYear = parameters.compareToLastYear === true;
|
|
3396
|
-
if (
|
|
3397
|
-
return this.
|
|
3397
|
+
if (selectedColumns !== null && selectedColumns.length === 0) {
|
|
3398
|
+
return this.sortAndAddFixedCols(config, parameters, []);
|
|
3398
3399
|
}
|
|
3399
|
-
if (
|
|
3400
|
+
if (selectedColumns?.length && config.columnGroups?.length) {
|
|
3400
3401
|
const collected = [];
|
|
3401
|
-
for (const groupId of
|
|
3402
|
+
for (const groupId of selectedColumns) {
|
|
3402
3403
|
const group = config.columnGroups.find((g) => g.id === groupId);
|
|
3403
3404
|
if (!group) {
|
|
3404
3405
|
continue;
|
|
@@ -3411,26 +3412,10 @@ var ExportBuilder = class {
|
|
|
3411
3412
|
collected.push(...group.lastYearFields);
|
|
3412
3413
|
}
|
|
3413
3414
|
}
|
|
3414
|
-
return this.
|
|
3415
|
+
return this.sortAndAddFixedCols(config, parameters, collected);
|
|
3415
3416
|
}
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
for (const col of config.defaultVisibleColumns) {
|
|
3419
|
-
collected.push(col);
|
|
3420
|
-
const group = config.columnGroups.find((g) => g.baseFields.includes(col));
|
|
3421
|
-
if (group) {
|
|
3422
|
-
if (compareToLastWeek && group.lastWeekFields) {
|
|
3423
|
-
collected.push(...group.lastWeekFields);
|
|
3424
|
-
}
|
|
3425
|
-
if (compareToLastYear && group.lastYearFields) {
|
|
3426
|
-
collected.push(...group.lastYearFields);
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
}
|
|
3430
|
-
return this.sortAndPrependPrefix(config, parameters, collected);
|
|
3431
|
-
}
|
|
3432
|
-
const metricCols = selectedGroupIds?.length ? config.availableColumns.filter((c) => selectedGroupIds.includes(c)) : config.defaultVisibleColumns;
|
|
3433
|
-
return [...this.buildColumnPrefix(config, parameters), ...metricCols];
|
|
3417
|
+
const metricCols = selectedColumns?.length ? config.availableColumns.filter((c) => selectedColumns.includes(c)) : config.defaultVisibleColumns;
|
|
3418
|
+
return this.sortAndAddFixedCols(config, parameters, metricCols);
|
|
3434
3419
|
}
|
|
3435
3420
|
getColumnHeader(fieldName, config, parameters) {
|
|
3436
3421
|
if (fieldName === "groupByName" && parameters.groupBy) {
|
|
@@ -3466,24 +3451,13 @@ var ExportBuilder = class {
|
|
|
3466
3451
|
});
|
|
3467
3452
|
return formatted;
|
|
3468
3453
|
}
|
|
3469
|
-
|
|
3470
|
-
if (columns.includes("groupByName")) {
|
|
3471
|
-
return "groupByName";
|
|
3472
|
-
}
|
|
3473
|
-
const firstStringCol = columns.find((col) => {
|
|
3474
|
-
const field = config.fields[col];
|
|
3475
|
-
return field?.type === "string" && !field.footerCalculation;
|
|
3476
|
-
});
|
|
3477
|
-
return firstStringCol ?? columns[0];
|
|
3478
|
-
}
|
|
3479
|
-
buildTotalsRow(data, config, columns) {
|
|
3454
|
+
buildTotalsRow(data, config) {
|
|
3480
3455
|
if (data.length === 0) {
|
|
3481
3456
|
return null;
|
|
3482
3457
|
}
|
|
3483
|
-
|
|
3484
|
-
return calculateReportTotals(data, config.fields, { labelField, label: this.translate("table.total") });
|
|
3458
|
+
return calculateReportTotals(data, config.fields);
|
|
3485
3459
|
}
|
|
3486
|
-
getExtraFooterRows(data, config, sectionData
|
|
3460
|
+
getExtraFooterRows(data, config, sectionData) {
|
|
3487
3461
|
if (config.extraFooterRowsKey) {
|
|
3488
3462
|
if (!Array.isArray(data)) {
|
|
3489
3463
|
const rows = data[config.extraFooterRowsKey];
|
|
@@ -3493,12 +3467,8 @@ var ExportBuilder = class {
|
|
|
3493
3467
|
}
|
|
3494
3468
|
}
|
|
3495
3469
|
if (config.extraFooterFields?.length && sectionData.length > 0) {
|
|
3496
|
-
const
|
|
3497
|
-
const
|
|
3498
|
-
labelField,
|
|
3499
|
-
label: this.translate("table.total")
|
|
3500
|
-
});
|
|
3501
|
-
const row = { [labelField]: totals[labelField] };
|
|
3470
|
+
const totals = calculateReportTotals(sectionData, config.fields);
|
|
3471
|
+
const row = {};
|
|
3502
3472
|
for (const field of config.extraFooterFields) {
|
|
3503
3473
|
row[field] = totals[field];
|
|
3504
3474
|
}
|
|
@@ -3513,12 +3483,12 @@ var ExportBuilder = class {
|
|
|
3513
3483
|
const tableColumns = columns.map((col, i) => ({ header: headers[i], key: col }));
|
|
3514
3484
|
const rows = data.filter((row) => typeof row === "object" && row !== null).map((row) => this.formatRow(row, columns, columnTypes, localeConfig, row));
|
|
3515
3485
|
if (config.hasFooter) {
|
|
3516
|
-
const totalsRow = this.buildTotalsRow(data, config
|
|
3486
|
+
const totalsRow = this.buildTotalsRow(data, config);
|
|
3517
3487
|
if (totalsRow) {
|
|
3518
3488
|
rows.push(this.formatRow(totalsRow, columns, columnTypes, localeConfig, null));
|
|
3519
3489
|
}
|
|
3520
3490
|
}
|
|
3521
|
-
for (const extraRow of this.getExtraFooterRows(reportData, config, data
|
|
3491
|
+
for (const extraRow of this.getExtraFooterRows(reportData, config, data)) {
|
|
3522
3492
|
rows.push(this.formatRow(extraRow, columns, columnTypes, localeConfig, extraRow));
|
|
3523
3493
|
}
|
|
3524
3494
|
return { table: { columns: tableColumns, rows } };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-Bx5XpFQ0.cjs';
|
|
2
2
|
import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.cjs';
|
|
3
3
|
|
|
4
4
|
interface ReportDocumentSection {
|
|
@@ -36,14 +36,13 @@ declare class ExportBuilder {
|
|
|
36
36
|
private getConfig;
|
|
37
37
|
private getConfigSectionName;
|
|
38
38
|
private translate;
|
|
39
|
-
private
|
|
40
|
-
private
|
|
39
|
+
private getFixedColFromConfig;
|
|
40
|
+
private sortAndAddFixedCols;
|
|
41
41
|
private resolveColumns;
|
|
42
42
|
private getColumnHeader;
|
|
43
43
|
private resolveColumnsAndHeaders;
|
|
44
44
|
private formatField;
|
|
45
45
|
private formatRow;
|
|
46
|
-
private resolveLabelField;
|
|
47
46
|
private buildTotalsRow;
|
|
48
47
|
private getExtraFooterRows;
|
|
49
48
|
private renderTableContent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-Bx5XpFQ0.js';
|
|
2
2
|
import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.js';
|
|
3
3
|
|
|
4
4
|
interface ReportDocumentSection {
|
|
@@ -36,14 +36,13 @@ declare class ExportBuilder {
|
|
|
36
36
|
private getConfig;
|
|
37
37
|
private getConfigSectionName;
|
|
38
38
|
private translate;
|
|
39
|
-
private
|
|
40
|
-
private
|
|
39
|
+
private getFixedColFromConfig;
|
|
40
|
+
private sortAndAddFixedCols;
|
|
41
41
|
private resolveColumns;
|
|
42
42
|
private getColumnHeader;
|
|
43
43
|
private resolveColumnsAndHeaders;
|
|
44
44
|
private formatField;
|
|
45
45
|
private formatRow;
|
|
46
|
-
private resolveLabelField;
|
|
47
46
|
private buildTotalsRow;
|
|
48
47
|
private getExtraFooterRows;
|
|
49
48
|
private renderTableContent;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getReportConfig,
|
|
7
7
|
getReportFormattingLocaleOptions,
|
|
8
8
|
resolveTranslate
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-SUWIUPHT.js";
|
|
10
10
|
|
|
11
11
|
// src/exporters/exportBuilder.ts
|
|
12
12
|
import { format, isValid, parseISO } from "date-fns";
|
|
@@ -29,31 +29,33 @@ var ExportBuilder = class {
|
|
|
29
29
|
translate(messageKey) {
|
|
30
30
|
return resolveTranslate(messageKey, this.locale);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
getFixedColFromConfig(config, parameters) {
|
|
33
|
+
const visibleColumns = new Set(config.defaultVisibleColumns ?? []);
|
|
34
|
+
const fixedCols = config.availableColumns.filter((col) => !visibleColumns.has(col));
|
|
35
|
+
return fixedCols.filter((col) => {
|
|
36
|
+
if (col === "groupByName2") {
|
|
37
|
+
return !!parameters.secondGroupBy;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
sortAndAddFixedCols(config, parameters, collected) {
|
|
43
|
+
const fixedCols = this.getFixedColFromConfig(config, parameters);
|
|
44
|
+
const fixedColSet = new Set(fixedCols);
|
|
43
45
|
const orderMap = new Map(config.availableColumns.map((col, i) => [col, i]));
|
|
44
|
-
const sorted =
|
|
45
|
-
return [...
|
|
46
|
+
const sorted = collected.filter((col) => !fixedColSet.has(col)).sort((a, b) => (orderMap.get(a) ?? Infinity) - (orderMap.get(b) ?? Infinity));
|
|
47
|
+
return [...fixedCols, ...sorted];
|
|
46
48
|
}
|
|
47
49
|
resolveColumns(config, parameters) {
|
|
48
|
-
const
|
|
50
|
+
const selectedColumns = Array.isArray(parameters.cols) ? parameters.cols : null;
|
|
49
51
|
const compareToLastWeek = parameters.compareToLastWeek === true;
|
|
50
52
|
const compareToLastYear = parameters.compareToLastYear === true;
|
|
51
|
-
if (
|
|
52
|
-
return this.
|
|
53
|
+
if (selectedColumns !== null && selectedColumns.length === 0) {
|
|
54
|
+
return this.sortAndAddFixedCols(config, parameters, []);
|
|
53
55
|
}
|
|
54
|
-
if (
|
|
56
|
+
if (selectedColumns?.length && config.columnGroups?.length) {
|
|
55
57
|
const collected = [];
|
|
56
|
-
for (const groupId of
|
|
58
|
+
for (const groupId of selectedColumns) {
|
|
57
59
|
const group = config.columnGroups.find((g) => g.id === groupId);
|
|
58
60
|
if (!group) {
|
|
59
61
|
continue;
|
|
@@ -66,26 +68,10 @@ var ExportBuilder = class {
|
|
|
66
68
|
collected.push(...group.lastYearFields);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
return this.
|
|
71
|
+
return this.sortAndAddFixedCols(config, parameters, collected);
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
for (const col of config.defaultVisibleColumns) {
|
|
74
|
-
collected.push(col);
|
|
75
|
-
const group = config.columnGroups.find((g) => g.baseFields.includes(col));
|
|
76
|
-
if (group) {
|
|
77
|
-
if (compareToLastWeek && group.lastWeekFields) {
|
|
78
|
-
collected.push(...group.lastWeekFields);
|
|
79
|
-
}
|
|
80
|
-
if (compareToLastYear && group.lastYearFields) {
|
|
81
|
-
collected.push(...group.lastYearFields);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return this.sortAndPrependPrefix(config, parameters, collected);
|
|
86
|
-
}
|
|
87
|
-
const metricCols = selectedGroupIds?.length ? config.availableColumns.filter((c) => selectedGroupIds.includes(c)) : config.defaultVisibleColumns;
|
|
88
|
-
return [...this.buildColumnPrefix(config, parameters), ...metricCols];
|
|
73
|
+
const metricCols = selectedColumns?.length ? config.availableColumns.filter((c) => selectedColumns.includes(c)) : config.defaultVisibleColumns;
|
|
74
|
+
return this.sortAndAddFixedCols(config, parameters, metricCols);
|
|
89
75
|
}
|
|
90
76
|
getColumnHeader(fieldName, config, parameters) {
|
|
91
77
|
if (fieldName === "groupByName" && parameters.groupBy) {
|
|
@@ -121,24 +107,13 @@ var ExportBuilder = class {
|
|
|
121
107
|
});
|
|
122
108
|
return formatted;
|
|
123
109
|
}
|
|
124
|
-
|
|
125
|
-
if (columns.includes("groupByName")) {
|
|
126
|
-
return "groupByName";
|
|
127
|
-
}
|
|
128
|
-
const firstStringCol = columns.find((col) => {
|
|
129
|
-
const field = config.fields[col];
|
|
130
|
-
return field?.type === "string" && !field.footerCalculation;
|
|
131
|
-
});
|
|
132
|
-
return firstStringCol ?? columns[0];
|
|
133
|
-
}
|
|
134
|
-
buildTotalsRow(data, config, columns) {
|
|
110
|
+
buildTotalsRow(data, config) {
|
|
135
111
|
if (data.length === 0) {
|
|
136
112
|
return null;
|
|
137
113
|
}
|
|
138
|
-
|
|
139
|
-
return calculateReportTotals(data, config.fields, { labelField, label: this.translate("table.total") });
|
|
114
|
+
return calculateReportTotals(data, config.fields);
|
|
140
115
|
}
|
|
141
|
-
getExtraFooterRows(data, config, sectionData
|
|
116
|
+
getExtraFooterRows(data, config, sectionData) {
|
|
142
117
|
if (config.extraFooterRowsKey) {
|
|
143
118
|
if (!Array.isArray(data)) {
|
|
144
119
|
const rows = data[config.extraFooterRowsKey];
|
|
@@ -148,12 +123,8 @@ var ExportBuilder = class {
|
|
|
148
123
|
}
|
|
149
124
|
}
|
|
150
125
|
if (config.extraFooterFields?.length && sectionData.length > 0) {
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
labelField,
|
|
154
|
-
label: this.translate("table.total")
|
|
155
|
-
});
|
|
156
|
-
const row = { [labelField]: totals[labelField] };
|
|
126
|
+
const totals = calculateReportTotals(sectionData, config.fields);
|
|
127
|
+
const row = {};
|
|
157
128
|
for (const field of config.extraFooterFields) {
|
|
158
129
|
row[field] = totals[field];
|
|
159
130
|
}
|
|
@@ -168,12 +139,12 @@ var ExportBuilder = class {
|
|
|
168
139
|
const tableColumns = columns.map((col, i) => ({ header: headers[i], key: col }));
|
|
169
140
|
const rows = data.filter((row) => typeof row === "object" && row !== null).map((row) => this.formatRow(row, columns, columnTypes, localeConfig, row));
|
|
170
141
|
if (config.hasFooter) {
|
|
171
|
-
const totalsRow = this.buildTotalsRow(data, config
|
|
142
|
+
const totalsRow = this.buildTotalsRow(data, config);
|
|
172
143
|
if (totalsRow) {
|
|
173
144
|
rows.push(this.formatRow(totalsRow, columns, columnTypes, localeConfig, null));
|
|
174
145
|
}
|
|
175
146
|
}
|
|
176
|
-
for (const extraRow of this.getExtraFooterRows(reportData, config, data
|
|
147
|
+
for (const extraRow of this.getExtraFooterRows(reportData, config, data)) {
|
|
177
148
|
rows.push(this.formatRow(extraRow, columns, columnTypes, localeConfig, extraRow));
|
|
178
149
|
}
|
|
179
150
|
return { table: { columns: tableColumns, rows } };
|
package/dist/index.cjs
CHANGED
|
@@ -232,8 +232,7 @@ var COLUMN_GROUPS = [
|
|
|
232
232
|
lastYearFields: ["salesPerGuestLY"]
|
|
233
233
|
}
|
|
234
234
|
];
|
|
235
|
-
var
|
|
236
|
-
"groupByName",
|
|
235
|
+
var SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS = [
|
|
237
236
|
"salesAmountNet",
|
|
238
237
|
"salesVarLW",
|
|
239
238
|
"salesVarLWPct",
|
|
@@ -248,11 +247,12 @@ var SALES_SUMMARY_AVAILABLE_COLUMNS = [
|
|
|
248
247
|
"salesPerGuestLW",
|
|
249
248
|
"salesPerGuestLY"
|
|
250
249
|
];
|
|
251
|
-
var
|
|
250
|
+
var SALES_SUMMARY_AVAILABLE_COLUMNS = ["groupByName", ...SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS];
|
|
252
251
|
var salesSummaryConfig = {
|
|
253
252
|
fields: FIELDS2,
|
|
254
253
|
availableColumns: SALES_SUMMARY_AVAILABLE_COLUMNS,
|
|
255
254
|
defaultVisibleColumns: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
255
|
+
chartFields: SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
256
256
|
columnGroups: COLUMN_GROUPS,
|
|
257
257
|
hasFooter: true
|
|
258
258
|
};
|
|
@@ -546,6 +546,7 @@ var MODIFIER_MIX_AVAILABLE_COLUMNS = [
|
|
|
546
546
|
];
|
|
547
547
|
var modifierMixConfig = {
|
|
548
548
|
fields: FIELDS6,
|
|
549
|
+
chartFields: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
549
550
|
availableColumns: MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
550
551
|
defaultVisibleColumns: MODIFIER_MIX_VISIBLE_COLUMNS,
|
|
551
552
|
hasFooter: true
|
|
@@ -764,6 +765,7 @@ var FIELDS10 = {
|
|
|
764
765
|
salesMixPct: { type: "percent", columnKey: "salesMixByPct" }
|
|
765
766
|
};
|
|
766
767
|
var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
768
|
+
"groupByName",
|
|
767
769
|
"itemsQuantity",
|
|
768
770
|
"salesAmountGross",
|
|
769
771
|
"discountsAmount",
|
|
@@ -941,6 +943,7 @@ var FIELDS16 = {
|
|
|
941
943
|
}
|
|
942
944
|
};
|
|
943
945
|
var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
|
|
946
|
+
"groupByName",
|
|
944
947
|
"ticketsCount",
|
|
945
948
|
"guestsCount",
|
|
946
949
|
"ticketAvg",
|
|
@@ -1831,16 +1834,12 @@ var getFooterValue = (rows, field, config) => {
|
|
|
1831
1834
|
}
|
|
1832
1835
|
return 0;
|
|
1833
1836
|
};
|
|
1834
|
-
var calculateReportTotals = (data, fieldConfig
|
|
1835
|
-
const { labelField, label } = opts;
|
|
1837
|
+
var calculateReportTotals = (data, fieldConfig) => {
|
|
1836
1838
|
const result = {};
|
|
1837
1839
|
for (const [field, config] of Object.entries(fieldConfig)) {
|
|
1838
1840
|
const total = getFooterValue(data, field, config);
|
|
1839
1841
|
result[field] = total ?? "";
|
|
1840
1842
|
}
|
|
1841
|
-
if (result[labelField] === "" || result[labelField] === null) {
|
|
1842
|
-
result[labelField] = label;
|
|
1843
|
-
}
|
|
1844
1843
|
return result;
|
|
1845
1844
|
};
|
|
1846
1845
|
|
|
@@ -3260,7 +3259,7 @@ var enUS3 = {
|
|
|
3260
3259
|
"common.report-col.sales-mix-by-pct.short": "Sales Mix %",
|
|
3261
3260
|
"common.report-col.sales-mix-by-pct.info": "Percentage of total sales contributed by this item or category",
|
|
3262
3261
|
"common.report-col.sales-per-guest": "Sales/Guest",
|
|
3263
|
-
"common.report-col.sales-per-guest.short": "
|
|
3262
|
+
"common.report-col.sales-per-guest.short": "Sales/Guest",
|
|
3264
3263
|
"common.report-col.sales-per-guest.info": "Average spend per guest",
|
|
3265
3264
|
"common.report-col.sales-per-guest-lw": "Sales/Guest LW",
|
|
3266
3265
|
"common.report-col.sales-per-guest-lw.short": "Amt/Guest LW",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-
|
|
2
|
-
export { e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getReportConfig, n as getReportExportFileName } from './report-
|
|
1
|
+
import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-Bx5XpFQ0.cjs';
|
|
2
|
+
export { e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getReportConfig, n as getReportExportFileName } from './report-Bx5XpFQ0.cjs';
|
|
3
3
|
import { LocaleCode } from '@harbortouch/locale-registry';
|
|
4
4
|
|
|
5
5
|
type SupportedLocale = LocaleCode;
|
|
@@ -8,18 +8,15 @@ declare function resolveTranslate(key: MessageKey, locale: string): string;
|
|
|
8
8
|
declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
|
|
9
9
|
declare function isNumericType(type?: FieldType): boolean;
|
|
10
10
|
|
|
11
|
-
interface CalculateReportTotalsOptions {
|
|
12
|
-
labelField: string;
|
|
13
|
-
label: string;
|
|
14
|
-
}
|
|
15
11
|
declare const getFooterValue: <T>(rows: T[], field: keyof T, config: ColumnPresentationConfig) => number | "common.report-col.fifteen-min-interval" | "common.report-col.fifteen-min-interval.short" | "common.report-col.fifteen-min-interval.info" | "common.report-col.adjusted-tips" | "common.report-col.adjusted-tips.short" | "common.report-col.adjusted-tips.info" | "common.report-col.advantage-program" | "common.report-col.advantage-program.short" | "common.report-col.advantage-program.info" | "common.report-col.amex" | "common.report-col.amex.short" | "common.report-col.amex.info" | "common.report-col.amex-returns" | "common.report-col.amex-returns.short" | "common.report-col.amex-returns.info" | "common.report-col.attach-rate" | "common.report-col.attach-rate.short" | "common.report-col.attach-rate.info" | "common.report-col.auto-gratuity" | "common.report-col.auto-gratuity.short" | "common.report-col.auto-gratuity.info" | "common.report-col.average-gross-price" | "common.report-col.average-gross-price.short" | "common.report-col.average-gross-price.info" | "common.report-col.bank-fees" | "common.report-col.bank-fees.short" | "common.report-col.bank-fees.info" | "common.report-col.batch-amount" | "common.report-col.batch-amount.short" | "common.report-col.batch-amount.info" | "common.report-col.batch-date" | "common.report-col.batch-date.short" | "common.report-col.batch-date.info" | "common.report-col.batch-number" | "common.report-col.batch-number.short" | "common.report-col.batch-number.info" | "common.report-col.clock-in-time" | "common.report-col.clock-in-time.short" | "common.report-col.clock-in-time.info" | "common.report-col.clock-out-time" | "common.report-col.clock-out-time.short" | "common.report-col.clock-out-time.info" | "common.report-col.status" | "common.report-col.status.short" | "common.report-col.status.info" | "common.report-col.last-modified" | "common.report-col.last-modified.short" | "common.report-col.last-modified.info" | "common.report-col.country" | "common.report-col.country.short" | "common.report-col.country.info" | "common.report-col.customer-name" | "common.report-col.customer-name.short" | "common.report-col.customer-name.info" | "common.report-col.date" | "common.report-col.date.short" | "common.report-col.date.info" | "common.report-col.date-close" | "common.report-col.date-close.short" | "common.report-col.date-close.info" | "common.report-col.daypart" | "common.report-col.daypart.short" | "common.report-col.daypart.info" | "common.report-col.debit" | "common.report-col.debit.short" | "common.report-col.debit.info" | "common.report-col.debit-returns" | "common.report-col.debit-returns.short" | "common.report-col.debit-returns.info" | "common.report-col.declared-tips" | "common.report-col.declared-tips.short" | "common.report-col.declared-tips.info" | "common.report-col.department" | "common.report-col.department.short" | "common.report-col.department.info" | "common.report-col.deposit-currency" | "common.report-col.deposit-currency.short" | "common.report-col.deposit-currency.info" | "common.report-col.deposit-date" | "common.report-col.deposit-date.short" | "common.report-col.deposit-date.info" | "common.report-col.discount-amount" | "common.report-col.discount-amount.short" | "common.report-col.discount-amount.info" | "common.report-col.discount-count" | "common.report-col.discount-count.short" | "common.report-col.discount-count.info" | "common.report-col.ticket-count" | "common.report-col.ticket-count.short" | "common.report-col.ticket-count.info" | "common.report-col.item-count" | "common.report-col.item-count.short" | "common.report-col.item-count.info" | "common.report-col.discover" | "common.report-col.discover.short" | "common.report-col.discover.info" | "common.report-col.discover-returns" | "common.report-col.discover-returns.short" | "common.report-col.discover-returns.info" | "common.report-col.ebt" | "common.report-col.ebt.short" | "common.report-col.ebt.info" | "common.report-col.ebt-returns" | "common.report-col.ebt-returns.short" | "common.report-col.ebt-returns.info" | "common.report-col.employee-id" | "common.report-col.employee-id.short" | "common.report-col.employee-id.info" | "common.report-col.employee-job" | "common.report-col.employee-job.short" | "common.report-col.employee-job.info" | "common.report-col.employee-name" | "common.report-col.employee-name.short" | "common.report-col.employee-name.info" | "common.report-col.exempt-taxes" | "common.report-col.exempt-taxes.short" | "common.report-col.exempt-taxes.info" | "common.report-col.exempt-sales" | "common.report-col.exempt-sales.short" | "common.report-col.exempt-sales.info" | "common.report-col.grand-total" | "common.report-col.grand-total.short" | "common.report-col.grand-total.info" | "common.report-col.gross-cash-sales" | "common.report-col.gross-cash-sales.short" | "common.report-col.gross-cash-sales.info" | "common.report-col.gross-credit-sales" | "common.report-col.gross-credit-sales.short" | "common.report-col.gross-credit-sales.info" | "common.report-col.gross-sales" | "common.report-col.gross-sales.short" | "common.report-col.gross-sales.info" | "common.report-col.gross-tips" | "common.report-col.gross-tips.short" | "common.report-col.gross-tips.info" | "common.report-col.guest-count" | "common.report-col.guest-count.short" | "common.report-col.guest-count.info" | "common.report-col.guests-var-lw" | "common.report-col.guests-var-lw.short" | "common.report-col.guests-var-lw.info" | "common.report-col.guests-var-lw-pct" | "common.report-col.guests-var-lw-pct.short" | "common.report-col.guests-var-lw-pct.info" | "common.report-col.guests-var-ly" | "common.report-col.guests-var-ly.short" | "common.report-col.guests-var-ly.info" | "common.report-col.guests-var-ly-pct" | "common.report-col.guests-var-ly-pct.short" | "common.report-col.guests-var-ly-pct.info" | "common.report-col.hour" | "common.report-col.hour.short" | "common.report-col.hour.info" | "common.report-col.hours-worked" | "common.report-col.hours-worked.short" | "common.report-col.hours-worked.info" | "common.report-col.inclusive-tax" | "common.report-col.inclusive-tax.short" | "common.report-col.inclusive-tax.info" | "common.report-col.item-name" | "common.report-col.item-name.short" | "common.report-col.item-name.info" | "common.report-col.item-price" | "common.report-col.item-price.short" | "common.report-col.item-price.info" | "common.report-col.location-city" | "common.report-col.location-city.short" | "common.report-col.location-city.info" | "common.report-col.location-id" | "common.report-col.location-id.short" | "common.report-col.location-id.info" | "common.report-col.location-mid" | "common.report-col.location-mid.short" | "common.report-col.location-mid.info" | "common.report-col.location-name" | "common.report-col.location-name.short" | "common.report-col.location-name.info" | "common.report-col.location-state" | "common.report-col.location-state.short" | "common.report-col.location-state.info" | "common.report-col.mastercard" | "common.report-col.mastercard.short" | "common.report-col.mastercard.info" | "common.report-col.mc-returns" | "common.report-col.mc-returns.short" | "common.report-col.mc-returns.info" | "common.report-col.modifier-name" | "common.report-col.modifier-name.short" | "common.report-col.modifier-name.info" | "common.report-col.modifier-price" | "common.report-col.modifier-price.short" | "common.report-col.modifier-price.info" | "common.report-col.modifier-quantity" | "common.report-col.modifier-quantity.short" | "common.report-col.modifier-quantity.info" | "common.report-col.item-quantity" | "common.report-col.item-quantity.short" | "common.report-col.item-quantity.info" | "common.report-col.modifier-quantity-comp" | "common.report-col.modifier-quantity-comp.short" | "common.report-col.modifier-quantity-comp.info" | "common.report-col.item-quantity-comp" | "common.report-col.item-quantity-comp.short" | "common.report-col.item-quantity-comp.info" | "common.report-col.attach-rate-comp" | "common.report-col.attach-rate-comp.short" | "common.report-col.attach-rate-comp.info" | "common.report-col.total-modifier-sales-var" | "common.report-col.total-modifier-sales-var.short" | "common.report-col.total-modifier-sales-var.info" | "common.report-col.total-modifier-sales-var-pct" | "common.report-col.total-modifier-sales-var-pct.short" | "common.report-col.total-modifier-sales-var-pct.info" | "common.report-col.modifier-quantity-var" | "common.report-col.modifier-quantity-var.short" | "common.report-col.modifier-quantity-var.info" | "common.report-col.modifier-quantity-var-pct" | "common.report-col.modifier-quantity-var-pct.short" | "common.report-col.modifier-quantity-var-pct.info" | "common.report-col.attach-rate-var" | "common.report-col.attach-rate-var.short" | "common.report-col.attach-rate-var.info" | "common.report-col.attach-rate-var-pct" | "common.report-col.attach-rate-var-pct.short" | "common.report-col.attach-rate-var-pct.info" | "common.report-col.total-modifier-sales-comp" | "common.report-col.total-modifier-sales-comp.short" | "common.report-col.total-modifier-sales-comp.info" | "common.report-col.net-sales" | "common.report-col.net-sales.short" | "common.report-col.net-sales.info" | "common.report-col.net-tax-collected" | "common.report-col.net-tax-collected.short" | "common.report-col.net-tax-collected.info" | "common.report-col.net-tips" | "common.report-col.net-tips.short" | "common.report-col.net-tips.info" | "common.report-col.number-of-guests" | "common.report-col.number-of-guests.short" | "common.report-col.number-of-guests.info" | "common.report-col.order-type" | "common.report-col.order-type.short" | "common.report-col.order-type.info" | "common.report-col.payment-type" | "common.report-col.payment-type.short" | "common.report-col.payment-type.info" | "common.report-col.payroll-id" | "common.report-col.payroll-id.short" | "common.report-col.payroll-id.info" | "common.report-col.quantity" | "common.report-col.quantity.short" | "common.report-col.quantity.info" | "common.report-col.reference-number" | "common.report-col.reference-number.short" | "common.report-col.reference-number.info" | "common.report-col.refund-amount" | "common.report-col.refund-amount.short" | "common.report-col.refund-amount.info" | "common.report-col.refunded-tax-amount" | "common.report-col.refunded-tax-amount.short" | "common.report-col.refunded-tax-amount.info" | "common.report-col.revenue-center" | "common.report-col.revenue-center.short" | "common.report-col.revenue-center.info" | "common.report-col.revenue-class" | "common.report-col.revenue-class.short" | "common.report-col.revenue-class.info" | "common.report-col.sales-var-lw" | "common.report-col.sales-var-lw.short" | "common.report-col.sales-var-lw.info" | "common.report-col.sales-var-lw-pct" | "common.report-col.sales-var-lw-pct.short" | "common.report-col.sales-var-lw-pct.info" | "common.report-col.sales-var-ly" | "common.report-col.sales-var-ly.short" | "common.report-col.sales-var-ly.info" | "common.report-col.sales-var-ly-pct" | "common.report-col.sales-var-ly-pct.short" | "common.report-col.sales-var-ly-pct.info" | "common.report-col.sales-mix-by-pct" | "common.report-col.sales-mix-by-pct.short" | "common.report-col.sales-mix-by-pct.info" | "common.report-col.sales-per-guest" | "common.report-col.sales-per-guest.short" | "common.report-col.sales-per-guest.info" | "common.report-col.sales-per-guest-lw" | "common.report-col.sales-per-guest-lw.short" | "common.report-col.sales-per-guest-lw.info" | "common.report-col.sales-per-guest-ly" | "common.report-col.sales-per-guest-ly.short" | "common.report-col.sales-per-guest-ly.info" | "common.report-col.scheduled-shift-end" | "common.report-col.scheduled-shift-end.short" | "common.report-col.scheduled-shift-end.info" | "common.report-col.scheduled-shift-start" | "common.report-col.scheduled-shift-start.short" | "common.report-col.scheduled-shift-start.info" | "common.report-col.settlement-batch-date" | "common.report-col.settlement-batch-date.short" | "common.report-col.settlement-batch-date.info" | "common.report-col.shift-duration-hrs" | "common.report-col.shift-duration-hrs.short" | "common.report-col.shift-duration-hrs.info" | "common.report-col.subtotal" | "common.report-col.subtotal.short" | "common.report-col.subtotal.info" | "common.report-col.tax-collected" | "common.report-col.tax-collected.short" | "common.report-col.tax-collected.info" | "common.report-col.tax-name" | "common.report-col.tax-name.short" | "common.report-col.tax-name.info" | "common.report-col.tax-rate" | "common.report-col.tax-rate.short" | "common.report-col.tax-rate.info" | "common.report-col.taxable-sales" | "common.report-col.taxable-sales.short" | "common.report-col.taxable-sales.info" | "common.report-col.ticket-closed" | "common.report-col.ticket-closed.short" | "common.report-col.ticket-closed.info" | "common.report-col.ticket-fee" | "common.report-col.ticket-fee.short" | "common.report-col.ticket-fee.info" | "common.report-col.ticket-number" | "common.report-col.ticket-number.short" | "common.report-col.ticket-number.info" | "common.report-col.ticket-open" | "common.report-col.ticket-open.short" | "common.report-col.ticket-open.info" | "common.report-col.ticket-total" | "common.report-col.ticket-total.short" | "common.report-col.ticket-total.info" | "common.report-col.time-open-mins" | "common.report-col.time-open-mins.short" | "common.report-col.time-open-mins.info" | "common.report-col.tip-pct" | "common.report-col.tip-pct.short" | "common.report-col.tip-pct.info" | "common.report-col.tip-reduction" | "common.report-col.tip-reduction.short" | "common.report-col.tip-reduction.info" | "common.report-col.tip-share" | "common.report-col.tip-share.short" | "common.report-col.tip-share.info" | "common.report-col.tips" | "common.report-col.tips.short" | "common.report-col.tips.info" | "common.report-col.tips-per-hour" | "common.report-col.tips-per-hour.short" | "common.report-col.tips-per-hour.info" | "common.report-col.total-collected" | "common.report-col.total-collected.short" | "common.report-col.total-collected.info" | "common.report-col.total-item-sales" | "common.report-col.total-item-sales.short" | "common.report-col.total-item-sales.info" | "common.report-col.total-modifier-sales" | "common.report-col.total-modifier-sales.short" | "common.report-col.total-modifier-sales.info" | "common.report-col.total-returns" | "common.report-col.total-returns.short" | "common.report-col.total-returns.info" | "common.report-col.total-sales" | "common.report-col.total-sales.short" | "common.report-col.total-sales.info" | "common.report-col.total-tips" | "common.report-col.total-tips.short" | "common.report-col.total-tips.info" | "common.report-col.transaction-date" | "common.report-col.transaction-date.short" | "common.report-col.transaction-date.info" | "common.report-col.sale-payment-type" | "common.report-col.sale-payment-type.short" | "common.report-col.sale-payment-type.info" | "common.report-col.transaction-type" | "common.report-col.transaction-type.short" | "common.report-col.transaction-type.info" | "common.report-col.untaxed-sales" | "common.report-col.untaxed-sales.short" | "common.report-col.untaxed-sales.info" | "common.report-col.visa" | "common.report-col.visa.short" | "common.report-col.visa.info" | "common.report-col.visa-returns" | "common.report-col.visa-returns.short" | "common.report-col.visa-returns.info" | "common.report-col.payments-count" | "common.report-col.payments-count.short" | "common.report-col.payments-count.info" | "common.report-col.payments-amount" | "common.report-col.payments-amount.short" | "common.report-col.payments-amount.info" | "common.report-col.payments-total" | "common.report-col.payments-total.short" | "common.report-col.payments-total.info" | "common.report-col.refund-void-description" | "common.report-col.refund-void-description.short" | "common.report-col.refund-void-description.info" | "common.report-col.refund-void-count" | "common.report-col.refund-void-count.short" | "common.report-col.refund-void-count.info" | "common.report-col.refund-void-amount" | "common.report-col.refund-void-amount.short" | "common.report-col.refund-void-amount.info" | "common.report-col.refund-void-pct-sales" | "common.report-col.refund-void-pct-sales.short" | "common.report-col.refund-void-pct-sales.info" | "common.report-col.discount-name" | "common.report-col.discount-name.short" | "common.report-col.discount-name.info" | "common.report-col.tickets" | "common.report-col.tickets.short" | "common.report-col.tickets.info" | "common.report-col.guests" | "common.report-col.guests.short" | "common.report-col.guests.info" | "common.report-col.ticket-average" | "common.report-col.ticket-average.short" | "common.report-col.ticket-average.info" | "common.report-col.guest-average" | "common.report-col.guest-average.short" | "common.report-col.guest-average.info" | "common.report-col.net" | "common.report-col.net.short" | "common.report-col.net.info" | "common.report-col.gross-cash-tips" | "common.report-col.gross-cash-tips.short" | "common.report-col.gross-cash-tips.info" | "common.report-col.gross-credit-card-tips" | "common.report-col.gross-credit-card-tips.short" | "common.report-col.gross-credit-card-tips.info" | "common.report-col.type" | "common.report-col.type.short" | "common.report-col.type.info" | "common.report-section.revenue-class" | "common.report-section.payments" | "common.report-section.cash" | "common.report-section.taxes" | "common.report-section.refunds-voids" | "common.report-section.discounts" | "common.report-section.sales-by-day-part" | "common.report-section.sales-by-order-type" | "common.report-section.cash-row.cash-payments" | "common.report-section.cash-row.paid-in-outs" | "common.report-section.cash-row.gratuities-paid-out" | "common.report-section.cash-row.cc-tips-paid-out" | "common.report-section.trends-footer.total-sales" | "common.report-section.rev-class-footer.tax-total" | "common.report-section.rev-class-footer.gratuities" | "common.report-section.rev-class-footer.balance-payments" | "common.report-section.rev-class-footer.gift-card-sales" | "common.report-section.rev-class-footer.non-sales-revenue" | "common.report-section.rev-class-footer.house-account" | "common.report-section.rev-class-footer.total-accountable" | "scheduled-reports.period" | "components.form.field.group-by" | "components.form.field.last-week" | "components.form.field.last-year" | "common.labels.locations" | "common.labels.yes" | "analytics.field.location_id" | "analytics.field.order_type_id" | "analytics.field.revenue_center_id" | "analytics.field.revenue_center_id.all" | "analytics.field.hour_id" | "analytics.field.daypart_id" | "analytics.field.timeslot_id" | "analytics.field.employee_id" | "analytics.field.payroll_id" | "analytics.field.intraday_period_group" | "analytics.field.item_id" | "analytics.field.department_id" | "analytics.field.revenue_class_id" | "analytics.field.modifier_id" | "table.total" | "table.groups.sales" | "table.groups.net-sales" | "table.groups.guests" | "table.groups.sales-per-guest" | null;
|
|
16
|
-
declare const calculateReportTotals: <T>(data: T[], fieldConfig: Record<string, ColumnPresentationConfig
|
|
12
|
+
declare const calculateReportTotals: <T>(data: T[], fieldConfig: Record<string, ColumnPresentationConfig>) => T;
|
|
17
13
|
|
|
18
14
|
type SalesSummaryField = 'groupById' | 'groupByName' | 'salesAmountNet' | 'salesVarLW' | 'salesVarLY' | 'salesVarLWPct' | 'salesVarLYPct' | 'salesAmountNetLastWeek' | 'salesAmountNetLastYear' | 'salesAmountGross' | 'salesAmountGrossLastWeek' | 'salesAmountGrossLastYear' | 'ticketsCount' | 'ticketsCountLastWeek' | 'ticketsCountLastYear' | 'guestsCount' | 'guestsVarLW' | 'guestsVarLY' | 'guestsVarLWPct' | 'guestsVarLYPct' | 'guestsCountLastWeek' | 'guestsCountLastYear' | 'salesPerGuestTY' | 'salesPerGuestLW' | 'salesPerGuestLY';
|
|
19
15
|
declare const salesSummaryConfig: {
|
|
20
16
|
readonly fields: Record<SalesSummaryField, ColumnPresentationConfig<SalesSummaryField>>;
|
|
21
17
|
readonly availableColumns: SalesSummaryField[];
|
|
22
18
|
readonly defaultVisibleColumns: SalesSummaryField[];
|
|
19
|
+
readonly chartFields: SalesSummaryField[];
|
|
23
20
|
readonly columnGroups: ColumnGroupConfig[];
|
|
24
21
|
readonly hasFooter: true;
|
|
25
22
|
};
|
|
@@ -52,6 +49,7 @@ declare const productMixConfig: {
|
|
|
52
49
|
type ModifierMixField = 'groupById' | 'groupByName' | 'groupById2' | 'groupByName2' | 'modifiersSales' | 'modifiersQuantity' | 'itemsQuantity' | 'avgGross' | 'attachRate' | 'modifiersSalesComp' | 'modifiersQuantityComp' | 'itemsQuantityComp' | 'attachRateComp' | 'modifiersSalesVar' | 'modifiersSalesVarPct' | 'modifiersQuantityVar' | 'modifiersQuantityVarPct' | 'attachRateVar' | 'attachRateVarPct';
|
|
53
50
|
declare const modifierMixConfig: {
|
|
54
51
|
readonly fields: Record<ModifierMixField, ColumnPresentationConfig<ModifierMixField>>;
|
|
52
|
+
readonly chartFields: ModifierMixField[];
|
|
55
53
|
readonly availableColumns: ModifierMixField[];
|
|
56
54
|
readonly defaultVisibleColumns: ModifierMixField[];
|
|
57
55
|
readonly hasFooter: true;
|
|
@@ -306,4 +304,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
|
|
|
306
304
|
}[]) => LocaleOption[];
|
|
307
305
|
declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
|
|
308
306
|
|
|
309
|
-
export {
|
|
307
|
+
export { ColumnAlignment, ColumnGroupConfig, ColumnPresentationConfig, DAILY_SALES_CASH_ROW_LABELS, DAILY_SALES_REV_CLASS_FOOTER_LABELS, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, FieldType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, REPORT_SECTION_CONFIGS, ReportColumnKey, ReportConfig, type ReportSectionColumnDef, type ReportSectionDefinition, ReportType, type SalesByItemDetailField, type SalesSummaryField, type SupportedLocale, TENDER_TYPE, type TicketLiveField, type TicketSummaryField, type TimeFormat, buildDailySalesCashPayments, buildDailySalesRevClassFooter, buildPaymentsSectionData, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, dailySalesTrendsOrderTypeConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getDateToFormat, getFooterValue, getNumberToFormat, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, resolveTranslate, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-
|
|
2
|
-
export { e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getReportConfig, n as getReportExportFileName } from './report-
|
|
1
|
+
import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-Bx5XpFQ0.js';
|
|
2
|
+
export { e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getReportConfig, n as getReportExportFileName } from './report-Bx5XpFQ0.js';
|
|
3
3
|
import { LocaleCode } from '@harbortouch/locale-registry';
|
|
4
4
|
|
|
5
5
|
type SupportedLocale = LocaleCode;
|
|
@@ -8,18 +8,15 @@ declare function resolveTranslate(key: MessageKey, locale: string): string;
|
|
|
8
8
|
declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
|
|
9
9
|
declare function isNumericType(type?: FieldType): boolean;
|
|
10
10
|
|
|
11
|
-
interface CalculateReportTotalsOptions {
|
|
12
|
-
labelField: string;
|
|
13
|
-
label: string;
|
|
14
|
-
}
|
|
15
11
|
declare const getFooterValue: <T>(rows: T[], field: keyof T, config: ColumnPresentationConfig) => number | "common.report-col.fifteen-min-interval" | "common.report-col.fifteen-min-interval.short" | "common.report-col.fifteen-min-interval.info" | "common.report-col.adjusted-tips" | "common.report-col.adjusted-tips.short" | "common.report-col.adjusted-tips.info" | "common.report-col.advantage-program" | "common.report-col.advantage-program.short" | "common.report-col.advantage-program.info" | "common.report-col.amex" | "common.report-col.amex.short" | "common.report-col.amex.info" | "common.report-col.amex-returns" | "common.report-col.amex-returns.short" | "common.report-col.amex-returns.info" | "common.report-col.attach-rate" | "common.report-col.attach-rate.short" | "common.report-col.attach-rate.info" | "common.report-col.auto-gratuity" | "common.report-col.auto-gratuity.short" | "common.report-col.auto-gratuity.info" | "common.report-col.average-gross-price" | "common.report-col.average-gross-price.short" | "common.report-col.average-gross-price.info" | "common.report-col.bank-fees" | "common.report-col.bank-fees.short" | "common.report-col.bank-fees.info" | "common.report-col.batch-amount" | "common.report-col.batch-amount.short" | "common.report-col.batch-amount.info" | "common.report-col.batch-date" | "common.report-col.batch-date.short" | "common.report-col.batch-date.info" | "common.report-col.batch-number" | "common.report-col.batch-number.short" | "common.report-col.batch-number.info" | "common.report-col.clock-in-time" | "common.report-col.clock-in-time.short" | "common.report-col.clock-in-time.info" | "common.report-col.clock-out-time" | "common.report-col.clock-out-time.short" | "common.report-col.clock-out-time.info" | "common.report-col.status" | "common.report-col.status.short" | "common.report-col.status.info" | "common.report-col.last-modified" | "common.report-col.last-modified.short" | "common.report-col.last-modified.info" | "common.report-col.country" | "common.report-col.country.short" | "common.report-col.country.info" | "common.report-col.customer-name" | "common.report-col.customer-name.short" | "common.report-col.customer-name.info" | "common.report-col.date" | "common.report-col.date.short" | "common.report-col.date.info" | "common.report-col.date-close" | "common.report-col.date-close.short" | "common.report-col.date-close.info" | "common.report-col.daypart" | "common.report-col.daypart.short" | "common.report-col.daypart.info" | "common.report-col.debit" | "common.report-col.debit.short" | "common.report-col.debit.info" | "common.report-col.debit-returns" | "common.report-col.debit-returns.short" | "common.report-col.debit-returns.info" | "common.report-col.declared-tips" | "common.report-col.declared-tips.short" | "common.report-col.declared-tips.info" | "common.report-col.department" | "common.report-col.department.short" | "common.report-col.department.info" | "common.report-col.deposit-currency" | "common.report-col.deposit-currency.short" | "common.report-col.deposit-currency.info" | "common.report-col.deposit-date" | "common.report-col.deposit-date.short" | "common.report-col.deposit-date.info" | "common.report-col.discount-amount" | "common.report-col.discount-amount.short" | "common.report-col.discount-amount.info" | "common.report-col.discount-count" | "common.report-col.discount-count.short" | "common.report-col.discount-count.info" | "common.report-col.ticket-count" | "common.report-col.ticket-count.short" | "common.report-col.ticket-count.info" | "common.report-col.item-count" | "common.report-col.item-count.short" | "common.report-col.item-count.info" | "common.report-col.discover" | "common.report-col.discover.short" | "common.report-col.discover.info" | "common.report-col.discover-returns" | "common.report-col.discover-returns.short" | "common.report-col.discover-returns.info" | "common.report-col.ebt" | "common.report-col.ebt.short" | "common.report-col.ebt.info" | "common.report-col.ebt-returns" | "common.report-col.ebt-returns.short" | "common.report-col.ebt-returns.info" | "common.report-col.employee-id" | "common.report-col.employee-id.short" | "common.report-col.employee-id.info" | "common.report-col.employee-job" | "common.report-col.employee-job.short" | "common.report-col.employee-job.info" | "common.report-col.employee-name" | "common.report-col.employee-name.short" | "common.report-col.employee-name.info" | "common.report-col.exempt-taxes" | "common.report-col.exempt-taxes.short" | "common.report-col.exempt-taxes.info" | "common.report-col.exempt-sales" | "common.report-col.exempt-sales.short" | "common.report-col.exempt-sales.info" | "common.report-col.grand-total" | "common.report-col.grand-total.short" | "common.report-col.grand-total.info" | "common.report-col.gross-cash-sales" | "common.report-col.gross-cash-sales.short" | "common.report-col.gross-cash-sales.info" | "common.report-col.gross-credit-sales" | "common.report-col.gross-credit-sales.short" | "common.report-col.gross-credit-sales.info" | "common.report-col.gross-sales" | "common.report-col.gross-sales.short" | "common.report-col.gross-sales.info" | "common.report-col.gross-tips" | "common.report-col.gross-tips.short" | "common.report-col.gross-tips.info" | "common.report-col.guest-count" | "common.report-col.guest-count.short" | "common.report-col.guest-count.info" | "common.report-col.guests-var-lw" | "common.report-col.guests-var-lw.short" | "common.report-col.guests-var-lw.info" | "common.report-col.guests-var-lw-pct" | "common.report-col.guests-var-lw-pct.short" | "common.report-col.guests-var-lw-pct.info" | "common.report-col.guests-var-ly" | "common.report-col.guests-var-ly.short" | "common.report-col.guests-var-ly.info" | "common.report-col.guests-var-ly-pct" | "common.report-col.guests-var-ly-pct.short" | "common.report-col.guests-var-ly-pct.info" | "common.report-col.hour" | "common.report-col.hour.short" | "common.report-col.hour.info" | "common.report-col.hours-worked" | "common.report-col.hours-worked.short" | "common.report-col.hours-worked.info" | "common.report-col.inclusive-tax" | "common.report-col.inclusive-tax.short" | "common.report-col.inclusive-tax.info" | "common.report-col.item-name" | "common.report-col.item-name.short" | "common.report-col.item-name.info" | "common.report-col.item-price" | "common.report-col.item-price.short" | "common.report-col.item-price.info" | "common.report-col.location-city" | "common.report-col.location-city.short" | "common.report-col.location-city.info" | "common.report-col.location-id" | "common.report-col.location-id.short" | "common.report-col.location-id.info" | "common.report-col.location-mid" | "common.report-col.location-mid.short" | "common.report-col.location-mid.info" | "common.report-col.location-name" | "common.report-col.location-name.short" | "common.report-col.location-name.info" | "common.report-col.location-state" | "common.report-col.location-state.short" | "common.report-col.location-state.info" | "common.report-col.mastercard" | "common.report-col.mastercard.short" | "common.report-col.mastercard.info" | "common.report-col.mc-returns" | "common.report-col.mc-returns.short" | "common.report-col.mc-returns.info" | "common.report-col.modifier-name" | "common.report-col.modifier-name.short" | "common.report-col.modifier-name.info" | "common.report-col.modifier-price" | "common.report-col.modifier-price.short" | "common.report-col.modifier-price.info" | "common.report-col.modifier-quantity" | "common.report-col.modifier-quantity.short" | "common.report-col.modifier-quantity.info" | "common.report-col.item-quantity" | "common.report-col.item-quantity.short" | "common.report-col.item-quantity.info" | "common.report-col.modifier-quantity-comp" | "common.report-col.modifier-quantity-comp.short" | "common.report-col.modifier-quantity-comp.info" | "common.report-col.item-quantity-comp" | "common.report-col.item-quantity-comp.short" | "common.report-col.item-quantity-comp.info" | "common.report-col.attach-rate-comp" | "common.report-col.attach-rate-comp.short" | "common.report-col.attach-rate-comp.info" | "common.report-col.total-modifier-sales-var" | "common.report-col.total-modifier-sales-var.short" | "common.report-col.total-modifier-sales-var.info" | "common.report-col.total-modifier-sales-var-pct" | "common.report-col.total-modifier-sales-var-pct.short" | "common.report-col.total-modifier-sales-var-pct.info" | "common.report-col.modifier-quantity-var" | "common.report-col.modifier-quantity-var.short" | "common.report-col.modifier-quantity-var.info" | "common.report-col.modifier-quantity-var-pct" | "common.report-col.modifier-quantity-var-pct.short" | "common.report-col.modifier-quantity-var-pct.info" | "common.report-col.attach-rate-var" | "common.report-col.attach-rate-var.short" | "common.report-col.attach-rate-var.info" | "common.report-col.attach-rate-var-pct" | "common.report-col.attach-rate-var-pct.short" | "common.report-col.attach-rate-var-pct.info" | "common.report-col.total-modifier-sales-comp" | "common.report-col.total-modifier-sales-comp.short" | "common.report-col.total-modifier-sales-comp.info" | "common.report-col.net-sales" | "common.report-col.net-sales.short" | "common.report-col.net-sales.info" | "common.report-col.net-tax-collected" | "common.report-col.net-tax-collected.short" | "common.report-col.net-tax-collected.info" | "common.report-col.net-tips" | "common.report-col.net-tips.short" | "common.report-col.net-tips.info" | "common.report-col.number-of-guests" | "common.report-col.number-of-guests.short" | "common.report-col.number-of-guests.info" | "common.report-col.order-type" | "common.report-col.order-type.short" | "common.report-col.order-type.info" | "common.report-col.payment-type" | "common.report-col.payment-type.short" | "common.report-col.payment-type.info" | "common.report-col.payroll-id" | "common.report-col.payroll-id.short" | "common.report-col.payroll-id.info" | "common.report-col.quantity" | "common.report-col.quantity.short" | "common.report-col.quantity.info" | "common.report-col.reference-number" | "common.report-col.reference-number.short" | "common.report-col.reference-number.info" | "common.report-col.refund-amount" | "common.report-col.refund-amount.short" | "common.report-col.refund-amount.info" | "common.report-col.refunded-tax-amount" | "common.report-col.refunded-tax-amount.short" | "common.report-col.refunded-tax-amount.info" | "common.report-col.revenue-center" | "common.report-col.revenue-center.short" | "common.report-col.revenue-center.info" | "common.report-col.revenue-class" | "common.report-col.revenue-class.short" | "common.report-col.revenue-class.info" | "common.report-col.sales-var-lw" | "common.report-col.sales-var-lw.short" | "common.report-col.sales-var-lw.info" | "common.report-col.sales-var-lw-pct" | "common.report-col.sales-var-lw-pct.short" | "common.report-col.sales-var-lw-pct.info" | "common.report-col.sales-var-ly" | "common.report-col.sales-var-ly.short" | "common.report-col.sales-var-ly.info" | "common.report-col.sales-var-ly-pct" | "common.report-col.sales-var-ly-pct.short" | "common.report-col.sales-var-ly-pct.info" | "common.report-col.sales-mix-by-pct" | "common.report-col.sales-mix-by-pct.short" | "common.report-col.sales-mix-by-pct.info" | "common.report-col.sales-per-guest" | "common.report-col.sales-per-guest.short" | "common.report-col.sales-per-guest.info" | "common.report-col.sales-per-guest-lw" | "common.report-col.sales-per-guest-lw.short" | "common.report-col.sales-per-guest-lw.info" | "common.report-col.sales-per-guest-ly" | "common.report-col.sales-per-guest-ly.short" | "common.report-col.sales-per-guest-ly.info" | "common.report-col.scheduled-shift-end" | "common.report-col.scheduled-shift-end.short" | "common.report-col.scheduled-shift-end.info" | "common.report-col.scheduled-shift-start" | "common.report-col.scheduled-shift-start.short" | "common.report-col.scheduled-shift-start.info" | "common.report-col.settlement-batch-date" | "common.report-col.settlement-batch-date.short" | "common.report-col.settlement-batch-date.info" | "common.report-col.shift-duration-hrs" | "common.report-col.shift-duration-hrs.short" | "common.report-col.shift-duration-hrs.info" | "common.report-col.subtotal" | "common.report-col.subtotal.short" | "common.report-col.subtotal.info" | "common.report-col.tax-collected" | "common.report-col.tax-collected.short" | "common.report-col.tax-collected.info" | "common.report-col.tax-name" | "common.report-col.tax-name.short" | "common.report-col.tax-name.info" | "common.report-col.tax-rate" | "common.report-col.tax-rate.short" | "common.report-col.tax-rate.info" | "common.report-col.taxable-sales" | "common.report-col.taxable-sales.short" | "common.report-col.taxable-sales.info" | "common.report-col.ticket-closed" | "common.report-col.ticket-closed.short" | "common.report-col.ticket-closed.info" | "common.report-col.ticket-fee" | "common.report-col.ticket-fee.short" | "common.report-col.ticket-fee.info" | "common.report-col.ticket-number" | "common.report-col.ticket-number.short" | "common.report-col.ticket-number.info" | "common.report-col.ticket-open" | "common.report-col.ticket-open.short" | "common.report-col.ticket-open.info" | "common.report-col.ticket-total" | "common.report-col.ticket-total.short" | "common.report-col.ticket-total.info" | "common.report-col.time-open-mins" | "common.report-col.time-open-mins.short" | "common.report-col.time-open-mins.info" | "common.report-col.tip-pct" | "common.report-col.tip-pct.short" | "common.report-col.tip-pct.info" | "common.report-col.tip-reduction" | "common.report-col.tip-reduction.short" | "common.report-col.tip-reduction.info" | "common.report-col.tip-share" | "common.report-col.tip-share.short" | "common.report-col.tip-share.info" | "common.report-col.tips" | "common.report-col.tips.short" | "common.report-col.tips.info" | "common.report-col.tips-per-hour" | "common.report-col.tips-per-hour.short" | "common.report-col.tips-per-hour.info" | "common.report-col.total-collected" | "common.report-col.total-collected.short" | "common.report-col.total-collected.info" | "common.report-col.total-item-sales" | "common.report-col.total-item-sales.short" | "common.report-col.total-item-sales.info" | "common.report-col.total-modifier-sales" | "common.report-col.total-modifier-sales.short" | "common.report-col.total-modifier-sales.info" | "common.report-col.total-returns" | "common.report-col.total-returns.short" | "common.report-col.total-returns.info" | "common.report-col.total-sales" | "common.report-col.total-sales.short" | "common.report-col.total-sales.info" | "common.report-col.total-tips" | "common.report-col.total-tips.short" | "common.report-col.total-tips.info" | "common.report-col.transaction-date" | "common.report-col.transaction-date.short" | "common.report-col.transaction-date.info" | "common.report-col.sale-payment-type" | "common.report-col.sale-payment-type.short" | "common.report-col.sale-payment-type.info" | "common.report-col.transaction-type" | "common.report-col.transaction-type.short" | "common.report-col.transaction-type.info" | "common.report-col.untaxed-sales" | "common.report-col.untaxed-sales.short" | "common.report-col.untaxed-sales.info" | "common.report-col.visa" | "common.report-col.visa.short" | "common.report-col.visa.info" | "common.report-col.visa-returns" | "common.report-col.visa-returns.short" | "common.report-col.visa-returns.info" | "common.report-col.payments-count" | "common.report-col.payments-count.short" | "common.report-col.payments-count.info" | "common.report-col.payments-amount" | "common.report-col.payments-amount.short" | "common.report-col.payments-amount.info" | "common.report-col.payments-total" | "common.report-col.payments-total.short" | "common.report-col.payments-total.info" | "common.report-col.refund-void-description" | "common.report-col.refund-void-description.short" | "common.report-col.refund-void-description.info" | "common.report-col.refund-void-count" | "common.report-col.refund-void-count.short" | "common.report-col.refund-void-count.info" | "common.report-col.refund-void-amount" | "common.report-col.refund-void-amount.short" | "common.report-col.refund-void-amount.info" | "common.report-col.refund-void-pct-sales" | "common.report-col.refund-void-pct-sales.short" | "common.report-col.refund-void-pct-sales.info" | "common.report-col.discount-name" | "common.report-col.discount-name.short" | "common.report-col.discount-name.info" | "common.report-col.tickets" | "common.report-col.tickets.short" | "common.report-col.tickets.info" | "common.report-col.guests" | "common.report-col.guests.short" | "common.report-col.guests.info" | "common.report-col.ticket-average" | "common.report-col.ticket-average.short" | "common.report-col.ticket-average.info" | "common.report-col.guest-average" | "common.report-col.guest-average.short" | "common.report-col.guest-average.info" | "common.report-col.net" | "common.report-col.net.short" | "common.report-col.net.info" | "common.report-col.gross-cash-tips" | "common.report-col.gross-cash-tips.short" | "common.report-col.gross-cash-tips.info" | "common.report-col.gross-credit-card-tips" | "common.report-col.gross-credit-card-tips.short" | "common.report-col.gross-credit-card-tips.info" | "common.report-col.type" | "common.report-col.type.short" | "common.report-col.type.info" | "common.report-section.revenue-class" | "common.report-section.payments" | "common.report-section.cash" | "common.report-section.taxes" | "common.report-section.refunds-voids" | "common.report-section.discounts" | "common.report-section.sales-by-day-part" | "common.report-section.sales-by-order-type" | "common.report-section.cash-row.cash-payments" | "common.report-section.cash-row.paid-in-outs" | "common.report-section.cash-row.gratuities-paid-out" | "common.report-section.cash-row.cc-tips-paid-out" | "common.report-section.trends-footer.total-sales" | "common.report-section.rev-class-footer.tax-total" | "common.report-section.rev-class-footer.gratuities" | "common.report-section.rev-class-footer.balance-payments" | "common.report-section.rev-class-footer.gift-card-sales" | "common.report-section.rev-class-footer.non-sales-revenue" | "common.report-section.rev-class-footer.house-account" | "common.report-section.rev-class-footer.total-accountable" | "scheduled-reports.period" | "components.form.field.group-by" | "components.form.field.last-week" | "components.form.field.last-year" | "common.labels.locations" | "common.labels.yes" | "analytics.field.location_id" | "analytics.field.order_type_id" | "analytics.field.revenue_center_id" | "analytics.field.revenue_center_id.all" | "analytics.field.hour_id" | "analytics.field.daypart_id" | "analytics.field.timeslot_id" | "analytics.field.employee_id" | "analytics.field.payroll_id" | "analytics.field.intraday_period_group" | "analytics.field.item_id" | "analytics.field.department_id" | "analytics.field.revenue_class_id" | "analytics.field.modifier_id" | "table.total" | "table.groups.sales" | "table.groups.net-sales" | "table.groups.guests" | "table.groups.sales-per-guest" | null;
|
|
16
|
-
declare const calculateReportTotals: <T>(data: T[], fieldConfig: Record<string, ColumnPresentationConfig
|
|
12
|
+
declare const calculateReportTotals: <T>(data: T[], fieldConfig: Record<string, ColumnPresentationConfig>) => T;
|
|
17
13
|
|
|
18
14
|
type SalesSummaryField = 'groupById' | 'groupByName' | 'salesAmountNet' | 'salesVarLW' | 'salesVarLY' | 'salesVarLWPct' | 'salesVarLYPct' | 'salesAmountNetLastWeek' | 'salesAmountNetLastYear' | 'salesAmountGross' | 'salesAmountGrossLastWeek' | 'salesAmountGrossLastYear' | 'ticketsCount' | 'ticketsCountLastWeek' | 'ticketsCountLastYear' | 'guestsCount' | 'guestsVarLW' | 'guestsVarLY' | 'guestsVarLWPct' | 'guestsVarLYPct' | 'guestsCountLastWeek' | 'guestsCountLastYear' | 'salesPerGuestTY' | 'salesPerGuestLW' | 'salesPerGuestLY';
|
|
19
15
|
declare const salesSummaryConfig: {
|
|
20
16
|
readonly fields: Record<SalesSummaryField, ColumnPresentationConfig<SalesSummaryField>>;
|
|
21
17
|
readonly availableColumns: SalesSummaryField[];
|
|
22
18
|
readonly defaultVisibleColumns: SalesSummaryField[];
|
|
19
|
+
readonly chartFields: SalesSummaryField[];
|
|
23
20
|
readonly columnGroups: ColumnGroupConfig[];
|
|
24
21
|
readonly hasFooter: true;
|
|
25
22
|
};
|
|
@@ -52,6 +49,7 @@ declare const productMixConfig: {
|
|
|
52
49
|
type ModifierMixField = 'groupById' | 'groupByName' | 'groupById2' | 'groupByName2' | 'modifiersSales' | 'modifiersQuantity' | 'itemsQuantity' | 'avgGross' | 'attachRate' | 'modifiersSalesComp' | 'modifiersQuantityComp' | 'itemsQuantityComp' | 'attachRateComp' | 'modifiersSalesVar' | 'modifiersSalesVarPct' | 'modifiersQuantityVar' | 'modifiersQuantityVarPct' | 'attachRateVar' | 'attachRateVarPct';
|
|
53
50
|
declare const modifierMixConfig: {
|
|
54
51
|
readonly fields: Record<ModifierMixField, ColumnPresentationConfig<ModifierMixField>>;
|
|
52
|
+
readonly chartFields: ModifierMixField[];
|
|
55
53
|
readonly availableColumns: ModifierMixField[];
|
|
56
54
|
readonly defaultVisibleColumns: ModifierMixField[];
|
|
57
55
|
readonly hasFooter: true;
|
|
@@ -306,4 +304,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
|
|
|
306
304
|
}[]) => LocaleOption[];
|
|
307
305
|
declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
|
|
308
306
|
|
|
309
|
-
export {
|
|
307
|
+
export { ColumnAlignment, ColumnGroupConfig, ColumnPresentationConfig, DAILY_SALES_CASH_ROW_LABELS, DAILY_SALES_REV_CLASS_FOOTER_LABELS, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, FieldType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, REPORT_SECTION_CONFIGS, ReportColumnKey, ReportConfig, type ReportSectionColumnDef, type ReportSectionDefinition, ReportType, type SalesByItemDetailField, type SalesSummaryField, type SupportedLocale, TENDER_TYPE, type TicketLiveField, type TicketSummaryField, type TimeFormat, buildDailySalesCashPayments, buildDailySalesRevClassFooter, buildPaymentsSectionData, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, dailySalesTrendsOrderTypeConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getDateToFormat, getFooterValue, getNumberToFormat, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, resolveTranslate, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
package/dist/index.js
CHANGED
|
@@ -1017,7 +1017,7 @@ declare const enUS: {
|
|
|
1017
1017
|
readonly 'common.report-col.sales-mix-by-pct.short': "Sales Mix %";
|
|
1018
1018
|
readonly 'common.report-col.sales-mix-by-pct.info': "Percentage of total sales contributed by this item or category";
|
|
1019
1019
|
readonly 'common.report-col.sales-per-guest': "Sales/Guest";
|
|
1020
|
-
readonly 'common.report-col.sales-per-guest.short': "
|
|
1020
|
+
readonly 'common.report-col.sales-per-guest.short': "Sales/Guest";
|
|
1021
1021
|
readonly 'common.report-col.sales-per-guest.info': "Average spend per guest";
|
|
1022
1022
|
readonly 'common.report-col.sales-per-guest-lw': "Sales/Guest LW";
|
|
1023
1023
|
readonly 'common.report-col.sales-per-guest-lw.short': "Amt/Guest LW";
|
|
@@ -1017,7 +1017,7 @@ declare const enUS: {
|
|
|
1017
1017
|
readonly 'common.report-col.sales-mix-by-pct.short': "Sales Mix %";
|
|
1018
1018
|
readonly 'common.report-col.sales-mix-by-pct.info': "Percentage of total sales contributed by this item or category";
|
|
1019
1019
|
readonly 'common.report-col.sales-per-guest': "Sales/Guest";
|
|
1020
|
-
readonly 'common.report-col.sales-per-guest.short': "
|
|
1020
|
+
readonly 'common.report-col.sales-per-guest.short': "Sales/Guest";
|
|
1021
1021
|
readonly 'common.report-col.sales-per-guest.info': "Average spend per guest";
|
|
1022
1022
|
readonly 'common.report-col.sales-per-guest-lw': "Sales/Guest LW";
|
|
1023
1023
|
readonly 'common.report-col.sales-per-guest-lw.short': "Amt/Guest LW";
|