@formfeed/engine 0.3.15 → 0.3.17
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/index.cjs +639 -4
- package/index.js +639 -4
- package/package.json +1 -1
- package/types/index.d.cts +2 -2
- package/types/index.d.ts +2 -2
- package/types/lib/einvoice/check.d.cts +1 -1
- package/types/lib/einvoice/check.d.ts +1 -1
- package/types/lib/einvoice/coverage.d.cts +28 -0
- package/types/lib/einvoice/coverage.d.ts +28 -0
- package/types/lib/einvoice/index.d.cts +1 -0
- package/types/lib/einvoice/index.d.ts +1 -0
- package/types/lib/einvoice/report.d.cts +14 -0
- package/types/lib/einvoice/report.d.ts +14 -0
package/index.js
CHANGED
|
@@ -8558,15 +8558,24 @@ var FRENCH_FRAMEWORKS = /* @__PURE__ */ new Set([
|
|
|
8558
8558
|
"B2",
|
|
8559
8559
|
"S2",
|
|
8560
8560
|
"M2",
|
|
8561
|
+
"S3",
|
|
8561
8562
|
"B4",
|
|
8562
8563
|
"S4",
|
|
8563
8564
|
"M4",
|
|
8564
8565
|
"S5",
|
|
8565
8566
|
"S6",
|
|
8566
8567
|
"B7",
|
|
8567
|
-
"S7"
|
|
8568
|
+
"S7",
|
|
8569
|
+
"B8",
|
|
8570
|
+
"S8",
|
|
8571
|
+
"M8"
|
|
8568
8572
|
]);
|
|
8569
8573
|
var FRENCH_OPERATION = { goods: "B1", services: "S1", mixed: "M1" };
|
|
8574
|
+
var FRENCH_NOTES = [
|
|
8575
|
+
["PMT", "the fixed compensation of \u20AC40 for recovery costs"],
|
|
8576
|
+
["PMD", "the penalties for late payment"],
|
|
8577
|
+
["AAB", "the discount for early payment, or that none is given"]
|
|
8578
|
+
];
|
|
8570
8579
|
var CREDIT_TRANSFER = /* @__PURE__ */ new Set(["30", "58"]);
|
|
8571
8580
|
function checkInvoice(data, options = {}) {
|
|
8572
8581
|
const problems = [];
|
|
@@ -8624,7 +8633,7 @@ function checkInvoice(data, options = {}) {
|
|
|
8624
8633
|
}
|
|
8625
8634
|
const invoice = normalise(parsed.data, add2, options);
|
|
8626
8635
|
if (problems.length > 0) return { ok: false, invoice: null, problems };
|
|
8627
|
-
rules(invoice, add2);
|
|
8636
|
+
rules(invoice, add2, options);
|
|
8628
8637
|
return problems.length > 0 ? { ok: false, invoice: null, problems } : { ok: true, invoice, problems: [] };
|
|
8629
8638
|
}
|
|
8630
8639
|
function pathText(path) {
|
|
@@ -9054,7 +9063,7 @@ function defined(value) {
|
|
|
9054
9063
|
var cents = (text4) => text4 === void 0 ? 0n : toUnits(text4, 2);
|
|
9055
9064
|
var money = (value) => fromUnits(value, 2);
|
|
9056
9065
|
var rateKey = (tax) => `${tax.category}|${tax.rate ?? ""}`;
|
|
9057
|
-
function rules(invoice, add2) {
|
|
9066
|
+
function rules(invoice, add2, options) {
|
|
9058
9067
|
const { totals: totals2 } = invoice;
|
|
9059
9068
|
const sum = (path, stated, expected, rule2, formula) => {
|
|
9060
9069
|
if (stated !== expected)
|
|
@@ -9461,6 +9470,13 @@ function rules(invoice, add2) {
|
|
|
9461
9470
|
{ rule: "BR-CO-25" }
|
|
9462
9471
|
);
|
|
9463
9472
|
if (invoice.seller.address.country === "FR" && invoice.buyer.address.country === "FR") {
|
|
9473
|
+
if (options.profile === "basic")
|
|
9474
|
+
add2(
|
|
9475
|
+
"fr_profile",
|
|
9476
|
+
"",
|
|
9477
|
+
"_invoice is an invoice between French businesses, which France's e-invoicing reform does not accept in the profile basic (AFNOR XP Z12-012 takes EN 16931 and EXTENDED-CTC-FR); use en16931",
|
|
9478
|
+
{ args: { profile: "basic" } }
|
|
9479
|
+
);
|
|
9464
9480
|
const digits = (id) => (id?.value ?? "").replace(/\s/g, "");
|
|
9465
9481
|
if (!/^\d{9}$/.test(digits(invoice.seller.legal_registration)))
|
|
9466
9482
|
add2(
|
|
@@ -9502,6 +9518,29 @@ function rules(invoice, add2) {
|
|
|
9502
9518
|
"seller.vat_on_debits",
|
|
9503
9519
|
"_invoice.seller.vat_on_debits is missing: an invoice between French businesses says whether the seller pays VAT on invoicing (true) or on payment (false)"
|
|
9504
9520
|
);
|
|
9521
|
+
const subjects = new Set(invoice.notes.map((note2) => note2.subject_code));
|
|
9522
|
+
for (const [code, what] of FRENCH_NOTES)
|
|
9523
|
+
if (!subjects.has(code))
|
|
9524
|
+
add2(
|
|
9525
|
+
"fr_note",
|
|
9526
|
+
"notes",
|
|
9527
|
+
`_invoice.notes has no note with the subject_code ${code}: an invoice between French businesses states ${what} as a note (BT-21, BT-22)`,
|
|
9528
|
+
{ rule: "BR-FR-05", args: { subject_code: code } }
|
|
9529
|
+
);
|
|
9530
|
+
if (!invoice.seller.electronic_address)
|
|
9531
|
+
add2(
|
|
9532
|
+
"fr_electronic_address",
|
|
9533
|
+
"seller.electronic_address",
|
|
9534
|
+
"_invoice.seller.electronic_address is missing: an invoice between French businesses names the seller's electronic address (BT-34)",
|
|
9535
|
+
{ rule: "BR-FR-13", args: { term: "BT-34" } }
|
|
9536
|
+
);
|
|
9537
|
+
if (!invoice.buyer.electronic_address)
|
|
9538
|
+
add2(
|
|
9539
|
+
"fr_electronic_address",
|
|
9540
|
+
"buyer.electronic_address",
|
|
9541
|
+
"_invoice.buyer.electronic_address is missing: an invoice between French businesses names the buyer's electronic address (BT-49)",
|
|
9542
|
+
{ rule: "BR-FR-12", args: { term: "BT-49" } }
|
|
9543
|
+
);
|
|
9505
9544
|
}
|
|
9506
9545
|
}
|
|
9507
9546
|
|
|
@@ -9797,6 +9836,595 @@ ${children}${indent}</${element.name}>
|
|
|
9797
9836
|
`;
|
|
9798
9837
|
}
|
|
9799
9838
|
|
|
9839
|
+
// packages/engine/src/lib/einvoice/coverage.ts
|
|
9840
|
+
var EN16931_TERMS = [
|
|
9841
|
+
{ term: "BT-1", name: "Invoice number", fields: ["number"] },
|
|
9842
|
+
{ term: "BT-2", name: "Invoice issue date", fields: ["issue_date"] },
|
|
9843
|
+
{ term: "BT-3", name: "Invoice type code", fields: ["type_code"] },
|
|
9844
|
+
{ term: "BT-5", name: "Invoice currency code", fields: ["currency"] },
|
|
9845
|
+
{
|
|
9846
|
+
term: "BT-6",
|
|
9847
|
+
name: "VAT accounting currency code",
|
|
9848
|
+
fields: ["accounting_currency"]
|
|
9849
|
+
},
|
|
9850
|
+
{ term: "BT-7", name: "Value added tax point date", fields: [] },
|
|
9851
|
+
{
|
|
9852
|
+
term: "BT-8",
|
|
9853
|
+
name: "Value added tax point date code",
|
|
9854
|
+
fields: ["seller.vat_on_debits"]
|
|
9855
|
+
},
|
|
9856
|
+
{ term: "BT-9", name: "Payment due date", fields: ["payment.due_date"] },
|
|
9857
|
+
{ term: "BT-10", name: "Buyer reference", fields: ["buyer_reference"] },
|
|
9858
|
+
{ term: "BT-11", name: "Project reference", fields: [] },
|
|
9859
|
+
{ term: "BT-12", name: "Contract reference", fields: ["contract_reference"] },
|
|
9860
|
+
{
|
|
9861
|
+
term: "BT-13",
|
|
9862
|
+
name: "Purchase order reference",
|
|
9863
|
+
fields: ["order_reference"]
|
|
9864
|
+
},
|
|
9865
|
+
{ term: "BT-14", name: "Sales order reference", fields: [] },
|
|
9866
|
+
{ term: "BT-15", name: "Receiving advice reference", fields: [] },
|
|
9867
|
+
{ term: "BT-16", name: "Despatch advice reference", fields: [] },
|
|
9868
|
+
{ term: "BT-17", name: "Tender or lot reference", fields: [] },
|
|
9869
|
+
{ term: "BT-18", name: "Invoiced object identifier", fields: [] },
|
|
9870
|
+
{ term: "BT-19", name: "Buyer accounting reference", fields: [] },
|
|
9871
|
+
{ term: "BT-20", name: "Payment terms", fields: ["payment.terms"] },
|
|
9872
|
+
{
|
|
9873
|
+
term: "BT-21",
|
|
9874
|
+
name: "Invoice note subject code",
|
|
9875
|
+
fields: ["notes[].subject_code"]
|
|
9876
|
+
},
|
|
9877
|
+
{ term: "BT-22", name: "Invoice note", fields: ["note", "notes[].text"] },
|
|
9878
|
+
{
|
|
9879
|
+
term: "BT-23",
|
|
9880
|
+
name: "Business process type",
|
|
9881
|
+
fields: ["operation", "operation_code"]
|
|
9882
|
+
},
|
|
9883
|
+
{
|
|
9884
|
+
term: "BT-24",
|
|
9885
|
+
name: "Specification identifier",
|
|
9886
|
+
fields: [],
|
|
9887
|
+
option: "profile"
|
|
9888
|
+
},
|
|
9889
|
+
{
|
|
9890
|
+
term: "BT-25",
|
|
9891
|
+
name: "Preceding Invoice reference",
|
|
9892
|
+
fields: ["preceding_invoices[].number"]
|
|
9893
|
+
},
|
|
9894
|
+
{
|
|
9895
|
+
term: "BT-26",
|
|
9896
|
+
name: "Preceding Invoice issue date",
|
|
9897
|
+
fields: ["preceding_invoices[].issue_date"]
|
|
9898
|
+
},
|
|
9899
|
+
{ term: "BT-27", name: "Seller name", fields: ["seller.name"] },
|
|
9900
|
+
{
|
|
9901
|
+
term: "BT-28",
|
|
9902
|
+
name: "Seller trading name",
|
|
9903
|
+
fields: ["seller.trading_name"]
|
|
9904
|
+
},
|
|
9905
|
+
{ term: "BT-29", name: "Seller identifier", fields: ["seller.id"] },
|
|
9906
|
+
{
|
|
9907
|
+
term: "BT-30",
|
|
9908
|
+
name: "Seller legal registration identifier",
|
|
9909
|
+
fields: ["seller.legal_registration"]
|
|
9910
|
+
},
|
|
9911
|
+
{ term: "BT-31", name: "Seller VAT identifier", fields: ["seller.vat_id"] },
|
|
9912
|
+
{
|
|
9913
|
+
term: "BT-32",
|
|
9914
|
+
name: "Seller tax registration identifier",
|
|
9915
|
+
fields: ["seller.tax_number"]
|
|
9916
|
+
},
|
|
9917
|
+
{
|
|
9918
|
+
term: "BT-33",
|
|
9919
|
+
name: "Seller additional legal information",
|
|
9920
|
+
fields: ["seller.legal_info"],
|
|
9921
|
+
en16931Only: true
|
|
9922
|
+
},
|
|
9923
|
+
{
|
|
9924
|
+
term: "BT-34",
|
|
9925
|
+
name: "Seller electronic address",
|
|
9926
|
+
fields: ["seller.electronic_address"]
|
|
9927
|
+
},
|
|
9928
|
+
{
|
|
9929
|
+
term: "BT-35",
|
|
9930
|
+
name: "Seller address line 1",
|
|
9931
|
+
fields: ["seller.address.street"]
|
|
9932
|
+
},
|
|
9933
|
+
{
|
|
9934
|
+
term: "BT-36",
|
|
9935
|
+
name: "Seller address line 2",
|
|
9936
|
+
fields: ["seller.address.street2"]
|
|
9937
|
+
},
|
|
9938
|
+
{ term: "BT-37", name: "Seller city", fields: ["seller.address.city"] },
|
|
9939
|
+
{
|
|
9940
|
+
term: "BT-38",
|
|
9941
|
+
name: "Seller post code",
|
|
9942
|
+
fields: ["seller.address.postcode"]
|
|
9943
|
+
},
|
|
9944
|
+
{
|
|
9945
|
+
term: "BT-39",
|
|
9946
|
+
name: "Seller country subdivision",
|
|
9947
|
+
fields: ["seller.address.subdivision"]
|
|
9948
|
+
},
|
|
9949
|
+
{
|
|
9950
|
+
term: "BT-40",
|
|
9951
|
+
name: "Seller country code",
|
|
9952
|
+
fields: ["seller.address.country"]
|
|
9953
|
+
},
|
|
9954
|
+
{
|
|
9955
|
+
term: "BT-41",
|
|
9956
|
+
name: "Seller contact point",
|
|
9957
|
+
fields: ["seller.contact.name"],
|
|
9958
|
+
en16931Only: true
|
|
9959
|
+
},
|
|
9960
|
+
{
|
|
9961
|
+
term: "BT-42",
|
|
9962
|
+
name: "Seller contact telephone number",
|
|
9963
|
+
fields: ["seller.contact.phone"],
|
|
9964
|
+
en16931Only: true
|
|
9965
|
+
},
|
|
9966
|
+
{
|
|
9967
|
+
term: "BT-43",
|
|
9968
|
+
name: "Seller contact email address",
|
|
9969
|
+
fields: ["seller.contact.email"],
|
|
9970
|
+
en16931Only: true
|
|
9971
|
+
},
|
|
9972
|
+
{ term: "BT-44", name: "Buyer name", fields: ["buyer.name"] },
|
|
9973
|
+
{ term: "BT-45", name: "Buyer trading name", fields: ["buyer.trading_name"] },
|
|
9974
|
+
{ term: "BT-46", name: "Buyer identifier", fields: ["buyer.id"] },
|
|
9975
|
+
{
|
|
9976
|
+
term: "BT-47",
|
|
9977
|
+
name: "Buyer legal registration identifier",
|
|
9978
|
+
fields: ["buyer.legal_registration", "buyer.siren"]
|
|
9979
|
+
},
|
|
9980
|
+
{ term: "BT-48", name: "Buyer VAT identifier", fields: ["buyer.vat_id"] },
|
|
9981
|
+
{
|
|
9982
|
+
term: "BT-49",
|
|
9983
|
+
name: "Buyer electronic address",
|
|
9984
|
+
fields: ["buyer.electronic_address"]
|
|
9985
|
+
},
|
|
9986
|
+
{
|
|
9987
|
+
term: "BT-50",
|
|
9988
|
+
name: "Buyer address line 1",
|
|
9989
|
+
fields: ["buyer.address.street"]
|
|
9990
|
+
},
|
|
9991
|
+
{
|
|
9992
|
+
term: "BT-51",
|
|
9993
|
+
name: "Buyer address line 2",
|
|
9994
|
+
fields: ["buyer.address.street2"]
|
|
9995
|
+
},
|
|
9996
|
+
{ term: "BT-52", name: "Buyer city", fields: ["buyer.address.city"] },
|
|
9997
|
+
{
|
|
9998
|
+
term: "BT-53",
|
|
9999
|
+
name: "Buyer post code",
|
|
10000
|
+
fields: ["buyer.address.postcode"]
|
|
10001
|
+
},
|
|
10002
|
+
{
|
|
10003
|
+
term: "BT-54",
|
|
10004
|
+
name: "Buyer country subdivision",
|
|
10005
|
+
fields: ["buyer.address.subdivision"]
|
|
10006
|
+
},
|
|
10007
|
+
{
|
|
10008
|
+
term: "BT-55",
|
|
10009
|
+
name: "Buyer country code",
|
|
10010
|
+
fields: ["buyer.address.country"]
|
|
10011
|
+
},
|
|
10012
|
+
{
|
|
10013
|
+
term: "BT-56",
|
|
10014
|
+
name: "Buyer contact point",
|
|
10015
|
+
fields: ["buyer.contact.name"],
|
|
10016
|
+
en16931Only: true
|
|
10017
|
+
},
|
|
10018
|
+
{
|
|
10019
|
+
term: "BT-57",
|
|
10020
|
+
name: "Buyer contact telephone number",
|
|
10021
|
+
fields: ["buyer.contact.phone"],
|
|
10022
|
+
en16931Only: true
|
|
10023
|
+
},
|
|
10024
|
+
{
|
|
10025
|
+
term: "BT-58",
|
|
10026
|
+
name: "Buyer contact email address",
|
|
10027
|
+
fields: ["buyer.contact.email"],
|
|
10028
|
+
en16931Only: true
|
|
10029
|
+
},
|
|
10030
|
+
{ term: "BT-59", name: "Payee name", fields: [] },
|
|
10031
|
+
{ term: "BT-60", name: "Payee identifier", fields: [] },
|
|
10032
|
+
{ term: "BT-61", name: "Payee legal registration identifier", fields: [] },
|
|
10033
|
+
{ term: "BT-62", name: "Seller tax representative name", fields: [] },
|
|
10034
|
+
{
|
|
10035
|
+
term: "BT-63",
|
|
10036
|
+
name: "Seller tax representative VAT identifier",
|
|
10037
|
+
fields: []
|
|
10038
|
+
},
|
|
10039
|
+
{ term: "BT-64", name: "Tax representative address line 1", fields: [] },
|
|
10040
|
+
{ term: "BT-65", name: "Tax representative address line 2", fields: [] },
|
|
10041
|
+
{ term: "BT-66", name: "Tax representative city", fields: [] },
|
|
10042
|
+
{ term: "BT-67", name: "Tax representative post code", fields: [] },
|
|
10043
|
+
{ term: "BT-68", name: "Tax representative country subdivision", fields: [] },
|
|
10044
|
+
{ term: "BT-69", name: "Tax representative country code", fields: [] },
|
|
10045
|
+
{ term: "BT-70", name: "Deliver to party name", fields: ["delivery.name"] },
|
|
10046
|
+
{ term: "BT-71", name: "Deliver to location identifier", fields: [] },
|
|
10047
|
+
{ term: "BT-72", name: "Actual delivery date", fields: ["delivery.date"] },
|
|
10048
|
+
{
|
|
10049
|
+
term: "BT-73",
|
|
10050
|
+
name: "Invoicing period start date",
|
|
10051
|
+
fields: ["period.start"]
|
|
10052
|
+
},
|
|
10053
|
+
{ term: "BT-74", name: "Invoicing period end date", fields: ["period.end"] },
|
|
10054
|
+
{
|
|
10055
|
+
term: "BT-75",
|
|
10056
|
+
name: "Deliver to address line 1",
|
|
10057
|
+
fields: ["delivery.address.street"]
|
|
10058
|
+
},
|
|
10059
|
+
{
|
|
10060
|
+
term: "BT-76",
|
|
10061
|
+
name: "Deliver to address line 2",
|
|
10062
|
+
fields: ["delivery.address.street2"]
|
|
10063
|
+
},
|
|
10064
|
+
{ term: "BT-77", name: "Deliver to city", fields: ["delivery.address.city"] },
|
|
10065
|
+
{
|
|
10066
|
+
term: "BT-78",
|
|
10067
|
+
name: "Deliver to post code",
|
|
10068
|
+
fields: ["delivery.address.postcode"]
|
|
10069
|
+
},
|
|
10070
|
+
{
|
|
10071
|
+
term: "BT-79",
|
|
10072
|
+
name: "Deliver to country subdivision",
|
|
10073
|
+
fields: ["delivery.address.subdivision"]
|
|
10074
|
+
},
|
|
10075
|
+
{
|
|
10076
|
+
term: "BT-80",
|
|
10077
|
+
name: "Deliver to country code",
|
|
10078
|
+
fields: ["delivery.address.country"]
|
|
10079
|
+
},
|
|
10080
|
+
{
|
|
10081
|
+
term: "BT-81",
|
|
10082
|
+
name: "Payment means type code",
|
|
10083
|
+
fields: ["payment.means_code"]
|
|
10084
|
+
},
|
|
10085
|
+
{ term: "BT-82", name: "Payment means text", fields: [] },
|
|
10086
|
+
{
|
|
10087
|
+
term: "BT-83",
|
|
10088
|
+
name: "Remittance information",
|
|
10089
|
+
fields: ["payment.reference"]
|
|
10090
|
+
},
|
|
10091
|
+
{
|
|
10092
|
+
term: "BT-84",
|
|
10093
|
+
name: "Payment account identifier",
|
|
10094
|
+
fields: ["payment.iban"]
|
|
10095
|
+
},
|
|
10096
|
+
{
|
|
10097
|
+
term: "BT-85",
|
|
10098
|
+
name: "Payment account name",
|
|
10099
|
+
fields: ["payment.account_name"],
|
|
10100
|
+
en16931Only: true
|
|
10101
|
+
},
|
|
10102
|
+
{
|
|
10103
|
+
term: "BT-86",
|
|
10104
|
+
name: "Payment service provider identifier",
|
|
10105
|
+
fields: ["payment.bic"],
|
|
10106
|
+
en16931Only: true
|
|
10107
|
+
},
|
|
10108
|
+
{ term: "BT-87", name: "Payment card primary account number", fields: [] },
|
|
10109
|
+
{ term: "BT-88", name: "Payment card holder name", fields: [] },
|
|
10110
|
+
{
|
|
10111
|
+
term: "BT-89",
|
|
10112
|
+
name: "Mandate reference identifier",
|
|
10113
|
+
fields: ["payment.mandate_id"]
|
|
10114
|
+
},
|
|
10115
|
+
{
|
|
10116
|
+
term: "BT-90",
|
|
10117
|
+
name: "Bank assigned creditor identifier",
|
|
10118
|
+
fields: ["payment.creditor_id"]
|
|
10119
|
+
},
|
|
10120
|
+
{
|
|
10121
|
+
term: "BT-91",
|
|
10122
|
+
name: "Debited account identifier",
|
|
10123
|
+
fields: ["payment.debited_iban"]
|
|
10124
|
+
},
|
|
10125
|
+
{
|
|
10126
|
+
term: "BT-92",
|
|
10127
|
+
name: "Document level allowance amount",
|
|
10128
|
+
fields: ["allowances[].amount"]
|
|
10129
|
+
},
|
|
10130
|
+
{
|
|
10131
|
+
term: "BT-93",
|
|
10132
|
+
name: "Document level allowance base amount",
|
|
10133
|
+
fields: ["allowances[].base_amount"]
|
|
10134
|
+
},
|
|
10135
|
+
{
|
|
10136
|
+
term: "BT-94",
|
|
10137
|
+
name: "Document level allowance percentage",
|
|
10138
|
+
fields: ["allowances[].percent"]
|
|
10139
|
+
},
|
|
10140
|
+
{
|
|
10141
|
+
term: "BT-95",
|
|
10142
|
+
name: "Document level allowance VAT category code",
|
|
10143
|
+
fields: ["allowances[].tax.category"]
|
|
10144
|
+
},
|
|
10145
|
+
{
|
|
10146
|
+
term: "BT-96",
|
|
10147
|
+
name: "Document level allowance VAT rate",
|
|
10148
|
+
fields: ["allowances[].tax.rate"]
|
|
10149
|
+
},
|
|
10150
|
+
{
|
|
10151
|
+
term: "BT-97",
|
|
10152
|
+
name: "Document level allowance reason",
|
|
10153
|
+
fields: ["allowances[].reason"]
|
|
10154
|
+
},
|
|
10155
|
+
{
|
|
10156
|
+
term: "BT-98",
|
|
10157
|
+
name: "Document level allowance reason code",
|
|
10158
|
+
fields: ["allowances[].reason_code"]
|
|
10159
|
+
},
|
|
10160
|
+
{
|
|
10161
|
+
term: "BT-99",
|
|
10162
|
+
name: "Document level charge amount",
|
|
10163
|
+
fields: ["charges[].amount"]
|
|
10164
|
+
},
|
|
10165
|
+
{
|
|
10166
|
+
term: "BT-100",
|
|
10167
|
+
name: "Document level charge base amount",
|
|
10168
|
+
fields: ["charges[].base_amount"]
|
|
10169
|
+
},
|
|
10170
|
+
{
|
|
10171
|
+
term: "BT-101",
|
|
10172
|
+
name: "Document level charge percentage",
|
|
10173
|
+
fields: ["charges[].percent"]
|
|
10174
|
+
},
|
|
10175
|
+
{
|
|
10176
|
+
term: "BT-102",
|
|
10177
|
+
name: "Document level charge VAT category code",
|
|
10178
|
+
fields: ["charges[].tax.category"]
|
|
10179
|
+
},
|
|
10180
|
+
{
|
|
10181
|
+
term: "BT-103",
|
|
10182
|
+
name: "Document level charge VAT rate",
|
|
10183
|
+
fields: ["charges[].tax.rate"]
|
|
10184
|
+
},
|
|
10185
|
+
{
|
|
10186
|
+
term: "BT-104",
|
|
10187
|
+
name: "Document level charge reason",
|
|
10188
|
+
fields: ["charges[].reason"]
|
|
10189
|
+
},
|
|
10190
|
+
{
|
|
10191
|
+
term: "BT-105",
|
|
10192
|
+
name: "Document level charge reason code",
|
|
10193
|
+
fields: ["charges[].reason_code"]
|
|
10194
|
+
},
|
|
10195
|
+
{
|
|
10196
|
+
term: "BT-106",
|
|
10197
|
+
name: "Sum of Invoice line net amount",
|
|
10198
|
+
fields: ["totals.line_net"]
|
|
10199
|
+
},
|
|
10200
|
+
{
|
|
10201
|
+
term: "BT-107",
|
|
10202
|
+
name: "Sum of allowances on document level",
|
|
10203
|
+
fields: ["totals.allowances"]
|
|
10204
|
+
},
|
|
10205
|
+
{
|
|
10206
|
+
term: "BT-108",
|
|
10207
|
+
name: "Sum of charges on document level",
|
|
10208
|
+
fields: ["totals.charges"]
|
|
10209
|
+
},
|
|
10210
|
+
{
|
|
10211
|
+
term: "BT-109",
|
|
10212
|
+
name: "Invoice total amount without VAT",
|
|
10213
|
+
fields: ["totals.tax_basis"]
|
|
10214
|
+
},
|
|
10215
|
+
{
|
|
10216
|
+
term: "BT-110",
|
|
10217
|
+
name: "Invoice total VAT amount",
|
|
10218
|
+
fields: ["totals.tax_total"]
|
|
10219
|
+
},
|
|
10220
|
+
{
|
|
10221
|
+
term: "BT-111",
|
|
10222
|
+
name: "Invoice total VAT amount in accounting currency",
|
|
10223
|
+
fields: ["totals.tax_total_accounting"]
|
|
10224
|
+
},
|
|
10225
|
+
{
|
|
10226
|
+
term: "BT-112",
|
|
10227
|
+
name: "Invoice total amount with VAT",
|
|
10228
|
+
fields: ["totals.grand"]
|
|
10229
|
+
},
|
|
10230
|
+
{ term: "BT-113", name: "Paid amount", fields: ["totals.prepaid"] },
|
|
10231
|
+
{
|
|
10232
|
+
term: "BT-114",
|
|
10233
|
+
name: "Rounding amount",
|
|
10234
|
+
fields: ["totals.rounding"],
|
|
10235
|
+
en16931Only: true
|
|
10236
|
+
},
|
|
10237
|
+
{ term: "BT-115", name: "Amount due for payment", fields: ["totals.due"] },
|
|
10238
|
+
{
|
|
10239
|
+
term: "BT-116",
|
|
10240
|
+
name: "VAT category taxable amount",
|
|
10241
|
+
fields: ["tax.breakdown[].basis"]
|
|
10242
|
+
},
|
|
10243
|
+
{
|
|
10244
|
+
term: "BT-117",
|
|
10245
|
+
name: "VAT category tax amount",
|
|
10246
|
+
fields: ["tax.breakdown[].amount"]
|
|
10247
|
+
},
|
|
10248
|
+
{
|
|
10249
|
+
term: "BT-118",
|
|
10250
|
+
name: "VAT category code",
|
|
10251
|
+
fields: ["tax.breakdown[].category"]
|
|
10252
|
+
},
|
|
10253
|
+
{
|
|
10254
|
+
term: "BT-119",
|
|
10255
|
+
name: "VAT category rate",
|
|
10256
|
+
fields: ["tax.breakdown[].rate"]
|
|
10257
|
+
},
|
|
10258
|
+
{
|
|
10259
|
+
term: "BT-120",
|
|
10260
|
+
name: "VAT exemption reason text",
|
|
10261
|
+
fields: ["tax.breakdown[].exemption_reason"]
|
|
10262
|
+
},
|
|
10263
|
+
{
|
|
10264
|
+
term: "BT-121",
|
|
10265
|
+
name: "VAT exemption reason code",
|
|
10266
|
+
fields: ["tax.breakdown[].exemption_reason_code"]
|
|
10267
|
+
},
|
|
10268
|
+
{ term: "BT-122", name: "Supporting document reference", fields: [] },
|
|
10269
|
+
{ term: "BT-123", name: "Supporting document description", fields: [] },
|
|
10270
|
+
{ term: "BT-124", name: "External document location", fields: [] },
|
|
10271
|
+
{ term: "BT-125", name: "Attached document", fields: [] },
|
|
10272
|
+
{ term: "BT-126", name: "Invoice line identifier", fields: ["lines[].id"] },
|
|
10273
|
+
{ term: "BT-127", name: "Invoice line note", fields: ["lines[].note"] },
|
|
10274
|
+
{ term: "BT-128", name: "Invoice line object identifier", fields: [] },
|
|
10275
|
+
{ term: "BT-129", name: "Invoiced quantity", fields: ["lines[].quantity"] },
|
|
10276
|
+
{
|
|
10277
|
+
term: "BT-130",
|
|
10278
|
+
name: "Invoiced quantity unit of measure code",
|
|
10279
|
+
fields: ["lines[].unit_code"]
|
|
10280
|
+
},
|
|
10281
|
+
{
|
|
10282
|
+
term: "BT-131",
|
|
10283
|
+
name: "Invoice line net amount",
|
|
10284
|
+
fields: ["lines[].net_amount"]
|
|
10285
|
+
},
|
|
10286
|
+
{
|
|
10287
|
+
term: "BT-132",
|
|
10288
|
+
name: "Referenced purchase order line reference",
|
|
10289
|
+
fields: ["lines[].order_line_reference"],
|
|
10290
|
+
en16931Only: true
|
|
10291
|
+
},
|
|
10292
|
+
{
|
|
10293
|
+
term: "BT-133",
|
|
10294
|
+
name: "Invoice line Buyer accounting reference",
|
|
10295
|
+
fields: ["lines[].buyer_accounting_reference"],
|
|
10296
|
+
en16931Only: true
|
|
10297
|
+
},
|
|
10298
|
+
{
|
|
10299
|
+
term: "BT-134",
|
|
10300
|
+
name: "Invoice line period start date",
|
|
10301
|
+
fields: ["lines[].period.start"]
|
|
10302
|
+
},
|
|
10303
|
+
{
|
|
10304
|
+
term: "BT-135",
|
|
10305
|
+
name: "Invoice line period end date",
|
|
10306
|
+
fields: ["lines[].period.end"]
|
|
10307
|
+
},
|
|
10308
|
+
{
|
|
10309
|
+
term: "BT-136",
|
|
10310
|
+
name: "Invoice line allowance amount",
|
|
10311
|
+
fields: ["lines[].allowances[].amount"]
|
|
10312
|
+
},
|
|
10313
|
+
{
|
|
10314
|
+
term: "BT-137",
|
|
10315
|
+
name: "Invoice line allowance base amount",
|
|
10316
|
+
fields: ["lines[].allowances[].base_amount"]
|
|
10317
|
+
},
|
|
10318
|
+
{
|
|
10319
|
+
term: "BT-138",
|
|
10320
|
+
name: "Invoice line allowance percentage",
|
|
10321
|
+
fields: ["lines[].allowances[].percent"]
|
|
10322
|
+
},
|
|
10323
|
+
{
|
|
10324
|
+
term: "BT-139",
|
|
10325
|
+
name: "Invoice line allowance reason",
|
|
10326
|
+
fields: ["lines[].allowances[].reason"]
|
|
10327
|
+
},
|
|
10328
|
+
{
|
|
10329
|
+
term: "BT-140",
|
|
10330
|
+
name: "Invoice line allowance reason code",
|
|
10331
|
+
fields: ["lines[].allowances[].reason_code"]
|
|
10332
|
+
},
|
|
10333
|
+
{
|
|
10334
|
+
term: "BT-141",
|
|
10335
|
+
name: "Invoice line charge amount",
|
|
10336
|
+
fields: ["lines[].charges[].amount"]
|
|
10337
|
+
},
|
|
10338
|
+
{
|
|
10339
|
+
term: "BT-142",
|
|
10340
|
+
name: "Invoice line charge base amount",
|
|
10341
|
+
fields: ["lines[].charges[].base_amount"]
|
|
10342
|
+
},
|
|
10343
|
+
{
|
|
10344
|
+
term: "BT-143",
|
|
10345
|
+
name: "Invoice line charge percentage",
|
|
10346
|
+
fields: ["lines[].charges[].percent"]
|
|
10347
|
+
},
|
|
10348
|
+
{
|
|
10349
|
+
term: "BT-144",
|
|
10350
|
+
name: "Invoice line charge reason",
|
|
10351
|
+
fields: ["lines[].charges[].reason"]
|
|
10352
|
+
},
|
|
10353
|
+
{
|
|
10354
|
+
term: "BT-145",
|
|
10355
|
+
name: "Invoice line charge reason code",
|
|
10356
|
+
fields: ["lines[].charges[].reason_code"]
|
|
10357
|
+
},
|
|
10358
|
+
{ term: "BT-146", name: "Item net price", fields: ["lines[].net_price"] },
|
|
10359
|
+
{ term: "BT-147", name: "Item price discount", fields: [] },
|
|
10360
|
+
{ term: "BT-148", name: "Item gross price", fields: [] },
|
|
10361
|
+
{
|
|
10362
|
+
term: "BT-149",
|
|
10363
|
+
name: "Item price base quantity",
|
|
10364
|
+
fields: ["lines[].price_base_quantity"]
|
|
10365
|
+
},
|
|
10366
|
+
{
|
|
10367
|
+
term: "BT-150",
|
|
10368
|
+
name: "Item price base quantity unit of measure",
|
|
10369
|
+
fields: ["lines[].unit_code"]
|
|
10370
|
+
},
|
|
10371
|
+
{
|
|
10372
|
+
term: "BT-151",
|
|
10373
|
+
name: "Invoiced item VAT category code",
|
|
10374
|
+
fields: ["lines[].tax.category"]
|
|
10375
|
+
},
|
|
10376
|
+
{
|
|
10377
|
+
term: "BT-152",
|
|
10378
|
+
name: "Invoiced item VAT rate",
|
|
10379
|
+
fields: ["lines[].tax.rate"]
|
|
10380
|
+
},
|
|
10381
|
+
{ term: "BT-153", name: "Item name", fields: ["lines[].name"] },
|
|
10382
|
+
{
|
|
10383
|
+
term: "BT-154",
|
|
10384
|
+
name: "Item description",
|
|
10385
|
+
fields: ["lines[].description"],
|
|
10386
|
+
en16931Only: true
|
|
10387
|
+
},
|
|
10388
|
+
{
|
|
10389
|
+
term: "BT-155",
|
|
10390
|
+
name: "Item Sellers identifier",
|
|
10391
|
+
fields: ["lines[].seller_item_id"],
|
|
10392
|
+
en16931Only: true
|
|
10393
|
+
},
|
|
10394
|
+
{
|
|
10395
|
+
term: "BT-156",
|
|
10396
|
+
name: "Item Buyers identifier",
|
|
10397
|
+
fields: ["lines[].buyer_item_id"],
|
|
10398
|
+
en16931Only: true
|
|
10399
|
+
},
|
|
10400
|
+
{
|
|
10401
|
+
term: "BT-157",
|
|
10402
|
+
name: "Item standard identifier",
|
|
10403
|
+
fields: ["lines[].standard_item_id"]
|
|
10404
|
+
},
|
|
10405
|
+
{ term: "BT-158", name: "Item classification identifier", fields: [] },
|
|
10406
|
+
{ term: "BT-159", name: "Item country of origin", fields: [] },
|
|
10407
|
+
{ term: "BT-160", name: "Item attribute name", fields: [] },
|
|
10408
|
+
{ term: "BT-161", name: "Item attribute value", fields: [] },
|
|
10409
|
+
{
|
|
10410
|
+
term: "BT-162",
|
|
10411
|
+
name: "Seller address line 3",
|
|
10412
|
+
fields: ["seller.address.street3"]
|
|
10413
|
+
},
|
|
10414
|
+
{
|
|
10415
|
+
term: "BT-163",
|
|
10416
|
+
name: "Buyer address line 3",
|
|
10417
|
+
fields: ["buyer.address.street3"]
|
|
10418
|
+
},
|
|
10419
|
+
{ term: "BT-164", name: "Tax representative address line 3", fields: [] },
|
|
10420
|
+
{
|
|
10421
|
+
term: "BT-165",
|
|
10422
|
+
name: "Deliver to address line 3",
|
|
10423
|
+
fields: ["delivery.address.street3"]
|
|
10424
|
+
}
|
|
10425
|
+
];
|
|
10426
|
+
var carriesTerm = (term) => term.fields.length > 0 || term.option !== void 0;
|
|
10427
|
+
|
|
9800
10428
|
// packages/engine/src/lib/einvoice/display.ts
|
|
9801
10429
|
var DISPLAY_TERMS = {
|
|
9802
10430
|
"BT-1": "invoice number",
|
|
@@ -10070,7 +10698,12 @@ function einvoiceResult(options, specVersion, validation, display) {
|
|
|
10070
10698
|
valid: validation.valid,
|
|
10071
10699
|
schematron: validation.schematron,
|
|
10072
10700
|
pdfa: validation.pdfa,
|
|
10073
|
-
...capMessages(validation.messages)
|
|
10701
|
+
...capMessages(validation.messages),
|
|
10702
|
+
// what judged which bytes: the report a business keeps as its proof names both
|
|
10703
|
+
...validation.id ? { id: validation.id } : {},
|
|
10704
|
+
...validation.versions ? { versions: validation.versions } : {},
|
|
10705
|
+
...validation.xml_sha256 ? { xml_sha256: validation.xml_sha256 } : {},
|
|
10706
|
+
...validation.pdf_sha256 !== void 0 ? { pdf_sha256: validation.pdf_sha256 } : {}
|
|
10074
10707
|
} : null,
|
|
10075
10708
|
display: display ? { checked: display.checked, missing: display.missing } : null
|
|
10076
10709
|
};
|
|
@@ -13516,6 +14149,7 @@ export {
|
|
|
13516
14149
|
EINVOICE_PROFILE_NAMES,
|
|
13517
14150
|
EINVOICE_SPEC_VERSIONS,
|
|
13518
14151
|
EINVOICE_XML_NAME,
|
|
14152
|
+
EN16931_TERMS,
|
|
13519
14153
|
EPC_MAX_BYTES,
|
|
13520
14154
|
EngineSyntaxError,
|
|
13521
14155
|
INVOICE_DATA_KEY,
|
|
@@ -13544,6 +14178,7 @@ export {
|
|
|
13544
14178
|
builtinHelpers,
|
|
13545
14179
|
canvasDocument,
|
|
13546
14180
|
capMessages,
|
|
14181
|
+
carriesTerm,
|
|
13547
14182
|
chartInitScript,
|
|
13548
14183
|
chartMarkup,
|
|
13549
14184
|
chartPayload,
|