diff --git a/AUTHORS b/AUTHORS index 220da63c46ab103d920f6bfa3b940d5b94a1bd4e..8733233bcad5a2bb7659112e359e05fa4bf2a238 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,12 +2,11 @@ Active Contributors "Abhijith Balan" "Ark Arjun" (Logo designer) < arkarjun@gmail.com > -"Bhavesh Bawadhane" -"Mohd. Talha Pawaty" +"Nitesh Chaughule" "Prajkta Patkar" -"Rohini Baraskar" +"Reshma Bhatawadekar" "Uma Mahesh" -"Vaibhav Kurhe" + "Arun Kelkar" - Domain Expert - @@ -18,8 +17,8 @@ Past contributers Abhijeet Mote, Abhishek Alai, Aditi Patil, Akshay Puradkar, Amit Chaugule, Ankita Shanbhag, Aparna Kokirkar, Ashwini Jogdand, Ashwini Shinde, Ashutosh Paralikar -Avinash Pathak, Dinesh Sutar, Ganesh Mashram, Girish Joshi, Girish Mane, Ishan Masdekar -Kanchan Kayande, Kanchan Palatane,Namita Dubey,Navin Karkera ,Nutan Nivate, Payal Mamidwar, +Avinash Pathak, Bhavesh Bawadhane,,Dinesh Sutar, Ganesh Mashram, Girish Joshi, Girish Mane, Ishan Masdekar +Kanchan Kayande, Kanchan Palatane,Mohd. Talha Pawaty,Namita Dubey,Navin Karkera ,Nutan Nivate, Payal Mamidwar, Parabjyot Singh,, Poonam Dhane, Pornima Kolte,Prasad Shegokar, Priyali Mhetre,Radhika Vadegaonkar kulkarni, -Rahul Chaurasiya ,Ravindra Lakal, Rupali Markad, Sachin Patil,Sadhana Bagal,Sayali Yawle, Snehal Nighut, Shruti Surve, -Shweta Pawar, Sundeep Padmanabh,Trupti Kini, Ujwala Pawde, Vaishali Kamble,Vanita Rajpurohit, Vinayak Kusumkar and Vishakha Divekar. +Rahul Chaurasiya ,Ravindra Lakal, Rupali Markad,Rohini Baraskar ,Sachin Patil,Sadhana Bagal,Sayali Yawle, Snehal Nighut, Shruti Surve, +Shweta Pawar, Sundeep Padmanabh,Trupti Kini, Ujwala Pawde, Vaishali Kamble,Vanita Rajpurohit,Vaibhav Kurhe, Vinayak Kusumkar and Vishakha Divekar. diff --git a/CHANGELOG b/CHANGELOG index 79180b0399edace3ce5abe0ff0fe734e01f59d21..6102b1ee581c6237843aad94f57088d6594cfd51 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +[10-November-2017 Release 4.25 Update] +* GSTIN added in orgnisation details. +* Validation for PAN and GSTIN added. +* Organisation GSTIN added in Invoice and cashmemo. +* Cess added in product. +* Tax calculated considering cess in Invoice and Cash memo. +* Cess tax added in Registers. +* Context sensitive help for bill wise accounting. +* Provision to add 0 tax in gst for taxfree products. +* Permissions to godown in-charge modified. +* Minor bugs solved. + [25-September-2017 Release 4.25] * Invoice and Cash Memo are now GST compatible. * Provision to add Services. diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index 1e79db8e8be9802a565d28e6666f93dd30432f61..addaae5de5d8068791fd100690d5a98443c73a9e 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'); @@ -149,7 +158,7 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); if (str.length == 1) { return str.length < max ? pad("0" + str, max) : str; } else { - return str + return str; } } @@ -161,7 +170,7 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); } else if (str.length == 2) { return str.length < max ? pad("20" + str, max) : str; } else { - return str + return str; } } $("#invoice_date").blur(function(event) { @@ -172,6 +181,7 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); }); $("#invoice_year").blur(function(event) { + $(this).val(yearpad($(this).val(), 4)); invoicedatestring = $("#invoice_date").val() + $("#invoice_month").val() + $("#invoice_year").val(); invoicedate = Date.parseExact(invoicedatestring, "ddMMyyyy"); if (invoicedatestring.length == 0) { @@ -182,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(); @@ -209,12 +219,12 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); else { $("#taxapplicabletext").text("VAT"); $("#taxapplicable").val("22"); - $("#gstproducttable").hide(); + $("#gstproducttable").hide(); + $(".gstinfield").hide(); $("#invoice_product_table_vat").show(); $("#vathelp").show(); } } - $(this).val(yearpad($(this).val(), 4)); }); //Key Event for Cash Memo Date Field. @@ -285,6 +295,11 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); //being a dynamic generated field the numeric property is added on their focus $(".numtype").numeric(); }); + $(document).off('focus', '#accountno').on('focus', '#accountno', function(event) { + event.preventDefault(); + /* Act on the event */ + $("#accountno").numeric({ negative: false }); + }); $(document).off('blur', '.numtype').on('blur', '.numtype', function(event) { event.preventDefault(); /* Act on the event */ @@ -302,7 +317,32 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); event.preventDefault(); /* Act on the event */ $(".product_name_vat").change(); + $("#orggstin").text(""); + var gstinstateid=$("#invoice_state option:selected").attr("stateid"); + $.ajax({ + url: '/existingorg?type=getgstin', + type: 'POST', + dataType: 'json', + async: false, + data : {"gstinstate" : gstinstateid}, + beforeSend: function(xhr) { + xhr.setRequestHeader('gktoken', sessionStorage.gktoken); + } + }) + .done(function(resp) { + if (resp["gkstatus"] == 0) { + console.log("success"); + $("#orggstin").text(resp["gkresult"]); + } + }) + .fail(function() { + console.log("error"); + }) + .always(function() { + console.log("complete"); + }); }); + $('#invoice_state').change(); // if the selected product is changed the tax rate is again retrieved from the database, again using the combination of product code and state @@ -331,7 +371,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 +479,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 +504,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 +522,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 +603,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 +941,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 +1024,7 @@ $(document).off("keyup").on("keyup", function(event) { } var tax = {}; + var cess = {}; var contents = {}; var stock = {}; var freeqty = {}; @@ -1011,7 +1062,7 @@ $(document).off("keyup").on("keyup", function(event) { var ppu = $("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(3) input").val(); obj[ppu] = $("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(1) input").val(); //tax is stored as a dict with key as productcode and value as the tax rate - tax[productcode] = $("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(4) input").val(); + tax[productcode] = $("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(6) input").val(); // nested dictionary with key as product code and value is another dict with key as priceperunit and value is the product quantity contents[productcode] = obj; items[productcode] = $("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(1) input").val(); @@ -1060,7 +1111,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,12 +1126,14 @@ $(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()); form_data.append("sourcestate", $("#invoice_state option:selected").val()); form_data.append("taxflag",$("#taxapplicable").val() ); - form_data.append("freeqty", JSON.stringify(freeqty)); + form_data.append("orgstategstin",$("#orggstin").text() ); + form_data.append("freeqty", JSON.stringify(freeqty)); form_data.append("discount", JSON.stringify(discount)); form_data.append("bankdetails", JSON.stringify(bankdetails)); $('.modal-backdrop').remove(); @@ -1472,14 +1527,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/addcategory.js b/gkwebapp/static/js/addcategory.js index a881e89d44fbaaa1fa55deb2c80bd5a3c8669f5c..5da5d20513a1571348bda9b9bb325cf8a7e1c4b6 100644 --- a/gkwebapp/static/js/addcategory.js +++ b/gkwebapp/static/js/addcategory.js @@ -600,11 +600,13 @@ $(document).ready(function() { }); taxes = []; $("#category_tax_table tbody tr").each(function() { - var obj = {}; // dict for storing tax details - obj.taxname = $.trim($("td:eq(0) select option:selected", this).val()); - obj.state = $.trim($("td:eq(1) select option:selected", this).val()); - obj.taxrate = $.trim($("input", this).val()); - taxes.push(obj); + var obj = {}; // dict for storing tax details + if($("td:eq(0) select option:selected", this).val() != ""){ + obj.taxname = $.trim($("td:eq(0) select option:selected", this).val()); + obj.state = $.trim($("td:eq(1) select option:selected", this).val()); + obj.taxrate = $.trim($("input", this).val()); + taxes.push(obj); + } }); $.ajax({ url: '/category?action=save', diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index ca245a5165cfdb2b98c997cc8f8fd6b0e01ba63b..7b40a2e56f90c7544dbef65c4642d0d986415804 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -1,6 +1,6 @@ /* Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation -This file is part of GNUKhata:A modular,robust and Free Accounting System. + This file is part of GNUKhata:A modular,robust and Free Accounting System. GNUKhata is Free Software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -23,13 +23,14 @@ Contributors: "Ishan Masdekar " "Navin Karkera" "Prajkta Patkar" +"Reshma Bhatawadekar" */ // This script is for the addcustomer/supplier.jinja2 $(document).ready(function() { //All the navigation events where pressing enter shifts focus to the next element and pressing the up arrow key focuses the previous element - + var gstinstring = ""; $("#add_cussup").focus().select(); $("#add_cussup").keydown(function(event) { if (event.which==13) { @@ -37,7 +38,7 @@ $(document).ready(function() { if ($.trim($("#add_cussup").val())=="") { $("#role-blank-alert").alert(); $("#role-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#role-blank-alert").hide(); + $("#role-blank-alert").hide(); }); $("#add_cussup").focus(); return false; @@ -121,28 +122,74 @@ $("#add_state").keydown(function(event) { event.preventDefault(); } else if (event.which==13) { - event.preventDefault(); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); + event.preventDefault(); + if ($.trim($("#add_cussup_pan").val()) !="") { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:last').focus(); + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').focus(); + } } else if (event.which==27) { event.preventDefault(); $("#cussup_save").focus(); } }); - $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { + //Change event on GSTIN State + $(document).off('change', '.gstinstate').on('change', '.gstinstate', function(event) { + event.preventDefault(); var curindex = $(this).closest('tr').index(); - var gstin = $(this).val(); - var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstnint < 0 || gstin.length !=15){ - $("#gstin-improper-alert").alert(); - $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); - }); - return false; - } + var cusstatecode = $('#gstintable tbody tr:eq('+curindex+') td:eq(0) select option:selected').attr("stateid"); + if (cusstatecode.length == 1){ + cusstatecode = "0" + cusstatecode; + } + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val(cusstatecode); //for state code + if ($('#add_cussup_pan').val() != ''){ + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val($('#add_cussup_pan').val()).prop("disabled",true); //for pan + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').prop("disabled",false); + } + + }); + + //Keydown event on gstin's panno + $(document).off("keydown", ".panno").on("keydown", ".panno", function(event) { + var curindex = $(this).closest('tr').index(); + var previndex = curindex-1; + if (event.which == 13) { + event.preventDefault(); + if($(this).val() != '') { + $(this).next('input').focus().select(); + + } + else { + $("#panno-blank-alert").alert(); + $("#panno-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#panno-blank-alert").hide(); + $(this).focus().select(); + }); + return false; + } + } }); + $(document).off("change",".gstin").on("change",".gstin",function(event) { + var curindex = $(this).closest('tr').index(); + gstinstring = $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + + }); + $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) { var curindex1 = $(this).closest('tr').index(); @@ -151,30 +198,25 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) var selectedstate = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"); var numberofstates = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:not(:hidden)').length-1; if (event.which==13) { - event.preventDefault(); + event.preventDefault(); if (curindex1 != ($("#gstintable tbody tr").length-1)) { $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } - else { - if (numberofstates > 0) { - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="") { - $("#state-blank-alert").alert(); - $("#state-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#state-blank-alert").hide(); - }); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select').focus(); - return false; - } - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val()=="") { - $("#gstin-blank-alert").alert(); - $("#gstin-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-blank-alert").hide(); - }); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus(); - return false; - } + else { + gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + if (numberofstates > 0) { $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); - if (curindex1 == 0) { + if (curindex1 == 0) { $("#gstintable tbody tr:last td:last").append(''); } $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select option[stateid='+selectedstate+']').prop('hidden', true).prop('disabled', true); @@ -201,7 +243,7 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) } else if (event.ctrlKey && event.which==188) { event.preventDefault(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select').focus(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').focus(); } else if (event.which==190 && event.ctrlKey) { event.preventDefault(); @@ -263,11 +305,22 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { $("#add_cussup_pan").keydown(function(event) { if (event.which==13) { event.preventDefault(); - if($("#vatorgstflag").val() == '22' || $("#vatorgstflag").val() == '29'){ - $("#add_cussup_tan").focus().select(); + var regExp = /[a-zA-z]{5}\d{4}[a-zA-Z]{1}/; + var txtpan = $(this).val(); + if ((txtpan.length != 10 || !txtpan.match(regExp)) && $.trim($("#add_cussup_pan").val())!="") { + $("#pan-incorrect-alert").alert(); + $("#pan-incorrect-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#pan-incorrect-alert").hide(); + }); + $("#add_cussup_pan").focus(); } else { - $(".gstinstate:first").focus(); + if($("#vatorgstflag").val() == '22' || $("#vatorgstflag").val() == '29'){ + $("#add_cussup_tan").focus(); + } + else { + $(".gstinstate:first").focus(); + } } } if (event.which==38) { @@ -276,8 +329,6 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { } }); - - $("#add_cussup_tan").keydown(function(event) { if (event.which==13) { event.preventDefault(); @@ -304,9 +355,18 @@ else{ }); $("#add_cussup_reset").click(function(event) { // click the customer/supplier create tab to reload the current page in tab creating a reset effect - $("#customersupplier_create").click(); + $("#customersupplier_create").click(); }); - $("#cussup_save").click(function(event) { + + $(document).one("keyup", function(event) { + if(event.which == 45) { + $("#cussup_save").click(); + event.preventDefault(); + return false; + } + }); + + $("#cussup_save").click(function(event) { //save event for saving the customer/supplier event.preventDefault(); var allow = 1; @@ -349,35 +409,6 @@ if($("#vatorgstflag").val() == '22'){ } } -if($("#vatorgstflag").val() == '29'){ - console.log("Abdul Kalam: " + $("#add_cussup_tin").val()); - if ($.trim($("#add_cussup_tan").val())=="") { - for (var i = 0; i < $('#gstintable tbody tr').length; i++) { - if (($('#gstintable tbody tr:eq('+i+') td:eq(1) input').val())=="" ) { - $("#both-blank-alert").alert(); - $("#both-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#both-blank-alert").hide(); - }); - $("#add_cussup_tin").focus(); - return false; - } - } - } -} - -if($("#vatorgstflag").val() == '7'){ - for (var i = 0; i < $('#gstintable tbody tr').length; i++) { - if (($('#gstintable tbody tr:eq('+i+') td:eq(1) input').val())=="" ) { - $("#gstin-blank-alert").alert(); - $("#gstin-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-blank-alert").hide(); - }); - $("#add_cussup_tin").focus(); - return false; - } - } -} - if ($.trim($("#add_state").val())=="") { $("#state-blank-alert").alert(); $("#state-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -395,24 +426,24 @@ if($("#vatorgstflag").val() == '7'){ $("#add_cussup_address").focus(); return false; } - var gobj = {}; // Creating a dictionary for storing godown wise opening stock + + var gobj = {}; // Creating a dictionary for storing statecode with gstin. $("#gstintable tbody tr").each(function(){ var curindex1 = $(this).index(); if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"))!="") { - if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val())!="") { - var gstin = $.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val()); - var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstnint < 0 || gstin.length !=15){ - allow = 0; - $("#gstin-improper-alert").alert(); - $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus().select(); - }); - return false; - } - gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val(); - } + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + + gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] = gstinstring; } }); var custtan = ""; diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index f0c5f69c831232c2447f39108079017bf00bb0ba..388c404e6555809636e6b74e85cbbc2ba64a1990 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" @@ -41,7 +41,7 @@ $(document).ready(function() { } else { $(".gstinfield").show(); } - + //Initialising some variables. var issuername = ""; var designation = ""; @@ -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)); } @@ -150,11 +158,16 @@ $(document).ready(function() { //Certain fields are hidden in the case of Purchase Invoice. They are shown in Sale Invoice. if ($("#status").val() == '15') { //In/Out flag is saved in a hidden field. 15 is OUT(Sale Invoice) and 9 is IN(Purchase Invoice). - $(".invoice_issuer").show(); //Issuer Name is shown in Sale Invoice. Purchase Invoice is only recorded, not created by an organisation. + $(".invoice_issuer").show(); //Issuer Name is shown in Sale Invoice. Purchase Invoice is only recorded, not created by an organisation. $(".fixed-table").removeClass('fixed-tablepurchase'); //CSS class for adjusting style properties. $(".fixed-table").addClass('fixed-tablesale'); } + if ($("#status").val() == '9') { + $(".reversepurchase").show(); + } + + $(".input-sm:visible").first().focus(); //Focus on the first element when the page loads //Preventing characters in numeric fields. $("#invoice_date").numeric({ negative: false }); @@ -214,6 +227,7 @@ $(document).ready(function() { $(this).val(pad($(this).val(), 2)); }); $("#invoice_year").blur(function(event) { + $(this).val(yearpad($(this).val(), 4)); invoicedatestring = $("#invoice_date").val() + $("#invoice_month").val() + $("#invoice_year").val(); invoicedate = Date.parseExact(invoicedatestring, "ddMMyyyy"); if (invoicedatestring.length == 0) { @@ -270,7 +284,6 @@ $(document).ready(function() { $("#vathelp").show(); } } - $(this).val(yearpad($(this).val(), 4)); }); //Key Event for Invoice Date Field. @@ -312,6 +325,7 @@ $(document).ready(function() { //Change Event For State of Origin/Delivery. $("#invoicestate").change(function(event) { event.preventDefault(); + $("#orggstin").text(""); $("#statecodeforinvoice").text($("#invoicestate option:selected").attr("stateid")); if ($("#invoice_customerstate option:selected").val() == $("#invoicestate option:selected").val()) { $(".igstfield").hide(); @@ -324,6 +338,31 @@ $(document).ready(function() { $(".igstfield").show(); } $(".product_name_vat, .product_name_gst").change(); + + var gstinstateid=$("#invoicestate option:selected").attr("stateid"); + $.ajax({ + url: '/existingorg?type=getgstin', + type: 'POST', + dataType: 'json', + async: false, + data : {"gstinstate" : gstinstateid}, + beforeSend: function(xhr) { + xhr.setRequestHeader('gktoken', sessionStorage.gktoken); + } + }) + .done(function(resp) { + if (resp["gkstatus"] == 0) { + console.log("success"); + $("#orggstin").text(resp["gkresult"]); + } + }) + .fail(function() { + console.log("error"); + }) + .always(function() { + console.log("complete"); + }); + }); $("#invoicestate").change(); @@ -421,10 +460,17 @@ $(document).ready(function() { $("#invoice_customerstate").val(resp["gkresult"]["state"]); //State of Customer is selected automatically. $("#invoice_customeraddr").text(resp["gkresult"]["custaddr"]); //Adress of Customer is loaded. $("#tin").text(resp["gkresult"]["custtan"]); //Customer TIN is loaded. + //All GSTINs of this customer are + gstins = resp["gkresult"]["gstin"]; + if ($("#invoice_customer option:selected").attr("custid") in gstins) { + $("#gstin").text(resp["gkresult"]["gstin"][$("#invoice_customerstate option:selected").attr("stateid")]); //GSTIN is loaded if available. + } + else { + $("#gstin").text(''); //If GSTIN is not available it is set as blank. + } //GSTIN of customer in default state is selected. $("#gstin").text(resp["gkresult"]["gstin"][$("#invoice_customerstate option:selected").attr("stateid")]); - //All GSTINs of this customer are - gstins = resp["gkresult"]["gstin"]; + //State Code of Customer State is loaded. $("#statecodeofcustomer").text($("#invoice_customerstate option:selected").attr("stateid")); //Consignee State is synced with Customer State. @@ -645,6 +691,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 = ""; @@ -677,7 +724,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(); @@ -711,7 +763,7 @@ $(document).ready(function() { }) .fail(function() { - console.log("error"); + console.log("error"); }) .always(function() { console.log("complete"); @@ -1260,12 +1312,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(); @@ -1294,19 +1351,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() { @@ -1766,6 +1832,7 @@ if (event.which == 13) { $(this).val(pad($(this).val(), 2)); }); $("#supply_year").blur(function(event) { + $(this).val(yearpad($(this).val(), 4)); var supplydatestring = $("#supply_date").val() + $("#supply_month").val() + $("#supply_year").val(); if ((supplydatestring.length == 8) && (!Date.parseExact(supplydatestring, "ddMMyyyy"))) { $("#supplydate-alert").alert(); @@ -1796,7 +1863,7 @@ if (event.which == 13) { } } } - $(this).val(yearpad($(this).val(), 4)); + }); //Events for last fields - Bank Details, Reverse charge etc.. @@ -1807,15 +1874,22 @@ if (event.which == 13) { { event.preventDefault(); var nextIndex = f.index(this) + 1; + if($(".lastfield:visible").eq(nextIndex).is(":disabled")) { + nextIndex = nextIndex + 3; + } if(nextIndex < n){ f[nextIndex].focus(); } else if (nextIndex == n) { - $("#invoice_save").click(); + $("#invoice_save").focus().click(); } } else if (event.which == 38) { var previndex = f.index(this) - 1; + if($(".lastfield:visible").eq(previndex).is(":disabled")) { + previndex = previndex - 3; + } + if(previndex > -1) { if ($(this).is("select")) { if ($(this).val() == "Road") { @@ -1837,6 +1911,13 @@ if (event.which == 13) { } }); + $("#rev2radio").keydown(function(event) { + if (event.which == 13) { + event.preventDefault(); + $("#invoice_save").focus(); + } + }); + $("#invoice_addcust").click(function() { var statusinout; if ($("#status").val() == '9') { @@ -1897,7 +1978,7 @@ if (event.which == 13) { datatype: "text/json", beforeSend: function(xhr) { xhr.setRequestHeader("gktoken", sessionStorage.gktoken); - }, + } }) .done(function(resp) { var custs = resp["customers"]; @@ -1921,8 +2002,8 @@ if (event.which == 13) { var allow = 1; $("#invoice_save").click(function(event) { - event.stopPropagation(); - //event.preventDefault(); + event.preventDefault(); + event.stopPropagation(); var financialstart = Date.parseExact(sessionStorage.yyyymmddyear1, "yyyy-MM-dd"); if ($.trim($('#invoice_challanno').val()) == "") { $('html,body').animate({scrollTop: ($("#orgdata").offset().top)},'fast'); @@ -2011,20 +2092,20 @@ 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; - if($("#consigneename").val() != ""){ consignee["consigneename"] = $.trim($("#consigneename").val()); consignee["tinconsignee"] = $.trim($("#tinconsignee").val()); @@ -2123,8 +2204,8 @@ if (event.which == 13) { let obj = {}; 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(4) input").val()); - contents[productcode] = obj; + tax[productcode] = $.trim($("#invoice_product_table_vat tbody tr:eq(" + i + ") td:eq(6) input").val()); + 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()); @@ -2137,83 +2218,85 @@ 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("orgstategstin",$("#orggstin").text() ); + 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)); @@ -2229,13 +2312,20 @@ if (event.which == 13) { else { form_data.append("dateofsupply", $.trim($("#supply_year").val() + '-' + $("#supply_month").val() + '-' + $("#supply_date").val())); } - form_data.append("reversecharge", $("#reversecharge").val()); + if ($("#rev1radio").is(":checked")) { + + form_data.append("reversecharge", 1); + } + else if ($("#rev2radio").is(":checked")) { + + form_data.append("reversecharge", 0); + } + var files = $("#my-file-selector")[0].files; var filelist = []; for (var i = 0; i < files.length; i++) { form_data.append("file" + i, files[i]); } - event.preventDefault(); $('.modal-backdrop').remove(); $('.modal').modal('hide'); $('#confirm_yes').modal('show').one('click', '#tn_save_yes', function(e) { diff --git a/gkwebapp/static/js/addproduct.js b/gkwebapp/static/js/addproduct.js index e3f2dcba35fb3083902430c243842e8a953efffc..5ddaf226ea30c450428682d7906bce38da5450ca 100644 --- a/gkwebapp/static/js/addproduct.js +++ b/gkwebapp/static/js/addproduct.js @@ -1,13 +1,49 @@ +/* + Copyright (C) 2013, 2014, 2015, 2016, 2017 Digital Freedom Foundation + This file is part of GNUKhata:A modular,robust and Free Accounting System. + + GNUKhata is Free Software; you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation; either version 3 of + the License, or (at your option) any later version. + + GNUKhata is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public + License along with GNUKhata (COPYING); if not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301 USA59 Temple Place, Suite 330, + + + Contributors: + "Abhijith Balan" + "Bhavesh Bawadhane" + "Ishan Masdekar" + "Mohd. Talha Pawaty" + "Navin Karkera" + "Ravishankar Purne" + "Reshma Bhatawadekar" + "Rohini Baraskar" + "Sachin Patil" +*/ $(document).ready(function() { $(".serviceclass").hide(); $(".productclass").hide(); $(".common").hide(); - var godownflag = 0; - $('.modal-backdrop').remove(); + $('.modal-backdrop').remove(); + var taxfieldhtml = $("#product_tax_table tbody").html(); + var stateshtml = $("#product_tax_table tbody tr:first td:eq(1) select").html(); + var delhtml = ''; + $("#product_tax_table tbody tr:first td:eq(1) select").empty(); + $('#product_tax_table tbody tr:first td:eq(1) select').prop("disabled", true); + $("#product_tax_table tbody tr:first td:eq(1) select").append(''); var specday; var specmonth; var specyear; @@ -15,7 +51,7 @@ $(".productclass").hide(); var specspresent = 0; var selectedgodown; var selectedtaxname; - var selectedtaxstate = 0; + var selectedtaxstate = 0; $(".numtype").numeric({negative: false}); $("#moresmall").on('shown.bs.collapse', function(event) { event.preventDefault(); @@ -25,7 +61,6 @@ $(".productclass").hide(); event.preventDefault(); $("#smalllink").html('See more. '); }); - $("#additem").focus().select(); /*$("#addcatselect").focus(); if($("#addcatselect").is(':hidden')) { @@ -59,7 +94,13 @@ $(".productclass").hide(); $("#additem").change(); - +if($("#additem").is(':visible')) + { + $("#additem").focus(); + } + else{ + $("#addproddesc").focus(); + } $("#godownflag").click(function(e){ if ($(this).is(":checked")) { @@ -96,7 +137,7 @@ $(document).off('blur', '.numtype').on('blur', '.numtype', function(event) { } }); -$(document).off('blur', '#addproddesc').on('blur', '#addproddesc',function(event) { + $(document).off('blur', '#addproddesc').on('blur', '#addproddesc',function(event) { /* Act on the event */ $("#addproddesc").val($("#addproddesc").val().trim()); @@ -229,12 +270,12 @@ $("#hsnno").keydown(function(event) { $("#adduom").focus(); } else { - //if($("#igstrate").is(":hidden")){ + if($("#product_tax_table").length > 0){ $("#product_tax_table tbody tr:first td:eq(0) select").focus(); - //} - /*else { - $("#igstrate").focus().select(); - }*/ + } + else { + $("#apsubmit").focus(); + } } } @@ -285,8 +326,28 @@ $(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) { $("#spec_table tbody tr:first td:eq(1) input:first").focus(); } - else { - $("#product_tax_table tbody tr:first td:eq(0) select").focus(); + else { + if ($("#product_tax_table tbody").length > 0) { + $("#product_tax_table tbody tr:first td:eq(0) select").focus(); + } + else{ + if ($("#additem option:selected").val()=='7'){ + + if ($("#godownpresence").val()==0) { + $("#openingstock").focus().select(); + } + if ($("#godownpresence").val()==1) + { + $("#godownflag").focus().select(); + } + if(sessionStorage.invflag==0){ + $("#apsubmit").focus(); + } + } + else{ + $("#apsubmit").focus(); + } + } } } else if (event.which==32) @@ -381,7 +442,7 @@ $(document).off('keydown', '#newuom').on('keydown', '#newuom', function(event) { $('#adduom').append($('')); } - $("#adduom option").filter(function(i,e){return $(e).text()==unitname}).prop('selected', true); + $("#adduom option").filter(function(i,e){return $(e).text()==unitname;}).prop('selected', true); $("#product_tax_table tbody tr:first td:eq(0) select").focus(); } }) @@ -427,71 +488,19 @@ $("#addcatselect").change(function(event) { if (resp["gkresult"].length>0) { $('#product_tax_table tbody tr').remove(); for (tax of resp["gkresult"]) { - $('#product_tax_table tbody').append(''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''); + $('#product_tax_table tbody').append(taxfieldhtml); + $('#product_tax_table tbody tr:last').attr({value: tax["taxid"]}); $('#product_tax_table tbody tr:last td:eq(1) select').val(tax["state"]); - $('#product_tax_table tbody tr:last td:eq(0) select').val(tax["taxname"]); + $('#product_tax_table tbody tr:last td:eq(0) select').val(tax["taxname"]); + $('#product_tax_table tbody tr:last td:eq(2) input').val(tax["taxrate"]); + $('#product_tax_table tbody tr:last td:last').append(delhtml); } + $(".tax_del:first").hide(); + $(".tax_name").change(); } }) - .fail(function() { + .fail(function() { console.log("error"); }) .always(function() { @@ -538,69 +547,13 @@ $("#addcatselect").change(function(event) { $("#specifications").html(""); $("#specshelp").show(); $('#product_tax_table tbody tr').remove(); - $('#product_tax_table tbody').append(''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''); - + $('#product_tax_table tbody').append(taxfieldhtml); + $('#product_tax_table tbody tr:last').attr({value: "New"}); } }); /* -----------------------Spec Key Events---------------------------------------------- */ -$(document).off("keydown",".spec").on("keydown",".spec",function(event) { + $(document).off("keydown",".spec").on("keydown",".spec",function(event) { var curindex = $(this).closest('tr').index(); var nextindex = curindex+1; var previndex = curindex-1; @@ -652,7 +605,7 @@ function yearpad (str, max) { return str.length < max ? pad("20" + str, max) : str; } else{ - return str; + return str; } } $(document).off("blur",".specday").on("blur",".specday",function(event) { @@ -718,28 +671,8 @@ $(document).off("keydown",".tax_name").on("keydown",".tax_name",function(event) $('#product_tax_table tbody tr:eq('+curindex+') td:eq(1) select').focus(); event.preventDefault(); } - else if (($("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='CVAT' || $("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='IGST') && event.which==13 ) { + else if (($("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()!='VAT') && event.which==13 ) { event.preventDefault(); - var types = []; - $('#product_tax_table tbody tr').each(function(){ - if ($(".tax_name",this).val()=='CVAT' || $(".tax_name",this).val()=='IGST' ) { - types.push($(".tax_name",this).val()); - } - }); - types.sort(); - var duplicatetypes = []; - for (var i = 0; i < types.length - 1; i++) { - if (types[i + 1] == types[i]) { - duplicatetypes.push(types[i]); - } - } - if (duplicatetypes.length > 0) { - $("#cvat-alert").alert(); - $("#cvat-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#cvat-alert").hide(); - }); - return false; - } $('#product_tax_table tbody tr:eq('+curindex+') td:eq(2) input').focus().select(); } else if (event.which==13) { @@ -767,69 +700,29 @@ $(document).off("keydown",".tax_name").on("keydown",".tax_name",function(event) } }); - -$(document).off("change",".tax_name").on("change",".tax_name",function(event) -{ - var curindex = $(this).closest('tr').index(); - var previndex = curindex -1; - if ($("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='VAT') { - $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); - $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '').prop('disabled',false); - if (curindex > 0) { - for (var i = 1; i < curindex+1; i++) { - for (var j = 0; j < curindex; j++) { - if ($("#product_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "CVAT" || $("#product_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "IGST" ) { - i = i + 1; - } - selectedtaxstate = $("#product_tax_table tbody tr:eq("+j+") td:eq(1) select option:selected").attr("stateid"); - $('#product_tax_table tbody tr:eq('+i+') td:eq(1) select option[stateid='+selectedtaxstate+']').prop('hidden', true).prop('disabled', true); + $(document).off("change",".tax_name").on("change",".tax_name",function(event){ + var curindex = $(this).closest('tr').index(); + if ($("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='VAT') { + $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); + $('#product_tax_table tbody tr:eq('+curindex+') td:eq(1) select').prop("disabled", false); + $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(stateshtml); + $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select option:visible").first().prop("selected", true); } - } - } - } - else { - $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); - $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append('').prop('disabled','true'); - } - selectedtaxname = $("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val(); -}); + else { + $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); + $('#product_tax_table tbody tr:eq('+curindex+') td:eq(1) select').prop("disabled", true); + $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(''); + } + var previndex = curindex -1; + for (let j = 0; j < curindex + 1; j++) { + if ($("#product_tax_table tbody tr:eq("+j+") td:eq(0) select option:selected").val() == "VAT") { + var selectedtaxstate = $("#product_tax_table tbody tr:eq("+j+") td:eq(1) select option:selected").attr("stateid"); + for (let i=j+1; i<=curindex+1;i++){ + $('#product_tax_table tbody tr:eq('+i+') td:eq(1) select option[stateid='+selectedtaxstate+']').remove(); + } + } + } + }); $(document).off("keydown",".tax_state").on("keydown",".tax_state",function(event) @@ -859,24 +752,6 @@ $(document).off("keydown",".tax_state").on("keydown",".tax_state",function(event } else if (event.which==13) { event.preventDefault(); - var states = []; - $('#product_tax_table tbody tr').each(function(){ - states.push($(".tax_state",this).val()); - }); - states.sort(); - var duplicatestates = []; - for (var i = 0; i < states.length - 1; i++) { - if (states[i + 1] == states[i]) { - duplicatestates.push(states[i]); - } - } - if (duplicatestates.length > 0) { - $("#tax-same-alert").alert(); - $("#tax-same-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#tax-same-alert").hide(); - }); - return false; - } $('#product_tax_table tbody tr:eq('+curindex+') td:eq(2) input').focus().select(); } }); @@ -890,26 +765,26 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) $('#product_tax_table tbody tr:eq('+curindex1+') td:eq(2) input').val(parseFloat($('#product_tax_table tbody tr:eq('+curindex1+') td:eq(2) input').val()).toFixed(2)); event.preventDefault(); if ($('#product_tax_table tbody tr:eq('+curindex1+') td:eq(1) select option:selected').attr("stateid") < 1 && selectedtaxname == "VAT") { - $("#tax_state-blank-alert").alert(); + $("#tax_state-blank-alert").alert(); $("#tax_state-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#tax_state-blank-alert").hide(); }); return false; } - if (curindex1 != ($("#product_tax_table tbody tr").length-1)) { + if (curindex1 != ($("#product_tax_table tbody tr").length-1)) { $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } - else { - if ($('#product_tax_table tbody tr:eq('+curindex1+') td:eq(0) select').val()=="") { + else { + if ($('#product_tax_table tbody tr:eq('+curindex1+') td:eq(0) select').val()==null) { $("#tax-name-blank-alert").alert(); $("#tax-name-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#tax-name-blank-alert").hide(); }); $('#product_tax_table tbody tr:eq('+curindex1+') td:eq(0) select').focus(); return false; - } - if ($('#product_tax_table tbody tr:eq('+curindex1+') td:eq(2) input').val()=="") { - $("#tax-rate-blank-alert").alert(); + } + if (!$.isNumeric($('#product_tax_table tbody tr:eq('+curindex1+') td:eq(2) input').val())) { + $("#tax-rate-blank-alert").alert(); $("#tax-rate-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#tax-rate-blank-alert").hide(); }); @@ -917,68 +792,18 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) return false; } - $('#product_tax_table tbody').append(''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''); - $(".tax_rate").numeric(); - if (selectedtaxname == "CVAT" || selectedtaxname == "IGST" ) { - $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select option[value='+selectedtaxname+']').prop('hidden', true).prop('disabled', true); - } + $('#product_tax_table tbody').append(taxfieldhtml); + $('#product_tax_table tbody tr:eq('+nextindex1+') td:last').append(delhtml); + $(".tax_rate").numeric(); + for (let j = 0; j < curindex1 + 1; j++) { + var selectedtax = $("#product_tax_table tbody tr:eq("+j+") td:eq(0) select option:selected").val(); + if (selectedtax != "VAT") { + for (let i=j+1; i<=curindex1+1;i++){ + $('#product_tax_table tbody tr:eq('+i+') td:eq(0) select option[value='+selectedtax+']').remove(); + } + } + } + $(".tax_name:last").change(); $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } } @@ -1429,7 +1254,7 @@ else{ } }); - if(taxes.length == '0'){ + if(taxes.length == '0' && $("#product_tax_table").length > 0){ if($("#additem option:selected").val() == 7){ $("#tax-alert").alert(); $("#tax-alert").fadeTo(2250, 500).slideUp(500, function(){ diff --git a/gkwebapp/static/js/addproductvat.js b/gkwebapp/static/js/addproductvat.js index 8dbe8a41a510205eae62d1edf9c731402ab368a7..9ca1382cbfa9b2fa11965b98fde74ecf769bbc67 100644 --- a/gkwebapp/static/js/addproductvat.js +++ b/gkwebapp/static/js/addproductvat.js @@ -147,7 +147,12 @@ $(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) { $("#spec_table tbody tr:first td:eq(1) input:first").focus(); } else { - $("#product_tax_table tbody tr:first td:eq(0) select").focus(); + if ($("#product_tax_table").length > 0) { + $("#product_tax_table tbody tr:first td:eq(0) select").focus(); + } + else{ + $("#godownflag").focus(); + } } } else if (event.which==32) diff --git a/gkwebapp/static/js/createcustsuppopup.js b/gkwebapp/static/js/createcustsuppopup.js index c8e208fcfc5e0778dd0791d2e8e77e39750467cf..6137e3a3129d2d1e71aa5cb2c2e461f28b77f607 100644 --- a/gkwebapp/static/js/createcustsuppopup.js +++ b/gkwebapp/static/js/createcustsuppopup.js @@ -29,7 +29,8 @@ Contributors: $(document).ready(function() { $("#add_cussup_name").focus(); - + var gstinstring = ""; + $("#add_cussup_name").keydown(function(event) { if (event.which==13) { if ($.trim($("#add_cussup_name").val())=="") { @@ -104,7 +105,12 @@ $("#add_state").keydown(function(event) { } else if (event.which==13) { event.preventDefault(); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); + if ($.trim($("#add_cussup_pan").val()) !="") { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:last').focus(); + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').focus(); + } } else if (event.which==27) { event.preventDefault(); @@ -112,18 +118,59 @@ $("#add_state").keydown(function(event) { } }); - $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { - var curindex = $(this).closest('tr').index(); - var gstin = $(this).val(); - var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstnint < 0 || gstin.length !=15){ - $("#gstin-improper-alert-modal").alert(); - $("#gstin-improper-alert-modal").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-improper-alert-modal").hide(); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); - }); - return false; - } + //Change event on GSTIN State + $(document).off('change', '.gstinstate').on('change', '.gstinstate', function(event) { + event.preventDefault(); + var curindex = $(this).closest('tr').index(); + var cusstatecode = $('#gstintable tbody tr:eq('+curindex+') td:eq(0) select option:selected').attr("stateid"); + if (cusstatecode.length == 1){ + cusstatecode = "0" + cusstatecode; + } + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val(cusstatecode); //for state code + if ($('#add_cussup_pan').val() != ''){ + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val($('#add_cussup_pan').val()).prop("disabled",true); //for pan + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').prop("disabled",false); + } + + }); + + //Keydown event on gstin's panno + $(document).off("keydown", ".panno").on("keydown", ".panno", function(event) { + var curindex = $(this).closest('tr').index(); + var previndex = curindex-1; + if (event.which == 13) { + event.preventDefault(); + if($(this).val() != '') { + $(this).next('input').focus().select(); + + } + else { + $("#panno-blank-alert").alert(); + $("#panno-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#panno-blank-alert").hide(); + $(this).focus().select(); + }); + return false; + } + } + }); + + $(document).off("change",".gstin").on("change",".gstin",function(event) { + var curindex = $(this).closest('tr').index(); + gstinstring = gstinstring = $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + }); $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) @@ -132,30 +179,26 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) var nextindex1 = curindex1+1; var previndex1 = curindex1-1; var selectedstate = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"); - var numberofstates = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:not(:hidden)').length-1; + var numberofstates = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:not(:hidden)').length-1; if (event.which==13) { - event.preventDefault(); + event.preventDefault(); if (curindex1 != ($("#gstintable tbody tr").length-1)) { $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } - else { + else { + gstinstring = gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } if (numberofstates > 0) { - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="") { - $("#state-blank-alert").alert(); - $("#state-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#state-blank-alert").hide(); - }); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select').focus(); - return false; - } - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val()=="") { - $("#gstin-blank-alert").alert(); - $("#gstin-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-blank-alert").hide(); - }); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus(); - return false; - } + $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); if (curindex1 == 0) { $("#gstintable tbody tr:last td:last").append(''); @@ -184,7 +227,7 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) } else if (event.ctrlKey && event.which==188) { event.preventDefault(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select').focus(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) input:eq(1)').focus(); } else if (event.which==190 && event.ctrlKey) { event.preventDefault(); @@ -243,14 +286,26 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { $("#add_cussup_address").focus().select(); } }); + $("#add_cussup_pan").keydown(function(event) { if (event.which==13) { event.preventDefault(); - if($("#vatorgstflag").val() == '22'|| $("#vatorgstflag").val() =='29' ){ - $("#add_cussup_tan").focus().select(); + var regExp = /[a-zA-z]{5}\d{4}[a-zA-Z]{1}/; //regEx for PAN + var txtpan = $(this).val(); + if ((txtpan.length != 10 || !txtpan.match(regExp)) && $.trim($("#add_cussup_pan").val())!="") { + $("#pan-incorrect-alert").alert(); + $("#pan-incorrect-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#pan-incorrect-alert").hide(); + }); + $("#add_cussup_pan").focus(); } else { - $(".gstinstate:first").focus(); + if($("#vatorgstflag").val() == '22' || $("#vatorgstflag").val() == '29'){ + $("#add_cussup_tan").focus(); + } + else { + $(".gstinstate:first").focus(); + } } } if (event.which==38) { @@ -309,11 +364,11 @@ else{ $("#add_cussup_pan").focus().select(); } }); - + $("#cussup_save").click(function(event) { //save event for saving the customer/supplier event.preventDefault(); - + var custsupval; if ($("#deliverychallan_gkstatus").val()=='in' || $('#status').val()=='9') { custsupval= 19; @@ -330,7 +385,7 @@ else{ else { groupcode = $("#credgroupcode").val(); } - + if ($.trim($("#add_cussup_name").val())=="") { $("#name-blank-alert").alert(); $("#name-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -356,25 +411,24 @@ else{ $("#add_cussup_address").focus(); return false; } - var gobj = {}; // Creating a dictionary for storing godown wise opening stock + var gobj = {}; // Creating a dictionary for storing statecode with gstin. $("#gstintable tbody tr").each(function(){ - var curindex1 = $(this).index(); - if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"))!="") { - if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val())!="") { - var gstin = $.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val()); - var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstnint < 0){ - allow = 0; - $("#gstin-improper-alert").alert(); - $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus().select(); - }); - return false; - } - gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val(); - } + var curindex1 = $(this).index(); + if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"))!="") { + gstinstring = gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; } + } + + gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] = gstinstring; + } }); var custtan = ""; if ($("#add_cussup_tan").length > 0) { diff --git a/gkwebapp/static/js/createuser.js b/gkwebapp/static/js/createuser.js index 489ce32099c385ab53648a91264fe7f08dc3ac3c..aa29bbadda0b3f9ff004e070e5f9e3c93ce65d37 100644 --- a/gkwebapp/static/js/createuser.js +++ b/gkwebapp/static/js/createuser.js @@ -28,7 +28,7 @@ $(document).ready(function(){ $("#msspinmodal").on('hidden.bs.modal', function(event) { $("#name").focus(); }); - $("#userrole option[value=3]").hide(); + //$("#userrole option[value=3]").hide(); if (sessionStorage.invflag==1) { $.ajax( { diff --git a/gkwebapp/static/js/editcategory.js b/gkwebapp/static/js/editcategory.js index f6d6c7d0db63ddad7578232aa8a08f53964cafce..7052c37a3bfddf51c712009d35e4e093af3b13c5 100644 --- a/gkwebapp/static/js/editcategory.js +++ b/gkwebapp/static/js/editcategory.js @@ -104,7 +104,7 @@ $(document).ready(function() { $('#category_edit_tax_table tbody tr:last').attr({value: tax["taxid"]}); $('#category_edit_tax_table tbody tr:last td:eq(0) select').val(tax["taxname"]); $('#category_edit_tax_table tbody tr:last td:eq(1) select').val(tax["state"]); - if(tax["taxname"] == "CVAT" || tax["taxname"] == "IGST"){ + if(tax["taxname"] != "VAT"){ $('#category_edit_tax_table tbody tr:last td:eq(1) select').prop("disabled", true); } $('#category_edit_tax_table tbody tr:last td:eq(2) input').val(tax["taxrate"]); @@ -116,7 +116,7 @@ $(document).ready(function() { $('#category_edit_tax_table tbody').append(taxfieldhtml); $(".tax_del:first").hide(); } - + }) .fail(function() { console.log("error"); @@ -290,8 +290,34 @@ $(document).ready(function() { $('#category_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').focus(); event.preventDefault(); } - else if (($("#category_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='CVAT' || $("#category_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='IGST') && event.which==13 ) { + else if (($("#category_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val() !='VAT') && event.which==13 ) { event.preventDefault(); + var types = []; + $('#category_edit_tax_table tbody tr').each(function(){ + if($(".tax_name",this).val()=='IGST') { + types.push($(".tax_name",this).val()); + } + if($(".tax_name",this).val()=='CESS') { + types.push($(".tax_name",this).val()); + } + if ($(".tax_name",this).val()=='CVAT') { + types.push($(".tax_name",this).val()); + } + }); + types.sort(); + var duplicatetypes = []; + for (var i = 0; i < types.length - 1; i++) { + if (types[i + 1] == types[i]) { + duplicatetypes.push(types[i]); + } + } + if (duplicatetypes.length > 0) { + $("#cvat-alert").alert(); + $("#cvat-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#cvat-alert").hide(); + }); + return false; + } $('#category_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').prop("disabled", true); $('#category_edit_tax_table tbody tr:eq('+curindex+') td:eq(2) input').focus().select(); } diff --git a/gkwebapp/static/js/editclone.js b/gkwebapp/static/js/editclone.js index 64d5dfd44c16f2158537dc97ec2d2568da326078..8fd8d3c19c85b5c05e81f772140a3e4028b8db00 100644 --- a/gkwebapp/static/js/editclone.js +++ b/gkwebapp/static/js/editclone.js @@ -27,7 +27,29 @@ Contributors: $(document).ready(function() { - $("#instrumentbtn2").hide(); + + // Following ajax will fetch user data and make changes accordingly. + $.ajax({ + url: '/orgdata', + type: 'POST', + global: false, + async: false, + datatype: 'json', + beforeSend: function(xhr) + { + xhr.setRequestHeader('gktoken', sessionStorage.gktoken); + } + }) + .done(function(resp){ + if(resp["gkresult"]["userrole"]==2){ // If the user role is an Internal Auditor then Lock, Edit, Clone & Delete buttons are hidden. + $("#lock").remove(); + $("#edit").remove(); + $("#clone").remove(); + $("#delete").remove(); + } + }); + + $("#instrumentbtn2").hide(); function getBalance( accountcode, calculateTo ){ var bal = ''; $.ajax({ @@ -58,7 +80,6 @@ $(document).ready(function() return bal; } - if (($('#m_vtype').val()=="sales" || $('#m_vtype').val()=="purchase") && sessionStorage.invflag==1) { if ($("#viewinvsel").length > 0){ @@ -612,7 +633,7 @@ $(document).ready(function() return str.length < max ? pad("0" + str, max) : str; } else{ - return str + return str; } } function yearpad (str, max) { @@ -624,7 +645,7 @@ $(document).ready(function() return str.length < max ? pad("20" + str, max) : str; } else{ - return str + return str; } } @@ -702,7 +723,7 @@ $(document).ready(function() $('#vdate').focus().select(); return false; } - var curdate = Date.parseExact($("#vyear").val()+$("#vmonth").val()+$("#vdate").val(), "yyyyMMdd") + var curdate = Date.parseExact($("#vyear").val()+$("#vmonth").val()+$("#vdate").val(), "yyyyMMdd"); if (!curdate.between(financialstart,financialend)) { $("#between-date-alert").alert(); $("#between-date-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -1477,7 +1498,7 @@ $('#vctable tbody tr:last td:eq(2) input').val(getBalance(curacccode, caldata)); diff=crsum-drsum; if(curindex' + rowhtml + ''); for(var gstin in result["gstin"]){ + var gstinstr = result["gstin"][gstin]; $('#gstintable tbody tr:last td:eq(0) select option[stateid='+gstin+']').prop("selected", true); - $('#gstintable tbody tr:last td:eq(1) input').val(result["gstin"][gstin]); + $('#gstintable tbody tr:last td:eq(1) input:eq(0)').val(gstinstr.substring(0, 2)); + $('#gstintable tbody tr:last td:eq(1) input:eq(1)').val(gstinstr.substring(2, 12)); + $('#gstintable tbody tr:last td:eq(1) input:eq(2)').val(gstinstr.substring(12, 15)); $('#gstintable tbody').append('' + rowhtml + ''); } for(var i = 0; i < $("#gstintable tbody tr").length; i++) { @@ -60,7 +65,7 @@ $(document).ready(function() { } } } - $(".gstinstate, .gstin").prop("disabled", true); + $(".gstinstate, .statecode, .panno, .gstin").prop("disabled", true); $(".panel-footer").show(); $("#cus_innerdiv").show(); $("#cussup_edit_save").hide(); @@ -186,7 +191,23 @@ $(document).ready(function() { $("#edit_cussup_pan").keydown(function(event) { if (event.which==13) { event.preventDefault(); - $("#edit_cussup_tan").focus().select(); + var regExp = /[a-zA-z]{5}\d{4}[a-zA-Z]{1}/; //Regular expression for PAN + var txtpan = $(this).val(); + if ((txtpan.length != 10 || !txtpan.match(regExp)) && $.trim($("#edit_cussup_pan").val())!="") { + $("#pan-incorrect-alert").alert(); + $("#pan-incorrect-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#pan-incorrect-alert").hide(); + }); + $("#edit_cussup_pan").focus(); + } + else { + if($("#vatorgstflag").val() == '22' || $("#vatorgstflag").val() == '29'){ + $("#edit_cussup_tan").focus(); + } + else { + $(".gstinstate:first").focus(); + } + } } if (event.which==38){ event.preventDefault(); @@ -237,25 +258,72 @@ $(document).ready(function() { } else if (event.which==13) { event.preventDefault(); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); + if ($.trim($("#edit_cussup_pan").val()) !="") { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').focus(); + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').focus().select(); + } } else if (event.which==27) { event.preventDefault(); $("#cussup_edit_save").focus(); } }); - $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { - var curindex = $(this).closest('tr').index(); - var gstin = $(this).val(); - var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstnint < 0 || gstin.length !=15){ - $("#gstin-improper-alert").alert(); - $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); - }); - return false; - } + +//Change event on GSTIN State + $(document).off('change', '.gstinstate').on('change', '.gstinstate', function(event) { + event.preventDefault(); + var curindex = $(this).closest('tr').index(); + var cusstatecode = $('#gstintable tbody tr:eq('+curindex+') td:eq(0) select option:selected').attr("stateid"); + if (cusstatecode.length == 1){ + cusstatecode = "0" + cusstatecode; + } + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val(cusstatecode); //for state code + if ($('#edit_cussup_pan').val() != ''){ + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val($('#edit_cussup_pan').val()).prop("disabled",true); //for pan + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').prop("disabled",false); + } + + }); + + //Keydown event on gstin's panno + $(document).off("keydown", ".panno").on("keydown", ".panno", function(event) { + var curindex = $(this).closest('tr').index(); + var previndex = curindex-1; + if (event.which == 13) { + event.preventDefault(); + if($(this).val() != '') { + $(this).next('input').focus().select(); + + } + else { + $("#panno-blank-alert").alert(); + $("#panno-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#panno-blank-alert").hide(); + $(this).focus().select(); + }); + return false; + } + } + }); + + $(document).off("change",".gstin").on("change",".gstin",function(event) { + var curindex = $(this).closest('tr').index(); + gstinstring = $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + }); $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) @@ -270,24 +338,20 @@ $(document).ready(function() { if (curindex1 != ($("#gstintable tbody tr").length-1)) { $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } - else { + else { + gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } if (numberofstates > 0) { - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="") { - $("#state-blank-alert").alert(); - $("#state-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#state-blank-alert").hide(); - }); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select').focus(); - return false; - } - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val()=="") { - $("#gstin-blank-alert").alert(); - $("#gstin-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#gstin-blank-alert").hide(); - }); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus(); - return false; - } + $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); if (curindex1 == 0) { $("#gstintable tbody tr:last td:last").append(''); @@ -316,7 +380,7 @@ $(document).ready(function() { } else if (event.ctrlKey && event.which==188) { event.preventDefault(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select').focus(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').focus(); } else if (event.which==190 && event.ctrlKey) { event.preventDefault(); @@ -349,7 +413,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { $("#edit_cussup_fax").prop("disabled", false); $("#edit_cussup_pan").prop("disabled", false); $("#edit_cussup_tan").prop("disabled", false); - $(".gstinstate, .gstin").prop("disabled",false); + $(".gstinstate, .panno, .gstin").prop("disabled",false); $("#edit_state").prop("disabled", false); }); $(document).keyup(function(event) { @@ -361,7 +425,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { }); $("#cussup_edit_save").click(function(event) { var allow = 1; - + if ($.trim($("#edit_cussup_name").val())=="") { $("#name-blank-alert").alert(); $("#name-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -395,25 +459,23 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { $("#edit_cussup_tan").focus(); return false; } */ - var gobj = {}; // Creating a dictionary for storing godown wise opening stock + var gobj = {}; // Creating a dictionary for storing statecode with gstin. $("#gstintable tbody tr").each(function(){ var curindex1 = $(this).index(); if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"))!="") { - if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val())!="") { - var gstin = $.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val()); - var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstnint < 0 || gstin.length !=15){ - allow = 0; - $("#gstin-improper-alert").alert(); - $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + gstinstring = gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus().select(); - }); - return false; - } - gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').val(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] =gstinstring; } - } }); let custtan = ""; if ($("#edit_cussup_tan").length > 0){ @@ -503,7 +565,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { }); $("#cussup_delete").click(function(event) { event.preventDefault(); - + $('.modal-backdrop').remove(); $('.modal').modal('hide'); $('#confirm_del').modal('show').one('click', '#accdel', function (e) @@ -521,7 +583,7 @@ $("#cussup_delete").click(function(event) { xhr.setRequestHeader('gktoken',sessionStorage.gktoken ); }, success: function(resp) - + { if (resp["gkstatus"]==0) { $("#customersupplier_edit").click(); diff --git a/gkwebapp/static/js/editinvoice.js b/gkwebapp/static/js/editinvoice.js index 3c8131d660f587731eb051ad28dad7fefd528cb1..96a330c85bffada47d0d39815f0c85bae94c307e 100644 --- a/gkwebapp/static/js/editinvoice.js +++ b/gkwebapp/static/js/editinvoice.js @@ -30,7 +30,7 @@ Contributors: $(document).ready(function() { $('.modal-backdrop').remove(); $('.invoicedate').autotab('number'); - $("#invselect").focus(); + $("select:first").focus(); $("#invoice_editprint").hide(); var dcno = ''; var pqty = 0.00; diff --git a/gkwebapp/static/js/editorganisation.js b/gkwebapp/static/js/editorganisation.js index a8d58986538a59706ccf5369e594fd644b60d475..7859100bf7e0ec9825164f3d3194dbca754041e1 100644 --- a/gkwebapp/static/js/editorganisation.js +++ b/gkwebapp/static/js/editorganisation.js @@ -5,7 +5,7 @@ Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation GNUKhata is Free Software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version.and old.stockflag = 's' + the License, or (at your option) any later version. GNUKhata is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,8 +28,29 @@ Contributors: $(document).ready(function(){ $("#msspinmodal").modal("hide"); $(".regdate").autotab('number'); - $(".fcradate").autotab('number'); + $(".fcradate").autotab('number'); + var gstinstring = ""; // for cocatination of GSTIN. + for(var i = 0; i < $("#gstintable tbody tr").length; i++) { + var state = $("#gstintable tbody tr:eq("+i+") td:eq(0) select").attr("stateid"); + $("#gstintable tbody tr:eq("+i+") td:eq(0) select option[stateid="+state+"]").prop("selected", true); + + var gstinstr =$('#gstintable tbody tr:eq('+i+') td:eq(1) input:eq(0)').val(); + $('#gstintable tbody tr:eq('+i+') td:eq(1) input:eq(0)').val(gstinstr.substring(0, 2)); + $('#gstintable tbody tr:eq('+i+') td:eq(1) input:eq(1)').val(gstinstr.substring(2, 12)); + $('#gstintable tbody tr:eq('+i+') td:eq(1) input:eq(2)').val(gstinstr.substring(12, 15)); + + $("#gstintable tbody tr:eq(" + i +") td:last").append(''); + + } + if(sessionStorage.vatorgstflag == '22' ){ + $(".gstinfield").hide(); + $(".tinfield").show(); + } else { + $(".gstinfield").show(); + } + if($("#state").val() != "" ){ + $("#orgstate").val($("#state").val());} $(".regdate").numeric({negative: false}); $(".fcradate").numeric({negative: false}); @@ -42,7 +63,401 @@ $(document).ready(function(){ $("#orgaddr").focus().select(); } - $('input:visible, textarea').keydown(function(event){ + // Add GSTIN modal + $('#addgstinmodal').on('shown.bs.modal', function() { + $("#gstintable tbody tr:first td:eq(0) select").focus(); + }); + + +$(document).off("keydown",".gstinstate").on("keydown",".gstinstate",function(event) +{ + var curindex = $(this).closest('tr').index(); + var nextindex = curindex+1; + var previndex = curindex-1; + if (event.which==13) { + event.preventDefault(); + if ($.trim($("#orgpan").val()) !="") { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:last').focus(); + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').focus(); + } + } + else if (event.which==27) { + event.preventDefault(); + $("#gstin_done").focus(); + } +}); + +//Change event on GSTIN State + $(document).off('change', '.gstinstate').on('change', '.gstinstate', function(event) { + event.preventDefault(); + var curindex = $(this).closest('tr').index(); + var cusstatecode = $('#gstintable tbody tr:eq('+curindex+') td:eq(0) select option:selected').attr("stateid"); + if (cusstatecode.length == 1){ + cusstatecode = "0" + cusstatecode; + } + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val(cusstatecode); //for state code + if ($('#orgpan').val() != ''){ + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val($('#orgpan').val()).prop("disabled",true); //for pan + } + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').prop("disabled",false); + } + + }); + + //Keydown event on gstin's panno + $(document).off("keydown", ".panno").on("keydown", ".panno", function(event) { + var curindex = $(this).closest('tr').index(); + var previndex = curindex-1; + if (event.which == 13) { + event.preventDefault(); + if($(this).val() != '') { + $(this).next('input').focus().select(); + + } + else { + $("#panno-blank-alert").alert(); + $("#panno-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#panno-blank-alert").hide(); + $(this).focus().select(); + }); + return false; + } + } + }); + + $(document).off("change",".gstin").on("change",".gstin",function(event) { + var curindex = $(this).closest('tr').index(); + gstinstring = $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + + }); + + + $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) +{ + var curindex1 = $(this).closest('tr').index(); + var nextindex1 = curindex1+1; + var previndex1 = curindex1-1; + var selectedstate = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"); + var numberofstates = $('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:not(:hidden)').length-1; + if (event.which==13) { + event.preventDefault(); + if (curindex1 != ($("#gstintable tbody tr").length-1)) { + $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); + } + else { + gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + if (numberofstates > 0) { + $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); + $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select option[stateid='+selectedstate+']').prop('hidden', true).prop('disabled', true); + $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select option[value=""]').prop('selected', true); + $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); + } + else { + $("#gstin_done").focus(); + } + } + } + else if(event.which==190 && event.shiftKey) + { + event.preventDefault(); + $('#gstintable tbody tr:eq('+nextindex1+') td:eq(1) input').focus().select(); + } + else if (event.which==188 && event.shiftKey) + { + if(previndex1>-1) + { + event.preventDefault(); + $('#gstintable tbody tr:eq('+previndex1+') td:eq(1) input').focus().select(); + } + } + else if (event.ctrlKey && event.which==188) { + event.preventDefault(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').focus(); + } + else if (event.which==190 && event.ctrlKey) { + event.preventDefault(); + $('#gstintable tbody tr:eq('+nextindex1+') td:eq(0) select').focus(); + } + else if (event.which==27) { + event.preventDefault(); + $("#gstin_done").focus(); + } +}); + + $(document).off("click",".state_del").on("click", ".state_del", function() { + $(this).closest('tr').fadeOut(200, function(){ + $(this).closest('tr').remove(); //closest method gives the closest element specified + $('#gstintable tbody tr:last td:eq(0) select').focus().select(); + }); + $('#gstintable tbody tr:last td:eq(0) select').select(); +}); + //Keydown event start here + $("#orgaddr").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgcountry").focus().select(); + } + }); + + $("#orgregno").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgfcrano").focus().select(); + } + }); + + $("#orgfcrano").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgaddr").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgregno").focus().select(); + } + }); + + $("#orgcountry").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgstate").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgaddr").focus().select(); + } + }); + + $("#orgstate").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgcity").focus().select(); + } + if (event.which==38 && $("#add_state option:selected").index()==0) { + event.preventDefault(); + $("#orgcountry").focus().select(); + } + }); + + $("#orgcity").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgstax").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgstate").focus().select(); + } + }); + + $("#orgstax").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgpan").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgcity").focus().select(); + } + }); + + $("#regday").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#regmonth").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgpan").focus().select(); + } + }); + + $("#regmonth").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#regyear").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#regday").focus().select(); + } + }); + + $("#regyear").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#fcraregday").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#regmonth").focus().select(); + } + }); + + $("#fcraregday").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#fcraregmonth").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#regyear").focus().select(); + } + }); + + $("#fcraregmonth").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#fcraregyear").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#fcraregday").focus().select(); + } + }); + + $("#fcraregyear").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgemail").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#fcraregmonth").focus().select(); + } + }); + + // Validation for PAN + $("#orgpan").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + var regExp = /[a-zA-z]{5}\d{4}[a-zA-Z]{1}/; + var txtpan = $(this).val(); + if ((txtpan.length != 10 || !txtpan.match(regExp)) && $.trim($("#orgpan").val())!="") { + $("#pan-incorrect-alert").alert(); + $("#pan-incorrect-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#pan-incorrect-alert").hide(); + }); + $("#orgpan").focus(); + } + else { + if ($("#orgtype").val()=="Not For Profit"){ + $("#regday").focus(); + + } + else { + $("#orgemail").focus(); + } + } + } + if (event.which==38) { + event.preventDefault(); + $("#orgstax").focus().select(); + } + }); + + $("#orgemail").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgtelno").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + if ($("#orgtype").val()=="Not For Profit"){ + $("#fcraregyear").focus(); + + } + else { + $("#orgpan").focus().select(); + } + } + }); + + $("#orgtelno").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgwebsite").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgemail").focus().select(); + } + }); + + $("#orgwebsite").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgpincode").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgtelno").focus().select(); + } + }); + + + $("#orgpincode").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgfax").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgwebsite").focus().select(); + } + }); + + $("#orgfax").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + $("#orgmvat").focus().select(); + } + if (event.which==38) { + event.preventDefault(); + $("#orgpincode").focus().select(); + } + }); + + $("#orgmvat").keydown(function(event) { + if (event.which==13) { + event.preventDefault(); + if($("#vatorgstflag").val() == '7' || $("#vatorgstflag").val() == '29'){ + $("#orggstin").focus(); + } + else { + $("#submit").focus(); + } + } + if (event.which==38) { + event.preventDefault(); + $("#orgfax").focus().select(); + } + }); + + /**$('input:visible, textarea').keydown(function(event){ var n =$('input:visible,textarea').length; var f= $('input:visible, textarea'); if (event.which == 13) @@ -60,7 +475,7 @@ $(document).ready(function(){ f[prevIndex].focus().select(); } } - }); + });**/ $("#reset").click(function() { @@ -107,6 +522,29 @@ $(document).ready(function(){ } } } + + + var gobj = {}; // Creating a dictionary for storing statecode with gstin. + $("#gstintable tbody tr").each(function(){ + var curindex1 = $(this).index(); + if ($.trim($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid"))!="") { + gstinstring = $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(0)').val() +$('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(1)').val() + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').val(); + if(gstinstring != ''){ + if(gstinstring.length !=15){ + $("#gstin-improper-alert").alert(); + $("#gstin-improper-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#gstin-improper-alert").hide(); + $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input:eq(2)').focus().select(); + }); + return false; + } + } + + gobj[$('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').attr("stateid")] = gstinstring; + } + + }); + var form_data = new FormData(); form_data.append("orgcity", $("#orgcity").val()); form_data.append("orgaddr", $("#orgaddr").val()); @@ -119,7 +557,8 @@ $(document).ready(function(){ form_data.append("orgemail",$("#orgemail").val()); form_data.append("orgpan",$("#orgpan").val()); form_data.append("orgmvat",$("#orgmvat").val()); - form_data.append("orgstax",$("#orgstax").val()); + form_data.append("orgstax",$("#orgstax").val()); + form_data.append("gstin",JSON.stringify(gobj)); //for gstin form_data.append("orgregno",regno); form_data.append("orgregdate",regdate); form_data.append( "orgfcrano",fcrano); @@ -193,5 +632,8 @@ $(document).ready(function(){ .always(function() { console.log("complete"); }); + $("#gstin_done").click(function(event) { + $('#addgstinmodal').modal('hide'); + }); }); diff --git a/gkwebapp/static/js/editproduct.js b/gkwebapp/static/js/editproduct.js index 10ebab3ba156ec2cfbf6f3656e7d2ae2fa34bb4f..59b3f0ee3e69119a355b57fa614e845a95e62966 100644 --- a/gkwebapp/static/js/editproduct.js +++ b/gkwebapp/static/js/editproduct.js @@ -7,9 +7,11 @@ $(document).ready(function() { var specdate; var selectedgodown; var selectedtaxname; - var selectedtaxstate; + var selectedtaxstate; + var taxhtml; + var stateshtml; $("#prodselect").focus(); - $(".product_tax_disable").prop('disabled',true); + $(".product_tax_disable").prop('disabled',true); $(".product_cat_tax_disable").prop('disabled',true); $(document).off('focus', '.numtype').on('focus', '.numtype', function(event) { event.preventDefault(); @@ -17,15 +19,15 @@ $(document).ready(function() { $(".numtype").numeric(); }); - - if(sessionStorage.invflag==0){ + + if(sessionStorage.invflag==0){ $(".noinventory").hide(); $("#taxhelp3").hide(); $("#taxhelp4").show(); - + } - $(document).off('blur', '.numtype').on('blur', '.numtype', function(event) { + $(document).off('blur', '.numtype').on('blur', '.numtype', function(event) { event.preventDefault(); /* Act on the event */ if ($(this).val()=="" && !$(this).hasClass("hsn")) @@ -58,9 +60,30 @@ $(document).ready(function() { e.preventDefault(); if ($("#numberofspecs").val() > 0) { $("#spec_table tbody tr:first td:eq(1) input:first").focus(); + } + else { + if ($('#product_edit_tax_table').length > 0){ + $('#product_edit_tax_table tbody tr:first td:eq(0) select').focus(); + } + else { + if($('#gsflag').val() == '7') { + if ($("#editgodownpresence").val() == 0) { + $("#editopeningstock").focus().select(); + } + else { + if ($("#editgodownflag").val() == 1) { + $('#editgodown_ob_table tbody tr:first td:eq(0) select').focus().select(); + } + else if ($("#editgodownflag").val() == 0) { + $("#editgodownflag").focus().select(); + } + } + } else { - $('#product_edit_tax_table tbody tr:first td:eq(0) select').focus(); + $("#epsubmit").focus(); + } + } } } if (e.which == 38) { @@ -134,7 +157,7 @@ $(document).ready(function() { } else { $("#editproddesc").focus().select(); - + } @@ -158,15 +181,20 @@ $(document).ready(function() { $("#prodselect").focus(); } }); - $(document).on('keydown', '#gscode', function(event) { + $(document).on('keydown', '#gscode', function(event) { if (event.which==13) { event.preventDefault(); if($("#gsflag").val()=='7'){ $("#edituom").focus(); } - else{ -$("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); + else{ + if ($("#product_edit_tax_table").length > 0) { + $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); + } + else{ + $("#epsubmit").focus(); + } } } }); @@ -207,7 +235,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $("#editgodownflag").focus().select(); } else { - $(".editgodown_ob").eq(n-1).focus().select(); + $(".editgodown_ob").eq(n-1).focus().select(); } } else if (event.which==173) { @@ -286,22 +314,22 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); .done(function(resp) { console.log("success"); if (resp["gkresult"].length > 0) { - var taxhtml = $('#product_edit_tax_table tbody tr:first').html(); + taxhtml = $('#product_edit_tax_table tbody tr:first').html(); + stateshtml = $('#product_edit_tax_table tbody tr:first td:eq(1) select').html(); + $('#product_edit_tax_table tbody tr:first').remove(); - $('#product_edit_tax_table tbody tr').remove(); - for (tax of resp["gkresult"]) { - $('#product_edit_tax_table tbody').append(''+ taxhtml + ''); + $('#product_edit_tax_table tbody').append(''+ taxhtml + ''); $('#product_edit_tax_table tbody tr:last td:last').append(''); - $(".product_tax_disable").prop('disabled',true); - $('#product_edit_tax_table tbody tr:last td:eq(1) select').val(tax["state"]); + $('#product_edit_tax_table tbody tr:last td:eq(1) select').val(tax["state"]); $('#product_edit_tax_table tbody tr:last td:eq(0) select').val(tax["taxname"]); $('#product_edit_tax_table tbody tr:last td:eq(2) input').val(tax["taxrate"]); } + $(".tax_del:first").hide(); } - existingnonetax = resp["gkresult"]; + existingnonetax = resp["gkresult"]; }) .fail(function() { console.log("error"); @@ -484,11 +512,11 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); event.preventDefault(); if ($("#catg").val()){ $("#editcatselect").focus(); - + } else { $("#editproddesc").focus().select(); - + } $(".godownflag").show(); @@ -496,7 +524,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $(".product_cat_tax_disable").prop('disabled',false); $(".product_tax_disable").prop('disabled',false); $("#product_edit_tax_table tbody tr").each(function() { - if($('td:eq(0) select option:selected', this).val() == 'CVAT' || $('td:eq(0) select option:selected', this).val() =='IGST' ){ + if($('td:eq(0) select option:selected', this).val() == 'CVAT' || $('td:eq(0) select option:selected', this).val() =='IGST' || $('td:eq(0) select option:selected', this).val() =='CESS' ){ $('td:eq(1) select', this).prop('disabled', true); } }); @@ -648,13 +676,16 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $('#product_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').focus(); event.preventDefault(); } - else if (($("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='CVAT' || $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val() =='IGST' ) && event.which==13 ) { + else if (($("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()!='VAT') && event.which==13 ) { event.preventDefault(); var types = []; $('#product_edit_tax_table tbody tr').each(function(){ if($(".tax_name",this).val()=='IGST') { types.push($(".tax_name",this).val()); } + if($(".tax_name",this).val()=='CESS') { + types.push($(".tax_name",this).val()); + } if ($(".tax_name",this).val()=='CVAT') { types.push($(".tax_name",this).val()); } @@ -706,65 +737,27 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $(document).off("change",".tax_name").on("change",".tax_name",function(event) { - var curindex = $(this).closest('tr').index(); - var previndex = curindex -1; - if ($("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='VAT') { - $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); - $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '').prop('disabled', false); - if (curindex > 0) { - for (var i = 1; i < curindex+1; i++) { - for (var j = 0; j < curindex; j++) { - if ($("#product_edit_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "CVAT" || $("#product_edit_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "IGST") { - i = i + 1; - } - selectedtaxstate = $("#product_edit_tax_table tbody tr:eq("+j+") td:eq(1) select option:selected").attr("stateid"); - $('#product_edit_tax_table tbody tr:eq('+i+') td:eq(1) select option[stateid='+selectedtaxstate+']').prop('hidden', true).prop('disabled', true); + var curindex = $(this).closest('tr').index(); + if ($("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='VAT') { + $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); + $('#product_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').prop("disabled", false); + $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(stateshtml); + $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select option:visible").first().prop("selected", true); + } + else { + $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); + $('#product_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').prop("disabled", true); + $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(''); + } + var previndex = curindex -1; + for (let j = 0; j < curindex + 1; j++) { + if ($("#product_edit_tax_table tbody tr:eq("+j+") td:eq(0) select option:selected").val() == "VAT") { + var selectedtaxstate = $("#product_edit_tax_table tbody tr:eq("+j+") td:eq(1) select option:selected").attr("stateid"); + for (let i=j+1; i<=curindex+1;i++){ + $('#product_edit_tax_table tbody tr:eq('+i+') td:eq(1) select option[stateid='+selectedtaxstate+']').remove(); + } } - } } - } - else { - $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").empty(); - $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append('').prop('disabled',true); - } - selectedtaxname = $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val(); }); $(document).off("keydown",".tax_state").on("keydown",".tax_state",function(event) @@ -794,26 +787,6 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); } else if (event.which==13) { event.preventDefault(); - var edittaxstates = []; - $('#product_edit_tax_table tbody tr').each(function(){ - edittaxstates.push($(".tax_state",this).val()); - }); - if (edittaxstates.length>1) { - edittaxstates.sort(); - var duplicatestates = []; - for (var i = 0; i < edittaxstates.length - 1; i++) { - if (edittaxstates[i+1] == edittaxstates[i]) { - duplicatestates.push(edittaxstates[i]); - } - } - if (duplicatestates.length > 0) { - $("#tax-same-alert").alert(); - $("#tax-same-alert").fadeTo(2250, 500).slideUp(500, function(){ - $("#tax-same-alert").hide(); - }); - return false; - } - } $('#product_edit_tax_table tbody tr:eq('+curindex+') td:eq(2) input').focus().select(); } }); @@ -825,30 +798,6 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); var previndex1 = curindex1-1; if (event.which==13) { event.preventDefault(); - if ($('#product_edit_tax_table tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="IGST" && $("#vatorgstflag").val()!='29') { - if ($("#invflag").val()==0){ - $("#epsubmit").focus(); - } - if($('#gsflag').val() == '7') { - if ($("#editgodownpresence").val() == 0) { - $("#editopeningstock").focus().select(); - } - else { - if ($("#editgodownflag").val() == 1) { - $('#editgodown_ob_table tbody tr:first td:eq(0) select').focus().select(); - } - else if ($("#editgodownflag").val() == 0) { - $("#editgodownflag").focus().select(); - } - } - - } - else { - $("#epsubmit").focus(); - } - } - else { - if ($('#product_edit_tax_table tbody tr:eq('+curindex1+') td:eq(1) select option:selected').attr("stateid") < 1 && selectedtaxname == "VAT") { $("#tax_state-blank-alert").alert(); $("#tax_state-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -876,71 +825,21 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $('#product_edit_tax_table tbody tr:eq('+curindex1+') td:eq(2) input').focus(); return false; } - $('#product_edit_tax_table tbody').append(''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''); - $(".tax_rate").numeric(); - if (selectedtaxname == "CVAT" || selectedtaxname == "IGST") { - $('#product_edit_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select option[value='+selectedtaxname+']').prop('hidden', true).prop('disabled', true); - } + $('#product_edit_tax_table tbody').append(''+ taxhtml + ''); + $('#product_edit_tax_table tbody tr:last td:last').append(''); + $(".product_tax_disable").prop('disabled',false); + $(".tax_rate").numeric(); + for (let j = 0; j < curindex1 + 1; j++) { + var selectedtax = $("#product_edit_tax_table tbody tr:eq("+j+") td:eq(0) select option:selected").val(); + if (selectedtax != "VAT") { + for (let i=j+1; i<=curindex1+1;i++){ + $('#product_edit_tax_table tbody tr:eq('+i+') td:eq(0) select option[value='+selectedtax+']').remove(); + } + } + } + $(".tax_name:last").change(); $('#product_edit_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } - } } else if(event.which==190 && event.shiftKey) { @@ -1232,15 +1131,19 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $("#product_edit_tax_table tbody tr").each(function(index){ if ($.trim($('#product_edit_tax_table tbody tr:eq('+index+') td:eq(0) select option:selected').val())=="") { taxflag=1; - + } if ($.trim($('#product_edit_tax_table tbody tr:eq('+index+') td:eq(0) select option:selected').val())=="IGST") { igstflag=1; } - + + if ($.trim($('#product_edit_tax_table tbody tr:eq('+index+') td:eq(0) select option:selected').val())=="CESS") { + igstflag=1; + } + }); - + if(taxflag){ $("#tax-alert").alert(); $("#tax-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -1298,14 +1201,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); taxes.push(obj); } }); - for (tax of existingnonetax) { - let obj = {}; - obj.taxrowid = tax["taxid"]; - obj.taxname = tax["taxname"]; - obj.state = tax["state"]; - obj.taxrate = tax["taxrate"]; - taxes.push(obj); - } + var obj = {}; $("#editgodown_ob_table tbody tr").each(function(){ if ($.trim($(".editgodown_name",this).val())!="") { @@ -1365,7 +1261,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); event.stopPropagation(); }); - + $('#epdelete').click(function(event) { event.preventDefault(); var gsflag = $("#gsflag").val(); diff --git a/gkwebapp/static/js/editproductvat.js b/gkwebapp/static/js/editproductvat.js index b5433d79a369d727a19fe0cc3aa822ce01e2576b..3448a6e200a9b975ce436221335dfd05449a3682 100644 --- a/gkwebapp/static/js/editproductvat.js +++ b/gkwebapp/static/js/editproductvat.js @@ -53,7 +53,12 @@ $(document).ready(function() { $("#spec_table tbody tr:first td:eq(1) input:first").focus(); } else { - $('#product_edit_tax_table tbody tr:first td:eq(0) select').focus(); + if ($('#product_edit_tax_table').length > 0) { + $('#product_edit_tax_table tbody tr:first td:eq(0) select').focus(); + } + else { + $('#editgodown_ob_table tbody tr:first td:eq(0) select').focus(); + } } } if (e.which == 38) { @@ -856,9 +861,14 @@ $(document).ready(function() { if ($("#editgodownflag").is(':visible')) { $("#editgodownflag").focus().select(); } - else { - $('#product_edit_tax_table tbody tr:last td:eq(2) input').focus().select(); - } + else { + if ($('#product_edit_tax_table').length > 0) { + $('#product_edit_tax_table tbody tr:last td:eq(2) input').focus().select(); + } + else { + $("#edituom").focus(); + } + } } if(previndex>-1 && curindex != 0) { diff --git a/gkwebapp/static/js/invoice.js b/gkwebapp/static/js/invoice.js index 8f51b3599ee9ad1ad3a74c7f942b7a800daaa2a3..87af200ac9f2b5842b23dce1ce7d1b7ddaf5c7b7 100644 --- a/gkwebapp/static/js/invoice.js +++ b/gkwebapp/static/js/invoice.js @@ -82,12 +82,32 @@ Contributors: } ); }); - $("#invoice_view").click(function() {// calls view invoice page. + $("#invoice_view_sale").click(function() {// calls view invoice page. $.ajax( { type: "POST", - url: "/invoice?action=showedit", + url: "/invoice?action=showsale", + global: false, + async: false, + datatype: "text/html", + beforeSend: function(xhr) + { + xhr.setRequestHeader('gktoken',sessionStorage.gktoken ); + }, + success: function(resp) + { + $("#invoice_div").html(resp); + } + } + ); + }); + $("#invoice_view_purchase").click(function() {// calls view invoice page. + $.ajax( + { + + type: "POST", + url: "/invoice?action=showpurchase", global: false, async: false, datatype: "text/html", diff --git a/gkwebapp/static/js/mainshell.js b/gkwebapp/static/js/mainshell.js index a0acbf1df9cd6eafc81ba16759d5c5ccbc17c770..d56e59b08e799c3cb8fa5e565c193f21a7e5ad14 100644 --- a/gkwebapp/static/js/mainshell.js +++ b/gkwebapp/static/js/mainshell.js @@ -515,8 +515,13 @@ var userrole1; $("#orgpref").remove(); } if(resp["gkresult"]["userrole"]==2) { - $("#showviewlog").remove(); - $("#orgpref").remove(); + $("#showviewlog").remove(); + $("#orgpref").remove(); + $(".mastermenu").remove(); + $(".inventorymenu").remove(); + $(".administrationmenu").remove(); + $(".intauditor").remove(); + $("#fevoucher").text("Find Voucher"); } if (resp["gkresult"]["booksclosedflag"]==1) { $(".closebooks").remove(); @@ -870,7 +875,6 @@ var userrole1; }, success: function(resp) { - console.log(resp); $('#info').html(resp); } }); diff --git a/gkwebapp/static/js/receivedtransfernote.js b/gkwebapp/static/js/receivedtransfernote.js index a563282b9984206210adfc6efbae226fe56b2cbf..3de4d71f454ea63cd64c11feeaaf11829b9f6130 100644 --- a/gkwebapp/static/js/receivedtransfernote.js +++ b/gkwebapp/static/js/receivedtransfernote.js @@ -196,7 +196,7 @@ This script is for the Received transfer note page. else { var rcdatearray = result["receiveddate"].split(/\s*\-\s*/g) - console.log(rcdatearray) + $("#rec_received").hide(); $("#received_tn_date").val(rcdatearray[0]).prop("disabled", true); $("#received_tn_month").val(rcdatearray[1]).prop("disabled", true); @@ -242,10 +242,10 @@ This script is for the Received transfer note page. // This function will set the TN as received. $("#rec_received").click(function(event) { event.preventDefault(); - $('.modal-backdrop').remove(); - $('.modal').modal('hide'); - $('#confirm_yes').modal('show').one('click', '#tn_yes', function (e) - { +// $('.modal-backdrop').remove(); +// $('.modal').modal('hide'); +// $('#confirm_yes').modal('show').one('click', '#tn_yes', function (e) + // { if ($.trim($('#received_tn_date').val())=="") { $("#date-blank-alert").alert(); $("#date-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ @@ -280,7 +280,7 @@ This script is for the Received transfer note page. } - var curdate = Date.parseExact($("#received_tn_year").val()+$("#received_tn_month").val()+$("#received_tn_date").val(), "yyyyMMdd") + var curdate = Date.parseExact($("#received_tn_year").val()+$("#received_tn_month").val()+$("#received_tn_date").val(), "yyyyMMdd"); var receiveddate1 =$("#received_tn_year").val()+'-'+$("#received_tn_month").val()+'-'+$("#received_tn_date").val(); @@ -298,7 +298,7 @@ This script is for the Received transfer note page. } var createdate=$('#rec_transfernote_date').text(); - var createdateyyyymmdd=createdate[6]+createdate[7]+createdate[8]+createdate[9]+createdate[5]+createdate[3]+createdate[4]+createdate[2]+createdate[0]+createdate[1] + var createdateyyyymmdd=createdate[6]+createdate[7]+createdate[8]+createdate[9]+createdate[5]+createdate[3]+createdate[4]+createdate[2]+createdate[0]+createdate[1]; if(Date.parseExact(receiveddate1,"yyyy-MM-dd").compareTo(Date.parseExact(createdateyyyymmdd,"yyyy-MM-dd"))==-1) @@ -348,10 +348,11 @@ This script is for the Received transfer note page. }); - }); + // }); $("#confirm_yes").on('shown.bs.modal', function(event) { $("#tn_no").focus(); }); + $("#confirm_yes").on('hidden.bs.modal', function(event) { $("#rec_tn_list").focus(); }); diff --git a/gkwebapp/static/js/showstockreport.js b/gkwebapp/static/js/showstockreport.js index 29ad432d8dda39eb66f9177001d09b2a00e9ddad..706782e6c9b50a935e0c44c8fd28075ce46a7834 100644 --- a/gkwebapp/static/js/showstockreport.js +++ b/gkwebapp/static/js/showstockreport.js @@ -99,12 +99,12 @@ $(document).ready(function() { }); $('#viewprintableversion').click(function (e) { - var printdata ={} + var printdata ={}; if ($("#godownflag").val()==0) { - printdata = {"productcode":$("#productcode").val(),"productdesc":$("#productdesc").val(),"calculatefrom":$("#calculatefrom").val(), "calculateto":$("#calculateto").val(), "godownflag":$("#godownflag").val(), "goid":"-1", "goname":""} + printdata = {"productcode":$("#productcode").val(),"productdesc":$("#productdesc").val(),"calculatefrom":$("#calculatefrom").val(), "calculateto":$("#calculateto").val(), "godownflag":$("#godownflag").val(), "goid":"-1", "goname":""}; } else { - printdata = {"productcode":$("#productcode").val(),"productdesc":$("#productdesc").val(),"calculatefrom":$("#calculatefrom").val(), "calculateto":$("#calculateto").val(), "godownflag":$("#godownflag").val(), "goid":$("#goid").val(), "goname":$("#goname").val(), "goaddr":$("#goaddr").val()} + printdata = {"productcode":$("#productcode").val(),"productdesc":$("#productdesc").val(),"calculatefrom":$("#calculatefrom").val(), "calculateto":$("#calculateto").val(), "godownflag":$("#godownflag").val(), "goid":$("#goid").val(), "goname":$("#goname").val(), "goaddr":$("#goaddr").val()}; } console.log(printdata); $.ajax({ @@ -150,7 +150,7 @@ $(document).ready(function() { // get binary data as a response var blob = this.response; var url = window.URL.createObjectURL(blob); - window.location.assign(url) + window.location.assign(url); } }; diff --git a/gkwebapp/static/js/viewcategorywisestockonhandreport.js b/gkwebapp/static/js/viewcategorywisestockonhandreport.js index 5ebbdbf4be814e5a0cd7144a70aa960a94a48538..95a54586777daaedbb49d12602cdec71c5abb8bb 100644 --- a/gkwebapp/static/js/viewcategorywisestockonhandreport.js +++ b/gkwebapp/static/js/viewcategorywisestockonhandreport.js @@ -255,8 +255,26 @@ $(document).ready(function() { else { $("#viewstock_toyear").keydown(function(e){ if(e.which==13){ - e.preventDefault(); - $("#godownflag").focus().select(); + e.preventDefault(); + + if($("#godownwise_div").is(":hidden")) + { + $('#viewstock_submit').focus().click(); + } + else { + if($("#godownflag").is (":visible")){ + + $("#godownflag").focus().select(); + } + else{ + if($("#editgoddet").length>0){ + $("#editgoddet").focus(); + } + else{ + $('#viewstock_submit').focus().click(); + } + } + } } if(e.which==38){ e.preventDefault(); @@ -333,9 +351,18 @@ $(document).ready(function() { if($("#godownflag").val()==0) { dataset = {"categorycode":$("#viewstock_categoryname option:selected").val(), "categoryname": $.trim($("#viewstock_categoryname option:selected").text()), "subcategorycode":$("#viewstock_subcategoryname option:selected").val(), "subcategoryname": $.trim($("#viewstock_subcategoryname option:selected").text()), "speccode":"all", "specname": "all", /*$("#viewstock_specsname option:selected").val(), "specname": $.trim($("#viewstock_specsname option:selected").text()),*/"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":0,"godownflag":0}; } - else { - dataset = {"categorycode":$("#viewstock_categoryname option:selected").val(), "categoryname": $.trim($("#viewstock_categoryname option:selected").text()), "subcategorycode":$("#viewstock_subcategoryname option:selected").val(), "subcategoryname": $.trim($("#viewstock_subcategoryname option:selected").text()), "speccode":"all", "specname": "all", /*$("#viewstock_specsname option:selected").val(), "specname": $.trim($("#viewstock_specsname option:selected").text()),*/"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":0,"godownflag":1,"goid":$("#editgoddet option:selected").val(),"goname":$("#editgoddet option:selected").data('godownname'), "goaddr":$("#editgoddet option:selected").data('godownaddress')}; + else { + if($("#editgoddet").length>0){ + dataset = {"categorycode":$("#viewstock_categoryname option:selected").val(), "categoryname": $.trim($("#viewstock_categoryname option:selected").text()), "subcategorycode":$("#viewstock_subcategoryname option:selected").val(), "subcategoryname": $.trim($("#viewstock_subcategoryname option:selected").text()), "speccode":"all", "specname": "all", /*$("#viewstock_specsname option:selected").val(), "specname": $.trim($("#viewstock_specsname option:selected").text()),*/"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":0,"godownflag":1,"goid":$("#editgoddet option:selected").val(),"goname":$("#editgoddet option:selected").data('godownname'), "goaddr":$("#editgoddet option:selected").data('godownaddress')}; } + // Dataset for single Godown. + else{ + dataset = {"categorycode":$("#viewstock_categoryname option:selected").val(), "categoryname": $.trim($("#viewstock_categoryname option:selected").text()), "subcategorycode":$("#viewstock_subcategoryname option:selected").val(), "subcategoryname": $.trim($("#viewstock_subcategoryname option:selected").text()), "speccode":"all", "specname": "all", /*$("#viewstock_specsname option:selected").val(), "specname": $.trim($("#viewstock_specsname option:selected").text()),*/"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":0,"godownflag":1,"goid":$("#godwn").data('value'), "goname":$("#godwn").data('godownname'), "goaddr":$("#godwn").data('godownaddress')}; + } + } + + + $.ajax( { type: "POST", diff --git a/gkwebapp/static/js/viewstockonhandreport.js b/gkwebapp/static/js/viewstockonhandreport.js index 57a9f26c8fb783278b31e80ab9b977b4ef66ba08..3b43e7f38983ff8b04202e651d90a0c98780de69 100644 --- a/gkwebapp/static/js/viewstockonhandreport.js +++ b/gkwebapp/static/js/viewstockonhandreport.js @@ -39,10 +39,10 @@ $(document).ready(function() { // Setting default date to financialstart and end. - var todatearray = sessionStorage.yyyymmddyear2.split(/\s*\-\s*/g) - $("#viewstock_todate").val(todatearray[2]) - $("#viewstock_tomonth").val(todatearray[1]) - $("#viewstock_toyear").val(todatearray[0]) + var todatearray = sessionStorage.yyyymmddyear2.split(/\s*\-\s*/g); + $("#viewstock_todate").val(todatearray[2]); + $("#viewstock_tomonth").val(todatearray[1]); + $("#viewstock_toyear").val(todatearray[0]); function pad (str, max) { //to add leading zeros in date str = str.toString(); @@ -50,7 +50,7 @@ $(document).ready(function() { return str.length < max ? pad("0" + str, max) : str; } else{ - return str + return str; } } function yearpad (str, max) { //to add leading 20 or 200 to year @@ -65,6 +65,10 @@ $(document).ready(function() { return str } } + + + + // function to toggle godown option depending on check box. @@ -144,12 +148,23 @@ $(document).ready(function() { $("#viewstock_toyear").keydown(function(e){ if(e.which==13){ e.preventDefault(); - if($("#godownwise_div").is(":hidden")) + if($("#godownwise_div").is(":hidden")) { $('#viewstock_submit').focus().click(); } - else { - $("#godownflag").focus().select(); + else { + if($("#godownflag").is (":visible")){ + + $("#godownflag").focus().select(); + } + else{ + if($("#editgoddet").length>0){ //if there is no select box then view button is triggered. + $("#editgoddet").focus(); + } + else{ + $('#viewstock_submit').focus().click(); + } + } } } @@ -187,15 +202,15 @@ $(document).ready(function() { $("#account-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#account-blank-alert").hide(); }); - $('#viewstock_productname').focus() + $('#viewstock_productname').focus(); return false; } - if ($("#editgoddet").val()==null && $("#godownflag").val()==1) { + if ($("#editgoddet").val()==null && $("#godownflag").val()==1 && $("#godwn").data("data-value") !=null){ $("#godown-blank-alert").alert(); $("#godown-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#godown-blank-alert").hide(); }); - $('#editgoddet').focus() + $('#editgoddet').focus(); return false; } @@ -204,7 +219,7 @@ $(document).ready(function() { $("#godprod-all-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#godprod-all-alert").hide(); }); - $('#viewstock_productname').focus() + $('#viewstock_productname').focus(); return false; } @@ -213,7 +228,7 @@ $(document).ready(function() { $("#godprod-all-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#godprod-all-alert").hide(); }); - $('#viewstock_productname').focus() + $('#viewstock_productname').focus(); return false; } @@ -269,25 +284,34 @@ $(document).ready(function() { // -----------------------end of validations--------------------- // creating dataset for retrieving report from the server. - var dataset = {} + var dataset = {}; if ($("#godownflag").val()==0) { if ($("#viewstock_productname").val()==0){ - dataset = {"productcode":0, "productdesc": 0,"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":1,"godownflag":$("#godownflag").val(),"goid":-1,"goname":""} + dataset = {"productcode":0, "productdesc": 0,"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":1,"godownflag":$("#godownflag").val(),"goid":-1,"goname":""}; } else { - dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":0,"godownflag":$("#godownflag").val(),"goid":-1,"goname":""} + dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":0,"godownflag":$("#godownflag").val(),"goid":-1,"goname":""}; } } else if ($("#godownflag").val()==1) { console.log($("#editgoddet").val()); if ($("#editgoddet").val()==0){ //pag condition - dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":2,"godownflag":$("#godownflag").val(), "goid":0 , "goname":"All godowns", "goaddr":$("#editgoddet option:selected").data('godownaddress')} + dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":2,"godownflag":$("#godownflag").val(), "goid":0 , "goname":"All godowns", "goaddr":$("#editgoddet option:selected").data('godownaddress')}; + } + + else{ + if($("#editgoddet").length>0){ + dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":3,"godownflag":$("#godownflag").val(), "goid":$("#editgoddet option:selected").val(), "goname":$("#editgoddet option:selected").data('godownname'), "goaddr":$("#editgoddet option:selected").data('godownaddress')}; + } + else{ - dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":3,"godownflag":$("#godownflag").val(), "goid":$("#editgoddet option:selected").val(), "goname":$("#editgoddet option:selected").data('godownname'), "goaddr":$("#editgoddet option:selected").data('godownaddress')} - } + // Dataset for single Godown. + dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"backflag":3,"godownflag":$("#godownflag").val(), "goid":$("#godwn").data('value'), "goname":$("#godwn").data('godownname'), "goaddr":$("#godwn").data('godownaddress')}; + } + } } $.ajax( { diff --git a/gkwebapp/static/js/viewstockreport.js b/gkwebapp/static/js/viewstockreport.js index 6c1e7d02f34eb7e9be687be968a7ad1adf458f71..6d75963d06ce5ed65a4802b41fad914b5e787103 100644 --- a/gkwebapp/static/js/viewstockreport.js +++ b/gkwebapp/static/js/viewstockreport.js @@ -40,15 +40,15 @@ $(document).ready(function() { var sel1 = 0; // flag for focus on combo box // Setting default date to financialstart and end. - var fromdatearray = sessionStorage.yyyymmddyear1.split(/\s*\-\s*/g) + var fromdatearray = sessionStorage.yyyymmddyear1.split(/\s*\-\s*/g); $("#viewstock_fromdate").val(fromdatearray[2]); console.log(fromdatearray[2]); $("#viewstock_frommonth").val(fromdatearray[1]); $("#viewstock_fromyear").val(fromdatearray[0]); - var todatearray = sessionStorage.yyyymmddyear2.split(/\s*\-\s*/g) - $("#viewstock_todate").val(todatearray[2]) - $("#viewstock_tomonth").val(todatearray[1]) - $("#viewstock_toyear").val(todatearray[0]) + var todatearray = sessionStorage.yyyymmddyear2.split(/\s*\-\s*/g); + $("#viewstock_todate").val(todatearray[2]); + $("#viewstock_tomonth").val(todatearray[1]); + $("#viewstock_toyear").val(todatearray[0]); function pad (str, max) { //to add leading zeros in date str = str.toString(); @@ -56,7 +56,7 @@ $(document).ready(function() { return str.length < max ? pad("0" + str, max) : str; } else{ - return str + return str; } } function yearpad (str, max) { //to add leading 20 or 200 to year @@ -68,7 +68,7 @@ $(document).ready(function() { return str.length < max ? pad("20" + str, max) : str; } else{ - return str + return str; } } @@ -212,7 +212,7 @@ $(document).ready(function() { $("#account-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#account-blank-alert").hide(); }); - $('#viewstock_productname').focus() + $('#viewstock_productname').focus(); return false; } if ($("#editgoddet").val()==null && $("#godownflag").val()==1) { @@ -220,7 +220,7 @@ $(document).ready(function() { $("#godown-blank-alert").fadeTo(2250, 500).slideUp(500, function(){ $("#godown-blank-alert").hide(); }); - $('#editgoddet').focus() + $('#editgoddet').focus(); return false; } if ($("#viewstock_fromyear").val()==0 ||$("#viewstock_frommonth").val()==0 ||$("#viewstock_fromdate").val()==0 ) { @@ -284,12 +284,12 @@ $(document).ready(function() { // -----------------------end of validations--------------------- // creating dataset for retrieving report from the server. - var dataset = {} + var dataset = {}; if ($("#godownflag").val()==0) { - dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculatefrom":$("#viewstock_fromyear").val()+"-"+$("#viewstock_frommonth").val()+"-"+$("#viewstock_fromdate").val(),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"financialstart":sessionStorage.yyyymmddyear1,"backflag":0,"godownflag":$("#godownflag").val(),"goid":-1,"goname":""} + dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculatefrom":$("#viewstock_fromyear").val()+"-"+$("#viewstock_frommonth").val()+"-"+$("#viewstock_fromdate").val(),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"financialstart":sessionStorage.yyyymmddyear1,"backflag":0,"godownflag":$("#godownflag").val(),"goid":-1,"goname":""}; } else if ($("#godownflag").val()==1) { - dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculatefrom":$("#viewstock_fromyear").val()+"-"+$("#viewstock_frommonth").val()+"-"+$("#viewstock_fromdate").val(),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"financialstart":sessionStorage.yyyymmddyear1,"backflag":0,"godownflag":$("#godownflag").val(), "goid":$("#editgoddet option:selected").val(), "goname":$("#editgoddet option:selected").data('godownname'), "goaddr":$("#editgoddet option:selected").data('godownaddress')} + dataset = {"productcode":$("#viewstock_productname option:selected").val(), "productdesc": $.trim($("#viewstock_productname option:selected").text()),"calculatefrom":$("#viewstock_fromyear").val()+"-"+$("#viewstock_frommonth").val()+"-"+$("#viewstock_fromdate").val(),"calculateto":$("#viewstock_toyear").val()+"-"+$("#viewstock_tomonth").val()+"-"+$("#viewstock_todate").val(),"financialstart":sessionStorage.yyyymmddyear1,"backflag":0,"godownflag":$("#godownflag").val(), "goid":$("#editgoddet option:selected").val(), "goname":$("#editgoddet option:selected").data('godownname'), "goaddr":$("#editgoddet option:selected").data('godownaddress')}; } $.ajax( { diff --git a/gkwebapp/templates/addcashmemo.jinja2 b/gkwebapp/templates/addcashmemo.jinja2 index f70c3ee11048c22c454807c08e8497c0243fc336..5c26f826166d0d2d78876954029d5b1f89990d17 100644 --- a/gkwebapp/templates/addcashmemo.jinja2 +++ b/gkwebapp/templates/addcashmemo.jinja2 @@ -122,12 +122,14 @@ {% else %} - {% endif %} - + {% endif %} + - - - + {% if resultgstvat != '22' %} +
+ +
+ {% endif %} {% if gkstatus=="out" %} @@ -260,8 +262,8 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% trans %}CGST{% endtrans %} - {% trans %}SGST{% endtrans %} - + {% trans %}SGST/UTGST{% endtrans %} + {% trans %}CESS{% endtrans %} @@ -269,8 +271,9 @@ {%trans%}Amount{%endtrans%} {%trans%}Rate{%endtrans%} % {%trans%}Amount{%endtrans%} - - + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} + @@ -311,14 +314,17 @@ - - - - - - - - + + + + + + + + + + +
@@ -326,10 +332,12 @@ Total - - - - + + + + + +
@@ -349,8 +357,8 @@ - - + + @@ -370,7 +378,7 @@

