@bookipi/htmlgenerator 1.12.0-alpha5 → 1.12.0-alpha6
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 +57 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +57 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11882,6 +11882,42 @@ var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(company, defaultLang) {
|
|
|
11882
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
11883
|
};
|
|
11884
11884
|
|
|
11885
|
+
var checkHasShippingTaxRate = function checkHasShippingTaxRate(document) {
|
|
11886
|
+
return document.shippingTaxRate != null && document.shippingTaxRate !== '';
|
|
11887
|
+
};
|
|
11888
|
+
var computeShippingTax = function computeShippingTax(document) {
|
|
11889
|
+
var rate = checkHasShippingTaxRate(document) ? parseFloat(document.shippingTaxRate) : 0;
|
|
11890
|
+
var shipping = document.sp ? parseFloat(document.sp) : 0;
|
|
11891
|
+
if (!(rate > 0) || document.sntx || !shipping) {
|
|
11892
|
+
return 0;
|
|
11893
|
+
}
|
|
11894
|
+
return document.ti ? shipping * (1 - 1 / (1 + rate / 100)) : shipping * rate / 100;
|
|
11895
|
+
};
|
|
11896
|
+
var getShippingTaxBreakdown = function getShippingTaxBreakdown(document) {
|
|
11897
|
+
var hasShippingTaxRate = checkHasShippingTaxRate(document);
|
|
11898
|
+
var shippingTaxRate = hasShippingTaxRate ? parseFloat(document.shippingTaxRate) : 0;
|
|
11899
|
+
var shippingTax = computeShippingTax(document);
|
|
11900
|
+
var itemTax1 = document.tx ? parseFloat(document.tx) : 0;
|
|
11901
|
+
var itemTax2 = document.tx2 ? parseFloat(document.tx2) : 0;
|
|
11902
|
+
var shippingMatchesTax1 = hasShippingTaxRate && shippingTaxRate > 0 && !document.sntx && shippingTaxRate === parseFloat(document.tp || 0);
|
|
11903
|
+
var shippingMatchesTax2 = hasShippingTaxRate && shippingTaxRate > 0 && !document.sntx && !!document.ttx && shippingTaxRate === parseFloat(document.tp2 || 0) && !shippingMatchesTax1;
|
|
11904
|
+
var showTax1SubBreakdown = shippingMatchesTax1 && !!shippingTax;
|
|
11905
|
+
var showTax2SubBreakdown = shippingMatchesTax2 && !!shippingTax;
|
|
11906
|
+
var showSeparateShippingLine = hasShippingTaxRate && shippingTaxRate > 0 && !document.sntx && !shippingMatchesTax1 && !shippingMatchesTax2 && !!shippingTax;
|
|
11907
|
+
return {
|
|
11908
|
+
hasShippingTaxRate: hasShippingTaxRate,
|
|
11909
|
+
shippingTaxRate: shippingTaxRate,
|
|
11910
|
+
shippingTax: shippingTax,
|
|
11911
|
+
itemTax1: itemTax1,
|
|
11912
|
+
itemTax2: itemTax2,
|
|
11913
|
+
shippingMatchesTax1: shippingMatchesTax1,
|
|
11914
|
+
shippingMatchesTax2: shippingMatchesTax2,
|
|
11915
|
+
showTax1SubBreakdown: showTax1SubBreakdown,
|
|
11916
|
+
showTax2SubBreakdown: showTax2SubBreakdown,
|
|
11917
|
+
showSeparateShippingLine: showSeparateShippingLine
|
|
11918
|
+
};
|
|
11919
|
+
};
|
|
11920
|
+
|
|
11885
11921
|
var nl2br = function nl2br(str, is_xhtml) {
|
|
11886
11922
|
if (typeof str === "undefined" || str === null) {
|
|
11887
11923
|
return "";
|
|
@@ -12009,7 +12045,15 @@ var InvoiceContent = function InvoiceContent(_ref) {
|
|
|
12009
12045
|
var effectiveCurrency = document.currency || company.cr;
|
|
12010
12046
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
12011
12047
|
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
12012
|
-
var
|
|
12048
|
+
var shippingBreakdown = getShippingTaxBreakdown(document);
|
|
12049
|
+
var formatAmount = function formatAmount(amount) {
|
|
12050
|
+
return FormatCurrency$3(amount, effectiveCurrency, company.la, company.cf);
|
|
12051
|
+
};
|
|
12052
|
+
var shippingLabel = company.r_sp ? company.r_sp : defaultLang['shipping'];
|
|
12053
|
+
var subBreakdownRows = function subBreakdownRows(itemsAmount, shippingAmount) {
|
|
12054
|
+
return "<tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"padding-left: 24px;\">" + defaultLang['item'] + "</td>\n <td class=\"text-right\" width=\"22%\">" + formatAmount(itemsAmount) + "</td>\n </tr>\n <tr>\n <td class=\"text-md-right\" width=\"22%\" style=\"padding-left: 24px;\">" + shippingLabel + "</td>\n <td class=\"text-right\" width=\"22%\">" + formatAmount(shippingAmount) + "</td>\n </tr>";
|
|
12055
|
+
};
|
|
12056
|
+
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 ? '(' : '') + formatAmount(shippingBreakdown.shippingMatchesTax1 ? shippingBreakdown.itemTax1 + shippingBreakdown.shippingTax : document.tx) + (document.t1d ? ')' : '')) + "</td>\n </tr>" + (shippingBreakdown.showTax1SubBreakdown ? subBreakdownRows(shippingBreakdown.itemTax1, shippingBreakdown.shippingTax) : '') : '') + (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 ? '(' : '') + formatAmount(shippingBreakdown.shippingMatchesTax2 ? shippingBreakdown.itemTax2 + shippingBreakdown.shippingTax : document.tx2) + (document.t2d ? ')' : '')) + "</td>\n </tr>" + (shippingBreakdown.showTax2SubBreakdown ? subBreakdownRows(shippingBreakdown.itemTax2, shippingBreakdown.shippingTax) : '') : '') + (shippingBreakdown.showSeparateShippingLine ? "<tr>\n <td class=\"text-md-right\" width=\"22%\">" + (shippingLabel + " " + defaultLang['tax'] + (document.ti ? ' ' + defaultLang['included'] : '') + " (" + formatTaxRate(shippingBreakdown.shippingTaxRate, company.la) + "%)") + "</td>\n <td class=\"text-right\" width=\"22%\">" + formatAmount(shippingBreakdown.shippingTax) + "</td>\n </tr>" : '');
|
|
12013
12057
|
var taxBreakdownRows = !eInvoiceTaxLines ? defaultTaxRows : isTaxSummaryMatching(eInvoiceTaxLines, document) ? eInvoiceTaxLines.map(function (line) {
|
|
12014
12058
|
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
12059
|
}).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>";
|
|
@@ -12203,7 +12247,7 @@ var PaymentInstructions = function PaymentInstructions(_ref) {
|
|
|
12203
12247
|
|
|
12204
12248
|
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'];
|
|
12205
12249
|
|
|
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'];
|
|
12250
|
+
var DOCUMENT_KEYS = ['_id', 'ad', 'ty', 'cu', 'currency', 'd', 'dd', 'rn', 'it', 'st', 'tx', 'tx2', 'tt', 'dc', 'dcp', 'dcpo', 'sp', 'sntx', 'shippingTaxRate', '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'];
|
|
12207
12251
|
|
|
12208
12252
|
var decodeHtml = function decodeHtml(str) {
|
|
12209
12253
|
if (str === void 0) {
|
|
@@ -12400,7 +12444,8 @@ var getDefaultLang = function getDefaultLang(t, lang) {
|
|
|
12400
12444
|
vat: t ? t('vat') : lang['vat'],
|
|
12401
12445
|
serviceDeliveryDate: t ? t('service_delivery_date') : lang['service_delivery_date'],
|
|
12402
12446
|
tax_label: t ? t('tax_label') : lang['tax_label'],
|
|
12403
|
-
total_tax: t ? t('total_tax') : lang['total_tax']
|
|
12447
|
+
total_tax: t ? t('total_tax') : lang['total_tax'],
|
|
12448
|
+
tax: t ? t('tax') : lang['tax']
|
|
12404
12449
|
};
|
|
12405
12450
|
};
|
|
12406
12451
|
|
|
@@ -12835,7 +12880,15 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
|
|
|
12835
12880
|
var effectiveCurrency = document.currency || company.cr;
|
|
12836
12881
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
12837
12882
|
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
12838
|
-
var
|
|
12883
|
+
var shippingBreakdown = getShippingTaxBreakdown(document);
|
|
12884
|
+
var formatAmount = function formatAmount(amount) {
|
|
12885
|
+
return FormatCurrency$7(amount, effectiveCurrency, company.la, company.cf);
|
|
12886
|
+
};
|
|
12887
|
+
var shippingLabel = company.r_sp ? company.r_sp : defaultLang['shipping'];
|
|
12888
|
+
var subBreakdownRows = function subBreakdownRows(itemsAmount, shippingAmount) {
|
|
12889
|
+
return "<tr>\n <td width=\"22%\" style=\"padding-left: 24px;\">" + defaultLang['item'] + "</td>\n <td class=\"text-right\" width=\"22%\">" + formatAmount(itemsAmount) + "</td>\n </tr>\n <tr>\n <td width=\"22%\" style=\"padding-left: 24px;\">" + shippingLabel + "</td>\n <td class=\"text-right\" width=\"22%\">" + formatAmount(shippingAmount) + "</td>\n </tr>";
|
|
12890
|
+
};
|
|
12891
|
+
var defaultTaxRows = "" + (document.tx != 0 ? "<tr>\n <td width=\"22%\">" + (displayTaxName1 + taxIncluded1 + '(' + document.tp + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t1d ? '(' : '') + formatAmount(shippingBreakdown.shippingMatchesTax1 ? shippingBreakdown.itemTax1 + shippingBreakdown.shippingTax : document.tx) + (document.t1d ? ')' : '')) + "</td>\n </tr>" + (shippingBreakdown.showTax1SubBreakdown ? subBreakdownRows(shippingBreakdown.itemTax1, shippingBreakdown.shippingTax) : '') : '') + (document.ttx && document.tx2 != 0 ? "<tr>\n <td width=\"22%\">" + (displayTaxName2 + taxIncluded2 + '(' + document.tp2 + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + ((document.t2d ? '(' : '') + formatAmount(shippingBreakdown.shippingMatchesTax2 ? shippingBreakdown.itemTax2 + shippingBreakdown.shippingTax : document.tx2) + (document.t2d ? ')' : '')) + "</td>\n </tr>" + (shippingBreakdown.showTax2SubBreakdown ? subBreakdownRows(shippingBreakdown.itemTax2, shippingBreakdown.shippingTax) : '') : '') + (shippingBreakdown.showSeparateShippingLine ? "<tr>\n <td width=\"22%\">" + (shippingLabel + ' ' + defaultLang['tax'] + (document.ti ? ' ' + defaultLang['included'] : '') + ' (' + formatTaxRate(shippingBreakdown.shippingTaxRate, company.la) + '%)') + "</td>\n <td class=\"text-right\" width=\"22%\">" + formatAmount(shippingBreakdown.shippingTax) + "</td>\n </tr>" : '');
|
|
12839
12892
|
var taxBreakdownRows = !eInvoiceTaxLines ? defaultTaxRows : isTaxSummaryMatching(eInvoiceTaxLines, document) ? eInvoiceTaxLines.map(function (line) {
|
|
12840
12893
|
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
12894
|
}).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>";
|