@kreiseck/kasseneck-api 1.26.0 → 1.28.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cjs/client/aufrufe.d.ts +3 -3
  3. package/dist/cjs/client/aufrufe.js +3 -0
  4. package/dist/cjs/models/receipt-errors.d.ts +1 -1
  5. package/dist/cjs/models/receipt-errors.js +2 -0
  6. package/dist/cjs/models/receipt-item.d.ts +10 -0
  7. package/dist/cjs/models/receipt-item.js +8 -0
  8. package/dist/cjs/pos/artikel.d.ts +17 -0
  9. package/dist/cjs/pos/artikel.js +7 -0
  10. package/dist/cjs/pos/aufrunden.d.ts +6 -0
  11. package/dist/cjs/pos/aufrunden.js +59 -0
  12. package/dist/cjs/pos/client.js +12 -1
  13. package/dist/cjs/pos/index.d.ts +5 -3
  14. package/dist/cjs/pos/index.js +27 -4
  15. package/dist/cjs/pos/schicht-lesen.d.ts +2 -1
  16. package/dist/cjs/pos/schicht-lesen.js +48 -1
  17. package/dist/cjs/pos/schicht-typen.d.ts +106 -3
  18. package/dist/cjs/pos/schicht-typen.js +14 -4
  19. package/dist/cjs/pos/schicht.d.ts +28 -2
  20. package/dist/cjs/pos/schicht.js +19 -0
  21. package/dist/cjs/pos/settings.d.ts +39 -0
  22. package/dist/cjs/pos/settings.js +65 -4
  23. package/dist/cjs/pos/texte.d.ts +305 -0
  24. package/dist/cjs/pos/texte.js +113 -0
  25. package/dist/cjs/pos/zusaetze.d.ts +70 -0
  26. package/dist/cjs/pos/zusaetze.js +159 -0
  27. package/dist/cjs/receipt/grid.js +16 -3
  28. package/dist/cjs/receipt/layout.js +16 -9
  29. package/dist/cjs/receipt/shift-sheet.js +29 -0
  30. package/dist/cjs/stored/einstellungen.js +31 -4
  31. package/dist/cjs/stored/vokabular.d.ts +1 -1
  32. package/dist/cjs/stored/vokabular.js +35 -5
  33. package/dist/cjs/version.d.ts +1 -1
  34. package/dist/cjs/version.js +1 -1
  35. package/dist/esm/client/aufrufe.d.ts +3 -3
  36. package/dist/esm/client/aufrufe.js +3 -0
  37. package/dist/esm/models/receipt-errors.d.ts +1 -1
  38. package/dist/esm/models/receipt-errors.js +2 -0
  39. package/dist/esm/models/receipt-item.d.ts +10 -0
  40. package/dist/esm/models/receipt-item.js +8 -0
  41. package/dist/esm/pos/artikel.d.ts +17 -0
  42. package/dist/esm/pos/artikel.js +6 -0
  43. package/dist/esm/pos/aufrunden.d.ts +6 -0
  44. package/dist/esm/pos/aufrunden.js +56 -0
  45. package/dist/esm/pos/client.js +13 -2
  46. package/dist/esm/pos/index.d.ts +5 -3
  47. package/dist/esm/pos/index.js +6 -4
  48. package/dist/esm/pos/schicht-lesen.d.ts +2 -1
  49. package/dist/esm/pos/schicht-lesen.js +47 -1
  50. package/dist/esm/pos/schicht-typen.d.ts +106 -3
  51. package/dist/esm/pos/schicht-typen.js +13 -3
  52. package/dist/esm/pos/schicht.d.ts +28 -2
  53. package/dist/esm/pos/schicht.js +19 -1
  54. package/dist/esm/pos/settings.d.ts +39 -0
  55. package/dist/esm/pos/settings.js +60 -3
  56. package/dist/esm/pos/texte.d.ts +305 -0
  57. package/dist/esm/pos/texte.js +113 -0
  58. package/dist/esm/pos/zusaetze.d.ts +70 -0
  59. package/dist/esm/pos/zusaetze.js +148 -0
  60. package/dist/esm/receipt/grid.js +16 -3
  61. package/dist/esm/receipt/layout.js +16 -9
  62. package/dist/esm/receipt/shift-sheet.js +29 -0
  63. package/dist/esm/stored/einstellungen.js +32 -5
  64. package/dist/esm/stored/vokabular.d.ts +1 -1
  65. package/dist/esm/stored/vokabular.js +35 -5
  66. package/dist/esm/version.d.ts +1 -1
  67. package/dist/esm/version.js +1 -1
  68. package/fixtures/add-on-cases.json +103 -0
  69. package/fixtures/duplicate-cases.json +6 -0
  70. package/fixtures/expected/add-ons.grid32.txt +31 -0
  71. package/fixtures/expected/add-ons.grid48.txt +27 -0
  72. package/fixtures/expected/add-ons.lines.json +270 -0
  73. package/fixtures/expected/add-ons.sheet32.json +212 -0
  74. package/fixtures/expected/add-ons.sheet48.json +188 -0
  75. package/fixtures/expected/duplicate.shift-close.hex +28 -27
  76. package/fixtures/expected/shift-close-blind.grid32.txt +1 -0
  77. package/fixtures/expected/shift-close-blind.grid48.txt +1 -0
  78. package/fixtures/expected/shift-close-blind.lines.json +6 -0
  79. package/fixtures/expected/shift-close-put-in.grid32.txt +1 -0
  80. package/fixtures/expected/shift-close-put-in.grid48.txt +1 -0
  81. package/fixtures/expected/shift-close-put-in.lines.json +6 -0
  82. package/fixtures/expected/shift-close-take-out.grid32.txt +1 -0
  83. package/fixtures/expected/shift-close-take-out.grid48.txt +1 -0
  84. package/fixtures/expected/shift-close-take-out.lines.json +6 -0
  85. package/fixtures/expected/shift-close.grid32.txt +1 -0
  86. package/fixtures/expected/shift-close.grid48.txt +1 -0
  87. package/fixtures/expected/shift-close.lines.json +6 -0
  88. package/fixtures/expected/shift-interim.grid32.txt +1 -0
  89. package/fixtures/expected/shift-interim.grid48.txt +1 -0
  90. package/fixtures/expected/shift-interim.lines.json +6 -0
  91. package/fixtures/hobex-hps-codes.json +1 -1
  92. package/fixtures/invoice-api.schema.json +1 -1
  93. package/fixtures/invoice-texts.json +1 -1
  94. package/fixtures/manifest.json +8 -0
  95. package/fixtures/pos-texts.json +352 -1
  96. package/fixtures/receipts/add-ons.json +70 -0
  97. package/fixtures/renames-1.0.json +30 -0
  98. package/fixtures/shift-ablauf-cases.json +182 -0
  99. package/fixtures/shift-receipts.json +15 -15
  100. package/fixtures/surface.json +50 -2
  101. package/fixtures/tip-round-up-cases.json +27 -0
  102. package/fixtures/v3/antworten/belege.json +2 -2
  103. package/fixtures/v3/antworten/belegmail.json +2 -2
  104. package/fixtures/v3/antworten/berichte.json +2 -2
  105. package/fixtures/v3/antworten/kasse-belege.json +2 -2
  106. package/fixtures/v3/antworten/kasse.json +504 -4
  107. package/fixtures/v3/antworten/lager.json +1 -1
  108. package/fixtures/v3/antworten/rechnungen.json +2 -2
  109. package/fixtures/v3/antworten/storno.json +2 -2
  110. package/fixtures/v3/stored/belege.json +2 -2
  111. package/fixtures/v3/stored/kasse.json +520 -12
  112. package/fixtures/v3/stored/rechnungen.json +2 -2
  113. package/fixtures/v3/v3-vokabular.json +160 -19
  114. package/fixtures/v3/zahlbetrag-faelle.json +2 -2
  115. package/package.json +1 -1
