@kreiseck/kasseneck-api 1.30.0 → 1.32.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 (150) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/cjs/client/aufrufe.d.ts +3 -3
  3. package/dist/cjs/client/aufrufe.js +8 -0
  4. package/dist/cjs/client/receipts.d.ts +11 -0
  5. package/dist/cjs/client/receipts.js +14 -0
  6. package/dist/cjs/index.d.ts +2 -2
  7. package/dist/cjs/index.js +10 -5
  8. package/dist/cjs/models/index.d.ts +2 -2
  9. package/dist/cjs/models/index.js +7 -2
  10. package/dist/cjs/models/receipt-errors.d.ts +1 -1
  11. package/dist/cjs/models/receipt-errors.js +9 -0
  12. package/dist/cjs/models/receipt-item.d.ts +44 -2
  13. package/dist/cjs/models/receipt-item.js +56 -1
  14. package/dist/cjs/models/receipt.d.ts +17 -0
  15. package/dist/cjs/models/receipt.js +9 -0
  16. package/dist/cjs/models/voucher.d.ts +18 -0
  17. package/dist/cjs/models/voucher.js +32 -1
  18. package/dist/cjs/pos/artikel.d.ts +26 -0
  19. package/dist/cjs/pos/artikel.js +5 -0
  20. package/dist/cjs/pos/client.d.ts +1 -0
  21. package/dist/cjs/pos/client.js +14 -0
  22. package/dist/cjs/pos/errors.d.ts +1 -1
  23. package/dist/cjs/pos/errors.js +13 -0
  24. package/dist/cjs/pos/fremdgutschein-artikel.d.ts +66 -0
  25. package/dist/cjs/pos/fremdgutschein-artikel.js +74 -0
  26. package/dist/cjs/pos/index.d.ts +9 -4
  27. package/dist/cjs/pos/index.js +62 -4
  28. package/dist/cjs/pos/leergut.d.ts +60 -0
  29. package/dist/cjs/pos/leergut.js +82 -0
  30. package/dist/cjs/pos/pfand.d.ts +144 -0
  31. package/dist/cjs/pos/pfand.js +382 -0
  32. package/dist/cjs/pos/rabatt-vorlagen.d.ts +79 -0
  33. package/dist/cjs/pos/rabatt-vorlagen.js +156 -0
  34. package/dist/cjs/pos/schicht-lesen.js +8 -0
  35. package/dist/cjs/pos/schicht-typen.d.ts +15 -0
  36. package/dist/cjs/pos/settings.d.ts +72 -10
  37. package/dist/cjs/pos/settings.js +79 -5
  38. package/dist/cjs/pos/texte.d.ts +283 -0
  39. package/dist/cjs/pos/texte.js +163 -1
  40. package/dist/cjs/pos/zusaetze.d.ts +3 -3
  41. package/dist/cjs/pos/zusaetze.js +4 -2
  42. package/dist/cjs/receipt/discount.js +3 -0
  43. package/dist/cjs/receipt/due.d.ts +6 -0
  44. package/dist/cjs/receipt/due.js +16 -5
  45. package/dist/cjs/receipt/gutschein-plan.d.ts +7 -1
  46. package/dist/cjs/receipt/gutschein-plan.js +16 -2
  47. package/dist/cjs/receipt/layout.js +108 -2
  48. package/dist/cjs/receipt/shift-sheet.js +8 -0
  49. package/dist/cjs/register/pairing.d.ts +15 -1
  50. package/dist/cjs/register/pairing.js +14 -1
  51. package/dist/cjs/stored/draht.js +1 -0
  52. package/dist/cjs/stored/einstellungen.js +50 -2
  53. package/dist/cjs/stored/vokabular.d.ts +1 -1
  54. package/dist/cjs/stored/vokabular.js +107 -5
  55. package/dist/cjs/version.d.ts +1 -1
  56. package/dist/cjs/version.js +1 -1
  57. package/dist/esm/client/aufrufe.d.ts +3 -3
  58. package/dist/esm/client/aufrufe.js +8 -0
  59. package/dist/esm/client/receipts.d.ts +11 -0
  60. package/dist/esm/client/receipts.js +14 -0
  61. package/dist/esm/index.d.ts +2 -2
  62. package/dist/esm/index.js +2 -2
  63. package/dist/esm/models/index.d.ts +2 -2
  64. package/dist/esm/models/index.js +2 -2
  65. package/dist/esm/models/receipt-errors.d.ts +1 -1
  66. package/dist/esm/models/receipt-errors.js +9 -0
  67. package/dist/esm/models/receipt-item.d.ts +44 -2
  68. package/dist/esm/models/receipt-item.js +54 -1
  69. package/dist/esm/models/receipt.d.ts +17 -0
  70. package/dist/esm/models/receipt.js +9 -0
  71. package/dist/esm/models/voucher.d.ts +18 -0
  72. package/dist/esm/models/voucher.js +30 -0
  73. package/dist/esm/pos/artikel.d.ts +26 -0
  74. package/dist/esm/pos/artikel.js +5 -0
  75. package/dist/esm/pos/client.d.ts +1 -0
  76. package/dist/esm/pos/client.js +15 -1
  77. package/dist/esm/pos/errors.d.ts +1 -1
  78. package/dist/esm/pos/errors.js +13 -0
  79. package/dist/esm/pos/fremdgutschein-artikel.d.ts +66 -0
  80. package/dist/esm/pos/fremdgutschein-artikel.js +67 -0
  81. package/dist/esm/pos/index.d.ts +9 -4
  82. package/dist/esm/pos/index.js +10 -4
  83. package/dist/esm/pos/leergut.d.ts +60 -0
  84. package/dist/esm/pos/leergut.js +77 -0
  85. package/dist/esm/pos/pfand.d.ts +144 -0
  86. package/dist/esm/pos/pfand.js +371 -0
  87. package/dist/esm/pos/rabatt-vorlagen.d.ts +79 -0
  88. package/dist/esm/pos/rabatt-vorlagen.js +148 -0
  89. package/dist/esm/pos/schicht-lesen.js +8 -0
  90. package/dist/esm/pos/schicht-typen.d.ts +15 -0
  91. package/dist/esm/pos/settings.d.ts +72 -10
  92. package/dist/esm/pos/settings.js +74 -4
  93. package/dist/esm/pos/texte.d.ts +283 -0
  94. package/dist/esm/pos/texte.js +160 -0
  95. package/dist/esm/pos/zusaetze.d.ts +3 -3
  96. package/dist/esm/pos/zusaetze.js +4 -2
  97. package/dist/esm/receipt/discount.js +4 -1
  98. package/dist/esm/receipt/due.d.ts +6 -0
  99. package/dist/esm/receipt/due.js +17 -6
  100. package/dist/esm/receipt/gutschein-plan.d.ts +7 -1
  101. package/dist/esm/receipt/gutschein-plan.js +14 -2
  102. package/dist/esm/receipt/layout.js +109 -3
  103. package/dist/esm/receipt/shift-sheet.js +8 -0
  104. package/dist/esm/register/pairing.d.ts +15 -1
  105. package/dist/esm/register/pairing.js +13 -1
  106. package/dist/esm/stored/draht.js +1 -0
  107. package/dist/esm/stored/einstellungen.js +52 -4
  108. package/dist/esm/stored/vokabular.d.ts +1 -1
  109. package/dist/esm/stored/vokabular.js +107 -5
  110. package/dist/esm/version.d.ts +1 -1
  111. package/dist/esm/version.js +1 -1
  112. package/fixtures/add-on-cases.json +6 -4
  113. package/fixtures/deposit-cases.json +4758 -0
  114. package/fixtures/discount-preset-cases.json +1074 -0
  115. package/fixtures/expected/deposit-return.grid32.txt +28 -0
  116. package/fixtures/expected/deposit-return.grid48.txt +28 -0
  117. package/fixtures/expected/deposit-return.lines.json +275 -0
  118. package/fixtures/expected/deposit-return.sheet32.json +194 -0
  119. package/fixtures/expected/deposit-return.sheet48.json +194 -0
  120. package/fixtures/expected/deposit.grid32.txt +34 -0
  121. package/fixtures/expected/deposit.grid48.txt +32 -0
  122. package/fixtures/expected/deposit.lines.json +316 -0
  123. package/fixtures/expected/deposit.sheet32.json +230 -0
  124. package/fixtures/expected/deposit.sheet48.json +218 -0
  125. package/fixtures/external-voucher-article-cases.json +311 -0
  126. package/fixtures/hobex-hps-codes.json +1 -1
  127. package/fixtures/invoice-api.schema.json +1 -1
  128. package/fixtures/invoice-texts.json +1 -1
  129. package/fixtures/manifest.json +16 -0
  130. package/fixtures/pos-texts.json +266 -1
  131. package/fixtures/receipt-due-voucher-generated.json +1 -1
  132. package/fixtures/receipts/deposit-return.json +63 -0
  133. package/fixtures/receipts/deposit.json +83 -0
  134. package/fixtures/renames-1.0.json +18 -0
  135. package/fixtures/return-code-cases.json +1338 -0
  136. package/fixtures/surface.json +92 -7
  137. package/fixtures/v3/antworten/belege.json +2 -2
  138. package/fixtures/v3/antworten/belegmail.json +2 -2
  139. package/fixtures/v3/antworten/berichte.json +2 -2
  140. package/fixtures/v3/antworten/kasse-belege.json +2 -2
  141. package/fixtures/v3/antworten/kasse.json +428 -13
  142. package/fixtures/v3/antworten/lager.json +1 -1
  143. package/fixtures/v3/antworten/rechnungen.json +2 -2
  144. package/fixtures/v3/antworten/storno.json +2 -2
  145. package/fixtures/v3/stored/belege.json +2 -2
  146. package/fixtures/v3/stored/kasse.json +42 -4
  147. package/fixtures/v3/stored/rechnungen.json +2 -2
  148. package/fixtures/v3/v3-vokabular.json +898 -31
  149. package/fixtures/v3/zahlbetrag-faelle.json +187 -3
  150. package/package.json +1 -1
