@kreiseck/kasseneck-api 1.29.0 → 1.31.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/CHANGELOG.md +33 -0
- package/README.md +27 -0
- package/dist/cjs/client/list-receipts.d.ts +5 -0
- package/dist/cjs/client/list-receipts.js +5 -1
- package/dist/cjs/client/receipts.d.ts +6 -0
- package/dist/cjs/client/receipts.js +1 -0
- package/dist/cjs/enums/voucher-type.d.ts +5 -1
- package/dist/cjs/enums/voucher-type.js +5 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +15 -5
- package/dist/cjs/inventory/index.d.ts +2 -2
- package/dist/cjs/inventory/index.js +3 -2
- package/dist/cjs/inventory/typen.d.ts +39 -1
- package/dist/cjs/inventory/vertrag.d.ts +13 -2
- package/dist/cjs/inventory/vertrag.js +16 -1
- package/dist/cjs/inventory/webhook.d.ts +3 -0
- package/dist/cjs/inventory/webhook.js +39 -0
- package/dist/cjs/models/index.d.ts +1 -1
- package/dist/cjs/models/index.js +12 -2
- package/dist/cjs/models/voucher.d.ts +96 -2
- package/dist/cjs/models/voucher.js +158 -5
- package/dist/cjs/pos/artikel.d.ts +12 -0
- package/dist/cjs/pos/artikel.js +2 -0
- package/dist/cjs/pos/client.js +11 -0
- package/dist/cjs/pos/errors.d.ts +1 -1
- package/dist/cjs/pos/errors.js +1 -0
- package/dist/cjs/pos/fremdgutschein-artikel.d.ts +66 -0
- package/dist/cjs/pos/fremdgutschein-artikel.js +74 -0
- package/dist/cjs/pos/gutschein.d.ts +13 -0
- package/dist/cjs/pos/gutschein.js +5 -1
- package/dist/cjs/pos/index.d.ts +7 -4
- package/dist/cjs/pos/index.js +43 -4
- package/dist/cjs/pos/rabatt-vorlagen.d.ts +79 -0
- package/dist/cjs/pos/rabatt-vorlagen.js +156 -0
- package/dist/cjs/pos/schicht-lesen.js +8 -0
- package/dist/cjs/pos/schicht-typen.d.ts +15 -0
- package/dist/cjs/pos/settings.d.ts +69 -3
- package/dist/cjs/pos/settings.js +72 -5
- package/dist/cjs/pos/texte.d.ts +235 -0
- package/dist/cjs/pos/texte.js +135 -1
- package/dist/cjs/pos/zusaetze.d.ts +3 -3
- package/dist/cjs/pos/zusaetze.js +4 -2
- package/dist/cjs/receipt/due.d.ts +8 -1
- package/dist/cjs/receipt/due.js +1 -0
- package/dist/cjs/receipt/gutschein-plan.d.ts +11 -1
- package/dist/cjs/receipt/gutschein-plan.js +116 -1
- package/dist/cjs/receipt/layout.js +39 -6
- package/dist/cjs/receipt/shift-sheet.js +8 -0
- package/dist/cjs/stored/draht.js +6 -0
- package/dist/cjs/stored/einstellungen.js +50 -2
- package/dist/cjs/stored/vokabular.d.ts +3 -1
- package/dist/cjs/stored/vokabular.js +52 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/list-receipts.d.ts +5 -0
- package/dist/esm/client/list-receipts.js +5 -2
- package/dist/esm/client/receipts.d.ts +6 -0
- package/dist/esm/client/receipts.js +1 -0
- package/dist/esm/enums/voucher-type.d.ts +5 -1
- package/dist/esm/enums/voucher-type.js +5 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/inventory/index.d.ts +2 -2
- package/dist/esm/inventory/index.js +1 -1
- package/dist/esm/inventory/typen.d.ts +39 -1
- package/dist/esm/inventory/vertrag.d.ts +13 -2
- package/dist/esm/inventory/vertrag.js +15 -0
- package/dist/esm/inventory/webhook.d.ts +3 -0
- package/dist/esm/inventory/webhook.js +39 -0
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/voucher.d.ts +96 -2
- package/dist/esm/models/voucher.js +152 -4
- package/dist/esm/pos/artikel.d.ts +12 -0
- package/dist/esm/pos/artikel.js +2 -0
- package/dist/esm/pos/client.js +12 -1
- package/dist/esm/pos/errors.d.ts +1 -1
- package/dist/esm/pos/errors.js +1 -0
- package/dist/esm/pos/fremdgutschein-artikel.d.ts +66 -0
- package/dist/esm/pos/fremdgutschein-artikel.js +67 -0
- package/dist/esm/pos/gutschein.d.ts +13 -0
- package/dist/esm/pos/gutschein.js +4 -0
- package/dist/esm/pos/index.d.ts +7 -4
- package/dist/esm/pos/index.js +8 -4
- package/dist/esm/pos/rabatt-vorlagen.d.ts +79 -0
- package/dist/esm/pos/rabatt-vorlagen.js +148 -0
- package/dist/esm/pos/schicht-lesen.js +8 -0
- package/dist/esm/pos/schicht-typen.d.ts +15 -0
- package/dist/esm/pos/settings.d.ts +69 -3
- package/dist/esm/pos/settings.js +67 -4
- package/dist/esm/pos/texte.d.ts +235 -0
- package/dist/esm/pos/texte.js +133 -0
- package/dist/esm/pos/zusaetze.d.ts +3 -3
- package/dist/esm/pos/zusaetze.js +4 -2
- package/dist/esm/receipt/due.d.ts +8 -1
- package/dist/esm/receipt/due.js +1 -0
- package/dist/esm/receipt/gutschein-plan.d.ts +11 -1
- package/dist/esm/receipt/gutschein-plan.js +117 -2
- package/dist/esm/receipt/layout.js +40 -7
- package/dist/esm/receipt/shift-sheet.js +8 -0
- package/dist/esm/stored/draht.js +7 -1
- package/dist/esm/stored/einstellungen.js +52 -4
- package/dist/esm/stored/vokabular.d.ts +3 -1
- package/dist/esm/stored/vokabular.js +51 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/add-on-cases.json +6 -4
- package/fixtures/discount-preset-cases.json +1074 -0
- package/fixtures/expected/voucher-external-redeem.grid32.txt +30 -0
- package/fixtures/expected/voucher-external-redeem.grid48.txt +27 -0
- package/fixtures/expected/voucher-external-redeem.lines.json +280 -0
- package/fixtures/expected/voucher-external-redeem.sheet32.json +206 -0
- package/fixtures/expected/voucher-external-redeem.sheet48.json +188 -0
- package/fixtures/expected/voucher-external-sale.grid32.txt +27 -0
- package/fixtures/expected/voucher-external-sale.grid48.txt +26 -0
- package/fixtures/expected/voucher-external-sale.lines.json +256 -0
- package/fixtures/expected/voucher-external-sale.sheet32.json +188 -0
- package/fixtures/expected/voucher-external-sale.sheet48.json +182 -0
- package/fixtures/external-voucher-article-cases.json +311 -0
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/manifest.json +16 -0
- package/fixtures/pos-texts.json +226 -2
- package/fixtures/receipt-due-voucher-generated.json +2 -2
- package/fixtures/receipts/voucher-external-redeem.json +85 -0
- package/fixtures/receipts/voucher-external-sale.json +80 -0
- package/fixtures/renames-1.0.json +18 -0
- package/fixtures/stored/voucher-cases.json +2800 -0
- package/fixtures/surface.json +62 -5
- package/fixtures/v3/antworten/belege.json +4 -3
- package/fixtures/v3/antworten/belegmail.json +2 -2
- package/fixtures/v3/antworten/berichte.json +2 -2
- package/fixtures/v3/antworten/kasse-belege.json +4 -3
- package/fixtures/v3/antworten/kasse.json +16 -10
- package/fixtures/v3/antworten/lager.json +6 -3
- package/fixtures/v3/antworten/rechnungen.json +2 -2
- package/fixtures/v3/antworten/storno.json +2 -2
- package/fixtures/v3/stored/belege.json +2 -2
- package/fixtures/v3/stored/kasse.json +3 -3
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +262 -15
- package/fixtures/v3/zahlbetrag-faelle.json +2 -2
- package/package.json +1 -1
|
@@ -36,6 +36,14 @@ export declare const VOUCHER_TYPE_KINDS: readonly VoucherTypeKind[];
|
|
|
36
36
|
export declare const VOUCHER_AMOUNT_MODES: readonly ('free' | 'fixed')[];
|
|
37
37
|
/** Gueltigkeit einer Sorte: unbefristet oder N Jahre (das Muster der Sorte, nicht das eines Gutscheins). */
|
|
38
38
|
export declare const VOUCHER_TYPE_VALIDITY_PATTERNS: readonly ('unlimited' | 'years')[];
|
|
39
|
+
/**
|
|
40
|
+
* Freigabe fuer Fremdgutscheine des Kontos (`vouchers.externalVouchers`): `off` keine, `multi_purpose` nur
|
|
41
|
+
* Wertgutscheine (Mehrzweck) eines anderen Systems, `all` dazu Einzweckgutscheine. Die Kasse zeigt den Weg
|
|
42
|
+
* „Fremdgutschein“ nur ab `multi_purpose`, die Art Einzweck nur bei `all`; der Server prueft dieselbe Freigabe
|
|
43
|
+
* (`external_voucher_not_enabled`, `external_voucher_type_not_enabled`). Die Test-Umgebung ist immer `all`.
|
|
44
|
+
*/
|
|
45
|
+
export type PosExternalVouchers = 'off' | 'multi_purpose' | 'all';
|
|
46
|
+
export declare const EXTERNAL_VOUCHERS: readonly PosExternalVouchers[];
|
|
39
47
|
/** Der Artikel eines Dienstleistungsgutscheins. */
|
|
40
48
|
export interface VoucherArticle {
|
|
41
49
|
id: string;
|
|
@@ -158,6 +166,11 @@ export interface PosVoucherSettings {
|
|
|
158
166
|
* passende Sorte). Fehlt sie, zeigt die Kasse „Als Gutschein“ nicht.
|
|
159
167
|
*/
|
|
160
168
|
returnType?: PosVoucherReturnType;
|
|
169
|
+
/**
|
|
170
|
+
* Freigabe fuer Fremdgutscheine (Server 2026-11, [EXTERNAL_VOUCHERS]). Der Leser setzt sie immer; fehlt sie
|
|
171
|
+
* am Draht (aelterer Server) oder ist sie unbekannt, gilt `off`.
|
|
172
|
+
*/
|
|
173
|
+
externalVouchers?: PosExternalVouchers;
|
|
161
174
|
}
|
|
162
175
|
/** Sorte fuer Rueckgaben (`vouchers.returnType`): Kennung und Name. */
|
|
163
176
|
export interface PosVoucherReturnType {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VOUCHER_SETTINGS_DEFAULTS = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = void 0;
|
|
3
|
+
exports.VOUCHER_SETTINGS_DEFAULTS = exports.EXTERNAL_VOUCHERS = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = void 0;
|
|
4
4
|
exports.posVoucherSettingsFromWire = posVoucherSettingsFromWire;
|
|
5
5
|
exports.checkVoucher = checkVoucher;
|
|
6
6
|
exports.reprintVoucherLabel = reprintVoucherLabel;
|
|
@@ -19,10 +19,12 @@ exports.VOUCHER_TYPE_KINDS = Object.freeze(['multi_purpose', 'single_purpose']);
|
|
|
19
19
|
exports.VOUCHER_AMOUNT_MODES = Object.freeze(['free', 'fixed']);
|
|
20
20
|
/** Gueltigkeit einer Sorte: unbefristet oder N Jahre (das Muster der Sorte, nicht das eines Gutscheins). */
|
|
21
21
|
exports.VOUCHER_TYPE_VALIDITY_PATTERNS = Object.freeze(['unlimited', 'years']);
|
|
22
|
+
exports.EXTERNAL_VOUCHERS = Object.freeze(['off', 'multi_purpose', 'all']);
|
|
22
23
|
/** Ohne Block `vouchers` (alter Server, Konto ohne Schalter): Verkaufen ist aus. */
|
|
23
24
|
exports.VOUCHER_SETTINGS_DEFAULTS = Object.freeze({
|
|
24
25
|
sale: false, valueVoucherType: null, vatRateBp: null,
|
|
25
26
|
typeSale: false, types: Object.freeze([]), serviceArticles: false, labelDefault: null,
|
|
27
|
+
externalVouchers: 'off',
|
|
26
28
|
});
|
|
27
29
|
/**
|
|
28
30
|
* Block `vouchers` einer Einstellungs-Antwort, geschlossen im Zweifel: ist
|
|
@@ -83,6 +85,8 @@ function posVoucherSettingsFromWire(block) {
|
|
|
83
85
|
serviceArticles: leistung,
|
|
84
86
|
labelDefault: vorlageVomDraht(b['labelDefault']),
|
|
85
87
|
...rueckgabeSorteVomDraht(b['returnType']),
|
|
88
|
+
// Unbekannt oder fehlend: aus (schliesst nur den Fremdgutschein, nie den Block).
|
|
89
|
+
externalVouchers: exports.EXTERNAL_VOUCHERS.includes(b['externalVouchers']) ? b['externalVouchers'] : 'off',
|
|
86
90
|
};
|
|
87
91
|
}
|
|
88
92
|
/** `vouchers.returnType`, nur stimmig (Kennung wie eine Sorte, Name als Text); sonst fehlt es. */
|
package/dist/cjs/pos/index.d.ts
CHANGED
|
@@ -6,16 +6,19 @@
|
|
|
6
6
|
* die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
|
|
7
7
|
* und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
|
|
8
8
|
*/
|
|
9
|
-
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
9
|
+
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, tipKeptFor, type TipKeptDecision, DISCOUNT_PRESET_KIND, type PosDiscountPreset, type PosDiscountPresetKind, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, type PosTipKeptMode, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
10
10
|
export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
11
11
|
export { REFERENCE_MODES, type ReferenceMode, type PosReference, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, type ReferenceCheckResult, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
|
|
12
12
|
export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
|
|
13
|
+
export { ARTICLE_EXTERNAL_VOUCHER_TYPES, type ArticleExternalVoucher, ARTICLE_EXTERNAL_VOUCHER_INVALID, ARTICLE_EXTERNAL_VOUCHER_VAT_RATES, EXTERNAL_VOUCHER_ARTICLE_REASONS, type ExternalVoucherArticleReason, type ExternalVoucherArticleInput, isArticleExternalVoucher, checkExternalVoucherValue, checkExternalVoucherArticle, type ExternalVoucherTileBlock, externalVoucherTileBlock, } from './fremdgutschein-artikel.js';
|
|
14
|
+
export { ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES, type OwnVoucherCodeShape } from '../models/voucher.js';
|
|
13
15
|
export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, type SetMyPosLogoOptions, } from './client.js';
|
|
14
16
|
export { POS_ERROR_CODES, type PosErrorCode, isPosErrorCode, posErrorCode, isPosError, type PosFieldError, posFieldErrors, } from './errors.js';
|
|
15
17
|
export { distributeDiscount } from '../receipt/discount.js';
|
|
16
18
|
export { cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, type VoucherPerms, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
17
19
|
export { type NetworkPrinter, type PrintJob, type PrintJobStatus, PRINT_JOB_STATUSES, type PrintJobSource, PRINT_JOB_SOURCES, isPrintJobFinished, type CreatePrintJobOptions, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
18
20
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
21
|
+
export { posDiscountPresets, discountPresetChipText, discountChipsFromPresets, checkDiscountPresets, discountBlockLines, INVALID_DISCOUNT_PRESET, DISCOUNT_PRESETS_MAX, DISCOUNT_PRESET_NAME_MAX, DISCOUNT_PRESET_PERCENT_BP, DISCOUNT_PRESET_AMOUNT_CENTS, DISCOUNT_PRESET_MESSAGES, type DiscountPresetReason, type DiscountPresetError, type DiscountPresetsCheck, type DiscountBlockLine, type DiscountTotal, } from './rabatt-vorlagen.js';
|
|
19
22
|
export { depFolderName } from './dep.js';
|
|
20
23
|
export { type RegisterInspectionInfo, type RegisterInspectionSignature, type InspectionSignatureStatus, type InspectionInfoRow, type InspectionInfoRowKey, type InspectionInfoSection, type InspectionInfoLinesOptions, getRegisterInspectionInfo, inspectionInfoRows, inspectionInfoLines, } from './kasseninfo.js';
|
|
21
24
|
export { type ConnectStateReport, reportConnectState } from './connect-bestand.js';
|
|
@@ -23,11 +26,11 @@ export { STOCK_LOCATION_TYPES, type StockLocationType, type StockLocation, type
|
|
|
23
26
|
export { type ListMyStocktakesOptions, type ListMyStocktakeItemsOptions, type ListMyStocktakeCountsOptions, type RecordMyStocktakeCountOptions, type VoidMyStocktakeCountOptions, listMyStocktakes, listMyStocktakeItems, listMyStocktakeCounts, recordMyStocktakeCount, voidMyStocktakeCount, parseQuantityMilli, } from './inventur.js';
|
|
24
27
|
export type { Stocktake, StocktakeItem, StocktakeCount, StocktakeCountResult, StocktakeItemPage, StocktakeCountPage, StocktakeActor, StocktakeProgress, StocktakeReview, StocktakeRecount, StocktakeScope, } from '../inventory/typen.js';
|
|
25
28
|
export type { StocktakeStatus } from '../inventory/vertrag.js';
|
|
26
|
-
export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, type VoucherKind, type VoucherStatus, type VoucherValidity, type VoucherArticle, type VoucherCheck, type PosVoucherSettings, type PosVoucherReturnType, type VoucherPayout, type VoucherTypeKind, type PosVoucherType, type VoucherLabelTemplate, } from './gutschein.js';
|
|
29
|
+
export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, EXTERNAL_VOUCHERS, type PosExternalVouchers, type VoucherKind, type VoucherStatus, type VoucherValidity, type VoucherArticle, type VoucherCheck, type PosVoucherSettings, type PosVoucherReturnType, type VoucherPayout, type VoucherTypeKind, type PosVoucherType, type VoucherLabelTemplate, } from './gutschein.js';
|
|
27
30
|
export { type GetMyDrawerStateOptions, type OpenMyShiftOptions, type RecordMyCashMovementOptions, type DrawerOpeningEntry, type LogMyDrawerOpeningsOptions, type GetMyShiftReportOptions, type TipPayout, type CloseMyShiftOptions, type AfterCountOption, type RecordMyShiftCountOptions, getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, recordMyShiftCount, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, type ShiftTipLine, type ShiftTipLineKey, } from './schicht.js';
|
|
28
|
-
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, EXPECTED_PART_KEYS, DIFFERENCE_PART_TYPES, type ExpectedPartKey, type ShiftExpectedPart, type DifferencePartType, type ShiftDifferencePart, type LastShift, type ShiftCountResult, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftOwnerTip, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
|
|
31
|
+
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, EXPECTED_PART_KEYS, DIFFERENCE_PART_TYPES, type ExpectedPartKey, type ShiftExpectedPart, type DifferencePartType, type ShiftDifferencePart, type LastShift, type ShiftCountResult, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftOwnerTip, type ShiftDiscount, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
|
|
29
32
|
export { type ShiftReceiptLayoutOptions, shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
|
|
30
33
|
export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
31
34
|
export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
|
|
32
|
-
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
35
|
+
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, EXTERNAL_VOUCHER_TILE_MESSAGES, EXTERNAL_VOUCHER_ARTICLE_MESSAGES, externalVoucherArticleErrorMessage, EXTERNAL_VOUCHERS_LABELS, EXTERNAL_VOUCHER_KIND_LABELS, TIP_KEPT_MODE_LABELS, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
33
36
|
export { roundUpSuggestions } from './aufrunden.js';
|
package/dist/cjs/pos/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
3
|
+
exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.TIP_KEPT_MODE = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = exports.posShortcutConflict = exports.POS_SHORTCUT_SHARED_PAIRS = exports.posSettingsChanges = exports.unknownPosSettingValues = exports.sanitizePosSettings = exports.mergePosSettings = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.posCartWidth = exports.posTipStart = exports.posTipKinds = exports.POS_BUSINESS_OPTIONAL_LISTS = exports.DISCOUNT_PRESET_KIND = exports.tipKeptFor = exports.posTipKeptMode = exports.posCustomDiscountAllowed = exports.posTipKeptByDefault = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = void 0;
|
|
4
|
+
exports.getPosSettings = exports.OWN_VOUCHER_CODE_SHAPES = exports.ownVoucherCodeShape = exports.externalVoucherTileBlock = exports.checkExternalVoucherArticle = exports.checkExternalVoucherValue = exports.isArticleExternalVoucher = exports.EXTERNAL_VOUCHER_ARTICLE_REASONS = exports.ARTICLE_EXTERNAL_VOUCHER_VAT_RATES = exports.ARTICLE_EXTERNAL_VOUCHER_INVALID = exports.ARTICLE_EXTERNAL_VOUCHER_TYPES = exports.orderAddOnLines = exports.addOnDisplayOrder = exports.addOnRemap = exports.addOnsOfItem = exports.addOnReferencesValid = exports.addOnsFor = exports.isSelectableAddOn = exports.ADD_ON_BLOCK_REASONS = exports.ADD_ONS_MAX = exports.fromReferencePayload = exports.referenceLineName = exports.checkReference = exports.isDigitsOnlyPattern = exports.isValidReferencePattern = exports.cleanReferenceText = exports.REFERENCE_PATTERN_TEMPLATES = exports.REFERENCE_PATTERN_MAX = exports.REFERENCE_HINT_MAX = exports.REFERENCE_LABEL_MAX = exports.REFERENCE_INPUT_MAX = exports.REFERENCE_MODES = exports.tilePrompts = exports.isBookableArticle = exports.allowedQuantity = exports.quantityDefaults = exports.quantityRuleForUnit = exports.QUANTITY_RULES = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = void 0;
|
|
5
|
+
exports.checkVoucher = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = exports.parseQuantityMilli = exports.voidMyStocktakeCount = exports.recordMyStocktakeCount = exports.listMyStocktakeCounts = exports.listMyStocktakeItems = exports.listMyStocktakes = exports.setMyCashregisterStockLocation = exports.listMyStock = exports.listMyStockLocations = exports.STOCK_LOCATION_TYPES = exports.reportConnectState = exports.inspectionInfoLines = exports.inspectionInfoRows = exports.getRegisterInspectionInfo = exports.depFolderName = exports.DISCOUNT_PRESET_MESSAGES = exports.DISCOUNT_PRESET_AMOUNT_CENTS = exports.DISCOUNT_PRESET_PERCENT_BP = exports.DISCOUNT_PRESET_NAME_MAX = exports.DISCOUNT_PRESETS_MAX = exports.INVALID_DISCOUNT_PRESET = exports.discountBlockLines = exports.checkDiscountPresets = exports.discountChipsFromPresets = exports.discountPresetChipText = exports.posDiscountPresets = exports.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = exports.voucherPermsOf = exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.posFieldErrors = exports.isPosError = exports.posErrorCode = exports.isPosErrorCode = exports.POS_ERROR_CODES = exports.posSettingsFromWire = exports.setMyPosLogo = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = void 0;
|
|
6
|
+
exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.DIFFERENCE_PART_TYPES = exports.EXPECTED_PART_KEYS = exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = exports.durationText = exports.shiftTipLines = exports.newIdempotencyKey = exports.parseCentsAllowZero = exports.sumDenominations = exports.recordMyShiftCount = exports.closeMyShift = exports.getMyShiftReport = exports.logMyDrawerOpenings = exports.recordMyCashMovement = exports.openMyShift = exports.getMyDrawerState = exports.EXTERNAL_VOUCHERS = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.posVoucherSettingsFromWire = exports.VOUCHER_SETTINGS_DEFAULTS = exports.reprintVoucherLabel = void 0;
|
|
7
|
+
exports.roundUpSuggestions = exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.TIP_KEPT_MODE_LABELS = exports.EXTERNAL_VOUCHER_KIND_LABELS = exports.EXTERNAL_VOUCHERS_LABELS = exports.externalVoucherArticleErrorMessage = exports.EXTERNAL_VOUCHER_ARTICLE_MESSAGES = exports.EXTERNAL_VOUCHER_TILE_MESSAGES = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = void 0;
|
|
7
8
|
/**
|
|
8
9
|
* Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
|
|
9
10
|
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger, Lager (Standorte, Bestand,
|
|
@@ -22,6 +23,11 @@ Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_FIELDS", { enumerable: tru
|
|
|
22
23
|
Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_CHOICES", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_OPTIONAL_CHOICES; } });
|
|
23
24
|
Object.defineProperty(exports, "POS_DEVICE_OPTIONAL_CHOICES", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_OPTIONAL_CHOICES; } });
|
|
24
25
|
Object.defineProperty(exports, "posTipKeptByDefault", { enumerable: true, get: function () { return settings_js_1.posTipKeptByDefault; } });
|
|
26
|
+
Object.defineProperty(exports, "posCustomDiscountAllowed", { enumerable: true, get: function () { return settings_js_1.posCustomDiscountAllowed; } });
|
|
27
|
+
Object.defineProperty(exports, "posTipKeptMode", { enumerable: true, get: function () { return settings_js_1.posTipKeptMode; } });
|
|
28
|
+
Object.defineProperty(exports, "tipKeptFor", { enumerable: true, get: function () { return settings_js_1.tipKeptFor; } });
|
|
29
|
+
Object.defineProperty(exports, "DISCOUNT_PRESET_KIND", { enumerable: true, get: function () { return settings_js_1.DISCOUNT_PRESET_KIND; } });
|
|
30
|
+
Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_LISTS", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_OPTIONAL_LISTS; } });
|
|
25
31
|
Object.defineProperty(exports, "posTipKinds", { enumerable: true, get: function () { return settings_js_1.posTipKinds; } });
|
|
26
32
|
Object.defineProperty(exports, "posTipStart", { enumerable: true, get: function () { return settings_js_1.posTipStart; } });
|
|
27
33
|
Object.defineProperty(exports, "posCartWidth", { enumerable: true, get: function () { return settings_js_1.posCartWidth; } });
|
|
@@ -41,6 +47,7 @@ Object.defineProperty(exports, "QUANTITY", { enumerable: true, get: function ()
|
|
|
41
47
|
Object.defineProperty(exports, "TIP_MODE", { enumerable: true, get: function () { return settings_js_1.TIP_MODE; } });
|
|
42
48
|
Object.defineProperty(exports, "TIP_KINDS", { enumerable: true, get: function () { return settings_js_1.TIP_KINDS; } });
|
|
43
49
|
Object.defineProperty(exports, "TIP_START", { enumerable: true, get: function () { return settings_js_1.TIP_START; } });
|
|
50
|
+
Object.defineProperty(exports, "TIP_KEPT_MODE", { enumerable: true, get: function () { return settings_js_1.TIP_KEPT_MODE; } });
|
|
44
51
|
Object.defineProperty(exports, "CART_WIDTH", { enumerable: true, get: function () { return settings_js_1.CART_WIDTH; } });
|
|
45
52
|
Object.defineProperty(exports, "CHECKOUT_MODE", { enumerable: true, get: function () { return settings_js_1.CHECKOUT_MODE; } });
|
|
46
53
|
Object.defineProperty(exports, "CARD_PROVIDER", { enumerable: true, get: function () { return settings_js_1.CARD_PROVIDER; } });
|
|
@@ -100,6 +107,19 @@ Object.defineProperty(exports, "addOnsOfItem", { enumerable: true, get: function
|
|
|
100
107
|
Object.defineProperty(exports, "addOnRemap", { enumerable: true, get: function () { return zusaetze_js_1.addOnRemap; } });
|
|
101
108
|
Object.defineProperty(exports, "addOnDisplayOrder", { enumerable: true, get: function () { return zusaetze_js_1.addOnDisplayOrder; } });
|
|
102
109
|
Object.defineProperty(exports, "orderAddOnLines", { enumerable: true, get: function () { return zusaetze_js_1.orderAddOnLines; } });
|
|
110
|
+
var fremdgutschein_artikel_js_1 = require("./fremdgutschein-artikel.js");
|
|
111
|
+
Object.defineProperty(exports, "ARTICLE_EXTERNAL_VOUCHER_TYPES", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.ARTICLE_EXTERNAL_VOUCHER_TYPES; } });
|
|
112
|
+
Object.defineProperty(exports, "ARTICLE_EXTERNAL_VOUCHER_INVALID", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.ARTICLE_EXTERNAL_VOUCHER_INVALID; } });
|
|
113
|
+
Object.defineProperty(exports, "ARTICLE_EXTERNAL_VOUCHER_VAT_RATES", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.ARTICLE_EXTERNAL_VOUCHER_VAT_RATES; } });
|
|
114
|
+
Object.defineProperty(exports, "EXTERNAL_VOUCHER_ARTICLE_REASONS", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.EXTERNAL_VOUCHER_ARTICLE_REASONS; } });
|
|
115
|
+
Object.defineProperty(exports, "isArticleExternalVoucher", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.isArticleExternalVoucher; } });
|
|
116
|
+
Object.defineProperty(exports, "checkExternalVoucherValue", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.checkExternalVoucherValue; } });
|
|
117
|
+
Object.defineProperty(exports, "checkExternalVoucherArticle", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.checkExternalVoucherArticle; } });
|
|
118
|
+
Object.defineProperty(exports, "externalVoucherTileBlock", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.externalVoucherTileBlock; } });
|
|
119
|
+
// Form-Erkennung eigener Codes im Gutschein-Feld (Nachfrage statt Abweisung); dieselbe Funktion wie an der Wurzel.
|
|
120
|
+
var voucher_js_1 = require("../models/voucher.js");
|
|
121
|
+
Object.defineProperty(exports, "ownVoucherCodeShape", { enumerable: true, get: function () { return voucher_js_1.ownVoucherCodeShape; } });
|
|
122
|
+
Object.defineProperty(exports, "OWN_VOUCHER_CODE_SHAPES", { enumerable: true, get: function () { return voucher_js_1.OWN_VOUCHER_CODE_SHAPES; } });
|
|
103
123
|
var client_js_1 = require("./client.js");
|
|
104
124
|
Object.defineProperty(exports, "getPosSettings", { enumerable: true, get: function () { return client_js_1.getPosSettings; } });
|
|
105
125
|
Object.defineProperty(exports, "setMyPosSettings", { enumerable: true, get: function () { return client_js_1.setMyPosSettings; } });
|
|
@@ -130,6 +150,18 @@ Object.defineProperty(exports, "createPrintJob", { enumerable: true, get: functi
|
|
|
130
150
|
Object.defineProperty(exports, "getPrintJob", { enumerable: true, get: function () { return drucker_js_1.getPrintJob; } });
|
|
131
151
|
var trinkgeld_js_1 = require("./trinkgeld.js");
|
|
132
152
|
Object.defineProperty(exports, "listMyTipRecipients", { enumerable: true, get: function () { return trinkgeld_js_1.listMyTipRecipients; } });
|
|
153
|
+
var rabatt_vorlagen_js_1 = require("./rabatt-vorlagen.js");
|
|
154
|
+
Object.defineProperty(exports, "posDiscountPresets", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.posDiscountPresets; } });
|
|
155
|
+
Object.defineProperty(exports, "discountPresetChipText", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.discountPresetChipText; } });
|
|
156
|
+
Object.defineProperty(exports, "discountChipsFromPresets", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.discountChipsFromPresets; } });
|
|
157
|
+
Object.defineProperty(exports, "checkDiscountPresets", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.checkDiscountPresets; } });
|
|
158
|
+
Object.defineProperty(exports, "discountBlockLines", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.discountBlockLines; } });
|
|
159
|
+
Object.defineProperty(exports, "INVALID_DISCOUNT_PRESET", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.INVALID_DISCOUNT_PRESET; } });
|
|
160
|
+
Object.defineProperty(exports, "DISCOUNT_PRESETS_MAX", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.DISCOUNT_PRESETS_MAX; } });
|
|
161
|
+
Object.defineProperty(exports, "DISCOUNT_PRESET_NAME_MAX", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.DISCOUNT_PRESET_NAME_MAX; } });
|
|
162
|
+
Object.defineProperty(exports, "DISCOUNT_PRESET_PERCENT_BP", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.DISCOUNT_PRESET_PERCENT_BP; } });
|
|
163
|
+
Object.defineProperty(exports, "DISCOUNT_PRESET_AMOUNT_CENTS", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.DISCOUNT_PRESET_AMOUNT_CENTS; } });
|
|
164
|
+
Object.defineProperty(exports, "DISCOUNT_PRESET_MESSAGES", { enumerable: true, get: function () { return rabatt_vorlagen_js_1.DISCOUNT_PRESET_MESSAGES; } });
|
|
133
165
|
// Prüfung (DEP) an der Kasse: Ordner auf dem USB-Stick (gleich in Web-Kasse und Kassen-App).
|
|
134
166
|
var dep_js_1 = require("./dep.js");
|
|
135
167
|
Object.defineProperty(exports, "depFolderName", { enumerable: true, get: function () { return dep_js_1.depFolderName; } });
|
|
@@ -165,6 +197,7 @@ Object.defineProperty(exports, "VOUCHER_PAYOUTS", { enumerable: true, get: funct
|
|
|
165
197
|
Object.defineProperty(exports, "VOUCHER_TYPE_KINDS", { enumerable: true, get: function () { return gutschein_js_1.VOUCHER_TYPE_KINDS; } });
|
|
166
198
|
Object.defineProperty(exports, "VOUCHER_AMOUNT_MODES", { enumerable: true, get: function () { return gutschein_js_1.VOUCHER_AMOUNT_MODES; } });
|
|
167
199
|
Object.defineProperty(exports, "VOUCHER_TYPE_VALIDITY_PATTERNS", { enumerable: true, get: function () { return gutschein_js_1.VOUCHER_TYPE_VALIDITY_PATTERNS; } });
|
|
200
|
+
Object.defineProperty(exports, "EXTERNAL_VOUCHERS", { enumerable: true, get: function () { return gutschein_js_1.EXTERNAL_VOUCHERS; } });
|
|
168
201
|
// Schicht, Kassenstand und Lade-Protokoll (1.9.0): Aufrufe, Kataloge, Helfer, Bons.
|
|
169
202
|
var schicht_js_1 = require("./schicht.js");
|
|
170
203
|
Object.defineProperty(exports, "getMyDrawerState", { enumerable: true, get: function () { return schicht_js_1.getMyDrawerState; } });
|
|
@@ -220,6 +253,12 @@ Object.defineProperty(exports, "CANCELLATION_VOUCHER_ERROR_MESSAGES", { enumerab
|
|
|
220
253
|
Object.defineProperty(exports, "cancellationErrorMessage", { enumerable: true, get: function () { return texte_js_1.cancellationErrorMessage; } });
|
|
221
254
|
Object.defineProperty(exports, "VOUCHER_ERROR_MESSAGES", { enumerable: true, get: function () { return texte_js_1.VOUCHER_ERROR_MESSAGES; } });
|
|
222
255
|
Object.defineProperty(exports, "voucherErrorMessage", { enumerable: true, get: function () { return texte_js_1.voucherErrorMessage; } });
|
|
256
|
+
Object.defineProperty(exports, "EXTERNAL_VOUCHER_TILE_MESSAGES", { enumerable: true, get: function () { return texte_js_1.EXTERNAL_VOUCHER_TILE_MESSAGES; } });
|
|
257
|
+
Object.defineProperty(exports, "EXTERNAL_VOUCHER_ARTICLE_MESSAGES", { enumerable: true, get: function () { return texte_js_1.EXTERNAL_VOUCHER_ARTICLE_MESSAGES; } });
|
|
258
|
+
Object.defineProperty(exports, "externalVoucherArticleErrorMessage", { enumerable: true, get: function () { return texte_js_1.externalVoucherArticleErrorMessage; } });
|
|
259
|
+
Object.defineProperty(exports, "EXTERNAL_VOUCHERS_LABELS", { enumerable: true, get: function () { return texte_js_1.EXTERNAL_VOUCHERS_LABELS; } });
|
|
260
|
+
Object.defineProperty(exports, "EXTERNAL_VOUCHER_KIND_LABELS", { enumerable: true, get: function () { return texte_js_1.EXTERNAL_VOUCHER_KIND_LABELS; } });
|
|
261
|
+
Object.defineProperty(exports, "TIP_KEPT_MODE_LABELS", { enumerable: true, get: function () { return texte_js_1.TIP_KEPT_MODE_LABELS; } });
|
|
223
262
|
Object.defineProperty(exports, "LABELS", { enumerable: true, get: function () { return texte_js_1.LABELS; } });
|
|
224
263
|
Object.defineProperty(exports, "labelText", { enumerable: true, get: function () { return texte_js_1.labelText; } });
|
|
225
264
|
Object.defineProperty(exports, "RETURN_DISPOSITION_LABELS", { enumerable: true, get: function () { return texte_js_1.RETURN_DISPOSITION_LABELS; } });
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PosBusinessSettings, PosDiscountPreset } from './settings.js';
|
|
2
|
+
/** Fehlercode, den der Server bei einer ungueltigen Vorlage sendet. */
|
|
3
|
+
export declare const INVALID_DISCOUNT_PRESET = "invalid_discount_preset";
|
|
4
|
+
/** Hoechstzahl der Vorlagen. */
|
|
5
|
+
export declare const DISCOUNT_PRESETS_MAX = 5;
|
|
6
|
+
/** Laenge des Namens in Zeichen (nach dem Trimmen). */
|
|
7
|
+
export declare const DISCOUNT_PRESET_NAME_MAX = 24;
|
|
8
|
+
/** Prozent in Basispunkten: 0,1 % bis 100 % in Schritten von 0,1 %. */
|
|
9
|
+
export declare const DISCOUNT_PRESET_PERCENT_BP: Readonly<{
|
|
10
|
+
min: 10;
|
|
11
|
+
max: 10000;
|
|
12
|
+
step: 10;
|
|
13
|
+
}>;
|
|
14
|
+
/** Betrag in Cent: 0,01 € bis 1.000.000,00 €. */
|
|
15
|
+
export declare const DISCOUNT_PRESET_AMOUNT_CENTS: Readonly<{
|
|
16
|
+
min: 1;
|
|
17
|
+
max: 100000000;
|
|
18
|
+
}>;
|
|
19
|
+
/** Wirksame Vorlagen: die gespeicherten (auch leer), sonst die Prozent-Chips als namenlose Prozent-Vorlagen. */
|
|
20
|
+
export declare function posDiscountPresets(business: Readonly<Pick<Partial<PosBusinessSettings>, 'discountPresets' | 'discountChips'>> | null | undefined): PosDiscountPreset[];
|
|
21
|
+
/**
|
|
22
|
+
* Die Prozent-Chips, die der Server aus den Vorlagen nach `discountChips` spiegelt (fuer aeltere Kassen):
|
|
23
|
+
* Prozent-Vorlagen in ihrer Reihenfolge, gleiche Werte nur einmal, Betrag-Vorlagen fallen weg.
|
|
24
|
+
*/
|
|
25
|
+
export declare function discountChipsFromPresets(presets: readonly PosDiscountPreset[] | null | undefined): number[];
|
|
26
|
+
/** Text auf dem Chip: `Mitarbeiter-Rabatt 20 %`, `Stammkunde 5,00 €`; ohne Namen nur der Wert (`10 %`). */
|
|
27
|
+
export declare function discountPresetChipText(preset: Readonly<PosDiscountPreset>): string;
|
|
28
|
+
/** Warum eine Vorlage abgelehnt wird; je Grund ein Satz im Katalog ([DISCOUNT_PRESET_MESSAGES]). */
|
|
29
|
+
export type DiscountPresetReason = 'list' | 'entry' | 'name' | 'duplicate' | 'kind' | 'percent' | 'amount' | 'unknown_field';
|
|
30
|
+
/** Grund -> Satz (Katalog `discount_preset.*`). */
|
|
31
|
+
export declare const DISCOUNT_PRESET_MESSAGES: {
|
|
32
|
+
readonly list: "discount_preset.list";
|
|
33
|
+
readonly entry: "discount_preset.entry";
|
|
34
|
+
readonly name: "discount_preset.name";
|
|
35
|
+
readonly duplicate: "discount_preset.duplicate";
|
|
36
|
+
readonly kind: "discount_preset.kind";
|
|
37
|
+
readonly percent: "discount_preset.percent";
|
|
38
|
+
readonly amount: "discount_preset.amount";
|
|
39
|
+
readonly unknown_field: "discount_preset.unknown_field";
|
|
40
|
+
};
|
|
41
|
+
/** Ein Fehler der Pruefung: `index` die Vorlage (`null` = die Liste), `field` das Feld (`null` = die ganze Vorlage). */
|
|
42
|
+
export interface DiscountPresetError {
|
|
43
|
+
index: number | null;
|
|
44
|
+
field: string | null;
|
|
45
|
+
reason: DiscountPresetReason;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
48
|
+
export type DiscountPresetsCheck = {
|
|
49
|
+
ok: true;
|
|
50
|
+
value: PosDiscountPreset[];
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
code: typeof INVALID_DISCOUNT_PRESET;
|
|
54
|
+
errors: DiscountPresetError[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Prueft die Liste der Vorlagen vor dem Schreiben, mit denselben Regeln wie der Server: hoechstens 5, Name 1 bis 24
|
|
58
|
+
* Zeichen nach dem Trimmen ohne Steuerzeichen, eindeutig ohne Ruecksicht auf Gross und Klein, Art `percent`/`amount`
|
|
59
|
+
* mit genau dem passenden Wertfeld (Prozent 0,1 bis 100 in Schritten von 0,1, Betrag 0,01 bis 1.000.000 €).
|
|
60
|
+
* `value` ist die normalisierte Liste (Name getrimmt). Der Server antwortet bei einem Fehler mit
|
|
61
|
+
* [INVALID_DISCOUNT_PRESET].
|
|
62
|
+
*/
|
|
63
|
+
export declare function checkDiscountPresets(list: unknown): DiscountPresetsCheck;
|
|
64
|
+
/** Eine Zeile des Rabatte-Blocks auf Z- und X-Bon: `label` und der Betrag als Abzug (negativ). */
|
|
65
|
+
export interface DiscountBlockLine {
|
|
66
|
+
label: string;
|
|
67
|
+
cents: number;
|
|
68
|
+
}
|
|
69
|
+
/** Ein Rabatt je Name aus dem Laufstand bzw. den Bon-Daten: `cents` gewaehrt (positiv), `count` Belege. */
|
|
70
|
+
export interface DiscountTotal {
|
|
71
|
+
name: string;
|
|
72
|
+
cents: number;
|
|
73
|
+
count: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Zeilen des Rabatte-Blocks auf Z-Bon und Zwischenbericht: je Name `<Name> (n×)` mit dem Abzug, ab zwei Eintraegen
|
|
77
|
+
* zusaetzlich `Rabatte gesamt`. Ein leerer Name heisst „Rabatt“. Ein voll stornierter Name (Betrag 0) entfaellt wie in der Liste des Servers. Ohne Rabatte leer (kein Block).
|
|
78
|
+
*/
|
|
79
|
+
export declare function discountBlockLines(discounts: readonly DiscountTotal[] | null | undefined): DiscountBlockLine[];
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DISCOUNT_PRESET_MESSAGES = exports.DISCOUNT_PRESET_AMOUNT_CENTS = exports.DISCOUNT_PRESET_PERCENT_BP = exports.DISCOUNT_PRESET_NAME_MAX = exports.DISCOUNT_PRESETS_MAX = exports.INVALID_DISCOUNT_PRESET = void 0;
|
|
4
|
+
exports.posDiscountPresets = posDiscountPresets;
|
|
5
|
+
exports.discountChipsFromPresets = discountChipsFromPresets;
|
|
6
|
+
exports.discountPresetChipText = discountPresetChipText;
|
|
7
|
+
exports.checkDiscountPresets = checkDiscountPresets;
|
|
8
|
+
exports.discountBlockLines = discountBlockLines;
|
|
9
|
+
const texte_js_1 = require("./texte.js");
|
|
10
|
+
const settings_js_1 = require("./settings.js");
|
|
11
|
+
/*
|
|
12
|
+
* Rabatt-Vorlagen der Kasse (benannte Rabatt-Chips): wirksame Liste, Chip-Text, Spiegelung nach `discountChips`,
|
|
13
|
+
* Pruefung und Bon-Block. Zwilling von functions-kasse/rabatt-vorlagen-core.js; der Vertrag sind die Pruefaelle
|
|
14
|
+
* fixtures/discount-preset-cases.json (byte-gleich mit dem Backend).
|
|
15
|
+
*/
|
|
16
|
+
/** Fehlercode, den der Server bei einer ungueltigen Vorlage sendet. */
|
|
17
|
+
exports.INVALID_DISCOUNT_PRESET = 'invalid_discount_preset';
|
|
18
|
+
/** Hoechstzahl der Vorlagen. */
|
|
19
|
+
exports.DISCOUNT_PRESETS_MAX = 5;
|
|
20
|
+
/** Laenge des Namens in Zeichen (nach dem Trimmen). */
|
|
21
|
+
exports.DISCOUNT_PRESET_NAME_MAX = 24;
|
|
22
|
+
/** Prozent in Basispunkten: 0,1 % bis 100 % in Schritten von 0,1 %. */
|
|
23
|
+
exports.DISCOUNT_PRESET_PERCENT_BP = Object.freeze({ min: 10, max: 10000, step: 10 });
|
|
24
|
+
/** Betrag in Cent: 0,01 € bis 1.000.000,00 €. */
|
|
25
|
+
exports.DISCOUNT_PRESET_AMOUNT_CENTS = Object.freeze({ min: 1, max: 100000000 });
|
|
26
|
+
/** Wirksame Vorlagen: die gespeicherten (auch leer), sonst die Prozent-Chips als namenlose Prozent-Vorlagen. */
|
|
27
|
+
function posDiscountPresets(business) {
|
|
28
|
+
const vorlagen = business?.discountPresets;
|
|
29
|
+
if (Array.isArray(vorlagen))
|
|
30
|
+
return vorlagen.map((v) => ({ ...v }));
|
|
31
|
+
const raus = [];
|
|
32
|
+
const chips = business?.discountChips;
|
|
33
|
+
for (const p of Array.isArray(chips) ? chips : []) {
|
|
34
|
+
const bp = typeof p === 'number' ? Math.round(p * 100) : NaN;
|
|
35
|
+
if (Number.isFinite(bp) && bp >= exports.DISCOUNT_PRESET_PERCENT_BP.min && bp <= exports.DISCOUNT_PRESET_PERCENT_BP.max) {
|
|
36
|
+
raus.push({ name: '', kind: 'percent', percentBp: bp });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return raus;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Die Prozent-Chips, die der Server aus den Vorlagen nach `discountChips` spiegelt (fuer aeltere Kassen):
|
|
43
|
+
* Prozent-Vorlagen in ihrer Reihenfolge, gleiche Werte nur einmal, Betrag-Vorlagen fallen weg.
|
|
44
|
+
*/
|
|
45
|
+
function discountChipsFromPresets(presets) {
|
|
46
|
+
const raus = [];
|
|
47
|
+
for (const v of presets ?? []) {
|
|
48
|
+
if (!v || v.kind !== 'percent' || !Number.isInteger(v.percentBp))
|
|
49
|
+
continue;
|
|
50
|
+
const p = v.percentBp / 100;
|
|
51
|
+
if (!raus.includes(p))
|
|
52
|
+
raus.push(p);
|
|
53
|
+
}
|
|
54
|
+
return raus;
|
|
55
|
+
}
|
|
56
|
+
/** Prozent aus Basispunkten als Text mit Komma, ohne ueberfluessige Stellen: `1000` -> `10`, `1050` -> `10,5`. */
|
|
57
|
+
function prozentText(bp) {
|
|
58
|
+
const ganz = Math.trunc(bp / 100);
|
|
59
|
+
const rest = String(bp % 100).padStart(2, '0').replace(/0+$/, '');
|
|
60
|
+
return rest === '' ? String(ganz) : `${ganz},${rest}`;
|
|
61
|
+
}
|
|
62
|
+
/** Euro aus Cent mit Tausenderpunkt: `123456` -> `1.234,56 €`. */
|
|
63
|
+
function euroText(cents) {
|
|
64
|
+
const ganz = String(Math.trunc(cents / 100)).replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
65
|
+
return `${ganz},${String(cents % 100).padStart(2, '0')} €`;
|
|
66
|
+
}
|
|
67
|
+
/** Text auf dem Chip: `Mitarbeiter-Rabatt 20 %`, `Stammkunde 5,00 €`; ohne Namen nur der Wert (`10 %`). */
|
|
68
|
+
function discountPresetChipText(preset) {
|
|
69
|
+
const wert = preset.kind === 'amount' ? euroText(preset.amountCents ?? 0) : `${prozentText(preset.percentBp ?? 0)} %`;
|
|
70
|
+
return preset.name ? `${preset.name} ${wert}` : wert;
|
|
71
|
+
}
|
|
72
|
+
/** Grund -> Satz (Katalog `discount_preset.*`). */
|
|
73
|
+
exports.DISCOUNT_PRESET_MESSAGES = {
|
|
74
|
+
list: 'discount_preset.list',
|
|
75
|
+
entry: 'discount_preset.entry',
|
|
76
|
+
name: 'discount_preset.name',
|
|
77
|
+
duplicate: 'discount_preset.duplicate',
|
|
78
|
+
kind: 'discount_preset.kind',
|
|
79
|
+
percent: 'discount_preset.percent',
|
|
80
|
+
amount: 'discount_preset.amount',
|
|
81
|
+
unknown_field: 'discount_preset.unknown_field',
|
|
82
|
+
};
|
|
83
|
+
// Steuer- und Formatzeichen (Zeilenumbruch, Null, Zero-Width, Richtungswechsel): nie in einem Bon-Text.
|
|
84
|
+
const STEUERZEICHEN = /[\p{Cc}\p{Cf}\u2028\u2029]/u;
|
|
85
|
+
const WERTFELD = { percent: 'percentBp', amount: 'amountCents' };
|
|
86
|
+
const istObjekt = (x) => x !== null && typeof x === 'object' && !Array.isArray(x);
|
|
87
|
+
function fehler(index, field, reason) {
|
|
88
|
+
return { index, field, reason, message: (0, texte_js_1.messageText)(exports.DISCOUNT_PRESET_MESSAGES[reason]) };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Prueft die Liste der Vorlagen vor dem Schreiben, mit denselben Regeln wie der Server: hoechstens 5, Name 1 bis 24
|
|
92
|
+
* Zeichen nach dem Trimmen ohne Steuerzeichen, eindeutig ohne Ruecksicht auf Gross und Klein, Art `percent`/`amount`
|
|
93
|
+
* mit genau dem passenden Wertfeld (Prozent 0,1 bis 100 in Schritten von 0,1, Betrag 0,01 bis 1.000.000 €).
|
|
94
|
+
* `value` ist die normalisierte Liste (Name getrimmt). Der Server antwortet bei einem Fehler mit
|
|
95
|
+
* [INVALID_DISCOUNT_PRESET].
|
|
96
|
+
*/
|
|
97
|
+
function checkDiscountPresets(list) {
|
|
98
|
+
if (!Array.isArray(list) || list.length > exports.DISCOUNT_PRESETS_MAX) {
|
|
99
|
+
return { ok: false, code: exports.INVALID_DISCOUNT_PRESET, errors: [fehler(null, null, 'list')] };
|
|
100
|
+
}
|
|
101
|
+
const errors = [];
|
|
102
|
+
const value = [];
|
|
103
|
+
const namen = new Set();
|
|
104
|
+
list.forEach((v, index) => {
|
|
105
|
+
if (!istObjekt(v)) {
|
|
106
|
+
errors.push(fehler(index, null, 'entry'));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const vorher = errors.length;
|
|
110
|
+
const name = typeof v.name === 'string' ? v.name.trim() : null;
|
|
111
|
+
if (name === null || name.length < 1 || [...name].length > exports.DISCOUNT_PRESET_NAME_MAX || STEUERZEICHEN.test(name))
|
|
112
|
+
errors.push(fehler(index, 'name', 'name'));
|
|
113
|
+
else if (namen.has(name.toLocaleLowerCase('de')))
|
|
114
|
+
errors.push(fehler(index, 'name', 'duplicate'));
|
|
115
|
+
else
|
|
116
|
+
namen.add(name.toLocaleLowerCase('de'));
|
|
117
|
+
const kind = settings_js_1.DISCOUNT_PRESET_KIND.includes(v.kind) ? v.kind : null;
|
|
118
|
+
if (!kind)
|
|
119
|
+
errors.push(fehler(index, 'kind', 'kind'));
|
|
120
|
+
for (const k of Object.keys(v)) {
|
|
121
|
+
if (k === 'name' || k === 'kind')
|
|
122
|
+
continue;
|
|
123
|
+
if (k !== 'percentBp' && k !== 'amountCents')
|
|
124
|
+
errors.push(fehler(index, k, 'unknown_field'));
|
|
125
|
+
else if (kind && WERTFELD[kind] !== k)
|
|
126
|
+
errors.push(fehler(index, k, 'unknown_field'));
|
|
127
|
+
}
|
|
128
|
+
if (kind === 'percent') {
|
|
129
|
+
const p = v.percentBp;
|
|
130
|
+
const g = exports.DISCOUNT_PRESET_PERCENT_BP;
|
|
131
|
+
if (!Number.isInteger(p) || p < g.min || p > g.max || p % g.step !== 0)
|
|
132
|
+
errors.push(fehler(index, 'percentBp', 'percent'));
|
|
133
|
+
}
|
|
134
|
+
if (kind === 'amount') {
|
|
135
|
+
const c = v.amountCents;
|
|
136
|
+
const g = exports.DISCOUNT_PRESET_AMOUNT_CENTS;
|
|
137
|
+
if (!Number.isInteger(c) || c < g.min || c > g.max)
|
|
138
|
+
errors.push(fehler(index, 'amountCents', 'amount'));
|
|
139
|
+
}
|
|
140
|
+
if (errors.length === vorher && kind) {
|
|
141
|
+
value.push({ name: name, kind, [WERTFELD[kind]]: v[WERTFELD[kind]] });
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return errors.length ? { ok: false, code: exports.INVALID_DISCOUNT_PRESET, errors } : { ok: true, value };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Zeilen des Rabatte-Blocks auf Z-Bon und Zwischenbericht: je Name `<Name> (n×)` mit dem Abzug, ab zwei Eintraegen
|
|
148
|
+
* zusaetzlich `Rabatte gesamt`. Ein leerer Name heisst „Rabatt“. Ein voll stornierter Name (Betrag 0) entfaellt wie in der Liste des Servers. Ohne Rabatte leer (kein Block).
|
|
149
|
+
*/
|
|
150
|
+
function discountBlockLines(discounts) {
|
|
151
|
+
const liste = (discounts ?? []).filter((r) => r && Number.isSafeInteger(r.cents) && Number.isSafeInteger(r.count) && r.cents !== 0);
|
|
152
|
+
const zeilen = liste.map((r) => ({ label: (0, texte_js_1.labelText)('shift_receipt.discount_line', { name: r.name || (0, texte_js_1.labelText)('shift_receipt.discount_unnamed'), count: r.count }), cents: -r.cents }));
|
|
153
|
+
if (zeilen.length > 1)
|
|
154
|
+
zeilen.push({ label: (0, texte_js_1.labelText)('shift_receipt.discounts_total'), cents: -liste.reduce((x, r) => x + r.cents, 0) });
|
|
155
|
+
return zeilen;
|
|
156
|
+
}
|
|
@@ -149,8 +149,14 @@ function laufstand(ort, w) {
|
|
|
149
149
|
raus.ownerTips = liste(ort, o, 'ownerTips', inhaberTrinkgeld);
|
|
150
150
|
if (o.unassignedTipCents !== undefined && o.unassignedTipCents !== null)
|
|
151
151
|
raus.unassignedTipCents = ganzzahl(ort, o, 'unassignedTipCents');
|
|
152
|
+
if (o.discounts !== undefined && o.discounts !== null)
|
|
153
|
+
raus.discounts = liste(ort, o, 'discounts', rabatt);
|
|
152
154
|
return raus;
|
|
153
155
|
}
|
|
156
|
+
function rabatt(ort, w) {
|
|
157
|
+
const o = pflichtObjekt(ort, w);
|
|
158
|
+
return { name: typeof o.name === 'string' ? o.name : '', cents: ganzzahl(ort, o, 'cents'), count: ganzzahl(ort, o, 'count') };
|
|
159
|
+
}
|
|
154
160
|
function inhaberTrinkgeld(ort, w) {
|
|
155
161
|
const o = pflichtObjekt(ort, w);
|
|
156
162
|
return { registerUserId: kennung(ort, o, 'registerUserId'), name: text(o.name), cents: ganzzahl(ort, o, 'cents') };
|
|
@@ -373,6 +379,8 @@ function schichtBon(ort, w) {
|
|
|
373
379
|
// Ablauf der Kasse: nur, wenn der Server sie sendet (die Bons davor tragen sie nicht).
|
|
374
380
|
wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
|
|
375
381
|
wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
|
|
382
|
+
// Nur Anzeige: gewaehrte Rabatte je Name; der Server sendet sie erst ab dem ersten Rabatt.
|
|
383
|
+
wennWert(r, o, 'discounts', () => liste(ort, o, 'discounts', rabatt));
|
|
376
384
|
wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
|
|
377
385
|
wennDa(r, o, 'countedBeforePayoutCents', () => ganzzahlOderNull(ort, o, 'countedBeforePayoutCents'));
|
|
378
386
|
wennDa(r, o, 'countedBeforePayoutDenominations', () => stueckelung(ort, o, 'countedBeforePayoutDenominations'));
|
|
@@ -158,6 +158,19 @@ export interface ShiftRunningTotals {
|
|
|
158
158
|
ownerTips?: ShiftOwnerTip[];
|
|
159
159
|
/** Trinkgeld ohne angemeldeten Empfänger in Cent (nur Anzeige, 1.28.0); fehlt = 0. */
|
|
160
160
|
unassignedTipCents?: number;
|
|
161
|
+
/**
|
|
162
|
+
* Gewaehrte Rabatte je Name (nur Anzeige, nie im Soll): `cents` gewaehrt (positiv), `count` Belege mit diesem
|
|
163
|
+
* Namen, ein Storno nimmt beides zurueck. Der Server sendet es erst ab dem ersten Rabatt (fehlt = keiner);
|
|
164
|
+
* auf dem Z-Bon steht es als Block ([discountBlockLines]).
|
|
165
|
+
*/
|
|
166
|
+
discounts?: ShiftDiscount[];
|
|
167
|
+
}
|
|
168
|
+
/** Ein Eintrag von [ShiftRunningTotals.discounts] bzw. [ShiftSummaryReceipt.discounts]. */
|
|
169
|
+
export interface ShiftDiscount {
|
|
170
|
+
/** Name der Rabattzeile am Beleg (`''` = unbenannt, „Rabatt“). */
|
|
171
|
+
name: string;
|
|
172
|
+
cents: number;
|
|
173
|
+
count: number;
|
|
161
174
|
}
|
|
162
175
|
/** Ein Eintrag von [ShiftRunningTotals.ownerTips]: Trinkgeld, das als Umsatz erfasst ist. */
|
|
163
176
|
export interface ShiftOwnerTip {
|
|
@@ -390,6 +403,8 @@ export interface ShiftSummaryReceipt extends ShiftReceiptHeader {
|
|
|
390
403
|
differenceCents: number | null;
|
|
391
404
|
comment: string | null;
|
|
392
405
|
openingsWithoutSale: number;
|
|
406
|
+
/** Gewaehrte Rabatte je Name; fehlt, wenn es keine gab (der Bon bleibt dann wie bisher). */
|
|
407
|
+
discounts?: ShiftDiscount[];
|
|
393
408
|
/** Entnommen bzw. eingelegt nach dem Zaehlen; fehlt, wenn kein Geld bewegt wurde. */
|
|
394
409
|
afterCount?: AfterCount;
|
|
395
410
|
/**
|