@bookipi/htmlgenerator 1.12.0-alpha3 → 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.
@@ -412,7 +412,7 @@ var en = (_deposit_due$terms$pr = {
412
412
  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.";
413
413
  }, _deposit_due$terms$pr.details_line_3 = function details_line_3(x, y, z) {
414
414
  return x + " (" + y + "). " + z;
415
- }, _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);
415
+ }, _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);
416
416
 
417
417
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
418
418
 
@@ -8891,7 +8891,7 @@ var getDocumentName = function getDocumentName(_ref) {
8891
8891
  var _company$doc$document2;
8892
8892
  documentName = (_company$doc$document2 = company.doc[document.ty]) === null || _company$doc$document2 === void 0 ? void 0 : _company$doc$document2.n;
8893
8893
  } else {
8894
- if (document.ty === 1) {
8894
+ if (document.ty === 1 || document.ty === 5) {
8895
8895
  documentName = company.r_inv ? company.r_inv : defaultLang['document'];
8896
8896
  } else if (document.ty === 2) {
8897
8897
  documentName = company.r_crd ? company.r_crd : defaultLang['creditNote'];
@@ -11828,6 +11828,59 @@ var util = {
11828
11828
  };
11829
11829
  //# sourceMappingURL=index.modern.js.map
11830
11830
 
11831
+ var TWO_DECIMAL_TOLERANCE = 0.01;
11832
+ var resolveTaxAmount = function resolveTaxAmount(tax) {
11833
+ var rate = Number(tax === null || tax === void 0 ? void 0 : tax.rate) || 0;
11834
+ var taxableAmount = Number(tax === null || tax === void 0 ? void 0 : tax.taxableAmount) || 0;
11835
+ if ((tax === null || tax === void 0 ? void 0 : tax.taxAmount) != null && !Number.isNaN(Number(tax.taxAmount))) {
11836
+ return Number(tax.taxAmount);
11837
+ }
11838
+ return taxableAmount * rate / 100;
11839
+ };
11840
+ var getEInvoiceTaxLines = function getEInvoiceTaxLines(document) {
11841
+ var _document$eInvoicing;
11842
+ var taxesSummary = document === null || document === void 0 ? void 0 : (_document$eInvoicing = document.eInvoicing) === null || _document$eInvoicing === void 0 ? void 0 : _document$eInvoicing.taxesSummary;
11843
+ if (!Array.isArray(taxesSummary) || taxesSummary.length === 0) {
11844
+ return null;
11845
+ }
11846
+ return taxesSummary.map(function (tax) {
11847
+ var _tax$categoryCode;
11848
+ return {
11849
+ rate: Number(tax === null || tax === void 0 ? void 0 : tax.rate) || 0,
11850
+ categoryCode: (_tax$categoryCode = tax === null || tax === void 0 ? void 0 : tax.categoryCode) != null ? _tax$categoryCode : '',
11851
+ taxableAmount: Number(tax === null || tax === void 0 ? void 0 : tax.taxableAmount) || 0,
11852
+ taxAmount: resolveTaxAmount(tax)
11853
+ };
11854
+ }).sort(function (a, b) {
11855
+ return a.rate - b.rate || a.categoryCode.localeCompare(b.categoryCode);
11856
+ });
11857
+ };
11858
+ var isTaxSummaryMatching = function isTaxSummaryMatching(lines, document) {
11859
+ if (!Array.isArray(lines) || lines.length === 0) return false;
11860
+ var linesTotal = lines.reduce(function (acc, line) {
11861
+ return acc + line.taxAmount;
11862
+ }, 0);
11863
+ 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);
11864
+ if (Number.isNaN(expectedTax)) return false;
11865
+ var tolerance = TWO_DECIMAL_TOLERANCE * lines.length;
11866
+ return Math.abs(linesTotal - expectedTax) <= tolerance;
11867
+ };
11868
+ var formatTaxRate = function formatTaxRate(rate, locale) {
11869
+ try {
11870
+ return new Intl.NumberFormat(locale || 'en', {
11871
+ maximumFractionDigits: 2
11872
+ }).format(Number(rate) || 0);
11873
+ } catch (_unused) {
11874
+ return String(Number(rate) || 0);
11875
+ }
11876
+ };
11877
+ var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(company, defaultLang) {
11878
+ var _ref, _ref2;
11879
+ var eInvoiceConfig = getEInvoiceConfig(company === null || company === void 0 ? void 0 : company.co);
11880
+ var configLabel = eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang[eInvoiceConfig.taxLabel] : null;
11881
+ 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';
11882
+ };
11883
+
11831
11884
  var nl2br = function nl2br(str, is_xhtml) {
11832
11885
  if (typeof str === "undefined" || str === null) {
11833
11886
  return "";
@@ -11953,7 +12006,13 @@ var InvoiceContent = function InvoiceContent(_ref) {
11953
12006
  t: t
11954
12007
  });
11955
12008
  var effectiveCurrency = document.currency || company.cr;
11956
- 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>" : '');
12009
+ var eInvoiceTaxLines = getEInvoiceTaxLines(document);
12010
+ var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
12011
+ 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>" : '');
12012
+ var taxBreakdownRows = !eInvoiceTaxLines ? defaultTaxRows : isTaxSummaryMatching(eInvoiceTaxLines, document) ? eInvoiceTaxLines.map(function (line) {
12013
+ 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>";
12014
+ }).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>";
12015
+ 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>" : '');
11957
12016
  };
11958
12017
 
11959
12018
  var _templateObject$9, _templateObject2$2;
@@ -12143,7 +12202,7 @@ var PaymentInstructions = function PaymentInstructions(_ref) {
12143
12202
 
12144
12203
  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'];
12145
12204
 
12146
- 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'];
12205
+ 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'];
12147
12206
 
12148
12207
  var decodeHtml = function decodeHtml(str) {
12149
12208
  if (str === void 0) {
@@ -12339,7 +12398,8 @@ var getDefaultLang = function getDefaultLang(t, lang) {
12339
12398
  siren: t ? t('label_siren') : lang['label_siren'],
12340
12399
  vat: t ? t('vat') : lang['vat'],
12341
12400
  serviceDeliveryDate: t ? t('service_delivery_date') : lang['service_delivery_date'],
12342
- tax_label: t ? t('tax_label') : lang['tax_label']
12401
+ tax_label: t ? t('tax_label') : lang['tax_label'],
12402
+ total_tax: t ? t('total_tax') : lang['total_tax']
12343
12403
  };
12344
12404
  };
12345
12405
 
@@ -12772,7 +12832,13 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
12772
12832
  t: t
12773
12833
  });
12774
12834
  var effectiveCurrency = document.currency || company.cr;
12775
- 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>" : '');
12835
+ var eInvoiceTaxLines = getEInvoiceTaxLines(document);
12836
+ var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
12837
+ 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>" : '');
12838
+ var taxBreakdownRows = !eInvoiceTaxLines ? defaultTaxRows : isTaxSummaryMatching(eInvoiceTaxLines, document) ? eInvoiceTaxLines.map(function (line) {
12839
+ 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>";
12840
+ }).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>";
12841
+ 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>" : '');
12776
12842
  };
12777
12843
 
12778
12844
  var _templateObject$s;