@harbortouch/skytab-analytics-report-utils 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -25,6 +25,9 @@ __export(index_exports, {
25
25
  DAILY_SALES_REV_CLASS_FOOTER_LABELS: () => DAILY_SALES_REV_CLASS_FOOTER_LABELS,
26
26
  REPORT_SECTION_CONFIGS: () => REPORT_SECTION_CONFIGS,
27
27
  Report: () => Report,
28
+ TENDER_TYPE: () => TENDER_TYPE,
29
+ buildDailySalesCashPayments: () => buildDailySalesCashPayments,
30
+ buildDailySalesRevClassFooter: () => buildDailySalesRevClassFooter,
28
31
  calculateFieldTotal: () => calculateFieldTotal,
29
32
  calculateReportTotals: () => calculateReportTotals,
30
33
  dailySalesCacheConfig: () => dailySalesCacheConfig,
@@ -1894,6 +1897,38 @@ var REPORT_SECTION_CONFIGS = {
1894
1897
  [Report.DAILY_SALES_LIVE]: DAILY_SALES_SECTIONS
1895
1898
  };
1896
1899
 
1900
+ // src/constants.ts
1901
+ var TENDER_TYPE = {
1902
+ CASH: "Cash",
1903
+ CASH_REFUNDS: "Cash Refunds",
1904
+ UNKNOWN: "Unknown"
1905
+ };
1906
+
1907
+ // src/reports/dailySales.utils.ts
1908
+ var buildDailySalesCashPayments = (payments, paidOutAmount, gratuitiesPaidOutAmount, tipsPaidOutAmount) => [
1909
+ {
1910
+ name: DAILY_SALES_CASH_ROW_LABELS.cashPayments,
1911
+ amount: payments.filter((r) => r.paymentTypeName === TENDER_TYPE.CASH || r.paymentTypeName === TENDER_TYPE.CASH_REFUNDS).reduce((sum, r) => sum + r.paymentsAmount, 0)
1912
+ },
1913
+ { name: DAILY_SALES_CASH_ROW_LABELS.paidInOuts, amount: paidOutAmount },
1914
+ { name: DAILY_SALES_CASH_ROW_LABELS.gratuitiesPaidOut, amount: gratuitiesPaidOutAmount },
1915
+ { name: DAILY_SALES_CASH_ROW_LABELS.ccTipsPaidOut, amount: tipsPaidOutAmount }
1916
+ ];
1917
+ var buildDailySalesRevClassFooter = (inputs) => {
1918
+ const totalAccountable = inputs.revClassNetSales + inputs.taxTotal + inputs.gratuitiesTotal + inputs.giftCardSalesTotal - inputs.balancePaymentsTotal + inputs.nonSalesTotal;
1919
+ return [
1920
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.taxTotal, salesAmountNet: inputs.taxTotal },
1921
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.gratuities, salesAmountNet: inputs.gratuitiesTotal },
1922
+ {
1923
+ groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.balancePayments,
1924
+ salesAmountNet: inputs.balancePaymentsTotal
1925
+ },
1926
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.giftCardSales, salesAmountNet: inputs.giftCardSalesTotal },
1927
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.nonSalesRevenue, salesAmountNet: inputs.nonSalesTotal },
1928
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.totalAccountable, salesAmountNet: totalAccountable }
1929
+ ];
1930
+ };
1931
+
1897
1932
  // src/translations/crowdin/skytab-analytics-report-utils/en-GB.ts