@@ -61,6 +61,12 @@ export interface ReceiptItem {
61
61
  originalIndex?: number;
62
62
  /** Nur an Storno-Zeilen mit `articleId`: wohin die Ware ging (Lager-Kern Stufe 2). */
63
63
  returnDisposition?: ReturnDisposition;
64
+ /**
65
+ * Zusatz-Kacheln (1.27.0): Index der Hauptposition im selben Beleg; nur an
66
+ * Zusatzpositionen. Der Server prueft: ganze Zahl, zeigt nach vorne auf eine
67
+ * Warenposition, die selbst kein Zusatz ist (`invalid_add_on_reference`).
68
+ */
69
+ addOnOf?: number;
64
70
  }
65
71
  /** Empfaenger einer Trinkgeld-Position (Kassen-Benutzer, Snapshot des Namens). */
66
72
  export interface TipRecipient {
@@ -99,6 +105,8 @@ export interface ReceiptItemPayload {
99
105
  keptByEmployee?: boolean;
100
106
  /** Artikel-Verweis, siehe [ReceiptItem.articleId]. */
101
107
  articleId?: string;
108
+ /** Hauptposition eines Zusatzes, siehe [ReceiptItem.addOnOf]. */
109
+ addOnOf?: number;
102
110
  }
103
111
  /**
104
112
  * Nutzlast-Form, die dieses Paket **liest** — v2 und v1 nebeneinander, alles
@@ -144,6 +152,8 @@ export interface ReceiptItemPayloadRead {
144
152
  originalIndex?: number | null;
145
153
  /** Storno-Zeile mit `articleId`: Rueckgabe-Wahl, siehe [ReceiptItem.returnDisposition]. */
146
154
  returnDisposition?: string | null;
155
+ /** Hauptposition eines Zusatzes, siehe [ReceiptItem.addOnOf]. */
156
+ addOnOf?: number | null;
147
157
  }
148
158
  export declare function toReceiptItemPayload(item: ReceiptItem): ReceiptItemPayload;
149
159
  /**
@@ -57,6 +57,9 @@ export function toReceiptItemPayload(item) {
57
57
  // Artikel-Verweis reist mit (Erloesgruppen im Bericht); leere Werte nicht.
58
58
  if (item.articleId != null && item.articleId !== '')
59
59
  nutzlast.articleId = item.articleId;
60
+ // Zusatz-Kacheln: Verweis auf die Hauptposition nur, wenn gesetzt.
61
+ if (istIndex(item.addOnOf))
62
+ nutzlast.addOnOf = item.addOnOf;
60
63
  return nutzlast;
61
64
  }
62
65
  /**
@@ -107,8 +110,13 @@ export function fromReceiptItemPayload(payload) {
107
110
  // unbekannter Wert faellt weg wie am Rand des Servers).
108
111
  ...(Number.isInteger(payload.originalIndex) && payload.originalIndex >= 0 ? { originalIndex: payload.originalIndex } : {}),
109
112
  ...(isReturnDisposition(payload.returnDisposition) ? { returnDisposition: payload.returnDisposition } : {}),
113
+ // Zusatz-Kacheln: Verweis auf die Hauptposition (nur eine ganze Zahl >= 0).
114
+ ...(istIndex(payload.addOnOf) ? { addOnOf: payload.addOnOf } : {}),
110
115
  };
111
116
  }
117
+ function istIndex(wert) {
118
+ return Number.isInteger(wert) && wert >= 0;
119
+ }
112
120
  /** Erster brauchbarer Zahlenwert der Reihe; `null`/`undefined`/NaN zaehlen nicht. */
