Invoice Generator

Business Details
Customer Details
Default GST rate for newly added invoice items.
Products / Services
# Product / Service Qty Rate (โ‚น) GST % Amount Action
1
Invoice Summary
Total Items 1
Subtotal โ‚น0.00
Total GST โ‚น0.00
Grand Total โ‚น0.00
`; const printWindow=window.open("","_blank","width=1000,height=900"); printWindow.document.open(); printWindow.document.write(html); printWindow.document.close(); printWindow.focus(); }; /*===================================================== Reset First Row ======================================================*/ Invoice.resetFirstRow = function () { const firstRow = Invoice.elements.invoiceBody.querySelector(".invoiceRow"); firstRow.querySelector(".itemName").value = ""; firstRow.querySelector(".quantity").value = 1; firstRow.querySelector(".rate").value = 0; firstRow.querySelector(".gst").value = document.getElementById("defaultGST").value; firstRow.querySelector(".lineTotal").value = Invoice.format(0); }; /*===================================================== Reset Invoice ======================================================*/ Invoice.reset = function () { setTimeout(function () { /* Keep only first row */ const rows = Invoice.elements.invoiceBody.querySelectorAll(".invoiceRow"); rows.forEach(function (row, index) { if (index > 0) { row.remove(); } }); Invoice.resetFirstRow(); Invoice.generateInvoiceNumber(); Invoice.setDates(); Invoice.updateRowNumbers(); Invoice.resetSummary(); Invoice.calculate(); }, 100); }; /*===================================================== Button Events ======================================================*/ Invoice.elements.printInvoice.addEventListener("click", function (e) { e.preventDefault(); Invoice.print(); }); Invoice.elements.resetInvoice.addEventListener( "click", function () { Invoice.reset(); } );