@harbortouch/skytab-analytics-report-utils 0.4.1 → 0.4.3
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/columns/index.d.ts +1 -1
- package/dist/index.cjs +167 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +152 -1
- package/dist/reports/dailySales.d.ts +6 -0
- package/dist/reports/dailySalesDiscounts.d.ts +6 -0
- package/dist/reports/dailySalesPayments.d.ts +6 -0
- package/dist/reports/dailySalesRefundsVoids.d.ts +6 -0
- package/dist/reports/dailySalesTaxes.d.ts +6 -0
- package/dist/reports/index.d.ts +3 -0
- package/dist/totals.d.ts +1 -1
- package/package.json +1 -1
package/dist/columns/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ReportColumnKey = 'fifteenMinInterval' | 'adjustedTips' | 'advantageProgram' | 'amex' | 'amexReturns' | 'attachRate' | 'autoGratuity' | 'averageGrossPrice' | 'bankFees' | 'batchAmount' | 'batchDate' | 'batchNumber' | 'clockInTime' | 'clockOutTime' | 'country' | 'customerName' | 'date' | 'dateClose' | 'daypart' | 'debit' | 'debitReturns' | 'declaredTips' | 'department' | 'depositCurrency' | 'depositDate' | 'discountAmount' | 'discover' | 'discoverReturns' | 'ebt' | 'ebtReturns' | 'employeeId' | 'employeeJob' | 'employeeName' | 'exemptTaxes' | 'grandTotal' | 'grossCashSales' | 'grossCashTips' | 'grossCreditCardTips' | 'grossCreditSales' | 'grossSales' | 'grossTips' | 'guestCount' | 'guestsVarLw' | 'guestsVarLwPct' | 'guestsVarLy' | 'guestsVarLyPct' | 'hour' | 'hoursWorked' | 'inclusiveTax' | 'itemName' | 'itemPrice' | 'locationCity' | 'locationMid' | 'locationName' | 'locationState' | 'mastercard' | 'mcReturns' | 'modifierName' | 'modifierPrice' | 'modifierQuantity' | 'netSales' | 'netTaxCollected' | 'netTips' | 'numberOfGuests' | 'orderType' | 'paymentType' | 'payrollId' | 'quantity' | 'referenceNumber' | 'refundAmount' | 'refundedTaxAmount' | 'revenueCenter' | 'revenueClass' | 'salesVarLw' | 'salesVarLwPct' | 'salesVarLy' | 'salesVarLyPct' | 'salesMixByPct' | 'salesPerGuest' | 'salesPerGuestLw' | 'salesPerGuestLy' | 'scheduledShiftEnd' | 'scheduledShiftStart' | 'settlementBatchDate' | 'shiftDurationHrs' | 'subtotal' | 'taxCollected' | 'taxName' | 'taxRate' | 'taxableSales' | 'ticketClosed' | 'ticketFee' | 'ticketNumber' | 'ticketOpen' | 'ticketTotal' | 'timeOpenMins' | 'tipPct' | 'tipReduction' | 'tipShare' | 'tips' | 'tipsPerHour' | 'totalCollected' | 'totalItemSales' | 'totalModifierSales' | 'totalReturns' | 'totalSales' | 'totalTips' | 'transactionDate' | 'transactionType' | 'untaxedSales' | 'visa' | 'visaReturns';
|
|
1
|
+
export type ReportColumnKey = 'fifteenMinInterval' | 'adjustedTips' | 'advantageProgram' | 'amex' | 'amexReturns' | 'attachRate' | 'autoGratuity' | 'averageGrossPrice' | 'bankFees' | 'batchAmount' | 'batchDate' | 'batchNumber' | 'clockInTime' | 'clockOutTime' | 'country' | 'customerName' | 'date' | 'dateClose' | 'daypart' | 'debit' | 'debitReturns' | 'declaredTips' | 'department' | 'depositCurrency' | 'depositDate' | 'discountAmount' | 'discountCount' | 'discover' | 'discoverReturns' | 'ebt' | 'ebtReturns' | 'employeeId' | 'employeeJob' | 'employeeName' | 'exemptTaxes' | 'grandTotal' | 'grossCashSales' | 'grossCashTips' | 'grossCreditCardTips' | 'grossCreditSales' | 'grossSales' | 'grossTips' | 'guestCount' | 'guestsVarLw' | 'guestsVarLwPct' | 'guestsVarLy' | 'guestsVarLyPct' | 'hour' | 'hoursWorked' | 'inclusiveTax' | 'itemName' | 'itemPrice' | 'locationCity' | 'locationMid' | 'locationName' | 'locationState' | 'mastercard' | 'mcReturns' | 'modifierName' | 'modifierPrice' | 'modifierQuantity' | 'netSales' | 'netTaxCollected' | 'netTips' | 'numberOfGuests' | 'orderType' | 'paymentType' | 'payrollId' | 'quantity' | 'referenceNumber' | 'refundAmount' | 'refundedTaxAmount' | 'revenueCenter' | 'revenueClass' | 'salesVarLw' | 'salesVarLwPct' | 'salesVarLy' | 'salesVarLyPct' | 'salesMixByPct' | 'salesPerGuest' | 'salesPerGuestLw' | 'salesPerGuestLy' | 'scheduledShiftEnd' | 'scheduledShiftStart' | 'settlementBatchDate' | 'shiftDurationHrs' | 'subtotal' | 'taxCollected' | 'taxName' | 'taxRate' | 'taxableSales' | 'ticketClosed' | 'ticketFee' | 'ticketNumber' | 'ticketOpen' | 'ticketTotal' | 'timeOpenMins' | 'tipPct' | 'tipReduction' | 'tipShare' | 'tips' | 'tipsPerHour' | 'totalCollected' | 'totalItemSales' | 'totalModifierSales' | 'totalReturns' | 'totalSales' | 'totalTips' | 'transactionDate' | 'transactionType' | 'untaxedSales' | 'visa' | 'visaReturns' | 'paymentsCount' | 'paymentsAmount' | 'paymentsTotal';
|
|
2
2
|
export interface ColumnMetadata {
|
|
3
3
|
titleKey: string;
|
|
4
4
|
shortTitleKey: string;
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,16 @@ 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_AVAILABLE_COLUMNS: () => DAILY_SALES_AVAILABLE_COLUMNS,
|
|
25
|
+
DAILY_SALES_DEFAULT_VISIBLE_COLUMNS: () => DAILY_SALES_DEFAULT_VISIBLE_COLUMNS,
|
|
26
|
+
DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS: () => DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
27
|
+
DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS: () => DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS,
|
|
28
|
+
DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS: () => DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
29
|
+
DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS: () => DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS,
|
|
30
|
+
DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS: () => DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
31
|
+
DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS: () => DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS,
|
|
32
|
+
DAILY_SALES_TAXES_AVAILABLE_COLUMNS: () => DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
33
|
+
DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS: () => DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS,
|
|
24
34
|
ITEM_TAX_AVAILABLE_COLUMNS: () => ITEM_TAX_AVAILABLE_COLUMNS,
|
|
25
35
|
ITEM_TAX_DEFAULT_VISIBLE_COLUMNS: () => ITEM_TAX_DEFAULT_VISIBLE_COLUMNS,
|
|
26
36
|
MODIFIER_MIX_AVAILABLE_COLUMNS: () => MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
@@ -35,6 +45,11 @@ __export(index_exports, {
|
|
|
35
45
|
TICKET_SUMMARY_AVAILABLE_COLUMNS: () => TICKET_SUMMARY_AVAILABLE_COLUMNS,
|
|
36
46
|
TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS: () => TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
37
47
|
calculateReportTotals: () => calculateReportTotals,
|
|
48
|
+
dailySalesConfig: () => dailySalesConfig,
|
|
49
|
+
dailySalesDiscountsConfig: () => dailySalesDiscountsConfig,
|
|
50
|
+
dailySalesPaymentsConfig: () => dailySalesPaymentsConfig,
|
|
51
|
+
dailySalesRefundsVoidsConfig: () => dailySalesRefundsVoidsConfig,
|
|
52
|
+
dailySalesTaxesConfig: () => dailySalesTaxesConfig,
|
|
38
53
|
getColumnAlignment: () => getColumnAlignment,
|
|
39
54
|
getColumnMetadata: () => getColumnMetadata,
|
|
40
55
|
isNumericType: () => isNumericType,
|
|
@@ -179,6 +194,11 @@ var COLUMN_REGISTRY = {
|
|
|
179
194
|
shortTitleKey: "common.report-col.discount-amount.short",
|
|
180
195
|
infoTextKey: "common.report-col.discount-amount.info"
|
|
181
196
|
},
|
|
197
|
+
discountCount: {
|
|
198
|
+
titleKey: "common.report-col.discount-count",
|
|
199
|
+
shortTitleKey: "common.report-col.discount-count.short",
|
|
200
|
+
infoTextKey: "common.report-col.discount-count.info"
|
|
201
|
+
},
|
|
182
202
|
discover: {
|
|
183
203
|
titleKey: "common.report-col.discover",
|
|
184
204
|
shortTitleKey: "common.report-col.discover.short",
|
|
@@ -608,6 +628,21 @@ var COLUMN_REGISTRY = {
|
|
|
608
628
|
titleKey: "common.report-col.visa-returns",
|
|
609
629
|
shortTitleKey: "common.report-col.visa-returns.short",
|
|
610
630
|
infoTextKey: "common.report-col.visa-returns.info"
|
|
631
|
+
},
|
|
632
|
+
paymentsCount: {
|
|
633
|
+
titleKey: "common.report-col.payments-count",
|
|
634
|
+
shortTitleKey: "common.report-col.payments-count.short",
|
|
635
|
+
infoTextKey: "common.report-col.payments-count.info"
|
|
636
|
+
},
|
|
637
|
+
paymentsAmount: {
|
|
638
|
+
titleKey: "common.report-col.payments-amount",
|
|
639
|
+
shortTitleKey: "common.report-col.payments-amount.short",
|
|
640
|
+
infoTextKey: "common.report-col.payments-amount.info"
|
|
641
|
+
},
|
|
642
|
+
paymentsTotal: {
|
|
643
|
+
titleKey: "common.report-col.payments-total",
|
|
644
|
+
shortTitleKey: "common.report-col.payments-total.short",
|
|
645
|
+
infoTextKey: "common.report-col.payments-total.info"
|
|
611
646
|
}
|
|
612
647
|
};
|
|
613
648
|
function getColumnMetadata(key) {
|
|
@@ -627,6 +662,7 @@ function isNumericType(type) {
|
|
|
627
662
|
|
|
628
663
|
// src/totals.ts
|
|
629
664
|
function calculateReportTotals(data, fieldConfig, opts) {
|
|
665
|
+
const rows = data;
|
|
630
666
|
const { labelField, label } = opts;
|
|
631
667
|
const fieldsToSum = /* @__PURE__ */ new Set();
|
|
632
668
|
const derivedFields = [];
|
|
@@ -648,7 +684,7 @@ function calculateReportTotals(data, fieldConfig, opts) {
|
|
|
648
684
|
}
|
|
649
685
|
const sums = {};
|
|
650
686
|
for (const field of fieldsToSum) {
|
|
651
|
-
sums[field] =
|
|
687
|
+
sums[field] = rows.reduce((acc, row) => acc + (row[field] ?? 0), 0);
|
|
652
688
|
}
|
|
653
689
|
const derived = {};
|
|
654
690
|
for (const { field, calc } of derivedFields) {
|
|
@@ -1133,9 +1169,134 @@ var itemTaxConfig = {
|
|
|
1133
1169
|
availableColumns: ITEM_TAX_AVAILABLE_COLUMNS,
|
|
1134
1170
|
defaultVisibleColumns: ITEM_TAX_DEFAULT_VISIBLE_COLUMNS
|
|
1135
1171
|
};
|
|
1172
|
+
|
|
1173
|
+
// src/reports/dailySales.ts
|
|
1174
|
+
var FIRST_COLUMN_WIDTH4 = 240;
|
|
1175
|
+
var FIELDS7 = {
|
|
1176
|
+
groupById: { type: "string" },
|
|
1177
|
+
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH4 },
|
|
1178
|
+
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
1179
|
+
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
1180
|
+
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
1181
|
+
inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
|
|
1182
|
+
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
1183
|
+
salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
|
|
1184
|
+
avgPrice: {
|
|
1185
|
+
type: "fixedNumber",
|
|
1186
|
+
columnKey: "averageGrossPrice",
|
|
1187
|
+
footerCalculation: {
|
|
1188
|
+
type: "average",
|
|
1189
|
+
numeratorField: "salesAmountGross",
|
|
1190
|
+
denominatorField: "itemsQuantity"
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
1195
|
+
"itemsQuantity",
|
|
1196
|
+
"salesAmountGross",
|
|
1197
|
+
"discountsAmount",
|
|
1198
|
+
"salesAmountNet",
|
|
1199
|
+
"salesMixPct"
|
|
1200
|
+
];
|
|
1201
|
+
var DAILY_SALES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_AVAILABLE_COLUMNS;
|
|
1202
|
+
var dailySalesConfig = {
|
|
1203
|
+
fields: FIELDS7,
|
|
1204
|
+
availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
1205
|
+
defaultVisibleColumns: DAILY_SALES_DEFAULT_VISIBLE_COLUMNS
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// src/reports/dailySalesPayments.ts
|
|
1209
|
+
var FIRST_COLUMN_WIDTH5 = 240;
|
|
1210
|
+
var FIELDS8 = {
|
|
1211
|
+
paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH5 },
|
|
1212
|
+
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
1213
|
+
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
1214
|
+
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
1215
|
+
totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
1216
|
+
};
|
|
1217
|
+
var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
1218
|
+
"paymentsCount",
|
|
1219
|
+
"paymentsAmount",
|
|
1220
|
+
"tipsAmount",
|
|
1221
|
+
"totalSales"
|
|
1222
|
+
];
|
|
1223
|
+
var DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS;
|
|
1224
|
+
var dailySalesPaymentsConfig = {
|
|
1225
|
+
fields: FIELDS8,
|
|
1226
|
+
availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1227
|
+
defaultVisibleColumns: DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
// src/reports/dailySalesDiscounts.ts
|
|
1231
|
+
var FIRST_COLUMN_WIDTH6 = 240;
|
|
1232
|
+
var FIELDS9 = {
|
|
1233
|
+
discountName: { type: "string", size: FIRST_COLUMN_WIDTH6 },
|
|
1234
|
+
discountsCount: { type: "number", columnKey: "discountCount", footerCalculation: { type: "sum" } },
|
|
1235
|
+
discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
|
|
1236
|
+
};
|
|
1237
|
+
var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
|
|
1238
|
+
"discountsCount",
|
|
1239
|
+
"discountsAmount"
|
|
1240
|
+
];
|
|
1241
|
+
var DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS;
|
|
1242
|
+
var dailySalesDiscountsConfig = {
|
|
1243
|
+
fields: FIELDS9,
|
|
1244
|
+
availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1245
|
+
defaultVisibleColumns: DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// src/reports/dailySalesRefundsVoids.ts
|
|
1249
|
+
var FIRST_COLUMN_WIDTH7 = 240;
|
|
1250
|
+
var FIELDS10 = {
|
|
1251
|
+
description: { type: "string", size: FIRST_COLUMN_WIDTH7 },
|
|
1252
|
+
count: { type: "number", footerCalculation: { type: "sum" } },
|
|
1253
|
+
amount: { type: "money", footerCalculation: { type: "sum" } },
|
|
1254
|
+
pctSales: { type: "percent", footerCalculation: { type: "sum" } }
|
|
1255
|
+
};
|
|
1256
|
+
var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = [
|
|
1257
|
+
"count",
|
|
1258
|
+
"amount",
|
|
1259
|
+
"pctSales"
|
|
1260
|
+
];
|
|
1261
|
+
var DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS;
|
|
1262
|
+
var dailySalesRefundsVoidsConfig = {
|
|
1263
|
+
fields: FIELDS10,
|
|
1264
|
+
availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1265
|
+
defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1268
|
+
// src/reports/dailySalesTaxes.ts
|
|
1269
|
+
var FIRST_COLUMN_WIDTH8 = 240;
|
|
1270
|
+
var FIELDS11 = {
|
|
1271
|
+
taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH8 },
|
|
1272
|
+
taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "sum" } },
|
|
1273
|
+
taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
|
|
1274
|
+
exemptSales: { type: "money", columnKey: "exemptTaxes", footerCalculation: { type: "sum" } }
|
|
1275
|
+
};
|
|
1276
|
+
var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = [
|
|
1277
|
+
"taxableSales",
|
|
1278
|
+
"taxesAmount",
|
|
1279
|
+
"exemptSales"
|
|
1280
|
+
];
|
|
1281
|
+
var DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_TAXES_AVAILABLE_COLUMNS;
|
|
1282
|
+
var dailySalesTaxesConfig = {
|
|
1283
|
+
fields: FIELDS11,
|
|
1284
|
+
availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1285
|
+
defaultVisibleColumns: DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS
|
|
1286
|
+
};
|
|
1136
1287
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1137
1288
|
0 && (module.exports = {
|
|
1138
1289
|
COLUMN_REGISTRY,
|
|
1290
|
+
DAILY_SALES_AVAILABLE_COLUMNS,
|
|
1291
|
+
DAILY_SALES_DEFAULT_VISIBLE_COLUMNS,
|
|
1292
|
+
DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1293
|
+
DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS,
|
|
1294
|
+
DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1295
|
+
DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS,
|
|
1296
|
+
DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1297
|
+
DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS,
|
|
1298
|
+
DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1299
|
+
DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS,
|
|
1139
1300
|
ITEM_TAX_AVAILABLE_COLUMNS,
|
|
1140
1301
|
ITEM_TAX_DEFAULT_VISIBLE_COLUMNS,
|
|
1141
1302
|
MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
@@ -1150,6 +1311,11 @@ var itemTaxConfig = {
|
|
|
1150
1311
|
TICKET_SUMMARY_AVAILABLE_COLUMNS,
|
|
1151
1312
|
TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
1152
1313
|
calculateReportTotals,
|
|
1314
|
+
dailySalesConfig,
|
|
1315
|
+
dailySalesDiscountsConfig,
|
|
1316
|
+
dailySalesPaymentsConfig,
|
|
1317
|
+
dailySalesRefundsVoidsConfig,
|
|
1318
|
+
dailySalesTaxesConfig,
|
|
1153
1319
|
getColumnAlignment,
|
|
1154
1320
|
getColumnMetadata,
|
|
1155
1321
|
isNumericType,
|
package/dist/index.d.ts
CHANGED
|
@@ -10,3 +10,8 @@ export { ticketLiveConfig, TICKET_LIVE_AVAILABLE_COLUMNS, TICKET_LIVE_DEFAULT_VI
|
|
|
10
10
|
export { productMixConfig, PRODUCT_MIX_AVAILABLE_COLUMNS, PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS, PRODUCT_MIX_CHART_FIELDS, } from './reports/productMix';
|
|
11
11
|
export { modifierMixConfig, MODIFIER_MIX_AVAILABLE_COLUMNS, MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS, } from './reports/modifierMix';
|
|
12
12
|
export { itemTaxConfig, ITEM_TAX_AVAILABLE_COLUMNS, ITEM_TAX_DEFAULT_VISIBLE_COLUMNS } from './reports/itemTax';
|
|
13
|
+
export { dailySalesConfig, DAILY_SALES_AVAILABLE_COLUMNS, DAILY_SALES_DEFAULT_VISIBLE_COLUMNS, } from './reports/dailySales';
|
|
14
|
+
export { dailySalesPaymentsConfig, DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS, DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS, } from './reports/dailySalesPayments';
|
|
15
|
+
export { dailySalesDiscountsConfig, DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS, DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS, } from './reports/dailySalesDiscounts';
|
|
16
|
+
export { dailySalesRefundsVoidsConfig, DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS, DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS, } from './reports/dailySalesRefundsVoids';
|
|
17
|
+
export { dailySalesTaxesConfig, DAILY_SALES_TAXES_AVAILABLE_COLUMNS, DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS, } from './reports/dailySalesTaxes';
|
package/dist/index.js
CHANGED
|
@@ -130,6 +130,11 @@ var COLUMN_REGISTRY = {
|
|
|
130
130
|
shortTitleKey: "common.report-col.discount-amount.short",
|
|
131
131
|
infoTextKey: "common.report-col.discount-amount.info"
|
|
132
132
|
},
|
|
133
|
+
discountCount: {
|
|
134
|
+
titleKey: "common.report-col.discount-count",
|
|
135
|
+
shortTitleKey: "common.report-col.discount-count.short",
|
|
136
|
+
infoTextKey: "common.report-col.discount-count.info"
|
|
137
|
+
},
|
|
133
138
|
discover: {
|
|
134
139
|
titleKey: "common.report-col.discover",
|
|
135
140
|
shortTitleKey: "common.report-col.discover.short",
|
|
@@ -559,6 +564,21 @@ var COLUMN_REGISTRY = {
|
|
|
559
564
|
titleKey: "common.report-col.visa-returns",
|
|
560
565
|
shortTitleKey: "common.report-col.visa-returns.short",
|
|
561
566
|
infoTextKey: "common.report-col.visa-returns.info"
|
|
567
|
+
},
|
|
568
|
+
paymentsCount: {
|
|
569
|
+
titleKey: "common.report-col.payments-count",
|
|
570
|
+
shortTitleKey: "common.report-col.payments-count.short",
|
|
571
|
+
infoTextKey: "common.report-col.payments-count.info"
|
|
572
|
+
},
|
|
573
|
+
paymentsAmount: {
|
|
574
|
+
titleKey: "common.report-col.payments-amount",
|
|
575
|
+
shortTitleKey: "common.report-col.payments-amount.short",
|
|
576
|
+
infoTextKey: "common.report-col.payments-amount.info"
|
|
577
|
+
},
|
|
578
|
+
paymentsTotal: {
|
|
579
|
+
titleKey: "common.report-col.payments-total",
|
|
580
|
+
shortTitleKey: "common.report-col.payments-total.short",
|
|
581
|
+
infoTextKey: "common.report-col.payments-total.info"
|
|
562
582
|
}
|
|
563
583
|
};
|
|
564
584
|
function getColumnMetadata(key) {
|
|
@@ -578,6 +598,7 @@ function isNumericType(type) {
|
|
|
578
598
|
|
|
579
599
|
// src/totals.ts
|
|
580
600
|
function calculateReportTotals(data, fieldConfig, opts) {
|
|
601
|
+
const rows = data;
|
|
581
602
|
const { labelField, label } = opts;
|
|
582
603
|
const fieldsToSum = /* @__PURE__ */ new Set();
|
|
583
604
|
const derivedFields = [];
|
|
@@ -599,7 +620,7 @@ function calculateReportTotals(data, fieldConfig, opts) {
|
|
|
599
620
|
}
|
|
600
621
|
const sums = {};
|
|
601
622
|
for (const field of fieldsToSum) {
|
|
602
|
-
sums[field] =
|
|
623
|
+
sums[field] = rows.reduce((acc, row) => acc + (row[field] ?? 0), 0);
|
|
603
624
|
}
|
|
604
625
|
const derived = {};
|
|
605
626
|
for (const { field, calc } of derivedFields) {
|
|
@@ -1084,8 +1105,133 @@ var itemTaxConfig = {
|
|
|
1084
1105
|
availableColumns: ITEM_TAX_AVAILABLE_COLUMNS,
|
|
1085
1106
|
defaultVisibleColumns: ITEM_TAX_DEFAULT_VISIBLE_COLUMNS
|
|
1086
1107
|
};
|
|
1108
|
+
|
|
1109
|
+
// src/reports/dailySales.ts
|
|
1110
|
+
var FIRST_COLUMN_WIDTH4 = 240;
|
|
1111
|
+
var FIELDS7 = {
|
|
1112
|
+
groupById: { type: "string" },
|
|
1113
|
+
groupByName: { type: "string", size: FIRST_COLUMN_WIDTH4 },
|
|
1114
|
+
itemsQuantity: { type: "number", columnKey: "quantity" },
|
|
1115
|
+
salesAmountGross: { type: "money", columnKey: "grossSales" },
|
|
1116
|
+
discountsAmount: { type: "money", columnKey: "discountAmount" },
|
|
1117
|
+
inclusiveTaxesAmount: { type: "money", columnKey: "inclusiveTax" },
|
|
1118
|
+
salesAmountNet: { type: "money", columnKey: "netSales" },
|
|
1119
|
+
salesMixPct: { type: "percent", columnKey: "salesMixByPct" },
|
|
1120
|
+
avgPrice: {
|
|
1121
|
+
type: "fixedNumber",
|
|
1122
|
+
columnKey: "averageGrossPrice",
|
|
1123
|
+
footerCalculation: {
|
|
1124
|
+
type: "average",
|
|
1125
|
+
numeratorField: "salesAmountGross",
|
|
1126
|
+
denominatorField: "itemsQuantity"
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
var DAILY_SALES_AVAILABLE_COLUMNS = [
|
|
1131
|
+
"itemsQuantity",
|
|
1132
|
+
"salesAmountGross",
|
|
1133
|
+
"discountsAmount",
|
|
1134
|
+
"salesAmountNet",
|
|
1135
|
+
"salesMixPct"
|
|
1136
|
+
];
|
|
1137
|
+
var DAILY_SALES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_AVAILABLE_COLUMNS;
|
|
1138
|
+
var dailySalesConfig = {
|
|
1139
|
+
fields: FIELDS7,
|
|
1140
|
+
availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
|
|
1141
|
+
defaultVisibleColumns: DAILY_SALES_DEFAULT_VISIBLE_COLUMNS
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
// src/reports/dailySalesPayments.ts
|
|
1145
|
+
var FIRST_COLUMN_WIDTH5 = 240;
|
|
1146
|
+
var FIELDS8 = {
|
|
1147
|
+
paymentTypeName: { type: "string", size: FIRST_COLUMN_WIDTH5 },
|
|
1148
|
+
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
1149
|
+
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
1150
|
+
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
1151
|
+
totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
1152
|
+
};
|
|
1153
|
+
var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
1154
|
+
"paymentsCount",
|
|
1155
|
+
"paymentsAmount",
|
|
1156
|
+
"tipsAmount",
|
|
1157
|
+
"totalSales"
|
|
1158
|
+
];
|
|
1159
|
+
var DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS;
|
|
1160
|
+
var dailySalesPaymentsConfig = {
|
|
1161
|
+
fields: FIELDS8,
|
|
1162
|
+
availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1163
|
+
defaultVisibleColumns: DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
// src/reports/dailySalesDiscounts.ts
|
|
1167
|
+
var FIRST_COLUMN_WIDTH6 = 240;
|
|
1168
|
+
var FIELDS9 = {
|
|
1169
|
+
discountName: { type: "string", size: FIRST_COLUMN_WIDTH6 },
|
|
1170
|
+
discountsCount: { type: "number", columnKey: "discountCount", footerCalculation: { type: "sum" } },
|
|
1171
|
+
discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
|
|
1172
|
+
};
|
|
1173
|
+
var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
|
|
1174
|
+
"discountsCount",
|
|
1175
|
+
"discountsAmount"
|
|
1176
|
+
];
|
|
1177
|
+
var DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS;
|
|
1178
|
+
var dailySalesDiscountsConfig = {
|
|
1179
|
+
fields: FIELDS9,
|
|
1180
|
+
availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1181
|
+
defaultVisibleColumns: DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
// src/reports/dailySalesRefundsVoids.ts
|
|
1185
|
+
var FIRST_COLUMN_WIDTH7 = 240;
|
|
1186
|
+
var FIELDS10 = {
|
|
1187
|
+
description: { type: "string", size: FIRST_COLUMN_WIDTH7 },
|
|
1188
|
+
count: { type: "number", footerCalculation: { type: "sum" } },
|
|
1189
|
+
amount: { type: "money", footerCalculation: { type: "sum" } },
|
|
1190
|
+
pctSales: { type: "percent", footerCalculation: { type: "sum" } }
|
|
1191
|
+
};
|
|
1192
|
+
var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = [
|
|
1193
|
+
"count",
|
|
1194
|
+
"amount",
|
|
1195
|
+
"pctSales"
|
|
1196
|
+
];
|
|
1197
|
+
var DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS;
|
|
1198
|
+
var dailySalesRefundsVoidsConfig = {
|
|
1199
|
+
fields: FIELDS10,
|
|
1200
|
+
availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1201
|
+
defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1204
|
+
// src/reports/dailySalesTaxes.ts
|
|
1205
|
+
var FIRST_COLUMN_WIDTH8 = 240;
|
|
1206
|
+
var FIELDS11 = {
|
|
1207
|
+
taxName: { type: "string", columnKey: "taxName", size: FIRST_COLUMN_WIDTH8 },
|
|
1208
|
+
taxableSales: { type: "money", columnKey: "taxableSales", footerCalculation: { type: "sum" } },
|
|
1209
|
+
taxesAmount: { type: "money", columnKey: "taxCollected", footerCalculation: { type: "sum" } },
|
|
1210
|
+
exemptSales: { type: "money", columnKey: "exemptTaxes", footerCalculation: { type: "sum" } }
|
|
1211
|
+
};
|
|
1212
|
+
var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = [
|
|
1213
|
+
"taxableSales",
|
|
1214
|
+
"taxesAmount",
|
|
1215
|
+
"exemptSales"
|
|
1216
|
+
];
|
|
1217
|
+
var DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_TAXES_AVAILABLE_COLUMNS;
|
|
1218
|
+
var dailySalesTaxesConfig = {
|
|
1219
|
+
fields: FIELDS11,
|
|
1220
|
+
availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1221
|
+
defaultVisibleColumns: DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS
|
|
1222
|
+
};
|
|
1087
1223
|
export {
|
|
1088
1224
|
COLUMN_REGISTRY,
|
|
1225
|
+
DAILY_SALES_AVAILABLE_COLUMNS,
|
|
1226
|
+
DAILY_SALES_DEFAULT_VISIBLE_COLUMNS,
|
|
1227
|
+
DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
|
|
1228
|
+
DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS,
|
|
1229
|
+
DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
|
|
1230
|
+
DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS,
|
|
1231
|
+
DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
|
|
1232
|
+
DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS,
|
|
1233
|
+
DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
|
|
1234
|
+
DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS,
|
|
1089
1235
|
ITEM_TAX_AVAILABLE_COLUMNS,
|
|
1090
1236
|
ITEM_TAX_DEFAULT_VISIBLE_COLUMNS,
|
|
1091
1237
|
MODIFIER_MIX_AVAILABLE_COLUMNS,
|
|
@@ -1100,6 +1246,11 @@ export {
|
|
|
1100
1246
|
TICKET_SUMMARY_AVAILABLE_COLUMNS,
|
|
1101
1247
|
TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS,
|
|
1102
1248
|
calculateReportTotals,
|
|
1249
|
+
dailySalesConfig,
|
|
1250
|
+
dailySalesDiscountsConfig,
|
|
1251
|
+
dailySalesPaymentsConfig,
|
|
1252
|
+
dailySalesRefundsVoidsConfig,
|
|
1253
|
+
dailySalesTaxesConfig,
|
|
1103
1254
|
getColumnAlignment,
|
|
1104
1255
|
getColumnMetadata,
|
|
1105
1256
|
isNumericType,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReportConfig } from '../types';
|
|
2
|
+
type DailySalesField = 'groupById' | 'groupByName' | 'itemsQuantity' | 'salesAmountGross' | 'discountsAmount' | 'inclusiveTaxesAmount' | 'salesAmountNet' | 'salesMixPct' | 'avgPrice';
|
|
3
|
+
export declare const DAILY_SALES_AVAILABLE_COLUMNS: DailySalesField[];
|
|
4
|
+
export declare const DAILY_SALES_DEFAULT_VISIBLE_COLUMNS: DailySalesField[];
|
|
5
|
+
export declare const dailySalesConfig: ReportConfig<DailySalesField>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReportConfig } from '../types';
|
|
2
|
+
type DailySalesDiscountsField = 'discountName' | 'discountsCount' | 'discountsAmount';
|
|
3
|
+
export declare const DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS: DailySalesDiscountsField[];
|
|
4
|
+
export declare const DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS: DailySalesDiscountsField[];
|
|
5
|
+
export declare const dailySalesDiscountsConfig: ReportConfig<DailySalesDiscountsField>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReportConfig } from '../types';
|
|
2
|
+
type DailySalesPaymentsField = 'paymentTypeName' | 'paymentsCount' | 'paymentsAmount' | 'tipsAmount' | 'totalSales';
|
|
3
|
+
export declare const DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS: DailySalesPaymentsField[];
|
|
4
|
+
export declare const DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS: DailySalesPaymentsField[];
|
|
5
|
+
export declare const dailySalesPaymentsConfig: ReportConfig<DailySalesPaymentsField>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReportConfig } from '../types';
|
|
2
|
+
type DailySalesRefundsVoidsField = 'description' | 'count' | 'amount' | 'pctSales';
|
|
3
|
+
export declare const DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS: DailySalesRefundsVoidsField[];
|
|
4
|
+
export declare const DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS: DailySalesRefundsVoidsField[];
|
|
5
|
+
export declare const dailySalesRefundsVoidsConfig: ReportConfig<DailySalesRefundsVoidsField>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReportConfig } from '../types';
|
|
2
|
+
type DailySalesTaxesField = 'taxName' | 'taxableSales' | 'taxesAmount' | 'exemptSales';
|
|
3
|
+
export declare const DAILY_SALES_TAXES_AVAILABLE_COLUMNS: DailySalesTaxesField[];
|
|
4
|
+
export declare const DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS: DailySalesTaxesField[];
|
|
5
|
+
export declare const dailySalesTaxesConfig: ReportConfig<DailySalesTaxesField>;
|
|
6
|
+
export {};
|
package/dist/reports/index.d.ts
CHANGED
|
@@ -4,3 +4,6 @@ export { ticketLiveConfig, TICKET_LIVE_AVAILABLE_COLUMNS, TICKET_LIVE_DEFAULT_VI
|
|
|
4
4
|
export { productMixConfig, PRODUCT_MIX_AVAILABLE_COLUMNS, PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS, PRODUCT_MIX_CHART_FIELDS, } from './productMix';
|
|
5
5
|
export { modifierMixConfig, MODIFIER_MIX_AVAILABLE_COLUMNS, MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS } from './modifierMix';
|
|
6
6
|
export { itemTaxConfig, ITEM_TAX_AVAILABLE_COLUMNS, ITEM_TAX_DEFAULT_VISIBLE_COLUMNS } from './itemTax';
|
|
7
|
+
export { dailySalesConfig, DAILY_SALES_AVAILABLE_COLUMNS, DAILY_SALES_DEFAULT_VISIBLE_COLUMNS } from './dailySales';
|
|
8
|
+
export { dailySalesPaymentsConfig, DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS, DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS, } from './dailySalesPayments';
|
|
9
|
+
export { dailySalesDiscountsConfig, DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS, DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS, } from './dailySalesDiscounts';
|
package/dist/totals.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export interface CalculateReportTotalsOptions {
|
|
|
3
3
|
labelField: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function calculateReportTotals<T
|
|
6
|
+
export declare function calculateReportTotals<T>(data: T[], fieldConfig: Record<string, ColumnPresentationConfig>, opts: CalculateReportTotalsOptions): T;
|