@design.estate/dees-document 3.2.0 → 3.4.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/dist_bundle/bundle.js +594 -339
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.pdfservice.d.ts +3 -0
- package/dist_ts/classes.pdfservice.js +5 -1
- package/dist_ts_shared/index.d.ts +3 -0
- package/dist_ts_shared/index.js +4 -1
- package/dist_ts_shared/paidamount.d.ts +42 -0
- package/dist_ts_shared/paidamount.js +141 -0
- package/dist_ts_shared/paymentreminder.d.ts +28 -0
- package/dist_ts_shared/paymentreminder.js +33 -0
- package/dist_ts_shared/translation.d.ts +51 -0
- package/dist_ts_shared/translation.js +106 -1
- package/dist_ts_shared/unitnames.d.ts +44 -0
- package/dist_ts_shared/unitnames.js +103 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/contentinvoice.d.ts +101 -1
- package/dist_ts_web/elements/contentinvoice.js +654 -44
- package/dist_ts_web/elements/document.js +13 -1
- package/dist_ts_web/elements/letterheader.d.ts +2 -0
- package/dist_ts_web/elements/letterheader.js +20 -1
- package/package.json +2 -2
- package/readme.md +117 -5
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.pdfservice.ts +4 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/contentinvoice.ts +802 -49
- package/ts_web/elements/document.ts +11 -0
- package/ts_web/elements/letterheader.ts +28 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { LanguageCode } from "./translation.js";
|
|
2
|
+
/**
|
|
3
|
+
* The names of units of measure, printed in place of their codes.
|
|
4
|
+
*
|
|
5
|
+
* An EN 16931 invoice line carries its unit as a code of UN/ECE Recommendation
|
|
6
|
+
* 20, or of Recommendation 21 with the prefix "X" (BT-130, business rule
|
|
7
|
+
* BR-CL-23), and a printed invoice has to state the quantity in a unit its
|
|
8
|
+
* reader understands (§ 14 Abs. 4 Satz 1 Nr. 5 UStG). The table names the codes
|
|
9
|
+
* a small business commonly invoices in. Each English name is the
|
|
10
|
+
* Recommendation's own name, in the plural where the quantity asks for it; the
|
|
11
|
+
* German name is the customary German name of the same unit. "C62", whose
|
|
12
|
+
* Recommendation 20 name is "one", is named by its synonym "unit".
|
|
13
|
+
*
|
|
14
|
+
* A code the table does not hold, and a unit given as a word rather than a
|
|
15
|
+
* code, print as they are.
|
|
16
|
+
*/
|
|
17
|
+
/** A unit's name for a quantity of one and for any other quantity. */
|
|
18
|
+
export interface IUnitName {
|
|
19
|
+
one: string;
|
|
20
|
+
other: string;
|
|
21
|
+
}
|
|
22
|
+
/** The unit names of one language and the locale whose plural rules they follow. */
|
|
23
|
+
export interface IUnitNameTable {
|
|
24
|
+
/** BCP 47 locale that decides between the singular and the plural */
|
|
25
|
+
locale: string;
|
|
26
|
+
/** names by Recommendation 20 code, or Recommendation 21 code with the prefix "X" */
|
|
27
|
+
names: Record<string, IUnitName>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The decimals a quantity carries: those of its shortest representation, the
|
|
31
|
+
* one `String()` gives, so 12.5 has one and 1.0000001 has seven. NaN and
|
|
32
|
+
* Infinity have none. Capped at 100, the most `Intl` formats.
|
|
33
|
+
*/
|
|
34
|
+
export declare const quantityFractionDigits: (quantity: number) => number;
|
|
35
|
+
/** Unit names by document language code, keyed like `translation.languageCodeMap`. */
|
|
36
|
+
export declare const unitNameTables: Record<string, IUnitNameTable>;
|
|
37
|
+
/**
|
|
38
|
+
* The unit of a position as the document prints it: the name of a known code in
|
|
39
|
+
* the document's language, in the singular or plural the quantity asks for, and
|
|
40
|
+
* anything else as it is. The plural rules see every decimal the quantity
|
|
41
|
+
* carries, so 1.0001 hours are "hours", not "hour". A language without its own names takes the English
|
|
42
|
+
* ones, as `translation.translate()` does for every other word.
|
|
43
|
+
*/
|
|
44
|
+
export declare const unitName: (languageCode: LanguageCode | undefined, unitType: string, quantity: number) => string;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const EN_unitNames = {
|
|
2
|
+
locale: "en",
|
|
3
|
+
names: {
|
|
4
|
+
// counts
|
|
5
|
+
C62: { one: "unit", other: "units" },
|
|
6
|
+
H87: { one: "piece", other: "pieces" },
|
|
7
|
+
XPP: { one: "piece", other: "pieces" },
|
|
8
|
+
PR: { one: "pair", other: "pairs" },
|
|
9
|
+
E48: { one: "service unit", other: "service units" },
|
|
10
|
+
LS: { one: "lump sum", other: "lump sums" },
|
|
11
|
+
// time
|
|
12
|
+
MIN: { one: "minute", other: "minutes" },
|
|
13
|
+
HUR: { one: "hour", other: "hours" },
|
|
14
|
+
DAY: { one: "day", other: "days" },
|
|
15
|
+
WEE: { one: "week", other: "weeks" },
|
|
16
|
+
MON: { one: "month", other: "months" },
|
|
17
|
+
ANN: { one: "year", other: "years" },
|
|
18
|
+
// mass
|
|
19
|
+
GRM: { one: "gram", other: "grams" },
|
|
20
|
+
KGM: { one: "kilogram", other: "kilograms" },
|
|
21
|
+
TNE: { one: "tonne", other: "tonnes" },
|
|
22
|
+
// length, area, volume
|
|
23
|
+
MTR: { one: "metre", other: "metres" },
|
|
24
|
+
KMT: { one: "kilometre", other: "kilometres" },
|
|
25
|
+
MTK: { one: "square metre", other: "square metres" },
|
|
26
|
+
MTQ: { one: "cubic metre", other: "cubic metres" },
|
|
27
|
+
LTR: { one: "litre", other: "litres" },
|
|
28
|
+
// energy
|
|
29
|
+
KWH: { one: "kilowatt hour", other: "kilowatt hours" },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const DE_unitNames = {
|
|
33
|
+
locale: "de",
|
|
34
|
+
names: {
|
|
35
|
+
// counts
|
|
36
|
+
C62: { one: "Einheit", other: "Einheiten" },
|
|
37
|
+
H87: { one: "Stück", other: "Stück" },
|
|
38
|
+
XPP: { one: "Stück", other: "Stück" },
|
|
39
|
+
PR: { one: "Paar", other: "Paar" },
|
|
40
|
+
E48: { one: "Leistungseinheit", other: "Leistungseinheiten" },
|
|
41
|
+
LS: { one: "Pauschale", other: "Pauschalen" },
|
|
42
|
+
// time
|
|
43
|
+
MIN: { one: "Minute", other: "Minuten" },
|
|
44
|
+
HUR: { one: "Stunde", other: "Stunden" },
|
|
45
|
+
DAY: { one: "Tag", other: "Tage" },
|
|
46
|
+
WEE: { one: "Woche", other: "Wochen" },
|
|
47
|
+
MON: { one: "Monat", other: "Monate" },
|
|
48
|
+
ANN: { one: "Jahr", other: "Jahre" },
|
|
49
|
+
// mass
|
|
50
|
+
GRM: { one: "Gramm", other: "Gramm" },
|
|
51
|
+
KGM: { one: "Kilogramm", other: "Kilogramm" },
|
|
52
|
+
TNE: { one: "Tonne", other: "Tonnen" },
|
|
53
|
+
// length, area, volume
|
|
54
|
+
MTR: { one: "Meter", other: "Meter" },
|
|
55
|
+
KMT: { one: "Kilometer", other: "Kilometer" },
|
|
56
|
+
MTK: { one: "Quadratmeter", other: "Quadratmeter" },
|
|
57
|
+
MTQ: { one: "Kubikmeter", other: "Kubikmeter" },
|
|
58
|
+
LTR: { one: "Liter", other: "Liter" },
|
|
59
|
+
// energy
|
|
60
|
+
KWH: { one: "Kilowattstunde", other: "Kilowattstunden" },
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The decimals a quantity carries: those of its shortest representation, the
|
|
65
|
+
* one `String()` gives, so 12.5 has one and 1.0000001 has seven. NaN and
|
|
66
|
+
* Infinity have none. Capped at 100, the most `Intl` formats.
|
|
67
|
+
*/
|
|
68
|
+
export const quantityFractionDigits = (quantity) => {
|
|
69
|
+
const digits = /^(\d+)(?:\.(\d+))?(?:e([+-]\d+))?$/.exec(String(Math.abs(quantity)));
|
|
70
|
+
if (!digits) {
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
return Math.min(100, Math.max(0, (digits[2] ?? "").length - Number(digits[3] ?? 0)));
|
|
74
|
+
};
|
|
75
|
+
/** Unit names by document language code, keyed like `translation.languageCodeMap`. */
|
|
76
|
+
export const unitNameTables = {
|
|
77
|
+
EN: EN_unitNames,
|
|
78
|
+
DE: DE_unitNames,
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The unit of a position as the document prints it: the name of a known code in
|
|
82
|
+
* the document's language, in the singular or plural the quantity asks for, and
|
|
83
|
+
* anything else as it is. The plural rules see every decimal the quantity
|
|
84
|
+
* carries, so 1.0001 hours are "hours", not "hour". A language without its own names takes the English
|
|
85
|
+
* ones, as `translation.translate()` does for every other word.
|
|
86
|
+
*/
|
|
87
|
+
export const unitName = (languageCode, unitType, quantity) => {
|
|
88
|
+
const table = (languageCode && unitNameTables[languageCode]) || EN_unitNames;
|
|
89
|
+
const name = Object.hasOwn(table.names, unitType)
|
|
90
|
+
? table.names[unitType]
|
|
91
|
+
: undefined;
|
|
92
|
+
if (!name) {
|
|
93
|
+
return unitType;
|
|
94
|
+
}
|
|
95
|
+
const fractionDigits = quantityFractionDigits(quantity);
|
|
96
|
+
return new Intl.PluralRules(table.locale, {
|
|
97
|
+
minimumFractionDigits: fractionDigits,
|
|
98
|
+
maximumFractionDigits: fractionDigits,
|
|
99
|
+
}).select(quantity) === "one"
|
|
100
|
+
? name.one
|
|
101
|
+
: name.other;
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pdG5hbWVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfc2hhcmVkL3VuaXRuYW1lcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQ0EsTUFBTSxZQUFZLEdBQW1CO0lBQ25DLE1BQU0sRUFBRSxJQUFJO0lBQ1osS0FBSyxFQUFFO1FBQ0wsU0FBUztRQUNULEdBQUcsRUFBRSxFQUFFLEdBQUcsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLE9BQU8sRUFBRTtRQ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n0=
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-document',
|
|
6
|
-
version: '3.
|
|
6
|
+
version: '3.4.0',
|
|
7
7
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfd2ViLzAwX2NvbW1pdGluZm9fZGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLFVBQVUsR0FBRztJQUN4QixJQUFJLEVBQUUsOEJBQThCO0lBQ3BDLE9BQU8sRUFBRSxPQUFPO0lBQ2hCLFdBQVcsRUFBRSx1TEFBdUw7Q0FDck0sQ0FBQSJ9
|
|
@@ -19,6 +19,10 @@ export declare class DeContentInvoice extends DeesElement {
|
|
|
19
19
|
* gates the number row and the period row of the letterhead.
|
|
20
20
|
*/
|
|
21
21
|
private get accountingDoc();
|
|
22
|
+
/** The payment reminder this content prints, or null. */
|
|
23
|
+
private get paymentReminder();
|
|
24
|
+
/** The currency of the letter's amounts: an accounting document's or a reminder's. */
|
|
25
|
+
private get currency();
|
|
22
26
|
/**
|
|
23
27
|
* The document builds this element for every letter; one that is no
|
|
24
28
|
* accounting document, and one of a type this version does not know, keep
|
|
@@ -35,6 +39,18 @@ export declare class DeContentInvoice extends DeesElement {
|
|
|
35
39
|
* an unknown or missing currency falls back to a plain decimal number.
|
|
36
40
|
*/
|
|
37
41
|
protected formatPrice(value: number): string;
|
|
42
|
+
/**
|
|
43
|
+
* Formats a quantity in the document's language with every decimal it
|
|
44
|
+
* carries: 12.5 prints as "12,5" in German and "12.5" in English, and no
|
|
45
|
+
* stated quantity is rounded. The decimals are those of the shortest
|
|
46
|
+
* representation of the number, the one `String()` gives, as the unit name
|
|
47
|
+
* counts them for its singular or plural.
|
|
48
|
+
*/
|
|
49
|
+
protected formatQuantity(quantityArg: number): string;
|
|
50
|
+
/** Formats a rate in percent, with as many decimals as it states, up to four. */
|
|
51
|
+
protected formatPercent(percentArg: number): string;
|
|
52
|
+
/** Formats a day in the document's language and date style. */
|
|
53
|
+
protected formatDay(timestampArg: number): string;
|
|
38
54
|
getTotalNet: () => number;
|
|
39
55
|
getTotalGross: () => number;
|
|
40
56
|
getVatGroups: () => {
|
|
@@ -58,7 +74,12 @@ export declare class DeContentInvoice extends DeesElement {
|
|
|
58
74
|
* Apply pre-computed pagination offsets for thumbnail rendering
|
|
59
75
|
*/
|
|
60
76
|
private applyOffsetTrimming;
|
|
61
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The due date, which only an accounting document and a payment reminder
|
|
79
|
+
* have: it counts `dueInDays` from the letter's date. A document that
|
|
80
|
+
* states a paid amount names the amount due, since the total is not what
|
|
81
|
+
* remains to be paid.
|
|
82
|
+
*/
|
|
62
83
|
private renderPaymentTerms;
|
|
63
84
|
/**
|
|
64
85
|
* The QR pay box. It is printed only when the payment has a valid EPC QR
|
|
@@ -66,6 +87,32 @@ export declare class DeContentInvoice extends DeesElement {
|
|
|
66
87
|
* currency or without the sender's IBAN does not have.
|
|
67
88
|
*/
|
|
68
89
|
private renderPaymentInfo;
|
|
90
|
+
/**
|
|
91
|
+
* The paid amount and the amount due, below the gross total, when the
|
|
92
|
+
* document states a paid amount (EN 16931 BT-113 and BT-115). The advance
|
|
93
|
+
* payments a final invoice deducts are deducted as the gross total received,
|
|
94
|
+
* with the tax it contains stated per rate, as Abschnitt 14.8 Abs. 7 Satz 3
|
|
95
|
+
* UStAE allows: "Statt der vorausgezahlten Entgelte oder Teilentgelte und
|
|
96
|
+
* der Steuerbeträge können auch die Gesamtbeträge der Voraus- oder
|
|
97
|
+
* Anzahlungen abgesetzt und die darin enthaltenen Steuerbeträge zusätzlich
|
|
98
|
+
* angegeben werden." More paid than the total prints as a credit balance.
|
|
99
|
+
*/
|
|
100
|
+
private renderPaidAmountSums;
|
|
101
|
+
/**
|
|
102
|
+
* The advance payments the paid amount deducts, one line each, by the
|
|
103
|
+
* advance invoice's number and date and the day the payment was received,
|
|
104
|
+
* as far as the document states them. Each line is its own block, so a long
|
|
105
|
+
* list flows across pages.
|
|
106
|
+
*/
|
|
107
|
+
private renderAdvancePayments;
|
|
108
|
+
/**
|
|
109
|
+
* What the document asks to be paid: the payment terms and the QR pay box
|
|
110
|
+
* for the gross total, or for the amount due when the document states a
|
|
111
|
+
* paid amount. When nothing is due, it says so, and names the credit
|
|
112
|
+
* balance when more was paid than the total; there are no terms and no QR
|
|
113
|
+
* pay box then.
|
|
114
|
+
*/
|
|
115
|
+
private renderPaymentRequest;
|
|
69
116
|
/**
|
|
70
117
|
* The reverse-charge statement. § 14a UStG requires the words
|
|
71
118
|
* "Steuerschuldnerschaft des Leistungsempfängers": Abs. 5 for a domestic
|
|
@@ -77,6 +124,14 @@ export declare class DeContentInvoice extends DeesElement {
|
|
|
77
124
|
* Directive (2006/112/EC).
|
|
78
125
|
*/
|
|
79
126
|
private renderReverseChargeNote;
|
|
127
|
+
/**
|
|
128
|
+
* What makes a corrected invoice a correction (§ 31 Abs. 5 UStDV): its
|
|
129
|
+
* title, the invoice it corrects by number and issue date when the document
|
|
130
|
+
* states them ("spezifisch und eindeutig", Satz 2), and the details it
|
|
131
|
+
* supplies or corrects, in words. A received corrected invoice may name
|
|
132
|
+
* neither; then only the title is printed, and no reference is made up.
|
|
133
|
+
*/
|
|
134
|
+
private renderCorrection;
|
|
80
135
|
/** The earlier documents a correction answers, by number and, when known, by date. */
|
|
81
136
|
private renderRelatedDocuments;
|
|
82
137
|
/**
|
|
@@ -86,6 +141,51 @@ export declare class DeContentInvoice extends DeesElement {
|
|
|
86
141
|
* paragraph in one piece could be taller than a page and would never fit.
|
|
87
142
|
*/
|
|
88
143
|
private renderNotes;
|
|
144
|
+
/**
|
|
145
|
+
* The document a reminder claims, as the claims table and the charges name
|
|
146
|
+
* it: its kind and its number.
|
|
147
|
+
*/
|
|
148
|
+
private claimLabel;
|
|
149
|
+
/**
|
|
150
|
+
* The ground of the claim: every reminded document with its number, its
|
|
151
|
+
* date, the date it fell due when it stated one, its gross total and what is
|
|
152
|
+
* still open on it.
|
|
153
|
+
*/
|
|
154
|
+
private renderReminderClaims;
|
|
155
|
+
/**
|
|
156
|
+
* What a charge rests on, as the reminder states it: default interest its
|
|
157
|
+
* computation (principal, rate a year with the base rate and the surcharge
|
|
158
|
+
* points of § 288 Abs. 1 or 2 BGB, first and last day), the default lump sum
|
|
159
|
+
* its provision, and every charge the claim it accrues on. A cost with lump
|
|
160
|
+
* sums credited against it lists them (§ 288 Abs. 5 Satz 3 BGB); its amount
|
|
161
|
+
* is already the cost less them.
|
|
162
|
+
*/
|
|
163
|
+
private renderChargeBasis;
|
|
164
|
+
/** One row per charge: its description, what it rests on, and its amount. */
|
|
165
|
+
private renderReminderCharges;
|
|
166
|
+
/** The sums of a reminder: the open claims, the charges and the total payable, without VAT. */
|
|
167
|
+
private renderReminderSums;
|
|
168
|
+
/**
|
|
169
|
+
* A payment reminder: the issuer's intro or the standard one, the reminded
|
|
170
|
+
* documents, the charges, the sums, the notes, the new payment deadline and
|
|
171
|
+
* the QR pay box for the total payable with the reminder's number.
|
|
172
|
+
*/
|
|
173
|
+
private renderPaymentReminder;
|
|
89
174
|
private renderReferencedContract;
|
|
90
175
|
attachInvoiceDom(): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Sizes the columns of a table to their widest cell. Every row is a grid of
|
|
178
|
+
* its own, so the rows only line up when a column has one width for all of
|
|
179
|
+
* them; each page renders every row before it is trimmed, so every page
|
|
180
|
+
* measures the same widths.
|
|
181
|
+
*
|
|
182
|
+
* A column is never narrower than its minimum. The widths the columns ask
|
|
183
|
+
* for beyond their minimums are granted out of the row's width less its
|
|
184
|
+
* fixed columns and the minimum of its flexible column (the description),
|
|
185
|
+
* in equal shares, so the table always fits the page. A cell whose text is
|
|
186
|
+
* still wider than its column, such as an amount beyond hundreds of
|
|
187
|
+
* billions, is set in a smaller font, down to 8 px, and wraps inside its
|
|
188
|
+
* column once that is not enough, so it never runs into its neighbour.
|
|
189
|
+
*/
|
|
190
|
+
private fitColumns;
|
|
91
191
|
}
|