@bookipi/htmlgenerator 1.1.6 → 1.1.7

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
@@ -1656,171 +1656,6 @@ var nl2br = function nl2br(str, is_xhtml) {
1656
1656
  return (str + "").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1" + breakTag + "$2");
1657
1657
  };
1658
1658
 
1659
- var invoiceHtmlWithDetails = (function (_ref) {
1660
- var invoice = _ref.invoice,
1661
- lang = _ref.lang,
1662
- referral = _ref.referral,
1663
- _ref$companyLogoBase = _ref.companyLogoBase,
1664
- companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase;
1665
- var company = invoice.company;
1666
- var document = invoice.document;
1667
- var logoBase64 = invoice.logoBase64;
1668
- var attachments = invoice.attachments || [];
1669
- var customerSignBase64 = invoice.customerSignBase64;
1670
- var signatureBase64 = invoice.signatureBase64;
1671
- var logoPath = invoice.logoPath || company.lg && "" + companyLogoBase + company._id + "/logo.jpg?" + new Date().getTime();
1672
- var documentName = null;
1673
-
1674
- if (company.doc && company.doc[document.ty] && company.doc[document.ty].n) {
1675
- documentName = company.doc[document.ty].n;
1676
- } else {
1677
- if (document.ty === 1) {
1678
- documentName = company.r_inv ? company.r_inv : lang['document'];
1679
- } else if (document.ty === 2) {
1680
- documentName = company.r_crd ? company.r_crd : lang['creditnote'];
1681
- } else {
1682
- documentName = company.r_est ? company.r_est : lang['Estimate'];
1683
- }
1684
- }
1685
-
1686
- var logoContainer = null;
1687
-
1688
- if (logoPath) {
1689
- 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;\">";
1690
- } else if (logoBase64) {
1691
- logoContainer = "<img\n src=\"" + logoBase64 + "\"\n id='invoice-logo'\n className='img-fluid'\n style=\"width:" + (company.ls * 2 || 200) + "px, height: 'auto'\"\n />";
1692
- } else {
1693
- logoContainer = " <h1>" + company.c + " </h1>";
1694
- }
1695
-
1696
- var timeZone = company.tz;
1697
-
1698
- var formatDate = function formatDate(date) {
1699
- var d = moment(date);
1700
-
1701
- if (timeZone) {
1702
- d = d.tz(timeZone);
1703
- }
1704
-
1705
- 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');
1706
- };
1707
-
1708
- var companyAddress = {
1709
- address1: company && (company.address && company.address.address1 || company.address1) || null,
1710
- address2: company && (company.address && company.address.address2 || company.address2) || null,
1711
- address3: company && (company.address && company.address.address3 || company.address3) || null,
1712
- city: company && company.address && company.address.city || null,
1713
- state: company && company.address && company.address.state || null,
1714
- zip: company && company.address && company.address.zip || null,
1715
- country: company && company.address && company.address.country || null
1716
- };
1717
- var customer = document.cu;
1718
- var customerAddress = customer.address || {};
1719
- var customerShippingAddress = customer.shippingAddress || {};
1720
- var shippingAddressExists = customerShippingAddress.address1 || customerShippingAddress.address2 || customerShippingAddress.address3 || customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip || document.asi;
1721
- var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
1722
- var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
1723
- var discountOnItem = false;
1724
-
1725
- if (document.it) {
1726
- for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
1727
- var item = _step.value;
1728
-
1729
- if (item.dc && item.dc > 0) {
1730
- discountOnItem = true;
1731
- }
1732
-
1733
- if (taxPercent1 > 0 && item.tx) {
1734
- if (document.ti && !document.t1d) {
1735
- var totalTaxRate = void 0;
1736
-
1737
- if (document.ttx && !document.t2d) {
1738
- totalTaxRate = taxPercent1 + taxPercent2;
1739
- } else {
1740
- totalTaxRate = taxPercent1;
1741
- }
1742
-
1743
- item.taxAmount1 = item.t * (1 - 1 / (1 + totalTaxRate / 100)) * (taxPercent1 / totalTaxRate);
1744
- } else {
1745
- item.taxAmount1 = item.t * taxPercent1 / 100;
1746
- }
1747
- }
1748
-
1749
- if (document.ttx && taxPercent2 > 0 && item.tx2) {
1750
- if (document.ti && !document.t2d) {
1751
- var _totalTaxRate = taxPercent1 + taxPercent2;
1752
-
1753
- item.taxAmount2 = item.t * (1 - 1 / (1 + _totalTaxRate / 100)) * (taxPercent2 / _totalTaxRate);
1754
- } else {
1755
- item.taxAmount2 = item.t * taxPercent2 / 100;
1756
- }
1757
- }
1758
- }
1759
- }
1760
-
1761
- var itemsContainer = '';
1762
-
1763
- if (document.it) {
1764
- for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
1765
- var _item = _step2.value;
1766
- 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>");
1767
- }
1768
- }
1769
-
1770
- var taxName1;
1771
- var taxIncluded1;
1772
- var taxName2;
1773
- var taxIncluded2;
1774
-
1775
- if (document.tx != 0) {
1776
- taxName1 = document.tn ? document.tn : 'Tax';
1777
- taxIncluded1 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
1778
- }
1779
-
1780
- if (document.ttx && document.tx2 != 0) {
1781
- taxName2 = document.tn2 ? document.tn2 : 'Tax 2';
1782
- taxIncluded2 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
1783
- }
1784
-
1785
- function payment_on(date, brand, endNumber) {
1786
- if (brand && endNumber) {
1787
- return 'Paid on ' + date + ' using ' + brand + ' ending in ' + endNumber;
1788
- } else if (brand && !endNumber) {
1789
- return 'Paid on ' + date + ' using ' + brand;
1790
- } else {
1791
- return 'Paid on ' + date;
1792
- }
1793
- }
1794
-
1795
- var paymentContainer = '';
1796
-
1797
- if (document.pm) {
1798
- for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
1799
- var payment = _step3.value;
1800
- 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>");
1801
- }
1802
- }
1803
-
1804
- var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
1805
- var attachmentContainer = '';
1806
-
1807
- if (attachments) {
1808
- for (var i = 0; i < attachments.length; i++) {
1809
- 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>");
1810
- }
1811
- }
1812
-
1813
- 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>" || "";
1814
- 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()) : "( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp)") + "</div>\n </div>" || "";
1815
- 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>&nbsp;</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";
1816
- return {
1817
- html: html,
1818
- timeZone: timeZone,
1819
- formatDate: formatDate,
1820
- documentName: documentName
1821
- };
1822
- });
1823
-
1824
1659
  var defaultLang = {
1825
1660
  terms: "Terms and conditions",
1826
1661
  privacy: "Privacy Policy",
@@ -2203,18 +2038,189 @@ var defaultLang = {
2203
2038
  search_item: "Search item"
2204
2039
  };
2205
2040
 
2041
+ var invoiceHtmlWithDetails = (function (_ref) {
2042
+ var invoice = _ref.invoice,
2043
+ _ref$lang = _ref.lang,
2044
+ lang = _ref$lang === void 0 ? defaultLang : _ref$lang,
2045
+ referral = _ref.referral,
2046
+ _ref$companyLogoBase = _ref.companyLogoBase,
2047
+ companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase,
2048
+ _ref$isDeposit = _ref.isDeposit,
2049
+ isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit;
2050
+ var company = invoice.company;
2051
+ var document = invoice.document;
2052
+ var logoBase64 = invoice.logoBase64;
2053
+ var attachments = invoice.attachments || [];
2054
+ var customerSignBase64 = invoice.customerSignBase64;
2055
+ var signatureBase64 = invoice.signatureBase64;
2056
+ var logoPath = invoice.logoPath || company.lg && "" + companyLogoBase + company._id + "/logo.jpg?" + new Date().getTime();
2057
+ var documentName = null;
2058
+
2059
+ if (company.doc && company.doc[document.ty] && company.doc[document.ty].n) {
2060
+ documentName = company.doc[document.ty].n;
2061
+ } else {
2062
+ if (document.ty === 1) {
2063
+ documentName = company.r_inv ? company.r_inv : lang['document'];
2064
+ } else if (document.ty === 2) {
2065
+ documentName = company.r_crd ? company.r_crd : lang['creditnote'];
2066
+ } else {
2067
+ documentName = company.r_est ? company.r_est : lang['Estimate'];
2068
+ }
2069
+ }
2070
+
2071
+ var logoContainer = null;
2072
+
2073
+ if (logoPath) {
2074
+ 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;\">";
2075
+ } else if (logoBase64) {
2076
+ logoContainer = "<img\n src=\"" + logoBase64 + "\"\n id='invoice-logo'\n className='img-fluid'\n style=\"width:" + (company.ls * 2 || 200) + "px, height: 'auto'\"\n />";
2077
+ } else {
2078
+ logoContainer = " <h1>" + company.c + " </h1>";
2079
+ }
2080
+
2081
+ var timeZone = company.tz;
2082
+
2083
+ var formatDate = function formatDate(date) {
2084
+ var d = moment(date);
2085
+
2086
+ if (timeZone) {
2087
+ d = d.tz(timeZone);
2088
+ }
2089
+
2090
+ 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');
2091
+ };
2092
+
2093
+ var companyAddress = {
2094
+ address1: company && (company.address && company.address.address1 || company.address1) || null,
2095
+ address2: company && (company.address && company.address.address2 || company.address2) || null,
2096
+ address3: company && (company.address && company.address.address3 || company.address3) || null,
2097
+ city: company && company.address && company.address.city || null,
2098
+ state: company && company.address && company.address.state || null,
2099
+ zip: company && company.address && company.address.zip || null,
2100
+ country: company && company.address && company.address.country || null
2101
+ };
2102
+ var customer = document.cu;
2103
+ var customerAddress = customer.address || {};
2104
+ var customerShippingAddress = customer.shippingAddress || {};
2105
+ var shippingAddressExists = customerShippingAddress.address1 || customerShippingAddress.address2 || customerShippingAddress.address3 || customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip || document.asi;
2106
+ var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
2107
+ var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
2108
+ var discountOnItem = false;
2109
+
2110
+ if (document.it) {
2111
+ for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
2112
+ var item = _step.value;
2113
+
2114
+ if (item.dc && item.dc > 0) {
2115
+ discountOnItem = true;
2116
+ }
2117
+
2118
+ if (taxPercent1 > 0 && item.tx) {
2119
+ if (document.ti && !document.t1d) {
2120
+ var totalTaxRate = void 0;
2121
+
2122
+ if (document.ttx && !document.t2d) {
2123
+ totalTaxRate = taxPercent1 + taxPercent2;
2124
+ } else {
2125
+ totalTaxRate = taxPercent1;
2126
+ }
2127
+
2128
+ item.taxAmount1 = item.t * (1 - 1 / (1 + totalTaxRate / 100)) * (taxPercent1 / totalTaxRate);
2129
+ } else {
2130
+ item.taxAmount1 = item.t * taxPercent1 / 100;
2131
+ }
2132
+ }
2133
+
2134
+ if (document.ttx && taxPercent2 > 0 && item.tx2) {
2135
+ if (document.ti && !document.t2d) {
2136
+ var _totalTaxRate = taxPercent1 + taxPercent2;
2137
+
2138
+ item.taxAmount2 = item.t * (1 - 1 / (1 + _totalTaxRate / 100)) * (taxPercent2 / _totalTaxRate);
2139
+ } else {
2140
+ item.taxAmount2 = item.t * taxPercent2 / 100;
2141
+ }
2142
+ }
2143
+ }
2144
+ }
2145
+
2146
+ var itemsContainer = '';
2147
+
2148
+ if (document.it) {
2149
+ for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
2150
+ var _item = _step2.value;
2151
+ 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>");
2152
+ }
2153
+ }
2154
+
2155
+ var taxName1;
2156
+ var taxIncluded1;
2157
+ var taxName2;
2158
+ var taxIncluded2;
2159
+
2160
+ if (document.tx != 0) {
2161
+ taxName1 = document.tn ? document.tn : 'Tax';
2162
+ taxIncluded1 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
2163
+ }
2164
+
2165
+ if (document.ttx && document.tx2 != 0) {
2166
+ taxName2 = document.tn2 ? document.tn2 : 'Tax 2';
2167
+ taxIncluded2 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
2168
+ }
2169
+
2170
+ function payment_on(date, brand, endNumber) {
2171
+ if (brand && endNumber) {
2172
+ return 'Paid on ' + date + ' using ' + brand + ' ending in ' + endNumber;
2173
+ } else if (brand && !endNumber) {
2174
+ return 'Paid on ' + date + ' using ' + brand;
2175
+ } else {
2176
+ return 'Paid on ' + date;
2177
+ }
2178
+ }
2179
+
2180
+ var paymentContainer = '';
2181
+
2182
+ if (document.pm) {
2183
+ for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
2184
+ var payment = _step3.value;
2185
+ 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>");
2186
+ }
2187
+ }
2188
+
2189
+ var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
2190
+ var attachmentContainer = '';
2191
+
2192
+ if (attachments) {
2193
+ for (var i = 0; i < attachments.length; i++) {
2194
+ 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>");
2195
+ }
2196
+ }
2197
+
2198
+ 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>" || "";
2199
+ 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()) : "( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp)") + "</div>\n </div>" || "";
2200
+ 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>&nbsp;</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\">" + (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 ? "<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";
2201
+ return {
2202
+ html: html,
2203
+ timeZone: timeZone,
2204
+ formatDate: formatDate,
2205
+ documentName: documentName
2206
+ };
2207
+ });
2208
+
2206
2209
  var invoiceHtml = (function (_ref) {
2207
2210
  var invoice = _ref.invoice,
2208
2211
  _ref$lang = _ref.lang,
2209
2212
  lang = _ref$lang === void 0 ? defaultLang : _ref$lang,
2210
2213
  referral = _ref.referral,
2211
2214
  _ref$companyLogoBase = _ref.companyLogoBase,
2212
- companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase;
2215
+ companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase,
2216
+ _ref$isDeposit = _ref.isDeposit,
2217
+ isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit;
2213
2218
  return invoiceHtmlWithDetails({
2214
2219
  invoice: invoice,
2215
2220
  lang: lang,
2216
2221
  referral: referral,
2217
- companyLogoBase: companyLogoBase
2222
+ companyLogoBase: companyLogoBase,
2223
+ isDeposit: isDeposit
2218
2224
  }).html;
2219
2225
  });
2220
2226
 
@@ -2378,17 +2384,19 @@ var CompanyCompat = function CompanyCompat(doc) {
2378
2384
  return newCompany;
2379
2385
  };
2380
2386
 
2381
- var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
2382
- if (lang === void 0) {
2383
- lang = defaultLang;
2384
- }
2385
-
2387
+ var InvoiceCompatHtml = function InvoiceCompatHtml(_ref) {
2388
+ var invoice = _ref.invoice,
2389
+ _ref$lang = _ref.lang,
2390
+ lang = _ref$lang === void 0 ? defaultLang : _ref$lang,
2391
+ _ref$isDeposit = _ref.isDeposit,
2392
+ isDeposit = _ref$isDeposit === void 0 ? false : _ref$isDeposit;
2386
2393
  return invoiceHtml({
2387
2394
  invoice: _extends({}, invoice, {
2388
2395
  document: InvoiceCompat(invoice.document),
2389
2396
  company: CompanyCompat(invoice.company)
2390
2397
  }),
2391
- lang: lang
2398
+ lang: lang,
2399
+ isDeposit: isDeposit
2392
2400
  });
2393
2401
  };
2394
2402