@bookipi/htmlgenerator 1.1.6 → 1.1.9
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/bootstrap.min.css +7 -0
- package/dist/index.js +224 -175
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +224 -175
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import moment from 'moment-timezone';
|
|
2
|
+
import bootstrapCss from '!!raw-loader!bootstrap/dist/css/bootstrap.min.css';
|
|
3
|
+
import fontAwesomeCss from '!!raw-loader!font-awesome/css/font-awesome.min.css';
|
|
2
4
|
|
|
3
5
|
function _extends() {
|
|
4
6
|
_extends = Object.assign || function (target) {
|
|
@@ -1654,172 +1656,7 @@ var nl2br = function nl2br(str, is_xhtml) {
|
|
|
1654
1656
|
return (str + "").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1" + breakTag + "$2");
|
|
1655
1657
|
};
|
|
1656
1658
|
|
|
1657
|
-
var
|
|
1658
|
-
var invoice = _ref.invoice,
|
|
1659
|
-
lang = _ref.lang,
|
|
1660
|
-
referral = _ref.referral,
|
|
1661
|
-
_ref$companyLogoBase = _ref.companyLogoBase,
|
|
1662
|
-
companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase;
|
|
1663
|
-
var company = invoice.company;
|
|
1664
|
-
var document = invoice.document;
|
|
1665
|
-
var logoBase64 = invoice.logoBase64;
|
|
1666
|
-
var attachments = invoice.attachments || [];
|
|
1667
|
-
var customerSignBase64 = invoice.customerSignBase64;
|
|
1668
|
-
var signatureBase64 = invoice.signatureBase64;
|
|
1669
|
-
var logoPath = invoice.logoPath || company.lg && "" + companyLogoBase + company._id + "/logo.jpg?" + new Date().getTime();
|
|
1670
|
-
var documentName = null;
|
|
1671
|
-
|
|
1672
|
-
if (company.doc && company.doc[document.ty] && company.doc[document.ty].n) {
|
|
1673
|
-
documentName = company.doc[document.ty].n;
|
|
1674
|
-
} else {
|
|
1675
|
-
if (document.ty === 1) {
|
|
1676
|
-
documentName = company.r_inv ? company.r_inv : lang['document'];
|
|
1677
|
-
} else if (document.ty === 2) {
|
|
1678
|
-
documentName = company.r_crd ? company.r_crd : lang['creditnote'];
|
|
1679
|
-
} else {
|
|
1680
|
-
documentName = company.r_est ? company.r_est : lang['Estimate'];
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
var logoContainer = null;
|
|
1685
|
-
|
|
1686
|
-
if (logoPath) {
|
|
1687
|
-
logoContainer = "<img src=\"" + logoPath + "\" id=\"invoice-logo\" class=\"img-fluid\" style=\"padding-top: 10px;width: " + (company.ls ? company.ls * 1.8 + 'px' : '250px') + ";height:auto;\">";
|
|
1688
|
-
} else if (logoBase64) {
|
|
1689
|
-
logoContainer = "<img\n src=\"" + logoBase64 + "\"\n id='invoice-logo'\n className='img-fluid'\n style=\"width:" + (company.ls * 2 || 200) + "px, height: 'auto'\"\n />";
|
|
1690
|
-
} else {
|
|
1691
|
-
logoContainer = " <h1>" + company.c + " </h1>";
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
var timeZone = company.tz;
|
|
1695
|
-
|
|
1696
|
-
var formatDate = function formatDate(date) {
|
|
1697
|
-
var d = moment(date);
|
|
1698
|
-
|
|
1699
|
-
if (timeZone) {
|
|
1700
|
-
d = d.tz(timeZone);
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
return d.format(company.df === 0 ? 'D MMM YYYY' : company.df === 1 ? 'DD/MM/YYYY' : company.df === 3 ? 'MM/D/YYYY' : company.df === 4 ? 'YYYY/MM/DD' : 'MMM D, YYYY');
|
|
1704
|
-
};
|
|
1705
|
-
|
|
1706
|
-
var companyAddress = {
|
|
1707
|
-
address1: company && (company.address && company.address.address1 || company.address1) || null,
|
|
1708
|
-
address2: company && (company.address && company.address.address2 || company.address2) || null,
|
|
1709
|
-
address3: company && (company.address && company.address.address3 || company.address3) || null,
|
|
1710
|
-
city: company && company.address && company.address.city || null,
|
|
1711
|
-
state: company && company.address && company.address.state || null,
|
|
1712
|
-
zip: company && company.address && company.address.zip || null,
|
|
1713
|
-
country: company && company.address && company.address.country || null
|
|
1714
|
-
};
|
|
1715
|
-
var customer = document.cu;
|
|
1716
|
-
var customerAddress = customer.address || {};
|
|
1717
|
-
var customerShippingAddress = customer.shippingAddress || {};
|
|
1718
|
-
var shippingAddressExists = customerShippingAddress.address1 || customerShippingAddress.address2 || customerShippingAddress.address3 || customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip || document.asi;
|
|
1719
|
-
var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
|
|
1720
|
-
var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
|
|
1721
|
-
var discountOnItem = false;
|
|
1722
|
-
|
|
1723
|
-
if (document.it) {
|
|
1724
|
-
for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
|
|
1725
|
-
var item = _step.value;
|
|
1726
|
-
|
|
1727
|
-
if (item.dc && item.dc > 0) {
|
|
1728
|
-
discountOnItem = true;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
if (taxPercent1 > 0 && item.tx) {
|
|
1732
|
-
if (document.ti && !document.t1d) {
|
|
1733
|
-
var totalTaxRate = void 0;
|
|
1734
|
-
|
|
1735
|
-
if (document.ttx && !document.t2d) {
|
|
1736
|
-
totalTaxRate = taxPercent1 + taxPercent2;
|
|
1737
|
-
} else {
|
|
1738
|
-
totalTaxRate = taxPercent1;
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
item.taxAmount1 = item.t * (1 - 1 / (1 + totalTaxRate / 100)) * (taxPercent1 / totalTaxRate);
|
|
1742
|
-
} else {
|
|
1743
|
-
item.taxAmount1 = item.t * taxPercent1 / 100;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
if (document.ttx && taxPercent2 > 0 && item.tx2) {
|
|
1748
|
-
if (document.ti && !document.t2d) {
|
|
1749
|
-
var _totalTaxRate = taxPercent1 + taxPercent2;
|
|
1750
|
-
|
|
1751
|
-
item.taxAmount2 = item.t * (1 - 1 / (1 + _totalTaxRate / 100)) * (taxPercent2 / _totalTaxRate);
|
|
1752
|
-
} else {
|
|
1753
|
-
item.taxAmount2 = item.t * taxPercent2 / 100;
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
var itemsContainer = '';
|
|
1760
|
-
|
|
1761
|
-
if (document.it) {
|
|
1762
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
|
|
1763
|
-
var _item = _step2.value;
|
|
1764
|
-
itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (_item.n || "") + "</strong></span>\n <div><small>" + (nl2br(_item.dsc) || "") + "</small></div>\n <div class=\"d-block d-sm-none mt-1\">\n " + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? FormatCurrency(_item.p, company.cr, company.la, company.cf) + " \u2715 " + _item.q : '') + "\n " + (discountOnItem && (_item.p || _item.p == 0) && _item.dc ? (_item.dc > 0 ? " - " : " + ") + FormatCurrency(Math.abs(_item.dc), company.cr, company.la, company.cf) : "") + "\n </div>\n</td>\n<td class=\"text-center d-none d-sm-table-cell\">" + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? _item.q : "") + "</td>\n<td class=\"text-right d-none d-sm-table-cell\">\n" + (_item.p || _item.p == 0 ? FormatCurrency(_item.p, company.cr, company.la, company.cf) : "") + "\n</td>\n" + (discountOnItem ? "<td class=\"text-right\">" + ((_item.p || _item.p == 0) && _item.dc ? FormatCurrency(_item.dc, company.cr, company.la, company.cf) : "") + "</td>" : '') + "\n<td class=\"text-right\">" + (_item.p || _item.p == 0 ? FormatCurrency(_item.t, company.cr, company.la, company.cf) : "") + "</td>\n</tr>");
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
var taxName1;
|
|
1769
|
-
var taxIncluded1;
|
|
1770
|
-
var taxName2;
|
|
1771
|
-
var taxIncluded2;
|
|
1772
|
-
|
|
1773
|
-
if (document.tx != 0) {
|
|
1774
|
-
taxName1 = document.tn ? document.tn : 'Tax';
|
|
1775
|
-
taxIncluded1 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
if (document.ttx && document.tx2 != 0) {
|
|
1779
|
-
taxName2 = document.tn2 ? document.tn2 : 'Tax 2';
|
|
1780
|
-
taxIncluded2 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
function payment_on(date, brand, endNumber) {
|
|
1784
|
-
if (brand && endNumber) {
|
|
1785
|
-
return 'Paid on ' + date + ' using ' + brand + ' ending in ' + endNumber;
|
|
1786
|
-
} else if (brand && !endNumber) {
|
|
1787
|
-
return 'Paid on ' + date + ' using ' + brand;
|
|
1788
|
-
} else {
|
|
1789
|
-
return 'Paid on ' + date;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
var paymentContainer = '';
|
|
1794
|
-
|
|
1795
|
-
if (document.pm) {
|
|
1796
|
-
for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
|
|
1797
|
-
var payment = _step3.value;
|
|
1798
|
-
paymentContainer = paymentContainer + ("<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (lang.payment_on ? lang.payment_on(formatDate(payment.d), payment.b) : payment_on(formatDate(payment.d), payment.b)) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(payment.a, company.cr, company.la, company.cf) + "</td>\n </tr>");
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
|
|
1803
|
-
var attachmentContainer = '';
|
|
1804
|
-
|
|
1805
|
-
if (attachments) {
|
|
1806
|
-
for (var i = 0; i < attachments.length; i++) {
|
|
1807
|
-
attachmentContainer = attachmentContainer + ("<div class=\"mt-5\">\n <img src=\"" + attachments[i].imageUrl + "\" style=\"max-width:100%\"/>\n <div><strong>" + attachments[i].t + "</strong></div>\n <div>" + attachments[i].d + "</div>\n </div>");
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
var signatureContainer = document.sd && "\n <div class=\"col-6\" style=\"text-align: center\">\n <strong>" + (document.cs || customerSignBase64 ? company.c : "") + "</strong>\n <div style=\"height:130px;border-bottom:2px solid #dee2e6; margin-right:40px; margin-left:40px\">\n " + (signatureBase64 && "<img src=" + signatureBase64 + " style=\"width:220px;margin-top:20px;\" />" || "") + "\n </div>\n <div>" + (document.sd ? formatDate(document.sd) : "") + "</div>\n </div>" || "";
|
|
1812
|
-
var clientSignature = (document.cs || customerSignBase64) && "\n <div class=\"col-6\" style=\"text-align: center\">\n <strong>" + document.cu.c + "</strong>\n <div style=\"height:130px;border-bottom:2px solid #dee2e6; margin-right:40px; margin-left:40px\">\n " + (customerSignBase64 && "<img src=" + customerSignBase64 + " style=\"width:220px;margin-top:20px;\" />" || "") + "\n </div>\n <div>" + (customerSignBase64 ? formatDate(new Date()) : "(   /  /  )") + "</div>\n </div>" || "";
|
|
1813
|
-
var html = "\n<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <title>Invoice</title>\n <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css\" integrity=\"sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh\" crossorigin=\"anonymous\">\n <link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n </head>\n <style>\n body {\n font-size: 18px;\n }\n .invoice-body {\n background: #fff;\n padding: 50px\n }\n\n .invoice-company {\n font-size: 20px\n }\n\n .invoice-header {\n /* margin: 0 -50px; */\n background: #f0f3f4;\n padding: 30px 50px;\n }\n .invoice-content {\n padding: 38px;\n }\n .invoice-date,\n .invoice-from,\n .invoice-to {\n /* display: table-cell; */\n /* width: 1% */\n }\n\n .invoice-from,\n .invoice-to {\n padding-right: 20px\n }\n\n .invoice-date .date,\n .invoice-from strong,\n .invoice-to strong {\n font-size: 18px;\n font-weight: 600\n }\n\n .invoice-date {\n /* text-align: right; */\n padding-left: 20px\n }\n\n .invoice-price {\n /* background: #f0f3f4; */\n display: table;\n width: 100%\n }\n\n .invoice-price .invoice-price-left,\n .invoice-price .invoice-price-right {\n display: table-cell;\n padding: 28px 12px 16px;\n font-size: 20px;\n font-weight: 600;\n width: 70%;\n position: relative;\n vertical-align: middle\n }\n\n .invoice-price .invoice-price-left .sub-price {\n display: table-cell;\n vertical-align: middle;\n padding: 0 20px\n }\n\n .invoice-price small {\n font-size: 18px;\n font-weight: 400;\n display: block\n }\n\n .invoice-price .invoice-price-row {\n display: table;\n float: left\n }\n\n .invoice-price .invoice-price-right {\n width: 30%;\n background: #2d353c;\n color: #fff;\n font-size: 28px;\n text-align: right;\n vertical-align: bottom;\n font-weight: 300;\n right: 38px;\n }\n\n .invoice-price .invoice-price-right small {\n display: block;\n opacity: .7;\n position: absolute;\n top: 10px;\n left: 12px;\n font-size: 18px\n }\n\n .invoice-footer {\n border-top: 1px solid #ddd;\n padding-top: 10px;\n font-size: 18px\n }\n\n .invoice-note {\n color: #999;\n margin-top: 80px;\n font-size: 85%\n }\n\n .invoice-body > div:not(.invoice-footer) {\n margin-bottom: 20px\n }\n\n .btn.btn-white, .btn.btn-white.disabled, .btn.btn-white.disabled:focus, .btn.btn-white.disabled:hover, .btn.btn-white[disabled], .btn.btn-white[disabled]:focus, .btn.btn-white[disabled]:hover {\n color: #2d353c;\n background: #fff;\n border-color: #d9dfe3;\n }\n .table-inline-block{\n display: inline-block;\n }\n\n @media print {\n body, page {\n /* width: 21cm; */\n /* margin: 0; */\n box-shadow: 0;\n background-color: #fff\n }\n /* .invoice-body {\n padding:10;\n } */\n #invoice {\n width:100%\n }\n\n .invoice-price .invoice-price-right {\n background: #f0f3f4;\n color: black;\n border: 2px solid #f0f3f4;\n }\n }\n\n @media only screen {\n #invoice {\n margin-top:10px;\n max-width:28cm;\n zoom: 0.8;\n box-shadow: 0 0 0.5cm rgba(0,0,0,0.2);\n margin-right:auto;margin-left:auto;\n background: white;\n }\n }\n\n @media (min-width: 767.99px) {\n .invoice-detail-right {\n max-width: 200px;\n }\n }\n @media (max-width: 767.98px) {\n .invoice-body {\n padding: 30px\n }\n .invoice-header {\n padding: 20px 30px;\n }\n .invoice-content {\n padding: 18px;\n }\n .invoice-price .invoice-price-right {\n right: 18px;\n }\n #invoice-logo {\n padding-top:0;\n max-width: 250px;\n text-align: center;\n margin-right:auto;\n margin-left:auto;\n display: block;\n }\n .invoice-date {\n margin-top:10px;\n border-top: 1px solid #dee2e6;\n }\n }\n\n .table-small td{\n padding: 8px 12px\n }\n .table-invoice-header{\n background: #f0f3f4\n }\n h1,h2,h3,h4 {margin-top:15px}\n h1 {font-size:27px}\n h2 {font-size:22px}\n </style>\n <body>\n <div id=\"invoice\" class=\"print\">\n <div class=\"invoice-body\">\n <!-- begin invoice-company -->\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-6 mb-3 mb-md-0\">\n " + logoContainer + "\n </div>\n <div class=\"col-sm-12 col-md-6 text-md-right\">\n <h1>" + documentName + "</h1>\n <div class=\"text-inverse mb-1\" style=\"font-size: 20px;\">\n <strong>" + company.c + "</strong>\n </div>\n <address class=\"m-t-5 m-b-5\">\n <div class=\"mb-2\">\n " + (companyAddress.address1 ? "<div>" + companyAddress.address1 + "</div>" : "") + "\n " + (companyAddress.address2 ? "<div>" + companyAddress.address2 + "</div>" : "") + "\n " + (companyAddress.address3 ? "<div>" + companyAddress.address3 + "</div>" : "") + "\n " + (companyAddress.city || companyAddress.state || companyAddress.zip ? "<div>" + ((companyAddress.city ? companyAddress.city + " " : "") + (companyAddress.state ? companyAddress.state + " " : "") + (companyAddress.zip ? companyAddress.zip + " " : "")) + "</div>" : "") + "\n " + (companyAddress.country ? "<div>" + companyAddress.country + "</div>" : "") + "\n </div>\n " + (company.ai ? "<div>" + company.ai + "</div>" : "") + "\n " + (company.ph ? "<div>" + company.ph + "</div>" : "") + "\n " + (company.de ? "<div>" + company.de + "</div>" : "") + "\n " + (company.tfn ? "<div>" + ((company.bn ? company.bn : "Tax no.") + " : " + company.tfn) + "</div>" : "") + "\n </address>\n </div>\n </div>\n </div>\n <!-- end invoice-company -->\n <!-- begin invoice-header -->\n <div class=\"invoice-header\">\n <div class=\"row\">\n <div class=\"invoice-to col-sm-12 col-md-6\">\n <strong>" + (company.r_bt ? company.r_bt : lang["bill_to"]) + "</strong>\n <div class=\"text-inverse mb-1\">\n <small style=\"font-size: 18px;\">" + document.cu.c + "</small>\n </div>\n <address class=\"m-t-5 m-b-5\">\n " + (customerAddress.address1 ? "<div>" + customerAddress.address1 + "</div>" : "") + "\n " + (customerAddress.address2 ? "<div>" + customerAddress.address2 + "</div>" : "") + "\n " + (customerAddress.address3 ? "<div>" + customerAddress.address3 + "</div>" : "") + "\n " + (customerAddress.city || customerAddress.state || customerAddress.zip ? "<div>" + ((customerAddress.city ? customerAddress.city + " " : "") + (customerAddress.state ? customerAddress.state + " " : "") + (customerAddress.zip ? customerAddress.zip + " " : "")) + "</div>" : "") + "\n " + (customerAddress.country ? "<div>" + customerAddress.country + "</div>" : "") + "\n " + (document.cu.tfn ? "<div>" + (document.cu.tfn ? (company.bn || "Tax no.") + " : " + document.cu.tfn : "") + "</div>" : "") + "\n " + (document.cu.ph ? "<div>" + document.cu.ph + "</div>" : "") + "\n </address>\n\n " + (shippingAddressExists ? "<strong stryle=\"margin-top:10px\">" + (company.r_st ? company.r_st : lang.ship_to) + "</strong>" : "") + "\n " + (shippingAddressExists ? "\n <address class=\"m-t-5 m-b-5\">\n " + (customerShippingAddress.address1 ? "<div>" + customerShippingAddress.address1 + "</div>" : "") + "\n " + (customerShippingAddress.address2 ? "<div>" + customerShippingAddress.address2 + "</div>" : "") + "\n " + (customerShippingAddress.address3 ? "<div>" + customerShippingAddress.address3 + "</div>" : "") + "\n " + (customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip ? "<div>" + ((customerShippingAddress.city ? customerShippingAddress.city + " " : "") + (customerShippingAddress.state ? customerShippingAddress.state + " " : "") + (customerShippingAddress.zip ? customerShippingAddress.zip + " " : "")) + "</div>" : "") + "\n " + (customerShippingAddress.country ? "<div>" + customerShippingAddress.country + "</div>" : "") + "\n " + (document.asi ? "<div>" + document.asi + "</div>" : "") + "\n </address>\n " : "") + "\n </div>\n\n <div class=\"invoice-date col-sm-12 col-md-6\">\n <small> </small>\n <div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + documentName + " #</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + (document.no ? document.no : "") + "</div>\n </div>\n <div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_d ? company.r_d : lang["date"]) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + formatDate(document.d) + "</div>\n </div>\n " + (document.ty == 1 && !document.rd ? "<div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_dd ? company.r_dd : lang["due_date"]) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">\n " + (document.dd ? formatDate(document.dd) : formatDate(new Date(document.d).setDate(new Date(document.d).getDate() + parseInt(document.di)))) + "\n </div>\n </div>" : '') + "\n " + (document.pon ? "<div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_po ? company.r_po : lang['po_number']) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + document.pon + "</div>\n </div>\n " : '') + "\n </div>\n </div>\n </div>\n <!-- end invoice-header -->\n <!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table class=\"table table-invoice\">\n <thead>\n <tr class=\"table table-invoice\">\n <th class=\"text-left\">" + (company.r_it ? company.r_it : lang['item']) + "</th>\n <th class=\"text-center d-none d-sm-table-cell\" width=\"15%\">" + (document.um ? document.um : company.r_q ? company.r_q : lang['quantity']) + "</th>\n <th class=\"text-right d-none d-sm-table-cell\" width=\"15%\">" + (company.r_p ? company.r_p : lang['price']) + "</th>\n " + (discountOnItem ? "<th class=\"text-right\" width=\"15%\">" + (company.r_dc ? company.r_dc : lang['discount']) + "</th>" : '') + "\n <th class=\"text-right\" width=\"15%\">" + (company.r_a ? company.r_a : lang['amount']) + "</th>\n </tr>\n </thead>\n <tbody>\n " + itemsContainer + "\n </tbody>\n </table>\n </div>\n \n <hr>\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sb ? company.r_sb : lang["subtotal"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.st, company.cr, company.la, company.cf) + "</td>\n </tr>\n " + (document.dc ? " <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + ((company.r_dc ? company.r_dc : lang["discount"]) + (document.dcpo && document.dcp ? " (" + document.dcp + "%)" : "")) + "</td>\n <td class=\"text-right\" width=\"25%\">" + ("(" + FormatCurrency(document.dc, company.cr, company.la, company.cf) + ")") + "</td>\n </tr>" : '') + "\n " + (document.sp && !document.sntx ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sp ? company.r_sp : lang["shipping"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sp, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.tx != 0 ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (taxName1 + taxIncluded1 + "(" + document.tp + "%)") + "</td>\n <td class=\"text-right\" width=\"25%\">" + ((document.t1d ? "(" : "") + FormatCurrency(document.tx, company.cr, company.la, company.cf) + (document.t1d ? ")" : "")) + "</td>\n </tr>" : '') + "\n " + (document.ttx && document.tx2 != 0 ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (taxName2 + taxIncluded2 + "(" + document.tp2 + "%)") + "</td>\n <td class=\"text-right\" width=\"25%\">" + ((document.t2d ? "(" : "") + FormatCurrency(document.tx2, company.cr, company.la, company.cf) + (document.t2d ? ")" : "")) + "</td>\n </tr>" : '') + "\n " + (document.sp && document.sntx ? " <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sp ? company.r_sp : lang["shipping"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sp, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.ti ? " <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\" style=\"border-top: 1px solid #ddd\">" + (company.r_n ? company.r_n : lang["net"]) + "</td>\n <td class=\"text-right\" width=\"25%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency(document.tt - (document.tx || 0) - (document.tx2 || 0), company.cr, company.la, company.cd) + "</td>\n </tr>" : '') + "\n " + (document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\" style=\"border-bottom: 1px solid #ddd\">" + (company.r_tt ? company.r_tt : lang["total"]) + "</td>\n <td class=\"text-right\" width=\"25%\" style=\"border-bottom: 1px solid #ddd\">" + FormatCurrency(document.tt ? document.tt : 0, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.sca ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + lang["credit_card_surcharge"] + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sca, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.ty == 1 && document.pma && document.pm ? paymentContainer : '') + "\n </tbody>\n </table>\n </div>\n </div>\n </div>\n <!-- end invoice-content -->\n\n <!-- begin invoice price -->\n <div class=\"invoice-price\">\n <div class=\"invoice-price-left\">\n <div class=\"invoice-price-row\"></div>\n </div>\n <div class=\"invoice-price-right\">\n <small>" + (document.ty == 1 ? company.r_ad ? company.r_ad : lang["amount_due"] : company.r_gt ? company.r_gt : lang["grand_total"]) + "</small>\n <span class=\"f-w-600\">" + FormatCurrency(document.ad, company.cr, company.la, company.cf) + "</span>\n </div>\n </div>\n <!-- end invoice price -->\n\n <div class=\"invoice-body\">\n <!-- begin payment-instruction -->\n " + (paymentOn ? "<h2>" + (company.r_pi ? company.r_pi : lang['payment_instruction']) + "</h2>" : "") + "\n " + (paymentOn && company.p1 ? company.p1 + "<br>" : "") + "\n " + (paymentOn && company.p2 ? company.p2 + "<br>" : "") + "\n " + (paymentOn && company.p3 ? company.p3 + "<br>" : "") + "\n <!-- end payment-instruction -->\n\n <!-- begin invoice-note -->\n " + (document.noteHtml ? "<div class=\"mt-4\">\n " + document.noteHtml + "\n </div>" : (document.nt ? "<div class=\"mt-4\">\n <h2>" + (company.r_nt ? company.r_nt : lang["note"]) + "</h2>\n " + nl2br(document.nt) + "\n </div>" : '') + "\n " + (document.tc ? "<div class=\"mt-4\">\n <h2>" + (company.r_tc ? company.r_tc : lang["terms"]) + "</h2>\n " + nl2br(document.tc) + "\n </div>" : '')) + "\n <!-- end invoice-note -->\n \n <!--- begin company signature -->\n <!-- begin invoice-signature -->\n " + (document.sd || document.cs || customerSignBase64 ? "<hr class=\"mt-5\">\n <div>" + (company.r_bs || lang['by_signing'] || "") + "</div>\n <div class=\"row mt-4\">\n " + (signatureContainer || clientSignature || "") + "\n " + (signatureContainer && clientSignature || "") + "\n </div>" : '') + "\n <!-- end invoice-signature-->\n\n <!-- begin invoice attachments -->\n\n " + (attachments && attachments.length > 0 ? "<div style=\"text-align: center\">\n " + attachmentContainer + "\n </div>" : '') + "\n <!-- end invoice attachment -->\n </div>\n </body>\n\n " + (referral ? "<div style=\"text-align:center;color:rgb(108, 108, 108);font-size:16px;padding:10px\">\n <div style=\"font-size:14px;padding:10px\">" + lang["try_bookipi"] + "</div>\n <div style=\"text-align:center;font-size:12px\">\n <a href=\"" + referral + "\"><img src=\"https://s3.amazonaws.com/bookipi.com/img/appstore-btn-130.png\"/></a>\n <a href=\"" + referral + "\"><img src=\"https://s3.amazonaws.com/bookipi.com/img/googleplay-btn-130.png\"/></a>\n </div>\n </div>" : '') + "\n</html>\n";
|
|
1814
|
-
return {
|
|
1815
|
-
html: html,
|
|
1816
|
-
timeZone: timeZone,
|
|
1817
|
-
formatDate: formatDate,
|
|
1818
|
-
documentName: documentName
|
|
1819
|
-
};
|
|
1820
|
-
});
|
|
1821
|
-
|
|
1822
|
-
var defaultLang = {
|
|
1659
|
+
var defaultLang$1 = {
|
|
1823
1660
|
terms: "Terms and conditions",
|
|
1824
1661
|
privacy: "Privacy Policy",
|
|
1825
1662
|
firstname: "First Name",
|
|
@@ -2201,18 +2038,225 @@ var defaultLang = {
|
|
|
2201
2038
|
search_item: "Search item"
|
|
2202
2039
|
};
|
|
2203
2040
|
|
|
2041
|
+
var invoiceTemplate = (function (_ref) {
|
|
2042
|
+
var company = _ref.company,
|
|
2043
|
+
document = _ref.document,
|
|
2044
|
+
logoBase64 = _ref.logoBase64,
|
|
2045
|
+
attachments = _ref.attachments,
|
|
2046
|
+
customerSignBase64 = _ref.customerSignBase64,
|
|
2047
|
+
signatureBase64 = _ref.signatureBase64,
|
|
2048
|
+
logoPath = _ref.logoPath,
|
|
2049
|
+
companyAddress = _ref.companyAddress,
|
|
2050
|
+
taxName1 = _ref.taxName1,
|
|
2051
|
+
taxIncluded1 = _ref.taxIncluded1,
|
|
2052
|
+
taxName2 = _ref.taxName2,
|
|
2053
|
+
taxIncluded2 = _ref.taxIncluded2,
|
|
2054
|
+
customerAddress = _ref.customerAddress,
|
|
2055
|
+
customerShippingAddress = _ref.customerShippingAddress,
|
|
2056
|
+
shippingAddressExists = _ref.shippingAddressExists,
|
|
2057
|
+
_ref$lang = _ref.lang,
|
|
2058
|
+
lang = _ref$lang === void 0 ? defaultLang : _ref$lang,
|
|
2059
|
+
documentName = _ref.documentName,
|
|
2060
|
+
_ref$isDeposit = _ref.isDeposit,
|
|
2061
|
+
isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit,
|
|
2062
|
+
formatDate = _ref.formatDate,
|
|
2063
|
+
discountOnItem = _ref.discountOnItem,
|
|
2064
|
+
paymentOn = _ref.paymentOn,
|
|
2065
|
+
_ref$isOffline = _ref.isOffline,
|
|
2066
|
+
isOffline = _ref$isOffline === void 0 ? false : _ref$isOffline;
|
|
2067
|
+
|
|
2068
|
+
var signatureContainer = document.sd && "\n <div class=\"col-6\" style=\"text-align: center\">\n <strong>" + (document.cs || customerSignBase64 ? company.c : "") + "</strong>\n <div style=\"height:130px;border-bottom:2px solid #dee2e6; margin-right:40px; margin-left:40px\">\n " + (signatureBase64 && "<img src=" + signatureBase64 + " style=\"width:220px;margin-top:20px;\" />" || "") + "\n </div>\n <div>" + (document.sd ? formatDate(document.sd) : "") + "</div>\n </div>" || "";
|
|
2069
|
+
var clientSignature = (document.cs || customerSignBase64) && "\n <div class=\"col-6\" style=\"text-align: center\">\n <strong>" + document.cu.c + "</strong>\n <div style=\"height:130px;border-bottom:2px solid #dee2e6; margin-right:40px; margin-left:40px\">\n " + (customerSignBase64 && "<img src=" + customerSignBase64 + " style=\"width:220px;margin-top:20px;\" />" || "") + "\n </div>\n <div>" + (customerSignBase64 ? formatDate(new Date()) : "(   /  /  )") + "</div>\n </div>" || "";
|
|
2070
|
+
var logoContainer = null;
|
|
2071
|
+
|
|
2072
|
+
if (logoPath) {
|
|
2073
|
+
logoContainer = "<img src=\"" + logoPath + "\" id=\"invoice-logo\" class=\"img-fluid\" style=\"padding-top: 10px;width: " + (company.ls ? company.ls * 1.8 + 'px' : '250px') + ";height:auto;\">";
|
|
2074
|
+
} else if (logoBase64) {
|
|
2075
|
+
logoContainer = "<img\n src=\"" + logoBase64 + "\"\n id='invoice-logo'\n className='img-fluid'\n style=\"width:" + (company.ls * 2 || 200) + "px, height: 'auto'\"\n />";
|
|
2076
|
+
} else {
|
|
2077
|
+
logoContainer = " <h1>" + company.c + " </h1>";
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
var itemsContainer = '';
|
|
2081
|
+
|
|
2082
|
+
if (document.it) {
|
|
2083
|
+
for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
|
|
2084
|
+
var item = _step.value;
|
|
2085
|
+
itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (item.n || "") + "</strong></span>\n <div><small>" + (nl2br(item.dsc) || "") + "</small></div>\n <div class=\"d-block d-sm-none mt-1\">\n " + ((item.p || item.p == 0) && (item.q || item.q == 0) ? FormatCurrency(item.p, company.cr, company.la, company.cf) + " \u2715 " + item.q : '') + "\n " + (discountOnItem && (item.p || item.p == 0) && item.dc ? (item.dc > 0 ? " - " : " + ") + FormatCurrency(Math.abs(item.dc), company.cr, company.la, company.cf) : "") + "\n </div>\n</td>\n<td class=\"text-center d-none d-sm-table-cell\">" + ((item.p || item.p == 0) && (item.q || item.q == 0) ? item.q : "") + "</td>\n<td class=\"text-right d-none d-sm-table-cell\">\n" + (item.p || item.p == 0 ? FormatCurrency(item.p, company.cr, company.la, company.cf) : "") + "\n</td>\n" + (discountOnItem ? "<td class=\"text-right\">" + ((item.p || item.p == 0) && item.dc ? FormatCurrency(item.dc, company.cr, company.la, company.cf) : "") + "</td>" : '') + "\n<td class=\"text-right\">" + (item.p || item.p == 0 ? FormatCurrency(item.t, company.cr, company.la, company.cf) : "") + "</td>\n</tr>");
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
var numOfRowsPaymentInstruction = (1 + (document.dc ? 1 : 0) + (document.sp && !document.sntx ? 1 : 0) + (document.tx != 0 ? 1 : 0) + (document.ttx && document.tx2 != 0 ? 1 : 0) + (document.sp && document.sntx ? 1 : 0) + (document.ti ? 1 : 0) + (document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? 1 : 0) + (document.sca ? 1 : 0)).toString();
|
|
2090
|
+
var paymentInstructionDetails = "\n" + (paymentOn ? "<h2 style=\"margin-top: 0; font-size: 18px; font-weight: 700;\">" + (company.r_pi ? company.r_pi : lang['payment_instruction']) + "</h2>" : "") + "\n" + (paymentOn && company.p1 ? company.p1 + "<br>" : "") + "\n" + (paymentOn && company.p2 ? company.p2 + "<br>" : "") + "\n" + (paymentOn && company.p3 ? company.p3 + "<br>" : "") + "\n";
|
|
2091
|
+
var html = "\n<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <title>Invoice</title>\n " + (!isOffline ? " <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css\" integrity=\"sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh\" crossorigin=\"anonymous\">\n <link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">" : "<style>" + bootstrapCss + "</style><style>" + fontAwesomeCss + "</style>") + "\n </head>\n <style>\n body {\n font-size: 18px;\n }\n .invoice-body {\n background: #fff;\n padding: 25px 50px;\n }\n\n .invoice-company {\n font-size: 20px\n }\n\n .invoice-header {\n /* margin: 0 -50px; */\n background: #f0f3f4;\n padding: 25px 50px;\n }\n .invoice-content {\n padding: 20px 38px 10px;\n }\n .invoice-date,\n .invoice-from,\n .invoice-to {\n /* display: table-cell; */\n /* width: 1% */\n }\n\n .table td, .table th {\n padding: .50rem .75rem;\n }\n\n .invoice-from,\n .invoice-to {\n padding-right: 20px\n }\n\n .invoice-date .date,\n .invoice-from strong,\n .invoice-to strong {\n font-size: 18px;\n font-weight: 600\n }\n\n .invoice-date {\n /* text-align: right; */\n padding-left: 20px\n }\n\n .invoice-price {\n /* background: #f0f3f4; */\n display: table;\n width: 100%\n }\n\n .invoice-price .invoice-price-left,\n .invoice-price .invoice-price-right {\n display: table-cell;\n padding: 28px 12px 16px;\n font-size: 20px;\n font-weight: 600;\n width: 70%;\n position: relative;\n vertical-align: middle\n }\n\n .invoice-price .invoice-price-left .sub-price {\n display: table-cell;\n vertical-align: middle;\n padding: 0 20px\n }\n\n .invoice-price small {\n font-size: 18px;\n font-weight: 400;\n display: block\n }\n\n .invoice-price .invoice-price-row {\n display: table;\n float: left\n }\n\n .invoice-price .invoice-price-right {\n width: 30%;\n background: #2d353c;\n color: #fff;\n font-size: 28px;\n text-align: right;\n vertical-align: bottom;\n font-weight: 300;\n right: 38px;\n }\n\n .invoice-price .invoice-price-right small {\n display: block;\n opacity: .7;\n position: absolute;\n top: 10px;\n left: 12px;\n font-size: 18px\n }\n\n .invoice-footer {\n border-top: 1px solid #ddd;\n padding-top: 10px;\n font-size: 18px\n }\n\n .invoice-note {\n color: #999;\n margin-top: 80px;\n font-size: 85%\n }\n\n companyAddress,\n taxName1,\n taxIncluded1,\n taxName2,\n taxIncluded2,\n\n customerAddress,\n customerShippingAddress,\n shippingAddressExists,\n\n lang,\n referral,\n\n @media (min-width: 767.99px) {\n .invoice-detail-right {\n max-width: 200px;\n }\n }\n @media (max-width: 767.98px) {\n .invoice-body {\n padding: 30px\n }\n .invoice-header {\n padding: 20px 30px;\n }\n .invoice-content {\n padding: 18px;\n }\n .invoice-price .invoice-price-right {\n right: 18px;\n }\n #invoice-logo {\n padding-top:0;\n max-width: 250px;\n text-align: center;\n margin-right:auto;\n margin-left:auto;\n display: block;\n }\n .invoice-date {\n margin-top:10px;\n border-top: 1px solid #dee2e6;\n }\n }\n\n .table-small td{\n padding: 8px 12px\n }\n .table-invoice-header{\n background: #f0f3f4\n }\n h1,h2,h3,h4 {margin-top:15px}\n h1 {font-size:27px}\n h2 {font-size:22px}\n </style>\n <body>\n <div id=\"invoice\" class=\"print\">\n <div class=\"invoice-body\">\n <!-- begin invoice-company -->\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-6 mb-3 mb-md-0\">\n " + logoContainer + "\n </div>\n <div class=\"col-sm-12 col-md-6 text-md-right\">\n <h1>" + documentName + "</h1>\n <div class=\"text-inverse mb-1\" style=\"font-size: 20px;\">\n <strong>" + company.c + "</strong>\n </div>\n <address class=\"m-t-5 m-b-5\">\n <div class=\"mb-2\">\n " + (companyAddress.address1 ? "<div>" + companyAddress.address1 + "</div>" : "") + "\n " + (companyAddress.address2 ? "<div>" + companyAddress.address2 + "</div>" : "") + "\n " + (companyAddress.address3 ? "<div>" + companyAddress.address3 + "</div>" : "") + "\n " + (companyAddress.city || companyAddress.state || companyAddress.zip ? "<div>" + ((companyAddress.city ? companyAddress.city + " " : "") + (companyAddress.state ? companyAddress.state + " " : "") + (companyAddress.zip ? companyAddress.zip + " " : "")) + "</div>" : "") + "\n " + (companyAddress.country ? "<div>" + companyAddress.country + "</div>" : "") + "\n </div>\n " + (company.ai ? "<div>" + company.ai + "</div>" : "") + "\n " + (company.ph ? "<div>" + company.ph + "</div>" : "") + "\n " + (company.de ? "<div>" + company.de + "</div>" : "") + "\n " + (company.tfn ? "<div>" + ((company.bn ? company.bn : "Tax no.") + " : " + company.tfn) + "</div>" : "") + "\n </address>\n </div>\n </div>\n </div>\n <!-- end invoice-company -->\n <!-- begin invoice-header -->\n <div class=\"invoice-header\">\n <div class=\"row\">\n <div class=\"invoice-to col-sm-12 col-md-6\">\n <strong>" + (company.r_bt ? company.r_bt : lang["bill_to"]) + "</strong>\n <div class=\"text-inverse mb-1\">\n <small style=\"font-size: 18px;\">" + document.cu.c + "</small>\n </div>\n <address class=\"m-t-5 m-b-5\">\n " + (customerAddress.address1 ? "<div>" + customerAddress.address1 + "</div>" : "") + "\n " + (customerAddress.address2 ? "<div>" + customerAddress.address2 + "</div>" : "") + "\n " + (customerAddress.address3 ? "<div>" + customerAddress.address3 + "</div>" : "") + "\n " + (customerAddress.city || customerAddress.state || customerAddress.zip ? "<div>" + ((customerAddress.city ? customerAddress.city + " " : "") + (customerAddress.state ? customerAddress.state + " " : "") + (customerAddress.zip ? customerAddress.zip + " " : "")) + "</div>" : "") + "\n " + (customerAddress.country ? "<div>" + customerAddress.country + "</div>" : "") + "\n " + (document.cu.tfn ? "<div>" + (document.cu.tfn ? (company.bn || "Tax no.") + " : " + document.cu.tfn : "") + "</div>" : "") + "\n " + (document.cu.ph ? "<div>" + document.cu.ph + "</div>" : "") + "\n </address>\n\n " + (shippingAddressExists ? "<strong stryle=\"margin-top:10px\">" + (company.r_st ? company.r_st : lang.ship_to) + "</strong>" : "") + "\n " + (shippingAddressExists ? "\n <address class=\"m-t-5 m-b-5\">\n " + (customerShippingAddress.address1 ? "<div>" + customerShippingAddress.address1 + "</div>" : "") + "\n " + (customerShippingAddress.address2 ? "<div>" + customerShippingAddress.address2 + "</div>" : "") + "\n " + (customerShippingAddress.address3 ? "<div>" + customerShippingAddress.address3 + "</div>" : "") + "\n " + (customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip ? "<div>" + ((customerShippingAddress.city ? customerShippingAddress.city + " " : "") + (customerShippingAddress.state ? customerShippingAddress.state + " " : "") + (customerShippingAddress.zip ? customerShippingAddress.zip + " " : "")) + "</div>" : "") + "\n " + (customerShippingAddress.country ? "<div>" + customerShippingAddress.country + "</div>" : "") + "\n " + (document.asi ? "<div>" + document.asi + "</div>" : "") + "\n </address>\n " : "") + "\n </div>\n\n <div class=\"invoice-date col-sm-12 col-md-6\">\n <div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + documentName + " #</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + (document.no ? document.no : "") + "</div>\n </div>\n <div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_d ? company.r_d : lang["date"]) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + formatDate(document.d) + "</div>\n </div>\n " + (document.ty == 1 && !document.rd ? "<div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_dd ? company.r_dd : lang["due_date"]) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">\n " + (document.dd ? formatDate(document.dd) : formatDate(new Date(document.d).setDate(new Date(document.d).getDate() + parseInt(document.di)))) + "\n </div>\n </div>" : '') + "\n " + (document.pon ? "<div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_po ? company.r_po : lang['po_number']) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + document.pon + "</div>\n </div>\n " : '') + "\n </div>\n </div>\n </div>\n <!-- end invoice-header -->\n <!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table class=\"table table-invoice\">\n <thead>\n <tr class=\"table table-invoice\">\n <th class=\"text-left\">" + (company.r_it ? company.r_it : lang['item']) + "</th>\n <th class=\"text-center d-none d-sm-table-cell\" width=\"15%\">" + (document.um ? document.um : company.r_q ? company.r_q : lang['quantity']) + "</th>\n <th class=\"text-right d-none d-sm-table-cell\" width=\"15%\">" + (company.r_p ? company.r_p : lang['price']) + "</th>\n " + (discountOnItem ? "<th class=\"text-right\" width=\"15%\">" + (company.r_dc ? company.r_dc : lang['discount']) + "</th>" : '') + "\n <th class=\"text-right\" width=\"15%\">" + (company.r_a ? company.r_a : lang['amount']) + "</th>\n </tr>\n </thead>\n <tbody>\n " + itemsContainer + "\n </tbody>\n </table>\n </div>\n \n <hr>\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-sm-table-cell\" rowspan=\"" + numOfRowsPaymentInstruction + "\">\n " + (paymentOn ? paymentInstructionDetails : "") + "\n </td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sb ? company.r_sb : lang["subtotal"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.st, company.cr, company.la, company.cf) + "</td>\n </tr>\n " + (document.dc ? "<tr>\n <td class=\"text-md-right\" width=\"25%\">" + ((company.r_dc ? company.r_dc : lang["discount"]) + (document.dcpo && document.dcp ? " (" + document.dcp + "%)" : "")) + "</td>\n <td class=\"text-right\" width=\"25%\">" + ("(" + FormatCurrency(document.dc, company.cr, company.la, company.cf) + ")") + "</td>\n </tr>" : '') + "\n " + (document.sp && !document.sntx ? "<tr>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sp ? company.r_sp : lang["shipping"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sp, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.tx != 0 ? "<tr>\n <td class=\"text-md-right\" width=\"25%\">" + (taxName1 + taxIncluded1 + "(" + document.tp + "%)") + "</td>\n <td class=\"text-right\" width=\"25%\">" + ((document.t1d ? "(" : "") + FormatCurrency(document.tx, company.cr, company.la, company.cf) + (document.t1d ? ")" : "")) + "</td>\n </tr>" : '') + "\n " + (document.ttx && document.tx2 != 0 ? "<tr>\n <td class=\"text-md-right\" width=\"25%\">" + (taxName2 + taxIncluded2 + "(" + document.tp2 + "%)") + "</td>\n <td class=\"text-right\" width=\"25%\">" + ((document.t2d ? "(" : "") + FormatCurrency(document.tx2, company.cr, company.la, company.cf) + (document.t2d ? ")" : "")) + "</td>\n </tr>" : '') + "\n " + (document.sp && document.sntx ? "<tr>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sp ? company.r_sp : lang["shipping"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sp, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.ti ? "<tr>\n <td class=\"text-md-right\" width=\"25%\" style=\"border-top: 1px solid #ddd\">" + (company.r_n ? company.r_n : lang["net"]) + "</td>\n <td class=\"text-right\" width=\"25%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency(document.tt - (document.tx || 0) - (document.tx2 || 0), company.cr, company.la, company.cd) + "</td>\n </tr>" : '') + "\n " + (document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td class=\"text-md-right\" width=\"25%\" style=\"border-bottom: 1px solid #ddd\">" + (company.r_tt ? company.r_tt : lang["total"]) + "</td>\n <td class=\"text-right\" width=\"25%\" style=\"border-bottom: 1px solid #ddd\">" + FormatCurrency(document.tt ? document.tt : 0, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.sca ? "<tr>\n <td class=\"text-md-right\" width=\"25%\">" + lang["credit_card_surcharge"] + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sca, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.ty == 1 && document.pma && document.pm ? paymentContainer : '') + "\n </tbody>\n </table>\n </div>\n </div>\n </div>\n <!-- end invoice-content -->\n\n <!-- begin invoice price -->\n <div class=\"invoice-price\">\n <div class=\"invoice-price-left\">\n <div class=\"invoice-price-row\"></div>\n </div>\n <div class=\"invoice-price-right\">\n <small>" + (document.ty == 1 ? company.r_ad ? company.r_ad : lang["amount_due"] : company.r_gt ? company.r_gt : lang["grand_total"]) + "</small>\n <span class=\"f-w-600\">" + (isDeposit ? FormatCurrency(document.depositAmount, company.cr, company.la, company.cf) : FormatCurrency(document.ad, company.cr, company.la, company.cf)) + "</span>\n </div>\n </div>\n <!-- end invoice price -->\n\n <div class=\"invoice-body\">\n <!-- begin payment-instruction -->\n " + (paymentOn ? "\n <div class=\"d-block d-sm-none\">" + paymentInstructionDetails + "</div>\n " : "") + "\n <!-- end payment-instruction -->\n\n <!-- begin invoice-note -->\n " + (document.noteHtml ? "<div class=\"mt-1\">\n " + document.noteHtml + "\n </div>" : (document.nt ? "<div class=\"mt-1\">\n <h2>" + (company.r_nt ? company.r_nt : lang["note"]) + "</h2>\n " + nl2br(document.nt) + "\n </div>" : '') + "\n " + (document.tc ? "<div class=\"mt-1\">\n <h2>" + (company.r_tc ? company.r_tc : lang["terms"]) + "</h2>\n " + nl2br(document.tc) + "\n </div>" : '')) + "\n <!-- end invoice-note -->\n \n <!--- begin company signature -->\n <!-- begin invoice-signature -->\n " + (document.sd || document.cs || customerSignBase64 ? "<hr class=\"mt-1\">\n <div>" + (company.r_bs || lang['by_signing'] || "") + "</div>\n <div class=\"row mt-1\">\n " + (signatureContainer || clientSignature || "") + "\n " + (signatureContainer && clientSignature || "") + "\n </div>" : '') + "\n <!-- end invoice-signature-->\n\n <!-- begin invoice attachments -->\n\n " + (attachments && attachments.length > 0 ? "<div style=\"text-align: center\">\n " + attachmentContainer + "\n </div>" : '') + "\n <!-- end invoice attachment -->\n </div>\n </body>\n</html>\n";
|
|
2092
|
+
return html;
|
|
2093
|
+
});
|
|
2094
|
+
|
|
2095
|
+
var invoiceHtmlWithDetails = (function (_ref) {
|
|
2096
|
+
var invoice = _ref.invoice,
|
|
2097
|
+
_ref$lang = _ref.lang,
|
|
2098
|
+
lang = _ref$lang === void 0 ? defaultLang$1 : _ref$lang,
|
|
2099
|
+
referral = _ref.referral,
|
|
2100
|
+
_ref$companyLogoBase = _ref.companyLogoBase,
|
|
2101
|
+
companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase,
|
|
2102
|
+
_ref$isDeposit = _ref.isDeposit,
|
|
2103
|
+
isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit,
|
|
2104
|
+
_ref$isOffline = _ref.isOffline,
|
|
2105
|
+
isOffline = _ref$isOffline === void 0 ? false : _ref$isOffline;
|
|
2106
|
+
var company = invoice.company;
|
|
2107
|
+
var document = invoice.document;
|
|
2108
|
+
var logoBase64 = invoice.logoBase64;
|
|
2109
|
+
var attachments = invoice.attachments || [];
|
|
2110
|
+
var customerSignBase64 = invoice.customerSignBase64;
|
|
2111
|
+
var signatureBase64 = invoice.signatureBase64;
|
|
2112
|
+
var logoPath = invoice.logoPath || company.lg && "" + companyLogoBase + company._id + "/logo.jpg?" + new Date().getTime();
|
|
2113
|
+
var documentName = null;
|
|
2114
|
+
|
|
2115
|
+
if (company.doc && company.doc[document.ty] && company.doc[document.ty].n) {
|
|
2116
|
+
documentName = company.doc[document.ty].n;
|
|
2117
|
+
} else {
|
|
2118
|
+
if (document.ty === 1) {
|
|
2119
|
+
documentName = company.r_inv ? company.r_inv : lang['document'];
|
|
2120
|
+
} else if (document.ty === 2) {
|
|
2121
|
+
documentName = company.r_crd ? company.r_crd : lang['creditnote'];
|
|
2122
|
+
} else {
|
|
2123
|
+
documentName = company.r_est ? company.r_est : lang['Estimate'];
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
var timeZone = company.tz;
|
|
2128
|
+
|
|
2129
|
+
var formatDate = function formatDate(date) {
|
|
2130
|
+
var d = moment(date);
|
|
2131
|
+
|
|
2132
|
+
if (timeZone) {
|
|
2133
|
+
d = d.tz(timeZone);
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
return d.format(company.df === 0 ? 'D MMM YYYY' : company.df === 1 ? 'DD/MM/YYYY' : company.df === 3 ? 'MM/D/YYYY' : company.df === 4 ? 'YYYY/MM/DD' : 'MMM D, YYYY');
|
|
2137
|
+
};
|
|
2138
|
+
|
|
2139
|
+
var companyAddress = {
|
|
2140
|
+
address1: company && (company.address && company.address.address1 || company.address1) || null,
|
|
2141
|
+
address2: company && (company.address && company.address.address2 || company.address2) || null,
|
|
2142
|
+
address3: company && (company.address && company.address.address3 || company.address3) || null,
|
|
2143
|
+
city: company && company.address && company.address.city || null,
|
|
2144
|
+
state: company && company.address && company.address.state || null,
|
|
2145
|
+
zip: company && company.address && company.address.zip || null,
|
|
2146
|
+
country: company && company.address && company.address.country || null
|
|
2147
|
+
};
|
|
2148
|
+
var customer = document.cu;
|
|
2149
|
+
var customerAddress = customer.address || {};
|
|
2150
|
+
var customerShippingAddress = customer.shippingAddress || {};
|
|
2151
|
+
var shippingAddressExists = customerShippingAddress.address1 || customerShippingAddress.address2 || customerShippingAddress.address3 || customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip || document.asi;
|
|
2152
|
+
var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
|
|
2153
|
+
var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
|
|
2154
|
+
var discountOnItem = false;
|
|
2155
|
+
|
|
2156
|
+
if (document.it) {
|
|
2157
|
+
for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
|
|
2158
|
+
var item = _step.value;
|
|
2159
|
+
|
|
2160
|
+
if (item.dc && item.dc > 0) {
|
|
2161
|
+
discountOnItem = true;
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
if (taxPercent1 > 0 && item.tx) {
|
|
2165
|
+
if (document.ti && !document.t1d) {
|
|
2166
|
+
var totalTaxRate = void 0;
|
|
2167
|
+
|
|
2168
|
+
if (document.ttx && !document.t2d) {
|
|
2169
|
+
totalTaxRate = taxPercent1 + taxPercent2;
|
|
2170
|
+
} else {
|
|
2171
|
+
totalTaxRate = taxPercent1;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
item.taxAmount1 = item.t * (1 - 1 / (1 + totalTaxRate / 100)) * (taxPercent1 / totalTaxRate);
|
|
2175
|
+
} else {
|
|
2176
|
+
item.taxAmount1 = item.t * taxPercent1 / 100;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
if (document.ttx && taxPercent2 > 0 && item.tx2) {
|
|
2181
|
+
if (document.ti && !document.t2d) {
|
|
2182
|
+
var _totalTaxRate = taxPercent1 + taxPercent2;
|
|
2183
|
+
|
|
2184
|
+
item.taxAmount2 = item.t * (1 - 1 / (1 + _totalTaxRate / 100)) * (taxPercent2 / _totalTaxRate);
|
|
2185
|
+
} else {
|
|
2186
|
+
item.taxAmount2 = item.t * taxPercent2 / 100;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
var taxName1;
|
|
2193
|
+
var taxIncluded1;
|
|
2194
|
+
var taxName2;
|
|
2195
|
+
var taxIncluded2;
|
|
2196
|
+
|
|
2197
|
+
if (document.tx != 0) {
|
|
2198
|
+
taxName1 = document.tn ? document.tn : 'Tax';
|
|
2199
|
+
taxIncluded1 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
if (document.ttx && document.tx2 != 0) {
|
|
2203
|
+
taxName2 = document.tn2 ? document.tn2 : 'Tax 2';
|
|
2204
|
+
taxIncluded2 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
|
|
2208
|
+
var html = invoiceTemplate({
|
|
2209
|
+
company: company,
|
|
2210
|
+
document: document,
|
|
2211
|
+
logoBase64: logoBase64,
|
|
2212
|
+
attachments: attachments,
|
|
2213
|
+
customerSignBase64: customerSignBase64,
|
|
2214
|
+
signatureBase64: signatureBase64,
|
|
2215
|
+
logoPath: logoPath,
|
|
2216
|
+
companyAddress: companyAddress,
|
|
2217
|
+
taxName1: taxName1,
|
|
2218
|
+
taxIncluded1: taxIncluded1,
|
|
2219
|
+
taxName2: taxName2,
|
|
2220
|
+
taxIncluded2: taxIncluded2,
|
|
2221
|
+
customerAddress: customerAddress,
|
|
2222
|
+
customerShippingAddress: customerShippingAddress,
|
|
2223
|
+
shippingAddressExists: shippingAddressExists,
|
|
2224
|
+
lang: lang,
|
|
2225
|
+
referral: referral,
|
|
2226
|
+
documentName: documentName,
|
|
2227
|
+
isDeposit: isDeposit,
|
|
2228
|
+
timeZone: timeZone,
|
|
2229
|
+
formatDate: formatDate,
|
|
2230
|
+
discountOnItem: discountOnItem,
|
|
2231
|
+
paymentOn: paymentOn,
|
|
2232
|
+
isOffline: isOffline
|
|
2233
|
+
});
|
|
2234
|
+
return {
|
|
2235
|
+
html: html,
|
|
2236
|
+
timeZone: timeZone,
|
|
2237
|
+
formatDate: formatDate,
|
|
2238
|
+
documentName: documentName
|
|
2239
|
+
};
|
|
2240
|
+
});
|
|
2241
|
+
|
|
2204
2242
|
var invoiceHtml = (function (_ref) {
|
|
2205
2243
|
var invoice = _ref.invoice,
|
|
2206
2244
|
_ref$lang = _ref.lang,
|
|
2207
|
-
lang = _ref$lang === void 0 ? defaultLang : _ref$lang,
|
|
2245
|
+
lang = _ref$lang === void 0 ? defaultLang$1 : _ref$lang,
|
|
2208
2246
|
referral = _ref.referral,
|
|
2209
2247
|
_ref$companyLogoBase = _ref.companyLogoBase,
|
|
2210
|
-
companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase
|
|
2248
|
+
companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase,
|
|
2249
|
+
_ref$isDeposit = _ref.isDeposit,
|
|
2250
|
+
isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit,
|
|
2251
|
+
_ref$isOffline = _ref.isOffline,
|
|
2252
|
+
isOffline = _ref$isOffline === void 0 ? false : _ref$isOffline;
|
|
2211
2253
|
return invoiceHtmlWithDetails({
|
|
2212
2254
|
invoice: invoice,
|
|
2213
2255
|
lang: lang,
|
|
2214
2256
|
referral: referral,
|
|
2215
|
-
companyLogoBase: companyLogoBase
|
|
2257
|
+
companyLogoBase: companyLogoBase,
|
|
2258
|
+
isDeposit: isDeposit,
|
|
2259
|
+
isOffline: isOffline
|
|
2216
2260
|
}).html;
|
|
2217
2261
|
});
|
|
2218
2262
|
|
|
@@ -2376,17 +2420,22 @@ var CompanyCompat = function CompanyCompat(doc) {
|
|
|
2376
2420
|
return newCompany;
|
|
2377
2421
|
};
|
|
2378
2422
|
|
|
2379
|
-
var InvoiceCompatHtml = function InvoiceCompatHtml(
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2423
|
+
var InvoiceCompatHtml = function InvoiceCompatHtml(_ref) {
|
|
2424
|
+
var invoice = _ref.invoice,
|
|
2425
|
+
_ref$lang = _ref.lang,
|
|
2426
|
+
lang = _ref$lang === void 0 ? defaultLang$1 : _ref$lang,
|
|
2427
|
+
_ref$isDeposit = _ref.isDeposit,
|
|
2428
|
+
isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit,
|
|
2429
|
+
_ref$isOffline = _ref.isOffline,
|
|
2430
|
+
isOffline = _ref$isOffline === void 0 ? false : _ref$isOffline;
|
|
2384
2431
|
return invoiceHtml({
|
|
2385
2432
|
invoice: _extends({}, invoice, {
|
|
2386
2433
|
document: InvoiceCompat(invoice.document),
|
|
2387
2434
|
company: CompanyCompat(invoice.company)
|
|
2388
2435
|
}),
|
|
2389
|
-
lang: lang
|
|
2436
|
+
lang: lang,
|
|
2437
|
+
isDeposit: isDeposit,
|
|
2438
|
+
isOffline: isOffline
|
|
2390
2439
|
});
|
|
2391
2440
|
};
|
|
2392
2441
|
|