diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index 47547a97731585ece73f475b3c3c2d9a0d35827e..ca62589741cb199630b1ffdac47406bf383653c7 100644 --- a/gkwebapp/static/js/addcashmemo.js +++ b/gkwebapp/static/js/addcashmemo.js @@ -45,85 +45,94 @@ $(document).ready(function() { var totaltablehtml = $("#invoice_product_table_total tbody tr:first").html(); //HTML for table displaying totals in GST Product Table. var vathtml = $('#invoice_product_table_vat tbody tr:first').html(); //HTML for VAT Product Table row. -//Function to calculate gst tax amount - function calculategstaxamt(curindex) { -//Initialising variables to zero and getting values from various input fileds. -var rowqty = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(2) input').val()).toFixed(2); -var rowprice = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(4) input').val()).toFixed(2); -var rowdiscount = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(5) input').val()).toFixed(2); -var taxdetails = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(0) select').data("taxdetails"); -var taxamount = 0.00; -var rowtaxableamount=(rowqty * rowprice) - rowdiscount; //Taxable amount for each row is calculated. -if ($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(2) input').is(":disabled") && $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(3) input').is(":disabled")) { - rowtaxableamount = rowprice - rowdiscount; -} + //Function to calculate gst tax amount + function calculategstaxamt(curindex) { + //Initialising variables to zero and getting values from various input fileds. + var rowqty = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(2) input').val()).toFixed(2); + var rowprice = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(4) input').val()).toFixed(2); + var rowdiscount = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(5) input').val()).toFixed(2); + var taxamount = 0.00; + var rowtaxableamount=(rowqty * rowprice) - rowdiscount; //Taxable amount for each row is calculated. + if ($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(2) input').is(":disabled") && $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(3) input').is(":disabled")) { + rowtaxableamount = rowprice - rowdiscount; + } -//Initialising variables for calculating total of Discount, Taxable Amount, Tax Amounts, and Total Amounts. -var rowtotal = 0.00; -var totalamount = 0.00; -var totalcgst = 0.00; -var totalsgst = 0.00; -var totaldiscount = 0.00; -var totaltaxable = 0.00; -$('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(rowtaxableamount).toFixed(2)); -taxamount = (rowtaxableamount * taxdetails["taxrate"])/100; //Amount of tax to be applied is found out. -if (taxdetails["taxname"] == "SGST") { - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(8) input').val(parseFloat(taxamount).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(10) input').val(parseFloat(taxamount).toFixed(2)); - rowtotal = rowtaxableamount + (2*taxamount); - $('#invoice_product_table_total tbody tr:eq(' + curindex + ') td:eq(0) input').val(parseFloat(rowtotal).toFixed(2)); -} -//Total of discount, taxable amount, tax amounts and total are found out -for(var i = 0; i < $("#invoice_product_table_gst tbody tr").length; i++) { - totaldiscount = totaldiscount + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(5) input').val()); - totaltaxable = totaltaxable + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(6) input').val()); - totalcgst = totalcgst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(8) input').val()); - totalsgst = totalsgst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(10) input').val()); - totalamount = totalamount + parseFloat($('#invoice_product_table_total tbody tr:eq(' + i + ') td:eq(0) input').val()); -} -//Total of various columns are displayed on the footer. -$('#discounttotal_product_gst').text(parseFloat(totaldiscount).toFixed(2)); -$('#taxablevaluetotal_product_gst').text(parseFloat(totaltaxable).toFixed(2)); -$('#totalcgst_product_gst').text(parseFloat(totalcgst).toFixed(2)); -$('#totalsgst_product_gst').text(parseFloat(totalsgst).toFixed(2)); -$('#total_product_gst').text(parseFloat(totalamount).toFixed(2)); -$('#totalinvoicevalue').text(parseFloat(totalamount).toFixed(2)); - } + //Initialising variables for calculating total of Discount, Taxable Amount, Tax Amounts, and Total Amounts. + var rowtotal = 0.00; + var totalamount = 0.00; + var totalcgst = 0.00; + var totalsgst = 0.00; + var totalcess = 0.00; + var totaldiscount = 0.00; + var totaltaxable = 0.00; + + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(rowtaxableamount).toFixed(2)); + let sgstrate = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(); + let sgstamount = (rowtaxableamount * sgstrate)/100; //Amount of SGST to be applied is found out. + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(8) input').val(parseFloat(sgstamount).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(10) input').val(parseFloat(sgstamount).toFixed(2)); + + let cessrate = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(); + let cessamount = (rowtaxableamount * cessrate)/100; //Amount of Cess to be applied is found out. + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(12) input').val(parseFloat(cessamount).toFixed(2)); + + rowtotal = rowtaxableamount + 2*sgstamount + cessamount; //Sum of Taxable Amount and Tax Amount is found out. + $('#invoice_product_table_total tbody tr:eq(' + curindex + ') td:eq(0) input').val(parseFloat(rowtotal).toFixed(2)); + + //Total of discount, taxable amount, tax amounts and total are found out + for(var i = 0; i < $("#invoice_product_table_gst tbody tr").length; i++) { + totaldiscount = totaldiscount + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(5) input').val()); + totaltaxable = totaltaxable + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(6) input').val()); + totalcgst = totalcgst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(8) input').val()); + totalsgst = totalsgst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(10) input').val()); + totalcess = totalcess + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(12) input').val()); + totalamount = totalamount + parseFloat($('#invoice_product_table_total tbody tr:eq(' + i + ') td:eq(0) input').val()); + } - //Function to calculate Tax Amount and Total of Discount, Taxable Amount, Tax Amounts and Total Amount. - //This is similar to the function above. - function calculatevataxamt(curindex) { -//Initialising variables to zero and getting values from various input fileds. -var rowqty = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(1) input').val()).toFixed(2); -var rowprice = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(3) input').val()).toFixed(2); -var rowdiscount = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(4) input').val()).toFixed(2); -var rowtaxrate = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val()).toFixed(2); -var taxamount = 0.00; -var rowtaxableamount=(rowqty * rowprice) - rowdiscount; //Taxable amount for each row is calculated. -var rowtotal = 0.00; -var totalamount = 0.00; -var totaltax = 0.00; -var totaldiscount = 0.00; -var totaltaxable = 0.00; -$('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(5) input').val(parseFloat(rowtaxableamount).toFixed(2)); //Taxable amount is displayed. -taxamount = (rowtaxableamount * rowtaxrate)/100; //Amount of tax to be applied is found out. - $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(taxamount).toFixed(2)); - rowtotal = rowtaxableamount + taxamount; - $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(8) input').val(parseFloat(rowtotal).toFixed(2)); -//Total of discount, taxable amount, tax amounts and total are found out -for(var i = 0; i < $("#invoice_product_table_vat tbody tr").length; i++) { - totaldiscount = totaldiscount + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(4) input').val()); - totaltaxable = totaltaxable + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(5) input').val()); - totaltax = totaltax + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(7) input').val()); - totalamount = totalamount + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(8) input').val()); -} -//Total of various columns are displayed on the footer. -$('#discounttotal_product_vat').val(parseFloat(totaldiscount).toFixed(2)); -$('#taxablevaluetotal_product_vat').val(parseFloat(totaltaxable).toFixed(2)); -$('#totaltax').val(parseFloat(totaltax).toFixed(2)); -$('#total_product_vat').val(parseFloat(totalamount).toFixed(2)); -$("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); - } + //Total of various columns are displayed on the footer. + $('#discounttotal_product_gst').text(parseFloat(totaldiscount).toFixed(2)); + $('#taxablevaluetotal_product_gst').text(parseFloat(totaltaxable).toFixed(2)); + $('#totalcgst_product_gst').text(parseFloat(totalcgst).toFixed(2)); + $('#totalsgst_product_gst').text(parseFloat(totalsgst).toFixed(2)); + $('#totalcess_product_gst').text(parseFloat(totalcess).toFixed(2)); + $('#total_product_gst').text(parseFloat(totalamount).toFixed(2)); + $('#totalinvoicevalue').text(parseFloat(totalamount).toFixed(2)); + } + + //Function to calculate Tax Amount and Total of Discount, Taxable Amount, Tax Amounts and Total Amount. + //This is similar to the function above. + function calculatevataxamt(curindex) { + //Initialising variables to zero and getting values from various input fileds. + var rowqty = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(1) input').val()).toFixed(2); + var rowprice = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(3) input').val()).toFixed(2); + var rowdiscount = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(4) input').val()).toFixed(2); + var rowtaxrate = parseFloat($('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val()).toFixed(2); + var taxamount = 0.00; + var rowtaxableamount=(rowqty * rowprice) - rowdiscount; //Taxable amount for each row is calculated. + var rowtotal = 0.00; + var totalamount = 0.00; + var totaltax = 0.00; + var totaldiscount = 0.00; + var totaltaxable = 0.00; + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(5) input').val(parseFloat(rowtaxableamount).toFixed(2)); //Taxable amount is displayed. + taxamount = (rowtaxableamount * rowtaxrate)/100; //Amount of tax to be applied is found out. + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(taxamount).toFixed(2)); + rowtotal = rowtaxableamount + taxamount; + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(8) input').val(parseFloat(rowtotal).toFixed(2)); + //Total of discount, taxable amount, tax amounts and total are found out + for(var i = 0; i < $("#invoice_product_table_vat tbody tr").length; i++) { + totaldiscount = totaldiscount + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(4) input').val()); + totaltaxable = totaltaxable + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(5) input').val()); + totaltax = totaltax + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(7) input').val()); + totalamount = totalamount + parseFloat($('#invoice_product_table_vat tbody tr:eq(' + i + ') td:eq(8) input').val()); + } + //Total of various columns are displayed on the footer. + $('#discounttotal_product_vat').val(parseFloat(totaldiscount).toFixed(2)); + $('#taxablevaluetotal_product_vat').val(parseFloat(totaltaxable).toFixed(2)); + $('#totaltax').val(parseFloat(totaltax).toFixed(2)); + $('#total_product_vat').val(parseFloat(totalamount).toFixed(2)); + $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); + } $(".invstate").show(); $(".fixed-table").removeClass('fixed-tablepurchase'); @@ -183,7 +192,7 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); $("#invoice_date").focus().select(); return false; } - else if (!invoicedate && invoicedatestring.length == 8) { + else if (!invoicedate && invoicedatestring.length == 8) { $("#date-alert").alert(); $("#date-alert").fadeTo(2250, 500).slideUp(500, function() { $("#date-alert").hide(); @@ -331,7 +340,12 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); }) .done(function(resp) { if (resp["gkstatus"] == 0) { - $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['taxrate']).toFixed(2)); + if ('VAT' in resp['tax']) { + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['tax']['VAT']).toFixed(2)); + } + else if ('CVAT' in resp['tax']) { + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['tax']['CVAT']).toFixed(2)); + } } else if (resp["gkstatus"] == 1) { $("#notax-alert").alert(); @@ -434,15 +448,19 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); } }); - $(document).off('change', '.product_name_gst').on('change', '.product_name_gst', function(event) { - event.preventDefault(); - /* Act on the event */ - var productcode = $(this).find('option:selected').val(); - var curindex = $(this).closest('tbody tr').index(); - var sourcestate=$("#invoice_state option:selected").val(); - - var taxflag=$("#taxapplicable").val(); - if (productcode != "") { + $(document).off('change', '.product_name_gst').on('change', '.product_name_gst', function(event) { + event.preventDefault(); + /* Act on the event */ + var productcode = $(this).find('option:selected').val(); + var curindex = $(this).closest('tbody tr').index(); + var sourcestate=$("#invoice_state option:selected").val(); + var taxflag=$("#taxapplicable").val(); + + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(0).toFixed(2)); + + if (productcode != "") { $.ajax({ url: '/invoice?action=getappliedtax', type: 'POST', @@ -455,14 +473,15 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); }) .done(function(resp) { if (resp["gkstatus"] == 0) { - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(0) select').data("taxdetails", {taxname: resp["taxname"], taxrate:resp["taxrate"]}); - if(resp['taxname']=='SGST'){ - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(resp['taxrate']).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(resp['taxrate']).toFixed(2)); - } - - - //$('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(4) input').prop("disabled", false); + //Loads SGST rate. + if('SGST' in resp['tax']){ + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(resp['tax']['SGST']).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(resp['tax']['SGST']).toFixed(2)); + //Loads CESS rate if avaliable. + if ('CESS' in resp['tax']) { + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(resp['tax']['CESS']).toFixed(2)); + } + } } }) .fail(function() { @@ -472,7 +491,7 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); console.log("complete"); }); $.ajax({ - url: '/invoice?action=getproduct', + url: '/invoice?action=getproduct', type: 'POST', dataType: 'json', async: false, @@ -553,7 +572,7 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); event.preventDefault(); $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(1) input').focus().select(); } - else if (event.which == 27) { + else if (event.which == 27) { $("#accountno").focus().select(); } }); @@ -891,7 +910,7 @@ else if (event.which == 38) { if ($(this).is("select")) { if ($(this).val() == "Road") { f[previndex].focus(); - f[previndex].select(); + f[previndex].select(); } } else { @@ -974,6 +993,7 @@ $(document).off("keyup").on("keyup", function(event) { } var tax = {}; + var cess = {}; var contents = {}; var stock = {}; var freeqty = {}; @@ -1060,7 +1080,9 @@ $(document).off("keyup").on("keyup", function(event) { contents[productcode] = obj; items[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val(); freeqty[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").val(); - discount[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(5) input").val(); + discount[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(5) input").val(); + tax[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(7) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(9) input").val()); + cess[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(11) input").val()); } invoicetotal = $('#total_product_gst').text(); stock["items"] = items; @@ -1073,6 +1095,7 @@ $(document).off("keyup").on("keyup", function(event) { form_data.append("invoicedate", $("#invoice_year").val() + '-' + $("#invoice_month").val() + '-' + $("#invoice_date").val()); form_data.append("contents", JSON.stringify(contents)); form_data.append("tax", JSON.stringify(tax)); + form_data.append("cess", JSON.stringify(cess)); form_data.append("stock", JSON.stringify(stock)); form_data.append("invoicetotal", invoicetotal); form_data.append("taxstate", $("#invoice_state option:selected").val()); @@ -1472,14 +1495,14 @@ $(document).off("keyup").on("keyup", function(event) { event.preventDefault(); /* Act on the event */ - var curindex = $(this).closest('#invoice_product_table_gst tbody tr').index(); + var curindex = $(this).closest('#invoice_product_table_gst tbody tr').index(); if ($(this).val() == "") { $(this).val(0); } calculategstaxamt(curindex); }); - $(document).off("keydown", ".invoice_product_quantity_gst").on("keydown", ".invoice_product_quantity_gst", function(event) { - var curindex = $(this).closest('tr').index(); + $(document).off("keydown", ".invoice_product_quantity_gst").on("keydown", ".invoice_product_quantity_gst", function(event) { + var curindex = $(this).closest('tr').index(); var nextindex = curindex + 1; var previndex = curindex - 1; diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index cecdb555a20340955c5adf55dea62771d6bece7a..aa3026f8d54a8084ea8d4e3d17e86be8a001c854 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -22,7 +22,7 @@ "Krishnakant Mane" "Ishan Masdekar " "Navin Karkera" - "Prajkta Patkar" + "Prajkta Patkar" "Vaibhav Kurhe" "Abhijith Balan" "Rohini Baraskar" @@ -61,34 +61,39 @@ $(document).ready(function() { var rowqty = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(2) input').val()).toFixed(2); var rowprice = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(4) input').val()).toFixed(2); var rowdiscount = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(5) input').val()).toFixed(2); - var taxdetails = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(0) select').data("taxdetails"); - var taxamount = 0.00; var rowtaxableamount=(rowqty * rowprice) - rowdiscount; //Taxable amount for each row is calculated. if ($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(2) input').is(":disabled") && $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(3) input').is(":disabled")) { rowtaxableamount = rowprice - rowdiscount; } + //Initialising variables for calculating total of Discount, Taxable Amount, Tax Amounts, and Total Amounts. var rowtotal = 0.00; var totalamount = 0.00; var totalcgst = 0.00; var totalsgst = 0.00; var totaligst = 0.00; + var totalcess = 0.00; var totaldiscount = 0.00; var totaltaxable = 0.00; + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(rowtaxableamount).toFixed(2)); //Taxable amount is displayed. - taxamount = (rowtaxableamount * taxdetails["taxrate"])/100; //Amount of tax to be applied is found out. - //Checks if TAX is IGST or SGST + CGST. Amount of tax to be applied is then displayed accordingly along with calculated total amount. - if (taxdetails["taxname"] == "IGST") { - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(12) input').val(parseFloat(taxamount).toFixed(2)); - rowtotal = rowtaxableamount + taxamount; - $('#invoice_product_table_total tbody tr:eq(' + curindex + ') td:eq(0) input').val(parseFloat(rowtotal).toFixed(2)); - } - else if (taxdetails["taxname"] == "SGST") { - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(8) input').val(parseFloat(taxamount).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(10) input').val(parseFloat(taxamount).toFixed(2)); - rowtotal = rowtaxableamount + (2*taxamount); - $('#invoice_product_table_total tbody tr:eq(' + curindex + ') td:eq(0) input').val(parseFloat(rowtotal).toFixed(2)); - } + + let sgstrate = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(); + let sgstamount = (rowtaxableamount * sgstrate)/100; //Amount of SGST to be applied is found out. + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(8) input').val(parseFloat(sgstamount).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(10) input').val(parseFloat(sgstamount).toFixed(2)); + + let igstrate = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(); + let igstamount = (rowtaxableamount * igstrate)/100; //Amount of IGST to be applied is found out. + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(12) input').val(parseFloat(igstamount).toFixed(2)); + + let cessrate = $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(13) input').val(); + let cessamount = (rowtaxableamount * cessrate)/100; //Amount of Cess to be applied is found out. + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(14) input').val(parseFloat(cessamount).toFixed(2)); + + rowtotal = rowtaxableamount + 2*sgstamount + igstamount + cessamount; //Sum of Taxable Amount and Tax Amount is found out. + $('#invoice_product_table_total tbody tr:eq(' + curindex + ') td:eq(0) input').val(parseFloat(rowtotal).toFixed(2)); + //Total of discount, taxable amount, tax amounts and total are found out for(var i = 0; i < $("#invoice_product_table_gst tbody tr").length; i++) { totaldiscount = totaldiscount + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(5) input').val()); @@ -96,14 +101,17 @@ $(document).ready(function() { totalcgst = totalcgst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(8) input').val()); totalsgst = totalsgst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(10) input').val()); totaligst = totaligst + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(12) input').val()); + totalcess = totalcess + parseFloat($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(14) input').val()); totalamount = totalamount + parseFloat($('#invoice_product_table_total tbody tr:eq(' + i + ') td:eq(0) input').val()); } + //Total of various columns are displayed on the footer. $('#discounttotal_product_gst').text(parseFloat(totaldiscount).toFixed(2)); $('#taxablevaluetotal_product_gst').text(parseFloat(totaltaxable).toFixed(2)); $('#totalcgst_product_gst').text(parseFloat(totalcgst).toFixed(2)); $('#totalsgst_product_gst').text(parseFloat(totalsgst).toFixed(2)); $('#totaligst_product_gst').text(parseFloat(totaligst).toFixed(2)); + $('#totalcess_product_gst').text(parseFloat(totalcess).toFixed(2)); $('#total_product_gst').text(parseFloat(totalamount).toFixed(2)); $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); } @@ -652,6 +660,7 @@ $(document).ready(function() { $(document).off('change', '.product_name_vat').on('change', '.product_name_vat', function(event) { event.preventDefault(); /* Act on the event */ + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(0).toFixed(2)); var productcode = $(this).find('option:selected').val(); var curindex = $(this).closest('tbody tr').index(); var destinationstate = ""; @@ -684,7 +693,12 @@ $(document).ready(function() { }) .done(function(resp) { if (resp["gkstatus"] == 0) { - $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['taxrate']).toFixed(2)); + if ('VAT' in resp['tax']) { + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['tax']['VAT']).toFixed(2)); + } + else if ('CVAT' in resp['tax']) { + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['tax']['CVAT']).toFixed(2)); + } } else if (resp["gkstatus"] == 1) { $("#notax-alert").alert(); @@ -718,7 +732,7 @@ $(document).ready(function() { }) .fail(function() { - console.log("error"); + console.log("error"); }) .always(function() { console.log("complete"); @@ -1267,12 +1281,17 @@ $(document).ready(function() { //GST events start here //Change event for Product Name field. $(document).off('change', '.product_name_gst').on('change', '.product_name_gst', function(event) { - event.preventDefault(); - /* Act on the event */ - var productcode = $(this).find('option:selected').val(); - var curindex = $(this).closest('tbody tr').index(); - var destinationstate = ""; - var sourcestate = ""; + event.preventDefault(); + var productcode = $(this).find('option:selected').val(); + var curindex = $(this).closest('tbody tr').index(); + var destinationstate = ""; + var sourcestate = ""; + + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(13) input').val(parseFloat(0).toFixed(2)); + if ($("#status").val() == 9) { destinationstate = $("#invoicestate option:selected").val(); sourcestate = $("#invoice_customerstate").val(); @@ -1301,19 +1320,28 @@ $(document).ready(function() { } }) .done(function(resp) { - if (resp["gkstatus"] == 0) { - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(0) select').data("taxdetails", {taxname: resp["taxname"], taxrate:resp["taxrate"]}); - if(resp['taxname']=='SGST'){ - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(resp['taxrate']).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(resp['taxrate']).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(0).toFixed(2)); - } - else{ - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(resp['taxrate']).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(0).toFixed(2)); - $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(0).toFixed(2)); - } - } + if (resp["gkstatus"] == 0) { + //Loads SGST rate. + if('SGST' in resp['tax']){ + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(resp['tax']['SGST']).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(resp['tax']['SGST']).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(0).toFixed(2)); + //Loads CESS rate if avaliable. + if ('CESS' in resp['tax']) { + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(13) input').val(parseFloat(resp['tax']['CESS']).toFixed(2)); + } + } + //Loads IGST rate. + else if('IGST' in resp['tax']){ + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(resp['tax']['IGST']).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(0).toFixed(2)); + //Loads CESS rate. + if ('CESS' in resp['tax']) { + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(13) input').val(parseFloat(resp['tax']['CESS']).toFixed(2)); + } + } + } else if (resp["gkstatus"] == 1) { $("#notax-alert").alert(); $("#notax-alert").fadeTo(2250, 500).slideUp(500, function() { @@ -2026,16 +2054,17 @@ if (event.which == 13) { $('#consigneename').focus(); return false; } - var tax = {}; + var tax = {}; + var cess = {}; var contents = {}; - var freeqty = {}; - var stock = {}; + var freeqty = {}; + var stock = {}; var items = {}; var discount = {}; var consignee = {}; var bankdetails = {}; var invoicetotal = 0.00; - var productcodes = []; + var productcodes = []; var productqtys = []; var quantity; var ppu; @@ -2138,7 +2167,7 @@ if (event.which == 13) { ppu = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(3) input").val()); obj[ppu] = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(1) input").val()); tax[productcode] = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(6) input").val()); - contents[productcode] = obj; + contents[productcode] = obj; items[productcode] = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(1) input").val()); freeqty[productcode] = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(2) input").val()); discount[productcode] = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(4) input").val()); @@ -2151,83 +2180,84 @@ if (event.which == 13) { else if ($("#taxapplicable").val() == 7) { for (let i = 0; i < $("#invoice_product_table_gst tbody tr").length; i++) { if ($('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(0) select option:selected').val() == "") { - $("#product-blank-alert").alert(); - $("#product-blank-alert").fadeTo(2250, 500).slideUp(500, function() { - $("#product-blank-alert").hide(); - }); - $('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(0) select').focus(); - return false; - } - quantity = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").val()); - if (parseFloat(quantity) === 0.00 && $('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(0) select option:selected').attr("gsflag") == '7') { - $("#quantity-blank-alert").alert(); - $("#quantity-blank-alert").fadeTo(2250, 500).slideUp(500, function() { - $("#quantity-blank-alert").hide(); - }); - $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").focus().select(); - return false; - } - if ($("#invoice_deliverynote option:selected").val() != '') { - if ((parseFloat(parseFloat(quantity).toFixed(2)) > parseFloat(parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(1) input").attr("data")).toFixed(2))) && $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(0) select option:selected').attr("gsflag") == '7') { - $("#quantity-exceed-alert").alert(); - $("#quantity-exceed-alert").fadeTo(2250, 500).slideUp(500, function() { - $("#quantity-exceed-alert").hide(); - }); - return false; - } - } + $("#product-blank-alert").alert(); + $("#product-blank-alert").fadeTo(2250, 500).slideUp(500, function() { + $("#product-blank-alert").hide(); + }); + $('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(0) select').focus(); + return false; + } + quantity = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").val()); + if (parseFloat(quantity) === 0.00 && $('#invoice_product_table_gst tbody tr:eq(' + i + ') td:eq(0) select option:selected').attr("gsflag") == '7') { + $("#quantity-blank-alert").alert(); + $("#quantity-blank-alert").fadeTo(2250, 500).slideUp(500, function() { + $("#quantity-blank-alert").hide(); + }); + $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").focus().select(); + return false; + } + if ($("#invoice_deliverynote option:selected").val() != '') { + if ((parseFloat(parseFloat(quantity).toFixed(2)) > parseFloat(parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(1) input").attr("data")).toFixed(2))) && $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(0) select option:selected').attr("gsflag") == '7') { + $("#quantity-exceed-alert").alert(); + $("#quantity-exceed-alert").fadeTo(2250, 500).slideUp(500, function() { + $("#quantity-exceed-alert").hide(); + }); + return false; + } + } calculategstaxamt(i); - productqtys.push(parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val())); + productqtys.push(parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val())); let obj = {}; - productcode = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(0) select option:selected").val(); - ppu = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(4) input").val(); - obj[ppu] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val(); - contents[productcode] = obj; - tax[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(7) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(9) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(11) input").val()); - items[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val(); - freeqty[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").val(); - discount[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(5) input").val(); - } + productcode = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(0) select option:selected").val(); + ppu = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(4) input").val(); + obj[ppu] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val(); + contents[productcode] = obj; + tax[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(7) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(9) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(11) input").val()); + cess[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(13) input").val()); + items[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val(); + freeqty[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").val(); + discount[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(5) input").val(); + } invoicetotal = $.trim($('#total_product_gst').html()); } - - stock["items"] = items; - - if ($("#status").val() == '9') { - stock["inout"] = 9; - issuername = ""; - designation = ""; - } else { - stock["inout"] = 15; - issuername = $("#invoice_issuer_name").val(); - designation = $("#invoice_issuer_designation").val(); - if (issuername == "") { - $("#invoice_issuer_name").focus(); - $("#issuer-blank-alert").alert(); - $("#issuer-blank-alert").fadeTo(2250, 500).slideUp(500, function() { - $("#issuer-blank-alert").hide(); - }); - return false; + stock["items"] = items; + if ($("#status").val() == '9') { + stock["inout"] = 9; + issuername = ""; + designation = ""; } - } - var form_data = new FormData(); - form_data.append("dcid", $("#invoice_deliverynote option:selected").val()); - form_data.append("custid", $("#invoice_customer option:selected").val()); - form_data.append("invoiceno", $("#invoice_challanno").val()); + else { + stock["inout"] = 15; + issuername = $("#invoice_issuer_name").val(); + designation = $("#invoice_issuer_designation").val(); + if (issuername == "") { + $("#invoice_issuer_name").focus(); + $("#issuer-blank-alert").alert(); + $("#issuer-blank-alert").fadeTo(2250, 500).slideUp(500, function() { + $("#issuer-blank-alert").hide(); + }); + return false; + } + } + var form_data = new FormData(); + form_data.append("dcid", $("#invoice_deliverynote option:selected").val()); + form_data.append("custid", $("#invoice_customer option:selected").val()); + form_data.append("invoiceno", $("#invoice_challanno").val()); form_data.append("invoicedate", $.trim($("#invoice_year").val() + '-' + $("#invoice_month").val() + '-' + $("#invoice_date").val())); - form_data.append("contents", JSON.stringify(contents)); - form_data.append("tax", JSON.stringify(tax)); - form_data.append("stock", JSON.stringify(stock)); - form_data.append("issuername", issuername); - form_data.append("designation", designation); - form_data.append("invtotal", invoicetotal); - if ($("#status").val() == 9) { - form_data.append("taxstate", $("#invoicestate option:selected").val()); - form_data.append("sourcestate", $("#invoice_customerstate option:selected").val()); - } - else if ($("#status").val() == 15) { - form_data.append("taxstate", $("#invoice_customerstate option:selected").val()); - form_data.append("sourcestate", $("#invoicestate option:selected").val()); + form_data.append("contents", JSON.stringify(contents)); + form_data.append("tax", JSON.stringify(tax)); + form_data.append("cess", JSON.stringify(cess)); + form_data.append("stock", JSON.stringify(stock)); + form_data.append("issuername", issuername); + form_data.append("designation", designation); + form_data.append("invtotal", invoicetotal); + if ($("#status").val() == 9) { + form_data.append("taxstate", $("#invoicestate option:selected").val()); + form_data.append("sourcestate", $("#invoice_customerstate option:selected").val()); + } + else if ($("#status").val() == 15) { + form_data.append("taxstate", $("#invoice_customerstate option:selected").val()); + form_data.append("sourcestate", $("#invoicestate option:selected").val()); } form_data.append("freeqty", JSON.stringify(freeqty)); form_data.append("discount", JSON.stringify(discount)); diff --git a/gkwebapp/templates/addcashmemo.jinja2 b/gkwebapp/templates/addcashmemo.jinja2 index f70c3ee11048c22c454807c08e8497c0243fc336..ab2cb4d1c85e3a162acc30826fbaee6967c35b29 100644 --- a/gkwebapp/templates/addcashmemo.jinja2 +++ b/gkwebapp/templates/addcashmemo.jinja2 @@ -260,8 +260,8 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% trans %}CGST{% endtrans %} - {% trans %}SGST{% endtrans %} - + {% trans %}SGST/UTGST{% endtrans %} + {% trans %}CESS{% endtrans %} @@ -269,8 +269,9 @@ {%trans%}Amount{%endtrans%} {%trans%}Rate{%endtrans%} % {%trans%}Amount{%endtrans%} - - + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} + @@ -311,14 +312,17 @@ - - - - - - - - + + + + + + + + + + +
@@ -326,10 +330,12 @@ Total - - - - + + + + + +
@@ -349,8 +355,8 @@ - - + + diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 5420cdb3346ecb45551ebc59b2a7da3d64b2a256..33a8d139862ec3a992292e66286324732a678ff3 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -398,8 +398,9 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% trans %}CGST{% endtrans %} - {% trans %}SGST{% endtrans %} + {% trans %}SGST/UTGST{% endtrans %} {% trans %}IGST{% endtrans %} + {% trans %}CESS{% endtrans %} @@ -409,6 +410,8 @@ {% trans %}Amount{% endtrans %} {% trans %}Rate{% endtrans %} % {% trans %}Amount{% endtrans %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -450,18 +453,22 @@ - - + + - - + + - - + + - - + + + + + +
@@ -469,12 +476,13 @@ Total - - - + + + - - + + +
@@ -495,8 +503,8 @@ - - + + diff --git a/gkwebapp/templates/printcashmemo.jinja2 b/gkwebapp/templates/printcashmemo.jinja2 index f100118de526d477bd2335db16b97dc1f546fa9f..f10ce9be6075a70fa76eda7f4dadeae72a771220 100644 --- a/gkwebapp/templates/printcashmemo.jinja2 +++ b/gkwebapp/templates/printcashmemo.jinja2 @@ -202,7 +202,7 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% if gkresult["taxname"]=='SGST' %}{% trans %}CGST{% endtrans %}{% endif %} - {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST{% endtrans %}{% endif %} + {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST/UTGST{% endtrans %}{% endif %} Total @@ -211,6 +211,8 @@ {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Rate{% endtrans %} %{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -244,7 +246,8 @@ {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxrate"] }}{% endif %} {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxamount"] }}{% endif %} - + {{ gkresult["invcontents"][product]["cessrate"] }} + {{ gkresult["invcontents"][product]["cess"] }} {{ gkresult["invcontents"][product]["totalAmount"] }} {% endfor %} @@ -256,6 +259,7 @@ {{ gkresult["totaltaxablevalue"] }} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }} {{ gkresult["invoicetotal"] }} diff --git a/gkwebapp/templates/printinvoice.jinja2 b/gkwebapp/templates/printinvoice.jinja2 index e418ac0b65e9b03448ed31fa5ad6825f4e23cfc4..f1eb9eb45006d2eb2ac67a0bfa2e9445a85bf272 100644 --- a/gkwebapp/templates/printinvoice.jinja2 +++ b/gkwebapp/templates/printinvoice.jinja2 @@ -327,8 +327,9 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% if gkresult["taxname"]=='SGST' %}{% trans %}CGST{% endtrans %}{% endif %} - {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST{% endtrans %}{% endif %} + {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST/UTGST{% endtrans %}{% endif %} {% if gkresult["taxname"]=='IGST' %}{% trans %}IGST{% endtrans %}{% endif %} + {% trans %}CESS{% endtrans %} Total @@ -339,6 +340,8 @@ {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} {% if gkresult["taxname"]=='IGST' %}{% trans %}Rate{% endtrans %} %{% endif %} {% if gkresult["taxname"]=='IGST' %}{% trans %}Amount{% endtrans %}{% endif %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -375,7 +378,9 @@ {% if gkresult["invcontents"][product]["taxname"]=='IGST' %}{{ gkresult["invcontents"][product]["taxrate"] }}{% endif %} {% if gkresult["invcontents"][product]["taxname"]=='IGST' %}{{ gkresult["invcontents"][product]["taxamount"] }}{% endif %} - {{ gkresult["invcontents"][product]["totalAmount"] }} + {{ gkresult["invcontents"][product]["cessrate"] }} + {{ gkresult["invcontents"][product]["cess"] }} + {{ gkresult["invcontents"][product]["totalAmount"] }} {% endfor %} @@ -387,6 +392,7 @@ {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='IGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }} {{ gkresult["invoicetotal"] }} diff --git a/gkwebapp/templates/viewsinglecashmemo.jinja2 b/gkwebapp/templates/viewsinglecashmemo.jinja2 index 14da37ecb8f118eb736348daf1ba239550044cea..e3e8fe0b12a0d1d5bb61b8281e46a0aeef0f0698 100644 --- a/gkwebapp/templates/viewsinglecashmemo.jinja2 +++ b/gkwebapp/templates/viewsinglecashmemo.jinja2 @@ -118,7 +118,8 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% if gkresult["taxname"]=='SGST' %}{% trans %}CGST{% endtrans %}{% endif %} - {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST{% endtrans %}{% endif %} + {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST/UTGST{% endtrans %}{% endif %} + {% trans %}CESS{% endtrans %} @@ -126,6 +127,8 @@ {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Rate{% endtrans %} %{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -163,6 +166,8 @@ {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxrate"] }}{% endif %} {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxamount"] }}{% endif %} + {{ gkresult["invcontents"][product]["cessrate"] }} + {{ gkresult["invcontents"][product]["cess"] }} {% endfor %} @@ -177,6 +182,7 @@ {{ gkresult["totaltaxablevalue"] }} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }} diff --git a/gkwebapp/templates/viewsingleinvoice.jinja2 b/gkwebapp/templates/viewsingleinvoice.jinja2 index 47d85f5649f221152e7cd9188367e4ec76cb2922..d539158bd460f95c043621577f47e7274db0a9bd 100644 --- a/gkwebapp/templates/viewsingleinvoice.jinja2 +++ b/gkwebapp/templates/viewsingleinvoice.jinja2 @@ -242,8 +242,9 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% if gkresult["taxname"]=='SGST' %}{% trans %}CGST{% endtrans %}{% endif %} - {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST{% endtrans %}{% endif %} + {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST/UTGST{% endtrans %}{% endif %} {% if gkresult["taxname"]=='IGST' %}{% trans %}IGST{% endtrans %}{% endif %} + {% trans %}CESS{% endtrans %} @@ -253,6 +254,8 @@ {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} {% if gkresult["taxname"]=='IGST' %}{% trans %}Rate{% endtrans %} %{% endif %} {% if gkresult["taxname"]=='IGST' %}{% trans %}Amount{% endtrans %}{% endif %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -293,6 +296,8 @@ {% if gkresult["invcontents"][product]["taxname"]=='IGST' %}{{ gkresult["invcontents"][product]["taxrate"] }}{% endif %} {% if gkresult["invcontents"][product]["taxname"]=='IGST' %}{{ gkresult["invcontents"][product]["taxamount"] }}{% endif %} + {{ gkresult["invcontents"][product]["cessrate"] }} + {{ gkresult["invcontents"][product]["cess"] }} {% endfor %} @@ -308,6 +313,7 @@ {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='IGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }} diff --git a/gkwebapp/views/cashmemo.py b/gkwebapp/views/cashmemo.py index 1657a2e501dca3cca636c7cceb4717b5215dec8e..51689bb6f8424e9a0c51f3be8bf922dba412cf3d 100644 --- a/gkwebapp/views/cashmemo.py +++ b/gkwebapp/views/cashmemo.py @@ -70,9 +70,7 @@ def getproducts(request): def savecashmemo(request): header={"gktoken":request.headers["gktoken"]} - cashmemodata = {"invoiceno":request.params["invoiceno"],"invoicetotal":request.params["invoicetotal"],"icflag":3,"taxstate":request.params["taxstate"],"sourcestate":request.params["sourcestate"],"invoicedate":request.params["invoicedate"], - "tax":json.loads(request.params["tax"]), - "contents":json.loads(request.params["contents"]),"freeqty":json.loads(request.params["freeqty"]),"taxflag":request.params["taxflag"]} + cashmemodata = {"invoiceno":request.params["invoiceno"],"invoicetotal":request.params["invoicetotal"],"icflag":3,"taxstate":request.params["taxstate"],"sourcestate":request.params["sourcestate"],"invoicedate":request.params["invoicedate"],"tax":json.loads(request.params["tax"]), "cess":json.loads(request.params["cess"]), "contents":json.loads(request.params["contents"]),"freeqty":json.loads(request.params["freeqty"]),"taxflag":request.params["taxflag"]} if request.params.has_key("discount"): cashmemodata["discount"]=json.loads(request.params["discount"]) diff --git a/gkwebapp/views/invoice.py b/gkwebapp/views/invoice.py index 6190697429de270325522fc40d9c4d0b08d51961..06fd84be6cd99c00ea31f27390c51910499500e3 100644 --- a/gkwebapp/views/invoice.py +++ b/gkwebapp/views/invoice.py @@ -81,7 +81,7 @@ def saveinvoice(request): header={"gktoken":request.headers["gktoken"]} invoicedata = {"invoiceno":request.params["invoiceno"],"taxstate":request.params["taxstate"],"invoicedate":request.params["invoicedate"], - "tax":json.loads(request.params["tax"]),"custid":request.params["custid"],"invoicetotal":request.params["invtotal"], "contents":json.loads(request.params["contents"]),"issuername":request.params["issuername"],"designation":request.params["designation"],"freeqty":json.loads(request.params["freeqty"]), "discount":json.loads(request.params["discount"]), "consignee":json.loads(request.params["consignee"]),"bankdetails":json.loads(request.params["bankdetails"]),"taxflag":request.params["taxflag"],"sourcestate":request.params["sourcestate"],"transportationmode":request.params["transportationmode"], "reversecharge":request.params["reversecharge"], "vehicleno":request.params["vehicleno"]} + "tax":json.loads(request.params["tax"]), "cess":json.loads(request.params["cess"]),"custid":request.params["custid"],"invoicetotal":request.params["invtotal"], "contents":json.loads(request.params["contents"]),"issuername":request.params["issuername"],"designation":request.params["designation"],"freeqty":json.loads(request.params["freeqty"]), "discount":json.loads(request.params["discount"]), "consignee":json.loads(request.params["consignee"]),"bankdetails":json.loads(request.params["bankdetails"]),"taxflag":request.params["taxflag"],"sourcestate":request.params["sourcestate"],"transportationmode":request.params["transportationmode"], "reversecharge":request.params["reversecharge"], "vehicleno":request.params["vehicleno"]} if request.params["dateofsupply"] != "": invoicedata["dateofsupply"] = request.params["dateofsupply"] @@ -137,7 +137,7 @@ def getappliedtax(request): try: taxdetails = requests.get("http://127.0.0.1:6543/products?type=pt&productcode=%d&source=%s&destination=%s&taxflag=%d"%(int(request.params["productcode"]),request.params["source"],request.params["destination"],int(request.params["taxflag"])), headers=header) data = taxdetails.json()["gkresult"] - return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":data["taxname"],"taxrate":data["taxrate"]} + return{"gkstatus":taxdetails.json()["gkstatus"],"tax":data} except: return {"gkstatus":1}