1898
1933
  var enUS = {
1899
1934
  "common.report-col.fifteen-min-interval": false,
@@ -3517,6 +3552,9 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
3517
3552
  DAILY_SALES_REV_CLASS_FOOTER_LABELS,
3518
3553
  REPORT_SECTION_CONFIGS,
3519
3554
  Report,
3555
+ TENDER_TYPE,
3556
+ buildDailySalesCashPayments,
3557
+ buildDailySalesRevClassFooter,
3520
3558
  calculateFieldTotal,
3521
3559
  calculateReportTotals,
3522
3560
  dailySalesCacheConfig,
package/dist/index.d.cts CHANGED
@@ -103,6 +103,49 @@ declare const dailySalesDiscountsConfig: {
103
103
  readonly sectionName: "common.report-section.discounts";
104
104
  };
105
105
 
106
+ declare const buildDailySalesCashPayments: (payments: {
107
+ paymentTypeName: string;
108
+ paymentsAmount: number;
109
+ }[], paidOutAmount: number, gratuitiesPaidOutAmount: number, tipsPaidOutAmount: number) => ({
110
+ name: "common.report-section.cash-row.cash-payments";
111
+ amount: number;
112
+ } | {
113
+ name: "common.report-section.cash-row.paid-in-outs";
114
+ amount: number;
115
+ } | {
116
+ name: "common.report-section.cash-row.gratuities-paid-out";
117
+ amount: number;
118
+ } | {
119
+ name: "common.report-section.cash-row.cc-tips-paid-out";
120
+ amount: number;
121
+ })[];
122
+ declare const buildDailySalesRevClassFooter: (inputs: {
123
+ revClassNetSales: number;
124
+ taxTotal: number;
125
+ gratuitiesTotal: number;
126
+ giftCardSalesTotal: number;
127
+ balancePaymentsTotal: number;
128
+ nonSalesTotal: number;
129
+ }) => ({
130
+ groupByName: "common.report-section.rev-class-footer.tax-total";
131
+ salesAmountNet: number;
132
+ } | {
133
+ groupByName: "common.report-section.rev-class-footer.gratuities";
134
+ salesAmountNet: number;
135
+ } | {
136
+ groupByName: "common.report-section.rev-class-footer.balance-payments";
137
+ salesAmountNet: number;
138
+ } | {
139
+ groupByName: "common.report-section.rev-class-footer.gift-card-sales";
140
+ salesAmountNet: number;
141
+ } | {
142
+ groupByName: "common.report-section.rev-class-footer.non-sales-revenue";
143
+ salesAmountNet: number;
144
+ } | {
145
+ groupByName: "common.report-section.rev-class-footer.total-accountable";
146
+ salesAmountNet: number;
147
+ })[];
148
+
106
149
  type DailySalesRefundsVoidsField = 'description' | 'count' | 'amount' | 'pctSales';
107
150
  declare const dailySalesRefundsVoidsConfig: {
108
151
  readonly fields: Record<DailySalesRefundsVoidsField, ColumnPresentationConfig<DailySalesRefundsVoidsField>>;
@@ -205,6 +248,12 @@ declare const DAILY_SALES_REV_CLASS_FOOTER_LABELS: {
205
248
  };
206
249
  declare const REPORT_SECTION_CONFIGS: Partial<Record<ReportType, ReportSectionDefinition[]>>;
207
250
 
251
+ declare const TENDER_TYPE: {
252
+ readonly CASH: "Cash";
253
+ readonly CASH_REFUNDS: "Cash Refunds";
254
+ readonly UNKNOWN: "Unknown";
255
+ };
256
+
208
257
  type TimeFormat = '00:00' | '00:00:00' | '00:00-24H';
209
258
  interface LocaleOption {
210
259
  currency: string;
@@ -246,4 +295,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
246
295
  }[]) => LocaleOption[];
247
296
  declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
248
297
 
249
- export { type CalculateReportTotalsOptions, ColumnAlignment, ColumnGroupConfig, ColumnPresentationConfig, DAILY_SALES_CASH_ROW_LABELS, DAILY_SALES_REV_CLASS_FOOTER_LABELS, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, FieldType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, REPORT_SECTION_CONFIGS, ReportColumnKey, ReportConfig, type ReportSectionColumnDef, type ReportSectionDefinition, ReportType, type SalesByItemDetailField, type SalesSummaryField, type SupportedLocale, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, dailySalesTrendsOrderTypeConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getDateToFormat, getNumberToFormat, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, resolveTranslate, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
298
+ export { type CalculateReportTotalsOptions, ColumnAlignment, ColumnGroupConfig, ColumnPresentationConfig, DAILY_SALES_CASH_ROW_LABELS, DAILY_SALES_REV_CLASS_FOOTER_LABELS, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, FieldType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, REPORT_SECTION_CONFIGS, ReportColumnKey, ReportConfig, type ReportSectionColumnDef, type ReportSectionDefinition, ReportType, type SalesByItemDetailField, type SalesSummaryField, type SupportedLocale, TENDER_TYPE, type TicketLiveField, type TicketSummaryField, type TimeFormat, buildDailySalesCashPayments, buildDailySalesRevClassFooter, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, dailySalesTrendsOrderTypeConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getDateToFormat, getNumberToFormat, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, resolveTranslate, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
package/dist/index.d.ts CHANGED
@@ -103,6 +103,49 @@ declare const dailySalesDiscountsConfig: {
103
103
  readonly sectionName: "common.report-section.discounts";
104
104
  };
105
105
 
106
+ declare const buildDailySalesCashPayments: (payments: {
107
+ paymentTypeName: string;
108
+ paymentsAmount: number;
109
+ }[], paidOutAmount: number, gratuitiesPaidOutAmount: number, tipsPaidOutAmount: number) => ({
110
+ name: "common.report-section.cash-row.cash-payments";
111
+ amount: number;
112
+ } | {
113
+ name: "common.report-section.cash-row.paid-in-outs";
114
+ amount: number;
115
+ } | {
116
+ name: "common.report-section.cash-row.gratuities-paid-out";
117
+ amount: number;
118
+ } | {
119
+ name: "common.report-section.cash-row.cc-tips-paid-out";
120
+ amount: number;
121
+ })[];
122
+ declare const buildDailySalesRevClassFooter: (inputs: {
123
+ revClassNetSales: number;
124
+ taxTotal: number;
125
+ gratuitiesTotal: number;
126
+ giftCardSalesTotal: number;
127
+ balancePaymentsTotal: number;
128
+ nonSalesTotal: number;
129
+ }) => ({
130
+ groupByName: "common.report-section.rev-class-footer.tax-total";
131
+ salesAmountNet: number;
132
+ } | {
133
+ groupByName: "common.report-section.rev-class-footer.gratuities";
134
+ salesAmountNet: number;
135
+ } | {
136
+ groupByName: "common.report-section.rev-class-footer.balance-payments";
137
+ salesAmountNet: number;
138
+ } | {
139
+ groupByName: "common.report-section.rev-class-footer.gift-card-sales";
140
+ salesAmountNet: number;
141
+ } | {
142
+ groupByName: "common.report-section.rev-class-footer.non-sales-revenue";
143
+ salesAmountNet: number;
144
+ } | {
145
+ groupByName: "common.report-section.rev-class-footer.total-accountable";
146
+ salesAmountNet: number;
147
+ })[];
148
+
106
149
  type DailySalesRefundsVoidsField = 'description' | 'count' | 'amount' | 'pctSales';
107
150
  declare const dailySalesRefundsVoidsConfig: {
108
151
  readonly fields: Record<DailySalesRefundsVoidsField, ColumnPresentationConfig<DailySalesRefundsVoidsField>>;
@@ -205,6 +248,12 @@ declare const DAILY_SALES_REV_CLASS_FOOTER_LABELS: {
205
248
  };
206
249
  declare const REPORT_SECTION_CONFIGS: Partial<Record<ReportType, ReportSectionDefinition[]>>;
207
250
 
251
+ declare const TENDER_TYPE: {
252
+ readonly CASH: "Cash";
253
+ readonly CASH_REFUNDS: "Cash Refunds";
254
+ readonly UNKNOWN: "Unknown";
255
+ };
256
+
208
257
  type TimeFormat = '00:00' | '00:00:00' | '00:00-24H';
209
258
  interface LocaleOption {
210
259
  currency: string;
@@ -246,4 +295,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
246
295
  }[]) => LocaleOption[];
247
296
  declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
248
297
 
249
- export { type CalculateReportTotalsOptions, ColumnAlignment, ColumnGroupConfig, ColumnPresentationConfig, DAILY_SALES_CASH_ROW_LABELS, DAILY_SALES_REV_CLASS_FOOTER_LABELS, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, FieldType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, REPORT_SECTION_CONFIGS, ReportColumnKey, ReportConfig, type ReportSectionColumnDef, type ReportSectionDefinition, ReportType, type SalesByItemDetailField, type SalesSummaryField, type SupportedLocale, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, dailySalesTrendsOrderTypeConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getDateToFormat, getNumberToFormat, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, resolveTranslate, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
298
+ export { type CalculateReportTotalsOptions, ColumnAlignment, ColumnGroupConfig, ColumnPresentationConfig, DAILY_SALES_CASH_ROW_LABELS, DAILY_SALES_REV_CLASS_FOOTER_LABELS, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type EmployeeTipField, FieldType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, REPORT_SECTION_CONFIGS, ReportColumnKey, ReportConfig, type ReportSectionColumnDef, type ReportSectionDefinition, ReportType, type SalesByItemDetailField, type SalesSummaryField, type SupportedLocale, TENDER_TYPE, type TicketLiveField, type TicketSummaryField, type TimeFormat, buildDailySalesCashPayments, buildDailySalesRevClassFooter, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, dailySalesTrendsOrderTypeConfig, employeeTimecardConfig, employeeTipConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getDateToFormat, getNumberToFormat, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, resolveTranslate, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
package/dist/index.js CHANGED
@@ -185,12 +185,47 @@ var REPORT_SECTION_CONFIGS = {
185
185
  [Report.DAILY_SALES]: DAILY_SALES_SECTIONS,
186
186
  [Report.DAILY_SALES_LIVE]: DAILY_SALES_SECTIONS
187
187
  };
188
+
189
+ // src/constants.ts
190
+ var TENDER_TYPE = {
191
+ CASH: "Cash",
192
+ CASH_REFUNDS: "Cash Refunds",
193
+ UNKNOWN: "Unknown"
194
+ };
195
+
196
+ // src/reports/dailySales.utils.ts
197
+ var buildDailySalesCashPayments = (payments, paidOutAmount, gratuitiesPaidOutAmount, tipsPaidOutAmount) => [
198
+ {
199
+ name: DAILY_SALES_CASH_ROW_LABELS.cashPayments,
200
+ amount: payments.filter((r) => r.paymentTypeName === TENDER_TYPE.CASH || r.paymentTypeName === TENDER_TYPE.CASH_REFUNDS).reduce((sum, r) => sum + r.paymentsAmount, 0)
201
+ },
202
+ { name: DAILY_SALES_CASH_ROW_LABELS.paidInOuts, amount: paidOutAmount },
203
+ { name: DAILY_SALES_CASH_ROW_LABELS.gratuitiesPaidOut, amount: gratuitiesPaidOutAmount },
204
+ { name: DAILY_SALES_CASH_ROW_LABELS.ccTipsPaidOut, amount: tipsPaidOutAmount }
205
+ ];
206
+ var buildDailySalesRevClassFooter = (inputs) => {
207
+ const totalAccountable = inputs.revClassNetSales + inputs.taxTotal + inputs.gratuitiesTotal + inputs.giftCardSalesTotal - inputs.balancePaymentsTotal + inputs.nonSalesTotal;
208
+ return [
209
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.taxTotal, salesAmountNet: inputs.taxTotal },
210
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.gratuities, salesAmountNet: inputs.gratuitiesTotal },
211
+ {
212
+ groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.balancePayments,
213
+ salesAmountNet: inputs.balancePaymentsTotal
214
+ },
215
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.giftCardSales, salesAmountNet: inputs.giftCardSalesTotal },
216
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.nonSalesRevenue, salesAmountNet: inputs.nonSalesTotal },
217
+ { groupByName: DAILY_SALES_REV_CLASS_FOOTER_LABELS.totalAccountable, salesAmountNet: totalAccountable }
218
+ ];
219
+ };
188
220
  export {
189
221
  COLUMN_REGISTRY,
190
222
  DAILY_SALES_CASH_ROW_LABELS,
191
223
  DAILY_SALES_REV_CLASS_FOOTER_LABELS,
192
224
  REPORT_SECTION_CONFIGS,
193
225
  Report,
226
+ TENDER_TYPE,
227
+ buildDailySalesCashPayments,
228
+ buildDailySalesRevClassFooter,
194
229
  calculateFieldTotal,
195
230
  calculateReportTotals,
196
231
  dailySalesCacheConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbortouch/skytab-analytics-report-utils",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Centralized report column presentation configuration for SkyTab Analytics",
5
5
  "engines": {
6
6
  "node": ">=22.6.0",