@bookipi/htmlgenerator 1.14.1-alpha.6 → 1.14.1-alpha.8
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 +25 -15
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +25 -15
- package/dist/index.modern.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/utils.modern.js +1 -1
- package/dist/utils.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8896,6 +8896,16 @@ var updateLocale = function updateLocale() {
|
|
|
8896
8896
|
});
|
|
8897
8897
|
};
|
|
8898
8898
|
|
|
8899
|
+
var getCustomLabel = function getCustomLabel() {
|
|
8900
|
+
var _labels$find;
|
|
8901
|
+
for (var _len = arguments.length, labels = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8902
|
+
labels[_key] = arguments[_key];
|
|
8903
|
+
}
|
|
8904
|
+
return (_labels$find = labels.find(function (label) {
|
|
8905
|
+
return typeof label === 'string' && label.trim();
|
|
8906
|
+
})) === null || _labels$find === void 0 ? void 0 : _labels$find.trim();
|
|
8907
|
+
};
|
|
8908
|
+
|
|
8899
8909
|
var getOldTaxDetails = function getOldTaxDetails(document, company, defaultLang) {
|
|
8900
8910
|
var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
|
|
8901
8911
|
var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
|
|
@@ -8906,11 +8916,11 @@ var getOldTaxDetails = function getOldTaxDetails(document, company, defaultLang)
|
|
|
8906
8916
|
var discountOnItem = false;
|
|
8907
8917
|
var hasNonTaxableItem = false;
|
|
8908
8918
|
if (document.tx != 0) {
|
|
8909
|
-
taxName1 = document.tn
|
|
8919
|
+
taxName1 = getCustomLabel(document.tn, company.tn, 'Tax');
|
|
8910
8920
|
taxIncluded1 = document.ti && !document.t1d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
8911
8921
|
}
|
|
8912
8922
|
if (document.ttx && document.tx2 != 0) {
|
|
8913
|
-
taxName2 = document.tn2
|
|
8923
|
+
taxName2 = getCustomLabel(document.tn2, company.tn2, 'Tax');
|
|
8914
8924
|
taxIncluded2 = document.ti && !document.t2d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
8915
8925
|
}
|
|
8916
8926
|
if (document.it) {
|
|
@@ -9069,11 +9079,11 @@ var getTaxDetails = function getTaxDetails(document, company, defaultLang, _temp
|
|
|
9069
9079
|
var taxName2;
|
|
9070
9080
|
var taxIncluded2;
|
|
9071
9081
|
if (document.tx != 0) {
|
|
9072
|
-
taxName1 = document.tn
|
|
9082
|
+
taxName1 = getCustomLabel(document.tn, company.tn, 'Tax');
|
|
9073
9083
|
taxIncluded1 = document.ti && !document.t1d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
9074
9084
|
}
|
|
9075
9085
|
if (document.ttx && document.tx2 != 0) {
|
|
9076
|
-
taxName2 = document.tn2
|
|
9086
|
+
taxName2 = getCustomLabel(document.tn2, company.tn2, 'Tax');
|
|
9077
9087
|
taxIncluded2 = document.ti && !document.t2d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
9078
9088
|
}
|
|
9079
9089
|
var discountOnItem = (document.it || []).some(function (item) {
|
|
@@ -18097,11 +18107,11 @@ var formatTaxRate = function formatTaxRate(rate, locale) {
|
|
|
18097
18107
|
return String(Number(rate) || 0);
|
|
18098
18108
|
}
|
|
18099
18109
|
};
|
|
18100
|
-
var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(company, defaultLang) {
|
|
18110
|
+
var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(document, company, defaultLang) {
|
|
18101
18111
|
var _ref, _ref2, _defaultLang$vat;
|
|
18102
18112
|
var eInvoiceConfig = getEInvoiceConfig(company === null || company === void 0 ? void 0 : company.co);
|
|
18103
18113
|
var configLabel = eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang[eInvoiceConfig.taxLabel] : null;
|
|
18104
|
-
return (_ref = (_ref2 = (_defaultLang$vat = defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.vat) != null ? _defaultLang$vat : configLabel) != null ? _ref2 : defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.tax) != null ? _ref : 'Tax';
|
|
18114
|
+
return getCustomLabel(document === null || document === void 0 ? void 0 : document.tn, company === null || company === void 0 ? void 0 : company.tn, (_ref = (_ref2 = (_defaultLang$vat = defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.vat) != null ? _defaultLang$vat : configLabel) != null ? _ref2 : defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.tax) != null ? _ref : 'Tax');
|
|
18105
18115
|
};
|
|
18106
18116
|
|
|
18107
18117
|
var toCalcCompany = function toCalcCompany(company, currencyCode) {
|
|
@@ -18559,8 +18569,8 @@ var InvoiceContent = function InvoiceContent(_ref) {
|
|
|
18559
18569
|
taxIncluded2 = _getTaxDetails.taxIncluded2;
|
|
18560
18570
|
var eInvoiceConfig = getEInvoiceConfig(company.co);
|
|
18561
18571
|
var eInvoiceTaxLabel = document.eInvoicing && eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
|
|
18562
|
-
var displayTaxName1 = document.tn
|
|
18563
|
-
var displayTaxName2 = document.tn2
|
|
18572
|
+
var displayTaxName1 = getCustomLabel(document.tn, company.tn, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1);
|
|
18573
|
+
var displayTaxName2 = getCustomLabel(document.tn2, company.tn2, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2);
|
|
18564
18574
|
var timeZone = company.tz;
|
|
18565
18575
|
var formatDate = function formatDate(date) {
|
|
18566
18576
|
return getFormatDate({
|
|
@@ -18588,7 +18598,7 @@ var InvoiceContent = function InvoiceContent(_ref) {
|
|
|
18588
18598
|
});
|
|
18589
18599
|
var effectiveCurrency = document.currency || company.cr;
|
|
18590
18600
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
18591
|
-
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
18601
|
+
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(document, company, defaultLang);
|
|
18592
18602
|
var shippingBreakdown = getShippingTaxBreakdown(document, effectiveCurrency, showShippingTaxBreakdown, calculationOptions);
|
|
18593
18603
|
var formatAmount = function formatAmount(amount) {
|
|
18594
18604
|
return FormatCurrency$3(amount, effectiveCurrency, company.la, company.cf);
|
|
@@ -19491,8 +19501,8 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
|
|
|
19491
19501
|
taxIncluded2 = _getTaxDetails.taxIncluded2;
|
|
19492
19502
|
var eInvoiceConfig = getEInvoiceConfig(company.co);
|
|
19493
19503
|
var eInvoiceTaxLabel = document.eInvoicing && eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
|
|
19494
|
-
var displayTaxName1 = document.tn
|
|
19495
|
-
var displayTaxName2 = document.tn2
|
|
19504
|
+
var displayTaxName1 = getCustomLabel(document.tn, company.tn, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1);
|
|
19505
|
+
var displayTaxName2 = getCustomLabel(document.tn2, company.tn2, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2);
|
|
19496
19506
|
var timeZone = company.tz;
|
|
19497
19507
|
var formatDate = function formatDate(date) {
|
|
19498
19508
|
return getFormatDate({
|
|
@@ -19520,7 +19530,7 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
|
|
|
19520
19530
|
});
|
|
19521
19531
|
var effectiveCurrency = document.currency || company.cr;
|
|
19522
19532
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
19523
|
-
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
19533
|
+
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(document, company, defaultLang);
|
|
19524
19534
|
var shippingBreakdown = getShippingTaxBreakdown(document, effectiveCurrency, showShippingTaxBreakdown, calculationOptions);
|
|
19525
19535
|
var formatAmount = function formatAmount(amount) {
|
|
19526
19536
|
return FormatCurrency$7(amount, effectiveCurrency, company.la, company.cf);
|
|
@@ -19947,7 +19957,7 @@ var InvoiceCompat = function InvoiceCompat(doc) {
|
|
|
19947
19957
|
};
|
|
19948
19958
|
var TemplateCompat = function TemplateCompat(template) {
|
|
19949
19959
|
if (template == null) return null;
|
|
19950
|
-
var mapping = new Map([["billTo", "r_bt"], ["shipTo", "r_st"], ["item", "r_it"], ["quantity", "r_q"], ["price", "r_p"], ["amount", "r_a"], ["date", "r_d"], ["dueDate", "r_dd"], ["
|
|
19960
|
+
var mapping = new Map([["billTo", "r_bt"], ["shipTo", "r_st"], ["item", "r_it"], ["quantity", "r_q"], ["price", "r_p"], ["amount", "r_a"], ["date", "r_d"], ["dueDate", "r_dd"], ["purchaseOrder", "r_po"], ["shipping", "r_sp"], ["included", "r_ic"], ["subtotal", "r_sb"], ["net", "r_n"], ["total", "r_tt"], ["amountDue", "r_ad"], ["grandTotal", "r_gt"], ["payInt", "r_pi"], ["note", "r_nt"], ["Tos", "r_tc"], ["bySigning", "r_bs"]]);
|
|
19951
19961
|
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
19952
19962
|
var k = _ref5[0],
|
|
19953
19963
|
v = _ref5[1];
|
|
@@ -20857,8 +20867,8 @@ var TaxTable = function TaxTable(_ref) {
|
|
|
20857
20867
|
if (!(document !== null && document !== void 0 && document.it)) {
|
|
20858
20868
|
return '';
|
|
20859
20869
|
}
|
|
20860
|
-
var taxName1 = document.tn;
|
|
20861
|
-
var taxTable = html$C(_templateObject$E || (_templateObject$E = _taggedTemplateLiteralLoose(["\n <div>", "</div>\n <div class=\"tax-table-wrapper mt-2 mb-5\">\n <table class=\"tax-table table table-sm\">\n <thead>\n <tr>\n <th>", "</th>\n <th>", "</th>\n <th>", "</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td style=\"border-top: none;\">\n ", "%", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n </tr>\n <tr>\n <td>\n ", "", "%", "\n </td>\n <td>\n ", "\n </td>\n <td>\n ", "\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n "])), defaultLang['reduced_tax_description'], defaultLang['tax_rate_category'], taxName1
|
|
20870
|
+
var taxName1 = getCustomLabel(document.tn, company === null || company === void 0 ? void 0 : company.tn, defaultLang['consumption_tax']);
|
|
20871
|
+
var taxTable = html$C(_templateObject$E || (_templateObject$E = _taggedTemplateLiteralLoose(["\n <div>", "</div>\n <div class=\"tax-table-wrapper mt-2 mb-5\">\n <table class=\"tax-table table table-sm\">\n <thead>\n <tr>\n <th>", "</th>\n <th>", "</th>\n <th>", "</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td style=\"border-top: none;\">\n ", "%", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n </tr>\n <tr>\n <td>\n ", "", "%", "\n </td>\n <td>\n ", "\n </td>\n <td>\n ", "\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n "])), defaultLang['reduced_tax_description'], defaultLang['tax_rate_category'], taxName1, defaultLang['amount_of_tax'], document.tp, defaultLang['tax_subject'], FormatCurrencyJP(document.tx, company.cr, company.la, company.cf), FormatCurrencyJP(document.tax1BaseAmount || 0, company.cr, company.la, company.cf), defaultLang['reduced'], document.tp2, defaultLang['tax_subject'], FormatCurrencyJP(document.tx2, company.cr, company.la, company.cf), FormatCurrencyJP(document.tax2BaseAmount || 0, company.cr, company.la, company.cf));
|
|
20862
20872
|
return taxTable;
|
|
20863
20873
|
};
|
|
20864
20874
|
|