@bookipi/htmlgenerator 1.12.0-alpha8 → 1.12.0-alpha9
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 +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +18 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -11836,6 +11836,11 @@ var util = {
|
|
|
11836
11836
|
parseCurrencyString: parseCurrencyString,
|
|
11837
11837
|
formatterBuilder: formatterBuilder
|
|
11838
11838
|
};
|
|
11839
|
+
|
|
11840
|
+
var index = {
|
|
11841
|
+
currencies: currencies,
|
|
11842
|
+
numberFormat: numberFormat
|
|
11843
|
+
};
|
|
11839
11844
|
//# sourceMappingURL=index.modern.js.map
|
|
11840
11845
|
|
|
11841
11846
|
var TWO_DECIMAL_TOLERANCE = 0.01;
|
|
@@ -11891,6 +11896,12 @@ var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(company, defaultLang) {
|
|
|
11891
11896
|
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';
|
|
11892
11897
|
};
|
|
11893
11898
|
|
|
11899
|
+
var currencies$1 = index.currencies;
|
|
11900
|
+
var roundNumber$1 = function roundNumber(number, scale) {
|
|
11901
|
+
var multiplier = Math.pow(10, scale);
|
|
11902
|
+
return Math.round((number + Number.EPSILON) * multiplier) / multiplier;
|
|
11903
|
+
};
|
|
11904
|
+
|
|
11894
11905
|
var checkHasShippingTaxRate = function checkHasShippingTaxRate(document) {
|
|
11895
11906
|
return document.shippingTaxRate != null && document.shippingTaxRate !== '';
|
|
11896
11907
|
};
|
|
@@ -11935,16 +11946,19 @@ var computeItemTaxes = function computeItemTaxes(document) {
|
|
|
11935
11946
|
itemTax2: itemTax2
|
|
11936
11947
|
};
|
|
11937
11948
|
};
|
|
11938
|
-
var getShippingTaxBreakdown = function getShippingTaxBreakdown(document) {
|
|
11949
|
+
var getShippingTaxBreakdown = function getShippingTaxBreakdown(document, currencyCode) {
|
|
11939
11950
|
var hasShippingTaxRate = checkHasShippingTaxRate(document);
|
|
11940
11951
|
var shippingTaxRate = hasShippingTaxRate ? parseFloat(document.shippingTaxRate) : 0;
|
|
11941
|
-
var shippingTax = computeShippingTax(document);
|
|
11942
11952
|
var shipping = document.sp ? parseFloat(document.sp) : 0;
|
|
11943
11953
|
var tax1 = document.tx ? parseFloat(document.tx) : 0;
|
|
11944
11954
|
var tax2 = document.tx2 ? parseFloat(document.tx2) : 0;
|
|
11945
11955
|
var _computeItemTaxes = computeItemTaxes(document),
|
|
11946
11956
|
itemTax1 = _computeItemTaxes.itemTax1,
|
|
11947
11957
|
itemTax2 = _computeItemTaxes.itemTax2;
|
|
11958
|
+
var _ref = currencies$1[currencyCode] || currencies$1.USD,
|
|
11959
|
+
decimal_digits = _ref.decimal_digits;
|
|
11960
|
+
var shippingTax = computeShippingTax(document);
|
|
11961
|
+
shippingTax = roundNumber$1(shippingTax, decimal_digits);
|
|
11948
11962
|
var shippingMatchesTax1 = hasShippingTaxRate && shippingTaxRate > 0 && !document.sntx && shippingTaxRate === parseFloat(document.tp || 0) && tax1 > 0;
|
|
11949
11963
|
var shippingMatchesTax2 = hasShippingTaxRate && shippingTaxRate > 0 && !document.sntx && !!document.ttx && shippingTaxRate === parseFloat(document.tp2 || 0) && tax2 > 0 && !shippingMatchesTax1;
|
|
11950
11964
|
var shippingFoldedIn = !hasShippingTaxRate && !!shipping && !document.sntx;
|
|
@@ -12100,7 +12114,7 @@ var InvoiceContent = function InvoiceContent(_ref) {
|
|
|
12100
12114
|
var effectiveCurrency = document.currency || company.cr;
|
|
12101
12115
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
12102
12116
|
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
12103
|
-
var shippingBreakdown = getShippingTaxBreakdown(document);
|
|
12117
|
+
var shippingBreakdown = getShippingTaxBreakdown(document, effectiveCurrency);
|
|
12104
12118
|
var formatAmount = function formatAmount(amount) {
|
|
12105
12119
|
return FormatCurrency$3(amount, effectiveCurrency, company.la, company.cf);
|
|
12106
12120
|
};
|
|
@@ -12948,7 +12962,7 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
|
|
|
12948
12962
|
var effectiveCurrency = document.currency || company.cr;
|
|
12949
12963
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
12950
12964
|
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
12951
|
-
var shippingBreakdown = getShippingTaxBreakdown(document);
|
|
12965
|
+
var shippingBreakdown = getShippingTaxBreakdown(document, effectiveCurrency);
|
|
12952
12966
|
var formatAmount = function formatAmount(amount) {
|
|
12953
12967
|
return FormatCurrency$7(amount, effectiveCurrency, company.la, company.cf);
|
|
12954
12968
|
};
|