@bookipi/htmlgenerator 1.14.1-alpha.4 → 1.14.1-alpha.6

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.
@@ -413,7 +413,7 @@ var en = (_deposit_due$terms$pr = {
413
413
  return "This offer is valid from the date of issue and will expire at the close of business (" + x + "). Acceptance will be in the form of accepting and signing this proposal.";
414
414
  }, _deposit_due$terms$pr.details_line_3 = function details_line_3(x, y, z) {
415
415
  return x + " (" + y + "). " + z;
416
- }, _deposit_due$terms$pr.details_line_3_1 = 'This offer is valid from the date of issue and will expire at the close of business', _deposit_due$terms$pr.details_line_3_2 = 'Acceptance will be in the form of accepting and signing this proposal.', _deposit_due$terms$pr.details_line_4 = "Please accept this proposal and terms of service. This creates a legally binding contract between us. At any time if you have any questions please contact us on the details above. These terms will be effective throughout the period of our engagement and may only be changed by the Parties' agreement in writing.", _deposit_due$terms$pr.supplier_details = 'Supplier Details', _deposit_due$terms$pr.customer_details = 'Customer Details', _deposit_due$terms$pr.effective_date = 'Dated', _deposit_due$terms$pr.supplier_empty = 'No supplier added yet.', _deposit_due$terms$pr.customer_empty = 'No customer added yet.', _deposit_due$terms$pr.kind_regards = 'Kind regards', _deposit_due$terms$pr.services_title = 'Billing Schedule', _deposit_due$terms$pr["total"] = 'Total:', _deposit_due$terms$pr.items_empty = 'No services added yet.', _deposit_due$terms$pr.agreement_title = 'Terms and Conditions', _deposit_due$terms$pr["signature"] = 'Signature', _deposit_due$terms$pr.proposal_id = 'Proposal ID:', _deposit_due$terms$pr.client = 'Client:', _deposit_due$terms$pr.email_addresses = 'Email address:', _deposit_due$terms$pr.ip = 'IP:', _deposit_due$terms$pr.time = 'Time:', _deposit_due$terms$pr.upgradeRequired = 'Upgrade required', _deposit_due$terms$pr.document = 'Document', _deposit_due$terms$pr["invoice"] = 'Invoice', _deposit_due$terms$pr.estimate = 'Estimate', _deposit_due$terms$pr.creditNote = 'Credit Note', _deposit_due$terms$pr.deliveryNote = 'Delivery Note', _deposit_due$terms$pr.purchaseOrder = 'Purchase Order', _deposit_due$terms$pr.Invoice = 'Invoice', _deposit_due$terms$pr["Estimate"] = 'Estimate', _deposit_due$terms$pr.creditnote = 'Credit Note', _deposit_due$terms$pr.service_delivery_date = 'Date of delivery or completion of service', _deposit_due$terms$pr["tax_label"] = 'VAT Rate', _deposit_due$terms$pr.label_siren = 'SIREN', _deposit_due$terms$pr.vat = 'VAT', _deposit_due$terms$pr.total_tax = 'Total tax', _deposit_due$terms$pr.einvoice_tax_code_reverse_charge = 'Reverse charge', _deposit_due$terms$pr.einvoice_tax_code_intra_community = 'Intra-community supply', _deposit_due$terms$pr.einvoice_tax_code_export_non_eu = 'Export outside the EU', _deposit_due$terms$pr.einvoice_tax_code_exempt = 'Exempt', _deposit_due$terms$pr.einvoice_tax_code_out_of_scope = 'Out of scope', _deposit_due$terms$pr.einvoice_vat_due_upon_issue = 'VAT due upon issue', _deposit_due$terms$pr.einvoice_vat_due_upon_payment = 'VAT due upon payment', _deposit_due$terms$pr.item_unit_unit = 'Unit', _deposit_due$terms$pr.item_unit_unit_short = function item_unit_unit_short(n) {
416
+ }, _deposit_due$terms$pr.details_line_3_1 = 'This offer is valid from the date of issue and will expire at the close of business', _deposit_due$terms$pr.details_line_3_2 = 'Acceptance will be in the form of accepting and signing this proposal.', _deposit_due$terms$pr.details_line_4 = "Please accept this proposal and terms of service. This creates a legally binding contract between us. At any time if you have any questions please contact us on the details above. These terms will be effective throughout the period of our engagement and may only be changed by the Parties' agreement in writing.", _deposit_due$terms$pr.supplier_details = 'Supplier Details', _deposit_due$terms$pr.customer_details = 'Customer Details', _deposit_due$terms$pr.effective_date = 'Dated', _deposit_due$terms$pr.supplier_empty = 'No supplier added yet.', _deposit_due$terms$pr.customer_empty = 'No customer added yet.', _deposit_due$terms$pr.kind_regards = 'Kind regards', _deposit_due$terms$pr.services_title = 'Billing Schedule', _deposit_due$terms$pr["total"] = 'Total:', _deposit_due$terms$pr.items_empty = 'No services added yet.', _deposit_due$terms$pr.agreement_title = 'Terms and Conditions', _deposit_due$terms$pr["signature"] = 'Signature', _deposit_due$terms$pr.proposal_id = 'Proposal ID:', _deposit_due$terms$pr.client = 'Client:', _deposit_due$terms$pr.email_addresses = 'Email address:', _deposit_due$terms$pr.ip = 'IP:', _deposit_due$terms$pr.time = 'Time:', _deposit_due$terms$pr.upgradeRequired = 'Upgrade required', _deposit_due$terms$pr.document = 'Document', _deposit_due$terms$pr["invoice"] = 'Invoice', _deposit_due$terms$pr.estimate = 'Estimate', _deposit_due$terms$pr.creditNote = 'Credit Note', _deposit_due$terms$pr.deliveryNote = 'Delivery Note', _deposit_due$terms$pr.purchaseOrder = 'Purchase Order', _deposit_due$terms$pr.Invoice = 'Invoice', _deposit_due$terms$pr["Estimate"] = 'Estimate', _deposit_due$terms$pr.creditnote = 'Credit Note', _deposit_due$terms$pr.service_delivery_date = 'Date of delivery or completion of service', _deposit_due$terms$pr.einvoice_tax_label = 'VAT Rate', _deposit_due$terms$pr.label_siren = 'SIREN', _deposit_due$terms$pr.vat = 'VAT', _deposit_due$terms$pr.total_tax = 'Total tax', _deposit_due$terms$pr.einvoice_tax_code_reverse_charge = 'Reverse charge', _deposit_due$terms$pr.einvoice_tax_code_intra_community = 'Intra-community supply', _deposit_due$terms$pr.einvoice_tax_code_export_non_eu = 'Export outside the EU', _deposit_due$terms$pr.einvoice_tax_code_exempt = 'Exempt', _deposit_due$terms$pr.einvoice_tax_code_out_of_scope = 'Out of scope', _deposit_due$terms$pr.einvoice_vat_due_upon_issue = 'VAT due upon issue', _deposit_due$terms$pr.einvoice_vat_due_upon_payment = 'VAT due upon payment', _deposit_due$terms$pr.item_unit_unit = 'Unit', _deposit_due$terms$pr.item_unit_unit_short = function item_unit_unit_short(n) {
417
417
  return n === 1 ? 'unit' : 'units';
418
418
  }, _deposit_due$terms$pr.item_unit_piece = 'Piece', _deposit_due$terms$pr.item_unit_piece_short = function item_unit_piece_short(n) {
419
419
  return n === 1 ? 'pc' : 'pcs';
@@ -11973,7 +11973,8 @@ var DEFAULT_CONFIG = {
11973
11973
 
11974
11974
  /** French e-invoice rules; other French documents use the default config. */
11975
11975
  var FRANCE_E_INVOICE_CONFIG = {
11976
- // Our server rejects a negative subtotal before the PDP; Factur-X lines are clamped to 0.
11976
+ // Our server rejects a negative subtotal before the PDP, so a line discount stops at 0. A
11977
+ // negative price stays a negative line; Factur-X writes it as a negative quantity (BR-27).
11977
11978
  allowNegativeLines: false,
11978
11979
  // Factur-X has no after-tax discount, so the app hides "After-tax" on French e-invoices.
11979
11980
  allowDiscountAfterTax: false,
@@ -12059,7 +12060,9 @@ var getCountryConfig = function getCountryConfig(countryCode, _temp) {
12059
12060
  var code = (countryCode || "").toUpperCase();
12060
12061
  return _extends$1({}, DEFAULT_CONFIG, COUNTRY_CONFIGS[code] && _extends$1({
12061
12062
  countryCode: code
12062
- }, COUNTRY_CONFIGS[code]), eInvoice && E_INVOICE_CONFIGS[code]);
12063
+ }, COUNTRY_CONFIGS[code]), eInvoice && E_INVOICE_CONFIGS[code] && _extends$1({
12064
+ countryCode: code
12065
+ }, E_INVOICE_CONFIGS[code]));
12063
12066
  };
12064
12067
 
12065
12068
  /** E-invoice tax codes per country; a country listed here taxes its e-invoices by code. */
@@ -13864,9 +13867,10 @@ var currencies = {
13864
13867
 
13865
13868
  var currencyTable = currencies;
13866
13869
 
13867
- /** The code when it is a known currency, otherwise USD. */
13870
+ /** The upper-case code when it is a known currency, otherwise USD. */
13868
13871
  var getCurrencyCode = function getCurrencyCode(currencyCode) {
13869
- return currencyCode && currencyTable[currencyCode] ? currencyCode : "USD";
13872
+ var code = (currencyCode || "").toUpperCase();
13873
+ return currencyTable[code] ? code : "USD";
13870
13874
  };
13871
13875
 
13872
13876
  /** Digits after the decimal point. Unknown codes use USD. */
@@ -13982,14 +13986,29 @@ var calculateAdjustment = function calculateAdjustment(adjustment, base) {
13982
13986
  };
13983
13987
 
13984
13988
  /**
13985
- * Splits `amount` across `weights` pro rata; no share exceeds its weight, and weights ≤ 0 get none.
13989
+ * Splits `amount` across `weights` pro rata; no share exceeds its weight, and weights of the
13990
+ * other sign (or 0) get none. A negative amount (a discount on a negative document) is split
13991
+ * over the negative weights the same way.
13986
13992
  * With `decimals`, shares are rounded so they still add up exactly (largest remainder method).
13987
13993
  */
13988
- var allocateProportionally = function allocateProportionally(amount, weights, decimals) {
13994
+ var _allocateProportionally = function allocateProportionally(amount, weights, decimals) {
13995
+ if (amount.lt(0)) {
13996
+ var _allocateProportional = _allocateProportionally(amount.neg(), weights.map(function (weight) {
13997
+ return weight.neg();
13998
+ }), decimals),
13999
+ shares = _allocateProportional.shares,
14000
+ excess = _allocateProportional.excess;
14001
+ return {
14002
+ shares: shares.map(function (share) {
14003
+ return share.neg();
14004
+ }),
14005
+ excess: excess.neg()
14006
+ };
14007
+ }
13989
14008
  var noShares = weights.map(function () {
13990
14009
  return ZERO;
13991
14010
  });
13992
- if (amount.lte(0)) return {
14011
+ if (amount.eq(0)) return {
13993
14012
  shares: noShares,
13994
14013
  excess: ZERO
13995
14014
  };
@@ -14057,10 +14076,11 @@ var allocateDocumentDiscount = function allocateDocumentDiscount(_ref) {
14057
14076
  shipping = _ref.shipping,
14058
14077
  decimals = _ref.decimals;
14059
14078
  var taxableDiscount = documentDiscount != null && documentDiscount.afterTax ? ZERO : discount;
14060
- var _allocateProportional = allocateProportionally(taxableDiscount, lineAmounts, decimals),
14079
+ var _allocateProportional = _allocateProportionally(taxableDiscount, lineAmounts, decimals),
14061
14080
  shares = _allocateProportional.shares,
14062
14081
  excess = _allocateProportional.excess;
14063
- var shippingShare = shipping.gt(0) ? excess.gt(shipping) ? shipping : excess : ZERO;
14082
+ // Only a positive discount left over lowers a positive shipping cost.
14083
+ var shippingShare = shipping.gt(0) && excess.gt(0) ? excess.gt(shipping) ? shipping : excess : ZERO;
14064
14084
  return {
14065
14085
  lineShares: shares,
14066
14086
  shippingShare: shippingShare
@@ -14090,6 +14110,7 @@ var calculatePaymentSummary = function calculatePaymentSummary(_ref) {
14090
14110
  total = _ref.total,
14091
14111
  decimals = _ref.decimals,
14092
14112
  isInvoice = _ref.isInvoice,
14113
+ hasLines = _ref.hasLines,
14093
14114
  round = _ref.round;
14094
14115
  var surchargeRate;
14095
14116
  var totalPayment = round(sumMonetaryDecimals(payments.map(function (payment) {
@@ -14106,9 +14127,9 @@ var calculatePaymentSummary = function calculatePaymentSummary(_ref) {
14106
14127
  var amountAfterPayment = amountBeforePayment.minus(totalPayment);
14107
14128
 
14108
14129
  // Within one minor unit counts as fully paid, matching the legacy +0.01 tolerance.
14109
- // No payment counts as not paid.
14130
+ // Nothing owed (e.g. a 100% discount) is paid; an empty document with no payment is not.
14110
14131
  var tolerance = new MonetaryDecimal(10).pow(-decimals);
14111
- var isPaid = totalPayment.gt(0) && totalPayment.plus(tolerance).gte(amountBeforePayment);
14132
+ var isPaid = (totalPayment.gt(0) || hasLines && amountBeforePayment.lte(0)) && totalPayment.plus(tolerance).gte(amountBeforePayment);
14112
14133
  var paymentStatus = isPaid ? 2 : totalPayment.eq(0) ? 0 : 1;
14113
14134
  return {
14114
14135
  totalPayment: totalPayment,
@@ -14399,6 +14420,7 @@ var calculate = function calculate(document, options) {
14399
14420
  total: total,
14400
14421
  decimals: decimals,
14401
14422
  isInvoice: !!document.isInvoice,
14423
+ hasLines: lineItems.length > 0,
14402
14424
  round: round
14403
14425
  });
14404
14426
  return {
@@ -14762,21 +14784,43 @@ var calculateEN16931Totals = function calculateEN16931Totals(document, company)
14762
14784
  if (eInvoiceStandard !== "en16931") {
14763
14785
  throw new Error("calculateEN16931Totals: \"" + (countryCode || "") + "\" has no EN 16931 e-invoice.");
14764
14786
  }
14787
+ var taxCodes = getTaxCodes(countryCode);
14788
+ var findTaxCode = function findTaxCode(code) {
14789
+ return taxCodes.find(function (taxCode) {
14790
+ return taxCode.code === code;
14791
+ });
14792
+ };
14793
+ // Every amount needs a listed code: an uncoded line has no VAT breakdown, and an unlisted
14794
+ // code has no VAT category, so the totals would not reconcile. Untaxed shipping keeps no
14795
+ // code (toCalcDocument drops it; it is reported as untaxedChargeTaxCode), so it is not checked.
14796
+ var lineItems = readField(document.it, document.items) || [];
14797
+ var shippingNonTaxable = !!readField(document.sntx, document.shippingNonTax);
14798
+ var shippingTaxCode = shippingNonTaxable ? null : document.shippingTaxCode;
14799
+ var unlistedCodes = [].concat(lineItems.map(function (lineItem) {
14800
+ return lineItem.taxCode;
14801
+ }), shippingTaxCode || !shippingNonTaxable && toMonetaryDecimal(readField(document.sp, document.shippingCost)).gt(0) ? [shippingTaxCode] : []).filter(function (code) {
14802
+ return !findTaxCode(code);
14803
+ });
14804
+ if (unlistedCodes.length > 0) {
14805
+ throw new Error("calculateEN16931Totals: every line needs a \"" + countryCode + "\" tax code; got " + unlistedCodes.map(function (code) {
14806
+ return JSON.stringify(code != null ? code : null);
14807
+ }).join(", ") + ".");
14808
+ }
14765
14809
  var _calculateDocumentWit = calculateDocumentWith(document, company, {}, {
14766
14810
  eInvoice: true,
14767
14811
  taxCodeRates: getTaxCodeRates(countryCode)
14768
14812
  }),
14769
14813
  calculation = _calculateDocumentWit.result;
14814
+ // A discount past the items and shipping leaves a negative total on zero tax bases, which
14815
+ // cannot reconcile (BT-112 = BT-109 + BT-110); that is a credit note, not an invoice.
14816
+ var discountable = new MonetaryDecimal(calculation.subtotal).plus(calculation.shipping);
14817
+ if (new MonetaryDecimal(calculation.discount).gt(discountable)) {
14818
+ throw new Error("calculateEN16931Totals: the discount (" + calculation.discount + ") is more than the items and shipping (" + discountable.toNumber() + ").");
14819
+ }
14770
14820
  var decimals = calculation.decimals;
14771
14821
  var round = function round(amount) {
14772
14822
  return roundMonetaryDecimal(amount, decimals, calculation.config.roundingMethod);
14773
14823
  };
14774
- var taxCodes = getTaxCodes(countryCode);
14775
- var findTaxCode = function findTaxCode(code) {
14776
- return taxCodes.find(function (taxCode) {
14777
- return taxCode.code === code;
14778
- });
14779
- };
14780
14824
 
14781
14825
  // EN 16931 needs the line nets to add up to their tax code's basis to the cent.
14782
14826
  var lineNets = calculation.lines.map(function (line) {
@@ -14851,15 +14895,15 @@ var calculateEN16931Totals = function calculateEN16931Totals(document, company)
14851
14895
  return {
14852
14896
  currency: calculation.currency,
14853
14897
  decimals: decimals,
14898
+ // Every line has exactly one tax: its code, checked above.
14854
14899
  lines: calculation.lines.map(function (line) {
14855
- var _line$taxes$, _line$taxes$0$rate, _line$taxes$2, _line$taxes$3;
14856
14900
  return {
14857
14901
  index: line.index,
14858
14902
  net: lineNets[line.index].toNumber(),
14859
14903
  documentDiscount: line.documentDiscount,
14860
- taxCode: (_line$taxes$ = line.taxes[0]) == null ? void 0 : _line$taxes$.code,
14861
- rate: (_line$taxes$0$rate = (_line$taxes$2 = line.taxes[0]) == null ? void 0 : _line$taxes$2.rate) != null ? _line$taxes$0$rate : 0,
14862
- inclusive: !!((_line$taxes$3 = line.taxes[0]) != null && _line$taxes$3.inclusive)
14904
+ taxCode: line.taxes[0].code,
14905
+ rate: line.taxes[0].rate,
14906
+ inclusive: line.taxes[0].inclusive
14863
14907
  };
14864
14908
  }),
14865
14909
  shipping: shipping,
@@ -14918,11 +14962,13 @@ var calculateProposal = function calculateProposal(proposal, company) {
14918
14962
  company = {};
14919
14963
  }
14920
14964
  var decimals = getCurrencyDecimals(company.cr || company.currency);
14965
+ var _getCountryConfig = getCountryConfig(company.co || company.country),
14966
+ roundingMethod = _getCountryConfig.roundingMethod;
14921
14967
  var serviceItems = proposal.serviceItems,
14922
14968
  proposalFields = _objectWithoutPropertiesLoose(proposal, _excluded$1);
14923
14969
  var lineItems = (serviceItems || []).map(function (serviceItem) {
14924
14970
  var discountPercentage = toMonetaryDecimal(serviceItem.discountPercentage);
14925
- var discount = discountPercentage.gt(0) ? roundMonetaryDecimal(toMonetaryDecimal(serviceItem.price).times(toMonetaryDecimal(isBlank(serviceItem.quantity) ? 1 : serviceItem.quantity)).times(discountPercentage).div(100), decimals, "half-up").toNumber() : serviceItem.discount;
14971
+ var discount = discountPercentage.gt(0) ? roundMonetaryDecimal(toMonetaryDecimal(serviceItem.price).times(toMonetaryDecimal(isBlank(serviceItem.quantity) ? 1 : serviceItem.quantity)).times(discountPercentage).div(100), decimals, roundingMethod).toNumber() : serviceItem.discount;
14926
14972
  return {
14927
14973
  price: serviceItem.price,
14928
14974
  quantity: serviceItem.quantity,
@@ -17825,7 +17871,7 @@ var frConfig = {
17825
17871
  onLabelKey: 'einvoice_vat_due_upon_issue',
17826
17872
  offLabelKey: 'einvoice_vat_due_upon_payment'
17827
17873
  },
17828
- taxLabel: 'tax_label',
17874
+ taxLabel: 'einvoice_tax_label',
17829
17875
  itemUnitType: true,
17830
17876
  itemTaxCodes: true,
17831
17877
  taxCodeRates: calc.getTaxCodeRates('FR'),
@@ -18067,6 +18113,9 @@ var toCalcCompany = function toCalcCompany(company, currencyCode) {
18067
18113
  var calculateDocument$1 = function calculateDocument(document, company, currencyCode) {
18068
18114
  return calc.calculateDocument(document, toCalcCompany(company, currencyCode));
18069
18115
  };
18116
+ var getCalculationContext$1 = function getCalculationContext(document, company) {
18117
+ return calc.getCalculationContext(document, toCalcCompany(company));
18118
+ };
18070
18119
  var calculateTaxCodeBreakdown$1 = function calculateTaxCodeBreakdown(document, company, currencyCode) {
18071
18120
  return calc.calculateTaxCodeBreakdown(document, toCalcCompany(company, currencyCode));
18072
18121
  };
@@ -18172,6 +18221,9 @@ var getTaxCodeBreakdown = function getTaxCodeBreakdown(document, company, curren
18172
18221
  var _ref = _temp === void 0 ? {} : _temp,
18173
18222
  _ref$calculationRevam = _ref.calculationRevamp,
18174
18223
  calculationRevamp = _ref$calculationRevam === void 0 ? true : _ref$calculationRevam;
18224
+ if (!getCalculationContext$1(document, company).taxCodeRates) {
18225
+ return [];
18226
+ }
18175
18227
  if (!calculationRevamp) {
18176
18228
  return getOldTaxCodeBreakdown(document, company, currencyCode);
18177
18229
  }
@@ -18505,9 +18557,9 @@ var InvoiceContent = function InvoiceContent(_ref) {
18505
18557
  taxName2 = _getTaxDetails.taxName2,
18506
18558
  taxIncluded2 = _getTaxDetails.taxIncluded2;
18507
18559
  var eInvoiceConfig = getEInvoiceConfig(company.co);
18508
- var eInvoiceTaxLabel = eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
18509
- var displayTaxName1 = eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1;
18510
- var displayTaxName2 = eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2;
18560
+ var eInvoiceTaxLabel = document.eInvoicing && eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
18561
+ var displayTaxName1 = document.tn ? taxName1 : eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1;
18562
+ var displayTaxName2 = document.tn2 ? taxName2 : eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2;
18511
18563
  var timeZone = company.tz;
18512
18564
  var formatDate = function formatDate(date) {
18513
18565
  return getFormatDate({
@@ -18990,7 +19042,7 @@ var getDefaultLang = function getDefaultLang(t, lang) {
18990
19042
  siren: t ? t('label_siren') : lang['label_siren'],
18991
19043
  vat: t ? t('vat') : lang['vat'],
18992
19044
  serviceDeliveryDate: t ? t('service_delivery_date') : lang['service_delivery_date'],
18993
- tax_label: t ? t('tax_label') : lang['tax_label'],
19045
+ einvoice_tax_label: lang['einvoice_tax_label'],
18994
19046
  einvoice_vat_due_upon_issue: t ? t('einvoice_vat_due_upon_issue') : lang['einvoice_vat_due_upon_issue'],
18995
19047
  einvoice_vat_due_upon_payment: t ? t('einvoice_vat_due_upon_payment') : lang['einvoice_vat_due_upon_payment'],
18996
19048
  total_tax: t ? t('total_tax') : lang['total_tax'],
@@ -19437,9 +19489,9 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
19437
19489
  taxName2 = _getTaxDetails.taxName2,
19438
19490
  taxIncluded2 = _getTaxDetails.taxIncluded2;
19439
19491
  var eInvoiceConfig = getEInvoiceConfig(company.co);
19440
- var eInvoiceTaxLabel = eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
19441
- var displayTaxName1 = eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1;
19442
- var displayTaxName2 = eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2;
19492
+ var eInvoiceTaxLabel = document.eInvoicing && eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
19493
+ var displayTaxName1 = document.tn ? taxName1 : eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1;
19494
+ var displayTaxName2 = document.tn2 ? taxName2 : eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2;
19443
19495
  var timeZone = company.tz;
19444
19496
  var formatDate = function formatDate(date) {
19445
19497
  return getFormatDate({