@bookipi/htmlgenerator 1.12.0-alpha4 → 1.12.0-alpha5

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/index.js CHANGED
@@ -414,7 +414,7 @@ var en = (_deposit_due$terms$pr = {
414
414
  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.";
415
415
  }, _deposit_due$terms$pr.details_line_3 = function details_line_3(x, y, z) {
416
416
  return x + " (" + y + "). " + z;
417
- }, _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);
417
+ }, _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);
418
418
 
419
419
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
420
420
 
@@ -11829,6 +11829,59 @@ var util = {
11829
11829
  formatterBuilder: formatterBuilder
11830
11830
  };
11831
11831
 
11832
+ var TWO_DECIMAL_TOLERANCE = 0.01;
11833
+ var resolveTaxAmount = function resolveTaxAmount(tax) {
11834
+ var rate = Number(tax === null || tax === void 0 ? void 0 : tax.rate) || 0;
11835
+ var taxableAmount = Number(tax === null || tax === void 0 ? void 0 : tax.taxableAmount) || 0;
11836
+ if ((tax === null || tax === void 0 ? void 0 : tax.taxAmount) != null && !Number.isNaN(Number(tax.taxAmount))) {
11837
+ return Number(tax.taxAmount);
11838
+ }
11839
+ return taxableAmount * rate / 100;
11840
+ };
11841
+ var getEInvoiceTaxLines = function getEInvoiceTaxLines(document) {
11842
+ var _document$eInvoicing;
11843
+ var taxesSummary = document === null || document === void 0 ? void 0 : (_document$eInvoicing = document.eInvoicing) === null || _document$eInvoicing === void 0 ? void 0 : _document$eInvoicing.taxesSummary;
11844
+ if (!Array.isArray(taxesSummary) || taxesSummary.length === 0) {
11845
+ return null;
11846
+ }
11847
+ return taxesSummary.map(function (tax) {
11848
+ var _tax$categoryCode;
11849
+ return {
11850
+ rate: Number(tax === null || tax === void 0 ? void 0 : tax.rate) || 0,
11851
+ categoryCode: (_tax$categoryCode = tax === null || tax === void 0 ? void 0 : tax.categoryCode) != null ? _tax$categoryCode : '',
11852
+ taxableAmount: Number(tax === null || tax === void 0 ? void 0 : tax.taxableAmount) || 0,
11853
+ taxAmount: resolveTaxAmount(tax)
11854
+ };
11855
+ }).sort(function (a, b) {
11856
+ return a.rate - b.rate || a.categoryCode.localeCompare(b.categoryCode);
11857
+ });
11858
+ };
11859
+ var isTaxSummaryMatching = function isTaxSummaryMatching(lines, document) {
11860
+ if (!Array.isArray(lines) || lines.length === 0) return false;
11861
+ var linesTotal = lines.reduce(function (acc, line) {
11862
+ return acc + line.taxAmount;
11863
+ }, 0);
11864
+ var expectedTax = (document === null || document === void 0 ? void 0 : document.tx) != null ? Number(document.tx) : (Number(document === null || document === void 0 ? void 0 : document.tt) || 0) - (Number(document === null || document === void 0 ? void 0 : document.st) || 0);
11865
+ if (Number.isNaN(expectedTax)) return false;
11866
+ var tolerance = TWO_DECIMAL_TOLERANCE * lines.length;
11867
+ return Math.abs(linesTotal - expectedTax) <= tolerance;
11868
+ };
11869
+ var formatTaxRate = function formatTaxRate(rate, locale) {
11870
+ try {
11871
+ return new Intl.NumberFormat(locale || 'en', {
11872
+ maximumFractionDigits: 2
11873
+ }).format(Number(rate) || 0);
11874
+ } catch (_unused) {
11875
+ return String(Number(rate) || 0);
11876
+ }
11877
+ };
11878
+ var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(company, defaultLang) {
11879
+ var _ref, _ref2;
11880
+ var eInvoiceConfig = getEInvoiceConfig(company === null || company === void 0 ? void 0 : company.co);
11881
+ var configLabel = eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang[eInvoiceConfig.taxLabel] : null;
11882
+ return (_ref = (_ref2 = configLabel != null ? configLabel : defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.vat) != null ? _ref2 : defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.tax) != null ? _ref : 'Tax';
11883
+ };
11884
+
11832
11885
  var nl2br = function nl2br(str, is_xhtml) {
11833
11886
  if (typeof str === "undefined" || str === null) {
11834
11887
  return "";
@@ -11954,7 +12007,13 @@ var InvoiceContent = function InvoiceContent(_ref) {
11954
12007
  t: t
11955
12008
  });
11956
12009
  var effectiveCurrency = document.currency || company.cr;
11957
- return html$8(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["<!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table class=\"table table-invoice\">\n <thead>\n <tr class=\"table table-invoice\">\n <th\n class=\"text-left\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-center d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-right d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n ", "\n <th\n class=\"text-right item-last\"\n ", "\n >\n ", "\n </th>\n </tr>\n </thead>\n <tbody>\n ", "\n </tbody>\n </table>\n </div>\n\n <hr />\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-md-table-cell\" width=\"50%\"></td>\n <td style=\"padding: 0;\">\n <table class=\"table table-borderless table-small\">\n <tr>\n <td class=\"text-md-right\" width=\"22%\">\n ", "\n </td>\n <td class=\"text-right\" width=\"22%\">\n ", "\n </td>\n </tr>\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n <!-- end invoice-content -->"])), itemWidth[0] ? "width='" + itemWidth[0] + "'" : '', company.r_it ? company.r_it : defaultLang['item'], itemWidth[1] ? "width='" + itemWidth[1] + "'" : '', document.um ? document.um : company.r_q ? company.r_q : defaultLang['quantity'], itemWidth[2] ? "width='" + itemWidth[2] + "'" : '', company.r_p ? company.r_p : defaultLang['price'], discountOnItem ? "<th class=\"text-right d-none d-md-table-cell\" " + (itemWidth[3] ? "width='" + itemWidth[3] + "'" : '') + ">" + (company.r_dc ? company.r_dc : defaultLang['discount']) + "</th>" : '', itemWidth[4] ? "width='" + itemWidth[4] + "'" : '', company.r_a ? company.r_a : defaultLang['amount'], itemsContainer, company.r_sb ? company.r_sb : defaultLang['subtotal'], FormatCurrency$3(document.st, effectiveCurrency, company.la, company.cf), document.dc && !document.discountAfterTax ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$3(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && !document.sntx ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.tx != 0 ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (displayTaxName1 + taxIncluded1 + '(' + document.tp + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t1d ? '(' : '') + FormatCurrency$3(document.tx, effectiveCurrency, company.la, company.cf) + (document.t1d ? ')' : '')) + "</td>\n </tr>" : '', document.ttx && document.tx2 != 0 ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (displayTaxName2 + taxIncluded2 + '(' + document.tp2 + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t2d ? '(' : '') + FormatCurrency$3(document.tx2, effectiveCurrency, company.la, company.cf) + (document.t2d ? ')' : '')) + "</td>\n </tr>" : '', document.dc && document.discountAfterTax ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$3(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && document.sntx ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ti && !document.t1d && !document.t2d ? "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + (company.r_n ? company.r_n : defaultLang['net']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency$3(document.tt - (document.tx || 0) - (document.tx2 || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-bottom: 1px solid #ddd\">" + (company.r_tt ? company.r_tt : defaultLang['total']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-bottom: 1px solid #ddd\">" + FormatCurrency$3(document.tt ? document.tt : 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.sca ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + defaultLang['credit_card_surcharge'] + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.sca, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.hangingAmount && document.hangingAmount > 0 ? "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + (company.payment_in_progress ? company.payment_in_progress : defaultLang.payment_in_progress) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency$3(document.hangingAmount || 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 && document.pma && document.pm ? paymentContainer : '', document.ty == 1 && isDeposit && document.depositAmount > 0 ? "\n <tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + (document.ty == 1 ? company.r_ad ? company.r_ad : defaultLang['amount_due'] : company.r_gt ? company.r_gt : defaultLang['grand_total']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency$3(document.ad - (document.hangingAmount || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '');
12010
+ var eInvoiceTaxLines = getEInvoiceTaxLines(document);
12011
+ var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
12012
+ var defaultTaxRows = "" + (document.tx != 0 ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + ("" + displayTaxName1 + taxIncluded1 + "(" + document.tp + "%)") + "</td>\n <td class=\"text-right\" width=\"22%\">" + ("" + (document.t1d ? '(' : '') + FormatCurrency$3(document.tx, effectiveCurrency, company.la, company.cf) + (document.t1d ? ')' : '')) + "</td>\n </tr>" : '') + (document.ttx && document.tx2 != 0 ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + ("" + displayTaxName2 + taxIncluded2 + "(" + document.tp2 + "%)") + "</td>\n <td class=\"text-right\" width=\"22%\">" + ("" + (document.t2d ? '(' : '') + FormatCurrency$3(document.tx2, effectiveCurrency, company.la, company.cf) + (document.t2d ? ')' : '')) + "</td>\n </tr>" : '');
12013
+ var taxBreakdownRows = !eInvoiceTaxLines ? defaultTaxRows : isTaxSummaryMatching(eInvoiceTaxLines, document) ? eInvoiceTaxLines.map(function (line) {
12014
+ return "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (eInvoiceTaxRowLabel + " (" + formatTaxRate(line.rate, company.la) + "%)") + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(line.taxAmount, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>";
12015
+ }).join('') : "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (defaultLang['total_tax'] || 'Total tax') + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.tx || 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>";
12016
+ return html$8(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["<!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table class=\"table table-invoice\">\n <thead>\n <tr class=\"table table-invoice\">\n <th\n class=\"text-left\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-center d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-right d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n ", "\n <th\n class=\"text-right item-last\"\n ", "\n >\n ", "\n </th>\n </tr>\n </thead>\n <tbody>\n ", "\n </tbody>\n </table>\n </div>\n\n <hr />\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-md-table-cell\" width=\"50%\"></td>\n <td style=\"padding: 0;\">\n <table class=\"table table-borderless table-small\">\n <tr>\n <td class=\"text-md-right\" width=\"22%\">\n ", "\n </td>\n <td class=\"text-right\" width=\"22%\">\n ", "\n </td>\n </tr>\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n <!-- end invoice-content -->"])), itemWidth[0] ? "width='" + itemWidth[0] + "'" : '', company.r_it ? company.r_it : defaultLang['item'], itemWidth[1] ? "width='" + itemWidth[1] + "'" : '', document.um ? document.um : company.r_q ? company.r_q : defaultLang['quantity'], itemWidth[2] ? "width='" + itemWidth[2] + "'" : '', company.r_p ? company.r_p : defaultLang['price'], discountOnItem ? "<th class=\"text-right d-none d-md-table-cell\" " + (itemWidth[3] ? "width='" + itemWidth[3] + "'" : '') + ">" + (company.r_dc ? company.r_dc : defaultLang['discount']) + "</th>" : '', itemWidth[4] ? "width='" + itemWidth[4] + "'" : '', company.r_a ? company.r_a : defaultLang['amount'], itemsContainer, company.r_sb ? company.r_sb : defaultLang['subtotal'], FormatCurrency$3(document.st, effectiveCurrency, company.la, company.cf), document.dc && !document.discountAfterTax ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$3(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && !document.sntx ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', taxBreakdownRows, document.dc && document.discountAfterTax ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$3(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && document.sntx ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ti && !document.t1d && !document.t2d ? "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + (company.r_n ? company.r_n : defaultLang['net']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency$3(document.tt - (document.tx || 0) - (document.tx2 || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-bottom: 1px solid #ddd\">" + (company.r_tt ? company.r_tt : defaultLang['total']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-bottom: 1px solid #ddd\">" + FormatCurrency$3(document.tt ? document.tt : 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.sca ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + defaultLang['credit_card_surcharge'] + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$3(document.sca, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.hangingAmount && document.hangingAmount > 0 ? "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + (company.payment_in_progress ? company.payment_in_progress : defaultLang.payment_in_progress) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency$3(document.hangingAmount || 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 && document.pma && document.pm ? paymentContainer : '', document.ty == 1 && isDeposit && document.depositAmount > 0 ? "\n <tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + (document.ty == 1 ? company.r_ad ? company.r_ad : defaultLang['amount_due'] : company.r_gt ? company.r_gt : defaultLang['grand_total']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency$3(document.ad - (document.hangingAmount || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '');
11958
12017
  };
11959
12018
 
11960
12019
  var _templateObject$9, _templateObject2$2;
@@ -12144,7 +12203,7 @@ var PaymentInstructions = function PaymentInstructions(_ref) {
12144
12203
 
12145
12204
  var COMPANY_KEYS = ['_id', 'fax', 'contactName', 'c', 'e', 'ph', 'tfn', 'la', 'cr', 'cf', 'tz', 'ls', 'doc', 'bn', 'tn', 'tn2', 'tp', 'tp2', 'ti', 'ttx', 't1d', 't2d', 'pi', 'p1', 'p2', 'p3', 'sg', 'a1', 'a2', 'a3', 'address', 'language', 'la', 'sc', 'sr', 'ai', 'ct', 'de', 'r_bs', 'r_tc', 'r_nt', 'r_deposit_due', 'r_ad', 'r_gt', 'r_po', 'r_bt', 'r_st', 'r_d', 'r_a', 'r_dc', 'r_ic', 'r_it', 'r_n', 'r_p', 'r_q', 'r_sb', 'r_sp', 'r_tt', 'r_pi', 'r_inv', 'r_est', 'r_crd', 'r_dd', 'df', 'lg', 'hasPaymentInstructionQRCode', 'updatedAt', 'payment_in_progress', 'eInvoicing', 'co'];
12146
12205
 
12147
- var DOCUMENT_KEYS = ['_id', 'ad', 'ty', 'cu', 'currency', 'd', 'dd', 'rn', 'it', 'st', 'tx', 'tx2', 'tt', 'dc', 'dcp', 'dcpo', 'sp', 'sntx', 'tp', 'tp2', 'tn', 'tn2', 'tax1BaseAmount', 'tax2BaseAmount', 'ti', 'ttx', 't1d', 't2d', 'pm', 'sca', 'hangingAmount', 'depositAmount', 'um', 'shouldShowPaymentInstructions', 'customization', 'asi', 'no', 'proposal', 'd', 'rd', 'di', 'pon', 'pma', 'depositDue', 'noteHtml', 'nt', 'tc', 'sd', 'cs', 'a1', 'a2', 'a3', 't2di', 'dco', 'discountAfterTax', 'csd', 'tz', 'sent', 'isUserSignatureOverlayed', 'serviceDeliveryDate'];
12206
+ var DOCUMENT_KEYS = ['_id', 'ad', 'ty', 'cu', 'currency', 'd', 'dd', 'rn', 'it', 'st', 'tx', 'tx2', 'tt', 'dc', 'dcp', 'dcpo', 'sp', 'sntx', 'tp', 'tp2', 'tn', 'tn2', 'tax1BaseAmount', 'tax2BaseAmount', 'ti', 'ttx', 't1d', 't2d', 'pm', 'sca', 'hangingAmount', 'depositAmount', 'um', 'shouldShowPaymentInstructions', 'customization', 'asi', 'no', 'proposal', 'd', 'rd', 'di', 'pon', 'pma', 'depositDue', 'noteHtml', 'nt', 'tc', 'sd', 'cs', 'a1', 'a2', 'a3', 't2di', 'dco', 'discountAfterTax', 'csd', 'tz', 'sent', 'isUserSignatureOverlayed', 'serviceDeliveryDate', 'eInvoicing'];
12148
12207
 
12149
12208
  var decodeHtml = function decodeHtml(str) {
12150
12209
  if (str === void 0) {
@@ -12340,7 +12399,8 @@ var getDefaultLang = function getDefaultLang(t, lang) {
12340
12399
  siren: t ? t('label_siren') : lang['label_siren'],
12341
12400
  vat: t ? t('vat') : lang['vat'],
12342
12401
  serviceDeliveryDate: t ? t('service_delivery_date') : lang['service_delivery_date'],
12343
- tax_label: t ? t('tax_label') : lang['tax_label']
12402
+ tax_label: t ? t('tax_label') : lang['tax_label'],
12403
+ total_tax: t ? t('total_tax') : lang['total_tax']
12344
12404
  };
12345
12405
  };
12346
12406
 
@@ -12773,7 +12833,13 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
12773
12833
  t: t
12774
12834
  });
12775
12835
  var effectiveCurrency = document.currency || company.cr;
12776
- return html$q(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["<!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table\n class=\"table table-borderless table-invoice\"\n style=\"margin-bottom: 40px; table-layout: fixed;\"\n >\n <thead class=\"invoice-table-header invoice-items-head\">\n <tr class=\"table table-invoice\">\n <th\n class=\"text-left text-uppercase\"\n style=\"border-top-left-radius: 8px; border-bottom-left-radius: 8px;\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-center text-uppercase d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-center text-uppercase d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n ", "\n <th\n class=\"text-right text-uppercase item-last\"\n style=\"border-top-right-radius: 8px; border-bottom-right-radius: 8px;\"\n ", "\n >\n ", "\n </th>\n </tr>\n </thead>\n <tbody>\n ", "\n </tbody>\n </table>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"price-table table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-md-table-cell\" width=\"50%\"></td>\n <td style=\"padding: 0;\">\n <table class=\"price-table table table-borderless table-small\">\n <tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">\n ", "\n </td>\n <td\n class=\"text-right\"\n width=\"22%\"\n style=\"border-top: 1px solid #E5E7EB\"\n >\n ", "\n </td>\n </tr>\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n\n <!-- end invoice-content -->\n </div>"])), itemWidth[0] ? "width='" + itemWidth[0] + "'" : '', company.r_it ? company.r_it : defaultLang['item'], itemWidth[1] ? "width='" + itemWidth[1] + "'" : '', company.r_p ? company.r_p : defaultLang['price'], itemWidth[2] ? "width='" + itemWidth[2] + "'" : '', document.um ? document.um : company.r_q ? company.r_q : defaultLang['quantity'], discountOnItem ? "<th class=\"text-right text-uppercase d-none d-md-table-cell\" " + (itemWidth[3] ? "width='" + itemWidth[3] + "'" : '') + ">" + (company.r_dc ? company.r_dc : defaultLang['discount']) + "</th>" : '', itemWidth[4] ? "width='" + itemWidth[4] + "'" : '', company.r_a ? company.r_a : defaultLang['amount'], itemsContainer, company.r_sb ? company.r_sb : defaultLang['subtotal'], FormatCurrency$7(document.st, effectiveCurrency, company.la, company.cf), document.dc && !document.discountAfterTax ? "<tr>\n <td width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$7(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && !document.sntx ? "<tr>\n <td width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.tx != 0 ? "<tr>\n <td width=\"22%\">" + (displayTaxName1 + taxIncluded1 + '(' + document.tp + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t1d ? '(' : '') + FormatCurrency$7(document.tx, effectiveCurrency, company.la, company.cf) + (document.t1d ? ')' : '')) + "</td>\n </tr>" : '', document.ttx && document.tx2 != 0 ? "<tr>\n <td width=\"22%\">" + (displayTaxName2 + taxIncluded2 + '(' + document.tp2 + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t2d ? '(' : '') + FormatCurrency$7(document.tx2, effectiveCurrency, company.la, company.cf) + (document.t2d ? ')' : '')) + "</td>\n </tr>" : '', document.dc && document.discountAfterTax ? "<tr>\n <td width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$7(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && document.sntx ? "<tr>\n <td width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ti && !document.t1d && !document.t2d ? "<tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + (company.r_n ? company.r_n : defaultLang['net']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + FormatCurrency$7(document.tt - (document.tx || 0) - (document.tx2 || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td width=\"22%\">" + (company.r_tt ? company.r_tt : defaultLang['total']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.tt ? document.tt : 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.sca ? "<tr>\n <td width=\"22%\">" + defaultLang['credit_card_surcharge'] + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.sca, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.hangingAmount && document.hangingAmount > 0 ? "<tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + (company.payment_in_progress ? company.payment_in_progress : defaultLang.payment_in_progress) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + FormatCurrency$7(document.hangingAmount || 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 && document.pma && document.pm ? paymentContainer : '', document.ty == 1 && isDeposit && document.depositAmount > 0 ? "\n <tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + (document.ty == 1 ? company.r_ad ? company.r_ad : defaultLang['amount_due'] : company.r_gt ? company.r_gt : defaultLang['grand_total']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + FormatCurrency$7(document.ad - (document.hangingAmount || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '');
12836
+ var eInvoiceTaxLines = getEInvoiceTaxLines(document);
12837
+ var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
12838
+ var defaultTaxRows = "" + (document.tx != 0 ? "<tr>\n <td width=\"22%\">" + (displayTaxName1 + taxIncluded1 + '(' + document.tp + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t1d ? '(' : '') + FormatCurrency$7(document.tx, effectiveCurrency, company.la, company.cf) + (document.t1d ? ')' : '')) + "</td>\n </tr>" : '') + (document.ttx && document.tx2 != 0 ? "<tr>\n <td width=\"22%\">" + (displayTaxName2 + taxIncluded2 + '(' + document.tp2 + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t2d ? '(' : '') + FormatCurrency$7(document.tx2, effectiveCurrency, company.la, company.cf) + (document.t2d ? ')' : '')) + "</td>\n </tr>" : '');
12839
+ var taxBreakdownRows = !eInvoiceTaxLines ? defaultTaxRows : isTaxSummaryMatching(eInvoiceTaxLines, document) ? eInvoiceTaxLines.map(function (line) {
12840
+ return "<tr>\n <td width=\"22%\">" + (eInvoiceTaxRowLabel + ' (' + formatTaxRate(line.rate, company.la) + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(line.taxAmount, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>";
12841
+ }).join('') : "<tr>\n <td width=\"22%\">" + (defaultLang['total_tax'] || 'Total tax') + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.tx || 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>";
12842
+ return html$q(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["<!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table\n class=\"table table-borderless table-invoice\"\n style=\"margin-bottom: 40px; table-layout: fixed;\"\n >\n <thead class=\"invoice-table-header invoice-items-head\">\n <tr class=\"table table-invoice\">\n <th\n class=\"text-left text-uppercase\"\n style=\"border-top-left-radius: 8px; border-bottom-left-radius: 8px;\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-center text-uppercase d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n <th\n class=\"text-center text-uppercase d-none d-md-table-cell\"\n ", "\n >\n ", "\n </th>\n ", "\n <th\n class=\"text-right text-uppercase item-last\"\n style=\"border-top-right-radius: 8px; border-bottom-right-radius: 8px;\"\n ", "\n >\n ", "\n </th>\n </tr>\n </thead>\n <tbody>\n ", "\n </tbody>\n </table>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"price-table table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-md-table-cell\" width=\"50%\"></td>\n <td style=\"padding: 0;\">\n <table class=\"price-table table table-borderless table-small\">\n <tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">\n ", "\n </td>\n <td\n class=\"text-right\"\n width=\"22%\"\n style=\"border-top: 1px solid #E5E7EB\"\n >\n ", "\n </td>\n </tr>\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n\n <!-- end invoice-content -->\n </div>"])), itemWidth[0] ? "width='" + itemWidth[0] + "'" : '', company.r_it ? company.r_it : defaultLang['item'], itemWidth[1] ? "width='" + itemWidth[1] + "'" : '', company.r_p ? company.r_p : defaultLang['price'], itemWidth[2] ? "width='" + itemWidth[2] + "'" : '', document.um ? document.um : company.r_q ? company.r_q : defaultLang['quantity'], discountOnItem ? "<th class=\"text-right text-uppercase d-none d-md-table-cell\" " + (itemWidth[3] ? "width='" + itemWidth[3] + "'" : '') + ">" + (company.r_dc ? company.r_dc : defaultLang['discount']) + "</th>" : '', itemWidth[4] ? "width='" + itemWidth[4] + "'" : '', company.r_a ? company.r_a : defaultLang['amount'], itemsContainer, company.r_sb ? company.r_sb : defaultLang['subtotal'], FormatCurrency$7(document.st, effectiveCurrency, company.la, company.cf), document.dc && !document.discountAfterTax ? "<tr>\n <td width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$7(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && !document.sntx ? "<tr>\n <td width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', taxBreakdownRows, document.dc && document.discountAfterTax ? "<tr>\n <td width=\"22%\">" + ((company.r_dc ? company.r_dc : defaultLang['discount']) + (document.dcpo && document.dcp ? ' (' + document.dcp + '%)' : '')) + "</td>\n <td class=\"text-right\" width=\"22%\">" + ('(' + FormatCurrency$7(document.dc, effectiveCurrency, company.la, company.cf) + ')') + "</td>\n </tr>" : '', document.sp && document.sntx ? "<tr>\n <td width=\"22%\">" + (company.r_sp ? company.r_sp : defaultLang['shipping']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.sp, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ti && !document.t1d && !document.t2d ? "<tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + (company.r_n ? company.r_n : defaultLang['net']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + FormatCurrency$7(document.tt - (document.tx || 0) - (document.tx2 || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td width=\"22%\">" + (company.r_tt ? company.r_tt : defaultLang['total']) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.tt ? document.tt : 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.sca ? "<tr>\n <td width=\"22%\">" + defaultLang['credit_card_surcharge'] + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$7(document.sca, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.hangingAmount && document.hangingAmount > 0 ? "<tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + (company.payment_in_progress ? company.payment_in_progress : defaultLang.payment_in_progress) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + FormatCurrency$7(document.hangingAmount || 0, effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '', document.ty == 1 && document.pma && document.pm ? paymentContainer : '', document.ty == 1 && isDeposit && document.depositAmount > 0 ? "\n <tr>\n <td width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + (document.ty == 1 ? company.r_ad ? company.r_ad : defaultLang['amount_due'] : company.r_gt ? company.r_gt : defaultLang['grand_total']) + "</td>\n <td class=\"text-right\" width=\"22%\" style=\"border-top: 1px solid #E5E7EB\">" + FormatCurrency$7(document.ad - (document.hangingAmount || 0), effectiveCurrency, company.la, company.cf) + "</td>\n </tr>" : '');
12777
12843
  };
12778
12844
 
12779
12845
  var _templateObject$s;