@bookipi/htmlgenerator 1.1.31-alpha1 → 1.1.31-alpha3

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 CHANGED
@@ -207,6 +207,15 @@ var currencies = {
207
207
  code: "BOB",
208
208
  name_plural: "Bolivian bolivianos"
209
209
  },
210
+ BSD: {
211
+ symbol: "B$",
212
+ name: "Bahamian Dollar",
213
+ symbol_native: "B$",
214
+ decimal_digits: 2,
215
+ rounding: 0,
216
+ code: "BSD",
217
+ name_plural: "Bahamian dollar"
218
+ },
210
219
  BRL: {
211
220
  symbol: "R$",
212
221
  name: "Brazilian Real",
@@ -1595,8 +1604,7 @@ var roundNumber = function roundNumber(num, scale) {
1595
1604
  var multiplier = Math.pow(10, scale);
1596
1605
  return Math.round((num + Number.EPSILON) * multiplier) / multiplier;
1597
1606
  };
1598
-
1599
- function formatMoney(num, c, d, t, forcePositive) {
1607
+ var formatMoney = function formatMoney(num, c, d, t, forcePositive) {
1600
1608
  if (forcePositive === void 0) {
1601
1609
  forcePositive = false;
1602
1610
  }
@@ -1617,8 +1625,7 @@ function formatMoney(num, c, d, t, forcePositive) {
1617
1625
 
1618
1626
  return ret;
1619
1627
  }(c, d, t);
1620
- }
1621
-
1628
+ };
1622
1629
  var FormatCurrencyDetails = function FormatCurrencyDetails(value, currency, lang, cFormat, rtl, removeDecimal, showLongSymbol, options) {
1623
1630
  if (options === void 0) {
1624
1631
  options = {
@@ -1720,7 +1727,6 @@ var FormatCurrencyDetails = function FormatCurrencyDetails(value, currency, lang
1720
1727
  symbol: symbol
1721
1728
  };
1722
1729
  };
1723
-
1724
1730
  var currencyFormat = function currencyFormat(value, currency, lang, cFormat, rtl, removeDecimal, showLongSymbol, options) {
1725
1731
  if (options === void 0) {
1726
1732
  options = {
@@ -1730,7 +1736,6 @@ var currencyFormat = function currencyFormat(value, currency, lang, cFormat, rtl
1730
1736
 
1731
1737
  return FormatCurrencyDetails(value, currency, lang, cFormat, rtl, removeDecimal, showLongSymbol, options).str;
1732
1738
  };
1733
-
1734
1739
  var FormatCurrencyNumber = function FormatCurrencyNumber(value, currency) {
1735
1740
  var currencyName = currency || "USD";
1736
1741
 
@@ -1763,6 +1768,8 @@ var getSafe = function getSafe(accessor) {
1763
1768
  };
1764
1769
 
1765
1770
  var util = {
1771
+ currencyFormat: currencyFormat,
1772
+ formatMoney: formatMoney,
1766
1773
  getSafe: getSafe,
1767
1774
  FormatCurrency: FormatCurrency,
1768
1775
  FormatCurrencyInPdf: FormatCurrencyInPdf,
@@ -9684,7 +9691,7 @@ var invoiceHtmlWithDetails = (function (_ref) {
9684
9691
  if (document.it) {
9685
9692
  for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
9686
9693
  var _item = _step2.value;
9687
- itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (_item.n || "") + "</strong></span>\n " + (_item.pc ? "<div class=\"text-inverse\">" + _item.pc + "</div>" : "") + "\n <div class=\"mt-2\">" + (nl2br(_item.dsc) || "") + "</div>\n <div class=\"d-block d-md-none mt-1\">\n " + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? FormatCurrency$1(_item.p, company.cr, company.la, company.cf, {
9694
+ itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (_item.n || "") + "</strong></span>\n " + (_item.productCode ? "<div class=\"text-inverse\">" + _item.productCode + "</div>" : "") + "\n <div class=\"mt-2\">" + (nl2br(_item.dsc) || "") + "</div>\n <div class=\"d-block d-md-none mt-1\">\n " + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? FormatCurrency$1(_item.p, company.cr, company.la, company.cf, {
9688
9695
  forceDecimal: forceItemUnitPriceDecimal
9689
9696
  }) + " ✕ " + (_item.q || "0") : "") + "\n " + (discountOnItem && (_item.p || _item.p == 0) && _item.dc ? "" + (_item.dc > 0 ? " - " : " + ") + FormatCurrency$1(Math.abs(_item.dc), company.cr, company.la, company.cf, {
9690
9697
  forceDecimal: forceItemUnitPriceDecimal
@@ -9986,7 +9993,7 @@ var invoiceHtmlWithDetailsAsync = (function (_ref) {
9986
9993
  if (document.it) {
9987
9994
  for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
9988
9995
  var _item = _step2.value;
9989
- itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (_item.n || "") + "</strong></span>\n <div>" + (nl2br(_item.dsc) || "") + "</div>\n <div class=\"d-block d-md-none mt-1\">\n " + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? FormatCurrency$2(_item.p, company.cr, company.la, company.cf, {
9996
+ itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (_item.n || "") + "</strong></span>\n " + (_item.productCode ? "<div class=\"text-inverse\">" + _item.productCode + "</div>" : "") + "\n <div>" + (nl2br(_item.dsc) || "") + "</div>\n <div class=\"d-block d-md-none mt-1\">\n " + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? FormatCurrency$2(_item.p, company.cr, company.la, company.cf, {
9990
9997
  forceDecimal: forceItemUnitPriceDecimal
9991
9998
  }) + " ✕ " + (_item.q || "0") : "") + "\n " + (discountOnItem && (_item.p || _item.p == 0) && _item.dc ? "" + (_item.dc > 0 ? " - " : " + ") + FormatCurrency$2(Math.abs(_item.dc), company.cr, company.la, company.cf, {
9992
9999
  forceDecimal: forceItemUnitPriceDecimal
@@ -10012,11 +10019,9 @@ var invoiceHtmlWithDetailsAsync = (function (_ref) {
10012
10019
  for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
10013
10020
  var payment = _step3.value;
10014
10021
  paymentContainer = paymentContainer + ("<tr>\n <td class=\"text-md-right\" width=\"22%\">" + t("payment_on.date", {
10015
- date: date
10022
+ date: formatDate(payment.d)
10016
10023
  }) + ("" + (payment.b ? t("payment_on.brand", {
10017
10024
  brand: formatCardBrand(payment.b)
10018
- }) : "") + (endNumber && payment.b ? t("payment_on.endNumber", {
10019
- endNumber: endNumber
10020
10025
  }) : "")) + "</td>\n <td class=\"text-right\" width=\"22%\">" + FormatCurrency$2(payment.a, company.cr, company.la, company.cf) + "</td>\n </tr>");
10021
10026
  }
10022
10027
  }
@@ -10141,7 +10146,7 @@ var invoiceHtmlAsync = function invoiceHtmlAsync(_ref2) {
10141
10146
  var docTypeMapping = new Map([[0, "estimate"], [1, "invoice"], [2, "credit_note"], [3, "delivery_note"], [4, "purchase_order"], ["estimate", 0], ["invoice", 1], ["credit_note", 2], ["delivery_note", 3], ["purchase_order", 4]]);
10142
10147
  var ItemCompat = function ItemCompat(item) {
10143
10148
  if (item == null) return null;
10144
- var mapping = new Map([["name", "n"], ["productCode", "pc"], ["description", "dsc"], ["price", "p"], ["quantity", "q"], ["tax", "tx"], ["tax2", "tx2"], ["discount", "dc"], ["total", "t"]]);
10149
+ var mapping = new Map([["name", "n"], ["productCode", "productCode"], ["description", "dsc"], ["price", "p"], ["quantity", "q"], ["tax", "tx"], ["tax2", "tx2"], ["discount", "dc"], ["total", "t"]]);
10145
10150
  return Object.fromEntries(Object.entries(item).map(function (_ref) {
10146
10151
  var k = _ref[0],
10147
10152
  v = _ref[1];