@kreiseck/kasseneck-api 1.27.0 → 1.29.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 +27 -0
- package/README.md +84 -0
- package/dist/cjs/client/api.d.ts +15 -0
- package/dist/cjs/client/api.js +8 -0
- package/dist/cjs/client/aufrufe.d.ts +4 -4
- package/dist/cjs/client/aufrufe.js +31 -0
- package/dist/cjs/client/index.d.ts +1 -0
- package/dist/cjs/client/index.js +17 -1
- package/dist/cjs/client/terminal.d.ts +206 -0
- package/dist/cjs/client/terminal.js +288 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +17 -1
- package/dist/cjs/pos/aufrunden.d.ts +6 -0
- package/dist/cjs/pos/aufrunden.js +59 -0
- package/dist/cjs/pos/client.js +12 -1
- package/dist/cjs/pos/index.d.ts +4 -3
- package/dist/cjs/pos/index.js +17 -4
- package/dist/cjs/pos/schicht-lesen.d.ts +2 -1
- package/dist/cjs/pos/schicht-lesen.js +48 -1
- package/dist/cjs/pos/schicht-typen.d.ts +106 -3
- package/dist/cjs/pos/schicht-typen.js +14 -4
- package/dist/cjs/pos/schicht.d.ts +28 -2
- package/dist/cjs/pos/schicht.js +19 -0
- package/dist/cjs/pos/settings.d.ts +39 -0
- package/dist/cjs/pos/settings.js +65 -4
- package/dist/cjs/pos/texte.d.ts +292 -0
- package/dist/cjs/pos/texte.js +108 -0
- package/dist/cjs/receipt/shift-sheet.js +29 -0
- package/dist/cjs/stored/einstellungen.js +31 -4
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +29 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/api.d.ts +15 -0
- package/dist/esm/client/api.js +8 -0
- package/dist/esm/client/aufrufe.d.ts +4 -4
- package/dist/esm/client/aufrufe.js +31 -0
- package/dist/esm/client/index.d.ts +1 -0
- package/dist/esm/client/index.js +1 -0
- package/dist/esm/client/terminal.d.ts +206 -0
- package/dist/esm/client/terminal.js +278 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/pos/aufrunden.d.ts +6 -0
- package/dist/esm/pos/aufrunden.js +56 -0
- package/dist/esm/pos/client.js +13 -2
- package/dist/esm/pos/index.d.ts +4 -3
- package/dist/esm/pos/index.js +5 -4
- package/dist/esm/pos/schicht-lesen.d.ts +2 -1
- package/dist/esm/pos/schicht-lesen.js +47 -1
- package/dist/esm/pos/schicht-typen.d.ts +106 -3
- package/dist/esm/pos/schicht-typen.js +13 -3
- package/dist/esm/pos/schicht.d.ts +28 -2
- package/dist/esm/pos/schicht.js +19 -1
- package/dist/esm/pos/settings.d.ts +39 -0
- package/dist/esm/pos/settings.js +60 -3
- package/dist/esm/pos/texte.d.ts +292 -0
- package/dist/esm/pos/texte.js +108 -0
- package/dist/esm/receipt/shift-sheet.js +29 -0
- package/dist/esm/stored/einstellungen.js +32 -5
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +29 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/duplicate-cases.json +6 -0
- package/fixtures/expected/duplicate.shift-close.hex +28 -27
- package/fixtures/expected/shift-close-blind.grid32.txt +1 -0
- package/fixtures/expected/shift-close-blind.grid48.txt +1 -0
- package/fixtures/expected/shift-close-blind.lines.json +6 -0
- package/fixtures/expected/shift-close-put-in.grid32.txt +1 -0
- package/fixtures/expected/shift-close-put-in.grid48.txt +1 -0
- package/fixtures/expected/shift-close-put-in.lines.json +6 -0
- package/fixtures/expected/shift-close-take-out.grid32.txt +1 -0
- package/fixtures/expected/shift-close-take-out.grid48.txt +1 -0
- package/fixtures/expected/shift-close-take-out.lines.json +6 -0
- package/fixtures/expected/shift-close.grid32.txt +1 -0
- package/fixtures/expected/shift-close.grid48.txt +1 -0
- package/fixtures/expected/shift-close.lines.json +6 -0
- package/fixtures/expected/shift-interim.grid32.txt +1 -0
- package/fixtures/expected/shift-interim.grid48.txt +1 -0
- package/fixtures/expected/shift-interim.lines.json +6 -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/pos-texts.json +337 -1
- package/fixtures/renames-1.0.json +30 -0
- package/fixtures/shift-ablauf-cases.json +182 -0
- package/fixtures/shift-receipts.json +15 -15
- package/fixtures/surface.json +59 -4
- package/fixtures/tip-round-up-cases.json +27 -0
- package/fixtures/v3/antworten/belege.json +2 -2
- package/fixtures/v3/antworten/belegmail.json +2 -2
- package/fixtures/v3/antworten/berichte.json +2 -2
- package/fixtures/v3/antworten/kasse-belege.json +2 -2
- package/fixtures/v3/antworten/kasse.json +504 -4
- package/fixtures/v3/antworten/lager.json +1 -1
- 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 +520 -12
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +184 -11
- package/fixtures/v3/zahlbetrag-faelle.json +2 -2
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ exports.schichtBon = schichtBon;
|
|
|
21
21
|
exports.bewegungsBon = bewegungsBon;
|
|
22
22
|
exports.abschluss = abschluss;
|
|
23
23
|
exports.geoeffnet = geoeffnet;
|
|
24
|
+
exports.gezaehlt = gezaehlt;
|
|
24
25
|
exports.gebucht = gebucht;
|
|
25
26
|
exports.gemeldet = gemeldet;
|
|
26
27
|
exports.bericht = bericht;
|
|
@@ -130,7 +131,7 @@ function trinkgeldMitOffen(ort, w) {
|
|
|
130
131
|
}
|
|
131
132
|
function laufstand(ort, w) {
|
|
132
133
|
const o = pflichtObjekt(ort, w);
|
|
133
|
-
|
|
134
|
+
const raus = {
|
|
134
135
|
cashSalesCents: ganzzahl(ort, o, 'cashSalesCents'),
|
|
135
136
|
cashCancellationsCents: ganzzahl(ort, o, 'cashCancellationsCents'),
|
|
136
137
|
nonCashByMethod: liste(ort, o, 'nonCashByMethod', unbar),
|
|
@@ -143,6 +144,16 @@ function laufstand(ort, w) {
|
|
|
143
144
|
tips: liste(ort, o, 'tips', trinkgeld),
|
|
144
145
|
openingsWithoutSale: ganzzahl(ort, o, 'openingsWithoutSale'),
|
|
145
146
|
};
|
|
147
|
+
// Nur Anzeige (1.28.0); der Server sendet beides nur, wenn es etwas gibt -- gelesen wie gesendet.
|
|
148
|
+
if (o.ownerTips !== undefined && o.ownerTips !== null)
|
|
149
|
+
raus.ownerTips = liste(ort, o, 'ownerTips', inhaberTrinkgeld);
|
|
150
|
+
if (o.unassignedTipCents !== undefined && o.unassignedTipCents !== null)
|
|
151
|
+
raus.unassignedTipCents = ganzzahl(ort, o, 'unassignedTipCents');
|
|
152
|
+
return raus;
|
|
153
|
+
}
|
|
154
|
+
function inhaberTrinkgeld(ort, w) {
|
|
155
|
+
const o = pflichtObjekt(ort, w);
|
|
156
|
+
return { registerUserId: kennung(ort, o, 'registerUserId'), name: text(o.name), cents: ganzzahl(ort, o, 'cents') };
|
|
146
157
|
}
|
|
147
158
|
/** Entnehmen oder Einlegen nach dem Zaehlen; die Art bleibt offen fuer kuenftige Werte (Text). */
|
|
148
159
|
function nachZaehlung(ort, w) {
|
|
@@ -165,6 +176,14 @@ function abgleich(ort, w) {
|
|
|
165
176
|
}
|
|
166
177
|
return { matches: wahr(ort, o, 'matches'), deviations };
|
|
167
178
|
}
|
|
179
|
+
function sollTeil(ort, w) {
|
|
180
|
+
const o = pflichtObjekt(ort, w);
|
|
181
|
+
return { key: kennung(ort, o, 'key'), cents: ganzzahl(ort, o, 'cents') };
|
|
182
|
+
}
|
|
183
|
+
function differenzTeil(ort, w) {
|
|
184
|
+
const o = pflichtObjekt(ort, w);
|
|
185
|
+
return { type: kennung(ort, o, 'type'), cents: ganzzahl(ort, o, 'cents'), at: text(o.at) };
|
|
186
|
+
}
|
|
168
187
|
/** Eine Schicht; was nur mit `cashView` kommt, steht nur, wenn gesendet. */
|
|
169
188
|
function schicht(ort, w) {
|
|
170
189
|
const o = pflichtObjekt(ort, w);
|
|
@@ -200,6 +219,14 @@ function schicht(ort, w) {
|
|
|
200
219
|
// Nur wenn beim Abschluss Geld entnommen oder eingelegt wurde.
|
|
201
220
|
wennWert(r, o, 'afterCount', () => nachZaehlung(unter(ort, 'afterCount'), o.afterCount));
|
|
202
221
|
wennWert(r, o, 'leftInDrawerCents', () => ganzzahl(ort, o, 'leftInDrawerCents'));
|
|
222
|
+
// Ablauf der Kasse: nur, wenn der Server sie sendet.
|
|
223
|
+
wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
|
|
224
|
+
wennWert(r, o, 'expectedParts', () => liste(ort, o, 'expectedParts', sollTeil));
|
|
225
|
+
wennWert(r, o, 'cashTipsInDrawerCents', () => ganzzahl(ort, o, 'cashTipsInDrawerCents'));
|
|
226
|
+
wennWert(r, o, 'interimCounts', () => ganzzahl(ort, o, 'interimCounts'));
|
|
227
|
+
wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
|
|
228
|
+
wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
|
|
229
|
+
wennWert(r, o, 'countedBeforePayoutCents', () => ganzzahl(ort, o, 'countedBeforePayoutCents'));
|
|
203
230
|
return raus;
|
|
204
231
|
}
|
|
205
232
|
function schichtOderNull(ort, w) {
|
|
@@ -220,6 +247,12 @@ function oeffnung(ort, w) {
|
|
|
220
247
|
ok: wahr(ort, o, 'ok'),
|
|
221
248
|
};
|
|
222
249
|
}
|
|
250
|
+
function letzteSchicht(ort, w) {
|
|
251
|
+
if (w === null)
|
|
252
|
+
return null;
|
|
253
|
+
const o = pflichtObjekt(ort, w);
|
|
254
|
+
return { number: ganzzahl(ort, o, 'number'), closedAt: kennung(ort, o, 'closedAt'), closedByName: text(o.closedByName) };
|
|
255
|
+
}
|
|
223
256
|
function ladeStand(ort, w) {
|
|
224
257
|
const o = pflichtObjekt(ort, w);
|
|
225
258
|
const lade = pflichtObjekt(unter(ort, 'drawer'), o.drawer);
|
|
@@ -249,6 +282,8 @@ function ladeStand(ort, w) {
|
|
|
249
282
|
wennDa(r, o, 'expectedCents', () => ganzzahlOderNull(ort, o, 'expectedCents'));
|
|
250
283
|
wennDa(r, o, 'recentOpenings', () => liste(ort, o, 'recentOpenings', oeffnung));
|
|
251
284
|
wennWert(r, o, 'suggestedFromShiftNumber', () => ganzzahl(ort, o, 'suggestedFromShiftNumber'));
|
|
285
|
+
// Letzte Schicht der Lade: `null` ist eine Aussage („keine“), darum bleibt es stehen.
|
|
286
|
+
wennDa(r, o, 'lastShift', () => (o.lastShift === undefined ? null : letzteSchicht(unter(ort, 'lastShift'), o.lastShift)));
|
|
252
287
|
// Wechselgeld der Lade: nur wenn eingestellt.
|
|
253
288
|
wennWert(raus.drawer, lade, 'changeFloatCents', () => ganzzahl(ladeOrt, lade, 'changeFloatCents'));
|
|
254
289
|
return raus;
|
|
@@ -335,6 +370,12 @@ function schichtBon(ort, w) {
|
|
|
335
370
|
const r = raus;
|
|
336
371
|
wennWert(r, o, 'afterCount', () => nachZaehlung(unter(ort, 'afterCount'), o.afterCount));
|
|
337
372
|
wennDa(r, o, 'leftInDrawerCents', () => ganzzahlOderNull(ort, o, 'leftInDrawerCents'));
|
|
373
|
+
// Ablauf der Kasse: nur, wenn der Server sie sendet (die Bons davor tragen sie nicht).
|
|
374
|
+
wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
|
|
375
|
+
wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
|
|
376
|
+
wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
|
|
377
|
+
wennDa(r, o, 'countedBeforePayoutCents', () => ganzzahlOderNull(ort, o, 'countedBeforePayoutCents'));
|
|
378
|
+
wennDa(r, o, 'countedBeforePayoutDenominations', () => stueckelung(ort, o, 'countedBeforePayoutDenominations'));
|
|
338
379
|
return raus;
|
|
339
380
|
}
|
|
340
381
|
/** Bon-Daten einer Kassenbewegung; eine andere Art ist ein Fehler. */
|
|
@@ -387,6 +428,12 @@ function geoeffnet(ort, w) {
|
|
|
387
428
|
wennDa(raus, o, 'handoverDifferenceCents', () => ganzzahlOderNull(ort, o, 'handoverDifferenceCents'));
|
|
388
429
|
return raus;
|
|
389
430
|
}
|
|
431
|
+
function gezaehlt(ort, w) {
|
|
432
|
+
const o = pflichtObjekt(ort, w);
|
|
433
|
+
const z = pflichtObjekt(unter(ort, 'count'), o.count);
|
|
434
|
+
const zOrt = unter(ort, 'count');
|
|
435
|
+
return { count: { expectedCents: ganzzahl(zOrt, z, 'expectedCents'), countedCents: ganzzahl(zOrt, z, 'countedCents'), differenceCents: ganzzahl(zOrt, z, 'differenceCents') } };
|
|
436
|
+
}
|
|
390
437
|
function gebucht(ort, w) {
|
|
391
438
|
const o = pflichtObjekt(ort, w);
|
|
392
439
|
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
|
|
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;
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
* (`{ "2000": 1, "500": 3 }`).
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.SHIFT_RECEIPT_KINDS = exports.AFTER_COUNT_TYPES = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = void 0;
|
|
18
|
+
exports.DIFFERENCE_PART_TYPES = exports.EXPECTED_PART_KEYS = exports.SHIFT_RECEIPT_KINDS = exports.AFTER_COUNT_TYPES = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = void 0;
|
|
19
19
|
/** Scheine und Muenzen in Euro-Cent, vom groessten Schein abwaerts (Backend `EUR_STUECKELUNG`). */
|
|
20
20
|
exports.EUR_DENOMINATIONS = Object.freeze([50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1]);
|
|
21
21
|
/**
|
|
22
22
|
* Alle Arten einer Kassenbewegung (Katalog `KASSEN_BEWEGUNG_ART`). Die ersten
|
|
23
23
|
* acht sendet die Kasse ([MANUAL_MOVEMENT_TYPES]); `transfer_in` (Gegenseite
|
|
24
|
-
* einer Umbuchung), `expense`, `count_difference
|
|
25
|
-
* vergibt nur der Server.
|
|
24
|
+
* einer Umbuchung), `expense`, `count_difference`, `handover_difference` und
|
|
25
|
+
* `interim_difference` (Differenz einer Zwischenzaehlung) vergibt nur der Server.
|
|
26
26
|
*/
|
|
27
27
|
exports.MOVEMENT_TYPES = Object.freeze([
|
|
28
28
|
'change_in', 'cash_drop', 'owner_deposit', 'owner_withdrawal', 'tip_payout', 'other_in', 'other_out', 'transfer_out',
|
|
29
|
-
'transfer_in', 'expense', 'count_difference', 'handover_difference',
|
|
29
|
+
'transfer_in', 'expense', 'count_difference', 'handover_difference', 'interim_difference',
|
|
30
30
|
]);
|
|
31
31
|
/**
|
|
32
32
|
* Was die Kasse von Hand buchen darf. Pflichtangaben je Art (sonst lehnt der
|
|
@@ -57,3 +57,13 @@ exports.MANUAL_OPENING_REASONS = Object.freeze(['change', 'check', 'misoperation
|
|
|
57
57
|
exports.AFTER_COUNT_TYPES = Object.freeze(['cash_drop', 'change_in']);
|
|
58
58
|
/** Arten der Bon-Daten (Katalog `SCHICHT_BON_ART`): Z-Bon, X-Bon, Kassenbewegung. */
|
|
59
59
|
exports.SHIFT_RECEIPT_KINDS = Object.freeze(['shift_close', 'shift_interim', 'cash_movement']);
|
|
60
|
+
/**
|
|
61
|
+
* Wie sich das Soll in der Lade zusammensetzt (`Shift.expectedParts`, Karte „So setzt sich das zusammen“):
|
|
62
|
+
* Anfang, Barverkaeufe, Trinkgeld bar, Storno bar, Einzahlungen, Ausgaben aus der Lade und die
|
|
63
|
+
* Summe der Zwischenzaehlungs-Differenzen. Die Summe der Teile ist das Soll.
|
|
64
|
+
*/
|
|
65
|
+
exports.EXPECTED_PART_KEYS = Object.freeze([
|
|
66
|
+
'opening', 'cash_sales', 'cash_tips', 'cancellations', 'cash_in', 'cash_out', 'interim_difference',
|
|
67
|
+
]);
|
|
68
|
+
/** Teile der Gesamtdifferenz einer geschlossenen Schicht mit Zwischenzaehlung: `interim` je Zaehlung, `closing` der Abschluss. */
|
|
69
|
+
exports.DIFFERENCE_PART_TYPES = Object.freeze(['interim', 'closing']);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { InternerTransport } from '../client/aufrufe.js';
|
|
2
|
-
import { type AfterCountType, type CashLocation, type CashMovementResult, type CloseShiftResult, type Denominations, type DrawerOpeningsResult, type DrawerState, type ManualMovementType, type OpeningReason, type OpenShiftResult, type ShiftReport, type ShiftTipTotals } from './schicht-typen.js';
|
|
2
|
+
import { type AfterCountType, type CashLocation, type CashMovementResult, type CloseShiftResult, type Denominations, type DrawerOpeningsResult, type DrawerState, type ManualMovementType, type OpeningReason, type OpenShiftResult, type ShiftCountResult, type ShiftReport, type ShiftTipTotals } from './schicht-typen.js';
|
|
3
3
|
/**
|
|
4
4
|
* Schicht, Kassenstand und Lade-Protokoll an der Kasse (Backend
|
|
5
|
-
* schicht-endpoints.js). Alle
|
|
5
|
+
* schicht-endpoints.js). Alle sieben Aufrufe gibt es nur ueber den Kassenweg
|
|
6
6
|
* `/api/v3`; sie laufen mit dem Kassen-Benutzer-Weg (`registerUserAuth`).
|
|
7
7
|
*
|
|
8
8
|
* Rechte am Server: `shift` (Schicht oeffnen und schliessen, Bericht),
|
|
@@ -125,6 +125,26 @@ export interface CloseMyShiftOptions {
|
|
|
125
125
|
* danach derselbe Betrag, gilt er als dieselbe Zaehlung.
|
|
126
126
|
*/
|
|
127
127
|
checkOnly?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* `countedCents` ist der Stand **vor** den Trinkgeld-Auszahlungen derselben Anfrage: die
|
|
130
|
+
* Kasse zaehlt zuerst, zahlt dann aus. Der Server speichert den Rohwert (Antwort:
|
|
131
|
+
* `shift.countedBeforePayoutCents`, auf dem Bon „Gezaehlt“) und rechnet Ist und Differenz
|
|
132
|
+
* mit dem Stand nach der Auszahlung. Ohne die Angabe zaehlt der Betrag wie bisher als Ist.
|
|
133
|
+
*/
|
|
134
|
+
countedBeforePayout?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Zwischenzaehlung waehrend der Schicht ([recordMyShiftCount], Recht `cashView`): der Kassenstand
|
|
138
|
+
* wird gezaehlt, ohne die Schicht zu schliessen.
|
|
139
|
+
*/
|
|
140
|
+
export interface RecordMyShiftCountOptions {
|
|
141
|
+
idempotencyKey: string;
|
|
142
|
+
shiftId: string;
|
|
143
|
+
/** Gezaehltes Bargeld in Cent (`0` erlaubt). */
|
|
144
|
+
countedCents: number;
|
|
145
|
+
denominations?: Denominations | null;
|
|
146
|
+
/** Freitext zur Zaehlung (z. B. Grund einer Abweichung). */
|
|
147
|
+
comment?: string;
|
|
128
148
|
}
|
|
129
149
|
/** Entnehmen oder Einlegen beim Abschluss (siehe [CloseMyShiftOptions.afterCount]). */
|
|
130
150
|
export interface AfterCountOption {
|
|
@@ -148,6 +168,12 @@ export declare function getMyShiftReport(transport: InternerTransport, options:
|
|
|
148
168
|
* `checkOnly` nur pruefen: `status: 'ready'` statt Schliessen.
|
|
149
169
|
*/
|
|
150
170
|
export declare function closeMyShift(transport: InternerTransport, options: CloseMyShiftOptions): Promise<CloseShiftResult>;
|
|
171
|
+
/**
|
|
172
|
+
* Zwischenzaehlung festhalten (Recht `cashView`, ohne es `not_permitted`): der Server vergleicht die Zaehlung mit dem Soll
|
|
173
|
+
* und haelt die Differenz fest, die Schicht bleibt offen. Antwort: Soll, Zaehlung und Differenz
|
|
174
|
+
* dieser Zaehlung. Derselbe `idempotencyKey` ergibt dieselbe Antwort und keinen zweiten Eintrag.
|
|
175
|
+
*/
|
|
176
|
+
export declare function recordMyShiftCount(transport: InternerTransport, options: RecordMyShiftCountOptions): Promise<ShiftCountResult>;
|
|
151
177
|
/**
|
|
152
178
|
* Summe einer Stueckelung in Cent, oder `null`, wenn sie keine ist: ein
|
|
153
179
|
* Schluessel, der kein Euro-Wert ist ([EUR_DENOMINATIONS], genau so
|
package/dist/cjs/pos/schicht.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.recordMyCashMovement = recordMyCashMovement;
|
|
|
6
6
|
exports.logMyDrawerOpenings = logMyDrawerOpenings;
|
|
7
7
|
exports.getMyShiftReport = getMyShiftReport;
|
|
8
8
|
exports.closeMyShift = closeMyShift;
|
|
9
|
+
exports.recordMyShiftCount = recordMyShiftCount;
|
|
9
10
|
exports.sumDenominations = sumDenominations;
|
|
10
11
|
exports.parseCentsAllowZero = parseCentsAllowZero;
|
|
11
12
|
exports.newIdempotencyKey = newIdempotencyKey;
|
|
@@ -117,6 +118,8 @@ async function closeMyShift(transport, options) {
|
|
|
117
118
|
}
|
|
118
119
|
if (p.checkOnly !== undefined && typeof p.checkOnly !== 'boolean')
|
|
119
120
|
throw anfragefehler(name, 'checkOnly muss true oder false sein');
|
|
121
|
+
if (p.countedBeforePayout !== undefined && typeof p.countedBeforePayout !== 'boolean')
|
|
122
|
+
throw anfragefehler(name, 'countedBeforePayout muss true oder false sein');
|
|
120
123
|
// Nur die Form: die Art (Katalog) und die Grenzen prueft der Server.
|
|
121
124
|
if (p.afterCount !== undefined && p.afterCount !== null) {
|
|
122
125
|
if (typeof p.afterCount !== 'object' || Array.isArray(p.afterCount))
|
|
@@ -125,6 +128,22 @@ async function closeMyShift(transport, options) {
|
|
|
125
128
|
}
|
|
126
129
|
return rufe(transport, name, p, schicht_lesen_js_1.abschluss);
|
|
127
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Zwischenzaehlung festhalten (Recht `cashView`, ohne es `not_permitted`): der Server vergleicht die Zaehlung mit dem Soll
|
|
133
|
+
* und haelt die Differenz fest, die Schicht bleibt offen. Antwort: Soll, Zaehlung und Differenz
|
|
134
|
+
* dieser Zaehlung. Derselbe `idempotencyKey` ergibt dieselbe Antwort und keinen zweiten Eintrag.
|
|
135
|
+
*/
|
|
136
|
+
async function recordMyShiftCount(transport, options) {
|
|
137
|
+
const name = 'recordMyShiftCount';
|
|
138
|
+
const p = (0, schreiben_js_1.anfrage)(name, options);
|
|
139
|
+
kennung(name, p, 'shiftId');
|
|
140
|
+
(0, schreiben_js_1.schluessel)(name, p, { pflicht: true });
|
|
141
|
+
cent(name, 'countedCents', p.countedCents);
|
|
142
|
+
stueckelungPruefen(name, p);
|
|
143
|
+
if (p.comment !== undefined && typeof p.comment !== 'string')
|
|
144
|
+
throw anfragefehler(name, 'comment muss ein Text sein');
|
|
145
|
+
return rufe(transport, name, p, schicht_lesen_js_1.gezaehlt);
|
|
146
|
+
}
|
|
128
147
|
// ---- Helfer der Kasse ---------------------------------------------------------
|
|
129
148
|
const ANZAHL_MAX = 100000;
|
|
130
149
|
const WERTE = new Set(schicht_typen_js_1.EUR_DENOMINATIONS.map(String));
|
|
@@ -22,6 +22,18 @@ export declare const QUANTITY: readonly ["off", "x", "kg"];
|
|
|
22
22
|
export type PosQuantity = typeof QUANTITY[number];
|
|
23
23
|
export declare const TIP_MODE: readonly ["amount", "total", "both"];
|
|
24
24
|
export type PosTipMode = typeof TIP_MODE[number];
|
|
25
|
+
/**
|
|
26
|
+
* Trinkgeld-Arten, die die Kasse anbietet (`business.tipKinds`): Prozent, Aufrunden
|
|
27
|
+
* (der Gast zahlt auf einen runden Betrag) und Gesamt (der Gast nennt den Betrag, den er insgesamt zahlt).
|
|
28
|
+
* `business.tipStart` ist die zuerst offene Art und liegt immer unter den angebotenen.
|
|
29
|
+
*/
|
|
30
|
+
export declare const TIP_KINDS: readonly ["percent", "round_up", "total"];
|
|
31
|
+
export type PosTipKind = typeof TIP_KINDS[number];
|
|
32
|
+
/** Die zuerst offene Trinkgeld-Art (`business.tipStart`): dieselben Werte wie [TIP_KINDS]. */
|
|
33
|
+
export declare const TIP_START: readonly ["percent", "round_up", "total"];
|
|
34
|
+
/** Breite der rechten Spalte (Korb) an diesem Geraet (`device.cartWidth`); in der schmalen Ansicht ohne Wirkung. */
|
|
35
|
+
export declare const CART_WIDTH: readonly ["narrow", "medium", "wide"];
|
|
36
|
+
export type PosCartWidth = typeof CART_WIDTH[number];
|
|
25
37
|
export declare const CHECKOUT_MODE: readonly ["page", "panel"];
|
|
26
38
|
export type PosCheckoutMode = typeof CHECKOUT_MODE[number];
|
|
27
39
|
/** Kartenanbieter: Karte gibt es erst mit eingerichtetem Anbieter; 'external' = eigenes Terminal ohne Anbindung. */
|
|
@@ -197,6 +209,14 @@ export interface PosBusinessSettings {
|
|
|
197
209
|
* Lesen ueber [posTipKeptByDefault]. Siehe [POS_BUSINESS_OPTIONAL_FIELDS].
|
|
198
210
|
*/
|
|
199
211
|
tipKeptByDefault?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Angebotene Trinkgeld-Arten (nichtleere Teilmenge von [TIP_KINDS], Reihenfolge wie
|
|
214
|
+
* gespeichert). Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es,
|
|
215
|
+
* gelten alle drei. Lesen ueber [posTipKinds]. `tipMode` folgt den Arten (der Server leitet ihn ab).
|
|
216
|
+
*/
|
|
217
|
+
tipKinds?: PosOpen<PosTipKind>[];
|
|
218
|
+
/** Zuerst offene Trinkgeld-Art; optional, fehlt sie, gilt Prozent (sonst die erste Art). Lesen ueber [posTipStart]. */
|
|
219
|
+
tipStart?: PosOpen<PosTipKind>;
|
|
200
220
|
}
|
|
201
221
|
/** Aktionen der Kasse, die eine Taste bekommen koennen (Schluessel von `device.shortcuts`). */
|
|
202
222
|
export declare const POS_SHORTCUT_ACTIONS: readonly ["checkout", "complete", "cancel", "customAmount", "cash", "card", "exactAmount", "receipts", "undoLast", "settings", "logout", "tip", "fullscreen", "clearTendered", "clearCart", "splitPayment", "shiftStatus", "openDrawer", "voucherPayout"];
|
|
@@ -256,6 +276,8 @@ export interface PosDeviceSettings {
|
|
|
256
276
|
* [POS_DEVICE_OPTIONAL_FIELDS].
|
|
257
277
|
*/
|
|
258
278
|
drawerId?: string | null;
|
|
279
|
+
/** Breite der rechten Spalte; optional, fehlt sie, gilt `narrow`. Lesen ueber [posCartWidth]. */
|
|
280
|
+
cartWidth?: PosOpen<PosCartWidth>;
|
|
259
281
|
terminalIp: string;
|
|
260
282
|
terminalPort: number;
|
|
261
283
|
terminalVia: PosOpen<PosTerminalVia>;
|
|
@@ -291,6 +313,23 @@ export declare function _optionalerWert(wert: unknown, schreiben: boolean): bool
|
|
|
291
313
|
* nimmt nur `true`/`false`.
|
|
292
314
|
*/
|
|
293
315
|
export declare const POS_BUSINESS_OPTIONAL_FIELDS: readonly ["tipKeptByDefault"];
|
|
316
|
+
/**
|
|
317
|
+
* Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
|
|
318
|
+
* `KASSE_BETRIEB_WERTE.tipKinds[]` und `.tipStart`): ohne Standardwert, der Server sendet sie nur,
|
|
319
|
+
* wenn sie gespeichert sind. [mergePosSettings] uebernimmt sie, wenn sie die Form haben
|
|
320
|
+
* (`tipKinds` eine nichtleere Liste von Texten, `tipStart` ein Text); den Wert prueft der Schreibweg.
|
|
321
|
+
*/
|
|
322
|
+
export declare const POS_BUSINESS_OPTIONAL_CHOICES: readonly ["tipKinds", "tipStart"];
|
|
323
|
+
/** Optionale Geraete-Einstellungen mit Wertemenge (Backend `GERAET_OPTIONAL`, Katalog `KASSE_GERAET_WERTE.cartWidth`). */
|
|
324
|
+
export declare const POS_DEVICE_OPTIONAL_CHOICES: readonly ["cartWidth"];
|
|
325
|
+
/** Hat der Wert die Form eines optionalen Wahlfeldes? Texte, die der Server neu einfuehren koennte, bleiben (kein Altwert 0.x). */
|
|
326
|
+
export declare function _optionalerWahlwert(feld: string, wert: unknown): boolean;
|
|
327
|
+
/** Wirksame Trinkgeld-Arten: die gespeicherten, sonst alle drei. */
|
|
328
|
+
export declare function posTipKinds(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): PosOpen<PosTipKind>[];
|
|
329
|
+
/** Wirksame Start-Art: die gespeicherte, wenn sie angeboten wird, sonst Prozent (oder die erste angebotene Art). */
|
|
330
|
+
export declare function posTipStart(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): PosOpen<PosTipKind>;
|
|
331
|
+
/** Wirksame Breite der rechten Spalte; ohne Angabe `narrow`. */
|
|
332
|
+
export declare function posCartWidth(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): PosOpen<PosCartWidth>;
|
|
294
333
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
295
334
|
export declare function posTipKeptByDefault(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
|
|
296
335
|
/**
|
package/dist/cjs/pos/settings.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._ALTFORM_0X = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_SHARED_PAIRS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = void 0;
|
|
3
|
+
exports._ALTFORM_0X = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_SHARED_PAIRS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = void 0;
|
|
4
4
|
exports.posShortcutConflict = posShortcutConflict;
|
|
5
5
|
exports._optionalerWert = _optionalerWert;
|
|
6
|
+
exports._optionalerWahlwert = _optionalerWahlwert;
|
|
7
|
+
exports.posTipKinds = posTipKinds;
|
|
8
|
+
exports.posTipStart = posTipStart;
|
|
9
|
+
exports.posCartWidth = posCartWidth;
|
|
6
10
|
exports.posTipKeptByDefault = posTipKeptByDefault;
|
|
7
11
|
exports._istAltwert0x = _istAltwert0x;
|
|
8
12
|
exports.mergePosSettings = mergePosSettings;
|
|
@@ -36,6 +40,16 @@ exports.FONT_SIZE = ['S', 'M', 'L', 'XL'];
|
|
|
36
40
|
exports.WATERMARK = ['off', 'login', 'everywhere'];
|
|
37
41
|
exports.QUANTITY = ['off', 'x', 'kg'];
|
|
38
42
|
exports.TIP_MODE = ['amount', 'total', 'both'];
|
|
43
|
+
/**
|
|
44
|
+
* Trinkgeld-Arten, die die Kasse anbietet (`business.tipKinds`): Prozent, Aufrunden
|
|
45
|
+
* (der Gast zahlt auf einen runden Betrag) und Gesamt (der Gast nennt den Betrag, den er insgesamt zahlt).
|
|
46
|
+
* `business.tipStart` ist die zuerst offene Art und liegt immer unter den angebotenen.
|
|
47
|
+
*/
|
|
48
|
+
exports.TIP_KINDS = ['percent', 'round_up', 'total'];
|
|
49
|
+
/** Die zuerst offene Trinkgeld-Art (`business.tipStart`): dieselben Werte wie [TIP_KINDS]. */
|
|
50
|
+
exports.TIP_START = exports.TIP_KINDS;
|
|
51
|
+
/** Breite der rechten Spalte (Korb) an diesem Geraet (`device.cartWidth`); in der schmalen Ansicht ohne Wirkung. */
|
|
52
|
+
exports.CART_WIDTH = ['narrow', 'medium', 'wide'];
|
|
39
53
|
exports.CHECKOUT_MODE = ['page', 'panel'];
|
|
40
54
|
/** Kartenanbieter: Karte gibt es erst mit eingerichtetem Anbieter; 'external' = eigenes Terminal ohne Anbindung. */
|
|
41
55
|
exports.CARD_PROVIDER = ['none', 'external', 'gptom', 'hobex', 'mypos', 'stripe'];
|
|
@@ -213,6 +227,41 @@ const OPTIONALE = new Set(exports.POS_DEVICE_OPTIONAL_FIELDS);
|
|
|
213
227
|
*/
|
|
214
228
|
exports.POS_BUSINESS_OPTIONAL_FIELDS = Object.freeze(['tipKeptByDefault']);
|
|
215
229
|
const OPTIONALE_SCHALTER = new Set(exports.POS_BUSINESS_OPTIONAL_FIELDS);
|
|
230
|
+
/**
|
|
231
|
+
* Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
|
|
232
|
+
* `KASSE_BETRIEB_WERTE.tipKinds[]` und `.tipStart`): ohne Standardwert, der Server sendet sie nur,
|
|
233
|
+
* wenn sie gespeichert sind. [mergePosSettings] uebernimmt sie, wenn sie die Form haben
|
|
234
|
+
* (`tipKinds` eine nichtleere Liste von Texten, `tipStart` ein Text); den Wert prueft der Schreibweg.
|
|
235
|
+
*/
|
|
236
|
+
exports.POS_BUSINESS_OPTIONAL_CHOICES = Object.freeze(['tipKinds', 'tipStart']);
|
|
237
|
+
/** Optionale Geraete-Einstellungen mit Wertemenge (Backend `GERAET_OPTIONAL`, Katalog `KASSE_GERAET_WERTE.cartWidth`). */
|
|
238
|
+
exports.POS_DEVICE_OPTIONAL_CHOICES = Object.freeze(['cartWidth']);
|
|
239
|
+
/** Hat der Wert die Form eines optionalen Wahlfeldes? Texte, die der Server neu einfuehren koennte, bleiben (kein Altwert 0.x). */
|
|
240
|
+
function _optionalerWahlwert(feld, wert) {
|
|
241
|
+
if (feld === 'tipKinds') {
|
|
242
|
+
return Array.isArray(wert) && wert.length > 0 && wert.every((x) => typeof x === 'string' && !_istAltwert0x('tipKinds', x));
|
|
243
|
+
}
|
|
244
|
+
return typeof wert === 'string' && wert !== '' && !_istAltwert0x(feld, wert);
|
|
245
|
+
}
|
|
246
|
+
const OPTIONALE_WAHL = new Set([...exports.POS_BUSINESS_OPTIONAL_CHOICES, ...exports.POS_DEVICE_OPTIONAL_CHOICES]);
|
|
247
|
+
/** Wirksame Trinkgeld-Arten: die gespeicherten, sonst alle drei. */
|
|
248
|
+
function posTipKinds(business) {
|
|
249
|
+
const k = business?.tipKinds;
|
|
250
|
+
return Array.isArray(k) && k.length > 0 ? [...k] : [...exports.TIP_KINDS];
|
|
251
|
+
}
|
|
252
|
+
/** Wirksame Start-Art: die gespeicherte, wenn sie angeboten wird, sonst Prozent (oder die erste angebotene Art). */
|
|
253
|
+
function posTipStart(business) {
|
|
254
|
+
const arten = posTipKinds(business);
|
|
255
|
+
const start = business?.tipStart;
|
|
256
|
+
if (typeof start === 'string' && arten.includes(start))
|
|
257
|
+
return start;
|
|
258
|
+
return arten.includes('percent') ? 'percent' : arten[0];
|
|
259
|
+
}
|
|
260
|
+
/** Wirksame Breite der rechten Spalte; ohne Angabe `narrow`. */
|
|
261
|
+
function posCartWidth(device) {
|
|
262
|
+
const w = device?.cartWidth;
|
|
263
|
+
return typeof w === 'string' && w !== '' ? w : 'narrow';
|
|
264
|
+
}
|
|
216
265
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
217
266
|
function posTipKeptByDefault(business) {
|
|
218
267
|
return !!business && business.tipKeptByDefault === true;
|
|
@@ -227,13 +276,13 @@ exports.POS_BUSINESS_VALUES = Object.freeze({
|
|
|
227
276
|
tileStyle: exports.TILE_STYLE, autoLogoutMinutes: exports.AUTO_LOGOUT_MINUTES, quantity: exports.QUANTITY, discount: exports.DISCOUNT,
|
|
228
277
|
cardProvider: exports.CARD_PROVIDER, tipMode: exports.TIP_MODE, checkoutMode: exports.CHECKOUT_MODE, receiptOutput: exports.RECEIPT_OUTPUT,
|
|
229
278
|
doneScreenSeconds: exports.DONE_SCREEN_SECONDS, watermarkSide: exports.WATERMARK_SIDE, watermarkStrength: exports.WATERMARK_STRENGTH,
|
|
230
|
-
logoScale: exports.LOGO_SCALE, watermarkScale: exports.WATERMARK_SCALE,
|
|
279
|
+
logoScale: exports.LOGO_SCALE, watermarkScale: exports.WATERMARK_SCALE, tipKinds: exports.TIP_KINDS, tipStart: exports.TIP_START,
|
|
231
280
|
});
|
|
232
281
|
/** Wie [POS_BUSINESS_VALUES] fuer die Geraete-Einstellungen. */
|
|
233
282
|
exports.POS_DEVICE_VALUES = Object.freeze({
|
|
234
283
|
layout: exports.LAYOUT, categoryPosition: exports.CATEGORY_POSITION, tileHeight: exports.TILE_HEIGHT, printerType: exports.PRINTER_TYPE,
|
|
235
284
|
paperSize: exports.PAPER_SIZE, codePage: exports.CODE_PAGE, cut: exports.CUT, qrMode: exports.QR_MODE, drawerAutoOpen: exports.DRAWER_AUTO_OPEN,
|
|
236
|
-
terminalVia: exports.TERMINAL_VIA, terminalType: exports.TERMINAL_TYPE,
|
|
285
|
+
terminalVia: exports.TERMINAL_VIA, terminalType: exports.TERMINAL_TYPE, cartWidth: exports.CART_WIDTH,
|
|
237
286
|
});
|
|
238
287
|
/** Eigene Eigenschaft, nie eine geerbte (`toString`, `constructor`, `__proto__`). */
|
|
239
288
|
const eigen = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
@@ -262,6 +311,9 @@ const ALTWERTE_0X = Object.freeze({
|
|
|
262
311
|
drawerAutoOpen: ['bar', 'immer', 'nie'],
|
|
263
312
|
terminalVia: ['direkt'],
|
|
264
313
|
terminalType: ['keins'],
|
|
314
|
+
tipKinds: ['prozent', 'aufrunden', 'gesamt'],
|
|
315
|
+
tipStart: ['prozent', 'aufrunden', 'gesamt'],
|
|
316
|
+
cartWidth: ['schmal', 'mittel', 'breit'],
|
|
265
317
|
});
|
|
266
318
|
/** Tasten-Aktionen der inneren Form (0.x). */
|
|
267
319
|
const ALTAKTIONEN_0X = new Set([
|
|
@@ -302,6 +354,8 @@ function mergePosSettings(standard, stored) {
|
|
|
302
354
|
out[key] = wert;
|
|
303
355
|
if (OPTIONALE_SCHALTER.has(key) && typeof wert === 'boolean')
|
|
304
356
|
out[key] = wert;
|
|
357
|
+
if (OPTIONALE_WAHL.has(key) && _optionalerWahlwert(key, wert))
|
|
358
|
+
out[key] = Array.isArray(wert) ? [...wert] : wert;
|
|
305
359
|
continue;
|
|
306
360
|
}
|
|
307
361
|
const wert = stored[key];
|
|
@@ -359,7 +413,14 @@ function unknownPosSettingValues(settings) {
|
|
|
359
413
|
const erlaubt = mengen[k];
|
|
360
414
|
if (!erlaubt || !eigen(block, k))
|
|
361
415
|
continue;
|
|
362
|
-
|
|
416
|
+
const wert = block[k];
|
|
417
|
+
// Eine Liste (tipKinds): unbekannt, sobald ein Eintrag fremd ist.
|
|
418
|
+
if (Array.isArray(wert)) {
|
|
419
|
+
if (wert.some((e) => !erlaubt.includes(e)))
|
|
420
|
+
raus.push(`${teil}.${k}`);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (!erlaubt.includes(wert))
|
|
363
424
|
raus.push(`${teil}.${k}`);
|
|
364
425
|
}
|
|
365
426
|
};
|