@kreiseck/kasseneck-api 1.36.0 → 1.38.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 +45 -1
- package/README.md +16 -0
- package/dist/cjs/client/aufrufe.d.ts +2 -2
- package/dist/cjs/client/aufrufe.js +5 -0
- package/dist/cjs/client/receipts.d.ts +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +6 -5
- package/dist/cjs/invoice/texte.d.ts +18 -1
- package/dist/cjs/invoice/texte.js +43 -2
- package/dist/cjs/invoice/vertrag.d.ts +1 -1
- package/dist/cjs/invoice/vertrag.js +1 -0
- package/dist/cjs/models/cancellation.d.ts +1 -1
- package/dist/cjs/models/cancellation.js +2 -0
- package/dist/cjs/models/index.d.ts +2 -1
- package/dist/cjs/models/index.js +6 -3
- package/dist/cjs/models/invoice-payment-ref.d.ts +42 -0
- package/dist/cjs/models/invoice-payment-ref.js +38 -0
- package/dist/cjs/models/receipt-item.d.ts +10 -2
- package/dist/cjs/models/receipt-item.js +14 -1
- package/dist/cjs/models/receipt.d.ts +7 -0
- package/dist/cjs/models/receipt.js +6 -0
- package/dist/cjs/payments/hobex-hps/index.d.ts +2 -1
- package/dist/cjs/payments/hobex-hps/index.js +3 -1
- package/dist/cjs/payments/hobex-hps/outcome.d.ts +10 -0
- package/dist/cjs/payments/hobex-hps/payments.d.ts +54 -0
- package/dist/cjs/payments/hobex-hps/payments.js +157 -1
- package/dist/cjs/payments/hobex-hps/support.d.ts +19 -0
- package/dist/cjs/payments/hobex-hps/support.js +22 -0
- package/dist/cjs/payments/hobex-hps/transaction-response.js +1 -1
- package/dist/cjs/payments/index.d.ts +1 -1
- package/dist/cjs/payments/index.js +2 -1
- package/dist/cjs/pos/errors.d.ts +1 -1
- package/dist/cjs/pos/errors.js +1 -0
- package/dist/cjs/pos/index.d.ts +4 -4
- package/dist/cjs/pos/index.js +13 -5
- package/dist/cjs/pos/schicht-lesen.d.ts +3 -1
- package/dist/cjs/pos/schicht-lesen.js +28 -1
- package/dist/cjs/pos/schicht-typen.d.ts +50 -4
- package/dist/cjs/pos/schicht-typen.js +7 -2
- package/dist/cjs/pos/schicht.d.ts +6 -4
- package/dist/cjs/pos/schicht.js +6 -3
- package/dist/cjs/pos/settings.d.ts +37 -8
- package/dist/cjs/pos/settings.js +34 -10
- package/dist/cjs/pos/texte.d.ts +262 -4
- package/dist/cjs/pos/texte.js +157 -7
- package/dist/cjs/pos/trinkgeld.d.ts +30 -0
- package/dist/cjs/pos/trinkgeld.js +30 -0
- package/dist/cjs/receipt/index.d.ts +1 -0
- package/dist/cjs/receipt/index.js +4 -2
- package/dist/cjs/receipt/layout.d.ts +2 -2
- package/dist/cjs/receipt/layout.js +106 -117
- package/dist/cjs/receipt/shift-sheet.js +12 -2
- package/dist/cjs/receipt/vermerke.d.ts +80 -0
- package/dist/cjs/receipt/vermerke.js +167 -0
- package/dist/cjs/register/pairing.d.ts +4 -0
- package/dist/cjs/register/pairing.js +2 -0
- package/dist/cjs/stored/draht.js +25 -1
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +32 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +2 -2
- package/dist/esm/client/aufrufe.js +5 -0
- package/dist/esm/client/receipts.d.ts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/invoice/texte.d.ts +18 -1
- package/dist/esm/invoice/texte.js +43 -2
- package/dist/esm/invoice/vertrag.d.ts +1 -1
- package/dist/esm/invoice/vertrag.js +1 -0
- package/dist/esm/models/cancellation.d.ts +1 -1
- package/dist/esm/models/cancellation.js +2 -0
- package/dist/esm/models/index.d.ts +2 -1
- package/dist/esm/models/index.js +2 -1
- package/dist/esm/models/invoice-payment-ref.d.ts +42 -0
- package/dist/esm/models/invoice-payment-ref.js +35 -0
- package/dist/esm/models/receipt-item.d.ts +10 -2
- package/dist/esm/models/receipt-item.js +13 -1
- package/dist/esm/models/receipt.d.ts +7 -0
- package/dist/esm/models/receipt.js +6 -0
- package/dist/esm/payments/hobex-hps/index.d.ts +2 -1
- package/dist/esm/payments/hobex-hps/index.js +1 -0
- package/dist/esm/payments/hobex-hps/outcome.d.ts +10 -0
- package/dist/esm/payments/hobex-hps/payments.d.ts +54 -0
- package/dist/esm/payments/hobex-hps/payments.js +158 -2
- package/dist/esm/payments/hobex-hps/support.d.ts +19 -0
- package/dist/esm/payments/hobex-hps/support.js +19 -0
- package/dist/esm/payments/hobex-hps/transaction-response.js +1 -1
- package/dist/esm/payments/index.d.ts +1 -1
- package/dist/esm/payments/index.js +1 -1
- package/dist/esm/pos/errors.d.ts +1 -1
- package/dist/esm/pos/errors.js +1 -0
- package/dist/esm/pos/index.d.ts +4 -4
- package/dist/esm/pos/index.js +5 -5
- package/dist/esm/pos/schicht-lesen.d.ts +3 -1
- package/dist/esm/pos/schicht-lesen.js +27 -1
- package/dist/esm/pos/schicht-typen.d.ts +50 -4
- package/dist/esm/pos/schicht-typen.js +6 -1
- package/dist/esm/pos/schicht.d.ts +6 -4
- package/dist/esm/pos/schicht.js +6 -3
- package/dist/esm/pos/settings.d.ts +37 -8
- package/dist/esm/pos/settings.js +30 -9
- package/dist/esm/pos/texte.d.ts +262 -4
- package/dist/esm/pos/texte.js +156 -6
- package/dist/esm/pos/trinkgeld.d.ts +30 -0
- package/dist/esm/pos/trinkgeld.js +28 -0
- package/dist/esm/receipt/index.d.ts +1 -0
- package/dist/esm/receipt/index.js +1 -0
- package/dist/esm/receipt/layout.d.ts +2 -2
- package/dist/esm/receipt/layout.js +103 -113
- package/dist/esm/receipt/shift-sheet.js +12 -2
- package/dist/esm/receipt/vermerke.d.ts +80 -0
- package/dist/esm/receipt/vermerke.js +155 -0
- package/dist/esm/register/pairing.d.ts +4 -0
- package/dist/esm/register/pairing.js +2 -0
- package/dist/esm/stored/draht.js +25 -1
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +32 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/duplicate-cases.json +1 -1
- package/fixtures/expected/duplicate.shift-close.hex +1 -1
- package/fixtures/expected/invoice-payment-cancellation.grid32.txt +28 -0
- package/fixtures/expected/invoice-payment-cancellation.grid48.txt +26 -0
- package/fixtures/expected/invoice-payment-cancellation.lines.json +189 -0
- package/fixtures/expected/invoice-payment-cancellation.sheet32.json +194 -0
- package/fixtures/expected/invoice-payment-cancellation.sheet48.json +182 -0
- package/fixtures/expected/invoice-payment-manual-receipt.grid32.txt +30 -0
- package/fixtures/expected/invoice-payment-manual-receipt.grid48.txt +29 -0
- package/fixtures/expected/invoice-payment-manual-receipt.lines.json +199 -0
- package/fixtures/expected/invoice-payment-manual-receipt.sheet32.json +206 -0
- package/fixtures/expected/invoice-payment-manual-receipt.sheet48.json +200 -0
- package/fixtures/expected/invoice-payment-normal.grid32.txt +22 -0
- package/fixtures/expected/invoice-payment-normal.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-normal.lines.json +192 -0
- package/fixtures/expected/invoice-payment-normal.sheet32.json +158 -0
- package/fixtures/expected/invoice-payment-normal.sheet48.json +152 -0
- package/fixtures/expected/invoice-payment-outage.grid32.txt +23 -0
- package/fixtures/expected/invoice-payment-outage.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-outage.lines.json +172 -0
- package/fixtures/expected/invoice-payment-outage.sheet32.json +164 -0
- package/fixtures/expected/invoice-payment-outage.sheet48.json +152 -0
- package/fixtures/expected/invoice-payment-partial.grid32.txt +20 -0
- package/fixtures/expected/invoice-payment-partial.grid48.txt +20 -0
- package/fixtures/expected/invoice-payment-partial.lines.json +162 -0
- package/fixtures/expected/invoice-payment-partial.sheet32.json +146 -0
- package/fixtures/expected/invoice-payment-partial.sheet48.json +146 -0
- package/fixtures/expected/invoice-payment-refund.grid32.txt +20 -0
- package/fixtures/expected/invoice-payment-refund.grid48.txt +20 -0
- package/fixtures/expected/invoice-payment-refund.lines.json +162 -0
- package/fixtures/expected/invoice-payment-refund.sheet32.json +146 -0
- package/fixtures/expected/invoice-payment-refund.sheet48.json +146 -0
- package/fixtures/expected/invoice-payment-see-invoice.grid32.txt +22 -0
- package/fixtures/expected/invoice-payment-see-invoice.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-see-invoice.lines.json +192 -0
- package/fixtures/expected/invoice-payment-see-invoice.sheet32.json +158 -0
- package/fixtures/expected/invoice-payment-see-invoice.sheet48.json +152 -0
- package/fixtures/expected/invoice-payment-training.grid32.txt +30 -0
- package/fixtures/expected/invoice-payment-training.grid48.txt +27 -0
- package/fixtures/expected/invoice-payment-training.lines.json +183 -0
- package/fixtures/expected/invoice-payment-training.sheet32.json +206 -0
- package/fixtures/expected/invoice-payment-training.sheet48.json +188 -0
- package/fixtures/expected/invoice-payment-without-vat.grid32.txt +20 -0
- package/fixtures/expected/invoice-payment-without-vat.grid48.txt +19 -0
- package/fixtures/expected/invoice-payment-without-vat.lines.json +162 -0
- package/fixtures/expected/invoice-payment-without-vat.sheet32.json +146 -0
- package/fixtures/expected/invoice-payment-without-vat.sheet48.json +140 -0
- package/fixtures/expected/invoice-payment-zero-percent.grid32.txt +22 -0
- package/fixtures/expected/invoice-payment-zero-percent.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-zero-percent.lines.json +192 -0
- package/fixtures/expected/invoice-payment-zero-percent.sheet32.json +158 -0
- package/fixtures/expected/invoice-payment-zero-percent.sheet48.json +152 -0
- package/fixtures/expected/shift-close-card-tips.grid32.txt +44 -0
- package/fixtures/expected/shift-close-card-tips.grid48.txt +40 -0
- package/fixtures/expected/shift-close-card-tips.lines.json +479 -0
- package/fixtures/expected/shift-close-put-in.grid32.txt +1 -1
- package/fixtures/expected/shift-close-put-in.grid48.txt +1 -1
- package/fixtures/expected/shift-close-put-in.lines.json +1 -1
- package/fixtures/expected/shift-close-take-out.grid32.txt +1 -1
- package/fixtures/expected/shift-close-take-out.grid48.txt +1 -1
- package/fixtures/expected/shift-close-take-out.lines.json +1 -1
- package/fixtures/expected/shift-close.grid32.txt +1 -1
- package/fixtures/expected/shift-close.grid48.txt +1 -1
- package/fixtures/expected/shift-close.lines.json +1 -1
- package/fixtures/expected/shift-interim-card-tips.grid32.txt +34 -0
- package/fixtures/expected/shift-interim-card-tips.grid48.txt +31 -0
- package/fixtures/expected/shift-interim-card-tips.lines.json +344 -0
- package/fixtures/hobex-hps-codes.json +2 -2
- package/fixtures/invoice-api.schema.json +3 -2
- package/fixtures/invoice-texts.json +37 -3
- package/fixtures/manifest.json +80 -0
- package/fixtures/pos-message-cases.json +3 -0
- package/fixtures/pos-texts.json +313 -3
- package/fixtures/receipt-due-generated.json +3 -3
- package/fixtures/receipt-due-voucher-generated.json +5 -5
- package/fixtures/receipts/invoice-payment-cancellation.json +70 -0
- package/fixtures/receipts/invoice-payment-manual-receipt.json +69 -0
- package/fixtures/receipts/invoice-payment-normal.json +65 -0
- package/fixtures/receipts/invoice-payment-outage.json +63 -0
- package/fixtures/receipts/invoice-payment-partial.json +63 -0
- package/fixtures/receipts/invoice-payment-refund.json +63 -0
- package/fixtures/receipts/invoice-payment-see-invoice.json +65 -0
- package/fixtures/receipts/invoice-payment-training.json +63 -0
- package/fixtures/receipts/invoice-payment-without-vat.json +63 -0
- package/fixtures/receipts/invoice-payment-zero-percent.json +65 -0
- package/fixtures/renames-1.0.json +10 -0
- package/fixtures/shift-ablauf-cases.json +4 -4
- package/fixtures/shift-cases.json +4 -2
- package/fixtures/shift-receipts-card-tips.json +73 -0
- package/fixtures/shift-receipts.json +9 -9
- package/fixtures/stored/card-tip-cases.json +132 -0
- package/fixtures/surface.json +23 -6
- 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 +247 -127
- 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 +3 -3
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +264 -21
- package/fixtures/v3/zahlbetrag-faelle.json +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { InternerTransport } from '../client/aufrufe.js';
|
|
2
2
|
import type { TipRecipient } from '../models/index.js';
|
|
3
|
+
import type { TipBalance } from './schicht-typen.js';
|
|
4
|
+
import type { TipPaymentKind } from './settings.js';
|
|
5
|
+
import type { LabelKey } from './texte.js';
|
|
3
6
|
/**
|
|
4
7
|
* Die Personen, denen dieser Aufrufer Trinkgeld zuweisen kann.
|
|
5
8
|
*
|
|
@@ -8,3 +11,30 @@ import type { TipRecipient } from '../models/index.js';
|
|
|
8
11
|
* Recht `tipAssign` angemeldet, steht nur er selbst darin.
|
|
9
12
|
*/
|
|
10
13
|
export declare function listMyTipRecipients(transport: InternerTransport): Promise<TipRecipient[]>;
|
|
14
|
+
export interface GetMyTipBalanceOptions {
|
|
15
|
+
/** Ohne Angabe gilt die Hauptlade der Kasse (`cashregisterId`). */
|
|
16
|
+
drawerId?: string;
|
|
17
|
+
cashregisterId?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* „Mein Trinkgeld“ (Spec 2026-11-11-kartentrinkgeld, § 4.6, § 5): der Trinkgeld-Stand der angemeldeten Person an
|
|
21
|
+
* dieser Lade -- offen (auch negativ: zu viel ausgezahlt), heute genommen, andere Laden mit offenem Betrag.
|
|
22
|
+
* Nur ueber den Kassenweg `/api/v3` und nur fuer eine persoenliche Anmeldung (Kassen-Benutzer `kind: person`);
|
|
23
|
+
* eine gemeinsame Geraete-Anmeldung und der Inhaber bekommen `not_a_person_login`. Nie der Stand einer anderen
|
|
24
|
+
* Person. Lesen ohne Wirkung.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getMyTipBalance(transport: InternerTransport, options?: GetMyTipBalanceOptions): Promise<TipBalance>;
|
|
27
|
+
/** Was mit dem Trinkgeld dieses Verkaufs geschieht ([tipStatus]). */
|
|
28
|
+
export type TipStatusKind = 'kept' | 'open';
|
|
29
|
+
/** Ergebnis von [tipStatus]: `kept` = gleich behalten, `open` = offen; `key` die Zeile aus dem Katalog mit `{amount}`. */
|
|
30
|
+
export interface TipStatus {
|
|
31
|
+
status: TipStatusKind;
|
|
32
|
+
key: LabelKey;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Die eine Zeile beim Kassieren und auf der Fertig-Seite (Spec 2026-11-11-kartentrinkgeld, § 4.4): sie sagt, was
|
|
36
|
+
* mit dem Mitarbeiter-Trinkgeld wirklich geschieht -- nicht die Stufe, sondern das Ergebnis von `tipKeptFor` (und
|
|
37
|
+
* bei Karte der Deckung durch das Soll, F1). Bar: „{amount} gleich einstecken“ / „{amount} in der Lade lassen“,
|
|
38
|
+
* Karte: „{amount} aus der Lade nehmen“ / „{amount} später auszahlen“. Den Text liefert `labelText(key, { amount })`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function tipStatus(method: TipPaymentKind, kept: boolean): TipStatus;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { KasseneckValidationError } from '../client/errors.js';
|
|
2
|
+
import { anfrage } from '../inventory/schreiben.js';
|
|
3
|
+
import { tipStand } from './schicht-lesen.js';
|
|
2
4
|
/**
|
|
3
5
|
* Die Personen, denen dieser Aufrufer Trinkgeld zuweisen kann.
|
|
4
6
|
*
|
|
@@ -22,3 +24,29 @@ export async function listMyTipRecipients(transport) {
|
|
|
22
24
|
return { registerUserId: String(d.registerUserId ?? ''), name: String(d.name ?? ''), owner: d.owner === true };
|
|
23
25
|
});
|
|
24
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* „Mein Trinkgeld“ (Spec 2026-11-11-kartentrinkgeld, § 4.6, § 5): der Trinkgeld-Stand der angemeldeten Person an
|
|
29
|
+
* dieser Lade -- offen (auch negativ: zu viel ausgezahlt), heute genommen, andere Laden mit offenem Betrag.
|
|
30
|
+
* Nur ueber den Kassenweg `/api/v3` und nur fuer eine persoenliche Anmeldung (Kassen-Benutzer `kind: person`);
|
|
31
|
+
* eine gemeinsame Geraete-Anmeldung und der Inhaber bekommen `not_a_person_login`. Nie der Stand einer anderen
|
|
32
|
+
* Person. Lesen ohne Wirkung.
|
|
33
|
+
*/
|
|
34
|
+
export async function getMyTipBalance(transport, options = {}) {
|
|
35
|
+
const name = 'getMyTipBalance';
|
|
36
|
+
const p = anfrage(name, options);
|
|
37
|
+
if (p.drawerId === '')
|
|
38
|
+
delete p.drawerId;
|
|
39
|
+
const ort = { name, pfad: '', scope: 'response' };
|
|
40
|
+
return tipStand(ort, await transport(name, p));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Die eine Zeile beim Kassieren und auf der Fertig-Seite (Spec 2026-11-11-kartentrinkgeld, § 4.4): sie sagt, was
|
|
44
|
+
* mit dem Mitarbeiter-Trinkgeld wirklich geschieht -- nicht die Stufe, sondern das Ergebnis von `tipKeptFor` (und
|
|
45
|
+
* bei Karte der Deckung durch das Soll, F1). Bar: „{amount} gleich einstecken“ / „{amount} in der Lade lassen“,
|
|
46
|
+
* Karte: „{amount} aus der Lade nehmen“ / „{amount} später auszahlen“. Den Text liefert `labelText(key, { amount })`.
|
|
47
|
+
*/
|
|
48
|
+
export function tipStatus(method, kept) {
|
|
49
|
+
if (method === 'card')
|
|
50
|
+
return kept ? { status: 'kept', key: 'tip.line_card_kept' } : { status: 'open', key: 'tip.line_card_open' };
|
|
51
|
+
return kept ? { status: 'kept', key: 'tip.line_cash_kept' } : { status: 'open', key: 'tip.line_cash_open' };
|
|
52
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { type LayoutAlign, type LayoutColumn, type LayoutTextLine, type LayoutColumnsLine, type LayoutRuleLine, type LayoutSpaceLine, type LayoutQrLine, type LayoutLine, type ReceiptLayout, type BuildReceiptLayoutOptions, buildReceiptLayout, receiptSignatureFailed, receiptSignatureIsTest, receiptIsZero, receiptAmountsAreZero, receiptIsSmallBusinessConsistent, receiptZdaText, CURRENT_LAYOUT_RULESET, type LayoutBannerLine, type LayoutBannerTone, type LayoutRuleset, SMALL_BUSINESS_NOTICE, formatCents, } from './layout.js';
|
|
2
2
|
export { markAsDuplicate } from './duplikat.js';
|
|
3
|
+
export { type ReceiptNote, type ReceiptNoteKind, type ReceiptNotesOptions, receiptNotes } from './vermerke.js';
|
|
3
4
|
export { type EscPosLayoutOptions, type EscPosLayoutResult, type QrPrintMode, type PrintLogo, assertLogoRaster, escPosLayoutBytes, escPosLayoutResult, } from './layout-escpos.js';
|
|
4
5
|
export { type GridLine, type GridLineKind, type ReceiptGrid, type RenderReceiptGridOptions, renderReceiptGrid, gridColumnWidths, gridToText, CHARS_PER_PAPER_SIZE, } from './grid.js';
|
|
5
6
|
export { type EposPrintXmlOptions, type EposPrintResult, type EposDirectOptions, type EposResponse, EposConnectionError, eposPrintXml, eposPrintXmlResult, eposXmlEscape, eposImageXml, eposServiceUrl, eposSoapEnvelope, eposParseResponse, eposDirectPrint, eposDirectStatus } from './epos.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { buildReceiptLayout, receiptSignatureFailed, receiptSignatureIsTest, receiptIsZero, receiptAmountsAreZero, receiptIsSmallBusinessConsistent, receiptZdaText, CURRENT_LAYOUT_RULESET, SMALL_BUSINESS_NOTICE, formatCents, } from './layout.js';
|
|
2
2
|
export { markAsDuplicate } from './duplikat.js';
|
|
3
|
+
export { receiptNotes } from './vermerke.js';
|
|
3
4
|
export { assertLogoRaster, escPosLayoutBytes, escPosLayoutResult, } from './layout-escpos.js';
|
|
4
5
|
export { renderReceiptGrid, gridColumnWidths, gridToText, CHARS_PER_PAPER_SIZE, } from './grid.js';
|
|
5
6
|
export { EposConnectionError, eposPrintXml, eposPrintXmlResult, eposXmlEscape, eposImageXml, eposServiceUrl, eposSoapEnvelope, eposParseResponse, eposDirectPrint, eposDirectStatus } from './epos.js';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type Receipt, type ReceiptCompany, type RegistrationInfo } from '../models/index.js';
|
|
2
2
|
import type { PosPaperSize } from '../printing/escpos.js';
|
|
3
|
+
import { receiptSignatureFailed } from './vermerke.js';
|
|
4
|
+
export { receiptSignatureFailed };
|
|
3
5
|
/**
|
|
4
6
|
* Beleg-Layout — der Bauplan eines Kasseneck-Belegs als reines Datenmodell.
|
|
5
7
|
*
|
|
@@ -163,8 +165,6 @@ export declare function stripeReceiptLines(daten: Record<string, unknown>, cardP
|
|
|
163
165
|
* deutsch — er steht so auf oesterreichischen Belegen.
|
|
164
166
|
*/
|
|
165
167
|
export declare const SMALL_BUSINESS_NOTICE = "Umsatzsteuerbefreit \u2013 Kleinunternehmer gem\u00E4\u00DF \u00A7 6 Abs. 1 Z 27 UStG.";
|
|
166
|
-
/** Wurde der Beleg ohne funktionierende Signatureinheit ausgestellt? */
|
|
167
|
-
export declare function receiptSignatureFailed(receipt: Receipt): boolean;
|
|
168
168
|
/**
|
|
169
169
|
* Traegt der Beleg eine **Test**-Signatur? Erkannt am ZDA-Kennzeichen `AT100`
|
|
170
170
|
* im maschinenlesbaren Code (`_R1-AT100_...`) — der Testpfad der Testumgebungen.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { VatRate, VoucherAction, VoucherType } from '../enums/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { receiptCompanyTaxInfo, receiptItemTotalCents, isDepositItem, isDepositReturnItem, isDiscountItem, isInvoicePaymentItem, isTipItem, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, voucherIsValid, isExternalVoucher, } from '../models/index.js';
|
|
3
3
|
import { parseServerTimeStamp, toViennaWallClock } from '../vienna-time.js';
|
|
4
4
|
import { KasseneckValidationError } from '../client/errors.js';
|
|
5
5
|
import { addOnDisplayOrder, istGueltigerZusatz } from '../pos/zusaetze.js';
|
|
6
|
+
import { belegtyp, nacherfassungTeile, receiptSignatureFailed, signaturausfallVermerk, stornoVermerk, testkasseVermerk, testsignaturVermerk, trainingVermerk, } from './vermerke.js';
|
|
7
|
+
export { receiptSignatureFailed };
|
|
6
8
|
export const CURRENT_LAYOUT_RULESET = 2;
|
|
7
9
|
/** Die Optionen von [buildReceiptLayout]; jede andere wird abgewiesen. */
|
|
8
10
|
const LAYOUT_OPTIONEN = new Set(['paperSize', 'ruleset', 'testCashregister', 'testSignature', 'registrationInfo']);
|
|
@@ -61,21 +63,6 @@ function belegZeit(timeStamp) {
|
|
|
61
63
|
const zwei = (n) => String(n).padStart(2, '0');
|
|
62
64
|
return `${zwei(t.day)}.${zwei(t.month)}.${t.year} ${zwei(t.hour)}:${zwei(t.minute)}:${zwei(t.second)}`;
|
|
63
65
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Datum des stornierten Originals fuer den Kopfblock: „11.08.2026, 09:02 Uhr".
|
|
66
|
-
* Ein unlesbarer Zeitstempel am BEZUG ist kein Grund, den Storno-Bon zu
|
|
67
|
-
* verweigern (der Beleg selbst ist gueltig) — dann bleibt die Zeile weg.
|
|
68
|
-
*/
|
|
69
|
-
function originalDatum(timeStamp) {
|
|
70
|
-
try {
|
|
71
|
-
const t = toViennaWallClock(parseServerTimeStamp(timeStamp));
|
|
72
|
-
const zwei = (n) => String(n).padStart(2, '0');
|
|
73
|
-
return `${zwei(t.day)}.${zwei(t.month)}.${t.year}, ${zwei(t.hour)}:${zwei(t.minute)} Uhr`;
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
66
|
/**
|
|
80
67
|
* Zahlungsart als Anzeigetext. Drei Faelle, und alle drei kommen vor:
|
|
81
68
|
* bekannter Eintrag (Beschriftung), unbekannter Schluessel (roh — besser als
|
|
@@ -524,19 +511,8 @@ function rueckgabeZahlungsZeilen(receipt, rueckgaben) {
|
|
|
524
511
|
*/
|
|
525
512
|
export const SMALL_BUSINESS_NOTICE = 'Umsatzsteuerbefreit – Kleinunternehmer gemäß § 6 Abs. 1 Z 27 UStG.';
|
|
526
513
|
// ------------------------------------------------------------------ Signatur
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Derselbe Text base64url-kodiert — so steht er als dritter JWS-Teil im Feld
|
|
531
|
-
* `sig` (Zwilling von `RKSVService.isSigSuccess`). Fest hinterlegt statt zur
|
|
532
|
-
* Laufzeit kodiert: `btoa`/`Buffer` sind in Browser und Node verschieden zu
|
|
533
|
-
* haben, und der Wert ist unveraenderlich.
|
|
534
|
-
*/
|
|
535
|
-
const SIGNATUR_AUSGEFALLEN_BASE64URL = 'U2ljaGVyaGVpdHNlaW5yaWNodHVuZyBhdXNnZWZhbGxlbg';
|
|
536
|
-
/** Wurde der Beleg ohne funktionierende Signatureinheit ausgestellt? */
|
|
537
|
-
export function receiptSignatureFailed(receipt) {
|
|
538
|
-
return receipt.sig.split('.')[2] === SIGNATUR_AUSGEFALLEN_BASE64URL;
|
|
539
|
-
}
|
|
514
|
+
// Ob der Beleg ohne Signatureinheit ausgestellt wurde (`receiptSignatureFailed`), steht bei den
|
|
515
|
+
// Vermerken (vermerke.ts): der Vermerk „Sicherheitseinrichtung ausgefallen“ haengt daran.
|
|
540
516
|
/**
|
|
541
517
|
* Traegt der Beleg eine **Test**-Signatur? Erkannt am ZDA-Kennzeichen `AT100`
|
|
542
518
|
* im maschinenlesbaren Code (`_R1-AT100_...`) — der Testpfad der Testumgebungen.
|
|
@@ -954,20 +930,65 @@ function einwegPfandCents(receipt) {
|
|
|
954
930
|
}
|
|
955
931
|
return gefunden ? summe : null;
|
|
956
932
|
}
|
|
933
|
+
// ---------------------------------------------------------- Zahlung auf Rechnung
|
|
934
|
+
/** Steuerhinweise unter einer Zahlung auf Rechnung, je Wert (eingerueckt wie „ USt bei Einlösung“); am Bon deutsch. */
|
|
935
|
+
const STEUERHINWEIS_TEXTE = {
|
|
936
|
+
incl_vat: ' inkl. USt',
|
|
937
|
+
zero_percent: ' 0 % USt',
|
|
938
|
+
see_invoice: ' Steuerangaben siehe Rechnung',
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* Zahlungsbeleg: jede Position ist eine Zahlung auf Rechnung (ein Beleg mit einer solchen Position
|
|
942
|
+
* besteht nur aus solchen, das prueft der Server).
|
|
943
|
+
*/
|
|
944
|
+
function istNurRechnungszahlung(receipt) {
|
|
945
|
+
return receipt.items.length > 0 && receipt.items.every(isInvoicePaymentItem);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Bezug je Position „Zahlung auf Rechnung“: die n-te solche Position (Belegreihenfolge) gehoert zur
|
|
949
|
+
* n-ten Rechnung in `invoicePayments`; der Server legt beide in derselben Reihenfolge an, eine Zeile
|
|
950
|
+
* je Rechnung. Ohne Bezug bleibt die Position ohne Steuerhinweis.
|
|
951
|
+
*/
|
|
952
|
+
function rechnungszahlungBezuege(receipt) {
|
|
953
|
+
const bezuege = receipt.invoicePayments ?? [];
|
|
954
|
+
const zu = new Map();
|
|
955
|
+
let n = 0;
|
|
956
|
+
receipt.items.forEach((it, i) => {
|
|
957
|
+
if (!isInvoicePaymentItem(it))
|
|
958
|
+
return;
|
|
959
|
+
const bezug = bezuege[n];
|
|
960
|
+
n += 1;
|
|
961
|
+
if (bezug !== undefined)
|
|
962
|
+
zu.set(i, bezug);
|
|
963
|
+
});
|
|
964
|
+
return zu;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Zeilen einer Zahlung auf Rechnung: Text der Position (er nennt die Rechnung) und Betrag, ohne Menge
|
|
968
|
+
* und ohne Satzkennzeichen -- der Betrag zaehlt im RKSV-Feld „Null“, ist aber kein steuerfreier Umsatz,
|
|
969
|
+
* kein Satz der Steuertabelle. Darunter der Steuerhinweis der Rechnung (Spec 2026-11-11, Abschnitt 16):
|
|
970
|
+
* „inkl. USt“, „0 % USt“ (steuerfrei, nicht steuerbar) oder „Steuerangaben siehe Rechnung“ (Reverse Charge). Breite 8:4 wie die Gutscheinzeilen.
|
|
971
|
+
*/
|
|
972
|
+
function rechnungszahlungZeilen(item, bezug) {
|
|
973
|
+
const zeilen = [{
|
|
974
|
+
kind: 'columns',
|
|
975
|
+
columns: [
|
|
976
|
+
{ text: item.name, width: 8, align: 'left' },
|
|
977
|
+
// Zwei Fuellzeichen, wo bei den Warenzeilen " B" steht: die Betraege fluchten in einer Spalte.
|
|
978
|
+
{ text: `${formatCents(receiptItemTotalCents(item))} `, width: 4, align: 'right' },
|
|
979
|
+
],
|
|
980
|
+
}];
|
|
981
|
+
if (bezug?.taxNote !== undefined)
|
|
982
|
+
zeilen.push(textZeile(STEUERHINWEIS_TEXTE[bezug.taxNote]));
|
|
983
|
+
return zeilen;
|
|
984
|
+
}
|
|
957
985
|
// ---------------------------------------------------------------- Belegart
|
|
958
|
-
const TESTKASSE_TEXT = 'TESTKASSE — kein gültiger Beleg';
|
|
959
|
-
const TESTSIGNATUR_TEXT = 'TESTSIGNATUR — kein gültiger Beleg';
|
|
960
|
-
/** Erklaerung am Trainingsbeleg (Wortlaut mit dem Betreiber abgestimmt). */
|
|
961
|
-
const TRAINING_ERKLAERUNG = [
|
|
962
|
-
'Trainingsbuchung — kein Kauf, keine Zahlung, keine steuerliche Buchung.',
|
|
963
|
-
'Sollten Sie diesen Beleg als Kunde erhalten haben, sagen Sie bitte dem Betrieb Bescheid.',
|
|
964
|
-
];
|
|
965
986
|
function bannerZeile(text, tone = 'receipt_type') {
|
|
966
987
|
return { kind: 'banner', text, tone };
|
|
967
988
|
}
|
|
968
|
-
/**
|
|
969
|
-
function
|
|
970
|
-
return
|
|
989
|
+
/** Ein Vermerk am Bon: Titel als Banner, jede Zeile zentriert darunter. */
|
|
990
|
+
function vermerkZeilen(vermerk) {
|
|
991
|
+
return [bannerZeile(vermerk.title), ...vermerk.lines.map((z) => textZeile(z, 'center'))];
|
|
971
992
|
}
|
|
972
993
|
/** Ist das ein Nullbeleg (Start-, Monats-, Jahres-, Schluss-, Pruefbeleg)? */
|
|
973
994
|
export function receiptIsZero(receipt) {
|
|
@@ -1047,16 +1068,6 @@ function belegMonatJahr(timeStamp) {
|
|
|
1047
1068
|
return { monat: '??', jahr: '????' };
|
|
1048
1069
|
}
|
|
1049
1070
|
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Grund eines Stornos lesbar -- aus dem EINEN Katalog des Modells
|
|
1052
|
-
* (`CANCELLATION_REASONS`, derselbe, den die Kasse anbietet und das Backend
|
|
1053
|
-
* annimmt). Unbekannter Code (Fremdclient): sichtbar, aber ohne zu werfen.
|
|
1054
|
-
*/
|
|
1055
|
-
function stornoGrundText(code) {
|
|
1056
|
-
if (!code)
|
|
1057
|
-
return null;
|
|
1058
|
-
return isCancellationReason(code) ? CANCELLATION_REASONS[code] : code;
|
|
1059
|
-
}
|
|
1060
1071
|
/**
|
|
1061
1072
|
* Kleinunternehmer (§ 6 Abs. 1 Z 27 UStG, unechte Befreiung): auf dem Beleg
|
|
1062
1073
|
* darf keine USt stehen -- jede Position 0 %. Sagt, ob der Beleg dazu passt;
|
|
@@ -1065,48 +1076,26 @@ function stornoGrundText(code) {
|
|
|
1065
1076
|
export function receiptIsSmallBusinessConsistent(receipt) {
|
|
1066
1077
|
return receipt.items.every((it) => Number(steuersatz(it.vat).rate) === 0);
|
|
1067
1078
|
}
|
|
1068
|
-
/** Grund-Zeile nach einem Ausfall der Kasse; `other` druckt den eigenen Text. */
|
|
1069
|
-
const NACHERFASSUNG_GRUND = {
|
|
1070
|
-
network_outage: 'Internet', power_outage: 'Strom', device_failure: 'Gerät defekt', system_outage: 'Störung',
|
|
1071
|
-
};
|
|
1072
|
-
/** `YYYY-MM-DD` als `TT.MM.JJJJ`; anderes bleibt, wie es kam. */
|
|
1073
|
-
function handbelegDatum(tag) {
|
|
1074
|
-
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(tag);
|
|
1075
|
-
return m ? `${m[3]}.${m[2]}.${m[1]}` : tag;
|
|
1076
|
-
}
|
|
1077
1079
|
/**
|
|
1078
|
-
* Block „NACHERFASSUNG“ (manualReceipt) unter dem Kopf
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1080
|
+
* Block „NACHERFASSUNG“ (manualReceipt) unter dem Kopf, aus dem Baustein
|
|
1081
|
+
* [nacherfassungTeile]: Titel, Anlass, Leerzeile, Handbeleg, dann der Hinweis,
|
|
1082
|
+
* dass der Beleg fuer die USt ein Duplikat ist. Der Zeitstempel des Belegs
|
|
1083
|
+
* bleibt der der Nacherfassung und steht wie immer unter „Datum:“.
|
|
1084
|
+
* Kleinunternehmer (keine USt am Beleg) bekommen den USt-Hinweis nicht, ebenso
|
|
1085
|
+
* ein Zahlungsbeleg (seine Umsatzsteuer steht auf der Rechnung).
|
|
1084
1086
|
*/
|
|
1085
1087
|
function nacherfassungBlock(receipt, company) {
|
|
1086
|
-
const
|
|
1087
|
-
if (!
|
|
1088
|
+
const teile = nacherfassungTeile(receipt);
|
|
1089
|
+
if (!teile)
|
|
1088
1090
|
return [];
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
aus.push(textZeile('Tagessammelbeleg', 'center'));
|
|
1098
|
-
aus.push(textZeile(`Handbelege Nr. ${m.number} bis ${m.numberTo}`, 'center'));
|
|
1099
|
-
aus.push(textZeile(`${m.count ? `${m.count} Belege ` : ''}vom ${tag}`, 'center'));
|
|
1100
|
-
if (!company.isSmallBusiness)
|
|
1101
|
-
aus.push(textZeile('USt: Duplikat der Handbelege', 'center'));
|
|
1102
|
-
}
|
|
1103
|
-
else {
|
|
1104
|
-
aus.push(textZeile(`Handbeleg Nr. ${m.number}`, 'center'));
|
|
1105
|
-
aus.push(textZeile(`vom ${tag}${m.time ? `, ${m.time} Uhr` : ''}`, 'center'));
|
|
1106
|
-
if (!company.isSmallBusiness)
|
|
1107
|
-
aus.push(textZeile('USt: Duplikat des Handbelegs', 'center'));
|
|
1108
|
-
}
|
|
1109
|
-
return aus;
|
|
1091
|
+
const ust = !company.isSmallBusiness && !istNurRechnungszahlung(receipt);
|
|
1092
|
+
return [
|
|
1093
|
+
bannerZeile(teile.title),
|
|
1094
|
+
...teile.anlass.map((z) => textZeile(z, 'center')),
|
|
1095
|
+
{ kind: 'space', lines: 1 },
|
|
1096
|
+
...teile.handbeleg.map((z) => textZeile(z, 'center')),
|
|
1097
|
+
...(ust ? [textZeile(teile.ustHinweis, 'center')] : []),
|
|
1098
|
+
];
|
|
1110
1099
|
}
|
|
1111
1100
|
/**
|
|
1112
1101
|
* Belegart-Block unter dem Betriebskopf: Titel als Banner, Untertitel als
|
|
@@ -1115,21 +1104,9 @@ function nacherfassungBlock(receipt, company) {
|
|
|
1115
1104
|
function belegartBlock(receipt) {
|
|
1116
1105
|
const t = belegtyp(receipt);
|
|
1117
1106
|
const aus = [];
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
aus.push(
|
|
1121
|
-
// Datum des Originals, wenn der Bezug es traegt (Backend seit 2026-09-04).
|
|
1122
|
-
const datum = receipt.cancellationOf?.timeStamp ? originalDatum(receipt.cancellationOf.timeStamp) : null;
|
|
1123
|
-
if (datum)
|
|
1124
|
-
aus.push(textZeile(`vom ${datum}`, 'center'));
|
|
1125
|
-
const grund = stornoGrundText(typeof receipt.cancellationReason === 'string' ? receipt.cancellationReason : undefined);
|
|
1126
|
-
if (grund)
|
|
1127
|
-
aus.push(textZeile(`Grund: ${grund}`, 'center'));
|
|
1128
|
-
}
|
|
1129
|
-
else if (t === 'training') {
|
|
1130
|
-
aus.push(bannerZeile('TRAININGSBELEG'));
|
|
1131
|
-
for (const z of TRAINING_ERKLAERUNG)
|
|
1132
|
-
aus.push(textZeile(z, 'center'));
|
|
1107
|
+
const vermerk = stornoVermerk(receipt) ?? trainingVermerk(receipt);
|
|
1108
|
+
if (vermerk) {
|
|
1109
|
+
aus.push(...vermerkZeilen(vermerk));
|
|
1133
1110
|
}
|
|
1134
1111
|
else if (istReinerLeergutBeleg(receipt)) {
|
|
1135
1112
|
aus.push(textZeile(LEERGUT_UEBERSCHRIFT, 'center', true));
|
|
@@ -1181,9 +1158,9 @@ export function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1181
1158
|
const nullbeleg = receiptIsZero(receipt) && (ruleset === 1 || receiptAmountsAreZero(receipt));
|
|
1182
1159
|
const warnungen = [];
|
|
1183
1160
|
if (options.testCashregister)
|
|
1184
|
-
warnungen.push(bannerZeile(
|
|
1161
|
+
warnungen.push(bannerZeile(testkasseVermerk().title, 'warning'));
|
|
1185
1162
|
if (options.testSignature)
|
|
1186
|
-
warnungen.push(bannerZeile(
|
|
1163
|
+
warnungen.push(bannerZeile(testsignaturVermerk().title, 'warning'));
|
|
1187
1164
|
// --- Warnrahmen oben (Testkasse/Testsignatur): ueber dem Kopf, damit ihn niemand uebersieht.
|
|
1188
1165
|
lines.push(...warnungen);
|
|
1189
1166
|
// --- Belegkopf: Firma, Anschrift, Steuerangabe, Telefon
|
|
@@ -1227,8 +1204,9 @@ export function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1227
1204
|
lines.push(textZeile(zeile, 'center'));
|
|
1228
1205
|
lines.push({ kind: 'space', lines: 1 });
|
|
1229
1206
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1207
|
+
const ausfall = signaturausfallVermerk(receipt);
|
|
1208
|
+
if (ausfall) {
|
|
1209
|
+
lines.push(textZeile(ausfall.title, 'center'));
|
|
1232
1210
|
lines.push({ kind: 'space', lines: 1 });
|
|
1233
1211
|
}
|
|
1234
1212
|
lines.push({ kind: 'qr', data: receipt.qr });
|
|
@@ -1285,9 +1263,16 @@ export function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1285
1263
|
gebundenesPfand.add(k);
|
|
1286
1264
|
const reihe = mitPfandReihenfolge(receipt.items, addOnDisplayOrder(receipt.items), pfandZu);
|
|
1287
1265
|
const an = (k) => receipt.items[reihe[k]];
|
|
1266
|
+
const rzBezuege = rechnungszahlungBezuege(receipt);
|
|
1288
1267
|
let i = 0;
|
|
1289
1268
|
while (i < reihe.length) {
|
|
1290
1269
|
const item = an(i);
|
|
1270
|
+
// Zahlung auf Rechnung: eigene Zeilen, nicht in der Steuertabelle (die Umsatzsteuer steht auf der Rechnung).
|
|
1271
|
+
if (isInvoicePaymentItem(item)) {
|
|
1272
|
+
lines.push(...rechnungszahlungZeilen(item, rzBezuege.get(reihe[i])));
|
|
1273
|
+
i += 1;
|
|
1274
|
+
continue;
|
|
1275
|
+
}
|
|
1291
1276
|
if (!isTipItem(item) && !isDiscountItem(item)) {
|
|
1292
1277
|
const satz = steuersatz(item.vat);
|
|
1293
1278
|
gruppeVon(satz).bruttoCents += receiptItemTotalCents(item);
|
|
@@ -1371,9 +1356,12 @@ export function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1371
1356
|
}
|
|
1372
1357
|
}
|
|
1373
1358
|
verteilePromoGutschein(gruppen, promoCents);
|
|
1374
|
-
// --- USt-Aufteilung
|
|
1375
|
-
|
|
1376
|
-
|
|
1359
|
+
// --- USt-Aufteilung; ein Zahlungsbeleg hat keine (seine Umsatzsteuer steht auf der Rechnung).
|
|
1360
|
+
const nurRechnungszahlung = istNurRechnungszahlung(receipt);
|
|
1361
|
+
if (!(nurRechnungszahlung && gruppen.size === 0)) {
|
|
1362
|
+
lines.push({ kind: 'space', lines: 1 });
|
|
1363
|
+
lines.push(tabellenZeile(['MwSt%', 'MwSt', 'Netto', 'Brutto'], paperSize));
|
|
1364
|
+
}
|
|
1377
1365
|
for (const gruppe of gruppen.values()) {
|
|
1378
1366
|
// Netto aus dem Brutto in ganzen Cent, MwSt als Rest: so ergeben Netto und
|
|
1379
1367
|
// MwSt zusammen immer wieder exakt den Brutto-Betrag der Zeile. (Das
|
|
@@ -1447,8 +1435,9 @@ export function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1447
1435
|
lines.push(paarZeile('Gesamt:', `${formatCents(summeCents)} €`));
|
|
1448
1436
|
lines.push(...(rueckgaben.length > 0 ? rueckgabeZahlungsZeilen(receipt, rueckgaben) : zahlungsZeilen(receipt)));
|
|
1449
1437
|
lines.push({ kind: 'space', lines: 1 });
|
|
1450
|
-
// --- Rechtshinweise und Ausfallhinweis
|
|
1451
|
-
|
|
1438
|
+
// --- Rechtshinweise und Ausfallhinweis. Der Kleinunternehmer-Hinweis erklaert die 0-%-Zeilen der
|
|
1439
|
+
// Steuertabelle; ein Zahlungsbeleg hat keine, den Hinweis traegt seine Rechnung.
|
|
1440
|
+
const hinweise = company.isSmallBusiness && !nurRechnungszahlung
|
|
1452
1441
|
? [SMALL_BUSINESS_NOTICE, ...receipt.legalMessage]
|
|
1453
1442
|
: receipt.legalMessage;
|
|
1454
1443
|
if (hinweise.length > 0) {
|
|
@@ -1457,8 +1446,9 @@ export function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1457
1446
|
}
|
|
1458
1447
|
lines.push({ kind: 'space', lines: 1 });
|
|
1459
1448
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1449
|
+
const ausfall = signaturausfallVermerk(receipt);
|
|
1450
|
+
if (ausfall) {
|
|
1451
|
+
lines.push(textZeile(ausfall.title, 'center'));
|
|
1462
1452
|
lines.push({ kind: 'space', lines: 1 });
|
|
1463
1453
|
}
|
|
1464
1454
|
// --- RKSV-QR-Code
|
|
@@ -139,6 +139,11 @@ export function shiftReceiptLayout(receipt, options = {}) {
|
|
|
139
139
|
zeilen.push(text(labelText('shift_receipt.opening_not_counted')));
|
|
140
140
|
if (bon.cashSalesCents !== null)
|
|
141
141
|
zeilen.push(betrag(labelText('shift_receipt.cash_sales'), bon.cashSalesCents));
|
|
142
|
+
// Kartentrinkgeld bar aus der Lade genommen (Spec keck 2026-11-11-kartentrinkgeld, § 4.3): verlaesst die Lade ohne
|
|
143
|
+
// Bewegung; ohne diese Zeile ginge Start + Bar + Bewegungen nicht im Soll auf. Steht wie die Bewegungen auch blind.
|
|
144
|
+
// Fehlt ohne Karten-direkt (Feld fehlt oder 0) -- der Bon bleibt dann Byte fuer Byte wie bisher.
|
|
145
|
+
if (bon.cardTipsTakenCents !== undefined && bon.cardTipsTakenCents !== 0)
|
|
146
|
+
zeilen.push(betrag(labelText('shift.part_card_tips_taken'), -bon.cardTipsTakenCents));
|
|
142
147
|
if (bon.cashCancellationsCents !== null)
|
|
143
148
|
zeilen.push(betrag(labelText('shift_receipt.cash_cancellations'), bon.cashCancellationsCents));
|
|
144
149
|
// Summe der Zwischenzaehlungs-Differenzen: damit Start + Bar + Bewegungen + diese = Soll aufgeht.
|
|
@@ -181,8 +186,13 @@ export function shiftReceiptLayout(receipt, options = {}) {
|
|
|
181
186
|
if (bon.comment)
|
|
182
187
|
zeilen.push(text(`${labelText('shift_receipt.comment')}: ${bon.comment}`));
|
|
183
188
|
zeilen.push(...nachZaehlungZeilen(bon));
|
|
184
|
-
// Zur Information: unbar, Zaehler.
|
|
189
|
+
// Zur Information: Zahlungen auf Rechnungen, unbar, Zaehler.
|
|
185
190
|
zeilen.push(regel());
|
|
191
|
+
// Zahlungen auf Rechnungen (1.38.0): nur Information, das Geld steckt schon im Barumsatz bzw. unbar.
|
|
192
|
+
// Ohne Betrag (fehlt oder 0) keine Zeile, der Bon bleibt wie bisher.
|
|
193
|
+
if (bon.invoicePaymentCents !== undefined && bon.invoicePaymentCents !== 0) {
|
|
194
|
+
zeilen.push(betrag(labelText('shift_receipt.invoice_payments'), bon.invoicePaymentCents));
|
|
195
|
+
}
|
|
186
196
|
if (bon.nonCashByMethod.length > 0) {
|
|
187
197
|
zeilen.push(text(labelText('shift_receipt.non_cash'), 'left', true));
|
|
188
198
|
for (const u of bon.nonCashByMethod)
|
|
@@ -198,7 +208,7 @@ export function shiftReceiptLayout(receipt, options = {}) {
|
|
|
198
208
|
zeilen.push(anzahl(labelText('shift_receipt.receipts'), bon.receiptCount));
|
|
199
209
|
zeilen.push(anzahl(labelText('shift_receipt.cancellations'), bon.cancellationCount));
|
|
200
210
|
zeilen.push(anzahl(labelText('shift_receipt.openings_without_sale'), bon.openingsWithoutSale));
|
|
201
|
-
// Trinkgeld je Mitarbeiter (shiftTipLines): verdient immer, ueber Lohn,
|
|
211
|
+
// Trinkgeld je Mitarbeiter (shiftTipLines): verdient immer, ueber Lohn, genommen und offen
|
|
202
212
|
// nur ungleich 0; wer ueberall 0 hat, entfaellt, ohne Mitarbeiter auch die Ueberschrift.
|
|
203
213
|
const trinkgeld = bon.tips.map((t) => ({ t, z: shiftTipLines(t) })).filter(({ z }) => z.length > 0);
|
|
204
214
|
if (trinkgeld.length > 0) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type Receipt } from '../models/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Vermerke eines Belegs: was ihn als besonderen Beleg ausweist (Testkasse,
|
|
4
|
+
* Testsignatur, Training, Storno, Nacherfassung, Signaturausfall). Eine Quelle
|
|
5
|
+
* fuer die Regeln: der Bon ([buildReceiptLayout]) setzt seine Bloecke aus
|
|
6
|
+
* diesen Bausteinen, und [receiptNotes] gibt sie strukturiert hinaus, damit
|
|
7
|
+
* ein anderes Blatt (Kassenteil auf der A4-Rechnung, Zahlungsbestaetigung)
|
|
8
|
+
* dieselben Vermerke anordnet, ohne eigene Regeln zu erfinden.
|
|
9
|
+
*
|
|
10
|
+
* Die Woerter sind Pflichtwoerter und bleiben in jeder Sprache deutsch
|
|
11
|
+
* (RKSV § 11 Abs. 3: Trainings- und Stornobuchungen ausdruecklich als solche
|
|
12
|
+
* bezeichnen; § 17 Abs. 4 und 5: Signaturausfall, Nacherfassung).
|
|
13
|
+
*
|
|
14
|
+
* „Duplikat“ ist kein Vermerk des Belegs: das druckt nur der Nachdruck auf
|
|
15
|
+
* Papier ([markAsDuplicate]).
|
|
16
|
+
*
|
|
17
|
+
* Abhaengig nur vom Belegmodell und der Wiener Zeit, damit der Zwilling in der
|
|
18
|
+
* 0.x-Linie und in Dart dieselben Regeln ohne den Rest des Layouts hat.
|
|
19
|
+
*/
|
|
20
|
+
/** Art eines Vermerks, in der festen Reihenfolge von [receiptNotes]. */
|
|
21
|
+
export type ReceiptNoteKind = 'test_cashregister' | 'test_signature' | 'training' | 'cancellation' | 'manual_receipt' | 'signature_outage';
|
|
22
|
+
/** Ein Vermerk: Titel (hervorgehoben) und Zeilen darunter, fertiger Text. */
|
|
23
|
+
export interface ReceiptNote {
|
|
24
|
+
kind: ReceiptNoteKind;
|
|
25
|
+
title: string;
|
|
26
|
+
lines: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface ReceiptNotesOptions {
|
|
29
|
+
/** Beleg einer Testumgebung (wie [BuildReceiptLayoutOptions.testCashregister]). */
|
|
30
|
+
testCashregister?: boolean;
|
|
31
|
+
/** Produktionskonto mit Test-Signatureinheit (wie [BuildReceiptLayoutOptions.testSignature]). */
|
|
32
|
+
testSignature?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const TESTKASSE_TEXT = "TESTKASSE \u2014 kein g\u00FCltiger Beleg";
|
|
35
|
+
export declare const TESTSIGNATUR_TEXT = "TESTSIGNATUR \u2014 kein g\u00FCltiger Beleg";
|
|
36
|
+
/** Text, den das Backend statt einer Signatur ablegt, wenn die Karte ausfaellt. */
|
|
37
|
+
export declare const SIGNATUR_AUSGEFALLEN = "Sicherheitseinrichtung ausgefallen";
|
|
38
|
+
/** Wurde der Beleg ohne funktionierende Signatureinheit ausgestellt? */
|
|
39
|
+
export declare function receiptSignatureFailed(receipt: Pick<Receipt, 'sig'>): boolean;
|
|
40
|
+
/** Belegtyp als Zeichenkette (Enum-Objekt oder roher Serverwert). */
|
|
41
|
+
export declare function belegtyp(receipt: Pick<Receipt, 'receiptType'>): string;
|
|
42
|
+
export declare function testkasseVermerk(): ReceiptNote;
|
|
43
|
+
export declare function testsignaturVermerk(): ReceiptNote;
|
|
44
|
+
/** Trainingsbeleg: Titel und Erklaerung; sonst `null`. */
|
|
45
|
+
export declare function trainingVermerk(receipt: Receipt): ReceiptNote | null;
|
|
46
|
+
/** Stornobeleg: Bezug, Datum des Originals (wenn der Bezug es traegt, Backend seit 2026-09-04) und Grund; sonst `null`. */
|
|
47
|
+
export declare function stornoVermerk(receipt: Receipt): ReceiptNote | null;
|
|
48
|
+
/**
|
|
49
|
+
* Teile der Nacherfassung: Anlass (Art und Grund), Handbeleg (Nummer und Tag) und der USt-Hinweis.
|
|
50
|
+
* Der Vermerk (§ 17 Abs. 5 RKSV) besteht aus Titel, Anlass und Handbeleg; den USt-Hinweis setzt nur
|
|
51
|
+
* der Bon, denn ob er gilt, haengt an der Firma (Kleinunternehmer) und am Beleg (Zahlungsbeleg).
|
|
52
|
+
*/
|
|
53
|
+
export interface NacherfassungTeile {
|
|
54
|
+
title: string;
|
|
55
|
+
anlass: string[];
|
|
56
|
+
handbeleg: string[];
|
|
57
|
+
/** „USt: Duplikat des Handbelegs“ bzw. „… der Handbelege“ (Registrierkassenerlass 3.3 Faelle 5 und 6, 2.4.11). */
|
|
58
|
+
ustHinweis: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Nacherfassung eines Handbelegs (manualReceipt): Art, Grund, Nummer und Tag
|
|
62
|
+
* des Handbelegs bzw. der Handbelege eines Tagessammelbelegs. Ohne Handbeleg `null`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function nacherfassungTeile(receipt: Receipt): NacherfassungTeile | null;
|
|
65
|
+
/** Signaturausfall (§ 17 Abs. 4 RKSV): der Vermerk ohne Zeilen; sonst `null`. */
|
|
66
|
+
export declare function signaturausfallVermerk(receipt: Receipt): ReceiptNote | null;
|
|
67
|
+
/**
|
|
68
|
+
* Die Vermerke eines Belegs in fester Reihenfolge: Testkasse, Testsignatur,
|
|
69
|
+
* Training, Storno, Nacherfassung, Signaturausfall. Ein gewoehnlicher Beleg
|
|
70
|
+
* hat keine (`[]`).
|
|
71
|
+
*
|
|
72
|
+
* Ob Testkasse oder Testsignatur, weiss nur der Aufrufer (er kennt das Konto),
|
|
73
|
+
* wie bei [buildReceiptLayout]. Eine unbekannte Option wirft
|
|
74
|
+
* (`KasseneckValidationError`, `scope: 'request'`): eine alte deutsche
|
|
75
|
+
* (`testKasse`) darf nie still wegfallen, sonst saehe ein Testbeleg gueltig aus.
|
|
76
|
+
*
|
|
77
|
+
* Firmendaten kennt diese Ausgabe nicht; der USt-Hinweis der Nacherfassung
|
|
78
|
+
* („USt: Duplikat …“) gehoert darum nicht zum Vermerk (siehe [NacherfassungTeile]).
|
|
79
|
+
*/
|
|
80
|
+
export declare function receiptNotes(receipt: Receipt, options?: ReceiptNotesOptions): ReceiptNote[];
|