@design.estate/dees-document 5.1.0 → 5.3.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 +439 -423
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/bundle.js.third-party-notices.json +27 -1
- package/dist_bundle/bundle.js.third-party-notices.txt +58 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.pdfservice.js +2 -1
- package/dist_ts_shared/accountingdoc.d.ts +10 -0
- package/dist_ts_shared/accountingdoc.js +20 -1
- package/dist_ts_shared/interfaces/document.d.ts +10 -0
- package/dist_ts_shared/paymentcode.d.ts +30 -3
- package/dist_ts_shared/paymentcode.js +33 -3
- package/dist_ts_shared/plugins.d.ts +2 -0
- package/dist_ts_shared/plugins.js +4 -1
- package/dist_ts_shared/translation.d.ts +4 -0
- package/dist_ts_shared/translation.js +10 -1
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/contentinvoice.d.ts +5 -1
- package/dist_ts_web/elements/contentinvoice.js +57 -28
- package/dist_ts_web/elements/paymentcode.d.ts +2 -0
- package/dist_ts_web/elements/paymentcode.js +14 -2
- package/package.json +4 -3
- package/readme.md +5 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.pdfservice.ts +1 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/contentinvoice.ts +61 -29
- package/ts_web/elements/paymentcode.ts +7 -0
|
@@ -143,6 +143,9 @@ const positionColumns: IColumnLayout = {
|
|
|
143
143
|
flexibleMinWidth: 120,
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
+
/** The positions of a document without VAT (`withoutVat`): the same, without the VAT rate's 50 px. */
|
|
147
|
+
const positionColumnsWithoutVat: IColumnLayout = { ...positionColumns, fixedWidth: 40 };
|
|
148
|
+
|
|
146
149
|
/**
|
|
147
150
|
* A reminder's claims, and its charges and sums, which share the last column;
|
|
148
151
|
* the document label is flexible with at least 150 px (as the grid in the
|
|
@@ -354,6 +357,11 @@ export class DeContentInvoice extends DeesElement {
|
|
|
354
357
|
grid-template-columns: 40px minmax(120px, 1fr) var(--quantity-column-width, 50px) var(--unit-column-width, 50px) var(--unit-price-column-width, 100px) 50px var(--amount-column-width, 100px);
|
|
355
358
|
}
|
|
356
359
|
|
|
360
|
+
/* a document without VAT (\`withoutVat\`) has no VAT column */
|
|
361
|
+
.grid.withoutVat {
|
|
362
|
+
grid-template-columns: 40px minmax(120px, 1fr) var(--quantity-column-width, 50px) var(--unit-column-width, 50px) var(--unit-price-column-width, 100px) var(--amount-column-width, 100px);
|
|
363
|
+
}
|
|
364
|
+
|
|
357
365
|
.topLine {
|
|
358
366
|
margin-top: 5px;
|
|
359
367
|
background: #e7e7e7;
|
|
@@ -899,7 +907,11 @@ export class DeContentInvoice extends DeesElement {
|
|
|
899
907
|
/**
|
|
900
908
|
* The QR pay box. It is printed only when the payment has a valid EPC QR
|
|
901
909
|
* code: a euro amount to the sender's IBAN, which a document in another
|
|
902
|
-
* currency or without the sender's IBAN does not have.
|
|
910
|
+
* currency or without the sender's IBAN does not have. The code carries the
|
|
911
|
+
* reference the document states (`paymentOptions.paymentReference`): an ISO
|
|
912
|
+
* 11649 creditor reference in line 10, any other as free text, and where it
|
|
913
|
+
* states none, the letter's number (`epcRemittanceOf`). A stated reference
|
|
914
|
+
* is printed beside the code, so a payer who types the transfer quotes it.
|
|
903
915
|
*/
|
|
904
916
|
private renderPaymentInfo(optionsArg: {
|
|
905
917
|
/** the sender, who is paid */
|
|
@@ -907,15 +919,17 @@ export class DeContentInvoice extends DeesElement {
|
|
|
907
919
|
currency: string;
|
|
908
920
|
/** the amount to pay */
|
|
909
921
|
amount: number;
|
|
910
|
-
/** the number of the letter, the remittance information */
|
|
911
|
-
|
|
922
|
+
/** the number of the letter, the remittance information where the document states no reference */
|
|
923
|
+
number: string;
|
|
924
|
+
/** the reference the document states for its payment (EN 16931 BT-83) */
|
|
925
|
+
statedReference?: string;
|
|
912
926
|
}): TemplateResult | null {
|
|
913
927
|
const bic = optionsArg.from.sepaConnection?.bic;
|
|
914
928
|
const name = optionsArg.from.name;
|
|
915
929
|
const iban = optionsArg.from.sepaConnection?.iban;
|
|
916
930
|
const currency = optionsArg.currency;
|
|
917
931
|
const totalGross = optionsArg.amount;
|
|
918
|
-
const
|
|
932
|
+
const remittance = plugins.shared.epcRemittanceOf(optionsArg.statedReference, optionsArg.number);
|
|
919
933
|
if (
|
|
920
934
|
typeof iban !== "string" ||
|
|
921
935
|
plugins.shared.buildEpcQrPayload({
|
|
@@ -924,7 +938,8 @@ export class DeContentInvoice extends DeesElement {
|
|
|
924
938
|
iban,
|
|
925
939
|
currency,
|
|
926
940
|
amount: totalGross,
|
|
927
|
-
remittanceInformation:
|
|
941
|
+
remittanceInformation: remittance.remittanceInformation,
|
|
942
|
+
...(remittance.creditorReference ? { creditorReference: remittance.creditorReference } : {}),
|
|
928
943
|
}) === null
|
|
929
944
|
) {
|
|
930
945
|
return null;
|
|
@@ -935,6 +950,9 @@ export class DeContentInvoice extends DeesElement {
|
|
|
935
950
|
<div>
|
|
936
951
|
<div class="label">${this.translateKey("invoice@@payment.qr")}</div>
|
|
937
952
|
<span> ${this.translateKey("invoice@@payment.qr.description")} </span>
|
|
953
|
+
${remittance.printedReference
|
|
954
|
+
? html`<div>${this.translateKey("invoice@@payment.reference")}: ${remittance.printedReference}</div>`
|
|
955
|
+
: ""}
|
|
938
956
|
</div>
|
|
939
957
|
<dedocument-paymentcode
|
|
940
958
|
bic="${bic}"
|
|
@@ -942,7 +960,8 @@ export class DeContentInvoice extends DeesElement {
|
|
|
942
960
|
iban="${iban}"
|
|
943
961
|
currency="${currency}"
|
|
944
962
|
totalGross="${totalGross}"
|
|
945
|
-
reference="${
|
|
963
|
+
reference="${remittance.remittanceInformation}"
|
|
964
|
+
creditorReference="${remittance.creditorReference ?? ""}"
|
|
946
965
|
/>
|
|
947
966
|
</div>
|
|
948
967
|
</div>`;
|
|
@@ -1052,7 +1071,8 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1052
1071
|
from: accountingDocArg.from,
|
|
1053
1072
|
currency: accountingDocArg.currency,
|
|
1054
1073
|
amount: summaryArg ? summaryArg.amountDue : this.getTotalGross(),
|
|
1055
|
-
|
|
1074
|
+
number: accountingDocArg.id,
|
|
1075
|
+
statedReference: accountingDocArg.paymentOptions?.paymentReference,
|
|
1056
1076
|
})}
|
|
1057
1077
|
`;
|
|
1058
1078
|
}
|
|
@@ -1397,7 +1417,8 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1397
1417
|
from: reminderArg.from,
|
|
1398
1418
|
currency: reminderArg.currency,
|
|
1399
1419
|
amount: totals.payable,
|
|
1400
|
-
|
|
1420
|
+
number: reminderArg.id,
|
|
1421
|
+
statedReference: reminderArg.paymentOptions?.paymentReference,
|
|
1401
1422
|
})}
|
|
1402
1423
|
`;
|
|
1403
1424
|
}
|
|
@@ -1435,6 +1456,11 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1435
1456
|
return;
|
|
1436
1457
|
}
|
|
1437
1458
|
const accountingDoc = this.accountingDoc;
|
|
1459
|
+
// a document without VAT prints no VAT column, no VAT line and one total; one that states tax is refused
|
|
1460
|
+
if (accountingDoc) {
|
|
1461
|
+
plugins.shared.assertWithoutVatStatesNoTax(accountingDoc, this.documentSettings);
|
|
1462
|
+
}
|
|
1463
|
+
const withoutVat = this.documentSettings.withoutVat === true;
|
|
1438
1464
|
// throws when the advance payments do not add up to the paid amount
|
|
1439
1465
|
const paidAmountSummary = accountingDoc
|
|
1440
1466
|
? plugins.shared.getPaidAmountSummary(accountingDoc, this.getTotalGross())
|
|
@@ -1444,7 +1470,7 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1444
1470
|
${this.renderCorrection()}
|
|
1445
1471
|
<div>${this.translateKey(this.docContent.introStatement)}</div>
|
|
1446
1472
|
${this.renderRelatedDocuments()}
|
|
1447
|
-
<div class="grid topLine dataHeader">
|
|
1473
|
+
<div class="grid topLine dataHeader ${withoutVat ? "withoutVat" : ""}">
|
|
1448
1474
|
<div class="lineItem rightAlign">
|
|
1449
1475
|
${this.translateKey("invoice@@item.position")}
|
|
1450
1476
|
</div>
|
|
@@ -1458,18 +1484,20 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1458
1484
|
${this.translateKey("invoice@@unit.type")}
|
|
1459
1485
|
</div>
|
|
1460
1486
|
<div class="lineItem rightAlign unitPriceCell">
|
|
1461
|
-
${this.translateKey("invoice@@price.unit.net")}
|
|
1462
|
-
</div>
|
|
1463
|
-
<div class="lineItem rightAlign">
|
|
1464
|
-
${this.translateKey("invoice@@vat.short")}
|
|
1487
|
+
${this.translateKey(withoutVat ? "invoice@@price.unit.withoutVat" : "invoice@@price.unit.net")}
|
|
1465
1488
|
</div>
|
|
1489
|
+
${withoutVat
|
|
1490
|
+
? html``
|
|
1491
|
+
: html`<div class="lineItem rightAlign">
|
|
1492
|
+
${this.translateKey("invoice@@vat.short")}
|
|
1493
|
+
</div>`}
|
|
1466
1494
|
<div class="lineItem rightAlign amountCell">
|
|
1467
|
-
${this.translateKey("invoice@@price.total.net")}
|
|
1495
|
+
${this.translateKey(withoutVat ? "invoice@@price.total.withoutVat" : "invoice@@price.total.net")}
|
|
1468
1496
|
</div>
|
|
1469
1497
|
</div>
|
|
1470
1498
|
${accountingDoc?.items?.map(
|
|
1471
1499
|
(invoiceItem, index) => html`
|
|
1472
|
-
<div class="grid needsDataHeader">
|
|
1500
|
+
<div class="grid needsDataHeader ${withoutVat ? "withoutVat" : ""}">
|
|
1473
1501
|
<div class="lineItem rightAlign">${index + 1}</div>
|
|
1474
1502
|
<div class="lineItem descriptionCell">${invoiceItem.name}</div>
|
|
1475
1503
|
<div class="lineItem rightAlign quantityCell">
|
|
@@ -1485,9 +1513,11 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1485
1513
|
<div class="lineItem rightAlign unitPriceCell">
|
|
1486
1514
|
${this.formatPrice(invoiceItem.unitNetPrice)}
|
|
1487
1515
|
</div>
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1516
|
+
${withoutVat
|
|
1517
|
+
? html``
|
|
1518
|
+
: html`<div class="lineItem rightAlign">
|
|
1519
|
+
${invoiceItem.vatPercentage}%
|
|
1520
|
+
</div>`}
|
|
1491
1521
|
<div class="lineItem rightAlign amountCell">
|
|
1492
1522
|
${this.formatPrice(
|
|
1493
1523
|
invoiceItem.unitQuantity * invoiceItem.unitNetPrice
|
|
@@ -1497,15 +1527,17 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1497
1527
|
`
|
|
1498
1528
|
)}
|
|
1499
1529
|
<div class="sums">
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1530
|
+
${withoutVat
|
|
1531
|
+
? html``
|
|
1532
|
+
: html`<div class="sumline">
|
|
1533
|
+
<div class="label">
|
|
1534
|
+
${this.translateKey("invoice@@sum.total.net")}
|
|
1535
|
+
</div>
|
|
1536
|
+
<div class="value value--total rightAlign amountCell">
|
|
1537
|
+
${this.formatPrice(this.getTotalNet())}
|
|
1538
|
+
</div>
|
|
1539
|
+
</div>`}
|
|
1540
|
+
${(withoutVat ? [] : this.getVatGroups()).map((vatGroupArg) => {
|
|
1509
1541
|
let itemNumbers = vatGroupArg.items
|
|
1510
1542
|
.map((item) => (accountingDoc?.items.indexOf(item) ?? -1) + 1)
|
|
1511
1543
|
.join(", ");
|
|
@@ -1529,7 +1561,7 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1529
1561
|
`;
|
|
1530
1562
|
})}
|
|
1531
1563
|
<div class="sumline">
|
|
1532
|
-
<div class="label">${this.translateKey("invoice@@totalGross")}</div>
|
|
1564
|
+
<div class="label">${this.translateKey(withoutVat ? "invoice@@totalWithoutVat" : "invoice@@totalGross")}</div>
|
|
1533
1565
|
<div class="value value--total rightAlign amountCell">
|
|
1534
1566
|
${this.formatPrice(this.getTotalGross())}
|
|
1535
1567
|
</div>
|
|
@@ -1558,7 +1590,7 @@ export class DeContentInvoice extends DeesElement {
|
|
|
1558
1590
|
this.fitColumns(
|
|
1559
1591
|
contentNodes.currentContent,
|
|
1560
1592
|
".grid.dataHeader",
|
|
1561
|
-
positionColumns
|
|
1593
|
+
withoutVat ? positionColumnsWithoutVat : positionColumns
|
|
1562
1594
|
);
|
|
1563
1595
|
}
|
|
1564
1596
|
|
|
@@ -53,6 +53,10 @@ export class DedocumentPaymentCode extends DeesElement {
|
|
|
53
53
|
@property()
|
|
54
54
|
accessor reference!: string;
|
|
55
55
|
|
|
56
|
+
/** an ISO 11649 creditor reference for line 10; the reference (line 11) is empty beside it */
|
|
57
|
+
@property()
|
|
58
|
+
accessor creditorReference: string | undefined;
|
|
59
|
+
|
|
56
60
|
/** The EPC QR code content, or null when the payment has no valid code (see buildEpcQrPayload). */
|
|
57
61
|
private get payload(): string | null {
|
|
58
62
|
if (
|
|
@@ -71,6 +75,9 @@ export class DedocumentPaymentCode extends DeesElement {
|
|
|
71
75
|
currency: this.currency,
|
|
72
76
|
amount: this.totalGross,
|
|
73
77
|
remittanceInformation: this.reference,
|
|
78
|
+
...(typeof this.creditorReference === "string" && this.creditorReference.length > 0
|
|
79
|
+
? { creditorReference: this.creditorReference }
|
|
80
|
+
: {}),
|
|
74
81
|
});
|
|
75
82
|
}
|
|
76
83
|
|