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