@bookipi/htmlgenerator 1.1.17-alpha5 → 1.1.17-alpha6
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 +19 -15
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +19 -15
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2043,7 +2043,7 @@ var defaultLang = {
|
|
|
2043
2043
|
};
|
|
2044
2044
|
|
|
2045
2045
|
var invoiceHtmlWithDetails = (function (_ref) {
|
|
2046
|
-
var _customer$address, _customer$address2, _customer$address3, _customer$
|
|
2046
|
+
var _customer$address, _customer$address2, _customer$address3, _customer$shippingAdd, _customer$shippingAdd2, _customer$shippingAdd3;
|
|
2047
2047
|
|
|
2048
2048
|
var invoice = _ref.invoice,
|
|
2049
2049
|
_ref$lang = _ref.lang,
|
|
@@ -2058,8 +2058,8 @@ var invoiceHtmlWithDetails = (function (_ref) {
|
|
|
2058
2058
|
isFromReactnative = _ref$isFromReactnativ === void 0 ? false : _ref$isFromReactnativ,
|
|
2059
2059
|
_ref$removeHtmlStanda = _ref.removeHtmlStandardDom,
|
|
2060
2060
|
removeHtmlStandardDom = _ref$removeHtmlStanda === void 0 ? false : _ref$removeHtmlStanda;
|
|
2061
|
-
var company = invoice.company;
|
|
2062
|
-
var document = invoice.document;
|
|
2061
|
+
var company = invoice.company || {};
|
|
2062
|
+
var document = invoice.document || {};
|
|
2063
2063
|
var logoBase64 = invoice.logoBase64;
|
|
2064
2064
|
var attachments = invoice.attachments || [];
|
|
2065
2065
|
var customerSignBase64 = invoice.customerSignBase64;
|
|
@@ -2109,19 +2109,16 @@ var invoiceHtmlWithDetails = (function (_ref) {
|
|
|
2109
2109
|
country: company && company.address && company.address.country || null
|
|
2110
2110
|
};
|
|
2111
2111
|
var customer = document.cu;
|
|
2112
|
-
|
|
2113
|
-
var customerAddress = _extends({}, customer.address, {
|
|
2112
|
+
var customerAddress = customer ? _extends({}, customer.address, {
|
|
2114
2113
|
address1: ((_customer$address = customer.address) === null || _customer$address === void 0 ? void 0 : _customer$address.address1) || customer.a1,
|
|
2115
2114
|
address2: ((_customer$address2 = customer.address) === null || _customer$address2 === void 0 ? void 0 : _customer$address2.address2) || customer.a2,
|
|
2116
2115
|
address3: ((_customer$address3 = customer.address) === null || _customer$address3 === void 0 ? void 0 : _customer$address3.address3) || customer.a3
|
|
2117
|
-
});
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
});
|
|
2124
|
-
|
|
2116
|
+
}) : {};
|
|
2117
|
+
var customerShippingAddress = customer ? _extends({}, customer.shippingAddress, {
|
|
2118
|
+
address1: ((_customer$shippingAdd = customer.shippingAddress) === null || _customer$shippingAdd === void 0 ? void 0 : _customer$shippingAdd.address1) || customer.sa1,
|
|
2119
|
+
address2: ((_customer$shippingAdd2 = customer.shippingAddress) === null || _customer$shippingAdd2 === void 0 ? void 0 : _customer$shippingAdd2.address2) || customer.sa2,
|
|
2120
|
+
address3: ((_customer$shippingAdd3 = customer.shippingAddress) === null || _customer$shippingAdd3 === void 0 ? void 0 : _customer$shippingAdd3.address3) || customer.sa3
|
|
2121
|
+
}) : {};
|
|
2125
2122
|
var shippingAddressExists = customerShippingAddress.address1 || customerShippingAddress.address2 || customerShippingAddress.address3 || customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip || document.asi;
|
|
2126
2123
|
var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
|
|
2127
2124
|
var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
|
|
@@ -2216,10 +2213,10 @@ var invoiceHtmlWithDetails = (function (_ref) {
|
|
|
2216
2213
|
}
|
|
2217
2214
|
|
|
2218
2215
|
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:100px;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 style=\"font-size:16px\">" + (document.sd ? formatDate(document.sd) : "") + "</div>\n </div>" : "";
|
|
2219
|
-
var clientSignature = document.cs || customerSignBase64 ? "\n <div class=\"col-6\" style=\"text-align: center\">\n <strong>" +
|
|
2216
|
+
var clientSignature = document.cs || customerSignBase64 ? "\n <div class=\"col-6\" style=\"text-align: center\">\n <strong>" + (customer ? customer.c : '') + "</strong>\n <div style=\"height:100px;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 style=\"font-size:16px\">" + (customerSignBase64 ? formatDate(new Date()) : "(   /  /  )") + "</div>\n </div>" : "";
|
|
2220
2217
|
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();
|
|
2221
2218
|
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 ";
|
|
2222
|
-
var html = (!removeHtmlStandardDom ? '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8">\n <title>Invoice</title>' : "") + "\n " + (isOffline ? "<style>" + bootstrapCss + "</style><style>" + fontawesomeCss + "</style>" : " <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 " + (!removeHtmlStandardDom ? "</head>" : "") + "\n <style>\n body {\n font-size: 18px;removeHtmlStandardDom\n -webkit-hyphens: auto;\n -ms-hyphens: auto;\n hyphens: auto;\n word-break: break-all;\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 .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 @page {\n size: A4;\n margin: 0 0.66cm 0 0.66cm;\n }\n body, page, html {\n /*width: 21cm; */\n /*margin: 0; */\n width: 100%;\n box-shadow: 0;\n background-color: #fff;\n display: block;\n }\n .print {\n max-width:100%\n margin: 0 auto 0 auto;\n }\n /* .invoice-body {\n padding:10;\n } */\n #invoice {\n " + (isFromReactnative ? "zoom: 0.8; max-width:calc(38cm - 1.32cm);margin: 0 auto 0 auto;" : "") + "\n }\n\n .invoice-price .invoice-price-right {\n background: #f0f3f4;\n color: black;\n border: 2px solid #f0f3f4;\n }\n \n .col-sm {\n -ms-flex-preferred-size: 0;\n flex-basis: 0;\n -ms-flex-positive: 1;\n flex-grow: 1;\n max-width: 100%;\n }\n \n .col-sm-6 {\n -ms-flex: 0 0 50%;\n flex: 0 0 50%;\n max-width: 50%;\n }\n }\n \n .text-left{\n text-align: left;\n }\n .text-center{\n text-align: center;\n } \n .text-right{\n text-align: right;\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 max-width: 100%;\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 " + (!removeHtmlStandardDom ? "<body>" : "") + "\n <div id=\"invoice\" class=\"print\">\n <div class=\"invoice-body\">\n <!-- begin invoice-company -->\n <div class=\"row\">\n <div class=\"col\" style=\"padding-top:10px\">\n " + logoContainer + "\n </div>\n <div class=\"col text-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-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-6\">\n <div class=\"row text-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-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-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-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\" width=\"15%\">" + (document.um ? document.um : company.r_q ? company.r_q : lang["quantity"]) + "</th>\n <th class=\"text-right\" 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-table-cell\" rowspan=\"" + numOfRowsPaymentInstruction + "\">\n " + (paymentOn ? paymentInstructionDetails : "") + "\n </td>\n <td class=\"text-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-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-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-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-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-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-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-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-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\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 ? "<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 </div>\n\n" + (!removeHtmlStandardDom ? "</body></html>" : "") + "\n";
|
|
2219
|
+
var html = (!removeHtmlStandardDom ? '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8">\n <title>Invoice</title>' : "") + "\n " + (isOffline ? "<style>" + bootstrapCss + "</style><style>" + fontawesomeCss + "</style>" : " <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 " + (!removeHtmlStandardDom ? "</head>" : "") + "\n <style>\n body {\n font-size: 18px;removeHtmlStandardDom\n -webkit-hyphens: auto;\n -ms-hyphens: auto;\n hyphens: auto;\n word-break: break-all;\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 .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 @page {\n size: A4;\n margin: 0 0.66cm 0 0.66cm;\n }\n body, page, html {\n /*width: 21cm; */\n /*margin: 0; */\n width: 100%;\n box-shadow: 0;\n background-color: #fff;\n display: block;\n }\n .print {\n max-width:100%\n margin: 0 auto 0 auto;\n }\n /* .invoice-body {\n padding:10;\n } */\n #invoice {\n " + (isFromReactnative ? "zoom: 0.8; max-width:calc(38cm - 1.32cm);margin: 0 auto 0 auto;" : "") + "\n }\n\n .invoice-price .invoice-price-right {\n background: #f0f3f4;\n color: black;\n border: 2px solid #f0f3f4;\n }\n \n .col-sm {\n -ms-flex-preferred-size: 0;\n flex-basis: 0;\n -ms-flex-positive: 1;\n flex-grow: 1;\n max-width: 100%;\n }\n \n .col-sm-6 {\n -ms-flex: 0 0 50%;\n flex: 0 0 50%;\n max-width: 50%;\n }\n }\n \n .text-left{\n text-align: left;\n }\n .text-center{\n text-align: center;\n } \n .text-right{\n text-align: right;\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 max-width: 100%;\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 " + (!removeHtmlStandardDom ? "<body>" : "") + "\n <div id=\"invoice\" class=\"print\">\n <div class=\"invoice-body\">\n <!-- begin invoice-company -->\n <div class=\"row\">\n <div class=\"col\" style=\"padding-top:10px\">\n " + logoContainer + "\n </div>\n <div class=\"col text-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-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;\">" + (customer ? customer.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 " + (customer && customer.tfn ? "<div>" + (customer.tfn ? (company.bn || "Tax no.") + " : " + customer.tfn : "") + "</div>" : "") + "\n " + (customer && customer.ph ? "<div>" + customer.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-6\">\n <div class=\"row text-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-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-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-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\" width=\"15%\">" + (document.um ? document.um : company.r_q ? company.r_q : lang["quantity"]) + "</th>\n <th class=\"text-right\" 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-table-cell\" rowspan=\"" + numOfRowsPaymentInstruction + "\">\n " + (paymentOn ? paymentInstructionDetails : "") + "\n </td>\n <td class=\"text-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-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-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-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-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-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-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-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-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\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 ? "<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 </div>\n\n" + (!removeHtmlStandardDom ? "</body></html>" : "") + "\n";
|
|
2223
2220
|
return {
|
|
2224
2221
|
html: html,
|
|
2225
2222
|
timeZone: timeZone,
|
|
@@ -2258,6 +2255,7 @@ var invoiceHtml = (function (_ref) {
|
|
|
2258
2255
|
var docTypeMapping = new Map([[0, "estimate"], [1, "invoice"], [2, "credit_note"], [3, "delivery_note"], [4, "purchase_order"], ["estimate", 0], ["invoice", 1], ["credit_note", 2], ["delivery_note", 3], ["purchase_order", 4]]);
|
|
2259
2256
|
|
|
2260
2257
|
var ItemCompat = function ItemCompat(item) {
|
|
2258
|
+
if (item == null) return null;
|
|
2261
2259
|
var mapping = new Map([["name", "n"], ["description", "dsc"], ["price", "p"], ["quantity", "q"], ["tax", "tx"], ["tax2", "tx2"], ["discount", "dc"], ["total", "t"]]);
|
|
2262
2260
|
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
|
2263
2261
|
var k = _ref[0],
|
|
@@ -2267,6 +2265,7 @@ var ItemCompat = function ItemCompat(item) {
|
|
|
2267
2265
|
};
|
|
2268
2266
|
|
|
2269
2267
|
var PaymentCompat = function PaymentCompat(payment) {
|
|
2268
|
+
if (payment == null) return null;
|
|
2270
2269
|
var mapping = new Map([["amount", "a"], ["date", "d"], ["chargeId", "cid"], ["surchargeRate", "sr"], ["last4", "l"], ["brand", "b"]]);
|
|
2271
2270
|
return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
|
|
2272
2271
|
var k = _ref2[0],
|
|
@@ -2276,6 +2275,7 @@ var PaymentCompat = function PaymentCompat(payment) {
|
|
|
2276
2275
|
};
|
|
2277
2276
|
|
|
2278
2277
|
var CustomerCompat = function CustomerCompat(customer) {
|
|
2278
|
+
if (customer == null) return null;
|
|
2279
2279
|
var mapping = new Map([["companyName", "c"], ["firstName", "f"], ["lastName", "l"], ["email", "e"], ["additionalInfo", "ai"], ["address1", "a1"], ["address2", "a2"], ["address3", "a3"], ["shippingAddress1", "sa1"], ["shippingAddress2", "sa2"], ["shippingAddress3", "sa3"], ["mobile", "mb"], ["phone", "ph"], ["TFN", "tfn"], ["trashed", "tr"], ["trashedDate", "trd"], ["company", "ui"], ["fax", "fax"]]);
|
|
2280
2280
|
return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
|
|
2281
2281
|
var k = _ref3[0],
|
|
@@ -2285,6 +2285,7 @@ var CustomerCompat = function CustomerCompat(customer) {
|
|
|
2285
2285
|
};
|
|
2286
2286
|
|
|
2287
2287
|
var InvoiceCompat = function InvoiceCompat(doc) {
|
|
2288
|
+
if (doc == null) return null;
|
|
2288
2289
|
var mapping = new Map([["address1", "a1"], ["address2", "a2"], ["address3", "a3"], ["customer", ["cu", CustomerCompat]], ["items", ["it", ItemCompat]], ["taxInclusive", "ti"], ["taxPercentage", "tp"], ["taxDeductible", "t1d"], ["taxInclusive", "ti"], ["taxName", "tn"], ["twoTaxes", "ttx"], ["taxName2", "tn2"], ["taxPercentage2", "tp2"], ["taxDeductible2", "t2d"], ["taxAmount", "tx"], ["tax2", "tx2"], ["taxDeductibleInc2", "t2di"], ["shippingCost", "sp"], ["shippingNonTax", "sntx"], ["total", "tt"], ["subTotal", "st"], ["amountDue", "ad"], ["discount", "dc"], ["discountOption", "dco"], ["discountPercentage", "dcp"], ["discountPercentageOption", "dcpo"], ["payments", ["pm", PaymentCompat]], ["timeZone", "tz"], ["type", "ty"], ["date", "d"], ["dueDate", "dd"], ["dueIn", "di"], ["removeDueDate", "rd"], ["purchaseOrderNumber", "pon"], ["note", "nt"]]);
|
|
2289
2290
|
return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
|
|
2290
2291
|
var k = _ref4[0],
|
|
@@ -2308,6 +2309,7 @@ var InvoiceCompat = function InvoiceCompat(doc) {
|
|
|
2308
2309
|
};
|
|
2309
2310
|
|
|
2310
2311
|
var TemplateCompat = function TemplateCompat(template) {
|
|
2312
|
+
if (template == null) return null;
|
|
2311
2313
|
var mapping = new Map([["billTo", "r_bt"], ["shipTo", "r_st"], ["item", "r_it"], ["quantity", "r_q"], ["price", "r_p"], ["amount", "r_a"], ["date", "r_d"], ["dueDate", "r_dd"], ["postCode", "r_po"], ["shipping", "r_sp"], ["included", "r_ic"], ["subtotal", "r_sb"], ["net", "r_n"], ["total", "r_tt"], ["amountDue", "r_ad"], ["grandTotal", "r_gt"], ["payInt", "r_pi"], ["note", "r_nt"], ["Tos", "r_tc"], ["bySigning", "r_bs"]]);
|
|
2312
2314
|
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
2313
2315
|
var k = _ref5[0],
|
|
@@ -2317,6 +2319,7 @@ var TemplateCompat = function TemplateCompat(template) {
|
|
|
2317
2319
|
};
|
|
2318
2320
|
|
|
2319
2321
|
var DocumentDefinitionCompat = function DocumentDefinitionCompat(dd) {
|
|
2322
|
+
if (dd == null) return null;
|
|
2320
2323
|
var docTypeMapping = new Map([[0, "estimate"], [1, "invoice"], [2, "credit_note"], [3, "delivery_note"], [4, "purchase_order"], ["estimate", 0], ["invoice", 1], ["credit_note", 2], ["delivery_note", 3], ["purchase_order", 4]]);
|
|
2321
2324
|
var docs = [];
|
|
2322
2325
|
var ms = [];
|
|
@@ -2349,6 +2352,7 @@ var DocumentDefinitionCompat = function DocumentDefinitionCompat(dd) {
|
|
|
2349
2352
|
};
|
|
2350
2353
|
|
|
2351
2354
|
var CompanyCompat = function CompanyCompat(doc) {
|
|
2355
|
+
if (doc == null) return null;
|
|
2352
2356
|
var mapping = new Map([["dateFormat", "df"], ["timeZone", "tz"], ["language", "la"], ["TFN", "tfn"], ["paymentInstruction1", "p1"], ["paymentInstruction2", "p2"], ["paymentInstruction3", "p3"], ["invoiceColor", "ct"], ["taxPercentage", "tp"], ["taxDeductible", "t1d"], ["taxInclusive", "ti"], ["taxName", "tn"], ["twoTaxes", "ttx"], ["taxName2", "tn2"], ["taxPercentage2", "tp2"], ["taxDeductible2", "t2d"], ["name", "c"], ["hasPaymentInstruction", "pi"], ["additionalInfo", "ai"], ["phoneNumber", "ph"], ["displayEmail", "de"], ["email", "e"], ["logoExists", "lg"]]);
|
|
2353
2357
|
var rootMapping = new Map([["template", TemplateCompat], ["documentDefinitions", DocumentDefinitionCompat]]);
|
|
2354
2358
|
var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
|