@harbortouch/skytab-analytics-report-utils 0.14.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +70 -19
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +69 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
dailySalesTaxesConfig: () => dailySalesTaxesConfig,
|
|
34
34
|
dailySalesTrendsConfig: () => dailySalesTrendsConfig,
|
|
35
35
|
employeeTimecardConfig: () => employeeTimecardConfig,
|
|
36
|
+
employeeTipConfig: () => employeeTipConfig,
|
|
36
37
|
formatDate: () => formatDate,
|
|
37
38
|
formatFieldValue: () => formatFieldValue,
|
|
38
39
|
formatFixedNumber: () => formatFixedNumber,
|
|
@@ -647,8 +648,56 @@ var employeeTimecardConfig = {
|
|
|
647
648
|
hasFooter: true
|
|
648
649
|
};
|
|
649
650
|
|
|
650
|
-
// src/reports/
|
|
651
|
+
// src/reports/employeeTip.ts
|
|
651
652
|
var FIELDS9 = {
|
|
653
|
+
employeeName: { type: "string", size: 220, columnKey: "employeeName" },
|
|
654
|
+
empId: { type: "string", size: 160, columnKey: "employeeId" },
|
|
655
|
+
payrollId: { type: "string", size: 160, columnKey: "payrollId" },
|
|
656
|
+
locationName: { type: "string", size: 220, columnKey: "locationName" },
|
|
657
|
+
status: { type: "string", size: 140, columnKey: "status" },
|
|
658
|
+
grossSales: { type: "money", columnKey: "grossSales", footerCalculation: { type: "sum" } },
|
|
659
|
+
grossCash: { type: "money", columnKey: "grossCashSales", footerCalculation: { type: "sum" } },
|
|
660
|
+
grossCc: { type: "money", columnKey: "grossCreditSales", footerCalculation: { type: "sum" } },
|
|
661
|
+
totalPayments: { type: "money", columnKey: "totalCollected", footerCalculation: { type: "sum" } },
|
|
662
|
+
autoGratuity: { type: "money", columnKey: "autoGratuity", footerCalculation: { type: "sum" } },
|
|
663
|
+
grossTips: { type: "money", columnKey: "grossTips", footerCalculation: { type: "sum" } },
|
|
664
|
+
declaredTips: { type: "money", columnKey: "declaredTips", footerCalculation: { type: "sum" } },
|
|
665
|
+
tipReduction: { type: "money", columnKey: "tipReduction", footerCalculation: { type: "sum" } },
|
|
666
|
+
tipShare: { type: "money", columnKey: "tipShare", footerCalculation: { type: "sum" } },
|
|
667
|
+
netTips: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
668
|
+
tipPercentage: {
|
|
669
|
+
type: "percent",
|
|
670
|
+
columnKey: "tipPct",
|
|
671
|
+
footerCalculation: { type: "average", numeratorField: "grossTips", denominatorField: "grossSales" }
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
var AVAILABLE_COLUMNS = [
|
|
675
|
+
"employeeName",
|
|
676
|
+
"empId",
|
|
677
|
+
"payrollId",
|
|
678
|
+
"locationName",
|
|
679
|
+
"status",
|
|
680
|
+
"grossSales",
|
|
681
|
+
"grossCash",
|
|
682
|
+
"grossCc",
|
|
683
|
+
"totalPayments",
|
|
684
|
+
"autoGratuity",
|
|
685
|
+
"grossTips",
|
|
686
|
+
"declaredTips",
|
|
687
|
+
"tipReduction",
|
|
688
|
+
"tipShare",
|
|
689
|
+
"netTips",
|
|
690
|
+
"tipPercentage"
|
|
691
|
+
];
|
|
692
|
+
var employeeTipConfig = {
|
|
693
|
+
fields: FIELDS9,
|
|
694
|
+
availableColumns: AVAILABLE_COLUMNS,
|
|
695
|
+
defaultVisibleColumns: AVAILABLE_COLUMNS,
|
|
696
|
+
hasFooter: true
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// src/reports/dailySales.ts
|
|
700
|
+
var FIELDS10 = {
|
|
652
701
|
groupById: { type: "string" },
|
|
653
702
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
654
703
|
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
@@ -667,14 +716,14 @@ var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
|
667
716
|
"salesMixPct"
|
|
668
717
|
];
|
|
669
718
|
var dailySalesConfig = {
|
|
670
|
-
fields:
|
|
719
|
+
fields: FIELDS10,
|
|
671
720
|
availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
672
721
|
defaultVisibleColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
673
722
|
hasFooter: true
|
|
674
723
|
};
|
|
675
724
|
|
|
676
725
|
// src/reports/dailySalesLive.ts
|
|
677
|
-
var
|
|
726
|
+
var FIELDS11 = {
|
|
678
727
|
groupById: { type: "string" },
|
|
679
728
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
680
729
|
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
@@ -694,14 +743,14 @@ var DAILY_SALES_LIVE_AVAILABLE_COLUMNS = [
|
|
|
694
743
|
"salesMixPct"
|
|
695
744
|
];
|
|
696
745
|
var dailySalesLiveConfig = {
|
|
697
|
-
fields:
|
|
746
|
+
fields: FIELDS11,
|
|
698
747
|
availableColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
699
748
|
defaultVisibleColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
700
749
|
hasFooter: true
|
|
701
750
|
};
|
|
702
751
|
|
|
703
752
|
// src/reports/dailySalesTrends.ts
|
|
704
|
-
var
|
|
753
|
+
var FIELDS12 = {
|
|
705
754
|
groupById: { type: "string" },
|
|
706
755
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
707
756
|
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
@@ -734,7 +783,7 @@ var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
|
|
|
734
783
|
"salesAmountNet"
|
|
735
784
|
];
|
|
736
785
|
var dailySalesTrendsConfig = {
|
|
737
|
-
fields:
|
|
786
|
+
fields: FIELDS12,
|
|
738
787
|
availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
739
788
|
defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
740
789
|
hasFooter: true
|
|
@@ -763,7 +812,7 @@ var REPORT_CONFIG_MAP = {
|
|
|
763
812
|
"modifier-mix": modifierMixConfig,
|
|
764
813
|
"item-tax": itemTaxConfig,
|
|
765
814
|
"employee-timecard": employeeTimecardConfig,
|
|
766
|
-
"employee-tip":
|
|
815
|
+
"employee-tip": employeeTipConfig,
|
|
767
816
|
"sales-by-item": salesByItemDetailConfig,
|
|
768
817
|
"daily-sales": dailySalesConfig,
|
|
769
818
|
"daily-sales-live": dailySalesLiveConfig,
|
|
@@ -787,7 +836,8 @@ var getReportConfig = (reportType) => REPORT_CONFIG_MAP[reportType];
|
|
|
787
836
|
var getReportExportFileName = ({
|
|
788
837
|
reportType,
|
|
789
838
|
startDate,
|
|
790
|
-
endDate
|
|
839
|
+
endDate,
|
|
840
|
+
format
|
|
791
841
|
}) => {
|
|
792
842
|
const formatDate2 = (date) => {
|
|
793
843
|
return [
|
|
@@ -797,7 +847,7 @@ var getReportExportFileName = ({
|
|
|
797
847
|
].join("-");
|
|
798
848
|
};
|
|
799
849
|
const filename = REPORT_DEFAULT_NAME_MAP[reportType].replace(/\s+/g, "_") ?? "Report";
|
|
800
|
-
return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}
|
|
850
|
+
return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}.${format}`.toLocaleLowerCase();
|
|
801
851
|
};
|
|
802
852
|
|
|
803
853
|
// src/columns/index.ts
|
|
@@ -1532,7 +1582,7 @@ var calculateReportTotals = (data, fieldConfig, opts) => {
|
|
|
1532
1582
|
};
|
|
1533
1583
|
|
|
1534
1584
|
// src/reports/dailySalesPayments.ts
|
|
1535
|
-
var
|
|
1585
|
+
var FIELDS13 = {
|
|
1536
1586
|
paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
1537
1587
|
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
1538
1588
|
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
@@ -1546,14 +1596,14 @@ var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
|
1546
1596
|
"totalSales"
|
|
1547
1597
|
];
|
|
1548
1598
|
var dailySalesPaymentsConfig = {
|
|
1549
|
-
fields:
|
|
1599
|
+
fields: FIELDS13,
|
|
1550
1600
|
availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1551
1601
|
defaultVisibleColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1552
1602
|
hasFooter: true
|
|
1553
1603
|
};
|
|
1554
1604
|
|
|
1555
1605
|
// src/reports/dailySalesDiscounts.ts
|
|
1556
|
-
var
|
|
1606
|
+
var FIELDS14 = {
|
|
1557
1607
|
discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH },
|
|
1558
1608
|
ticketCount: { type: "number", columnKey: "ticketCount", footerCalculation: { type: "sum" } },
|
|
1559
1609
|
itemCount: { type: "number", columnKey: "itemCount", footerCalculation: { type: "sum" } },
|
|
@@ -1565,14 +1615,14 @@ var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
|
|
|
1565
1615
|
"discountsAmount"
|
|
1566
1616
|
];
|
|
1567
1617
|
var dailySalesDiscountsConfig = {
|
|
1568
|
-
fields:
|
|
1618
|
+
fields: FIELDS14,
|
|
1569
1619
|
availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1570
1620
|
defaultVisibleColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1571
1621
|
hasFooter: true
|
|
1572
1622
|
};
|
|
1573
1623
|
|
|
1574
1624
|
// src/reports/dailySalesRefundsVoids.ts
|
|
1575
|
-
var
|
|
1625
|
+
var FIELDS15 = {
|
|
1576
1626
|
description: { type: "string", columnKey: "refundVoidDescription", size: FIRST_COLUMN_WIDTH },
|
|
1577
1627
|
count: { type: "number", columnKey: "refundVoidCount", footerCalculation: { type: "sum" } },
|
|
1578
1628
|
amount: { type: "money", columnKey: "refundVoidAmount", footerCalculation: { type: "sum" } },
|
|
@@ -1580,14 +1630,14 @@ var FIELDS14 = {
|
|
|
1580
1630
|
};
|
|
1581
1631
|
var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = ["count", "amount", "pctSales"];
|
|
1582
1632
|
var dailySalesRefundsVoidsConfig = {
|
|
1583
|
-
fields:
|
|
1633
|
+
fields: FIELDS15,
|
|
1584
1634
|
availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1585
1635
|
defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1586
1636
|
hasFooter: true
|
|
1587
1637
|
};
|
|
1588
1638
|
|
|
1589
1639
|
// src/reports/dailySalesTaxes.ts
|
|
1590
|
-
var
|
|
1640
|
+
var FIELDS16 = {
|
|
1591
1641
|
taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH },
|
|
1592
1642
|
taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "sum" } },
|
|
1593
1643
|
taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
|
|
@@ -1595,19 +1645,19 @@ var FIELDS15 = {
|
|
|
1595
1645
|
};
|
|
1596
1646
|
var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = ["taxableSales", "taxesAmount", "exemptSales"];
|
|
1597
1647
|
var dailySalesTaxesConfig = {
|
|
1598
|
-
fields:
|
|
1648
|
+
fields: FIELDS16,
|
|
1599
1649
|
availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1600
1650
|
defaultVisibleColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1601
1651
|
hasFooter: true
|
|
1602
1652
|
};
|
|
1603
1653
|
|
|
1604
1654
|
// src/reports/dailySalesCache.ts
|
|
1605
|
-
var
|
|
1655
|
+
var FIELDS17 = {
|
|
1606
1656
|
name: { type: "string", columnKey: "type", size: FIRST_COLUMN_WIDTH },
|
|
1607
1657
|
amount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } }
|
|
1608
1658
|
};
|
|
1609
1659
|
var dailySalesCacheConfig = {
|
|
1610
|
-
fields:
|
|
1660
|
+
fields: FIELDS17,
|
|
1611
1661
|
availableColumns: ["name", "amount"],
|
|
1612
1662
|
defaultVisibleColumns: ["name", "amount"],
|
|
1613
1663
|
hasFooter: true
|
|
@@ -1766,6 +1816,7 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1766
1816
|
dailySalesTaxesConfig,
|
|
1767
1817
|
dailySalesTrendsConfig,
|
|
1768
1818
|
employeeTimecardConfig,
|
|
1819
|
+
employeeTipConfig,
|
|
1769
1820
|
formatDate,
|
|
1770
1821
|
formatFieldValue,
|
|
1771
1822
|
formatFixedNumber,
|
package/dist/index.d.cts
CHANGED
|
@@ -1246,10 +1246,11 @@ declare const Report: {
|
|
|
1246
1246
|
};
|
|
1247
1247
|
type ReportType = (typeof Report)[keyof typeof Report];
|
|
1248
1248
|
declare const getReportConfig: (reportType: ReportType) => ReportConfig<string> | null;
|
|
1249
|
-
declare const getReportExportFileName: ({ reportType, startDate, endDate, }: {
|
|
1249
|
+
declare const getReportExportFileName: ({ reportType, startDate, endDate, format, }: {
|
|
1250
1250
|
reportType: ReportType;
|
|
1251
1251
|
startDate: Date;
|
|
1252
1252
|
endDate: Date;
|
|
1253
|
+
format: "csv" | "xlsx" | "pdf";
|
|
1253
1254
|
}) => string;
|
|
1254
1255
|
|
|
1255
1256
|
declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
|
|
@@ -1376,6 +1377,14 @@ declare const employeeTimecardConfig: {
|
|
|
1376
1377
|
readonly hasFooter: true;
|
|
1377
1378
|
};
|
|
1378
1379
|
|
|
1380
|
+
type EmployeeTipField = 'employeeName' | 'empId' | 'payrollId' | 'locationName' | 'status' | 'grossSales' | 'grossCash' | 'grossCc' | 'totalPayments' | 'autoGratuity' | 'grossTips' | 'declaredTips' | 'tipReduction' | 'tipShare' | 'netTips' | 'tipPercentage';
|
|
1381
|
+
declare const employeeTipConfig: {
|
|
1382
|
+
readonly fields: Record<EmployeeTipField, ColumnPresentationConfig<EmployeeTipField>>;
|
|
1383
|
+
readonly availableColumns: EmployeeTipField[];
|
|
1384
|
+
readonly defaultVisibleColumns: EmployeeTipField[];
|
|
1385
|
+
readonly hasFooter: true;
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1379
1388
|
type SalesByItemDetailField = 'businessDate' | 'ticketClosedAt' | 'hourId' | 'daypartName' | 'locationId' | 'locationName' | 'departmentName' | 'itemName' | 'revenueCenterName' | 'revenueClassName' | 'salesAmountGross' | 'itemsQuantity' | 'transactionId' | 'guestsCount' | 'employeeName' | 'orderTypeName' | 'salesType' | 'itemPrice';
|
|
1380
1389
|
declare const salesByItemDetailConfig: {
|
|
1381
1390
|
readonly fields: Record<SalesByItemDetailField, ColumnPresentationConfig<SalesByItemDetailField>>;
|
|
@@ -1433,4 +1442,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
|
|
|
1433
1442
|
}[]) => LocaleOption[];
|
|
1434
1443
|
declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
|
|
1435
1444
|
|
|
1436
|
-
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportExportFileName, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
|
1445
|
+
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportExportFileName, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1246,10 +1246,11 @@ declare const Report: {
|
|
|
1246
1246
|
};
|
|
1247
1247
|
type ReportType = (typeof Report)[keyof typeof Report];
|
|
1248
1248
|
declare const getReportConfig: (reportType: ReportType) => ReportConfig<string> | null;
|
|
1249
|
-
declare const getReportExportFileName: ({ reportType, startDate, endDate, }: {
|
|
1249
|
+
declare const getReportExportFileName: ({ reportType, startDate, endDate, format, }: {
|
|
1250
1250
|
reportType: ReportType;
|
|
1251
1251
|
startDate: Date;
|
|
1252
1252
|
endDate: Date;
|
|
1253
|
+
format: "csv" | "xlsx" | "pdf";
|
|
1253
1254
|
}) => string;
|
|
1254
1255
|
|
|
1255
1256
|
declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
|
|
@@ -1376,6 +1377,14 @@ declare const employeeTimecardConfig: {
|
|
|
1376
1377
|
readonly hasFooter: true;
|
|
1377
1378
|
};
|
|
1378
1379
|
|
|
1380
|
+
type EmployeeTipField = 'employeeName' | 'empId' | 'payrollId' | 'locationName' | 'status' | 'grossSales' | 'grossCash' | 'grossCc' | 'totalPayments' | 'autoGratuity' | 'grossTips' | 'declaredTips' | 'tipReduction' | 'tipShare' | 'netTips' | 'tipPercentage';
|
|
1381
|
+
declare const employeeTipConfig: {
|
|
1382
|
+
readonly fields: Record<EmployeeTipField, ColumnPresentationConfig<EmployeeTipField>>;
|
|
1383
|
+
readonly availableColumns: EmployeeTipField[];
|
|
1384
|
+
readonly defaultVisibleColumns: EmployeeTipField[];
|
|
1385
|
+
readonly hasFooter: true;
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1379
1388
|
type SalesByItemDetailField = 'businessDate' | 'ticketClosedAt' | 'hourId' | 'daypartName' | 'locationId' | 'locationName' | 'departmentName' | 'itemName' | 'revenueCenterName' | 'revenueClassName' | 'salesAmountGross' | 'itemsQuantity' | 'transactionId' | 'guestsCount' | 'employeeName' | 'orderTypeName' | 'salesType' | 'itemPrice';
|
|
1380
1389
|
declare const salesByItemDetailConfig: {
|
|
1381
1390
|
readonly fields: Record<SalesByItemDetailField, ColumnPresentationConfig<SalesByItemDetailField>>;
|
|
@@ -1433,4 +1442,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
|
|
|
1433
1442
|
}[]) => LocaleOption[];
|
|
1434
1443
|
declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
|
|
1435
1444
|
|
|
1436
|
-
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportExportFileName, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
|
1445
|
+
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportExportFileName, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
package/dist/index.js
CHANGED
|
@@ -584,8 +584,56 @@ var employeeTimecardConfig = {
|
|
|
584
584
|
hasFooter: true
|
|
585
585
|
};
|
|
586
586
|
|
|
587
|
-
// src/reports/
|
|
587
|
+
// src/reports/employeeTip.ts
|
|
588
588
|
var FIELDS9 = {
|
|
589
|
+
employeeName: { type: "string", size: 220, columnKey: "employeeName" },
|
|
590
|
+
empId: { type: "string", size: 160, columnKey: "employeeId" },
|
|
591
|
+
payrollId: { type: "string", size: 160, columnKey: "payrollId" },
|
|
592
|
+
locationName: { type: "string", size: 220, columnKey: "locationName" },
|
|
593
|
+
status: { type: "string", size: 140, columnKey: "status" },
|
|
594
|
+
grossSales: { type: "money", columnKey: "grossSales", footerCalculation: { type: "sum" } },
|
|
595
|
+
grossCash: { type: "money", columnKey: "grossCashSales", footerCalculation: { type: "sum" } },
|
|
596
|
+
grossCc: { type: "money", columnKey: "grossCreditSales", footerCalculation: { type: "sum" } },
|
|
597
|
+
totalPayments: { type: "money", columnKey: "totalCollected", footerCalculation: { type: "sum" } },
|
|
598
|
+
autoGratuity: { type: "money", columnKey: "autoGratuity", footerCalculation: { type: "sum" } },
|
|
599
|
+
grossTips: { type: "money", columnKey: "grossTips", footerCalculation: { type: "sum" } },
|
|
600
|
+
declaredTips: { type: "money", columnKey: "declaredTips", footerCalculation: { type: "sum" } },
|
|
601
|
+
tipReduction: { type: "money", columnKey: "tipReduction", footerCalculation: { type: "sum" } },
|
|
602
|
+
tipShare: { type: "money", columnKey: "tipShare", footerCalculation: { type: "sum" } },
|
|
603
|
+
netTips: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
604
|
+
tipPercentage: {
|
|
605
|
+
type: "percent",
|
|
606
|
+
columnKey: "tipPct",
|
|
607
|
+
footerCalculation: { type: "average", numeratorField: "grossTips", denominatorField: "grossSales" }
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
var AVAILABLE_COLUMNS = [
|
|
611
|
+
"employeeName",
|
|
612
|
+
"empId",
|
|
613
|
+
"payrollId",
|
|
614
|
+
"locationName",
|
|
615
|
+
"status",
|
|
616
|
+
"grossSales",
|
|
617
|
+
"grossCash",
|
|
618
|
+
"grossCc",
|
|
619
|
+
"totalPayments",
|
|
620
|
+
"autoGratuity",
|
|
621
|
+
"grossTips",
|
|
622
|
+
"declaredTips",
|
|
623
|
+
"tipReduction",
|
|
624
|
+
"tipShare",
|
|
625
|
+
"netTips",
|
|
626
|
+
"tipPercentage"
|
|
627
|
+
];
|
|
628
|
+
var employeeTipConfig = {
|
|
629
|
+
fields: FIELDS9,
|
|
630
|
+
availableColumns: AVAILABLE_COLUMNS,
|
|
631
|
+
defaultVisibleColumns: AVAILABLE_COLUMNS,
|
|
632
|
+
hasFooter: true
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// src/reports/dailySales.ts
|
|
636
|
+
var FIELDS10 = {
|
|
589
637
|
groupById: { type: "string" },
|
|
590
638
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
591
639
|
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
@@ -604,14 +652,14 @@ var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
|
604
652
|
"salesMixPct"
|
|
605
653
|
];
|
|
606
654
|
var dailySalesConfig = {
|
|
607
|
-
fields:
|
|
655
|
+
fields: FIELDS10,
|
|
608
656
|
availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
609
657
|
defaultVisibleColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
610
658
|
hasFooter: true
|
|
611
659
|
};
|
|
612
660
|
|
|
613
661
|
// src/reports/dailySalesLive.ts
|
|
614
|
-
var
|
|
662
|
+
var FIELDS11 = {
|
|
615
663
|
groupById: { type: "string" },
|
|
616
664
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
617
665
|
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
@@ -631,14 +679,14 @@ var DAILY_SALES_LIVE_AVAILABLE_COLUMNS = [
|
|
|
631
679
|
"salesMixPct"
|
|
632
680
|
];
|
|
633
681
|
var dailySalesLiveConfig = {
|
|
634
|
-
fields:
|
|
682
|
+
fields: FIELDS11,
|
|
635
683
|
availableColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
636
684
|
defaultVisibleColumns: DAILY_SALES_LIVE_AVAILABLE_COLUMNS,
|
|
637
685
|
hasFooter: true
|
|
638
686
|
};
|
|
639
687
|
|
|
640
688
|
// src/reports/dailySalesTrends.ts
|
|
641
|
-
var
|
|
689
|
+
var FIELDS12 = {
|
|
642
690
|
groupById: { type: "string" },
|
|
643
691
|
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
644
692
|
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
@@ -671,7 +719,7 @@ var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
|
|
|
671
719
|
"salesAmountNet"
|
|
672
720
|
];
|
|
673
721
|
var dailySalesTrendsConfig = {
|
|
674
|
-
fields:
|
|
722
|
+
fields: FIELDS12,
|
|
675
723
|
availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
676
724
|
defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
|
|
677
725
|
hasFooter: true
|
|
@@ -700,7 +748,7 @@ var REPORT_CONFIG_MAP = {
|
|
|
700
748
|
"modifier-mix": modifierMixConfig,
|
|
701
749
|
"item-tax": itemTaxConfig,
|
|
702
750
|
"employee-timecard": employeeTimecardConfig,
|
|
703
|
-
"employee-tip":
|
|
751
|
+
"employee-tip": employeeTipConfig,
|
|
704
752
|
"sales-by-item": salesByItemDetailConfig,
|
|
705
753
|
"daily-sales": dailySalesConfig,
|
|
706
754
|
"daily-sales-live": dailySalesLiveConfig,
|
|
@@ -724,7 +772,8 @@ var getReportConfig = (reportType) => REPORT_CONFIG_MAP[reportType];
|
|
|
724
772
|
var getReportExportFileName = ({
|
|
725
773
|
reportType,
|
|
726
774
|
startDate,
|
|
727
|
-
endDate
|
|
775
|
+
endDate,
|
|
776
|
+
format
|
|
728
777
|
}) => {
|
|
729
778
|
const formatDate2 = (date) => {
|
|
730
779
|
return [
|
|
@@ -734,7 +783,7 @@ var getReportExportFileName = ({
|
|
|
734
783
|
].join("-");
|
|
735
784
|
};
|
|
736
785
|
const filename = REPORT_DEFAULT_NAME_MAP[reportType].replace(/\s+/g, "_") ?? "Report";
|
|
737
|
-
return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}
|
|
786
|
+
return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}.${format}`.toLocaleLowerCase();
|
|
738
787
|
};
|
|
739
788
|
|
|
740
789
|
// src/columns/index.ts
|
|
@@ -1469,7 +1518,7 @@ var calculateReportTotals = (data, fieldConfig, opts) => {
|
|
|
1469
1518
|
};
|
|
1470
1519
|
|
|
1471
1520
|
// src/reports/dailySalesPayments.ts
|
|
1472
|
-
var
|
|
1521
|
+
var FIELDS13 = {
|
|
1473
1522
|
paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH },
|
|
1474
1523
|
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
1475
1524
|
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
@@ -1483,14 +1532,14 @@ var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
|
1483
1532
|
"totalSales"
|
|
1484
1533
|
];
|
|
1485
1534
|
var dailySalesPaymentsConfig = {
|
|
1486
|
-
fields:
|
|
1535
|
+
fields: FIELDS13,
|
|
1487
1536
|
availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1488
1537
|
defaultVisibleColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1489
1538
|
hasFooter: true
|
|
1490
1539
|
};
|
|
1491
1540
|
|
|
1492
1541
|
// src/reports/dailySalesDiscounts.ts
|
|
1493
|
-
var
|
|
1542
|
+
var FIELDS14 = {
|
|
1494
1543
|
discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH },
|
|
1495
1544
|
ticketCount: { type: "number", columnKey: "ticketCount", footerCalculation: { type: "sum" } },
|
|
1496
1545
|
itemCount: { type: "number", columnKey: "itemCount", footerCalculation: { type: "sum" } },
|
|
@@ -1502,14 +1551,14 @@ var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
|
|
|
1502
1551
|
"discountsAmount"
|
|
1503
1552
|
];
|
|
1504
1553
|
var dailySalesDiscountsConfig = {
|
|
1505
|
-
fields:
|
|
1554
|
+
fields: FIELDS14,
|
|
1506
1555
|
availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1507
1556
|
defaultVisibleColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1508
1557
|
hasFooter: true
|
|
1509
1558
|
};
|
|
1510
1559
|
|
|
1511
1560
|
// src/reports/dailySalesRefundsVoids.ts
|
|
1512
|
-
var
|
|
1561
|
+
var FIELDS15 = {
|
|
1513
1562
|
description: { type: "string", columnKey: "refundVoidDescription", size: FIRST_COLUMN_WIDTH },
|
|
1514
1563
|
count: { type: "number", columnKey: "refundVoidCount", footerCalculation: { type: "sum" } },
|
|
1515
1564
|
amount: { type: "money", columnKey: "refundVoidAmount", footerCalculation: { type: "sum" } },
|
|
@@ -1517,14 +1566,14 @@ var FIELDS14 = {
|
|
|
1517
1566
|
};
|
|
1518
1567
|
var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = ["count", "amount", "pctSales"];
|
|
1519
1568
|
var dailySalesRefundsVoidsConfig = {
|
|
1520
|
-
fields:
|
|
1569
|
+
fields: FIELDS15,
|
|
1521
1570
|
availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1522
1571
|
defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1523
1572
|
hasFooter: true
|
|
1524
1573
|
};
|
|
1525
1574
|
|
|
1526
1575
|
// src/reports/dailySalesTaxes.ts
|
|
1527
|
-
var
|
|
1576
|
+
var FIELDS16 = {
|
|
1528
1577
|
taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH },
|
|
1529
1578
|
taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "sum" } },
|
|
1530
1579
|
taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
|
|
@@ -1532,19 +1581,19 @@ var FIELDS15 = {
|
|
|
1532
1581
|
};
|
|
1533
1582
|
var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = ["taxableSales", "taxesAmount", "exemptSales"];
|
|
1534
1583
|
var dailySalesTaxesConfig = {
|
|
1535
|
-
fields:
|
|
1584
|
+
fields: FIELDS16,
|
|
1536
1585
|
availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1537
1586
|
defaultVisibleColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1538
1587
|
hasFooter: true
|
|
1539
1588
|
};
|
|
1540
1589
|
|
|
1541
1590
|
// src/reports/dailySalesCache.ts
|
|
1542
|
-
var
|
|
1591
|
+
var FIELDS17 = {
|
|
1543
1592
|
name: { type: "string", columnKey: "type", size: FIRST_COLUMN_WIDTH },
|
|
1544
1593
|
amount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } }
|
|
1545
1594
|
};
|
|
1546
1595
|
var dailySalesCacheConfig = {
|
|
1547
|
-
fields:
|
|
1596
|
+
fields: FIELDS17,
|
|
1548
1597
|
availableColumns: ["name", "amount"],
|
|
1549
1598
|
defaultVisibleColumns: ["name", "amount"],
|
|
1550
1599
|
hasFooter: true
|
|
@@ -1702,6 +1751,7 @@ export {
|
|
|
1702
1751
|
dailySalesTaxesConfig,
|
|
1703
1752
|
dailySalesTrendsConfig,
|
|
1704
1753
|
employeeTimecardConfig,
|
|
1754
|
+
employeeTipConfig,
|
|
1705
1755
|
formatDate,
|
|
1706
1756
|
formatFieldValue,
|
|
1707
1757
|
formatFixedNumber,
|