Bank Details :

- + diff --git a/gkwebapp/templates/addcategory.jinja2 b/gkwebapp/templates/addcategory.jinja2 index 6a770f44b6fb9e6922efda3683f27ae6333dcaa5..1c096b723f6ba92e6a0feaf48d41531cce2303e6 100644 --- a/gkwebapp/templates/addcategory.jinja2 +++ b/gkwebapp/templates/addcategory.jinja2 @@ -349,9 +349,10 @@ {% else %} + + - {% endif%} @@ -367,7 +368,7 @@ - + diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 05b2794f92376f344518f22aa0e67ae8e1d8bb3e..3e24f5917a7fe590c480aece8d84264ad0f6cb97 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -43,6 +43,18 @@ {% trans %}Please enter address!{% endtrans %} + + + +
- +
@@ -97,7 +109,7 @@
+
{% if vatorgstflag != '7' %}
- +
{% endif %}
- +
@@ -157,7 +169,14 @@ @@ -175,7 +194,7 @@
- +
@@ -236,7 +255,7 @@
- +
diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index fb4a7fbf46f568580fa50221ee847559e04b1489..e22a23f35c1f2e6660924f06ccd09d9539d8b2cb 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -69,7 +69,7 @@

Details of Invoice:

- + +
@@ -113,6 +113,12 @@
+ {% if resultgstvat != '22' %} + + {% endif %}
- + + @@ -409,6 +416,8 @@ + +
- +
+
+ + + + +
+
{% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% trans %}CGST{% endtrans %}{% trans %}SGST{% endtrans %}{% trans %}SGST/UTGST{% endtrans %} {% trans %}IGST{% endtrans %}{% trans %}CESS{% endtrans %}
{% trans %}Amount{% endtrans %} {% trans %}Rate{% endtrans %} % {% trans %}Amount{% endtrans %}{% trans %}Rate{% endtrans %} %{% trans %}Amount{% endtrans %}
@@ -450,18 +459,22 @@ - - + + - - + + - - + + - - + + + + + +
@@ -469,12 +482,13 @@ Total - - - + + + - - + + +
@@ -495,8 +509,8 @@ - - + + @@ -507,10 +521,10 @@
{% endif %} -
+
- - + +
@@ -581,9 +595,18 @@
-
+
diff --git a/gkwebapp/templates/addproduct.jinja2 b/gkwebapp/templates/addproduct.jinja2 index c9e109579b2918e38a3389478e608a5c6bd8f267..31f8b7869f5a69349c4f00d03e1aa6a5ae7661f3 100644 --- a/gkwebapp/templates/addproduct.jinja2 +++ b/gkwebapp/templates/addproduct.jinja2 @@ -8,22 +8,26 @@
-
+ {% if userrole|int != 3 %} +
+ {% else %} + -
- + {% if not gkresult["category"] %} - +
{% trans %}If you want to put this product under a category/sub-category, you must create a category first.{% endtrans %}
@@ -41,7 +45,7 @@
{% endif %}
- +
@@ -74,7 +78,7 @@ {% trans %}Press 'Enter' key to save and 'Esc' key to cancel.{% endtrans %}
- +
@@ -82,10 +86,19 @@
- + + {% if userrole|int != 3 %}
-
+ + +
@@ -99,57 +112,27 @@ - + @@ -170,15 +153,15 @@ See more. - - + + {% endif %}
{% if not godown %} @@ -302,8 +286,10 @@
- + {% if userrole|int != 3 %} +
+ {% endif %}
diff --git a/gkwebapp/templates/addproductvat.jinja2 b/gkwebapp/templates/addproductvat.jinja2 index c139b6ea391705a24aa63815e2f54cc54497d91d..aee7391a2640fcdbf3cbdb56be40701b843ae1c8 100644 --- a/gkwebapp/templates/addproductvat.jinja2 +++ b/gkwebapp/templates/addproductvat.jinja2 @@ -53,8 +53,9 @@ -
- +
+ + {% if userrole|int != 3 %}
@@ -137,8 +138,9 @@ {% endif %}
See more. -
-
+
+
+ {% endif %}
{% if not godown %} @@ -148,7 +150,7 @@ -
+
- - + + {% for state in states %} + {% for key, value in state.items() %} + + {% endfor %} + {% endfor %} + + +
@@ -165,7 +167,7 @@ @@ -180,70 +182,70 @@ -
-
- -
- - -
+
+
+ +
+ + +
+
-
- {% else %} + {% else %}
- - - -
-
- -
- - + + +
-
-
- - - - - - - - - - - - - - -
{% trans %}Godown{% endtrans %}{% trans %}Opening Stock{% endtrans %}
- - - - -
+
+ +
+ + +
+
+ -
{% endif %} -
+
- + + + + + + - @@ -142,57 +156,63 @@ th {
- + Press Enter key twice to shift focus to Fax
- +
- - -
-
- - -
+ +
- +
+ + +
+
+
- {% if vatorgstflag != '7' %} + {% if vatorgstflag != '7' %}
- +
{% endif %}
- +
- - - - - - - - - - + + + + + + + + + - + @@ -210,7 +230,7 @@ th {
- +
@@ -256,12 +276,12 @@ th {
- +
-
@@ -272,15 +292,15 @@ th {
- +
- +
- + -
+ {% endif %} - +
{% trans %}State{% endtrans %}{% trans %}GSTIN{% endtrans %}
-
{% trans %}State{% endtrans %}{% trans %}GSTIN{% endtrans %}
+ - - + + +
+
+ + + +
+
@@ -37,3 +44,4 @@ {% trans %}Press 'Esc' Key from Godowns Lists to shift focus to Security Question.{% endtrans %}
{% trans %}Press 'Space' Key in Godown Lists to Check or UnCheck CheckBox Button.{% endtrans %}
{% trans %}Press 'Enter' Key or 'UpArrow' Key in Godown Lists to change focus on Godown present in List.{% endtrans %} + {%endif%} diff --git a/gkwebapp/templates/customersupplierlist.jinja2 b/gkwebapp/templates/customersupplierlist.jinja2 index 7148fd617b2235ab2f80abd91f806ce61fdbf1b9..65f3534db7a6044ab9605df203c16e51aaba4aa2 100644 --- a/gkwebapp/templates/customersupplierlist.jinja2 +++ b/gkwebapp/templates/customersupplierlist.jinja2 @@ -9,6 +9,7 @@
Unadjusted Bills +
@@ -70,13 +71,41 @@
- +
+ + +
diff --git a/gkwebapp/templates/editcategory.jinja2 b/gkwebapp/templates/editcategory.jinja2 index 14c47961c608b706d08b9ace59ec3559494ff9de..b19e0336bc9d625096f5a6909c13919b61d65915 100644 --- a/gkwebapp/templates/editcategory.jinja2 +++ b/gkwebapp/templates/editcategory.jinja2 @@ -124,6 +124,10 @@ {% trans %}Duplicate Tax!{% endtrans %} +
@@ -148,7 +152,8 @@ {% else %} - + + {% endif%} diff --git a/gkwebapp/templates/editcustomersupplier.jinja2 b/gkwebapp/templates/editcustomersupplier.jinja2 index 349347a0c8690ef80cecb4d4299aee306d719199..061dff46b9ef8c2bc9fc03171ef1be4094f7d82f 100644 --- a/gkwebapp/templates/editcustomersupplier.jinja2 +++ b/gkwebapp/templates/editcustomersupplier.jinja2 @@ -69,6 +69,18 @@
+ + + +
- +
@@ -157,17 +169,17 @@
{% if vatorgstflag != '7' %} {% endif %}
@@ -189,7 +201,14 @@ @@ -205,7 +224,7 @@ - + {% endif %} diff --git a/gkwebapp/templates/editorganisation.jinja2 b/gkwebapp/templates/editorganisation.jinja2 index db0dd9ddf26408c3ae0d92b466c3c704593ddd61..abd8113bf9fff0e19260f8139b18cc5dc1218885 100644 --- a/gkwebapp/templates/editorganisation.jinja2 +++ b/gkwebapp/templates/editorganisation.jinja2 @@ -1,262 +1,398 @@ - - - {% trans %}GNUKhata{% endtrans %} | {% trans %}Edit Organisation{% endtrans %} - - - -
-
+ + + {% trans %}GNUKhata{% endtrans %} | {% trans %}Edit Organisation{% endtrans %} + + + + +
+
-
-
-
{% trans %}Edit Organisation{% endtrans %} -
+
+
+
{% trans %}Edit Organisation{% endtrans %} +
-
+
-
+

-
- +
+
+ + + + +
+
- - - {% if gkresult["orgtype"]=="Not For Profit" %} - - - - - - - - {%endif%} - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
-
-
- - - {% if gkresult["orgtype"]=="Not For Profit" %} - - - + + {% endif %} + + + + + + + + + + + + + + + + + + + + + {% if vatorgstflag=='22' or vatorgstflag=='29' %} + + + + + {% endif %} + {% if vatorgstflag=='7' or vatorgstflag=='29' %} + + + + + {% endif %} + +
- - - - + + + + +
+ + +
+ +
+ + + + {% if gkresult["orgtype"]=="Not For Profit" %} + + + + + + + + + {% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + + +
+ + + +
+ + + +
+ + + +
+
+
+ + + {% if gkresult["orgtype"]=="Not For Profit" %} + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + - - + + - - -
- - - - + + +
+ + + + - - + + - - - {%endif%} -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
-
-
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+
+ + -
-
- - -
+

+ +
+
+ +
+
+ + +
+
- - + -
- - - + + + {#For GSTIN#} + + + diff --git a/gkwebapp/templates/editproduct.jinja2 b/gkwebapp/templates/editproduct.jinja2 index 1164402f820f00d77793f9304d1f77f264258532..96dfccf811cdb8bcd4fcfd24a116b4f9ff7c0633 100644 --- a/gkwebapp/templates/editproduct.jinja2 +++ b/gkwebapp/templates/editproduct.jinja2 @@ -1,46 +1,46 @@ - -
+ +
-
-
-
+
+ +
-
+
-
- - -
+
+ + +
-
-
-
+
+
+
-
- +
+
+ {% endif %}
+
-
-
-
- - - - - - - - - - - - - - - - - + + +
{% trans %}Tax Name{% endtrans %}{% trans %}State{% endtrans %}{% trans %}Rate %{% endtrans %}
- - - - - - + {% if userrole|int != 3 %} +
+
+
+ + + + + + + + + + + + + + + + + - - -
{% trans %}Tax Name{% endtrans %}{% trans %}State{% endtrans %}{% trans %}Rate %{% endtrans %}
+ + + + + + -
- -
- Press 'Insert' key from anywhere on the screen to save changes. -
- Press 'Ctrl + >' to move forward or 'Ctrl + <' to move backward within a row in a table.
- Press 'Shift + <' to move backward within a Column in a table. - {% if proddesc["gsflag"]==7 %} - {% if numberofgodowns|int > 0 %} - Press 'Esc' key to shift focus from Tax Rate or Tax Name to Godown Name or from Godown Opening Stock to 'Save' button. - {% else %} - Press 'Esc' key to shift focus from Tax Rate or Tax Name to Opening Stock or from Opening Stock to 'Save' button. - {% endif %} - {% else %} - Press 'Esc' key to shift focus from Tax Rate or Tax Name to 'Save' button. - {% endif %} -
- See more. +
+ +
+ Press 'Insert' key from anywhere on the screen to save changes. +
+ Press 'Ctrl + >' to move forward or 'Ctrl + <' to move backward within a row in a table.
+ Press 'Shift + <' to move backward within a Column in a table. + {% if proddesc["gsflag"]==7 %} + {% if numberofgodowns|int > 0 %} + Press 'Esc' key to shift focus from Tax Rate or Tax Name to Godown Name or from Godown Opening Stock to 'Save' button. + {% else %} + Press 'Esc' key to shift focus from Tax Rate or Tax Name to Opening Stock or from Opening Stock to 'Save' button. + {% endif %} + {% else %} + Press 'Esc' key to shift focus from Tax Rate or Tax Name to 'Save' button. + {% endif %} +
+ See more. +
-
- {% if proddesc["gsflag"]==7 %} + {% endif %} + {% if proddesc["gsflag"]==7 %}
{% if not godown %} @@ -322,7 +295,7 @@ {% trans %}Godown{% endtrans %} - {% trans %}Opening Stock{% endtrans %} + {% trans %}Opening Stock{% endtrans %} diff --git a/gkwebapp/templates/editproductspecsvat.jinja2 b/gkwebapp/templates/editproductspecsvat.jinja2 index c7ce6b81d6c9fbf377c75f0fb9110a56326bc33f..d9d740874badd2592092e24ffc64f88bf9499dc7 100644 --- a/gkwebapp/templates/editproductspecsvat.jinja2 +++ b/gkwebapp/templates/editproductspecsvat.jinja2 @@ -76,106 +76,108 @@
- + {% endif %} - {% endfor %} - - + {% endfor %} + + - {% endif %} - - + {% endif %} + +
-
-
-
- - - - - - - - - - - - - - - - + + +
{% trans %}Tax Name{% endtrans %}{% trans %}State{% endtrans %}{% trans %}Rate %{% endtrans %}
- - - - - - + {% if userrole|int != 3 %} +
+
+
+ + + + + + + + + + + + + + + + - - -
{% trans %}Tax Name{% endtrans %}{% trans %}State{% endtrans %}{% trans %}Rate %{% endtrans %}
+ + + + + + -
-
- Press 'Insert' key from anywhere on the screen to save changes. -
- Press 'Ctrl + >' to move forward or 'Ctrl + <' to move backward within a row in a table.
- Press 'Shift + <' to move backward within a Column in a table. - {% if numberofgodowns|int > 0 %} - Press 'Esc' key to shift focus from Tax Rate or Tax Name to Godown Name or from Godown Opening Stock to 'Save' button. - {% else %} - Press 'Esc' key to shift focus from Tax Rate or Tax Name to Opening Stock or from Opening Stock to 'Save' button. - {% endif %} +
+
+ Press 'Insert' key from anywhere on the screen to save changes. +
+ Press 'Ctrl + >' to move forward or 'Ctrl + <' to move backward within a row in a table.
+ Press 'Shift + <' to move backward within a Column in a table. + {% if numberofgodowns|int > 0 %} + Press 'Esc' key to shift focus from Tax Rate or Tax Name to Godown Name or from Godown Opening Stock to 'Save' button. + {% else %} + Press 'Esc' key to shift focus from Tax Rate or Tax Name to Opening Stock or from Opening Stock to 'Save' button. + {% endif %} +
+ See more. +
- See more. -
- + {% endif %}
{% if not godown %} @@ -284,7 +286,7 @@ {% trans %}Godown{% endtrans %} - {% trans %}Opening Stock{% endtrans %} + {% trans %}Opening Stock{% endtrans %} diff --git a/gkwebapp/templates/editproductvat.jinja2 b/gkwebapp/templates/editproductvat.jinja2 index a7c292690c7ac1932f9009ecb994a17ccf4f903c..12110f87498f80d45d3ad9439d4360843412a29e 100644 --- a/gkwebapp/templates/editproductvat.jinja2 +++ b/gkwebapp/templates/editproductvat.jinja2 @@ -1,32 +1,32 @@ -
+
-
-
-
+
+ +
-
+
-
- - -
+
+ + +
-
-
-
+
+
+
-
- +
+
@@ -99,7 +105,7 @@
{% if gkresult["dcno"] %} - + {{gkresult["dcno"]}} {% endif %}
@@ -125,16 +131,6 @@ {% if gkresult["inoutflag"] == 15 %}{{ gkresult["sourcestatecode"] }}{% endif %}{% if gkresult["inoutflag"] == 9 %}{{ gkresult["taxstatecode"] }}{% endif %}
-
@@ -173,7 +169,7 @@
- {% if gkresult["inoutflag"] == 9 %}{{ gkresult["sourcestatecode"] }}{% endif %}{% if gkresult["inoutflag"] == 15 %}{{ gkresult["destinationstatecode"] }}{% endif %} + {% if gkresult["inoutflag"] == 9 %}{{ gkresult["sourcestatecode"] }}{% endif %}{% if gkresult["inoutflag"] == 15 %}{{ gkresult["taxstatecode"] }}{% endif %}
@@ -327,8 +323,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 +336,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 +374,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 +388,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"] }} @@ -396,8 +398,8 @@
{% endif %}
- - + +


@@ -469,12 +471,6 @@ {% if gkresult["dateofsupply"] %}{{ gkresult["dateofsupply"] }}{% else %}N/A{% endif %} - - - - - {% if gkresult["reversecharge"] %}{{ gkresult["reversecharge"] }}{% else %}N/A{% endif %} - diff --git a/gkwebapp/templates/printstockreport.jinja2 b/gkwebapp/templates/printstockreport.jinja2 index ec928cdbc4546039d995c58dc48f36f29d4648ba..4ab66e6db4f0c3968cfb1964fa810605dfa00645 100644 --- a/gkwebapp/templates/printstockreport.jinja2 +++ b/gkwebapp/templates/printstockreport.jinja2 @@ -99,13 +99,13 @@ {% trans %}INV No.{% endtrans %} {% if godown != "" %} - + {% trans %}TN No.{% endtrans %} {% endif %} - + {# {% trans %}RN No.{% endtrans %} - + #} {% trans %}Inward{% endtrans %} @@ -133,14 +133,14 @@ - + {% if godown != "" %} {% endif %} - - + {# + #} {{record["inward"]}} @@ -183,9 +183,9 @@ {% if record["trntype"] == "transfer note" %} Transfer Note {% endif %} - {% if record["trntype"] == "Rejection Note" %} + {#{% if record["trntype"] == "Rejection Note" %} Rejection Note - {% endif %} + {% endif %}#} @@ -199,17 +199,17 @@ {% endif %} {% if godown != "" %} - + {% if record["tnno"] != "" %} {{record["tnno"]}} {% endif %} {% endif %} - + {# {% if record["rnno"] != "" %} {{record["rnno"]}} {% endif %} - + #} {{record["inwardqty"]}} @@ -237,14 +237,14 @@ - + {% if godown != "" %} {% endif %} - - + {# + #} {{record["totalinwardqty"]}} diff --git a/gkwebapp/templates/receivedtransfernote.jinja2 b/gkwebapp/templates/receivedtransfernote.jinja2 index a918e86d203116323b2a489d1d7a0658a1edfa4a..6899a51af3b8774f9566fb893591a64306342144 100644 --- a/gkwebapp/templates/receivedtransfernote.jinja2 +++ b/gkwebapp/templates/receivedtransfernote.jinja2 @@ -1,102 +1,102 @@ - - - - -
- - + + + + +
+ + -
-
-
- +
+ + + + + + + diff --git a/gkwebapp/templates/viewsinglecashmemo.jinja2 b/gkwebapp/templates/viewsinglecashmemo.jinja2 index 14da37ecb8f118eb736348daf1ba239550044cea..10f0bcc81e3949ec29bf8701f72da97fe24e4cf5 100644 --- a/gkwebapp/templates/viewsinglecashmemo.jinja2 +++ b/gkwebapp/templates/viewsinglecashmemo.jinja2 @@ -15,14 +15,20 @@ {{ gkresult["sourcestate"] }}
- - {% if gkresult["taxflag"] == 22 %} + + {% if gkresult["taxflag"] == 22 %} VAT - {% else %} - GST - {% endif %} -
+ {% else %} + GST + {% endif %} +
+
+ {% if gkresult["taxflag"] == 7 %} +
+ + {% if gkresult["orgstategstin"] %}{{ gkresult["orgstategstin"] }}{% endif %}
+ {% endif %} {% if gkresult["taxflag"] == 22 %}

@@ -118,7 +124,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 +133,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 +172,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 +188,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 157440e18fc70c510699c13a0fa3d1cca73f6217..90ee1a5a7644786448f364543babe16c6e8e2c20 100644 --- a/gkwebapp/templates/viewsingleinvoice.jinja2 +++ b/gkwebapp/templates/viewsingleinvoice.jinja2 @@ -10,7 +10,7 @@ {% endif %}
{% if gkresult["dcno"] %} - + {{gkresult["dcno"]}} {% endif %}
@@ -36,7 +36,11 @@ {% if gkresult["inoutflag"] == 15 %}{{ gkresult["sourcestatecode"] }}{% endif %}{% if gkresult["inoutflag"] == 9 %}{{ gkresult["taxstatecode"] }}{% endif %}
- {% if gkresult["inoutflag"] == 15 %} + {% if gkresult["inoutflag"] == 15 and gkresult["taxflag"] == 7 %} +
+ + {% if gkresult["orgstategstin"] %}{{ gkresult["orgstategstin"] }}{% endif %} +
{{ gkresult["issuername"] }}
@@ -242,8 +246,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 +258,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 +300,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 +317,7 @@ {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='IGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }}
@@ -336,10 +346,10 @@
{% endif %}
-
+
- - + +
@@ -373,10 +383,12 @@ {% if gkresult["transportationmode"] %}{{ gkresult["transportationmode"] }}{% else %}N/A{% endif %}
- + {% if gkresult["vehicleno"] %} + + {% endif %}
@@ -385,11 +397,12 @@ {% if gkresult["dateofsupply"] %}{{ gkresult["dateofsupply"] }}{% else %}N/A{% endif %}
- -
+ {% if gkresult["inoutflag"] == 9 %} +
- {% if gkresult["reversecharge"] %}{{ gkresult["reversecharge"] }}{% else %}N/A{% endif %} -
+ {% if gkresult["reversecharge"]|int == 1 %}Y{% endif %} +
+ {% endif %}
diff --git a/gkwebapp/templates/viewstockonhandreport.jinja2 b/gkwebapp/templates/viewstockonhandreport.jinja2 index 69199d2705acb6d486a35a8659668c74b03b5130..0aa6213455a4e25b79564bcca4b0b21461f9ac4a 100644 --- a/gkwebapp/templates/viewstockonhandreport.jinja2 +++ b/gkwebapp/templates/viewstockonhandreport.jinja2 @@ -43,19 +43,31 @@ +
+ {% if not gkresult %} +
+ +
+ +
+ {% else %} +
- + {% if userrole != 3 %} + + {% endif %} + +
- +
@@ -65,32 +77,34 @@
-
+
{% if not godown %} - - + + + {% else %} +
+ {% if userrole == 3 %} +
+ + + +
+
+ + {% if godown|length > 1 %} + + {% else %} + + {% endif %} +
{% else %} -
- {% if userrole == 3 %} -
- - - -
-
- - -
- {%else%}
@@ -101,10 +115,9 @@
@@ -120,6 +133,7 @@
+ {%endif%} diff --git a/gkwebapp/templates/viewstockreport.jinja2 b/gkwebapp/templates/viewstockreport.jinja2 index 160026d044522dfc521b240a4d6c58cabd6a2fce..3abf9823aafedbe802e5bf220543e09bac2727f8 100644 --- a/gkwebapp/templates/viewstockreport.jinja2 +++ b/gkwebapp/templates/viewstockreport.jinja2 @@ -38,6 +38,14 @@ + +
+ {% if not gkresult %} +
+ +
+
+ {% else %}