113
121
  function ersteZahl(...werte) {
114
122
  for (const wert of werte) {
@@ -14,6 +14,13 @@ export interface ArticleGroup {
14
14
  symbol: string | null;
15
15
  sort: number;
16
16
  vatRate: number | null;
17
+ /**
18
+ * Zusaetze der Gruppe (Zusatz-Kacheln, 1.27.0): Artikel-Kennungen in der
19
+ * Reihenfolge des Fensters; null = keine. Optional, damit bestehende Literale
20
+ * weiter uebersetzen; der Leser setzt das Feld immer. Wirksam wird die Liste
21
+ * erst ueber [addOnsFor].
22
+ */
23
+ addOns?: string[] | null;
17
24
  }
18
25
  export interface ArticleGroupPayload {
19
26
  id?: string | null;
@@ -22,7 +29,10 @@ export interface ArticleGroupPayload {
22
29
  symbol?: string | null;
23
30
  sort?: number | null;
24
31
  vatRate?: number | null;
32
+ addOns?: unknown;
25
33
  }
34
+ /** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
35
+ export declare function addOnListe(wert: unknown): string[] | null;
26
36
  export declare function fromArticleGroupPayload(p: ArticleGroupPayload): ArticleGroup;
27
37
  /**
28
38
  * Mengenregel eines Artikels (Draht `quantityRule`): `piece` = ganze Stueck
@@ -105,6 +115,12 @@ export interface PosArticle {
105
115
  askPrice?: boolean;
106
116
  /** Kasse fragt beim Antippen eine Referenz ab; null = aus. Der Leser setzt es immer. */
107
117
  reference?: PosReference | null;
118
+ /**
119
+ * Eigene Zusatzliste (Zusatz-Kacheln, 1.27.0): null = wie die Gruppe, [] =
120
+ * keine, sonst die Liste in der Reihenfolge des Fensters. Der Leser setzt es
121
+ * immer; wirksam wird es ueber [addOnsFor].
122
+ */
123
+ addOns?: string[] | null;
108
124
  }
109
125
  /**
110
126
  * Kann die Kachel gebucht werden? Mit festem Preis immer, ohne Preis nur mit
@@ -144,6 +160,7 @@ export interface PosArticlePayload {
144
160
  serviceVoucher?: boolean | null;
145
161
  askPrice?: boolean | null;
146
162
  reference?: unknown;
163
+ addOns?: unknown;
147
164
  }
148
165
  export declare function fromPosArticlePayload(p: PosArticlePayload): PosArticle;
149
166
  /**
@@ -1,5 +1,9 @@
1
1
  import { KasseneckValidationError } from '../client/errors.js';
2
2
  import { fromReferencePayload } from './kachel-referenz.js';
3
+ /** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
4
+ export function addOnListe(wert) {
5
+ return Array.isArray(wert) ? wert.filter((s) => typeof s === 'string' && s !== '') : null;
6
+ }
3
7
  export function fromArticleGroupPayload(p) {
4
8
  return {
5
9
  id: p.id ?? '',
@@ -8,6 +12,7 @@ export function fromArticleGroupPayload(p) {
8
12
  symbol: p.symbol ?? null,
9
13
  sort: typeof p.sort === 'number' ? p.sort : 0,
10
14
  vatRate: typeof p.vatRate === 'number' ? p.vatRate : null,
15
+ addOns: addOnListe(p.addOns),
11
16
  };
12
17
  }
13
18
  /**
@@ -86,6 +91,7 @@ export function fromPosArticlePayload(p) {
86
91
  serviceVoucher: p.serviceVoucher === true,
87
92
  askPrice: p.askPrice === true,
88
93
  reference: fromReferencePayload(p.reference),
94
+ addOns: addOnListe(p.addOns),
89
95
  };
90
96
  }
91
97
  /**
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Aufrunden-Vorschlaege fuer Trinkgeld: genau drei aufsteigende Gesamtbetraege
3
+ * in Cent ueber dem Bezugsbetrag. Nur Ganzzahlen; die Pruefaelle stehen in
4
+ * `fixtures/tip-round-up-cases.json` (gleich im Dart-Zwilling).
5
+ */
6
+ export declare function roundUpSuggestions(amountCents: number): number[];
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Aufrunden-Vorschlaege fuer Trinkgeld: genau drei aufsteigende Gesamtbetraege
3
+ * in Cent ueber dem Bezugsbetrag. Nur Ganzzahlen; die Pruefaelle stehen in
4
+ * `fixtures/tip-round-up-cases.json` (gleich im Dart-Zwilling).
5
+ */
6
+ function steps(t) {
7
+ if (t < 1500)
8
+ return [50, 100];
9
+ if (t < 5000)
10
+ return [100, 500];
11
+ if (t < 20000)
12
+ return [500, 1000];
13
+ return [1000, 5000];
14
+ }
15
+ const ceilDiv = (a, b) => Math.floor((a + b - 1) / b);
16
+ export function roundUpSuggestions(amountCents) {
17
+ if (!Number.isInteger(amountCents) || amountCents <= 0)
18
+ return [];
19
+ const t = amountCents;
20
+ const [small, large] = steps(t);
21
+ const lo = Math.max(ceilDiv(t * 102, 100), t + 20);
22
+ const hi = Math.floor((t * (t < 1000 ? 125 : 120)) / 100);
23
+ const set = new Set();
24
+ for (const s of [small, large])
25
+ for (let m = ceilDiv(lo, s) * s; m <= hi; m += s)
26
+ set.add(m);
27
+ const candidates = [...set].sort((a, b) => a - b);
28
+ const chosen = new Set();
29
+ if (candidates.length > 0) {
30
+ const firstRound = candidates.find((k) => k % large === 0);
31
+ chosen.add(firstRound !== undefined && (firstRound - t) * 100 <= t * 10 ? firstRound : candidates[0]);
32
+ }
33
+ for (const target of [110, 115]) {
34
+ const free = candidates.filter((k) => !chosen.has(k));
35
+ if (free.length === 0)
36
+ break;
37
+ const dist = (k) => Math.abs(k * 100 - t * target);
38
+ const round = free.find((k) => k % large === 0 && dist(k) <= t * 3);
39
+ if (round !== undefined) {
40
+ chosen.add(round);
41
+ continue;
42
+ }
43
+ let best = free[0];
44
+ for (const k of free)
45
+ if (dist(k) < dist(best))
46
+ best = k;
47
+ chosen.add(best);
48
+ }
49
+ let next = chosen.size > 0 ? Math.max(...chosen) : ceilDiv(lo, small) * small - small;
50
+ while (chosen.size < 3) {
51
+ next = (Math.floor(next / small) + 1) * small;
52
+ if (next >= lo)
53
+ chosen.add(next);
54
+ }
55
+ return [...chosen].sort((a, b) => a - b);
56
+ }
@@ -1,6 +1,6 @@
1
1
  import { KasseneckValidationError } from '../client/errors.js';
2
2
  import { posVoucherSettingsFromWire } from './gutschein.js';
3
- import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
3
+ import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
4
4
  /*
5
5
  * Die Einstellungs-Aufrufe am Draht `/api/v3`: Parameter und Antwort heissen
6
6
  * `business`/`device`, Schluessel und Werte englisch (Nachtrag §11.7.2).
@@ -144,10 +144,21 @@ function pruefeTeil(name, teil, block, standard, werte) {
144
144
  throw new KasseneckValidationError(name, `${teil}.${schluessel}: true oder false erwartet`, 'request');
145
145
  continue;
146
146
  }
147
- if (!Object.prototype.hasOwnProperty.call(standard, schluessel)) {
147
+ const wahl = teil === 'business' ? POS_BUSINESS_OPTIONAL_CHOICES : POS_DEVICE_OPTIONAL_CHOICES;
148
+ if (!Object.prototype.hasOwnProperty.call(standard, schluessel) && !wahl.includes(schluessel)) {
148
149
  throw new KasseneckValidationError(name, `${teil}.${schluessel}: unbekanntes Feld`, 'request');
149
150
  }
150
151
  const erlaubt = Object.prototype.hasOwnProperty.call(werte, schluessel) ? werte[schluessel] : undefined;
152
+ if (schluessel === 'tipKinds' && !Array.isArray(wert)) {
153
+ throw new KasseneckValidationError(name, `${teil}.${schluessel}: eine Liste von Trinkgeld-Arten erwartet`, 'request');
154
+ }
155
+ // Eine Liste (tipKinds): nichtleer, jeder Eintrag aus der Wertemenge, ohne Dubletten.
156
+ if (erlaubt && Array.isArray(wert)) {
157
+ if (wert.length === 0 || new Set(wert).size !== wert.length || !wert.every((e) => erlaubt.includes(e))) {
158
+ throw new KasseneckValidationError(name, `${teil}.${schluessel}: ungueltiger Wert (erlaubt: ${erlaubt.join(', ')}, jede Art hoechstens einmal)`, 'request');
159
+ }
160
+ continue;
161
+ }
151
162
  if (erlaubt && !erlaubt.includes(wert)) {
152
163
  // Kein Altwert: dann ein Wert, den der Server kennt und dieses Paket
153
164
  // nicht. Er kam beim Lesen herein; wer den ganzen Block zurueckschickt,
@@ -6,9 +6,10 @@
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, posTipKeptByDefault, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, 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, 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';
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
+ export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
12
13
  export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, type SetMyPosLogoOptions, } from './client.js';
13
14
  export { POS_ERROR_CODES, type PosErrorCode, isPosErrorCode, posErrorCode, isPosError, type PosFieldError, posFieldErrors, } from './errors.js';
14
15
  export { distributeDiscount } from '../receipt/discount.js';
@@ -23,9 +24,10 @@ export { type ListMyStocktakesOptions, type ListMyStocktakeItemsOptions, type Li
23
24
  export type { Stocktake, StocktakeItem, StocktakeCount, StocktakeCountResult, StocktakeItemPage, StocktakeCountPage, StocktakeActor, StocktakeProgress, StocktakeReview, StocktakeRecount, StocktakeScope, } from '../inventory/typen.js';
24
25
  export type { StocktakeStatus } from '../inventory/vertrag.js';
25
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';
26
- export { type GetMyDrawerStateOptions, type OpenMyShiftOptions, type RecordMyCashMovementOptions, type DrawerOpeningEntry, type LogMyDrawerOpeningsOptions, type GetMyShiftReportOptions, type TipPayout, type CloseMyShiftOptions, type AfterCountOption, getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, type ShiftTipLine, type ShiftTipLineKey, } from './schicht.js';
27
- 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, 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 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';
27
+ 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';
28
29
  export { type ShiftReceiptLayoutOptions, shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
29
30
  export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputKind, type ReceiptOutputResult } from '../models/receipt-output.js';
30
31
  export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
31
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';
33
+ export { roundUpSuggestions } from './aufrunden.js';
@@ -6,11 +6,12 @@
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, posTipKeptByDefault, 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, 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, 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, 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
+ export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
14
15
  export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, } from './client.js';
15
16
  export { POS_ERROR_CODES, isPosErrorCode, posErrorCode, isPosError, posFieldErrors, } from './errors.js';
16
17
  export { distributeDiscount } from '../receipt/discount.js';
@@ -30,8 +31,8 @@ export { listMyStocktakes, listMyStocktakeItems, listMyStocktakeCounts, recordMy
30
31
  // Gutschein pruefen und Etikett nachdrucken an der Kasse; Gutschein-Sorten (Stufe 4b, 1.17.0).
31
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';
32
33
  // Schicht, Kassenstand und Lade-Protokoll (1.9.0): Aufrufe, Kataloge, Helfer, Bons.
33
- export { getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, } from './schicht.js';
34
- export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, } from './schicht-typen.js';
34
+ export { getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, recordMyShiftCount, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, } from './schicht.js';
35
+ 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';
35
36
  export { shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
36
37
  // Ausgaben eines Belegs (Belegdetail: Art und Ergebnis -> Beschriftung); dieselben Listen wie an der Wurzel.
37
38
  export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS } from '../models/receipt-output.js';
@@ -39,3 +40,4 @@ export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS } from '../models/receipt-
39
40
  export { RETURN_DISPOSITIONS, isReturnDisposition } from '../models/cancellation.js';
40
41
  // Was die Kasse selbst sagt: ein Katalog fuer Browser-Kasse und App.
41
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';
43
+ export { roundUpSuggestions } from './aufrunden.js';
@@ -12,7 +12,7 @@
12
12
  * stehen im Modell genau dann, wenn der Server sie sendet.
13
13
  */
14
14
  import { type ValidationScope } from '../client/errors.js';
15
- import type { CashMovement, CashMovementReceipt, CashMovementResult, DrawerOpeningsResult, OpenShiftResult, ShiftReport, CloseShiftResult, DrawerState, Shift, ShiftSummaryReceipt } from './schicht-typen.js';
15
+ import type { CashMovement, CashMovementReceipt, CashMovementResult, DrawerOpeningsResult, OpenShiftResult, ShiftReport, CloseShiftResult, ShiftCountResult, DrawerState, Shift, ShiftSummaryReceipt } from './schicht-typen.js';
16
16
  type Roh = Record<string, unknown>;
17
17
  /** Wer liest (fuer die Meldung) und wo im Rumpf. */
18
18
  export interface Ort {
@@ -33,6 +33,7 @@ export declare function schichtBon(ort: Ort, w: unknown): ShiftSummaryReceipt;
33
33
  export declare function bewegungsBon(ort: Ort, w: unknown): CashMovementReceipt;
34
34
  export declare function abschluss(ort: Ort, w: unknown): CloseShiftResult;
35
35
  export declare function geoeffnet(ort: Ort, w: unknown): OpenShiftResult;
36
+ export declare function gezaehlt(ort: Ort, w: unknown): ShiftCountResult;
36
37
  export declare function gebucht(ort: Ort, w: unknown): CashMovementResult;
37
38
  export declare function gemeldet(ort: Ort, w: unknown): DrawerOpeningsResult;
38
39
  export declare function bericht(ort: Ort, w: unknown): ShiftReport;
@@ -117,7 +117,7 @@ function trinkgeldMitOffen(ort, w) {
117
117
  }
118
118
  function laufstand(ort, w) {
119
119
  const o = pflichtObjekt(ort, w);
120
- return {
120
+ const raus = {
121
121
  cashSalesCents: ganzzahl(ort, o, 'cashSalesCents'),
122
122
  cashCancellationsCents: ganzzahl(ort, o, 'cashCancellationsCents'),
123
123
  nonCashByMethod: liste(ort, o, 'nonCashByMethod', unbar),
@@ -130,6 +130,16 @@ function laufstand(ort, w) {
130
130
  tips: liste(ort, o, 'tips', trinkgeld),
131
131
  openingsWithoutSale: ganzzahl(ort, o, 'openingsWithoutSale'),
132
132
  };
133
+ // Nur Anzeige (1.28.0); der Server sendet beides nur, wenn es etwas gibt -- gelesen wie gesendet.
134
+ if (o.ownerTips !== undefined && o.ownerTips !== null)
135
+ raus.ownerTips = liste(ort, o, 'ownerTips', inhaberTrinkgeld);
136
+ if (o.unassignedTipCents !== undefined && o.unassignedTipCents !== null)
137
+ raus.unassignedTipCents = ganzzahl(ort, o, 'unassignedTipCents');
138
+ return raus;
139
+ }
140
+ function inhaberTrinkgeld(ort, w) {
141
+ const o = pflichtObjekt(ort, w);
142
+ return { registerUserId: kennung(ort, o, 'registerUserId'), name: text(o.name), cents: ganzzahl(ort, o, 'cents') };
133
143
  }
134
144
  /** Entnehmen oder Einlegen nach dem Zaehlen; die Art bleibt offen fuer kuenftige Werte (Text). */
135
145
  function nachZaehlung(ort, w) {
@@ -152,6 +162,14 @@ function abgleich(ort, w) {
152
162
  }
153
163
  return { matches: wahr(ort, o, 'matches'), deviations };
154
164
  }
165
+ function sollTeil(ort, w) {
166
+ const o = pflichtObjekt(ort, w);
167
+ return { key: kennung(ort, o, 'key'), cents: ganzzahl(ort, o, 'cents') };
168
+ }
169
+ function differenzTeil(ort, w) {
170
+ const o = pflichtObjekt(ort, w);
171
+ return { type: kennung(ort, o, 'type'), cents: ganzzahl(ort, o, 'cents'), at: text(o.at) };
172
+ }
155
173
  /** Eine Schicht; was nur mit `cashView` kommt, steht nur, wenn gesendet. */
156
174
  export function schicht(ort, w) {
157
175
  const o = pflichtObjekt(ort, w);
@@ -187,6 +205,14 @@ export function schicht(ort, w) {
187
205
  // Nur wenn beim Abschluss Geld entnommen oder eingelegt wurde.
188
206
  wennWert(r, o, 'afterCount', () => nachZaehlung(unter(ort, 'afterCount'), o.afterCount));
189
207
  wennWert(r, o, 'leftInDrawerCents', () => ganzzahl(ort, o, 'leftInDrawerCents'));
208
+ // Ablauf der Kasse: nur, wenn der Server sie sendet.
209
+ wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
210
+ wennWert(r, o, 'expectedParts', () => liste(ort, o, 'expectedParts', sollTeil));
211
+ wennWert(r, o, 'cashTipsInDrawerCents', () => ganzzahl(ort, o, 'cashTipsInDrawerCents'));
212
+ wennWert(r, o, 'interimCounts', () => ganzzahl(ort, o, 'interimCounts'));
213
+ wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
214
+ wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
215
+ wennWert(r, o, 'countedBeforePayoutCents', () => ganzzahl(ort, o, 'countedBeforePayoutCents'));
190
216
  return raus;
191
217
  }
192
218
  function schichtOderNull(ort, w) {
@@ -207,6 +233,12 @@ function oeffnung(ort, w) {
207
233
  ok: wahr(ort, o, 'ok'),
208
234
  };
209
235
  }
236
+ function letzteSchicht(ort, w) {
237
+ if (w === null)
238
+ return null;
239
+ const o = pflichtObjekt(ort, w);
240
+ return { number: ganzzahl(ort, o, 'number'), closedAt: kennung(ort, o, 'closedAt'), closedByName: text(o.closedByName) };
241
+ }
210
242
  export function ladeStand(ort, w) {
211
243
  const o = pflichtObjekt(ort, w);
212
244
  const lade = pflichtObjekt(unter(ort, 'drawer'), o.drawer);
@@ -236,6 +268,8 @@ export function ladeStand(ort, w) {
236
268
  wennDa(r, o, 'expectedCents', () => ganzzahlOderNull(ort, o, 'expectedCents'));
237
269
  wennDa(r, o, 'recentOpenings', () => liste(ort, o, 'recentOpenings', oeffnung));
238
270
  wennWert(r, o, 'suggestedFromShiftNumber', () => ganzzahl(ort, o, 'suggestedFromShiftNumber'));
271
+ // Letzte Schicht der Lade: `null` ist eine Aussage („keine“), darum bleibt es stehen.
272
+ wennDa(r, o, 'lastShift', () => (o.lastShift === undefined ? null : letzteSchicht(unter(ort, 'lastShift'), o.lastShift)));
239
273
  // Wechselgeld der Lade: nur wenn eingestellt.
240
274
  wennWert(raus.drawer, lade, 'changeFloatCents', () => ganzzahl(ladeOrt, lade, 'changeFloatCents'));
241
275
  return raus;
@@ -322,6 +356,12 @@ export function schichtBon(ort, w) {
322
356
  const r = raus;
323
357
  wennWert(r, o, 'afterCount', () => nachZaehlung(unter(ort, 'afterCount'), o.afterCount));
324
358
  wennDa(r, o, 'leftInDrawerCents', () => ganzzahlOderNull(ort, o, 'leftInDrawerCents'));
359
+ // Ablauf der Kasse: nur, wenn der Server sie sendet (die Bons davor tragen sie nicht).
360
+ wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
361
+ wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
362
+ wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
363
+ wennDa(r, o, 'countedBeforePayoutCents', () => ganzzahlOderNull(ort, o, 'countedBeforePayoutCents'));
364
+ wennDa(r, o, 'countedBeforePayoutDenominations', () => stueckelung(ort, o, 'countedBeforePayoutDenominations'));
325
365
  return raus;
326
366
  }
327
367
  /** Bon-Daten einer Kassenbewegung; eine andere Art ist ein Fehler. */
@@ -374,6 +414,12 @@ export function geoeffnet(ort, w) {
374
414
  wennDa(raus, o, 'handoverDifferenceCents', () => ganzzahlOderNull(ort, o, 'handoverDifferenceCents'));
375
415
  return raus;
376
416
  }
417
+ export function gezaehlt(ort, w) {
418
+ const o = pflichtObjekt(ort, w);
419
+ const z = pflichtObjekt(unter(ort, 'count'), o.count);
420
+ const zOrt = unter(ort, 'count');
421
+ return { count: { expectedCents: ganzzahl(zOrt, z, 'expectedCents'), countedCents: ganzzahl(zOrt, z, 'countedCents'), differenceCents: ganzzahl(zOrt, z, 'differenceCents') } };
422
+ }
377
423
  export function gebucht(ort, w) {
378
424
  const o = pflichtObjekt(ort, w);
379
425
  return { movement: bewegung(unter(ort, 'movement'), o.movement), receipt: bewegungsBon(unter(ort, 'receipt'), o.receipt) };
@@ -19,10 +19,10 @@ export type EurDenomination = (typeof EUR_DENOMINATIONS)[number];
19
19
  /**
20
20
  * Alle Arten einer Kassenbewegung (Katalog `KASSEN_BEWEGUNG_ART`). Die ersten
21
21
  * acht sendet die Kasse ([MANUAL_MOVEMENT_TYPES]); `transfer_in` (Gegenseite
22
- * einer Umbuchung), `expense`, `count_difference` und `handover_difference`
23
- * vergibt nur der Server.
22
+ * einer Umbuchung), `expense`, `count_difference`, `handover_difference` und
23
+ * `interim_difference` (Differenz einer Zwischenzaehlung) vergibt nur der Server.
24
24
  */
25
- export declare const MOVEMENT_TYPES: readonly ["change_in", "cash_drop", "owner_deposit", "owner_withdrawal", "tip_payout", "other_in", "other_out", "transfer_out", "transfer_in", "expense", "count_difference", "handover_difference"];
25
+ export declare const MOVEMENT_TYPES: readonly ["change_in", "cash_drop", "owner_deposit", "owner_withdrawal", "tip_payout", "other_in", "other_out", "transfer_out", "transfer_in", "expense", "count_difference", "handover_difference", "interim_difference"];
26
26
  export type MovementType = (typeof MOVEMENT_TYPES)[number];
27
27
  /**
28
28
  * Was die Kasse von Hand buchen darf. Pflichtangaben je Art (sonst lehnt der
@@ -150,6 +150,20 @@ export interface ShiftRunningTotals {
150
150
  /** Nach Name sortiert. */
151
151
  tips: ShiftTipTotals[];
152
152
  openingsWithoutSale: number;
153
+ /**
154
+ * Trinkgeld an Kassen-Benutzer mit „Trinkgeld steuerpflichtig“ (Inhaber): zählt als Umsatz des Betriebs,
155
+ * nie als Anspruch, nie in „offen“ (nur Anzeige, 1.28.0). Nach Name sortiert; der Server sendet es nur,
156
+ * wenn es etwas gibt (fehlt = keines).
157
+ */
158
+ ownerTips?: ShiftOwnerTip[];
159
+ /** Trinkgeld ohne angemeldeten Empfänger in Cent (nur Anzeige, 1.28.0); fehlt = 0. */
160
+ unassignedTipCents?: number;
161
+ }
162
+ /** Ein Eintrag von [ShiftRunningTotals.ownerTips]: Trinkgeld, das als Umsatz erfasst ist. */
163
+ export interface ShiftOwnerTip {
164
+ registerUserId: string;
165
+ name: string | null;
166
+ cents: number;
153
167
  }
154
168
  /** Nachrechnung des Laufstands beim Abschluss: stimmt er, oder welche Felder weichen ab. */
155
169
  export interface ShiftReconciliation {
@@ -160,6 +174,29 @@ export interface ShiftReconciliation {
160
174
  recomputed: unknown;
161
175
  }> | null;
162
176
  }
177
+ /**
178
+ * Wie sich das Soll in der Lade zusammensetzt (`Shift.expectedParts`, Karte „So setzt sich das zusammen“):
179
+ * Anfang, Barverkaeufe, Trinkgeld bar, Storno bar, Einzahlungen, Ausgaben aus der Lade und die
180
+ * Summe der Zwischenzaehlungs-Differenzen. Die Summe der Teile ist das Soll.
181
+ */
182
+ export declare const EXPECTED_PART_KEYS: readonly ["opening", "cash_sales", "cash_tips", "cancellations", "cash_in", "cash_out", "interim_difference"];
183
+ export type ExpectedPartKey = (typeof EXPECTED_PART_KEYS)[number];
184
+ /** Ein Teil des Solls in Cent (Vorzeichen wie gebucht, Ausgaben negativ). */
185
+ export interface ShiftExpectedPart {
186
+ /** Offen fuer einen kuenftigen Teil des Servers; bekannt sind [EXPECTED_PART_KEYS]. */
187
+ key: ExpectedPartKey | (string & {});
188
+ cents: number;
189
+ }
190
+ /** Teile der Gesamtdifferenz einer geschlossenen Schicht mit Zwischenzaehlung: `interim` je Zaehlung, `closing` der Abschluss. */
191
+ export declare const DIFFERENCE_PART_TYPES: readonly ["interim", "closing"];
192
+ export type DifferencePartType = (typeof DIFFERENCE_PART_TYPES)[number];
193
+ export interface ShiftDifferencePart {
194
+ /** Offen fuer einen kuenftigen Wert; bekannt sind [DIFFERENCE_PART_TYPES]. */
195
+ type: DifferencePartType | (string & {});
196
+ cents: number;
197
+ /** Zeitpunkt der Zaehlung (ISO 8601, UTC); beim Abschluss kann er fehlen. */
198
+ at: string | null;
199
+ }
163
200
  export interface Shift {
164
201
  id: string;
165
202
  drawerId: string;
@@ -183,12 +220,38 @@ export interface Shift {
183
220
  suggestedFloatCents?: number | null;
184
221
  runningTotals?: ShiftRunningTotals;
185
222
  expectedCents?: number | null;
223
+ /**
224
+ * Gesamtdifferenz der Schicht. Mit Zwischenzaehlungen ist sie NICHT `countedCents − expectedCents`:
225
+ * jede Zwischenzaehlung verschiebt das Soll um ihre Differenz, gespeichert wird die Summe aus den
226
+ * Zwischen-Teilen und dem Abschluss-Teil (`differenceParts`). Ohne Zwischenzaehlung gilt Ist − Soll.
227
+ */
186
228
  differenceCents?: number | null;
187
229
  reconciliation?: ShiftReconciliation | null;
188
230
  /** Entnommen bzw. eingelegt nach dem Zaehlen. */
189
231
  afterCount?: AfterCount;
190
232
  /** Was danach in der Lade bleibt (Ist ∓ Betrag); fehlt blind (ohne `cashView`). */
191
233
  leftInDrawerCents?: number;
234
+ /**
235
+ * Wurde der Anfang gezaehlt? `false` heisst: der Bestand wurde ohne Zaehlen uebernommen.
236
+ * Steht an offenen und geschlossenen Schichten und auf den Z-Bon-Daten (`ShiftSummaryReceipt.openingCounted`);
237
+ * fehlt das Feld (aeltere Server), gilt es als unbekannt, nicht als gezaehlt.
238
+ */
239
+ openingCounted?: boolean;
240
+ /** Das Soll in Teilen (Summe = `expectedCents`); nur an der offenen Schicht mit `cashView`. */
241
+ expectedParts?: ShiftExpectedPart[];
242
+ /** Bar-Trinkgeld, das in der Lade liegt (Teil des Solls); nur an der offenen Schicht mit `cashView`. */
243
+ cashTipsInDrawerCents?: number;
244
+ /** Zahl der Zwischenzaehlungen dieser Schicht; nur an der offenen Schicht mit `cashView`. */
245
+ interimCounts?: number;
246
+ /** Summe der Differenzen der Zwischenzaehlungen in Cent; fehlt, wenn der Server sie nicht sendet. */
247
+ interimDifferenceCents?: number;
248
+ /** Teile der Gesamtdifferenz; nur an geschlossenen Schichten mit Zwischenzaehlung. */
249
+ differenceParts?: ShiftDifferencePart[];
250
+ /**
251
+ * Rohwert der Zaehlung vor der Trinkgeld-Auszahlung; nur wenn mit `countedBeforePayout`
252
+ * geschlossen wurde. `countedCents` bleibt dann der Stand nach der Auszahlung.
253
+ */
254
+ countedBeforePayoutCents?: number;
192
255
  }
193
256
  /** Offener Trinkgeld-Anspruch eines Mitarbeiters (auszahlbar beim Abschluss oder per `tip_payout`). */
194
257
  export interface TipClaim {
@@ -236,6 +299,18 @@ export interface DrawerState {
236
299
  * mit einem Betrag „Bleibt in der Kassenlade“ schloss.
237
300
  */
238
301
  suggestedFromShiftNumber?: number;
302
+ /**
303
+ * Die zuletzt geschlossene Schicht dieser Lade (Karte „Letzte Schicht“ am Schichtbeginn);
304
+ * `null`, wenn es keine gibt, fehlt ohne Recht `shift`.
305
+ */
306
+ lastShift?: LastShift | null;
307
+ }
308
+ /** Die zuletzt geschlossene Schicht einer Lade. */
309
+ export interface LastShift {
310
+ number: number;
311
+ closedAt: string;
312
+ /** Wer sie schloss; `null`, wenn kein Name bekannt ist. */
313
+ closedByName: string | null;
239
314
  }
240
315
  export interface CashMovement {
241
316
  id: string;
@@ -308,6 +383,10 @@ export interface ShiftSummaryReceipt extends ShiftReceiptHeader {
308
383
  /** Beim X-Bon immer `null`. */
309
384
  countedCents: number | null;
310
385
  countedDenominations: Denominations | null;
386
+ /**
387
+ * Gesamtdifferenz; mit Zwischenzaehlungen nicht `countedCents − expectedCents`, sondern die Summe der
388
+ * Zwischen-Teile und des Abschluss-Teils (`differenceParts`), wie an `Shift.differenceCents`.
389
+ */
311
390
  differenceCents: number | null;
312
391
  comment: string | null;
313
392
  openingsWithoutSale: number;
@@ -318,6 +397,22 @@ export interface ShiftSummaryReceipt extends ShiftReceiptHeader {
318
397
  * (mit „Entnommen“ ergaebe es sonst das Ist).
319
398
  */
320
399
  leftInDrawerCents?: number | null;
400
+ /**
401
+ * Wurde der Anfang gezaehlt? Nur mit `false` druckt der Bon „Anfang uebernommen, nicht
402
+ * gezaehlt“; fehlt das Feld (der Server sendet es auf dem Bon nicht), bleibt die Zeile weg.
403
+ */
404
+ openingCounted?: boolean;
405
+ /** Summe der Zwischenzaehlungs-Differenzen; fehlt, wenn sie 0 ist oder blind. */
406
+ interimDifferenceCents?: number;
407
+ /** Teile der Gesamtdifferenz (Zwischenzaehlungen und Abschluss); fehlt ohne Zwischenzaehlung und blind. */
408
+ differenceParts?: ShiftDifferencePart[];
409
+ /**
410
+ * Die Zaehlung vor der Trinkgeld-Auszahlung (Rohwert); nur wenn so geschlossen wurde, blind `null`.
411
+ * `countedCents` ist dann der Stand nach der Auszahlung.
412
+ */
413
+ countedBeforePayoutCents?: number | null;
414
+ /** Stueckelung zu `countedBeforePayoutCents`; blind `null`. */
415
+ countedBeforePayoutDenominations?: Denominations | null;
321
416
  }
322
417
  /** Bon-Daten einer Kassenbewegung. */
323
418
  export interface CashMovementReceipt extends ShiftReceiptHeader {
@@ -343,6 +438,14 @@ export interface OpenShiftResult {
343
438
  /** Unterschied zum uebergebenen Bestand beim Zaehlen; nur mit `cashView`. */
344
439
  handoverDifferenceCents?: number | null;
345
440
  }
441
+ /** Antwort von `recordMyShiftCount`: Soll, Zaehlung und Differenz dieser Zwischenzaehlung (Cent). */
442
+ export interface ShiftCountResult {
443
+ count: {
444
+ expectedCents: number;
445
+ countedCents: number;
446
+ differenceCents: number;
447
+ };
448
+ }
346
449
  export interface CashMovementResult {
347
450
  movement: CashMovement;
348
451
  receipt: CashMovementReceipt;
@@ -18,12 +18,12 @@ export const EUR_DENOMINATIONS = Object.freeze([50000, 20000, 10000, 5000, 2000,
18
18
  /**
19
19
  * Alle Arten einer Kassenbewegung (Katalog `KASSEN_BEWEGUNG_ART`). Die ersten
20
20
  * acht sendet die Kasse ([MANUAL_MOVEMENT_TYPES]); `transfer_in` (Gegenseite
21
- * einer Umbuchung), `expense`, `count_difference` und `handover_difference`
22
- * vergibt nur der Server.
21
+ * einer Umbuchung), `expense`, `count_difference`, `handover_difference` und
22
+ * `interim_difference` (Differenz einer Zwischenzaehlung) vergibt nur der Server.
23
23
  */
24
24
  export const MOVEMENT_TYPES = Object.freeze([
25
25
  'change_in', 'cash_drop', 'owner_deposit', 'owner_withdrawal', 'tip_payout', 'other_in', 'other_out', 'transfer_out',
26
- 'transfer_in', 'expense', 'count_difference', 'handover_difference',
26
+ 'transfer_in', 'expense', 'count_difference', 'handover_difference', 'interim_difference',
27
27
  ]);
28
28
  /**
29
29
  * Was die Kasse von Hand buchen darf. Pflichtangaben je Art (sonst lehnt der
@@ -54,3 +54,13 @@ export const MANUAL_OPENING_REASONS = Object.freeze(['change', 'check', 'misoper
54
54
  export const AFTER_COUNT_TYPES = Object.freeze(['cash_drop', 'change_in']);
55
55
  /** Arten der Bon-Daten (Katalog `SCHICHT_BON_ART`): Z-Bon, X-Bon, Kassenbewegung. */
56
56
  export const SHIFT_RECEIPT_KINDS = Object.freeze(['shift_close', 'shift_interim', 'cash_movement']);
57
+ /**
58
+ * Wie sich das Soll in der Lade zusammensetzt (`Shift.expectedParts`, Karte „So setzt sich das zusammen“):
59
+ * Anfang, Barverkaeufe, Trinkgeld bar, Storno bar, Einzahlungen, Ausgaben aus der Lade und die
60
+ * Summe der Zwischenzaehlungs-Differenzen. Die Summe der Teile ist das Soll.
61
+ */
62
+ export const EXPECTED_PART_KEYS = Object.freeze([
63
+ 'opening', 'cash_sales', 'cash_tips', 'cancellations', 'cash_in', 'cash_out', 'interim_difference',
64
+ ]);
65
+ /** Teile der Gesamtdifferenz einer geschlossenen Schicht mit Zwischenzaehlung: `interim` je Zaehlung, `closing` der Abschluss. */
66
+ export const DIFFERENCE_PART_TYPES = Object.freeze(['interim', 'closing']);