@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const ARTICLE_EXTERNAL_VOUCHER_TYPES = Object.freeze(['multi_purpose', 'single_purpose']);
|
|
2
|
+
/** Fehlercode beim Speichern eines Artikels, intern und unter `/v3` gleich. */
|
|
3
|
+
export const ARTICLE_EXTERNAL_VOUCHER_INVALID = 'article_external_voucher_invalid';
|
|
4
|
+
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
5
|
+
export const EXTERNAL_VOUCHER_ARTICLE_REASONS = Object.freeze([
|
|
6
|
+
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'rate_required', 'invalid_rate', 'price_required',
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* Saetze, mit denen ein Einzweckgutschein verkauft werden kann (Prozent wie
|
|
10
|
+
* `PosArticle.vatRate`; 0 = befreit verkauft): die Saetze der Kasse, Backend
|
|
11
|
+
* `article-groups-core.STEUERSAETZE`, dieselben wie [EXTERNAL_VOUCHER_VAT_RATES_BP] / 100.
|
|
12
|
+
*/
|
|
13
|
+
export const ARTICLE_EXTERNAL_VOUCHER_VAT_RATES = Object.freeze([20, 13, 10, 4.9, 0, 19]);
|
|
14
|
+
/** Ist der Wert eine Art fremder Gutschein? */
|
|
15
|
+
export function isArticleExternalVoucher(value) {
|
|
16
|
+
return ARTICLE_EXTERNAL_VOUCHER_TYPES.includes(value);
|
|
17
|
+
}
|
|
18
|
+
/** Form des Werts beim Speichern: `null` heisst entfernen und ist gueltig. Zwilling von `pruefeWert`. */
|
|
19
|
+
export function checkExternalVoucherValue(value) {
|
|
20
|
+
return value === null || isArticleExternalVoucher(value) ? null : 'invalid_type';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Regeln am wirksamen Artikelstand (Bestand + Aenderung), Zwilling von
|
|
24
|
+
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
25
|
+
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
26
|
+
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
27
|
+
* Referenz oder Mengenabfrage (die Kasse fragt die Nummer selbst und bucht
|
|
28
|
+
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
29
|
+
*/
|
|
30
|
+
export function checkExternalVoucherArticle(a) {
|
|
31
|
+
if (a.externalVoucher == null)
|
|
32
|
+
return null;
|
|
33
|
+
if (!isArticleExternalVoucher(a.externalVoucher))
|
|
34
|
+
return 'invalid_type';
|
|
35
|
+
if (a.serviceVoucher === true)
|
|
36
|
+
return 'service_voucher';
|
|
37
|
+
if (Array.isArray(a.addOns) && a.addOns.length > 0)
|
|
38
|
+
return 'add_ons';
|
|
39
|
+
if (a.stockTracked === true)
|
|
40
|
+
return 'stock_tracked';
|
|
41
|
+
if (a.reference)
|
|
42
|
+
return 'reference';
|
|
43
|
+
if (a.askQuantity === true)
|
|
44
|
+
return 'asks_quantity';
|
|
45
|
+
if (a.externalVoucher === 'single_purpose' && !(typeof a.vatRate === 'number' && Number.isFinite(a.vatRate)))
|
|
46
|
+
return 'rate_required';
|
|
47
|
+
if (a.externalVoucher === 'single_purpose' && !ARTICLE_EXTERNAL_VOUCHER_VAT_RATES.includes(a.vatRate))
|
|
48
|
+
return 'invalid_rate';
|
|
49
|
+
if (a.askPrice !== true && !(typeof a.unitPriceCents === 'number' && Number.isInteger(a.unitPriceCents) && a.unitPriceCents >= 1))
|
|
50
|
+
return 'price_required';
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Darf die Kachel verkaufen? `null` = ja (auch fuer jeden Artikel ohne
|
|
55
|
+
* `externalVoucher`). Gesperrt bei Freigabe `off` (oder ohne Angabe) und bei
|
|
56
|
+
* Einzweck ohne `all` -- dieselbe Regel, mit der der Server den Beleg abweist
|
|
57
|
+
* (`external_voucher_not_enabled`, `external_voucher_type_not_enabled`).
|
|
58
|
+
*/
|
|
59
|
+
export function externalVoucherTileBlock(article, externalVouchers) {
|
|
60
|
+
if (article.externalVoucher == null)
|
|
61
|
+
return null;
|
|
62
|
+
if (externalVouchers !== 'multi_purpose' && externalVouchers !== 'all')
|
|
63
|
+
return 'not_enabled';
|
|
64
|
+
if (article.externalVoucher === 'single_purpose' && externalVouchers !== 'all')
|
|
65
|
+
return 'type_not_enabled';
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
@@ -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 {
|
|
@@ -13,10 +13,12 @@ export const VOUCHER_TYPE_KINDS = Object.freeze(['multi_purpose', 'single_purpos
|
|
|
13
13
|
export const VOUCHER_AMOUNT_MODES = Object.freeze(['free', 'fixed']);
|
|
14
14
|
/** Gueltigkeit einer Sorte: unbefristet oder N Jahre (das Muster der Sorte, nicht das eines Gutscheins). */
|
|
15
15
|
export const VOUCHER_TYPE_VALIDITY_PATTERNS = Object.freeze(['unlimited', 'years']);
|
|
16
|
+
export const EXTERNAL_VOUCHERS = Object.freeze(['off', 'multi_purpose', 'all']);
|
|
16
17
|
/** Ohne Block `vouchers` (alter Server, Konto ohne Schalter): Verkaufen ist aus. */
|
|
17
18
|
export const VOUCHER_SETTINGS_DEFAULTS = Object.freeze({
|
|
18
19
|
sale: false, valueVoucherType: null, vatRateBp: null,
|
|
19
20
|
typeSale: false, types: Object.freeze([]), serviceArticles: false, labelDefault: null,
|
|
21
|
+
externalVouchers: 'off',
|
|
20
22
|
});
|
|
21
23
|
/**
|
|
22
24
|
* Block `vouchers` einer Einstellungs-Antwort, geschlossen im Zweifel: ist
|
|
@@ -77,6 +79,8 @@ export function posVoucherSettingsFromWire(block) {
|
|
|
77
79
|
serviceArticles: leistung,
|
|
78
80
|
labelDefault: vorlageVomDraht(b['labelDefault']),
|
|
79
81
|
...rueckgabeSorteVomDraht(b['returnType']),
|
|
82
|
+
// Unbekannt oder fehlend: aus (schliesst nur den Fremdgutschein, nie den Block).
|
|
83
|
+
externalVouchers: EXTERNAL_VOUCHERS.includes(b['externalVouchers']) ? b['externalVouchers'] : 'off',
|
|
80
84
|
};
|
|
81
85
|
}
|
|
82
86
|
/** `vouchers.returnType`, nur stimmig (Kennung wie eine Sorte, Name als Text); sonst fehlt es. */
|
package/dist/esm/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/esm/pos/index.js
CHANGED
|
@@ -6,12 +6,15 @@
|
|
|
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 { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, 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, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
|
|
9
|
+
export { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, 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, DISCOUNT_PRESET_KIND, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
|
|
10
10
|
// Die Enums als Laufzeitlisten, benannt nach ihrem Feld.
|
|
11
|
-
THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, CART_WIDTH, 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';
|
|
11
|
+
THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, CART_WIDTH, 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';
|
|
12
12
|
export { fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
13
13
|
export { REFERENCE_MODES, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
|
|
14
14
|
export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
|
|
15
|
+
export { ARTICLE_EXTERNAL_VOUCHER_TYPES, ARTICLE_EXTERNAL_VOUCHER_INVALID, ARTICLE_EXTERNAL_VOUCHER_VAT_RATES, EXTERNAL_VOUCHER_ARTICLE_REASONS, isArticleExternalVoucher, checkExternalVoucherValue, checkExternalVoucherArticle, externalVoucherTileBlock, } from './fremdgutschein-artikel.js';
|
|
16
|
+
// Form-Erkennung eigener Codes im Gutschein-Feld (Nachfrage statt Abweisung); dieselbe Funktion wie an der Wurzel.
|
|
17
|
+
export { ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES } from '../models/voucher.js';
|
|
15
18
|
export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, } from './client.js';
|
|
16
19
|
export { POS_ERROR_CODES, isPosErrorCode, posErrorCode, isPosError, posFieldErrors, } from './errors.js';
|
|
17
20
|
export { distributeDiscount } from '../receipt/discount.js';
|
|
@@ -20,6 +23,7 @@ export { distributeDiscount } from '../receipt/discount.js';
|
|
|
20
23
|
export { cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf } from '../register/pairing.js';
|
|
21
24
|
export { PRINT_JOB_STATUSES, PRINT_JOB_SOURCES, isPrintJobFinished, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
22
25
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
26
|
+
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, } from './rabatt-vorlagen.js';
|
|
23
27
|
// Prüfung (DEP) an der Kasse: Ordner auf dem USB-Stick (gleich in Web-Kasse und Kassen-App).
|
|
24
28
|
export { depFolderName } from './dep.js';
|
|
25
29
|
// Prüfung an der Kasse: Kasseninfo für den Prüfer, am Bildschirm und als Ausdruck (gleich im Dart-Zwilling).
|
|
@@ -29,7 +33,7 @@ export { reportConnectState } from './connect-bestand.js';
|
|
|
29
33
|
export { STOCK_LOCATION_TYPES, listMyStockLocations, listMyStock, setMyCashregisterStockLocation, } from './lager.js';
|
|
30
34
|
export { listMyStocktakes, listMyStocktakeItems, listMyStocktakeCounts, recordMyStocktakeCount, voidMyStocktakeCount, parseQuantityMilli, } from './inventur.js';
|
|
31
35
|
// Gutschein pruefen und Etikett nachdrucken an der Kasse; Gutschein-Sorten (Stufe 4b, 1.17.0).
|
|
32
|
-
export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, } from './gutschein.js';
|
|
36
|
+
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, } from './gutschein.js';
|
|
33
37
|
// Schicht, Kassenstand und Lade-Protokoll (1.9.0): Aufrufe, Kataloge, Helfer, Bons.
|
|
34
38
|
export { getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, recordMyShiftCount, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, } from './schicht.js';
|
|
35
39
|
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, EXPECTED_PART_KEYS, DIFFERENCE_PART_TYPES, } from './schicht-typen.js';
|
|
@@ -39,5 +43,5 @@ export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS } from '../models/receipt-
|
|
|
39
43
|
// Rueckgabe-Wahl beim Storno (Kassen-Dialog); dieselbe Liste wie an der Wurzel.
|
|
40
44
|
export { RETURN_DISPOSITIONS, isReturnDisposition } from '../models/cancellation.js';
|
|
41
45
|
// Was die Kasse selbst sagt: ein Katalog fuer Browser-Kasse und App.
|
|
42
|
-
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, } from './texte.js';
|
|
46
|
+
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, } from './texte.js';
|
|
43
47
|
export { roundUpSuggestions } from './aufrunden.js';
|
|
@@ -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,148 @@
|
|
|
1
|
+
import { messageText, labelText } from './texte.js';
|
|
2
|
+
import { DISCOUNT_PRESET_KIND } from './settings.js';
|
|
3
|
+
/*
|
|
4
|
+
* Rabatt-Vorlagen der Kasse (benannte Rabatt-Chips): wirksame Liste, Chip-Text, Spiegelung nach `discountChips`,
|
|
5
|
+
* Pruefung und Bon-Block. Zwilling von functions-kasse/rabatt-vorlagen-core.js; der Vertrag sind die Pruefaelle
|
|
6
|
+
* fixtures/discount-preset-cases.json (byte-gleich mit dem Backend).
|
|
7
|
+
*/
|
|
8
|
+
/** Fehlercode, den der Server bei einer ungueltigen Vorlage sendet. */
|
|
9
|
+
export const INVALID_DISCOUNT_PRESET = 'invalid_discount_preset';
|
|
10
|
+
/** Hoechstzahl der Vorlagen. */
|
|
11
|
+
export const DISCOUNT_PRESETS_MAX = 5;
|
|
12
|
+
/** Laenge des Namens in Zeichen (nach dem Trimmen). */
|
|
13
|
+
export const DISCOUNT_PRESET_NAME_MAX = 24;
|
|
14
|
+
/** Prozent in Basispunkten: 0,1 % bis 100 % in Schritten von 0,1 %. */
|
|
15
|
+
export const DISCOUNT_PRESET_PERCENT_BP = Object.freeze({ min: 10, max: 10000, step: 10 });
|
|
16
|
+
/** Betrag in Cent: 0,01 € bis 1.000.000,00 €. */
|
|
17
|
+
export const DISCOUNT_PRESET_AMOUNT_CENTS = Object.freeze({ min: 1, max: 100000000 });
|
|
18
|
+
/** Wirksame Vorlagen: die gespeicherten (auch leer), sonst die Prozent-Chips als namenlose Prozent-Vorlagen. */
|
|
19
|
+
export function posDiscountPresets(business) {
|
|
20
|
+
const vorlagen = business?.discountPresets;
|
|
21
|
+
if (Array.isArray(vorlagen))
|
|
22
|
+
return vorlagen.map((v) => ({ ...v }));
|
|
23
|
+
const raus = [];
|
|
24
|
+
const chips = business?.discountChips;
|
|
25
|
+
for (const p of Array.isArray(chips) ? chips : []) {
|
|
26
|
+
const bp = typeof p === 'number' ? Math.round(p * 100) : NaN;
|
|
27
|
+
if (Number.isFinite(bp) && bp >= DISCOUNT_PRESET_PERCENT_BP.min && bp <= DISCOUNT_PRESET_PERCENT_BP.max) {
|
|
28
|
+
raus.push({ name: '', kind: 'percent', percentBp: bp });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return raus;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Die Prozent-Chips, die der Server aus den Vorlagen nach `discountChips` spiegelt (fuer aeltere Kassen):
|
|
35
|
+
* Prozent-Vorlagen in ihrer Reihenfolge, gleiche Werte nur einmal, Betrag-Vorlagen fallen weg.
|
|
36
|
+
*/
|
|
37
|
+
export function discountChipsFromPresets(presets) {
|
|
38
|
+
const raus = [];
|
|
39
|
+
for (const v of presets ?? []) {
|
|
40
|
+
if (!v || v.kind !== 'percent' || !Number.isInteger(v.percentBp))
|
|
41
|
+
continue;
|
|
42
|
+
const p = v.percentBp / 100;
|
|
43
|
+
if (!raus.includes(p))
|
|
44
|
+
raus.push(p);
|
|
45
|
+
}
|
|
46
|
+
return raus;
|
|
47
|
+
}
|
|
48
|
+
/** Prozent aus Basispunkten als Text mit Komma, ohne ueberfluessige Stellen: `1000` -> `10`, `1050` -> `10,5`. */
|
|
49
|
+
function prozentText(bp) {
|
|
50
|
+
const ganz = Math.trunc(bp / 100);
|
|
51
|
+
const rest = String(bp % 100).padStart(2, '0').replace(/0+$/, '');
|
|
52
|
+
return rest === '' ? String(ganz) : `${ganz},${rest}`;
|
|
53
|
+
}
|
|
54
|
+
/** Euro aus Cent mit Tausenderpunkt: `123456` -> `1.234,56 €`. */
|
|
55
|
+
function euroText(cents) {
|
|
56
|
+
const ganz = String(Math.trunc(cents / 100)).replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
57
|
+
return `${ganz},${String(cents % 100).padStart(2, '0')} €`;
|
|
58
|
+
}
|
|
59
|
+
/** Text auf dem Chip: `Mitarbeiter-Rabatt 20 %`, `Stammkunde 5,00 €`; ohne Namen nur der Wert (`10 %`). */
|
|
60
|
+
export function discountPresetChipText(preset) {
|
|
61
|
+
const wert = preset.kind === 'amount' ? euroText(preset.amountCents ?? 0) : `${prozentText(preset.percentBp ?? 0)} %`;
|
|
62
|
+
return preset.name ? `${preset.name} ${wert}` : wert;
|
|
63
|
+
}
|
|
64
|
+
/** Grund -> Satz (Katalog `discount_preset.*`). */
|
|
65
|
+
export const DISCOUNT_PRESET_MESSAGES = {
|
|
66
|
+
list: 'discount_preset.list',
|
|
67
|
+
entry: 'discount_preset.entry',
|
|
68
|
+
name: 'discount_preset.name',
|
|
69
|
+
duplicate: 'discount_preset.duplicate',
|
|
70
|
+
kind: 'discount_preset.kind',
|
|
71
|
+
percent: 'discount_preset.percent',
|
|
72
|
+
amount: 'discount_preset.amount',
|
|
73
|
+
unknown_field: 'discount_preset.unknown_field',
|
|
74
|
+
};
|
|
75
|
+
// Steuer- und Formatzeichen (Zeilenumbruch, Null, Zero-Width, Richtungswechsel): nie in einem Bon-Text.
|
|
76
|
+
const STEUERZEICHEN = /[\p{Cc}\p{Cf}\u2028\u2029]/u;
|
|
77
|
+
const WERTFELD = { percent: 'percentBp', amount: 'amountCents' };
|
|
78
|
+
const istObjekt = (x) => x !== null && typeof x === 'object' && !Array.isArray(x);
|
|
79
|
+
function fehler(index, field, reason) {
|
|
80
|
+
return { index, field, reason, message: messageText(DISCOUNT_PRESET_MESSAGES[reason]) };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Prueft die Liste der Vorlagen vor dem Schreiben, mit denselben Regeln wie der Server: hoechstens 5, Name 1 bis 24
|
|
84
|
+
* Zeichen nach dem Trimmen ohne Steuerzeichen, eindeutig ohne Ruecksicht auf Gross und Klein, Art `percent`/`amount`
|
|
85
|
+
* mit genau dem passenden Wertfeld (Prozent 0,1 bis 100 in Schritten von 0,1, Betrag 0,01 bis 1.000.000 €).
|
|
86
|
+
* `value` ist die normalisierte Liste (Name getrimmt). Der Server antwortet bei einem Fehler mit
|
|
87
|
+
* [INVALID_DISCOUNT_PRESET].
|
|
88
|
+
*/
|
|
89
|
+
export function checkDiscountPresets(list) {
|
|
90
|
+
if (!Array.isArray(list) || list.length > DISCOUNT_PRESETS_MAX) {
|
|
91
|
+
return { ok: false, code: INVALID_DISCOUNT_PRESET, errors: [fehler(null, null, 'list')] };
|
|
92
|
+
}
|
|
93
|
+
const errors = [];
|
|
94
|
+
const value = [];
|
|
95
|
+
const namen = new Set();
|
|
96
|
+
list.forEach((v, index) => {
|
|
97
|
+
if (!istObjekt(v)) {
|
|
98
|
+
errors.push(fehler(index, null, 'entry'));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const vorher = errors.length;
|
|
102
|
+
const name = typeof v.name === 'string' ? v.name.trim() : null;
|
|
103
|
+
if (name === null || name.length < 1 || [...name].length > DISCOUNT_PRESET_NAME_MAX || STEUERZEICHEN.test(name))
|
|
104
|
+
errors.push(fehler(index, 'name', 'name'));
|
|
105
|
+
else if (namen.has(name.toLocaleLowerCase('de')))
|
|
106
|
+
errors.push(fehler(index, 'name', 'duplicate'));
|
|
107
|
+
else
|
|
108
|
+
namen.add(name.toLocaleLowerCase('de'));
|
|
109
|
+
const kind = DISCOUNT_PRESET_KIND.includes(v.kind) ? v.kind : null;
|
|
110
|
+
if (!kind)
|
|
111
|
+
errors.push(fehler(index, 'kind', 'kind'));
|
|
112
|
+
for (const k of Object.keys(v)) {
|
|
113
|
+
if (k === 'name' || k === 'kind')
|
|
114
|
+
continue;
|
|
115
|
+
if (k !== 'percentBp' && k !== 'amountCents')
|
|
116
|
+
errors.push(fehler(index, k, 'unknown_field'));
|
|
117
|
+
else if (kind && WERTFELD[kind] !== k)
|
|
118
|
+
errors.push(fehler(index, k, 'unknown_field'));
|
|
119
|
+
}
|
|
120
|
+
if (kind === 'percent') {
|
|
121
|
+
const p = v.percentBp;
|
|
122
|
+
const g = DISCOUNT_PRESET_PERCENT_BP;
|
|
123
|
+
if (!Number.isInteger(p) || p < g.min || p > g.max || p % g.step !== 0)
|
|
124
|
+
errors.push(fehler(index, 'percentBp', 'percent'));
|
|
125
|
+
}
|
|
126
|
+
if (kind === 'amount') {
|
|
127
|
+
const c = v.amountCents;
|
|
128
|
+
const g = DISCOUNT_PRESET_AMOUNT_CENTS;
|
|
129
|
+
if (!Number.isInteger(c) || c < g.min || c > g.max)
|
|
130
|
+
errors.push(fehler(index, 'amountCents', 'amount'));
|
|
131
|
+
}
|
|
132
|
+
if (errors.length === vorher && kind) {
|
|
133
|
+
value.push({ name: name, kind, [WERTFELD[kind]]: v[WERTFELD[kind]] });
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return errors.length ? { ok: false, code: INVALID_DISCOUNT_PRESET, errors } : { ok: true, value };
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Zeilen des Rabatte-Blocks auf Z-Bon und Zwischenbericht: je Name `<Name> (n×)` mit dem Abzug, ab zwei Eintraegen
|
|
140
|
+
* 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).
|
|
141
|
+
*/
|
|
142
|
+
export function discountBlockLines(discounts) {
|
|
143
|
+
const liste = (discounts ?? []).filter((r) => r && Number.isSafeInteger(r.cents) && Number.isSafeInteger(r.count) && r.cents !== 0);
|
|
144
|
+
const zeilen = liste.map((r) => ({ label: labelText('shift_receipt.discount_line', { name: r.name || labelText('shift_receipt.discount_unnamed'), count: r.count }), cents: -r.cents }));
|
|
145
|
+
if (zeilen.length > 1)
|
|
146
|
+
zeilen.push({ label: labelText('shift_receipt.discounts_total'), cents: -liste.reduce((x, r) => x + r.cents, 0) });
|
|
147
|
+
return zeilen;
|
|
148
|
+
}
|
|
@@ -135,8 +135,14 @@ function laufstand(ort, w) {
|
|
|
135
135
|
raus.ownerTips = liste(ort, o, 'ownerTips', inhaberTrinkgeld);
|
|
136
136
|
if (o.unassignedTipCents !== undefined && o.unassignedTipCents !== null)
|
|
137
137
|
raus.unassignedTipCents = ganzzahl(ort, o, 'unassignedTipCents');
|
|
138
|
+
if (o.discounts !== undefined && o.discounts !== null)
|
|
139
|
+
raus.discounts = liste(ort, o, 'discounts', rabatt);
|
|
138
140
|
return raus;
|
|
139
141
|
}
|
|
142
|
+
function rabatt(ort, w) {
|
|
143
|
+
const o = pflichtObjekt(ort, w);
|
|
144
|
+
return { name: typeof o.name === 'string' ? o.name : '', cents: ganzzahl(ort, o, 'cents'), count: ganzzahl(ort, o, 'count') };
|
|
145
|
+
}
|
|
140
146
|
function inhaberTrinkgeld(ort, w) {
|
|
141
147
|
const o = pflichtObjekt(ort, w);
|
|
142
148
|
return { registerUserId: kennung(ort, o, 'registerUserId'), name: text(o.name), cents: ganzzahl(ort, o, 'cents') };
|
|
@@ -359,6 +365,8 @@ export function schichtBon(ort, w) {
|
|
|
359
365
|
// Ablauf der Kasse: nur, wenn der Server sie sendet (die Bons davor tragen sie nicht).
|
|
360
366
|
wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
|
|
361
367
|
wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
|
|
368
|
+
// Nur Anzeige: gewaehrte Rabatte je Name; der Server sendet sie erst ab dem ersten Rabatt.
|
|
369
|
+
wennWert(r, o, 'discounts', () => liste(ort, o, 'discounts', rabatt));
|
|
362
370
|
wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
|
|
363
371
|
wennDa(r, o, 'countedBeforePayoutCents', () => ganzzahlOderNull(ort, o, 'countedBeforePayoutCents'));
|
|
364
372
|
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
|
/**
|
|
@@ -31,6 +31,29 @@ export declare const TIP_KINDS: readonly ["percent", "round_up", "total"];
|
|
|
31
31
|
export type PosTipKind = typeof TIP_KINDS[number];
|
|
32
32
|
/** Die zuerst offene Trinkgeld-Art (`business.tipStart`): dieselben Werte wie [TIP_KINDS]. */
|
|
33
33
|
export declare const TIP_START: readonly ["percent", "round_up", "total"];
|
|
34
|
+
/**
|
|
35
|
+
* Bar-Trinkgeld gleich behalten (`business.tipKeptMode`): `ask` = Schalter an der Kasse, vorbelegt mit
|
|
36
|
+
* `tipKeptByDefault`; `always`/`never` = kein Schalter, die Kasse setzt die Wahl selbst. Entscheidung ueber [tipKeptFor].
|
|
37
|
+
*/
|
|
38
|
+
export declare const TIP_KEPT_MODE: readonly ["ask", "always", "never"];
|
|
39
|
+
export type PosTipKeptMode = typeof TIP_KEPT_MODE[number];
|
|
40
|
+
/**
|
|
41
|
+
* Art einer Rabatt-Vorlage (`business.discountPresets[].kind`): Prozent oder fester Betrag
|
|
42
|
+
* (gespeichert `art`: `prozent | betrag`).
|
|
43
|
+
*/
|
|
44
|
+
export declare const DISCOUNT_PRESET_KIND: readonly ["percent", "amount"];
|
|
45
|
+
export type PosDiscountPresetKind = typeof DISCOUNT_PRESET_KIND[number];
|
|
46
|
+
/**
|
|
47
|
+
* Benannte Rabatt-Chips der Kasse: `kind` `percent` traegt `percentBp` (Basispunkte, 10 % = 1000), `amount` traegt
|
|
48
|
+
* `amountCents` (Cent). Der Name steht auf dem Chip und als Text der Rabattzeile am Beleg; ohne Namen (`''`) bleibt
|
|
49
|
+
* die Zeile „Rabatt“. Pruefen vor dem Schreiben: [checkDiscountPresets].
|
|
50
|
+
*/
|
|
51
|
+
export interface PosDiscountPreset {
|
|
52
|
+
name: string;
|
|
53
|
+
kind: PosDiscountPresetKind;
|
|
54
|
+
percentBp?: number;
|
|
55
|
+
amountCents?: number;
|
|
56
|
+
}
|
|
34
57
|
/** Breite der rechten Spalte (Korb) an diesem Geraet (`device.cartWidth`); in der schmalen Ansicht ohne Wirkung. */
|
|
35
58
|
export declare const CART_WIDTH: readonly ["narrow", "medium", "wide"];
|
|
36
59
|
export type PosCartWidth = typeof CART_WIDTH[number];
|
|
@@ -209,6 +232,25 @@ export interface PosBusinessSettings {
|
|
|
209
232
|
* Lesen ueber [posTipKeptByDefault]. Siehe [POS_BUSINESS_OPTIONAL_FIELDS].
|
|
210
233
|
*/
|
|
211
234
|
tipKeptByDefault?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Ob die Kasse beim Bar-Trinkgeld fragt (`ask`) oder es immer (`always`) bzw. nie (`never`) gleich behalten
|
|
237
|
+
* wird. Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es (oder ist es unbekannt),
|
|
238
|
+
* gilt `ask`. Lesen ueber [posTipKeptMode], entscheiden ueber [tipKeptFor].
|
|
239
|
+
*/
|
|
240
|
+
tipKeptMode?: PosOpen<PosTipKeptMode>;
|
|
241
|
+
/**
|
|
242
|
+
* Benannte Rabatt-Chips (Prozent oder Betrag, hoechstens 5). Optional: der Server sendet das Feld nur, wenn es
|
|
243
|
+
* gespeichert ist; dann sind die Vorlagen die Quelle der Chips und `discountChips` spiegelt ihre Prozentwerte fuer
|
|
244
|
+
* aeltere Kassen. Fehlt es, gilt `discountChips`. Lesen ueber [posDiscountPresets]; eine Vorlage mit unbekannter
|
|
245
|
+
* Art verwirft der Leser.
|
|
246
|
+
*/
|
|
247
|
+
discountPresets?: PosDiscountPreset[];
|
|
248
|
+
/**
|
|
249
|
+
* Eigener Rabatt an der Kasse: `true` = neben den Rabatt-Chips das freie Feld (Betrag oder Prozent), `false` = nur
|
|
250
|
+
* die Chips. Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es, gilt `true` (wie bisher).
|
|
251
|
+
* Lesen ueber [posCustomDiscountAllowed]. Siehe [POS_BUSINESS_OPTIONAL_FIELDS].
|
|
252
|
+
*/
|
|
253
|
+
customDiscountAllowed?: boolean;
|
|
212
254
|
/**
|
|
213
255
|
* Angebotene Trinkgeld-Arten (nichtleere Teilmenge von [TIP_KINDS], Reihenfolge wie
|
|
214
256
|
* gespeichert). Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es,
|
|
@@ -312,14 +354,22 @@ export declare function _optionalerWert(wert: unknown, schreiben: boolean): bool
|
|
|
312
354
|
* [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg
|
|
313
355
|
* nimmt nur `true`/`false`.
|
|
314
356
|
*/
|
|
315
|
-
export declare const POS_BUSINESS_OPTIONAL_FIELDS: readonly ["tipKeptByDefault"];
|
|
357
|
+
export declare const POS_BUSINESS_OPTIONAL_FIELDS: readonly ["tipKeptByDefault", "customDiscountAllowed"];
|
|
316
358
|
/**
|
|
317
359
|
* Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
|
|
318
|
-
* `KASSE_BETRIEB_WERTE.tipKinds[]` und `.
|
|
360
|
+
* `KASSE_BETRIEB_WERTE.tipKinds[]`, `.tipStart` und `.tipKeptMode`): ohne Standardwert, der Server sendet sie nur,
|
|
319
361
|
* wenn sie gespeichert sind. [mergePosSettings] uebernimmt sie, wenn sie die Form haben
|
|
320
362
|
* (`tipKinds` eine nichtleere Liste von Texten, `tipStart` ein Text); den Wert prueft der Schreibweg.
|
|
321
363
|
*/
|
|
322
|
-
export declare const POS_BUSINESS_OPTIONAL_CHOICES: readonly ["tipKinds", "tipStart"];
|
|
364
|
+
export declare const POS_BUSINESS_OPTIONAL_CHOICES: readonly ["tipKinds", "tipStart", "tipKeptMode"];
|
|
365
|
+
/**
|
|
366
|
+
* Optionale Betriebs-Listen aus Objekten (Backend `BETRIEB_OPTIONAL.rabattVorlagen`): ohne Standardwert, der Server
|
|
367
|
+
* sendet sie nur, wenn sie gespeichert sind (auch als leere Liste). Der Leser uebernimmt die Eintraege, die die Form
|
|
368
|
+
* einer Vorlage haben ([_vorlagenLesen]); eine Vorlage mit unbekannter Art faellt weg.
|
|
369
|
+
*/
|
|
370
|
+
export declare const POS_BUSINESS_OPTIONAL_LISTS: readonly ["discountPresets"];
|
|
371
|
+
/** Die lesbaren Vorlagen einer Liste vom Draht oder aus dem Speicher; keine Liste -> `null` (Feld fehlt). */
|
|
372
|
+
export declare function _vorlagenLesen(wert: unknown): PosDiscountPreset[] | null;
|
|
323
373
|
/** Optionale Geraete-Einstellungen mit Wertemenge (Backend `GERAET_OPTIONAL`, Katalog `KASSE_GERAET_WERTE.cartWidth`). */
|
|
324
374
|
export declare const POS_DEVICE_OPTIONAL_CHOICES: readonly ["cartWidth"];
|
|
325
375
|
/** Hat der Wert die Form eines optionalen Wahlfeldes? Texte, die der Server neu einfuehren koennte, bleiben (kein Altwert 0.x). */
|
|
@@ -332,6 +382,22 @@ export declare function posTipStart(business: Readonly<Partial<PosBusinessSettin
|
|
|
332
382
|
export declare function posCartWidth(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): PosOpen<PosCartWidth>;
|
|
333
383
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
334
384
|
export declare function posTipKeptByDefault(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
|
|
385
|
+
/** Darf an der Kasse ein eigener Rabatt (Betrag oder Prozent) eingetippt werden? Fehlt die Einstellung, gilt ja. */
|
|
386
|
+
export declare function posCustomDiscountAllowed(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
|
|
387
|
+
/** Wirksame Stufe „Trinkgeld gleich behalten“: die gespeicherte, wenn sie bekannt ist, sonst `ask`. */
|
|
388
|
+
export declare function posTipKeptMode(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): PosTipKeptMode;
|
|
389
|
+
/** Ergebnis von [tipKeptFor]: zeigt die Kasse den Schalter, und wird das Bar-Trinkgeld gleich behalten? */
|
|
390
|
+
export interface TipKeptDecision {
|
|
391
|
+
showSwitch: boolean;
|
|
392
|
+
kept: boolean;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Die eine Regel fuer Web-Kasse und Kassen-App beim Bar-Trinkgeld: `ask` zeigt den Schalter, gewaehlt ist
|
|
396
|
+
* `wanted` (die Wahl am Schalter, ein Wahrheitswert), sonst die Vorbelegung `tipKeptByDefault`; `always` bzw. `never` zeigen
|
|
397
|
+
* keinen Schalter und behalten gleich bzw. lassen offen, eine Schalterwahl zaehlt dann nicht. `kept` geht als
|
|
398
|
+
* `tip.direkt` an den Beleg (der Server erzwingt die Stufe dort nicht).
|
|
399
|
+
*/
|
|
400
|
+
export declare function tipKeptFor(business: Readonly<Partial<PosBusinessSettings>> | null | undefined, wanted?: boolean | null): TipKeptDecision;
|
|
335
401
|
/**
|
|
336
402
|
* Die Wertemenge je Feld, soweit das Feld eine hat: dagegen prueft der
|
|
337
403
|
* Schreibweg vor dem Senden (ein deutscher Wert wie `'nacht'` geht so gar
|