@formfeed/engine 0.3.16 → 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.cjs
CHANGED
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
EINVOICE_PROFILE_NAMES: () => EINVOICE_PROFILE_NAMES,
|
|
53
53
|
EINVOICE_SPEC_VERSIONS: () => EINVOICE_SPEC_VERSIONS,
|
|
54
54
|
EINVOICE_XML_NAME: () => EINVOICE_XML_NAME,
|
|
55
|
+
EN16931_TERMS: () => EN16931_TERMS,
|
|
55
56
|
EPC_MAX_BYTES: () => EPC_MAX_BYTES,
|
|
56
57
|
EngineSyntaxError: () => EngineSyntaxError,
|
|
57
58
|
INVOICE_DATA_KEY: () => INVOICE_DATA_KEY,
|
|
@@ -80,6 +81,7 @@ __export(index_exports, {
|
|
|
80
81
|
builtinHelpers: () => builtinHelpers,
|
|
81
82
|
canvasDocument: () => canvasDocument,
|
|
82
83
|
capMessages: () => capMessages,
|
|
84
|
+
carriesTerm: () => carriesTerm,
|
|
83
85
|
chartInitScript: () => chartInitScript,
|
|
84
86
|
chartMarkup: () => chartMarkup,
|
|
85
87
|
chartPayload: () => chartPayload,
|
|
@@ -8776,15 +8778,24 @@ var FRENCH_FRAMEWORKS = /* @__PURE__ */ new Set([
|
|
|
8776
8778
|
"B2",
|
|
8777
8779
|
"S2",
|
|
8778
8780
|
"M2",
|
|
8781
|
+
"S3",
|
|
8779
8782
|
"B4",
|
|
8780
8783
|
"S4",
|
|
8781
8784
|
"M4",
|
|
8782
8785
|
"S5",
|
|
8783
8786
|
"S6",
|
|
8784
8787
|
"B7",
|
|
8785
|
-
"S7"
|
|
8788
|
+
"S7",
|
|
8789
|
+
"B8",
|
|
8790
|
+
"S8",
|
|
8791
|
+
"M8"
|
|
8786
8792
|
]);
|
|
8787
8793
|
var FRENCH_OPERATION = { goods: "B1", services: "S1", mixed: "M1" };
|
|
8794
|
+
var FRENCH_NOTES = [
|
|
8795
|
+
["PMT", "the fixed compensation of \u20AC40 for recovery costs"],
|
|
8796
|
+
["PMD", "the penalties for late payment"],
|
|
8797
|
+
["AAB", "the discount for early payment, or that none is given"]
|
|
8798
|
+
];
|
|
8788
8799
|
var CREDIT_TRANSFER = /* @__PURE__ */ new Set(["30", "58"]);
|
|
8789
8800
|
function checkInvoice(data, options = {}) {
|
|
8790
8801
|
const problems = [];
|
|
@@ -8842,7 +8853,7 @@ function checkInvoice(data, options = {}) {
|
|
|
8842
8853
|
}
|
|
8843
8854
|
const invoice = normalise(parsed.data, add2, options);
|
|
8844
8855
|
if (problems.length > 0) return { ok: false, invoice: null, problems };
|
|
8845
|
-
rules(invoice, add2);
|
|
8856
|
+
rules(invoice, add2, options);
|
|
8846
8857
|
return problems.length > 0 ? { ok: false, invoice: null, problems } : { ok: true, invoice, problems: [] };
|
|
8847
8858
|
}
|
|
8848
8859
|
function pathText(path) {
|
|
@@ -9272,7 +9283,7 @@ function defined(value) {
|
|
|
9272
9283
|
var cents = (text4) => text4 === void 0 ? 0n : toUnits(text4, 2);
|
|
9273
9284
|
var money = (value) => fromUnits(value, 2);
|
|
9274
9285
|
var rateKey = (tax) => `${tax.category}|${tax.rate ?? ""}`;
|
|
9275
|
-
function rules(invoice, add2) {
|
|
9286
|
+
function rules(invoice, add2, options) {
|
|
9276
9287
|
const { totals: totals2 } = invoice;
|
|
9277
9288
|
const sum = (path, stated, expected, rule2, formula) => {
|
|
9278
9289
|
if (stated !== expected)
|
|
@@ -9679,6 +9690,13 @@ function rules(invoice, add2) {
|
|
|
9679
9690
|
{ rule: "BR-CO-25" }
|
|
9680
9691
|
);
|
|
9681
9692
|
if (invoice.seller.address.country === "FR" && invoice.buyer.address.country === "FR") {
|
|
9693
|
+
if (options.profile === "basic")
|
|
9694
|
+
add2(
|
|
9695
|
+
"fr_profile",
|
|
9696
|
+
"",
|
|
9697
|
+
"_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",
|
|
9698
|
+
{ args: { profile: "basic" } }
|
|
9699
|
+
);
|
|
9682
9700
|
const digits = (id) => (id?.value ?? "").replace(/\s/g, "");
|
|
9683
9701
|
if (!/^\d{9}$/.test(digits(invoice.seller.legal_registration)))
|
|
9684
9702
|
add2(
|
|
@@ -9720,6 +9738,29 @@ function rules(invoice, add2) {
|
|
|
9720
9738
|
"seller.vat_on_debits",
|
|
9721
9739
|
"_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)"
|
|
9722
9740
|
);
|
|
9741
|
+
const subjects = new Set(invoice.notes.map((note2) => note2.subject_code));
|
|
9742
|
+
for (const [code, what] of FRENCH_NOTES)
|
|
9743
|
+
if (!subjects.has(code))
|
|
9744
|
+
add2(
|
|
9745
|
+
"fr_note",
|
|
9746
|
+
"notes",
|
|
9747
|
+
`_invoice.notes has no note with the subject_code ${code}: an invoice between French businesses states ${what} as a note (BT-21, BT-22)`,
|
|
9748
|
+
{ rule: "BR-FR-05", args: { subject_code: code } }
|
|
9749
|
+
);
|
|
9750
|
+
if (!invoice.seller.electronic_address)
|
|
9751
|
+
add2(
|
|
9752
|
+
"fr_electronic_address",
|
|
9753
|
+
"seller.electronic_address",
|
|
9754
|
+
"_invoice.seller.electronic_address is missing: an invoice between French businesses names the seller's electronic address (BT-34)",
|
|
9755
|
+
{ rule: "BR-FR-13", args: { term: "BT-34" } }
|
|
9756
|
+
);
|
|
9757
|
+
if (!invoice.buyer.electronic_address)
|
|
9758
|
+
add2(
|
|
9759
|
+
"fr_electronic_address",
|
|
9760
|
+
"buyer.electronic_address",
|
|
9761
|
+
"_invoice.buyer.electronic_address is missing: an invoice between French businesses names the buyer's electronic address (BT-49)",
|
|
9762
|
+
{ rule: "BR-FR-12", args: { term: "BT-49" } }
|
|
9763
|
+
);
|
|
9723
9764
|
}
|
|
9724
9765
|
}
|
|
9725
9766
|
|
|
@@ -10015,6 +10056,595 @@ ${children}${indent}</${element.name}>
|
|
|
10015
10056
|
`;
|
|
10016
10057
|
}
|
|
10017
10058
|
|
|
10059
|
+
// packages/engine/src/lib/einvoice/coverage.ts
|
|
10060
|
+
var EN16931_TERMS = [
|
|
10061
|
+
{ term: "BT-1", name: "Invoice number", fields: ["number"] },
|
|
10062
|
+
{ term: "BT-2", name: "Invoice issue date", fields: ["issue_date"] },
|
|
10063
|
+
{ term: "BT-3", name: "Invoice type code", fields: ["type_code"] },
|
|
10064
|
+
{ term: "BT-5", name: "Invoice currency code", fields: ["currency"] },
|
|
10065
|
+
{
|
|
10066
|
+
term: "BT-6",
|
|
10067
|
+
name: "VAT accounting currency code",
|
|
10068
|
+
fields: ["accounting_currency"]
|
|
10069
|
+
},
|
|
10070
|
+
{ term: "BT-7", name: "Value added tax point date", fields: [] },
|
|
10071
|
+
{
|
|
10072
|
+
term: "BT-8",
|
|
10073
|
+
name: "Value added tax point date code",
|
|
10074
|
+
fields: ["seller.vat_on_debits"]
|
|
10075
|
+
},
|
|
10076
|
+
{ term: "BT-9", name: "Payment due date", fields: ["payment.due_date"] },
|
|
10077
|
+
{ term: "BT-10", name: "Buyer reference", fields: ["buyer_reference"] },
|
|
10078
|
+
{ term: "BT-11", name: "Project reference", fields: [] },
|
|
10079
|
+
{ term: "BT-12", name: "Contract reference", fields: ["contract_reference"] },
|
|
10080
|
+
{
|
|
10081
|
+
term: "BT-13",
|
|
10082
|
+
name: "Purchase order reference",
|
|
10083
|
+
fields: ["order_reference"]
|
|
10084
|
+
},
|
|
10085
|
+
{ term: "BT-14", name: "Sales order reference", fields: [] },
|
|
10086
|
+
{ term: "BT-15", name: "Receiving advice reference", fields: [] },
|
|
10087
|
+
{ term: "BT-16", name: "Despatch advice reference", fields: [] },
|
|
10088
|
+
{ term: "BT-17", name: "Tender or lot reference", fields: [] },
|
|
10089
|
+
{ term: "BT-18", name: "Invoiced object identifier", fields: [] },
|
|
10090
|
+
{ term: "BT-19", name: "Buyer accounting reference", fields: [] },
|
|
10091
|
+
{ term: "BT-20", name: "Payment terms", fields: ["payment.terms"] },
|
|
10092
|
+
{
|
|
10093
|
+
term: "BT-21",
|
|
10094
|
+
name: "Invoice note subject code",
|
|
10095
|
+
fields: ["notes[].subject_code"]
|
|
10096
|
+
},
|
|
10097
|
+
{ term: "BT-22", name: "Invoice note", fields: ["note", "notes[].text"] },
|
|
10098
|
+
{
|
|
10099
|
+
term: "BT-23",
|
|
10100
|
+
name: "Business process type",
|
|
10101
|
+
fields: ["operation", "operation_code"]
|
|
10102
|
+
},
|
|
10103
|
+
{
|
|
10104
|
+
term: "BT-24",
|
|
10105
|
+
name: "Specification identifier",
|
|
10106
|
+
fields: [],
|
|
10107
|
+
option: "profile"
|
|
10108
|
+
},
|
|
10109
|
+
{
|
|
10110
|
+
term: "BT-25",
|
|
10111
|
+
name: "Preceding Invoice reference",
|
|
10112
|
+
fields: ["preceding_invoices[].number"]
|
|
10113
|
+
},
|
|
10114
|
+
{
|
|
10115
|
+
term: "BT-26",
|
|
10116
|
+
name: "Preceding Invoice issue date",
|
|
10117
|
+
fields: ["preceding_invoices[].issue_date"]
|
|
10118
|
+
},
|
|
10119
|
+
{ term: "BT-27", name: "Seller name", fields: ["seller.name"] },
|
|
10120
|
+
{
|
|
10121
|
+
term: "BT-28",
|
|
10122
|
+
name: "Seller trading name",
|
|
10123
|
+
fields: ["seller.trading_name"]
|
|
10124
|
+
},
|
|
10125
|
+
{ term: "BT-29", name: "Seller identifier", fields: ["seller.id"] },
|
|
10126
|
+
{
|
|
10127
|
+
term: "BT-30",
|
|
10128
|
+
name: "Seller legal registration identifier",
|
|
10129
|
+
fields: ["seller.legal_registration"]
|
|
10130
|
+
},
|
|
10131
|
+
{ term: "BT-31", name: "Seller VAT identifier", fields: ["seller.vat_id"] },
|
|
10132
|
+
{
|
|
10133
|
+
term: "BT-32",
|
|
10134
|
+
name: "Seller tax registration identifier",
|
|
10135
|
+
fields: ["seller.tax_number"]
|
|
10136
|
+
},
|
|
10137
|
+
{
|
|
10138
|
+
term: "BT-33",
|
|
10139
|
+
name: "Seller additional legal information",
|
|
10140
|
+
fields: ["seller.legal_info"],
|
|
10141
|
+
en16931Only: true
|
|
10142
|
+
},
|
|
10143
|
+
{
|
|
10144
|
+
term: "BT-34",
|
|
10145
|
+
name: "Seller electronic address",
|
|
10146
|
+
fields: ["seller.electronic_address"]
|
|
10147
|
+
},
|
|
10148
|
+
{
|
|
10149
|
+
term: "BT-35",
|
|
10150
|
+
name: "Seller address line 1",
|
|
10151
|
+
fields: ["seller.address.street"]
|
|
10152
|
+
},
|
|
10153
|
+
{
|
|
10154
|
+
term: "BT-36",
|
|
10155
|
+
name: "Seller address line 2",
|
|
10156
|
+
fields: ["seller.address.street2"]
|
|
10157
|
+
},
|
|
10158
|
+
{ term: "BT-37", name: "Seller city", fields: ["seller.address.city"] },
|
|
10159
|
+
{
|
|
10160
|
+
term: "BT-38",
|
|
10161
|
+
name: "Seller post code",
|
|
10162
|
+
fields: ["seller.address.postcode"]
|
|
10163
|
+
},
|
|
10164
|
+
{
|
|
10165
|
+
term: "BT-39",
|
|
10166
|
+
name: "Seller country subdivision",
|
|
10167
|
+
fields: ["seller.address.subdivision"]
|
|
10168
|
+
},
|
|
10169
|
+
{
|
|
10170
|
+
term: "BT-40",
|
|
10171
|
+
name: "Seller country code",
|
|
10172
|
+
fields: ["seller.address.country"]
|
|
10173
|
+
},
|
|
10174
|
+
{
|
|
10175
|
+
term: "BT-41",
|
|
10176
|
+
name: "Seller contact point",
|
|
10177
|
+
fields: ["seller.contact.name"],
|
|
10178
|
+
en16931Only: true
|
|
10179
|
+
},
|
|
10180
|
+
{
|
|
10181
|
+
term: "BT-42",
|
|
10182
|
+
name: "Seller contact telephone number",
|
|
10183
|
+
fields: ["seller.contact.phone"],
|
|
10184
|
+
en16931Only: true
|
|
10185
|
+
},
|
|
10186
|
+
{
|
|
10187
|
+
term: "BT-43",
|
|
10188
|
+
name: "Seller contact email address",
|
|
10189
|
+
fields: ["seller.contact.email"],
|
|
10190
|
+
en16931Only: true
|
|
10191
|
+
},
|
|
10192
|
+
{ term: "BT-44", name: "Buyer name", fields: ["buyer.name"] },
|
|
10193
|
+
{ term: "BT-45", name: "Buyer trading name", fields: ["buyer.trading_name"] },
|
|
10194
|
+
{ term: "BT-46", name: "Buyer identifier", fields: ["buyer.id"] },
|
|
10195
|
+
{
|
|
10196
|
+
term: "BT-47",
|
|
10197
|
+
name: "Buyer legal registration identifier",
|
|
10198
|
+
fields: ["buyer.legal_registration", "buyer.siren"]
|
|
10199
|
+
},
|
|
10200
|
+
{ term: "BT-48", name: "Buyer VAT identifier", fields: ["buyer.vat_id"] },
|
|
10201
|
+
{
|
|
10202
|
+
term: "BT-49",
|
|
10203
|
+
name: "Buyer electronic address",
|
|
10204
|
+
fields: ["buyer.electronic_address"]
|
|
10205
|
+
},
|
|
10206
|
+
{
|
|
10207
|
+
term: "BT-50",
|
|
10208
|
+
name: "Buyer address line 1",
|
|
10209
|
+
fields: ["buyer.address.street"]
|
|
10210
|
+
},
|
|
10211
|
+
{
|
|
10212
|
+
term: "BT-51",
|
|
10213
|
+
name: "Buyer address line 2",
|
|
10214
|
+
fields: ["buyer.address.street2"]
|
|
10215
|
+
},
|
|
10216
|
+
{ term: "BT-52", name: "Buyer city", fields: ["buyer.address.city"] },
|
|
10217
|
+
{
|
|
10218
|
+
term: "BT-53",
|
|
10219
|
+
name: "Buyer post code",
|
|
10220
|
+
fields: ["buyer.address.postcode"]
|
|
10221
|
+
},
|
|
10222
|
+
{
|
|
10223
|
+
term: "BT-54",
|
|
10224
|
+
name: "Buyer country subdivision",
|
|
10225
|
+
fields: ["buyer.address.subdivision"]
|
|
10226
|
+
},
|
|
10227
|
+
{
|
|
10228
|
+
term: "BT-55",
|
|
10229
|
+
name: "Buyer country code",
|
|
10230
|
+
fields: ["buyer.address.country"]
|
|
10231
|
+
},
|
|
10232
|
+
{
|
|
10233
|
+
term: "BT-56",
|
|
10234
|
+
name: "Buyer contact point",
|
|
10235
|
+
fields: ["buyer.contact.name"],
|
|
10236
|
+
en16931Only: true
|
|
10237
|
+
},
|
|
10238
|
+
{
|
|
10239
|
+
term: "BT-57",
|
|
10240
|
+
name: "Buyer contact telephone number",
|
|
10241
|
+
fields: ["buyer.contact.phone"],
|
|
10242
|
+
en16931Only: true
|
|
10243
|
+
},
|
|
10244
|
+
{
|
|
10245
|
+
term: "BT-58",
|
|
10246
|
+
name: "Buyer contact email address",
|
|
10247
|
+
fields: ["buyer.contact.email"],
|
|
10248
|
+
en16931Only: true
|
|
10249
|
+
},
|
|
10250
|
+
{ term: "BT-59", name: "Payee name", fields: [] },
|
|
10251
|
+
{ term: "BT-60", name: "Payee identifier", fields: [] },
|
|
10252
|
+
{ term: "BT-61", name: "Payee legal registration identifier", fields: [] },
|
|
10253
|
+
{ term: "BT-62", name: "Seller tax representative name", fields: [] },
|
|
10254
|
+
{
|
|
10255
|
+
term: "BT-63",
|
|
10256
|
+
name: "Seller tax representative VAT identifier",
|
|
10257
|
+
fields: []
|
|
10258
|
+
},
|
|
10259
|
+
{ term: "BT-64", name: "Tax representative address line 1", fields: [] },
|
|
10260
|
+
{ term: "BT-65", name: "Tax representative address line 2", fields: [] },
|
|
10261
|
+
{ term: "BT-66", name: "Tax representative city", fields: [] },
|
|
10262
|
+
{ term: "BT-67", name: "Tax representative post code", fields: [] },
|
|
10263
|
+
{ term: "BT-68", name: "Tax representative country subdivision", fields: [] },
|
|
10264
|
+
{ term: "BT-69", name: "Tax representative country code", fields: [] },
|
|
10265
|
+
{ term: "BT-70", name: "Deliver to party name", fields: ["delivery.name"] },
|
|
10266
|
+
{ term: "BT-71", name: "Deliver to location identifier", fields: [] },
|
|
10267
|
+
{ term: "BT-72", name: "Actual delivery date", fields: ["delivery.date"] },
|
|
10268
|
+
{
|
|
10269
|
+
term: "BT-73",
|
|
10270
|
+
name: "Invoicing period start date",
|
|
10271
|
+
fields: ["period.start"]
|
|
10272
|
+
},
|
|
10273
|
+
{ term: "BT-74", name: "Invoicing period end date", fields: ["period.end"] },
|
|
10274
|
+
{
|
|
10275
|
+
term: "BT-75",
|
|
10276
|
+
name: "Deliver to address line 1",
|
|
10277
|
+
fields: ["delivery.address.street"]
|
|
10278
|
+
},
|
|
10279
|
+
{
|
|
10280
|
+
term: "BT-76",
|
|
10281
|
+
name: "Deliver to address line 2",
|
|
10282
|
+
fields: ["delivery.address.street2"]
|
|
10283
|
+
},
|
|
10284
|
+
{ term: "BT-77", name: "Deliver to city", fields: ["delivery.address.city"] },
|
|
10285
|
+
{
|
|
10286
|
+
term: "BT-78",
|
|
10287
|
+
name: "Deliver to post code",
|
|
10288
|
+
fields: ["delivery.address.postcode"]
|
|
10289
|
+
},
|
|
10290
|
+
{
|
|
10291
|
+
term: "BT-79",
|
|
10292
|
+
name: "Deliver to country subdivision",
|
|
10293
|
+
fields: ["delivery.address.subdivision"]
|
|
10294
|
+
},
|
|
10295
|
+
{
|
|
10296
|
+
term: "BT-80",
|
|
10297
|
+
name: "Deliver to country code",
|
|
10298
|
+
fields: ["delivery.address.country"]
|
|
10299
|
+
},
|
|
10300
|
+
{
|
|
10301
|
+
term: "BT-81",
|
|
10302
|
+
name: "Payment means type code",
|
|
10303
|
+
fields: ["payment.means_code"]
|
|
10304
|
+
},
|
|
10305
|
+
{ term: "BT-82", name: "Payment means text", fields: [] },
|
|
10306
|
+
{
|
|
10307
|
+
term: "BT-83",
|
|
10308
|
+
name: "Remittance information",
|
|
10309
|
+
fields: ["payment.reference"]
|
|
10310
|
+
},
|
|
10311
|
+
{
|
|
10312
|
+
term: "BT-84",
|
|
10313
|
+
name: "Payment account identifier",
|
|
10314
|
+
fields: ["payment.iban"]
|
|
10315
|
+
},
|
|
10316
|
+
{
|
|
10317
|
+
term: "BT-85",
|
|
10318
|
+
name: "Payment account name",
|
|
10319
|
+
fields: ["payment.account_name"],
|
|
10320
|
+
en16931Only: true
|
|
10321
|
+
},
|
|
10322
|
+
{
|
|
10323
|
+
term: "BT-86",
|
|
10324
|
+
name: "Payment service provider identifier",
|
|
10325
|
+
fields: ["payment.bic"],
|
|
10326
|
+
en16931Only: true
|
|
10327
|
+
},
|
|
10328
|
+
{ term: "BT-87", name: "Payment card primary account number", fields: [] },
|
|
10329
|
+
{ term: "BT-88", name: "Payment card holder name", fields: [] },
|
|
10330
|
+
{
|
|
10331
|
+
term: "BT-89",
|
|
10332
|
+
name: "Mandate reference identifier",
|
|
10333
|
+
fields: ["payment.mandate_id"]
|
|
10334
|
+
},
|
|
10335
|
+
{
|
|
10336
|
+
term: "BT-90",
|
|
10337
|
+
name: "Bank assigned creditor identifier",
|
|
10338
|
+
fields: ["payment.creditor_id"]
|
|
10339
|
+
},
|
|
10340
|
+
{
|
|
10341
|
+
term: "BT-91",
|
|
10342
|
+
name: "Debited account identifier",
|
|
10343
|
+
fields: ["payment.debited_iban"]
|
|
10344
|
+
},
|
|
10345
|
+
{
|
|
10346
|
+
term: "BT-92",
|
|
10347
|
+
name: "Document level allowance amount",
|
|
10348
|
+
fields: ["allowances[].amount"]
|
|
10349
|
+
},
|
|
10350
|
+
{
|
|
10351
|
+
term: "BT-93",
|
|
10352
|
+
name: "Document level allowance base amount",
|
|
10353
|
+
fields: ["allowances[].base_amount"]
|
|
10354
|
+
},
|
|
10355
|
+
{
|
|
10356
|
+
term: "BT-94",
|
|
10357
|
+
name: "Document level allowance percentage",
|
|
10358
|
+
fields: ["allowances[].percent"]
|
|
10359
|
+
},
|
|
10360
|
+
{
|
|
10361
|
+
term: "BT-95",
|
|
10362
|
+
name: "Document level allowance VAT category code",
|
|
10363
|
+
fields: ["allowances[].tax.category"]
|
|
10364
|
+
},
|
|
10365
|
+
{
|
|
10366
|
+
term: "BT-96",
|
|
10367
|
+
name: "Document level allowance VAT rate",
|
|
10368
|
+
fields: ["allowances[].tax.rate"]
|
|
10369
|
+
},
|
|
10370
|
+
{
|
|
10371
|
+
term: "BT-97",
|
|
10372
|
+
name: "Document level allowance reason",
|
|
10373
|
+
fields: ["allowances[].reason"]
|
|
10374
|
+
},
|
|
10375
|
+
{
|
|
10376
|
+
term: "BT-98",
|
|
10377
|
+
name: "Document level allowance reason code",
|
|
10378
|
+
fields: ["allowances[].reason_code"]
|
|
10379
|
+
},
|
|
10380
|
+
{
|
|
10381
|
+
term: "BT-99",
|
|
10382
|
+
name: "Document level charge amount",
|
|
10383
|
+
fields: ["charges[].amount"]
|
|
10384
|
+
},
|
|
10385
|
+
{
|
|
10386
|
+
term: "BT-100",
|
|
10387
|
+
name: "Document level charge base amount",
|
|
10388
|
+
fields: ["charges[].base_amount"]
|
|
10389
|
+
},
|
|
10390
|
+
{
|
|
10391
|
+
term: "BT-101",
|
|
10392
|
+
name: "Document level charge percentage",
|
|
10393
|
+
fields: ["charges[].percent"]
|
|
10394
|
+
},
|
|
10395
|
+
{
|
|
10396
|
+
term: "BT-102",
|
|
10397
|
+
name: "Document level charge VAT category code",
|
|
10398
|
+
fields: ["charges[].tax.category"]
|
|
10399
|
+
},
|
|
10400
|
+
{
|
|
10401
|
+
term: "BT-103",
|
|
10402
|
+
name: "Document level charge VAT rate",
|
|
10403
|
+
fields: ["charges[].tax.rate"]
|
|
10404
|
+
},
|
|
10405
|
+
{
|
|
10406
|
+
term: "BT-104",
|
|
10407
|
+
name: "Document level charge reason",
|
|
10408
|
+
fields: ["charges[].reason"]
|
|
10409
|
+
},
|
|
10410
|
+
{
|
|
10411
|
+
term: "BT-105",
|
|
10412
|
+
name: "Document level charge reason code",
|
|
10413
|
+
fields: ["charges[].reason_code"]
|
|
10414
|
+
},
|
|
10415
|
+
{
|
|
10416
|
+
term: "BT-106",
|
|
10417
|
+
name: "Sum of Invoice line net amount",
|
|
10418
|
+
fields: ["totals.line_net"]
|
|
10419
|
+
},
|
|
10420
|
+
{
|
|
10421
|
+
term: "BT-107",
|
|
10422
|
+
name: "Sum of allowances on document level",
|
|
10423
|
+
fields: ["totals.allowances"]
|
|
10424
|
+
},
|
|
10425
|
+
{
|
|
10426
|
+
term: "BT-108",
|
|
10427
|
+
name: "Sum of charges on document level",
|
|
10428
|
+
fields: ["totals.charges"]
|
|
10429
|
+
},
|
|
10430
|
+
{
|
|
10431
|
+
term: "BT-109",
|
|
10432
|
+
name: "Invoice total amount without VAT",
|
|
10433
|
+
fields: ["totals.tax_basis"]
|
|
10434
|
+
},
|
|
10435
|
+
{
|
|
10436
|
+
term: "BT-110",
|
|
10437
|
+
name: "Invoice total VAT amount",
|
|
10438
|
+
fields: ["totals.tax_total"]
|
|
10439
|
+
},
|
|
10440
|
+
{
|
|
10441
|
+
term: "BT-111",
|
|
10442
|
+
name: "Invoice total VAT amount in accounting currency",
|
|
10443
|
+
fields: ["totals.tax_total_accounting"]
|
|
10444
|
+
},
|
|
10445
|
+
{
|
|
10446
|
+
term: "BT-112",
|
|
10447
|
+
name: "Invoice total amount with VAT",
|
|
10448
|
+
fields: ["totals.grand"]
|
|
10449
|
+
},
|
|
10450
|
+
{ term: "BT-113", name: "Paid amount", fields: ["totals.prepaid"] },
|
|
10451
|
+
{
|
|
10452
|
+
term: "BT-114",
|
|
10453
|
+
name: "Rounding amount",
|
|
10454
|
+
fields: ["totals.rounding"],
|
|
10455
|
+
en16931Only: true
|
|
10456
|
+
},
|
|
10457
|
+
{ term: "BT-115", name: "Amount due for payment", fields: ["totals.due"] },
|
|
10458
|
+
{
|
|
10459
|
+
term: "BT-116",
|
|
10460
|
+
name: "VAT category taxable amount",
|
|
10461
|
+
fields: ["tax.breakdown[].basis"]
|
|
10462
|
+
},
|
|
10463
|
+
{
|
|
10464
|
+
term: "BT-117",
|
|
10465
|
+
name: "VAT category tax amount",
|
|
10466
|
+
fields: ["tax.breakdown[].amount"]
|
|
10467
|
+
},
|
|
10468
|
+
{
|
|
10469
|
+
term: "BT-118",
|
|
10470
|
+
name: "VAT category code",
|
|
10471
|
+
fields: ["tax.breakdown[].category"]
|
|
10472
|
+
},
|
|
10473
|
+
{
|
|
10474
|
+
term: "BT-119",
|
|
10475
|
+
name: "VAT category rate",
|
|
10476
|
+
fields: ["tax.breakdown[].rate"]
|
|
10477
|
+
},
|
|
10478
|
+
{
|
|
10479
|
+
term: "BT-120",
|
|
10480
|
+
name: "VAT exemption reason text",
|
|
10481
|
+
fields: ["tax.breakdown[].exemption_reason"]
|
|
10482
|
+
},
|
|
10483
|
+
{
|
|
10484
|
+
term: "BT-121",
|
|
10485
|
+
name: "VAT exemption reason code",
|
|
10486
|
+
fields: ["tax.breakdown[].exemption_reason_code"]
|
|
10487
|
+
},
|
|
10488
|
+
{ term: "BT-122", name: "Supporting document reference", fields: [] },
|
|
10489
|
+
{ term: "BT-123", name: "Supporting document description", fields: [] },
|
|
10490
|
+
{ term: "BT-124", name: "External document location", fields: [] },
|
|
10491
|
+
{ term: "BT-125", name: "Attached document", fields: [] },
|
|
10492
|
+
{ term: "BT-126", name: "Invoice line identifier", fields: ["lines[].id"] },
|
|
10493
|
+
{ term: "BT-127", name: "Invoice line note", fields: ["lines[].note"] },
|
|
10494
|
+
{ term: "BT-128", name: "Invoice line object identifier", fields: [] },
|
|
10495
|
+
{ term: "BT-129", name: "Invoiced quantity", fields: ["lines[].quantity"] },
|
|
10496
|
+
{
|
|
10497
|
+
term: "BT-130",
|
|
10498
|
+
name: "Invoiced quantity unit of measure code",
|
|
10499
|
+
fields: ["lines[].unit_code"]
|
|
10500
|
+
},
|
|
10501
|
+
{
|
|
10502
|
+
term: "BT-131",
|
|
10503
|
+
name: "Invoice line net amount",
|
|
10504
|
+
fields: ["lines[].net_amount"]
|
|
10505
|
+
},
|
|
10506
|
+
{
|
|
10507
|
+
term: "BT-132",
|
|
10508
|
+
name: "Referenced purchase order line reference",
|
|
10509
|
+
fields: ["lines[].order_line_reference"],
|
|
10510
|
+
en16931Only: true
|
|
10511
|
+
},
|
|
10512
|
+
{
|
|
10513
|
+
term: "BT-133",
|
|
10514
|
+
name: "Invoice line Buyer accounting reference",
|
|
10515
|
+
fields: ["lines[].buyer_accounting_reference"],
|
|
10516
|
+
en16931Only: true
|
|
10517
|
+
},
|
|
10518
|
+
{
|
|
10519
|
+
term: "BT-134",
|
|
10520
|
+
name: "Invoice line period start date",
|
|
10521
|
+
fields: ["lines[].period.start"]
|
|
10522
|
+
},
|
|
10523
|
+
{
|
|
10524
|
+
term: "BT-135",
|
|
10525
|
+
name: "Invoice line period end date",
|
|
10526
|
+
fields: ["lines[].period.end"]
|
|
10527
|
+
},
|
|
10528
|
+
{
|
|
10529
|
+
term: "BT-136",
|
|
10530
|
+
name: "Invoice line allowance amount",
|
|
10531
|
+
fields: ["lines[].allowances[].amount"]
|
|
10532
|
+
},
|
|
10533
|
+
{
|
|
10534
|
+
term: "BT-137",
|
|
10535
|
+
name: "Invoice line allowance base amount",
|
|
10536
|
+
fields: ["lines[].allowances[].base_amount"]
|
|
10537
|
+
},
|
|
10538
|
+
{
|
|
10539
|
+
term: "BT-138",
|
|
10540
|
+
name: "Invoice line allowance percentage",
|
|
10541
|
+
fields: ["lines[].allowances[].percent"]
|
|
10542
|
+
},
|
|
10543
|
+
{
|
|
10544
|
+
term: "BT-139",
|
|
10545
|
+
name: "Invoice line allowance reason",
|
|
10546
|
+
fields: ["lines[].allowances[].reason"]
|
|
10547
|
+
},
|
|
10548
|
+
{
|
|
10549
|
+
term: "BT-140",
|
|
10550
|
+
name: "Invoice line allowance reason code",
|
|
10551
|
+
fields: ["lines[].allowances[].reason_code"]
|
|
10552
|
+
},
|
|
10553
|
+
{
|
|
10554
|
+
term: "BT-141",
|
|
10555
|
+
name: "Invoice line charge amount",
|
|
10556
|
+
fields: ["lines[].charges[].amount"]
|
|
10557
|
+
},
|
|
10558
|
+
{
|
|
10559
|
+
term: "BT-142",
|
|
10560
|
+
name: "Invoice line charge base amount",
|
|
10561
|
+
fields: ["lines[].charges[].base_amount"]
|
|
10562
|
+
},
|
|
10563
|
+
{
|
|
10564
|
+
term: "BT-143",
|
|
10565
|
+
name: "Invoice line charge percentage",
|
|
10566
|
+
fields: ["lines[].charges[].percent"]
|
|
10567
|
+
},
|
|
10568
|
+
{
|
|
10569
|
+
term: "BT-144",
|
|
10570
|
+
name: "Invoice line charge reason",
|
|
10571
|
+
fields: ["lines[].charges[].reason"]
|
|
10572
|
+
},
|
|
10573
|
+
{
|
|
10574
|
+
term: "BT-145",
|
|
10575
|
+
name: "Invoice line charge reason code",
|
|
10576
|
+
fields: ["lines[].charges[].reason_code"]
|
|
10577
|
+
},
|
|
10578
|
+
{ term: "BT-146", name: "Item net price", fields: ["lines[].net_price"] },
|
|
10579
|
+
{ term: "BT-147", name: "Item price discount", fields: [] },
|
|
10580
|
+
{ term: "BT-148", name: "Item gross price", fields: [] },
|
|
10581
|
+
{
|
|
10582
|
+
term: "BT-149",
|
|
10583
|
+
name: "Item price base quantity",
|
|
10584
|
+
fields: ["lines[].price_base_quantity"]
|
|
10585
|
+
},
|
|
10586
|
+
{
|
|
10587
|
+
term: "BT-150",
|
|
10588
|
+
name: "Item price base quantity unit of measure",
|
|
10589
|
+
fields: ["lines[].unit_code"]
|
|
10590
|
+
},
|
|
10591
|
+
{
|
|
10592
|
+
term: "BT-151",
|
|
10593
|
+
name: "Invoiced item VAT category code",
|
|
10594
|
+
fields: ["lines[].tax.category"]
|
|
10595
|
+
},
|
|
10596
|
+
{
|
|
10597
|
+
term: "BT-152",
|
|
10598
|
+
name: "Invoiced item VAT rate",
|
|
10599
|
+
fields: ["lines[].tax.rate"]
|
|
10600
|
+
},
|
|
10601
|
+
{ term: "BT-153", name: "Item name", fields: ["lines[].name"] },
|
|
10602
|
+
{
|
|
10603
|
+
term: "BT-154",
|
|
10604
|
+
name: "Item description",
|
|
10605
|
+
fields: ["lines[].description"],
|
|
10606
|
+
en16931Only: true
|
|
10607
|
+
},
|
|
10608
|
+
{
|
|
10609
|
+
term: "BT-155",
|
|
10610
|
+
name: "Item Sellers identifier",
|
|
10611
|
+
fields: ["lines[].seller_item_id"],
|
|
10612
|
+
en16931Only: true
|
|
10613
|
+
},
|
|
10614
|
+
{
|
|
10615
|
+
term: "BT-156",
|
|
10616
|
+
name: "Item Buyers identifier",
|
|
10617
|
+
fields: ["lines[].buyer_item_id"],
|
|
10618
|
+
en16931Only: true
|
|
10619
|
+
},
|
|
10620
|
+
{
|
|
10621
|
+
term: "BT-157",
|
|
10622
|
+
name: "Item standard identifier",
|
|
10623
|
+
fields: ["lines[].standard_item_id"]
|
|
10624
|
+
},
|
|
10625
|
+
{ term: "BT-158", name: "Item classification identifier", fields: [] },
|
|
10626
|
+
{ term: "BT-159", name: "Item country of origin", fields: [] },
|
|
10627
|
+
{ term: "BT-160", name: "Item attribute name", fields: [] },
|
|
10628
|
+
{ term: "BT-161", name: "Item attribute value", fields: [] },
|
|
10629
|
+
{
|
|
10630
|
+
term: "BT-162",
|
|
10631
|
+
name: "Seller address line 3",
|
|
10632
|
+
fields: ["seller.address.street3"]
|
|
10633
|
+
},
|
|
10634
|
+
{
|
|
10635
|
+
term: "BT-163",
|
|
10636
|
+
name: "Buyer address line 3",
|
|
10637
|
+
fields: ["buyer.address.street3"]
|
|
10638
|
+
},
|
|
10639
|
+
{ term: "BT-164", name: "Tax representative address line 3", fields: [] },
|
|
10640
|
+
{
|
|
10641
|
+
term: "BT-165",
|
|
10642
|
+
name: "Deliver to address line 3",
|
|
10643
|
+
fields: ["delivery.address.street3"]
|
|
10644
|
+
}
|
|
10645
|
+
];
|
|
10646
|
+
var carriesTerm = (term) => term.fields.length > 0 || term.option !== void 0;
|
|
10647
|
+
|
|
10018
10648
|
// packages/engine/src/lib/einvoice/display.ts
|
|
10019
10649
|
var DISPLAY_TERMS = {
|
|
10020
10650
|
"BT-1": "invoice number",
|
|
@@ -10288,7 +10918,12 @@ function einvoiceResult(options, specVersion, validation, display) {
|
|
|
10288
10918
|
valid: validation.valid,
|
|
10289
10919
|
schematron: validation.schematron,
|
|
10290
10920
|
pdfa: validation.pdfa,
|
|
10291
|
-
...capMessages(validation.messages)
|
|
10921
|
+
...capMessages(validation.messages),
|
|
10922
|
+
// what judged which bytes: the report a business keeps as its proof names both
|
|
10923
|
+
...validation.id ? { id: validation.id } : {},
|
|
10924
|
+
...validation.versions ? { versions: validation.versions } : {},
|
|
10925
|
+
...validation.xml_sha256 ? { xml_sha256: validation.xml_sha256 } : {},
|
|
10926
|
+
...validation.pdf_sha256 !== void 0 ? { pdf_sha256: validation.pdf_sha256 } : {}
|
|
10292
10927
|
} : null,
|
|
10293
10928
|
display: display ? { checked: display.checked, missing: display.missing } : null
|
|
10294
10929
|
};
|