@@ -0,0 +1,371 @@
1
+ /**
2
+ * Pfand & Leergut an der Kasse: Pfandarten und Einstellungen aus
3
+ * `getKasseSettings` (Block `deposit`), Pfandliste am Artikel und an der
4
+ * Gruppe (`deposits`) und die Pfand-Angaben des Kassenobjekts aus
5
+ * `listRegisterUsersForDevice`. Alles nur Lesen und Schreiben der Formen; die
6
+ * Rechnung (Betrag, Staffel nach Tag) kommt in einem eigenen Modul.
7
+ */
8
+ import { Gtin } from '@kreiseck/validator';
9
+ import { readVatRateByRate } from '../models/enum-payload.js';
10
+ /** Art einer Pfandart: Einweg oder Mehrweg. */
11
+ export const DEPOSIT_KINDS = ['single_use', 'reusable'];
12
+ /** Gebindetyp einer Pfandart (frei, nur zur Anzeige). */
13
+ export const DEPOSIT_TYPES = ['bottle', 'crate', 'keg', 'cup', 'glass', 'other'];
14
+ /** Wer nimmt Leergut an der Kasse zurueck: diese Kasse, eine gemeinsame Stelle oder niemand. */
15
+ export const DEPOSIT_RETURN_MODES = ['here', 'shared', 'none'];
16
+ /** Vorbelegung, ob Getraenke vor Ort getrunken oder mitgenommen werden. */
17
+ export const DEPOSIT_ON_PREMISES_DEFAULTS = ['on_premises', 'takeaway', 'ask'];
18
+ const istObjekt = (w) => w !== null && typeof w === 'object' && !Array.isArray(w);
19
+ const istGanz = (w, min) => Number.isInteger(w) && w >= min;
20
+ function aus(liste, value) {
21
+ return typeof value === 'string' && liste.includes(value) ? value : null;
22
+ }
23
+ function betrag(value) {
24
+ if (!istObjekt(value) || typeof value['from'] !== 'string' || !istGanz(value['cents'], 0))
25
+ return null;
26
+ return { from: value['from'], cents: value['cents'] };
27
+ }
28
+ function pfandart(value) {
29
+ if (!istObjekt(value) || typeof value['id'] !== 'string' || value['id'] === '')
30
+ return null;
31
+ const kind = aus(DEPOSIT_KINDS, value['kind']);
32
+ if (kind == null)
33
+ return null;
34
+ const rate = value['returnRate'];
35
+ return {
36
+ id: value['id'],
37
+ kind,
38
+ name: typeof value['name'] === 'string' ? value['name'] : '',
39
+ type: aus(DEPOSIT_TYPES, value['type']),
40
+ amounts: Array.isArray(value['amounts']) ? value['amounts'].map(betrag).filter((b) => b != null) : [],
41
+ returnRate: typeof rate === 'number' && Number.isFinite(rate) ? rate : null,
42
+ used: value['used'] === true,
43
+ active: value['active'] !== false,
44
+ };
45
+ }
46
+ /**
47
+ * Den Block `deposit` einer Antwort lesen. Kein Objekt (Pfand aus, alter
48
+ * Server) -> `undefined`: das Feld fehlt dann am Modell, es wird nichts erfunden.
49
+ * Eine Pfandart in unbekannter Form faellt weg.
50
+ */
51
+ export function posDepositSettingsFromWire(value) {
52
+ if (!istObjekt(value))
53
+ return undefined;
54
+ return {
55
+ singleUse: value['singleUse'] === true,
56
+ reusable: value['reusable'] === true,
57
+ depositTypes: Array.isArray(value['depositTypes']) ? value['depositTypes'].map(pfandart).filter((a) => a != null) : [],
58
+ };
59
+ }
60
+ /** Die Pfandliste eines Artikels oder einer Gruppe; keine Liste -> `null`, unlesbare Eintraege fallen weg. */
61
+ export function depositEntriesFromWire(value) {
62
+ if (!Array.isArray(value))
63
+ return null;
64
+ const raus = [];
65
+ for (const e of value) {
66
+ if (!istObjekt(e) || typeof e['depositTypeId'] !== 'string' || e['depositTypeId'] === '' || !istGanz(e['quantity'], 1))
67
+ continue;
68
+ raus.push({
69
+ depositTypeId: e['depositTypeId'],
70
+ quantity: e['quantity'],
71
+ ...(typeof e['gtin'] === 'string' && e['gtin'] !== '' ? { gtin: e['gtin'] } : {}),
72
+ ...(typeof e['ownFilling'] === 'boolean' ? { ownFilling: e['ownFilling'] } : {}),
73
+ });
74
+ }
75
+ return raus;
76
+ }
77
+ /** Die Pfand-Angaben eines Kassenobjekts; fehlt der Block oder ist er unbrauchbar -> `undefined`. */
78
+ export function cashRegisterDepositFromWire(value) {
79
+ if (!istObjekt(value))
80
+ return undefined;
81
+ const returns = aus(DEPOSIT_RETURN_MODES, value['returns']);
82
+ const onPremisesDefault = aus(DEPOSIT_ON_PREMISES_DEFAULTS, value['onPremisesDefault']);
83
+ if (returns == null || onPremisesDefault == null)
84
+ return undefined;
85
+ const stelle = value['sharedReturnPoint'];
86
+ return {
87
+ returns,
88
+ onPremisesDefault,
89
+ usualQuantity: istGanz(value['usualQuantity'], 1) ? value['usualQuantity'] : 1,
90
+ sharedReturnPoint: istObjekt(stelle) && typeof stelle['name'] === 'string'
91
+ ? { name: stelle['name'], address: typeof stelle['address'] === 'string' ? stelle['address'] : '' }
92
+ : null,
93
+ };
94
+ }
95
+ // ---------------------------------------------------------------------------------------------------------------
96
+ // Vorschau-Rechnung: dieselben Pfand- und Leergutzeilen wie der Server (`createReceipt`), damit der Korb sie vor
97
+ // dem Buchen zeigt. Vertrag sind die Pruefaelle `fixtures/deposit-cases.json` (Backend `pfand-faelle.json`).
98
+ // ---------------------------------------------------------------------------------------------------------------
99
+ /** EWP-GTIN der Einweg-Pfandzeile (gesetzlich festgelegt). */
100
+ const EWP_GTIN = '9010945000011';
101
+ /** Pfandangaben, wirksam fuer einen Artikel: Artikel vor Gruppe, `[]` = kein Pfand, `null`/fehlend = wie die Gruppe. */
102
+ export function depositsFor(article, group) {
103
+ if (article == null)
104
+ return [];
105
+ if (article.externalVoucher != null)
106
+ return []; // fremde Gutscheine tragen nie Pfand, auch nicht von der Gruppe
107
+ if (Array.isArray(article.deposits))
108
+ return article.deposits;
109
+ if (group != null && Array.isArray(group.deposits))
110
+ return group.deposits;
111
+ return [];
112
+ }
113
+ /** Pfandbetrag in Cent am Wiener Tag `day` (`YYYY-MM-DD`): letzter Eintrag mit `from <= day`, sonst `null`. */
114
+ export function depositAmountOn(type, day) {
115
+ let cents = null;
116
+ for (const e of type.amounts) {
117
+ if (e.from <= day)
118
+ cents = e.cents;
119
+ else
120
+ break;
121
+ }
122
+ return cents;
123
+ }
124
+ const tagFormat = new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Vienna', year: 'numeric', month: '2-digit', day: '2-digit' });
125
+ /** Wiener Kalendertag `YYYY-MM-DD` zum Zeitpunkt `nowMs` (nie der UTC-Tag). */
126
+ export function viennaDay(nowMs) {
127
+ const teile = {};
128
+ for (const t of tagFormat.formatToParts(new Date(nowMs)))
129
+ teile[t.type] = t.value;
130
+ return `${teile['year']}-${teile['month']}-${teile['day']}`;
131
+ }
132
+ const istObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
133
+ const ganz = (v, min, max) => Number.isInteger(v) && v >= min && v <= max;
134
+ const nachId = (karte, id) => {
135
+ if (karte instanceof Map)
136
+ return karte.get(id);
137
+ return Object.prototype.hasOwnProperty.call(karte, id) ? karte[id] : undefined;
138
+ };
139
+ const fehler = (code) => ({ ok: false, code });
140
+ const OHNE_PFAND = ['tip', 'discount', 'voucher', 'voucher_float', 'deposit', 'deposit_return'];
141
+ const istHaupt = (it) => istObj(it) && !OHNE_PFAND.includes(it['kind']);
142
+ const mengeVon = (it) => (it['amount'] !== undefined && it['amount'] !== null ? it['amount'] : it['quantity']);
143
+ const satzVon = (it) => (it['vat'] !== undefined && it['vat'] !== null ? it['vat'] : it['vatRate']);
144
+ const hatVerweis = (it) => it['addOnOf'] !== undefined && it['addOnOf'] !== null;
145
+ const aktiv = (arten, id) => {
146
+ const a = typeof id === 'string' ? nachId(arten, id) : undefined;
147
+ return a && a.active !== false ? a : null;
148
+ };
149
+ function zeile(kind, art, name, quantity, cents, vatRate) {
150
+ return {
151
+ kind, name, quantity, amount: quantity,
152
+ unitPriceCents: cents, priceOneCents: cents, priceOne: cents / 100, vatRate, vat: vatRate,
153
+ depositTypeId: art.id, depositKind: art.kind,
154
+ };
155
+ }
156
+ function pfandPreis(art, haupt, day, smallBusiness) {
157
+ const cents = depositAmountOn(art, day);
158
+ if (cents === null)
159
+ return null;
160
+ if (art.kind === 'single_use')
161
+ return { cents, vatRate: 0 };
162
+ if (smallBusiness)
163
+ return { cents, vatRate: 0 };
164
+ const satz = satzVon(haupt);
165
+ return typeof satz === 'number' && Number.isFinite(satz) ? { cents, vatRate: satz } : null;
166
+ }
167
+ function abgeleitet(it, input) {
168
+ if (!input.auto || !istHaupt(it) || typeof it['articleId'] !== 'string' || it['articleId'] === '')
169
+ return [];
170
+ const a = nachId(input.articles, it['articleId']);
171
+ if (!a)
172
+ return [];
173
+ const g = a.groupId ? nachId(input.groups, a.groupId) : null;
174
+ return depositsFor(a, g);
175
+ }
176
+ function gtinOk(v) {
177
+ return typeof v === 'string' && Gtin.isValid(v);
178
+ }
179
+ function leergut(it, input) {
180
+ if (!input.cashRegister || input.cashRegister.returns !== 'here')
181
+ return fehler('deposit_return_not_offered');
182
+ if (input.mayReturn === false)
183
+ return fehler('not_permitted');
184
+ const art = aktiv(input.depositTypes, it['depositTypeId']);
185
+ if (!art)
186
+ return fehler('deposit_type_not_found');
187
+ if (art.kind === 'reusable' && art.used !== true)
188
+ return fehler('deposit_type_not_issued');
189
+ const quantity = it['quantity'];
190
+ if (!ganz(quantity, 1, 1000))
191
+ return fehler('invalid_deposit');
192
+ let codes;
193
+ if (it['codes'] !== undefined && it['codes'] !== null) {
194
+ if (!istObj(it['codes']))
195
+ return fehler('invalid_deposit');
196
+ const schluessel = Object.keys(it['codes']);
197
+ if (schluessel.length > 50)
198
+ return fehler('invalid_deposit');
199
+ let summe = 0;
200
+ for (const k of schluessel) {
201
+ const n = it['codes'][k];
202
+ if (!gtinOk(k) || !ganz(n, 1, 1000))
203
+ return fehler('invalid_deposit');
204
+ summe += n;
205
+ }
206
+ if (summe !== quantity)
207
+ return fehler('invalid_deposit');
208
+ codes = { ...it['codes'] };
209
+ }
210
+ const cents = depositAmountOn(art, input.day);
211
+ if (cents === null)
212
+ return fehler('invalid_deposit');
213
+ // Mehrweg-Leergut rechnet mit dem Rueckgabesatz der Pfandart (`returnRate` = Steuersatz), bei Kleinunternehmern 0.
214
+ let vatRate = 0;
215
+ if (art.kind === 'reusable' && !input.smallBusiness) {
216
+ if (art.returnRate === null || !Number.isFinite(art.returnRate))
217
+ return fehler('invalid_deposit');
218
+ vatRate = art.returnRate;
219
+ }
220
+ const z = zeile('deposit_return', art, 'Leergut ' + art.name.replace(/^Pfand /, ''), quantity, -cents, vatRate);
221
+ if (art.kind === 'single_use')
222
+ z['ean'] = EWP_GTIN;
223
+ if (codes)
224
+ z['codes'] = codes;
225
+ return { ok: true, line: z };
226
+ }
227
+ /**
228
+ * Pfand- und Leergutzeilen eines Belegs wie der Server: leitet Pfand zu Artikeln ab (`auto`), prueft ausdrueckliche
229
+ * `deposit`-Zeilen und `deposit_return`-Zeilen und rechnet `addOnOf` und `depositFor` auf die neuen Positionen um.
230
+ * Ohne Pfand-/Leergutzeile und ohne Ableitung kommen die Positionen unveraendert zurueck. Die Fehlercodes sind die
231
+ * von `createReceipt`.
232
+ */
233
+ export function withDepositLines(items, input) {
234
+ const liste = Array.isArray(items) ? items : [];
235
+ const dahinter = new Map();
236
+ const ersetzt = new Map();
237
+ const hinzu = (i, z) => { dahinter.set(i, [...(dahinter.get(i) ?? []), z]); };
238
+ for (let i = 0; i < liste.length; i += 1) {
239
+ const it = liste[i];
240
+ if (!istObj(it))
241
+ continue;
242
+ if (it['kind'] === 'deposit_return') {
243
+ const r = leergut(it, input);
244
+ if (!r.ok)
245
+ return r;
246
+ ersetzt.set(i, r.line);
247
+ continue;
248
+ }
249
+ if (it['kind'] === 'deposit') {
250
+ const verweis = it['depositFor'];
251
+ const haupt = Number.isInteger(verweis) ? liste[verweis] : null;
252
+ if (!istHaupt(haupt))
253
+ return fehler('invalid_deposit');
254
+ if (abgeleitet(haupt, input).length > 0)
255
+ return fehler('deposit_set_by_server');
256
+ const art = aktiv(input.depositTypes, it['depositTypeId']);
257
+ if (!art)
258
+ return fehler('deposit_type_not_found');
259
+ const menge = mengeVon(haupt);
260
+ if (!Number.isInteger(menge) || menge === 0)
261
+ return fehler('invalid_deposit_quantity');
262
+ const quantity = it['quantity'] === undefined || it['quantity'] === null ? menge : it['quantity'];
263
+ if (!Number.isInteger(quantity) || quantity % menge !== 0 || quantity / menge < 1)
264
+ return fehler('invalid_deposit_quantity');
265
+ const preis = pfandPreis(art, haupt, input.day, input.smallBusiness);
266
+ if (!preis)
267
+ return fehler('invalid_deposit');
268
+ const hatGtin = it['gtin'] !== undefined && it['gtin'] !== null;
269
+ if (hatGtin && !gtinOk(it['gtin']))
270
+ return fehler('invalid_deposit');
271
+ if (it['ownFilling'] !== undefined && it['ownFilling'] !== null && typeof it['ownFilling'] !== 'boolean')
272
+ return fehler('invalid_deposit');
273
+ if (it['ownFilling'] === true && !hatGtin)
274
+ return fehler('invalid_deposit');
275
+ const q = quantity;
276
+ const z = zeile('deposit', art, art.name, q, preis.cents, preis.vatRate);
277
+ z['depositFor'] = verweis;
278
+ z['perUnit'] = q / menge;
279
+ if (art.kind === 'single_use')
280
+ z['ean'] = EWP_GTIN;
281
+ if (hatGtin)
282
+ z['gtin'] = it['gtin'];
283
+ if (it['ownFilling'] === true)
284
+ z['ownFilling'] = true;
285
+ ersetzt.set(i, z);
286
+ continue;
287
+ }
288
+ const eintraege = abgeleitet(it, input);
289
+ if (!eintraege.length)
290
+ continue;
291
+ const menge = mengeVon(it);
292
+ const gelten = [];
293
+ for (const e of eintraege) {
294
+ const art = aktiv(input.depositTypes, e.depositTypeId);
295
+ if (!art)
296
+ return fehler('deposit_type_not_found');
297
+ if (art.kind === 'single_use' && input.onPremises === true)
298
+ continue;
299
+ gelten.push({ e, art });
300
+ }
301
+ if (!gelten.length)
302
+ continue;
303
+ if (!Number.isInteger(menge))
304
+ return fehler('invalid_deposit_quantity');
305
+ if (menge === 0)
306
+ continue;
307
+ for (const { e, art } of gelten) {
308
+ const preis = pfandPreis(art, it, input.day, input.smallBusiness);
309
+ if (!preis)
310
+ return fehler('invalid_deposit');
311
+ const z = zeile('deposit', art, art.name, e.quantity * menge, preis.cents, preis.vatRate);
312
+ z['depositFor'] = i;
313
+ z['perUnit'] = e.quantity;
314
+ if (art.kind === 'single_use')
315
+ z['ean'] = EWP_GTIN;
316
+ if (e.gtin)
317
+ z['gtin'] = e.gtin;
318
+ if (e.ownFilling === true)
319
+ z['ownFilling'] = true;
320
+ hinzu(i, z);
321
+ }
322
+ }
323
+ if (!ersetzt.size && !dahinter.size)
324
+ return { ok: true, items: [...liste] };
325
+ const neu = [];
326
+ let verschiebung = 0;
327
+ liste.forEach((_, i) => { neu.push(i + verschiebung); verschiebung += dahinter.get(i)?.length ?? 0; });
328
+ const umgerechnet = (v) => (typeof v === 'number' && Number.isInteger(v) ? neu[v] : undefined);
329
+ const raus = [];
330
+ liste.forEach((it, i) => {
331
+ if (!istObj(it)) {
332
+ raus.push(it);
333
+ return;
334
+ }
335
+ let z = ersetzt.get(i) ?? it;
336
+ if (z['kind'] === 'deposit' && umgerechnet(z['depositFor']) !== undefined)
337
+ z = { ...z, depositFor: umgerechnet(z['depositFor']) };
338
+ else if (hatVerweis(z) && umgerechnet(z['addOnOf']) !== undefined)
339
+ z = { ...z, addOnOf: umgerechnet(z['addOnOf']) };
340
+ raus.push(z);
341
+ for (const d of dahinter.get(i) ?? [])
342
+ raus.push({ ...d, depositFor: neu[i] });
343
+ });
344
+ return { ok: true, items: raus };
345
+ }
346
+ /**
347
+ * Die Leergutzeile zu `quantity` Stueck einer Pfandart, wie `withDepositLines` sie fuer eine
348
+ * `deposit_return`-Eingabe baut (fuer die Korb-Vorschau). Wirft, wenn sich keine Zeile ergibt
349
+ * (unbekannte Pfandart, Menge ausserhalb 1 bis 1000, Mehrweg ohne Rueckgabesatz, ungueltige Codes);
350
+ * ob die Kasse Leergut annimmt, prueft der Aufrufer.
351
+ */
352
+ export function depositReturnLine(type, quantity, options) {
353
+ const r = leergut({ kind: 'deposit_return', depositTypeId: type.id, quantity, ...(options.codes ? { codes: options.codes } : {}) }, { depositTypes: { [type.id]: type }, day: options.day, smallBusiness: options.smallBusiness, cashRegister: { returns: 'here' }, mayReturn: true });
354
+ if (!r.ok)
355
+ throw new Error(`Leergutzeile nicht moeglich: ${r.code}`);
356
+ const l = r.line;
357
+ const item = {
358
+ name: l['name'],
359
+ quantity: l['quantity'],
360
+ vat: readVatRateByRate(l['vatRate']),
361
+ priceCents: l['unitPriceCents'],
362
+ kind: 'deposit_return',
363
+ depositTypeId: l['depositTypeId'],
364
+ depositKind: type.kind,
365
+ };
366
+ if (typeof l['ean'] === 'string')
367
+ item.ean = l['ean'];
368
+ if (l['codes'] !== undefined)
369
+ item.codes = l['codes'];
370
+ return item;
371
+ }
@@ -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
  /**