@harbortouch/skytab-analytics-report-utils 0.14.5 → 0.16.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/README.md +49 -32
- package/dist/csv/index.cjs +42 -0
- package/dist/csv/index.d.cts +9 -0
- package/dist/csv/index.d.ts +9 -0
- package/dist/csv/index.js +17 -0
- package/dist/index.cjs +267 -102
- package/dist/index.d.cts +61 -2
- package/dist/index.d.ts +61 -2
- package/dist/index.js +263 -102
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -33,19 +33,34 @@ Requires **Node ≥ 22.6.0** and **pnpm ≥ 9.0.0**.
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
// Import everything from the main entry point
|
|
37
36
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
salesSummaryConfig,
|
|
38
|
+
COLUMN_REGISTRY,
|
|
39
|
+
getColumnAlignment,
|
|
40
|
+
calculateReportTotals,
|
|
42
41
|
} from '@harbortouch/skytab-analytics-report-utils';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Exporting report data to CSV
|
|
45
|
+
|
|
46
|
+
Import from the `/csv` sub-path. This keeps `csv-stringify` out of frontend bundles — it is only included when this import is actually used.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { CsvExporter } from '@harbortouch/skytab-analytics-report-utils/csv';
|
|
50
|
+
|
|
51
|
+
const exporter = new CsvExporter();
|
|
52
|
+
const csv = exporter.generate(reportRows);
|
|
53
|
+
// returns a UTF-8 BOM-prefixed CSV string (compatible with Excel)
|
|
43
54
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
// With overrides (any csv-stringify option)
|
|
56
|
+
const tsv = new CsvExporter({ delimiter: '\t', bom: false });
|
|
57
|
+
const output = tsv.generate(reportRows);
|
|
47
58
|
```
|
|
48
59
|
|
|
60
|
+
`CsvExporter` accepts an array of plain objects. Object keys become the header row; all keys are included in their original order. Returns a BOM-only string for empty input (or an empty string when `bom: false` is set).
|
|
61
|
+
|
|
62
|
+
> **Note:** `csv-stringify` is a dependency of this library — consuming projects do not need to install it separately.
|
|
63
|
+
|
|
49
64
|
### Integrating with the frontend (React + TanStack Table)
|
|
50
65
|
|
|
51
66
|
```typescript
|
|
@@ -61,9 +76,9 @@ const FIELD_CONFIG = salesSummaryConfig.fields as Record<keyof SalesSummaryRecor
|
|
|
61
76
|
import { calculateReportTotals, salesSummaryConfig } from '@harbortouch/skytab-analytics-report-utils';
|
|
62
77
|
|
|
63
78
|
const totals = calculateReportTotals(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
data, // row data array
|
|
80
|
+
salesSummaryConfig.fields, // field config from this library
|
|
81
|
+
{ labelField: 'groupByName', label: 'Total' },
|
|
67
82
|
);
|
|
68
83
|
```
|
|
69
84
|
|
|
@@ -76,6 +91,8 @@ src/
|
|
|
76
91
|
├── types.ts — Core interfaces (FieldType, ColumnPresentationConfig, ReportConfig, …)
|
|
77
92
|
├── columns/
|
|
78
93
|
│ └── index.ts — ReportColumnKey union type + COLUMN_REGISTRY (i18n keys)
|
|
94
|
+
├── csv/
|
|
95
|
+
│ └── index.ts — CsvExporter — published as the ./csv sub-path export
|
|
79
96
|
├── reports/
|
|
80
97
|
│ ├── salesSummary.ts
|
|
81
98
|
│ ├── ticketSummary.ts
|
|
@@ -94,14 +111,14 @@ src/
|
|
|
94
111
|
|
|
95
112
|
## Available reports
|
|
96
113
|
|
|
97
|
-
| Export
|
|
98
|
-
|
|
99
|
-
| `salesSummaryConfig`
|
|
114
|
+
| Export | Report |
|
|
115
|
+
| --------------------- | -------------- |
|
|
116
|
+
| `salesSummaryConfig` | Sales Summary |
|
|
100
117
|
| `ticketSummaryConfig` | Ticket Summary |
|
|
101
|
-
| `ticketLiveConfig`
|
|
102
|
-
| `productMixConfig`
|
|
103
|
-
| `modifierMixConfig`
|
|
104
|
-
| `itemTaxConfig`
|
|
118
|
+
| `ticketLiveConfig` | Ticket Live |
|
|
119
|
+
| `productMixConfig` | Product Mix |
|
|
120
|
+
| `modifierMixConfig` | Modifier Mix |
|
|
121
|
+
| `itemTaxConfig` | Item Tax |
|
|
105
122
|
|
|
106
123
|
---
|
|
107
124
|
|
|
@@ -111,26 +128,26 @@ src/
|
|
|
111
128
|
|
|
112
129
|
Governs both formatting and alignment for a column:
|
|
113
130
|
|
|
114
|
-
| Type
|
|
115
|
-
|
|
116
|
-
| `string`
|
|
117
|
-
| `date`
|
|
118
|
-
| `time`
|
|
119
|
-
| `boolean`
|
|
120
|
-
| `money`
|
|
121
|
-
| `number`
|
|
122
|
-
| `fixedNumber` | right
|
|
123
|
-
| `percent`
|
|
131
|
+
| Type | Alignment | Description |
|
|
132
|
+
| ------------- | --------- | ------------------------------------ |
|
|
133
|
+
| `string` | left | Plain text |
|
|
134
|
+
| `date` | left | Calendar date |
|
|
135
|
+
| `time` | left | Time of day |
|
|
136
|
+
| `boolean` | right | True/false flag |
|
|
137
|
+
| `money` | right | Currency value |
|
|
138
|
+
| `number` | right | Integer or generic numeric |
|
|
139
|
+
| `fixedNumber` | right | Decimal with fixed precision |
|
|
140
|
+
| `percent` | right | Ratio displayed as percentage (×100) |
|
|
124
141
|
|
|
125
142
|
### `FooterCalculation`
|
|
126
143
|
|
|
127
144
|
Declarative aggregation for totals rows:
|
|
128
145
|
|
|
129
|
-
| Type
|
|
130
|
-
|
|
131
|
-
| `sum`
|
|
146
|
+
| Type | Formula |
|
|
147
|
+
| --------------- | ----------------------------------------------- |
|
|
148
|
+
| `sum` | `Σ row[field]` |
|
|
132
149
|
| `percentChange` | `(Σ numerator − Σ denominator) / Σ denominator` |
|
|
133
|
-
| `average`
|
|
150
|
+
| `average` | `Σ numerator / Σ denominator` |
|
|
134
151
|
|
|
135
152
|
### Column Registry
|
|
136
153
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/csv/index.ts
|
|
21
|
+
var csv_exports = {};
|
|
22
|
+
__export(csv_exports, {
|
|
23
|
+
CsvExporter: () => CsvExporter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(csv_exports);
|
|
26
|
+
var import_sync = require("csv-stringify/sync");
|
|
27
|
+
var CsvExporter = class {
|
|
28
|
+
constructor(options = {}) {
|
|
29
|
+
this.options = options;
|
|
30
|
+
}
|
|
31
|
+
generate(rows) {
|
|
32
|
+
const opts = { header: true, delimiter: ",", bom: true, ...this.options };
|
|
33
|
+
if (!rows.length) {
|
|
34
|
+
return opts.bom ? "\uFEFF" : "";
|
|
35
|
+
}
|
|
36
|
+
return (0, import_sync.stringify)(rows, opts);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
CsvExporter
|
|
42
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/csv/index.ts
|
|
2
|
+
import { stringify } from "csv-stringify/sync";
|
|
3
|
+
var CsvExporter = class {
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
this.options = options;
|
|
6
|
+
}
|
|
7
|
+
generate(rows) {
|
|
8
|
+
const opts = { header: true, delimiter: ",", bom: true, ...this.options };
|
|
9
|
+
if (!rows.length) {
|
|
10
|
+
return opts.bom ? "\uFEFF" : "";
|
|
11
|
+
}
|
|
12
|
+
return stringify(rows, opts);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
CsvExporter
|
|
17
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
COLUMN_REGISTRY: () => COLUMN_REGISTRY,
|
|
24
|
+
DAILY_SALES_CASH_ROW_LABELS: () => DAILY_SALES_CASH_ROW_LABELS,
|
|
25
|
+
DAILY_SALES_REV_CLASS_FOOTER_LABELS: () => DAILY_SALES_REV_CLASS_FOOTER_LABELS,
|
|
26
|
+
REPORT_SECTION_CONFIGS: () => REPORT_SECTION_CONFIGS,
|
|
24
27
|
Report: () => Report,
|
|
25
28
|
calculateFieldTotal: () => calculateFieldTotal,
|
|
26
29
|
calculateReportTotals: () => calculateReportTotals,
|
|
@@ -32,6 +35,7 @@ __export(index_exports, {
|
|
|
32
35
|
dailySalesRefundsVoidsConfig: () => dailySalesRefundsVoidsConfig,
|
|
33
36
|
dailySalesTaxesConfig: () => dailySalesTaxesConfig,
|
|
34
37
|
dailySalesTrendsConfig: () => dailySalesTrendsConfig,
|
|
38
|
+
dailySalesTrendsOrderTypeConfig: () => dailySalesTrendsOrderTypeConfig,
|
|
35
39
|
employeeTimecardConfig: () => employeeTimecardConfig,
|
|
36
40
|
employeeTipConfig: () => employeeTipConfig,
|
|
37
41
|
formatDate: () => formatDate,
|
|
@@ -720,38 +724,118 @@ var dailySalesConfig = {
|
|
|
720
724
|
fields: FIELDS10,
|
|
721
725
|
availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
722
726
|
defaultVisibleColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
723
|
-
hasFooter: true
|
|
727
|
+
hasFooter: true,
|
|
728
|
+
dataAccessKey: "salesByRevClass",
|
|
729
|
+
sectionName: "common.report-section.revenue-class",
|
|
730
|
+
extraFooterRowsKey: "salesByRevClassFooter"
|
|
724
731
|
};
|
|
725
732
|
|
|
726
|
-
// src/reports/
|
|
733
|
+
// src/reports/dailySalesCache.ts
|
|
727
734
|
var FIELDS11 = {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
731
|
-
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
732
|
-
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
733
|
-
inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
|
|
734
|
-
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
735
|
-
salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
|
|
736
|
-
guestsCount: { type: "number", columnKey: "guests" }
|
|
735
|
+
name: { type: "string", columnKey: "type", size: FIRST_COLUMN_WIDTH },
|
|
736
|
+
amount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } }
|
|
737
737
|
};
|
|
738
|
-
var
|
|
739
|
-
"itemsQuantity",
|
|
740
|
-
"salesAmountGross",
|
|
741
|
-
"discountsAmount",
|
|
742
|
-
"inclusiveTaxesAmount",
|
|
743
|
-
"salesAmountNet",
|
|
744
|
-
"salesMixPct"
|
|
745
|
-
];
|
|
746
|
-
var dailySalesLiveConfig = {
|
|
738
|
+
var dailySalesCacheConfig = {
|
|
747
739
|
fields: FIELDS11,
|
|
748
|
-
availableColumns:
|
|
749
|
-
defaultVisibleColumns:
|
|
750
|
-
hasFooter: true
|
|
740
|
+
availableColumns: ["name", "amount"],
|
|
741
|
+
defaultVisibleColumns: ["name", "amount"],
|
|
742
|
+
hasFooter: true,
|
|
743
|
+
dataAccessKey: "cashPayments",
|
|
744
|
+
sectionName: "common.report-section.cash"
|
|
751
745
|
};
|
|
752
746
|
|
|
753
|
-
// src/reports/
|
|
747
|
+
// src/reports/dailySalesDiscounts.ts
|
|
754
748
|
var FIELDS12 = {
|
|
749
|
+
discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH },
|
|
750
|
+
ticketCount: { type: "number", columnKey: "ticketCount", footerCalculation: { type: "sum" } },
|
|
751
|
+
itemCount: { type: "number", columnKey: "itemCount", footerCalculation: { type: "sum" } },
|
|
752
|
+
discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
|
|
753
|
+
};
|
|
754
|
+
var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
|
|
755
|
+
"discountName",
|
|
756
|
+
"ticketCount",
|
|
757
|
+
"itemCount",
|
|
758
|
+
"discountsAmount"
|
|
759
|
+
];
|
|
760
|
+
var dailySalesDiscountsConfig = {
|
|
761
|
+
fields: FIELDS12,
|
|
762
|
+
availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
763
|
+
defaultVisibleColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
764
|
+
hasFooter: true,
|
|
765
|
+
dataAccessKey: "discounts",
|
|
766
|
+
sectionName: "common.report-section.discounts"
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
// src/reports/dailySalesPayments.ts
|
|
770
|
+
var FIELDS13 = {
|
|
771
|
+
paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
772
|
+
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
773
|
+
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
774
|
+
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
775
|
+
totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
776
|
+
};
|
|
777
|
+
var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
778
|
+
"paymentTypeName",
|
|
779
|
+
"paymentsCount",
|
|
780
|
+
"paymentsAmount",
|
|
781
|
+
"tipsAmount",
|
|
782
|
+
"totalSales"
|
|
783
|
+
];
|
|
784
|
+
var dailySalesPaymentsConfig = {
|
|
785
|
+
fields: FIELDS13,
|
|
786
|
+
availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
787
|
+
defaultVisibleColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
788
|
+
hasFooter: true,
|
|
789
|
+
dataAccessKey: "payments",
|
|
790
|
+
sectionName: "common.report-section.payments"
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
// src/reports/dailySalesRefundsVoids.ts
|
|
794
|
+
var FIELDS14 = {
|
|
795
|
+
description: { type: "string", columnKey: "refundVoidDescription", size: FIRST_COLUMN_WIDTH },
|
|
796
|
+
count: { type: "number", columnKey: "refundVoidCount", footerCalculation: { type: "sum" } },
|
|
797
|
+
amount: { type: "money", columnKey: "refundVoidAmount", footerCalculation: { type: "sum" } },
|
|
798
|
+
pctSales: { type: "percent", columnKey: "refundVoidPctSales", footerCalculation: { type: "sum" } }
|
|
799
|
+
};
|
|
800
|
+
var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = [
|
|
801
|
+
"description",
|
|
802
|
+
"count",
|
|
803
|
+
"amount",
|
|
804
|
+
"pctSales"
|
|
805
|
+
];
|
|
806
|
+
var dailySalesRefundsVoidsConfig = {
|
|
807
|
+
fields: FIELDS14,
|
|
808
|
+
availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
809
|
+
defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
810
|
+
hasFooter: true,
|
|
811
|
+
dataAccessKey: "refundsVoids",
|
|
812
|
+
sectionName: "common.report-section.refunds-voids"
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
// src/reports/dailySalesTaxes.ts
|
|
816
|
+
var FIELDS15 = {
|
|
817
|
+
taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH },
|
|
818
|
+
taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "none" } },
|
|
819
|
+
taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
|
|
820
|
+
exemptSales: { type: "money", columnKey: "exemptTaxes", footerCalculation: { type: "sum" } }
|
|
821
|
+
};
|
|
822
|
+
var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = [
|
|
823
|
+
"taxName",
|
|
824
|
+
"taxableSales",
|
|
825
|
+
"taxesAmount",
|
|
826
|
+
"exemptSales"
|
|
827
|
+
];
|
|
828
|
+
var dailySalesTaxesConfig = {
|
|
829
|
+
fields: FIELDS15,
|
|
830
|
+
availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
831
|
+
defaultVisibleColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
832
|
+
hasFooter: true,
|
|
833
|
+
dataAccessKey: "taxes",
|
|
834
|
+
sectionName: "common.report-section.taxes"
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
// src/reports/dailySalesTrends.ts
|
|
838
|
+
var FIELDS16 = {
|
|
755
839
|
groupById: { type: "string" },
|
|
756
840
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
757
841
|
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
@@ -784,10 +868,24 @@ var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
|
|
|
784
868
|
"salesAmountNet"
|
|
785
869
|
];
|
|
786
870
|
var dailySalesTrendsConfig = {
|
|
787
|
-
fields:
|
|
871
|
+
fields: FIELDS16,
|
|
788
872
|
availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
789
873
|
defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
790
|
-
hasFooter: true
|
|
874
|
+
hasFooter: true,
|
|
875
|
+
dataAccessKey: "trendsByDayPart",
|
|
876
|
+
sectionName: "common.report-section.sales-by-day-part",
|
|
877
|
+
totalsLabel: "common.report-section.trends-footer.total-sales",
|
|
878
|
+
extraFooterFields: ["salesAmountNet"]
|
|
879
|
+
};
|
|
880
|
+
var dailySalesTrendsOrderTypeConfig = {
|
|
881
|
+
fields: FIELDS16,
|
|
882
|
+
availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
883
|
+
defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
884
|
+
hasFooter: true,
|
|
885
|
+
dataAccessKey: "trendsByOrderType",
|
|
886
|
+
sectionName: "common.report-section.sales-by-order-type",
|
|
887
|
+
totalsLabel: "common.report-section.trends-footer.total-sales",
|
|
888
|
+
extraFooterFields: ["salesAmountNet"]
|
|
791
889
|
};
|
|
792
890
|
|
|
793
891
|
// src/report.ts
|
|
@@ -805,6 +903,16 @@ var Report = {
|
|
|
805
903
|
DAILY_SALES_LIVE: "daily-sales-live",
|
|
806
904
|
DAILY_SALES_TRENDS: "daily-sales-trends"
|
|
807
905
|
};
|
|
906
|
+
var DAILY_SALES_SECTION_CONFIGS = [
|
|
907
|
+
dailySalesConfig,
|
|
908
|
+
dailySalesPaymentsConfig,
|
|
909
|
+
dailySalesCacheConfig,
|
|
910
|
+
dailySalesTaxesConfig,
|
|
911
|
+
dailySalesRefundsVoidsConfig,
|
|
912
|
+
dailySalesDiscountsConfig,
|
|
913
|
+
dailySalesTrendsConfig,
|
|
914
|
+
dailySalesTrendsOrderTypeConfig
|
|
915
|
+
];
|
|
808
916
|
var REPORT_CONFIG_MAP = {
|
|
809
917
|
"sales-summary": salesSummaryConfig,
|
|
810
918
|
"ticket-analytics": ticketSummaryConfig,
|
|
@@ -815,9 +923,9 @@ var REPORT_CONFIG_MAP = {
|
|
|
815
923
|
"employee-timecard": employeeTimecardConfig,
|
|
816
924
|
"employee-tip": employeeTipConfig,
|
|
817
925
|
"sales-by-item": salesByItemDetailConfig,
|
|
818
|
-
"daily-sales":
|
|
819
|
-
"daily-sales-live":
|
|
820
|
-
"daily-sales-trends":
|
|
926
|
+
"daily-sales": DAILY_SALES_SECTION_CONFIGS,
|
|
927
|
+
"daily-sales-live": DAILY_SALES_SECTION_CONFIGS,
|
|
928
|
+
"daily-sales-trends": null
|
|
821
929
|
};
|
|
822
930
|
var REPORT_DEFAULT_NAME_MAP = {
|
|
823
931
|
"sales-summary": "Sales",
|
|
@@ -1582,86 +1690,139 @@ var calculateReportTotals = (data, fieldConfig, opts) => {
|
|
|
1582
1690
|
return result;
|
|
1583
1691
|
};
|
|
1584
1692
|
|
|
1585
|
-
// src/reports/
|
|
1586
|
-
var
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
"
|
|
1595
|
-
"
|
|
1596
|
-
"tipsAmount",
|
|
1597
|
-
"totalSales"
|
|
1598
|
-
];
|
|
1599
|
-
var dailySalesPaymentsConfig = {
|
|
1600
|
-
fields: FIELDS13,
|
|
1601
|
-
availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1602
|
-
defaultVisibleColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1603
|
-
hasFooter: true
|
|
1604
|
-
};
|
|
1605
|
-
|
|
1606
|
-
// src/reports/dailySalesDiscounts.ts
|
|
1607
|
-
var FIELDS14 = {
|
|
1608
|
-
discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH },
|
|
1609
|
-
ticketCount: { type: "number", columnKey: "ticketCount", footerCalculation: { type: "sum" } },
|
|
1610
|
-
itemCount: { type: "number", columnKey: "itemCount", footerCalculation: { type: "sum" } },
|
|
1611
|
-
discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
|
|
1693
|
+
// src/reports/dailySalesLive.ts
|
|
1694
|
+
var FIELDS17 = {
|
|
1695
|
+
groupById: { type: "string" },
|
|
1696
|
+
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
1697
|
+
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
1698
|
+
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
1699
|
+
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
1700
|
+
inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
|
|
1701
|
+
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
1702
|
+
salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
|
|
1703
|
+
guestsCount: { type: "number", columnKey: "guests" }
|
|
1612
1704
|
};
|
|
1613
|
-
var
|
|
1614
|
-
"
|
|
1615
|
-
"
|
|
1616
|
-
"discountsAmount"
|
|
1705
|
+
var DAILY_SALES_LIVE_AVAILABLE_COLUMNS = [
|
|
1706
|
+
"itemsQuantity",
|
|
1707
|
+
"salesAmountGross",
|
|
1708
|
+
"discountsAmount",
|
|
1709
|
+
"inclusiveTaxesAmount",
|
|
1710
|
+
"salesAmountNet",
|
|
1711
|
+
"salesMixPct"
|
|
1617
1712
|
];
|
|
1618
|
-
var
|
|
1619
|
-
fields:
|
|
1620
|
-
availableColumns:
|
|
1621
|
-
defaultVisibleColumns:
|
|
1622
|
-
hasFooter: true
|
|
1623
|
-
};
|
|
1624
|
-
|
|
1625
|
-
// src/reports/dailySalesRefundsVoids.ts
|
|
1626
|
-
var FIELDS15 = {
|
|
1627
|
-
description: { type: "string", columnKey: "refundVoidDescription", size: FIRST_COLUMN_WIDTH },
|
|
1628
|
-
count: { type: "number", columnKey: "refundVoidCount", footerCalculation: { type: "sum" } },
|
|
1629
|
-
amount: { type: "money", columnKey: "refundVoidAmount", footerCalculation: { type: "sum" } },
|
|
1630
|
-
pctSales: { type: "percent", columnKey: "refundVoidPctSales", footerCalculation: { type: "sum" } }
|
|
1631
|
-
};
|
|
1632
|
-
var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = ["count", "amount", "pctSales"];
|
|
1633
|
-
var dailySalesRefundsVoidsConfig = {
|
|
1634
|
-
fields: FIELDS15,
|
|
1635
|
-
availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1636
|
-
defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1713
|
+
var dailySalesLiveConfig = {
|
|
1714
|
+
fields: FIELDS17,
|
|
1715
|
+
availableColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
1716
|
+
defaultVisibleColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
1637
1717
|
hasFooter: true
|
|
1638
1718
|
};
|
|
1639
1719
|
|
|
1640
|
-
// src/reports/
|
|
1641
|
-
var
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
};
|
|
1647
|
-
var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = ["taxableSales", "taxesAmount", "exemptSales"];
|
|
1648
|
-
var dailySalesTaxesConfig = {
|
|
1649
|
-
fields: FIELDS16,
|
|
1650
|
-
availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1651
|
-
defaultVisibleColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1652
|
-
hasFooter: true
|
|
1720
|
+
// src/reports/reportSection.ts
|
|
1721
|
+
var DAILY_SALES_CASH_ROW_LABELS = {
|
|
1722
|
+
cashPayments: "common.report-section.cash-row.cash-payments",
|
|
1723
|
+
paidInOuts: "common.report-section.cash-row.paid-in-outs",
|
|
1724
|
+
gratuitiesPaidOut: "common.report-section.cash-row.gratuities-paid-out",
|
|
1725
|
+
ccTipsPaidOut: "common.report-section.cash-row.cc-tips-paid-out"
|
|
1653
1726
|
};
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1727
|
+
var DAILY_SALES_REV_CLASS_FOOTER_LABELS = {
|
|
1728
|
+
taxTotal: "common.report-section.rev-class-footer.tax-total",
|
|
1729
|
+
gratuities: "common.report-section.rev-class-footer.gratuities",
|
|
1730
|
+
balancePayments: "common.report-section.rev-class-footer.balance-payments",
|
|
1731
|
+
giftCardSales: "common.report-section.rev-class-footer.gift-card-sales",
|
|
1732
|
+
nonSalesRevenue: "common.report-section.rev-class-footer.non-sales-revenue",
|
|
1733
|
+
totalAccountable: "common.report-section.rev-class-footer.total-accountable"
|
|
1659
1734
|
};
|
|
1660
|
-
var
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1735
|
+
var DAILY_SALES_SECTIONS = [
|
|
1736
|
+
{
|
|
1737
|
+
sectionLabel: "common.report-section.revenue-class",
|
|
1738
|
+
config: dailySalesConfig,
|
|
1739
|
+
columns: [
|
|
1740
|
+
{ fieldKey: "groupByName", columnKey: "revenueClass" },
|
|
1741
|
+
{ fieldKey: "itemsQuantity", columnKey: "quantity" },
|
|
1742
|
+
{ fieldKey: "salesAmountGross", columnKey: "grossSales" },
|
|
1743
|
+
{ fieldKey: "discountsAmount", columnKey: "discountAmount" },
|
|
1744
|
+
{ fieldKey: "inclusiveTaxesAmount", columnKey: "inclusiveTax" },
|
|
1745
|
+
{ fieldKey: "salesAmountNet", columnKey: "netSales" },
|
|
1746
|
+
{ fieldKey: "salesMixPct", columnKey: "salesMixByPct" }
|
|
1747
|
+
]
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
sectionLabel: "common.report-section.payments",
|
|
1751
|
+
config: dailySalesPaymentsConfig,
|
|
1752
|
+
columns: [
|
|
1753
|
+
{ fieldKey: "paymentTypeName", columnKey: "paymentType" },
|
|
1754
|
+
{ fieldKey: "paymentsCount", columnKey: "paymentsCount" },
|
|
1755
|
+
{ fieldKey: "paymentsAmount", columnKey: "paymentsAmount" },
|
|
1756
|
+
{ fieldKey: "tipsAmount", columnKey: "tips" },
|
|
1757
|
+
{ fieldKey: "totalSales", columnKey: "paymentsTotal" }
|
|
1758
|
+
]
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
sectionLabel: "common.report-section.cash",
|
|
1762
|
+
config: dailySalesCacheConfig,
|
|
1763
|
+
columns: [
|
|
1764
|
+
{ fieldKey: "name", columnKey: "type", isRowLabelKey: true },
|
|
1765
|
+
{ fieldKey: "amount", columnKey: "paymentsAmount" }
|
|
1766
|
+
]
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
sectionLabel: "common.report-section.taxes",
|
|
1770
|
+
config: dailySalesTaxesConfig,
|
|
1771
|
+
columns: [
|
|
1772
|
+
{ fieldKey: "taxName", columnKey: "taxName" },
|
|
1773
|
+
{ fieldKey: "taxableSales", columnKey: "taxableSales" },
|
|
1774
|
+
{ fieldKey: "taxesAmount", columnKey: "taxCollected" },
|
|
1775
|
+
{ fieldKey: "exemptSales", columnKey: "exemptTaxes" }
|
|
1776
|
+
]
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
sectionLabel: "common.report-section.refunds-voids",
|
|
1780
|
+
config: dailySalesRefundsVoidsConfig,
|
|
1781
|
+
columns: [
|
|
1782
|
+
{ fieldKey: "description", columnKey: "refundVoidDescription" },
|
|
1783
|
+
{ fieldKey: "count", columnKey: "refundVoidCount" },
|
|
1784
|
+
{ fieldKey: "amount", columnKey: "refundVoidAmount" },
|
|
1785
|
+
{ fieldKey: "pctSales", columnKey: "refundVoidPctSales" }
|
|
1786
|
+
]
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
sectionLabel: "common.report-section.discounts",
|
|
1790
|
+
config: dailySalesDiscountsConfig,
|
|
1791
|
+
columns: [
|
|
1792
|
+
{ fieldKey: "discountName", columnKey: "discountName" },
|
|
1793
|
+
{ fieldKey: "ticketCount", columnKey: "ticketCount" },
|
|
1794
|
+
{ fieldKey: "itemCount", columnKey: "itemCount" },
|
|
1795
|
+
{ fieldKey: "discountsAmount", columnKey: "discountAmount" }
|
|
1796
|
+
]
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
sectionLabel: "common.report-section.sales-by-day-part",
|
|
1800
|
+
config: dailySalesTrendsConfig,
|
|
1801
|
+
columns: [
|
|
1802
|
+
{ fieldKey: "groupByName", columnKey: "daypart" },
|
|
1803
|
+
{ fieldKey: "ticketsCount", columnKey: "tickets" },
|
|
1804
|
+
{ fieldKey: "guestsCount", columnKey: "guests" },
|
|
1805
|
+
{ fieldKey: "ticketAvg", columnKey: "ticketAverage" },
|
|
1806
|
+
{ fieldKey: "guestAvg", columnKey: "guestAverage" },
|
|
1807
|
+
{ fieldKey: "salesAmountNet", columnKey: "netSales" }
|
|
1808
|
+
]
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
sectionLabel: "common.report-section.sales-by-order-type",
|
|
1812
|
+
config: dailySalesTrendsOrderTypeConfig,
|
|
1813
|
+
columns: [
|
|
1814
|
+
{ fieldKey: "groupByName", columnKey: "orderType" },
|
|
1815
|
+
{ fieldKey: "ticketsCount", columnKey: "tickets" },
|
|
1816
|
+
{ fieldKey: "guestsCount", columnKey: "guests" },
|
|
1817
|
+
{ fieldKey: "ticketAvg", columnKey: "ticketAverage" },
|
|
1818
|
+
{ fieldKey: "guestAvg", columnKey: "guestAverage" },
|
|
1819
|
+
{ fieldKey: "salesAmountNet", columnKey: "netSales" }
|
|
1820
|
+
]
|
|
1821
|
+
}
|
|
1822
|
+
];
|
|
1823
|
+
var REPORT_SECTION_CONFIGS = {
|
|
1824
|
+
[Report.DAILY_SALES]: DAILY_SALES_SECTIONS,
|
|
1825
|
+
[Report.DAILY_SALES_LIVE]: DAILY_SALES_SECTIONS
|
|
1665
1826
|
};
|
|
1666
1827
|
|
|
1667
1828
|
// src/formatting.ts
|
|
@@ -1805,6 +1966,9 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1805
1966
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1806
1967
|
0 && (module.exports = {
|
|
1807
1968
|
COLUMN_REGISTRY,
|
|
1969
|
+
DAILY_SALES_CASH_ROW_LABELS,
|
|
1970
|
+
DAILY_SALES_REV_CLASS_FOOTER_LABELS,
|
|
1971
|
+
REPORT_SECTION_CONFIGS,
|
|
1808
1972
|
Report,
|
|
1809
1973
|
calculateFieldTotal,
|
|
1810
1974
|
calculateReportTotals,
|
|
@@ -1816,6 +1980,7 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1816
1980
|
dailySalesRefundsVoidsConfig,
|
|
1817
1981
|
dailySalesTaxesConfig,
|
|
1818
1982
|
dailySalesTrendsConfig,
|
|
1983
|
+
dailySalesTrendsOrderTypeConfig,
|
|
1819
1984
|
employeeTimecardConfig,
|
|
1820
1985
|
employeeTipConfig,
|
|
1821
1986
|
formatDate,
|