From ecac02b0d68aa3a76e2de62b272ba1dc1984fe0c Mon Sep 17 00:00:00 2001 From: reshma1 Date: Mon, 9 Oct 2017 16:29:17 +0530 Subject: [PATCH 001/121] CESS option is added in select tax combo box --- gkwebapp/static/js/addproduct.js | 11 +++++++---- gkwebapp/templates/addproduct.jinja2 | 23 ++++++++++++----------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/gkwebapp/static/js/addproduct.js b/gkwebapp/static/js/addproduct.js index e3f2dcba..99225c94 100644 --- a/gkwebapp/static/js/addproduct.js +++ b/gkwebapp/static/js/addproduct.js @@ -434,6 +434,7 @@ $("#addcatselect").change(function(event) { ''+ ''+ ''+ + ''+ ''+ ''+ ''+ @@ -545,6 +546,7 @@ $("#addcatselect").change(function(event) { ''+ ''+ ''+ + ''+ ''+ ''+ ''+ @@ -718,11 +720,11 @@ $(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()=='CVAT' || $("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='IGST' || $("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='CESS') && 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' ) { + if ($(".tax_name",this).val()=='CVAT' || $(".tax_name",this).val()=='IGST' || $(".tax_name",this).val()=='CESS' ) { types.push($(".tax_name",this).val()); } }); @@ -815,7 +817,7 @@ $(document).off("change",".tax_name").on("change",".tax_name",function(event) 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" ) { + 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" || $("#product_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "CESS" ) { i = i + 1; } selectedtaxstate = $("#product_tax_table tbody tr:eq("+j+") td:eq(1) select option:selected").attr("stateid"); @@ -924,6 +926,7 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) ''+ ''+ ''+ + ''+ ''+ ''+ ''+ @@ -976,7 +979,7 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) ''+ ''); $(".tax_rate").numeric(); - if (selectedtaxname == "CVAT" || selectedtaxname == "IGST" ) { + if (selectedtaxname == "CVAT" || selectedtaxname == "IGST" || selectedtaxname == "CESS") { $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select option[value='+selectedtaxname+']').prop('hidden', true).prop('disabled', true); } $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); diff --git a/gkwebapp/templates/addproduct.jinja2 b/gkwebapp/templates/addproduct.jinja2 index c9e10957..6d8941c0 100644 --- a/gkwebapp/templates/addproduct.jinja2 +++ b/gkwebapp/templates/addproduct.jinja2 @@ -19,11 +19,11 @@ - +
- + {% 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 +41,7 @@
{% endif %} - +
@@ -74,7 +74,7 @@ {% trans %}Press 'Enter' key to save and 'Esc' key to cancel.{% endtrans %}
- +
@@ -82,7 +82,7 @@
- +
@@ -104,6 +104,7 @@ {%if vatorgstflag=='7' or vatorgstflag=='29' %} + {%endif%} @@ -170,15 +171,15 @@
See more.
- - +
-- GitLab From 51d995d6cb673391b9b0cdab4e75b6e68966d3da Mon Sep 17 00:00:00 2001 From: reshma1 Date: Tue, 10 Oct 2017 14:43:28 +0530 Subject: [PATCH 002/121] CESS option is added in Edit Product --- gkwebapp/static/js/editproduct.js | 38 +++++++++++++--------- gkwebapp/templates/editproductspecs.jinja2 | 5 +-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/gkwebapp/static/js/editproduct.js b/gkwebapp/static/js/editproduct.js index 10ebab3b..ed17072e 100644 --- a/gkwebapp/static/js/editproduct.js +++ b/gkwebapp/static/js/editproduct.js @@ -17,12 +17,12 @@ $(document).ready(function() { $(".numtype").numeric(); }); - + if(sessionStorage.invflag==0){ $(".noinventory").hide(); $("#taxhelp3").hide(); $("#taxhelp4").show(); - + } $(document).off('blur', '.numtype').on('blur', '.numtype', function(event) { @@ -134,7 +134,7 @@ $(document).ready(function() { } else { $("#editproddesc").focus().select(); - + } @@ -290,7 +290,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); $('#product_edit_tax_table tbody tr').remove(); - + for (tax of resp["gkresult"]) { $('#product_edit_tax_table tbody').append(''+ taxhtml + ''); $('#product_edit_tax_table tbody tr:last td:last').append(''); @@ -484,11 +484,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 +496,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 +648,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()=='CVAT' || $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val() =='IGST' || $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val() =='CESS') && 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()); } @@ -751,7 +754,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); 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") { + 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" || $("#product_edit_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "CESS") { i = i + 1; } selectedtaxstate = $("#product_edit_tax_table tbody tr:eq("+j+") td:eq(1) select option:selected").attr("stateid"); @@ -825,7 +828,7 @@ $("#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 ($('#product_edit_tax_table tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="IGST" || $('#product_edit_tax_table tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="CESS" && $("#vatorgstflag").val()!='29') { if ($("#invflag").val()==0){ $("#epsubmit").focus(); } @@ -883,6 +886,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); ''+ ''+ ''+ + ''+ ''+ ''+ ''+ @@ -935,7 +939,7 @@ $("#product_edit_tax_table tbody tr:first td:eq(0) select").focus(); ''+ ''); $(".tax_rate").numeric(); - if (selectedtaxname == "CVAT" || selectedtaxname == "IGST") { + if (selectedtaxname == "CVAT" || selectedtaxname == "IGST" || selectedtaxname == "CESS") { $('#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 tr:eq('+nextindex1+') td:eq(0) select').focus().select(); @@ -1232,15 +1236,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(){ @@ -1365,7 +1373,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/templates/editproductspecs.jinja2 b/gkwebapp/templates/editproductspecs.jinja2 index 551822db..f40a4434 100644 --- a/gkwebapp/templates/editproductspecs.jinja2 +++ b/gkwebapp/templates/editproductspecs.jinja2 @@ -67,7 +67,7 @@
{%endif%}
- + {% if prodspecs|length > 0 %}
@@ -113,7 +113,7 @@
- {% endif %} + {% endif %}
@@ -141,6 +141,7 @@ {%if vatorgstflag=='7' or vatorgstflag=='29'%} + {%endif%} -- GitLab From ee3635dc9c90aec98fe112b5ba8a0d585f8c1a80 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Tue, 10 Oct 2017 16:34:52 +0530 Subject: [PATCH 003/121] small bug is removed from edit product --- gkwebapp/static/js/editproduct.js | 9 +-------- gkwebapp/views/product.py | 9 ++++----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/gkwebapp/static/js/editproduct.js b/gkwebapp/static/js/editproduct.js index ed17072e..68ee1602 100644 --- a/gkwebapp/static/js/editproduct.js +++ b/gkwebapp/static/js/editproduct.js @@ -1306,14 +1306,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())!="") { diff --git a/gkwebapp/views/product.py b/gkwebapp/views/product.py index 0d0eed53..a9afe3a7 100644 --- a/gkwebapp/views/product.py +++ b/gkwebapp/views/product.py @@ -241,11 +241,10 @@ def editproduct(request): taxresult = requests.delete("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) for tax in taxes: if len(tax)!=0: - if tax["taxrowid"]=="new": - taxdata= {"taxname":tax["taxname"],"taxrate":float(tax["taxrate"]),"productcode":proddetails["productcode"]} - if tax["state"]!='': - taxdata["state"]=tax["state"] - taxresult = requests.post("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) + taxdata= {"taxname":tax["taxname"],"taxrate":float(tax["taxrate"]),"productcode":proddetails["productcode"]} + if tax["state"]!='': + taxdata["state"]=tax["state"] + taxresult = requests.post("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) return {"gkstatus": result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=delete", renderer="json") -- GitLab From 7290993874de1ff07ab71bad0e3f8fe8211eb503 Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Wed, 11 Oct 2017 07:42:46 +0530 Subject: [PATCH 004/121] Untabified product.py. Product templates now gets states from backend. --- gkwebapp/templates/editproductspecs.jinja2 | 44 +- gkwebapp/views/product.py | 1226 ++++++++++---------- 2 files changed, 621 insertions(+), 649 deletions(-) diff --git a/gkwebapp/templates/editproductspecs.jinja2 b/gkwebapp/templates/editproductspecs.jinja2 index f40a4434..a4667465 100644 --- a/gkwebapp/templates/editproductspecs.jinja2 +++ b/gkwebapp/templates/editproductspecs.jinja2 @@ -9,7 +9,7 @@
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {% for state in states %} + {% for key, value in state.items() %} + + {% endfor %} + {% endfor %} diff --git a/gkwebapp/views/product.py b/gkwebapp/views/product.py index a9afe3a7..61c522e4 100644 --- a/gkwebapp/views/product.py +++ b/gkwebapp/views/product.py @@ -41,736 +41,740 @@ from odslib import ODS @view_config(route_name="product",request_param="type=tab", renderer="gkwebapp:templates/producttab.jinja2") def showproducttab(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products",headers=header) - return{"numberofproducts":len(result.json()["gkresult"]),"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products",headers=header) + return{"numberofproducts":len(result.json()["gkresult"]),"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=addtabvat", renderer="gkwebapp:templates/addproductvat.jinja2") def addProductTabVat(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/categories", headers=header) - result1 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) - result2 = requests.get("http://127.0.0.1:6543/godown", headers=header) - return{"gkresult":{"category":result.json()["gkresult"],"uom":result1.json()["gkresult"]},"godown":result2.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/categories", headers=header) + result1 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) + result2 = requests.get("http://127.0.0.1:6543/godown", headers=header) + states = requests.get("http://127.0.0.1:6543/state", headers=header) + return{"gkresult":{"category":result.json()["gkresult"],"uom":result1.json()["gkresult"]},"godown":result2.json()["gkresult"],"gkstatus":result.json()["gkstatus"], "states": states.json()["gkresult"]} @view_config(route_name="product",request_param="type=addtab", renderer="gkwebapp:templates/addproduct.jinja2") def addproducttab(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/categories", headers=header) - result1 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) - result2 = requests.get("http://127.0.0.1:6543/godown", headers=header) - resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) - return{"gkresult":{"category":result.json()["gkresult"],"uom":result1.json()["gkresult"]},"godown":result2.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/categories", headers=header) + result1 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) + result2 = requests.get("http://127.0.0.1:6543/godown", headers=header) + resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + states = requests.get("http://127.0.0.1:6543/state", headers=header) + return{"gkresult":{"category":result.json()["gkresult"],"uom":result1.json()["gkresult"]},"godown":result2.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} @view_config(route_name="product",request_param="type=specs", renderer="gkwebapp:templates/addproductspecs.jinja2") def getcatspecs(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/categoryspecs?categorycode=%d"%(int(request.params["categorycode"])), headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/categoryspecs?categorycode=%d"%(int(request.params["categorycode"])), headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=cattax", renderer="json") def getcattax(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/tax?pscflag=c&categorycode=%d"%(int(request.params["categorycode"])), headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/tax?pscflag=c&categorycode=%d"%(int(request.params["categorycode"])), headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="by=category", renderer="json") def getprodbycat(request): - header={"gktoken":request.headers["gktoken"]} - if request.params["categorycode"]=="": - result = requests.get("http://127.0.0.1:6543/products?by=category&categorycode=", headers=header) - else: - result = requests.get("http://127.0.0.1:6543/products?by=category&categorycode=%d"%(int(request.params["categorycode"])), headers=header) + header={"gktoken":request.headers["gktoken"]} + if request.params["categorycode"]=="": + result = requests.get("http://127.0.0.1:6543/products?by=category&categorycode=", headers=header) + else: + result = requests.get("http://127.0.0.1:6543/products?by=category&categorycode=%d"%(int(request.params["categorycode"])), headers=header) - if len(result.json()["gkresult"])==0: - return{"gkresult":0,"gkstatus":result.json()["gkstatus"]} - else: - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + if len(result.json()["gkresult"])==0: + return{"gkresult":0,"gkstatus":result.json()["gkstatus"]} + else: + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} '''This method is used to get opening stock and godown id's of given productcode(i.e. opening stock of a product in different godowns).''' @view_config(route_name="product",request_param="by=godown", renderer="json") def getgodownproduct(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products?by=godown&productcode=%d"%int(request.params["productcode"]), headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products?by=godown&productcode=%d"%int(request.params["productcode"]), headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=prodtax", renderer="json") def getprodtax(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/tax?pscflag=p&productcode=%d"%(int(request.params["productcode"])), headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/tax?pscflag=p&productcode=%d"%(int(request.params["productcode"])), headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=uom", renderer="json") def produom(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.post("http://127.0.0.1:6543/unitofmeasurement", data=json.dumps({"unitname":request.params["unitname"]}),headers=header) - if result.json()["gkstatus"] ==0: - result = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) - return {"gkstatus": result.json()["gkstatus"], "gkresult": result.json()["gkresult"]} - else: - return{"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.post("http://127.0.0.1:6543/unitofmeasurement", data=json.dumps({"unitname":request.params["unitname"]}),headers=header) + if result.json()["gkstatus"] ==0: + result = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) + return {"gkstatus": result.json()["gkstatus"], "gkresult": result.json()["gkresult"]} + else: + return{"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=save", renderer="json") def saveproduct(request): - header={"gktoken":request.headers["gktoken"]} - prdspecs = {} - proddetails={} - productdetails={} - godownflag=False - taxes =0 - godowns={} - goid=0 - goopeningstock=0.00 - for prd in request.params: - - if prd=="type": - continue - elif prd=="godownflag": - if int(request.params[prd]) > 0: - godownflag=True - else: - godownflag=False - elif prd =="catselect": - if request.params[prd] !="": - proddetails["categorycode"] = request.params[prd] - elif prd == "addproddesc": - proddetails["productdesc"] = request.params[prd] - elif prd == "uom": - proddetails["uomid"] = request.params[prd] - elif prd == "openingstock": - proddetails["openingstock"] = request.params[prd] - elif prd == "taxes": - taxes = json.loads(request.params["taxes"]) - elif prd == "godowns": - godowns = json.loads(request.params["godowns"]) - elif prd == "newuom": - continue - else: - proddetails["specs"]= json.loads(request.params["specs"]) - - if request.params.has_key("gscode"): - proddetails["gscode"]=request.params["gscode"] - if request.params.has_key("gsflag"): - proddetails["gsflag"]=request.params["gsflag"] - else: - proddetails["gsflag"] = 7 - - productdetails = {"productdetails":proddetails, "godetails":godowns, "godownflag":godownflag} - if godownflag == True: - godnames = "" - j = 1; - for i in godowns.keys(): - resultgodown = requests.get("http://127.0.0.1:6543/godown?qty=single&goid=%d"%(int(i)), headers=header) - godnames += resultgodown.json()["gkresult"]["goname"] + "(" + resultgodown.json()["gkresult"]["goaddr"] + ")" - if j != len(godowns): - godnames += ", " - j += 1 - - result = requests.post("http://127.0.0.1:6543/products",data=json.dumps(productdetails),headers=header) - - if result.json()["gkstatus"] == 0: - if godownflag == True: - gkdata = {"activity":proddetails["productdesc"] + " product created in " + godnames + " godowns"} - else: - gkdata = {"activity":proddetails["productdesc"] + " product created"} - resultlog = requests.post("http://127.0.0.1:6543/log", data =json.dumps(gkdata),headers=header) - - if result.json()["gkstatus"] == 0: - if len(taxes)>0: - for tax in taxes: - taxdata= {"taxname":tax["taxname"],"taxrate":float(tax["taxrate"]),"productcode":result.json()["gkresult"]} - if tax["state"]!='': - taxdata["state"]=tax["state"] - - taxresult = requests.post("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) - return {"gkstatus": result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + prdspecs = {} + proddetails={} + productdetails={} + godownflag=False + taxes =0 + godowns={} + goid=0 + goopeningstock=0.00 + for prd in request.params: + + if prd=="type": + continue + elif prd=="godownflag": + if int(request.params[prd]) > 0: + godownflag=True + else: + godownflag=False + elif prd =="catselect": + if request.params[prd] !="": + proddetails["categorycode"] = request.params[prd] + elif prd == "addproddesc": + proddetails["productdesc"] = request.params[prd] + elif prd == "uom": + proddetails["uomid"] = request.params[prd] + elif prd == "openingstock": + proddetails["openingstock"] = request.params[prd] + elif prd == "taxes": + taxes = json.loads(request.params["taxes"]) + elif prd == "godowns": + godowns = json.loads(request.params["godowns"]) + elif prd == "newuom": + continue + else: + proddetails["specs"]= json.loads(request.params["specs"]) + + if request.params.has_key("gscode"): + proddetails["gscode"]=request.params["gscode"] + if request.params.has_key("gsflag"): + proddetails["gsflag"]=request.params["gsflag"] + else: + proddetails["gsflag"] = 7 + + productdetails = {"productdetails":proddetails, "godetails":godowns, "godownflag":godownflag} + if godownflag == True: + godnames = "" + j = 1; + for i in godowns.keys(): + resultgodown = requests.get("http://127.0.0.1:6543/godown?qty=single&goid=%d"%(int(i)), headers=header) + godnames += resultgodown.json()["gkresult"]["goname"] + "(" + resultgodown.json()["gkresult"]["goaddr"] + ")" + if j != len(godowns): + godnames += ", " + j += 1 + + result = requests.post("http://127.0.0.1:6543/products",data=json.dumps(productdetails),headers=header) + + if result.json()["gkstatus"] == 0: + if godownflag == True: + gkdata = {"activity":proddetails["productdesc"] + " product created in " + godnames + " godowns"} + else: + gkdata = {"activity":proddetails["productdesc"] + " product created"} + resultlog = requests.post("http://127.0.0.1:6543/log", data =json.dumps(gkdata),headers=header) + + if result.json()["gkstatus"] == 0: + if len(taxes)>0: + for tax in taxes: + taxdata= {"taxname":tax["taxname"],"taxrate":float(tax["taxrate"]),"productcode":result.json()["gkresult"]} + if tax["state"]!='': + taxdata["state"]=tax["state"] + + taxresult = requests.post("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) + return {"gkstatus": result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=edit", renderer="json") def editproduct(request): - header={"gktoken":request.headers["gktoken"]} - proddetails={} - productdetails={} - taxes =0 - taxdata = {} - godownflag=False - godowns={} - goid=0 - goopeningstock=0.00 - for prd in request.params: - if prd=="type": - continue - elif prd=="godownflag": - if int(request.params[prd]) > 0: - godownflag=True - else: - godownflag=False - elif prd =="productcode": - proddetails["productcode"] = request.params[prd] - elif prd =="catselect": - if request.params[prd] !="": - proddetails["categorycode"] = request.params[prd] - elif prd == "editproddesc": - proddetails["productdesc"] = request.params[prd]; - elif prd == "uom": - proddetails["uomid"] = request.params[prd] - elif prd == "openingstock": - proddetails["openingstock"] = request.params[prd] - elif prd == "taxes": - taxes = json.loads(request.params["taxes"]) - elif prd == "godowns": - godowns = json.loads(request.params["godowns"]) - else: - proddetails["specs"]= json.loads(request.params["specs"]) - if request.params.has_key("gscode"): - proddetails["gscode"]=request.params["gscode"] - if request.params.has_key("gsflag"): - proddetails["gsflag"]=request.params["gsflag"] - else: - proddetails["gsflag"] = 7 - - - productdetails = {"productdetails":proddetails, "godetails":godowns, "godownflag":godownflag} - result = requests.put("http://127.0.0.1:6543/products", data=json.dumps(productdetails),headers=header) - if result.json()["gkstatus"] == 0: - for tax in taxes: - if len(tax)!=0: - if tax["taxrowid"]!="new": - taxdata["taxid"] = tax["taxrowid"] - taxresult = requests.delete("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) - for tax in taxes: - if len(tax)!=0: - taxdata= {"taxname":tax["taxname"],"taxrate":float(tax["taxrate"]),"productcode":proddetails["productcode"]} - if tax["state"]!='': - taxdata["state"]=tax["state"] - taxresult = requests.post("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) - return {"gkstatus": result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + proddetails={} + productdetails={} + taxes =0 + taxdata = {} + godownflag=False + godowns={} + goid=0 + goopeningstock=0.00 + for prd in request.params: + if prd=="type": + continue + elif prd=="godownflag": + if int(request.params[prd]) > 0: + godownflag=True + else: + godownflag=False + elif prd =="productcode": + proddetails["productcode"] = request.params[prd] + elif prd =="catselect": + if request.params[prd] !="": + proddetails["categorycode"] = request.params[prd] + elif prd == "editproddesc": + proddetails["productdesc"] = request.params[prd]; + elif prd == "uom": + proddetails["uomid"] = request.params[prd] + elif prd == "openingstock": + proddetails["openingstock"] = request.params[prd] + elif prd == "taxes": + taxes = json.loads(request.params["taxes"]) + elif prd == "godowns": + godowns = json.loads(request.params["godowns"]) + else: + proddetails["specs"]= json.loads(request.params["specs"]) + if request.params.has_key("gscode"): + proddetails["gscode"]=request.params["gscode"] + if request.params.has_key("gsflag"): + proddetails["gsflag"]=request.params["gsflag"] + else: + proddetails["gsflag"] = 7 + + + productdetails = {"productdetails":proddetails, "godetails":godowns, "godownflag":godownflag} + result = requests.put("http://127.0.0.1:6543/products", data=json.dumps(productdetails),headers=header) + if result.json()["gkstatus"] == 0: + for tax in taxes: + if len(tax)!=0: + if tax["taxrowid"]!="new": + taxdata["taxid"] = tax["taxrowid"] + taxresult = requests.delete("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) + for tax in taxes: + if len(tax)!=0: + taxdata= {"taxname":tax["taxname"],"taxrate":float(tax["taxrate"]),"productcode":proddetails["productcode"]} + if tax["state"]!='': + taxdata["state"]=tax["state"] + taxresult = requests.post("http://127.0.0.1:6543/tax",data=json.dumps(taxdata) ,headers=header) + return {"gkstatus": result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=delete", renderer="json") def deleteproduct(request): - header={"gktoken":request.headers["gktoken"]} - resultprod = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) - resultgoprod = requests.get("http://127.0.0.1:6543/products?by=godown&productcode=%d"%(int(request.params["productcode"])), headers=header) - goproddata = resultgoprod.json()["gkresult"] - result = requests.delete("http://127.0.0.1:6543/products", data=json.dumps({"productcode":request.params["productcode"]}),headers=header) - if result.json()["gkstatus"] == 0: - goddetdata = "" - if len(goproddata) > 0: - goddetdata = " from godown " - j = 1 - for goprod in goproddata: - result = requests.get("http://127.0.0.1:6543/godown?qty=single&goid=%d"%(int(goprod["goid"])), headers=header) - goddetdata = goddetdata + result.json()["gkresult"]["goname"] + "(" + result.json()["gkresult"]["goaddr"] + ")" - if j != len(goproddata): - goddetdata += ", " - j += 1 - gkdata = {"activity":resultprod.json()["gkresult"]["productdesc"] + " product deleted" + goddetdata + "."} - resultlog = requests.post("http://127.0.0.1:6543/log", data =json.dumps(gkdata),headers=header) - return{"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + resultprod = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) + resultgoprod = requests.get("http://127.0.0.1:6543/products?by=godown&productcode=%d"%(int(request.params["productcode"])), headers=header) + goproddata = resultgoprod.json()["gkresult"] + result = requests.delete("http://127.0.0.1:6543/products", data=json.dumps({"productcode":request.params["productcode"]}),headers=header) + if result.json()["gkstatus"] == 0: + goddetdata = "" + if len(goproddata) > 0: + goddetdata = " from godown " + j = 1 + for goprod in goproddata: + result = requests.get("http://127.0.0.1:6543/godown?qty=single&goid=%d"%(int(goprod["goid"])), headers=header) + goddetdata = goddetdata + result.json()["gkresult"]["goname"] + "(" + result.json()["gkresult"]["goaddr"] + ")" + if j != len(goproddata): + goddetdata += ", " + j += 1 + gkdata = {"activity":resultprod.json()["gkresult"]["productdesc"] + " product deleted" + goddetdata + "."} + resultlog = requests.post("http://127.0.0.1:6543/log", data =json.dumps(gkdata),headers=header) + return{"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=edittab", renderer="gkwebapp:templates/editproduct.jinja2") def editproducttab(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products",headers=header) - resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products",headers=header) + resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} @view_config(route_name="product",request_param="type=edittabvat", renderer="gkwebapp:templates/editproductvat.jinja2") def editProductTabVat(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products",headers=header) - resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products",headers=header) + resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} @view_config(route_name="product",request_param="type=details", renderer="gkwebapp:templates/editproductspecs.jinja2") def productdetails(request): - header={"gktoken":request.headers["gktoken"]} - prodspecs={} - result = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) - resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + header={"gktoken":request.headers["gktoken"]} + prodspecs={} + result = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) + resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + states = requests.get("http://127.0.0.1:6543/state", headers=header) - if result.json()["gkresult"]["gsflag"]==7: + if result.json()["gkresult"]["gsflag"]==7: - if result.json()["gkresult"]["categorycode"]!=None: - result1 = requests.get("http://127.0.0.1:6543/categoryspecs?categorycode=%d"%(int(result.json()["gkresult"]["categorycode"])), headers=header) - prodspecs = result1.json()["gkresult"] - result2 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) + if result.json()["gkresult"]["categorycode"]!=None: + result1 = requests.get("http://127.0.0.1:6543/categoryspecs?categorycode=%d"%(int(result.json()["gkresult"]["categorycode"])), headers=header) + prodspecs = result1.json()["gkresult"] + result2 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) - result3 = requests.get("http://127.0.0.1:6543/categories", headers=header) - result4 = requests.get("http://127.0.0.1:6543/godown", headers=header) - numberofgodowns = int(result.json()["numberofgodowns"]) - return{"proddesc":result.json()["gkresult"],"prodspecs":prodspecs,"uom":result2.json()["gkresult"],"category":result3.json()["gkresult"],"godown":result4.json()["gkresult"],"numberofgodowns":numberofgodowns,"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} - else: - return{"proddesc":result.json()["gkresult"],"vatorgstflag":resultgstvat.json()["gkresult"]} + result3 = requests.get("http://127.0.0.1:6543/categories", headers=header) + result4 = requests.get("http://127.0.0.1:6543/godown", headers=header) + numberofgodowns = int(result.json()["numberofgodowns"]) + return{"proddesc":result.json()["gkresult"],"prodspecs":prodspecs,"uom":result2.json()["gkresult"],"category":result3.json()["gkresult"],"godown":result4.json()["gkresult"],"numberofgodowns":numberofgodowns,"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} + else: + return{"proddesc":result.json()["gkresult"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} @view_config(route_name="product",request_param="type=detailsvat", renderer="gkwebapp:templates/editproductspecsvat.jinja2") def productDetailsVat(request): - header={"gktoken":request.headers["gktoken"]} - prodspecs={} - result = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) - resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + header={"gktoken":request.headers["gktoken"]} + prodspecs={} + result = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) + resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + states = requests.get("http://127.0.0.1:6543/state", headers=header) - if result.json()["gkresult"]["gsflag"]==7: + if result.json()["gkresult"]["gsflag"]==7: - if result.json()["gkresult"]["categorycode"]!=None: - result1 = requests.get("http://127.0.0.1:6543/categoryspecs?categorycode=%d"%(int(result.json()["gkresult"]["categorycode"])), headers=header) - prodspecs = result1.json()["gkresult"] - result2 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) + if result.json()["gkresult"]["categorycode"]!=None: + result1 = requests.get("http://127.0.0.1:6543/categoryspecs?categorycode=%d"%(int(result.json()["gkresult"]["categorycode"])), headers=header) + prodspecs = result1.json()["gkresult"] + result2 = requests.get("http://127.0.0.1:6543/unitofmeasurement?qty=all", headers=header) - result3 = requests.get("http://127.0.0.1:6543/categories", headers=header) - result4 = requests.get("http://127.0.0.1:6543/godown", headers=header) - numberofgodowns = int(result.json()["numberofgodowns"]) - return{"proddesc":result.json()["gkresult"],"prodspecs":prodspecs,"uom":result2.json()["gkresult"],"category":result3.json()["gkresult"],"godown":result4.json()["gkresult"],"numberofgodowns":numberofgodowns,"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} - else: - return{"proddesc":result.json()["gkresult"],"vatorgstflag":resultgstvat.json()["gkresult"]} + result3 = requests.get("http://127.0.0.1:6543/categories", headers=header) + result4 = requests.get("http://127.0.0.1:6543/godown", headers=header) + numberofgodowns = int(result.json()["numberofgodowns"]) + return{"proddesc":result.json()["gkresult"],"prodspecs":prodspecs,"uom":result2.json()["gkresult"],"category":result3.json()["gkresult"],"godown":result4.json()["gkresult"],"numberofgodowns":numberofgodowns,"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} + else: + return{"proddesc":result.json()["gkresult"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} @view_config(route_name="product",request_param="type=list", renderer="gkwebapp:templates/listofstockitems.jinja2") def listofstockitems(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products",headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products",headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=printable", renderer="gkwebapp:templates/printlistofstockitems.jinja2") def printlistofstockitems(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products",headers=header) + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products",headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="product",request_param="type=spreadsheet", renderer="") def listofstockitemsspreadsheet(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products", headers=header) - resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) - resultgstvat = resultgstvat.json()["gkresult"] - result = result.json()["gkresult"] - fystart = str(request.params["fystart"]); - fyend = str(request.params["fyend"]); - orgname = str(request.params["orgname"]) - orgname += " (FY: " + fystart+" to "+fyend +")" - ods = ODS() - sheet = ods.content.getSheet(0) - sheet.setSheetName("List of Products") - sheet.getRow(0).setHeight("23pt") - - sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") - ods.content.mergeCells(0,0,4,1) - sheet.getRow(1).setHeight("18pt") - sheet.getCell(0,1).stringValue("List Of Products").setBold(True).setFontSize("14pt").setAlignHorizontal("center") - ods.content.mergeCells(0,1,4,1) - sheet.getColumn(1).setWidth("9cm") - sheet.getColumn(2).setWidth("4cm") - sheet.getColumn(3).setWidth("4cm") - sheet.getCell(0,2).stringValue("Sr. No.").setBold(True) - if resultgstvat == "22": - sheet.getCell(1,2).stringValue("Product").setBold(True) - sheet.getCell(2,2).stringValue("Category").setBold(True) - sheet.getCell(3,2).stringValue("UOM").setBold(True) - else: - sheet.getCell(1,2).stringValue("Product / Service").setBold(True) - sheet.getCell(2,2).stringValue("Type").setBold(True) - sheet.getCell(3,2).stringValue("Category").setBold(True) - sheet.getCell(4,2).stringValue("UOM").setBold(True) - - if resultgstvat == "22": - row = 3 - for stock in result: - sheet.getCell(0, row).stringValue(stock["srno"]) - sheet.getCell(1, row).stringValue(stock["productdesc"]) - sheet.getCell(2, row).stringValue(stock["categoryname"]) - sheet.getCell(3, row).stringValue(stock["unitname"]) - row += 1 - else: - row = 4 - for stock in result: - sheet.getCell(0, row).stringValue(stock["srno"]) - sheet.getCell(1, row).stringValue(stock["productdesc"]) - if stock["gsflag"] == 7: - sheet.getCell(2, row).stringValue("Product") - else: - sheet.getCell(2, row).stringValue("Service") - sheet.getCell(3, row).stringValue(stock["categoryname"]) - sheet.getCell(4, row).stringValue(stock["unitname"]) - row += 1 - - ods.save("response.ods") - repFile = open("response.ods") - rep = repFile.read() - repFile.close() - headerList = {'Content-Type':'application/vnd.oasis.opendocument.spreadsheet ods' ,'Content-Length': len(rep),'Content-Disposition': 'attachment; filename=report.ods', 'Set-Cookie':'fileDownload=true; path=/'} - os.remove("response.ods") - return Response(rep, headerlist=headerList.items()) + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products", headers=header) + resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + resultgstvat = resultgstvat.json()["gkresult"] + result = result.json()["gkresult"] + fystart = str(request.params["fystart"]); + fyend = str(request.params["fyend"]); + orgname = str(request.params["orgname"]) + orgname += " (FY: " + fystart+" to "+fyend +")" + ods = ODS() + sheet = ods.content.getSheet(0) + sheet.setSheetName("List of Products") + sheet.getRow(0).setHeight("23pt") + + sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") + ods.content.mergeCells(0,0,4,1) + sheet.getRow(1).setHeight("18pt") + sheet.getCell(0,1).stringValue("List Of Products").setBold(True).setFontSize("14pt").setAlignHorizontal("center") + ods.content.mergeCells(0,1,4,1) + sheet.getColumn(1).setWidth("9cm") + sheet.getColumn(2).setWidth("4cm") + sheet.getColumn(3).setWidth("4cm") + sheet.getCell(0,2).stringValue("Sr. No.").setBold(True) + if resultgstvat == "22": + sheet.getCell(1,2).stringValue("Product").setBold(True) + sheet.getCell(2,2).stringValue("Category").setBold(True) + sheet.getCell(3,2).stringValue("UOM").setBold(True) + else: + sheet.getCell(1,2).stringValue("Product / Service").setBold(True) + sheet.getCell(2,2).stringValue("Type").setBold(True) + sheet.getCell(3,2).stringValue("Category").setBold(True) + sheet.getCell(4,2).stringValue("UOM").setBold(True) + + if resultgstvat == "22": + row = 3 + for stock in result: + sheet.getCell(0, row).stringValue(stock["srno"]) + sheet.getCell(1, row).stringValue(stock["productdesc"]) + sheet.getCell(2, row).stringValue(stock["categoryname"]) + sheet.getCell(3, row).stringValue(stock["unitname"]) + row += 1 + else: + row = 4 + for stock in result: + sheet.getCell(0, row).stringValue(stock["srno"]) + sheet.getCell(1, row).stringValue(stock["productdesc"]) + if stock["gsflag"] == 7: + sheet.getCell(2, row).stringValue("Product") + else: + sheet.getCell(2, row).stringValue("Service") + sheet.getCell(3, row).stringValue(stock["categoryname"]) + sheet.getCell(4, row).stringValue(stock["unitname"]) + row += 1 + + ods.save("response.ods") + repFile = open("response.ods") + rep = repFile.read() + repFile.close() + headerList = {'Content-Type':'application/vnd.oasis.opendocument.spreadsheet ods' ,'Content-Length': len(rep),'Content-Disposition': 'attachment; filename=report.ods', 'Set-Cookie':'fileDownload=true; path=/'} + os.remove("response.ods") + return Response(rep, headerlist=headerList.items()) @view_config(route_name="product",request_param="type=viewstockreport", renderer="gkwebapp:templates/viewstockreport.jinja2") def viewstockreport(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products?invdc=4",headers=header) - result1 = requests.get("http://127.0.0.1:6543/godown",headers=header) - result2 = requests.get("http://127.0.0.1:6543/login", headers=header) - userrole = result2.json()["gkresult"]["userrole"] - return{"gkresult":result.json()["gkresult"], "godown":result1.json()["gkresult"], "gkstatus":result.json()["gkstatus"], "userrole":userrole} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products?invdc=4",headers=header) + result1 = requests.get("http://127.0.0.1:6543/godown",headers=header) + result2 = requests.get("http://127.0.0.1:6543/login", headers=header) + userrole = result2.json()["gkresult"]["userrole"] + return{"gkresult":result.json()["gkresult"], "godown":result1.json()["gkresult"], "gkstatus":result.json()["gkstatus"], "userrole":userrole} @view_config(route_name="product",request_param="type=showstockreport") def showstockreport(request): - header={"gktoken":request.headers["gktoken"]} - godownflag = int(request.params["godownflag"]) - goid = int(request.params["goid"]) - goname = request.params["goname"] - if godownflag==1: - goaddr = request.params["goaddr"] - productcode = int(request.params["productcode"]) - calculatefrom = request.params["calculatefrom"] - calculateto = request.params["calculateto"] - scalculatefrom = request.params["calculatefrom"] - scalculateto = request.params["calculateto"] - productdesc = request.params["productdesc"] - if int(request.params["backflag"]) > 0: - scalculatefrom = datetime.strptime(calculatefrom, '%d-%m-%Y').strftime('%Y-%m-%d') - scalculateto = datetime.strptime(calculateto, '%d-%m-%Y').strftime('%Y-%m-%d') - stockrefresh = {"productcode":productcode,"calculatefrom":calculatefrom,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid } - else: - stockrefresh = {"productcode":productcode,"calculatefrom":datetime.strptime(calculatefrom, '%Y-%m-%d').strftime('%d-%m-%Y'),"calculateto":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y'),"productdesc":productdesc,"godownflag":godownflag,"goid":goid} - if godownflag>0: - result = requests.get("http://127.0.0.1:6543/report?type=godownstockreport&goid=%d&productcode=%d&startdate=%s&enddate=%s"%(goid, productcode, scalculatefrom, scalculateto),headers=header) - else: - result = requests.get("http://127.0.0.1:6543/report?type=stockreport&productcode=%d&startdate=%s&enddate=%s"%(productcode, scalculatefrom, scalculateto),headers=header) - if godownflag==1: - return render_to_response("gkwebapp:templates/showstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname, "godownadd":goaddr},request=request) - return render_to_response("gkwebapp:templates/showstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) + header={"gktoken":request.headers["gktoken"]} + godownflag = int(request.params["godownflag"]) + goid = int(request.params["goid"]) + goname = request.params["goname"] + if godownflag==1: + goaddr = request.params["goaddr"] + productcode = int(request.params["productcode"]) + calculatefrom = request.params["calculatefrom"] + calculateto = request.params["calculateto"] + scalculatefrom = request.params["calculatefrom"] + scalculateto = request.params["calculateto"] + productdesc = request.params["productdesc"] + if int(request.params["backflag"]) > 0: + scalculatefrom = datetime.strptime(calculatefrom, '%d-%m-%Y').strftime('%Y-%m-%d') + scalculateto = datetime.strptime(calculateto, '%d-%m-%Y').strftime('%Y-%m-%d') + stockrefresh = {"productcode":productcode,"calculatefrom":calculatefrom,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid } + else: + stockrefresh = {"productcode":productcode,"calculatefrom":datetime.strptime(calculatefrom, '%Y-%m-%d').strftime('%d-%m-%Y'),"calculateto":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y'),"productdesc":productdesc,"godownflag":godownflag,"goid":goid} + if godownflag>0: + result = requests.get("http://127.0.0.1:6543/report?type=godownstockreport&goid=%d&productcode=%d&startdate=%s&enddate=%s"%(goid, productcode, scalculatefrom, scalculateto),headers=header) + else: + result = requests.get("http://127.0.0.1:6543/report?type=stockreport&productcode=%d&startdate=%s&enddate=%s"%(productcode, scalculatefrom, scalculateto),headers=header) + if godownflag==1: + return render_to_response("gkwebapp:templates/showstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname, "godownadd":goaddr},request=request) + return render_to_response("gkwebapp:templates/showstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) @view_config(route_name="product",request_param="type=printablestockreport") def printablestockreport(request): - header={"gktoken":request.headers["gktoken"]} - godownflag = int(request.params["godownflag"]) - goid = int(request.params["goid"]) - goname = request.params["goname"] - if godownflag==1: - goaddr = request.params["goaddr"] - productcode = int(request.params["productcode"]) - scalculatefrom = request.params["calculatefrom"] - scalculateto = request.params["calculateto"] - calculatefrom = datetime.strptime(scalculatefrom, '%d-%m-%Y').strftime('%Y-%m-%d') - calculateto = datetime.strptime(scalculateto, '%d-%m-%Y').strftime('%Y-%m-%d') - productdesc = request.params["productdesc"] - stockrefresh = {"productcode":productcode,"calculatefrom":scalculatefrom,"calculateto":scalculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} - if godownflag > 0: - result = requests.get("http://127.0.0.1:6543/report?type=godownstockreport&productcode=%d&startdate=%s&enddate=%s&goid=%d&godownflag=%d"%(productcode, calculatefrom, calculateto, goid, godownflag),headers=header) - else: - result = requests.get("http://127.0.0.1:6543/report?type=stockreport&productcode=%d&startdate=%s&enddate=%s"%(productcode, calculatefrom, calculateto),headers=header) - if godownflag==1: - return render_to_response("gkwebapp:templates/printstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname, "godownadd":goaddr},request=request) - return render_to_response("gkwebapp:templates/printstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) + header={"gktoken":request.headers["gktoken"]} + godownflag = int(request.params["godownflag"]) + goid = int(request.params["goid"]) + goname = request.params["goname"] + if godownflag==1: + goaddr = request.params["goaddr"] + productcode = int(request.params["productcode"]) + scalculatefrom = request.params["calculatefrom"] + scalculateto = request.params["calculateto"] + calculatefrom = datetime.strptime(scalculatefrom, '%d-%m-%Y').strftime('%Y-%m-%d') + calculateto = datetime.strptime(scalculateto, '%d-%m-%Y').strftime('%Y-%m-%d') + productdesc = request.params["productdesc"] + stockrefresh = {"productcode":productcode,"calculatefrom":scalculatefrom,"calculateto":scalculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} + if godownflag > 0: + result = requests.get("http://127.0.0.1:6543/report?type=godownstockreport&productcode=%d&startdate=%s&enddate=%s&goid=%d&godownflag=%d"%(productcode, calculatefrom, calculateto, goid, godownflag),headers=header) + else: + result = requests.get("http://127.0.0.1:6543/report?type=stockreport&productcode=%d&startdate=%s&enddate=%s"%(productcode, calculatefrom, calculateto),headers=header) + if godownflag==1: + return render_to_response("gkwebapp:templates/printstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname, "godownadd":goaddr},request=request) + return render_to_response("gkwebapp:templates/printstockreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) @view_config(route_name="product",request_param="type=stockreportspreadsheet", renderer="") def stockreportspreadsheet(request): - header={"gktoken":request.headers["gktoken"]} - godownflag = int(request.params["godownflag"]) - goid = int(request.params["goid"]) - goname = request.params["goname"] - if godownflag==1: - goaddr = request.params["goaddr"] - productcode = int(request.params["productcode"]) - calculatefrom = request.params["calculatefrom"] - calculateto = request.params["calculateto"] - scalculatefrom = datetime.strptime(calculatefrom, '%d-%m-%Y').strftime('%Y-%m-%d') - scalculateto = datetime.strptime(calculateto, '%d-%m-%Y').strftime('%Y-%m-%d') - productdesc = request.params["productdesc"] - if godownflag > 0: - result = requests.get("http://127.0.0.1:6543/report?type=godownstockreport&productcode=%d&startdate=%s&enddate=%s&goid=%d&godownflag=%d"%(productcode, scalculatefrom, scalculateto, goid, godownflag),headers=header) - else: - result = requests.get("http://127.0.0.1:6543/report?type=stockreport&productcode=%d&startdate=%s&enddate=%s"%(productcode, scalculatefrom, scalculateto),headers=header) - result = result.json()["gkresult"] - fystart = str(request.params["fystart"]); - ystart = datetime.strptime(fystart, '%Y-%m-%d').strftime('%d-%m-%Y') - fyend = str(request.params["fyend"]); - orgname = str(request.params["orgname"]) - orgname += " (FY: " + ystart+" to "+fyend +")" - ods = ODS() - sheet = ods.content.getSheet(0) - sheet.setSheetName("Product Report") - sheet.getRow(0).setHeight("23pt") - - if godownflag > 0: - sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") - ods.content.mergeCells(0,0,9,1) - sheet.getRow(1).setHeight("18pt") - sheet.getCell(0,1).stringValue("Godown Wise Product Report (Period : "+calculatefrom+" to "+calculateto+")").setBold(True).setFontSize("12pt").setAlignHorizontal("center") - ods.content.mergeCells(0,1,9,1) - sheet.getRow(2).setHeight("16pt") - sheet.getCell(0,2).stringValue("Name of the Product: "+productdesc).setBold(True).setFontSize("12pt").setAlignHorizontal("center") - ods.content.mergeCells(0,2,9,1) - sheet.getRow(3).setHeight("16pt") - sheet.getCell(0,3).stringValue("Name of the Godown : "+goname+", Godown Address: "+goaddr).setBold(True).setFontSize("12pt").setAlignHorizontal("center") - ods.content.mergeCells(0,3,9,1) - sheet.getColumn(1).setWidth("8cm") - sheet.getColumn(2).setWidth("4cm") - sheet.getColumn(3).setWidth("4cm") - sheet.getColumn(4).setWidth("2cm") - sheet.getCell(0,4).stringValue("Date").setBold(True).setAlignHorizontal("center") - sheet.getCell(1,4).stringValue("Particulars").setBold(True).setAlignHorizontal("center") - sheet.getCell(2,4).stringValue("Document Type").setBold(True).setAlignHorizontal("center") - sheet.getCell(3,4).stringValue("Deli Note No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(4,4).stringValue("INV No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(5,4).stringValue("TN No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(6,4).stringValue("RN No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(7,4).stringValue("Inward").setBold(True).setAlignHorizontal("right") - sheet.getCell(8,4).stringValue("Outward").setBold(True).setAlignHorizontal("right") - sheet.getCell(9,4).stringValue("Balance").setBold(True).setAlignHorizontal("right") - row = 5 - for stock in result: - if stock["particulars"]=="opening stock" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": - sheet.getCell(0, row).stringValue("") - sheet.getCell(1, row).stringValue(stock["particulars"].title()) - sheet.getCell(2, row).stringValue("") - sheet.getCell(3, row).stringValue("") - sheet.getCell(4, row).stringValue("") - sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue("") - sheet.getCell(7, row).stringValue(stock["inward"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue("") - sheet.getCell(9, row).stringValue("") - if stock["particulars"]!="Total" and (stock["dcno"]!="" or stock["invno"]!="" or stock["tnno"]!="" or stock["rnno"] != "") and stock["date"]!="": - sheet.getCell(0, row).stringValue(stock["date"]) - sheet.getCell(1, row).stringValue(stock["particulars"]) - sheet.getCell(2, row).stringValue(stock["trntype"]) - sheet.getCell(3, row).stringValue(stock["dcno"]) - sheet.getCell(4, row).stringValue(stock["invno"]) - sheet.getCell(5, row).stringValue(stock["tnno"]) - sheet.getCell(6, row).stringValue(stock["rnno"]) - sheet.getCell(7, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") - sheet.getCell(9, row).stringValue(stock["balance"]).setAlignHorizontal("right") - if stock["particulars"]=="Total" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": - sheet.getCell(0, row).stringValue("") - sheet.getCell(1, row).stringValue(stock["particulars"]) - sheet.getCell(2, row).stringValue("") - sheet.getCell(3, row).stringValue("") - sheet.getCell(4, row).stringValue("") - sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue("") - sheet.getCell(7, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") - sheet.getCell(9, row).stringValue("") - row += 1 - else: - sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") - ods.content.mergeCells(0,0,8,1) - sheet.getRow(1).setHeight("18pt") - sheet.getCell(0,1).stringValue("Product Report (Period : "+calculatefrom+" to "+calculateto+")").setBold(True).setFontSize("14pt").setAlignHorizontal("center") - ods.content.mergeCells(0,1,8,1) - sheet.getRow(2).setHeight("16pt") - sheet.getCell(0,2).stringValue("Name of the Product: "+productdesc).setBold(True).setFontSize("14pt").setAlignHorizontal("center") - ods.content.mergeCells(0,2,8,1) - sheet.getColumn(1).setWidth("4cm") - sheet.getColumn(2).setWidth("5cm") - sheet.getColumn(3).setWidth("4cm") - sheet.getColumn(4).setWidth("3cm") - sheet.getCell(0,3).stringValue("Date").setBold(True).setAlignHorizontal("center") - sheet.getCell(1,3).stringValue("Particulars").setBold(True).setAlignHorizontal("center") - sheet.getCell(2,3).stringValue("Document Type").setBold(True).setAlignHorizontal("center") - sheet.getCell(3,3).stringValue("Deli Note No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(4,3).stringValue("INV No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(5,3).stringValue("RN No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(6,3).stringValue("Inward").setBold(True).setAlignHorizontal("right") - sheet.getCell(7,3).stringValue("Outward").setBold(True).setAlignHorizontal("right") - sheet.getCell(8,3).stringValue("Balance").setBold(True).setAlignHorizontal("right") - row = 4 - for stock in result: - if stock["particulars"]=="opening stock" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": - sheet.getCell(0, row).stringValue("") - sheet.getCell(1, row).stringValue(stock["particulars"].title()) - sheet.getCell(2, row).stringValue("") - sheet.getCell(3, row).stringValue("") - sheet.getCell(4, row).stringValue("") - sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue(stock["inward"]).setAlignHorizontal("right") - sheet.getCell(7, row).stringValue("") - sheet.getCell(8, row).stringValue("") - if stock["particulars"]!="Total" and (stock["dcno"]!="" or stock["invno"]!="" or stock["rnid"] != "") and stock["date"]!="": - sheet.getCell(0, row).stringValue(stock["date"]) - sheet.getCell(1, row).stringValue(stock["particulars"]) - sheet.getCell(2, row).stringValue(stock["trntype"]) - sheet.getCell(3, row).stringValue(stock["dcno"]) - sheet.getCell(4, row).stringValue(stock["invno"]) - sheet.getCell(5, row).stringValue(stock["rnno"]) - sheet.getCell(6, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") - sheet.getCell(7, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue(stock["balance"]).setAlignHorizontal("right") - if stock["particulars"]=="Total" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": - sheet.getCell(0, row).stringValue("") - sheet.getCell(1, row).stringValue(stock["particulars"]) - sheet.getCell(2, row).stringValue("") - sheet.getCell(3, row).stringValue("") - sheet.getCell(4, row).stringValue("") - sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") - sheet.getCell(7, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue("") - row += 1 - - ods.save("response.ods") - repFile = open("response.ods") - rep = repFile.read() - repFile.close() - headerList = {'Content-Type':'application/vnd.oasis.opendocument.spreadsheet ods' ,'Content-Length': len(rep),'Content-Disposition': 'attachment; filename=report.ods', 'Set-Cookie':'fileDownload=true; path=/'} - os.remove("response.ods") - return Response(rep, headerlist=headerList.items()) + header={"gktoken":request.headers["gktoken"]} + godownflag = int(request.params["godownflag"]) + goid = int(request.params["goid"]) + goname = request.params["goname"] + if godownflag==1: + goaddr = request.params["goaddr"] + productcode = int(request.params["productcode"]) + calculatefrom = request.params["calculatefrom"] + calculateto = request.params["calculateto"] + scalculatefrom = datetime.strptime(calculatefrom, '%d-%m-%Y').strftime('%Y-%m-%d') + scalculateto = datetime.strptime(calculateto, '%d-%m-%Y').strftime('%Y-%m-%d') + productdesc = request.params["productdesc"] + if godownflag > 0: + result = requests.get("http://127.0.0.1:6543/report?type=godownstockreport&productcode=%d&startdate=%s&enddate=%s&goid=%d&godownflag=%d"%(productcode, scalculatefrom, scalculateto, goid, godownflag),headers=header) + else: + result = requests.get("http://127.0.0.1:6543/report?type=stockreport&productcode=%d&startdate=%s&enddate=%s"%(productcode, scalculatefrom, scalculateto),headers=header) + result = result.json()["gkresult"] + fystart = str(request.params["fystart"]); + ystart = datetime.strptime(fystart, '%Y-%m-%d').strftime('%d-%m-%Y') + fyend = str(request.params["fyend"]); + orgname = str(request.params["orgname"]) + orgname += " (FY: " + ystart+" to "+fyend +")" + ods = ODS() + sheet = ods.content.getSheet(0) + sheet.setSheetName("Product Report") + sheet.getRow(0).setHeight("23pt") + + if godownflag > 0: + sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") + ods.content.mergeCells(0,0,9,1) + sheet.getRow(1).setHeight("18pt") + sheet.getCell(0,1).stringValue("Godown Wise Product Report (Period : "+calculatefrom+" to "+calculateto+")").setBold(True).setFontSize("12pt").setAlignHorizontal("center") + ods.content.mergeCells(0,1,9,1) + sheet.getRow(2).setHeight("16pt") + sheet.getCell(0,2).stringValue("Name of the Product: "+productdesc).setBold(True).setFontSize("12pt").setAlignHorizontal("center") + ods.content.mergeCells(0,2,9,1) + sheet.getRow(3).setHeight("16pt") + sheet.getCell(0,3).stringValue("Name of the Godown : "+goname+", Godown Address: "+goaddr).setBold(True).setFontSize("12pt").setAlignHorizontal("center") + ods.content.mergeCells(0,3,9,1) + sheet.getColumn(1).setWidth("8cm") + sheet.getColumn(2).setWidth("4cm") + sheet.getColumn(3).setWidth("4cm") + sheet.getColumn(4).setWidth("2cm") + sheet.getCell(0,4).stringValue("Date").setBold(True).setAlignHorizontal("center") + sheet.getCell(1,4).stringValue("Particulars").setBold(True).setAlignHorizontal("center") + sheet.getCell(2,4).stringValue("Document Type").setBold(True).setAlignHorizontal("center") + sheet.getCell(3,4).stringValue("Deli Note No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(4,4).stringValue("INV No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(5,4).stringValue("TN No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(6,4).stringValue("RN No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(7,4).stringValue("Inward").setBold(True).setAlignHorizontal("right") + sheet.getCell(8,4).stringValue("Outward").setBold(True).setAlignHorizontal("right") + sheet.getCell(9,4).stringValue("Balance").setBold(True).setAlignHorizontal("right") + row = 5 + for stock in result: + if stock["particulars"]=="opening stock" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": + sheet.getCell(0, row).stringValue("") + sheet.getCell(1, row).stringValue(stock["particulars"].title()) + sheet.getCell(2, row).stringValue("") + sheet.getCell(3, row).stringValue("") + sheet.getCell(4, row).stringValue("") + sheet.getCell(5, row).stringValue("") + sheet.getCell(6, row).stringValue("") + sheet.getCell(7, row).stringValue(stock["inward"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue("") + sheet.getCell(9, row).stringValue("") + if stock["particulars"]!="Total" and (stock["dcno"]!="" or stock["invno"]!="" or stock["tnno"]!="" or stock["rnno"] != "") and stock["date"]!="": + sheet.getCell(0, row).stringValue(stock["date"]) + sheet.getCell(1, row).stringValue(stock["particulars"]) + sheet.getCell(2, row).stringValue(stock["trntype"]) + sheet.getCell(3, row).stringValue(stock["dcno"]) + sheet.getCell(4, row).stringValue(stock["invno"]) + sheet.getCell(5, row).stringValue(stock["tnno"]) + sheet.getCell(6, row).stringValue(stock["rnno"]) + sheet.getCell(7, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") + sheet.getCell(9, row).stringValue(stock["balance"]).setAlignHorizontal("right") + if stock["particulars"]=="Total" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": + sheet.getCell(0, row).stringValue("") + sheet.getCell(1, row).stringValue(stock["particulars"]) + sheet.getCell(2, row).stringValue("") + sheet.getCell(3, row).stringValue("") + sheet.getCell(4, row).stringValue("") + sheet.getCell(5, row).stringValue("") + sheet.getCell(6, row).stringValue("") + sheet.getCell(7, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") + sheet.getCell(9, row).stringValue("") + row += 1 + else: + sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") + ods.content.mergeCells(0,0,8,1) + sheet.getRow(1).setHeight("18pt") + sheet.getCell(0,1).stringValue("Product Report (Period : "+calculatefrom+" to "+calculateto+")").setBold(True).setFontSize("14pt").setAlignHorizontal("center") + ods.content.mergeCells(0,1,8,1) + sheet.getRow(2).setHeight("16pt") + sheet.getCell(0,2).stringValue("Name of the Product: "+productdesc).setBold(True).setFontSize("14pt").setAlignHorizontal("center") + ods.content.mergeCells(0,2,8,1) + sheet.getColumn(1).setWidth("4cm") + sheet.getColumn(2).setWidth("5cm") + sheet.getColumn(3).setWidth("4cm") + sheet.getColumn(4).setWidth("3cm") + sheet.getCell(0,3).stringValue("Date").setBold(True).setAlignHorizontal("center") + sheet.getCell(1,3).stringValue("Particulars").setBold(True).setAlignHorizontal("center") + sheet.getCell(2,3).stringValue("Document Type").setBold(True).setAlignHorizontal("center") + sheet.getCell(3,3).stringValue("Deli Note No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(4,3).stringValue("INV No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(5,3).stringValue("RN No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(6,3).stringValue("Inward").setBold(True).setAlignHorizontal("right") + sheet.getCell(7,3).stringValue("Outward").setBold(True).setAlignHorizontal("right") + sheet.getCell(8,3).stringValue("Balance").setBold(True).setAlignHorizontal("right") + row = 4 + for stock in result: + if stock["particulars"]=="opening stock" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": + sheet.getCell(0, row).stringValue("") + sheet.getCell(1, row).stringValue(stock["particulars"].title()) + sheet.getCell(2, row).stringValue("") + sheet.getCell(3, row).stringValue("") + sheet.getCell(4, row).stringValue("") + sheet.getCell(5, row).stringValue("") + sheet.getCell(6, row).stringValue(stock["inward"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue("") + sheet.getCell(8, row).stringValue("") + if stock["particulars"]!="Total" and (stock["dcno"]!="" or stock["invno"]!="" or stock["rnid"] != "") and stock["date"]!="": + sheet.getCell(0, row).stringValue(stock["date"]) + sheet.getCell(1, row).stringValue(stock["particulars"]) + sheet.getCell(2, row).stringValue(stock["trntype"]) + sheet.getCell(3, row).stringValue(stock["dcno"]) + sheet.getCell(4, row).stringValue(stock["invno"]) + sheet.getCell(5, row).stringValue(stock["rnno"]) + sheet.getCell(6, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue(stock["balance"]).setAlignHorizontal("right") + if stock["particulars"]=="Total" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": + sheet.getCell(0, row).stringValue("") + sheet.getCell(1, row).stringValue(stock["particulars"]) + sheet.getCell(2, row).stringValue("") + sheet.getCell(3, row).stringValue("") + sheet.getCell(4, row).stringValue("") + sheet.getCell(5, row).stringValue("") + sheet.getCell(6, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue("") + row += 1 + + ods.save("response.ods") + repFile = open("response.ods") + rep = repFile.read() + repFile.close() + headerList = {'Content-Type':'application/vnd.oasis.opendocument.spreadsheet ods' ,'Content-Length': len(rep),'Content-Disposition': 'attachment; filename=report.ods', 'Set-Cookie':'fileDownload=true; path=/'} + os.remove("response.ods") + return Response(rep, headerlist=headerList.items()) @view_config(route_name="product",request_param="type=viewstockonhandreport", renderer="gkwebapp:templates/viewstockonhandreport.jinja2") def viewStockOnHandReport(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/products?invdc=4",headers=header) - result1 = requests.get("http://127.0.0.1:6543/godown",headers=header) - result2 = requests.get("http://127.0.0.1:6543/login", headers=header) - userrole = result2.json()["gkresult"]["userrole"] - return{"gkresult":result.json()["gkresult"], "godown":result1.json()["gkresult"], "gkstatus":result.json()["gkstatus"], "userrole":userrole} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/products?invdc=4",headers=header) + result1 = requests.get("http://127.0.0.1:6543/godown",headers=header) + result2 = requests.get("http://127.0.0.1:6543/login", headers=header) + userrole = result2.json()["gkresult"]["userrole"] + return{"gkresult":result.json()["gkresult"], "godown":result1.json()["gkresult"], "gkstatus":result.json()["gkstatus"], "userrole":userrole} @view_config(route_name="product",request_param="type=viewcategorywisestockonhandreport", renderer="gkwebapp:templates/viewcategorywisestockonhandreport.jinja2") def viewCategorywiseStockOnHandReport(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/categories",headers=header) - result1 = requests.get("http://127.0.0.1:6543/godown",headers=header) - result2 = requests.get("http://127.0.0.1:6543/login", headers=header) - userrole = result2.json()["gkresult"]["userrole"] - return{"gkresult":result.json()["gkresult"], "godown":result1.json()["gkresult"], "gkstatus":result.json()["gkstatus"], "userrole":userrole} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/categories",headers=header) + result1 = requests.get("http://127.0.0.1:6543/godown",headers=header) + result2 = requests.get("http://127.0.0.1:6543/login", headers=header) + userrole = result2.json()["gkresult"]["userrole"] + return{"gkresult":result.json()["gkresult"], "godown":result1.json()["gkresult"], "gkstatus":result.json()["gkstatus"], "userrole":userrole} @view_config(route_name="product",request_param="type=showstockonhandreport") def showstockonhandreport(request): - header={"gktoken":request.headers["gktoken"]} - godownflag = int(request.params["godownflag"]) - goid = int(request.params["goid"]) - goname = request.params["goname"] + header={"gktoken":request.headers["gktoken"]} + godownflag = int(request.params["godownflag"]) + goid = int(request.params["goid"]) + goname = request.params["goname"] - if godownflag==1: - goaddr = request.params["goaddr"] - productcode = int(request.params["productcode"]) - calculateto = request.params["calculateto"] - scalculateto = request.params["calculateto"] + if godownflag==1: + goaddr = request.params["goaddr"] + productcode = int(request.params["productcode"]) + calculateto = request.params["calculateto"] + scalculateto = request.params["calculateto"] - productdesc = request.params["productdesc"] - if int(request.params["backflag"]) == 1 : - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":"All Products","godownflag":godownflag,"goid":goid,"date":date } - result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=all&enddate=%s"%(scalculateto),headers=header) + productdesc = request.params["productdesc"] + if int(request.params["backflag"]) == 1 : + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":"All Products","godownflag":godownflag,"goid":goid,"date":date } + result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=all&enddate=%s"%(scalculateto),headers=header) - if int(request.params["backflag"]) == 0: - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') - stockrefresh = {"productcode":productcode,"calculateto":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d'),"productdesc":productdesc,"godownflag":godownflag,"goid":goid,"date":date} - result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=%d&enddate=%s"%(productcode,scalculateto),headers=header) + if int(request.params["backflag"]) == 0: + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') + stockrefresh = {"productcode":productcode,"calculateto":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d'),"productdesc":productdesc,"godownflag":godownflag,"goid":goid,"date":date} + result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=%d&enddate=%s"%(productcode,scalculateto),headers=header) - if godownflag == 1 and int(request.params["backflag"]) == 3 : - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid,"date":date} - result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pg&goid=%d&productcode=%d&enddate=%s"%(goid, productcode, scalculateto),headers=header) + if godownflag == 1 and int(request.params["backflag"]) == 3 : + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid,"date":date} + result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pg&goid=%d&productcode=%d&enddate=%s"%(goid, productcode, scalculateto),headers=header) - if godownflag == 1 and int(request.params["backflag"]) == 2 and goid == 0: - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid,"date":date} - result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pag&productcode=%d&enddate=%s"%(productcode, scalculateto),headers=header) + if godownflag == 1 and int(request.params["backflag"]) == 2 and goid == 0: + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid,"date":date} + result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pag&productcode=%d&enddate=%s"%(productcode, scalculateto),headers=header) - if godownflag==1: - return render_to_response("gkwebapp:templates/showstockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname, "goaddr":goaddr},request=request) + if godownflag==1: + return render_to_response("gkwebapp:templates/showstockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname, "goaddr":goaddr},request=request) - return render_to_response("gkwebapp:templates/showstockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) + return render_to_response("gkwebapp:templates/showstockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) @view_config(route_name="product",request_param="type=showcategorywisestockonhandreport") def showcategorywisestockonhandreport(request): - header={"gktoken":request.headers["gktoken"]} - godownflag = int(request.params["godownflag"]) - if godownflag == 0: - goid = "-1" - else: - goid = request.params["goid"] - categorycode = int(request.params["categorycode"]) - calculateto = request.params["calculateto"] - categoryname = request.params["categoryname"] - subcategoryname = request.params["subcategoryname"] - specname = request.params["specname"] - stockrefresh = {"categorycode":categorycode,"calculateto":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d'),"categoryname":categoryname, "subcategoryname": subcategoryname, "specname":specname, "godownflag":godownflag,"goid":goid,"date":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y')} - if int(request.params["backflag"]) == 1 : - result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=all&enddate=%s"%(calculateto),headers=header) - if godownflag==1: - if request.params["goid"] == "all": - return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) - else: - return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":request.params["goname"], "goaddr":request.params["goaddr"]},request=request) - else: - return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) - - if int(request.params["backflag"]) == 0: - result = requests.get("http://127.0.0.1:6543/report?type=categorywisestockonhand&categorycode=%d&subcategorycode=%s&speccode=%s&goid=%s&enddate=%s"%(categorycode, request.params["subcategorycode"], request.params["speccode"], goid, calculateto),headers=header) - if godownflag==1: - if request.params["goid"] == "all": - return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) - else: - return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":request.params["goname"], "goaddr":request.params["goaddr"]},request=request) - else: - return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) - - '''if godownflag == 1 and int(request.params["backflag"]) == 3 : - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') - result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pg&goid=%d&productcode=%d&enddate=%s"%(goid, productcode, scalculateto),headers=header) - - if godownflag == 1 and int(request.params["backflag"]) == 2 and goid == 0: - - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') - result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pag&productcode=%d&enddate=%s"%(productcode, scalculateto),headers=header) - ''' + header={"gktoken":request.headers["gktoken"]} + godownflag = int(request.params["godownflag"]) + if godownflag == 0: + goid = "-1" + else: + goid = request.params["goid"] + categorycode = int(request.params["categorycode"]) + calculateto = request.params["calculateto"] + categoryname = request.params["categoryname"] + subcategoryname = request.params["subcategoryname"] + specname = request.params["specname"] + stockrefresh = {"categorycode":categorycode,"calculateto":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d'),"categoryname":categoryname, "subcategoryname": subcategoryname, "specname":specname, "godownflag":godownflag,"goid":goid,"date":datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y')} + if int(request.params["backflag"]) == 1 : + result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=all&enddate=%s"%(calculateto),headers=header) + if godownflag==1: + if request.params["goid"] == "all": + return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) + else: + return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":request.params["goname"], "goaddr":request.params["goaddr"]},request=request) + else: + return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) + + if int(request.params["backflag"]) == 0: + result = requests.get("http://127.0.0.1:6543/report?type=categorywisestockonhand&categorycode=%d&subcategorycode=%s&speccode=%s&goid=%s&enddate=%s"%(categorycode, request.params["subcategorycode"], request.params["speccode"], goid, calculateto),headers=header) + if godownflag==1: + if request.params["goid"] == "all": + return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) + else: + return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":request.params["goname"], "goaddr":request.params["goaddr"]},request=request) + else: + return render_to_response("gkwebapp:templates/showcategorywisestockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh},request=request) + + '''if godownflag == 1 and int(request.params["backflag"]) == 3 : + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') + result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pg&goid=%d&productcode=%d&enddate=%s"%(goid, productcode, scalculateto),headers=header) + + if godownflag == 1 and int(request.params["backflag"]) == 2 and goid == 0: + + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + date = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%d-%m-%Y') + result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pag&productcode=%d&enddate=%s"%(productcode, scalculateto),headers=header) + ''' @view_config(route_name="product",request_param="type=printablestockonhandreport") def printablestockonhandreport(request): - header={"gktoken":request.headers["gktoken"]} - godownflag = int(request.params["godownflag"]) - goid = int(request.params["goid"]) - goname = request.params["goname"] - productcode = int(request.params["productcode"]) - calculateto = request.params["calculateto"] - productdesc = request.params["productdesc"] - scalculateto = request.params["calculateto"] - if int(request.params["backflag"]) == 1 : + header={"gktoken":request.headers["gktoken"]} + godownflag = int(request.params["godownflag"]) + goid = int(request.params["goid"]) + goname = request.params["goname"] + productcode = int(request.params["productcode"]) + calculateto = request.params["calculateto"] + productdesc = request.params["productdesc"] + scalculateto = request.params["calculateto"] + if int(request.params["backflag"]) == 1 : - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":"all","godownflag":godownflag,"goid":goid } + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":"all","godownflag":godownflag,"goid":goid } - result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=all&enddate=%s"%(scalculateto),headers=header) + result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=all&enddate=%s"%(scalculateto),headers=header) - if int(request.params["backflag"]) == 0 : - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} - result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=%d&enddate=%s"%(productcode,scalculateto),headers=header) + if int(request.params["backflag"]) == 0 : + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} + result = requests.get("http://127.0.0.1:6543/report?stockonhandreport&productcode=%d&enddate=%s"%(productcode,scalculateto),headers=header) - if godownflag == 1 and int(request.params["backflag"]) == 3 : + if godownflag == 1 and int(request.params["backflag"]) == 3 : - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} - result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pg&goid=%d&productcode=%d&enddate=%s"%(goid, productcode, scalculateto),headers=header) + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} + result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pg&goid=%d&productcode=%d&enddate=%s"%(goid, productcode, scalculateto),headers=header) - if godownflag == 1 and int(request.params["backflag"]) == 2 and goid == 0: + if godownflag == 1 and int(request.params["backflag"]) == 2 and goid == 0: - scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') - stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} - result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pag&productcode=%d&enddate=%s"%(productcode, scalculateto),headers=header) + scalculateto = datetime.strptime(calculateto, '%Y-%m-%d').strftime('%Y-%m-%d') + stockrefresh = {"productcode":productcode,"calculateto":calculateto,"productdesc":productdesc,"godownflag":godownflag,"goid":goid} + result = requests.get("http://127.0.0.1:6543/report?godownwisestockonhand&type=pag&productcode=%d&enddate=%s"%(productcode, scalculateto),headers=header) - return render_to_response("gkwebapp:templates/printstockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) + return render_to_response("gkwebapp:templates/printstockonhandreport.jinja2",{"gkresult":result.json()["gkresult"],"stockrefresh":stockrefresh,"godown":goname},request=request) -- GitLab From 6034b6bfeb5977293e5a04cb20fda7be415e13ac Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Wed, 11 Oct 2017 09:04:52 +0530 Subject: [PATCH 005/121] States are loaded in Add Product from backend --- gkwebapp/templates/addproduct.jinja2 | 50 +++++----------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/gkwebapp/templates/addproduct.jinja2 b/gkwebapp/templates/addproduct.jinja2 index 6d8941c0..8971d4ca 100644 --- a/gkwebapp/templates/addproduct.jinja2 +++ b/gkwebapp/templates/addproduct.jinja2 @@ -100,7 +100,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {% for state in states %} + {% for key, value in state.items() %} + + {% endfor %} + {% endfor %} + + + -- GitLab From e73f591aa240d0b29af0267b267b31fa8409bddb Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Wed, 11 Oct 2017 13:31:28 +0530 Subject: [PATCH 006/121] Added back license --- gkwebapp/static/js/addproduct.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gkwebapp/static/js/addproduct.js b/gkwebapp/static/js/addproduct.js index 99225c94..4eb00dfe 100644 --- a/gkwebapp/static/js/addproduct.js +++ b/gkwebapp/static/js/addproduct.js @@ -1,4 +1,35 @@ +/* + 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() { -- GitLab From 86e77f05929dac5df93f05631ccf7f6774329db2 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Thu, 12 Oct 2017 11:55:37 +0530 Subject: [PATCH 007/121] gstin field is not mandatory field in add customer/supplier and '*' sign is also removed. --- gkwebapp/static/js/addcustomersupplier.js | 31 ++++++++++--------- gkwebapp/templates/addcustomersupplier.jinja2 | 4 +-- .../templates/editcustomersupplier.jinja2 | 8 ++--- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index ca245a51..dbea9ab5 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -132,17 +132,20 @@ $("#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").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; - } + if(gstin != ''){ + var gstnint = parseInt(gstin[0] + gstin[1]); + if(!($.isNumeric(gstnint)) || gstnint > 37 || 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; + } + } + }); - + $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) { var curindex1 = $(this).closest('tr').index(); @@ -157,7 +160,7 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) } else { if (numberofstates > 0) { - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="") { + /**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(); @@ -172,7 +175,7 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) }); $('#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(''); @@ -352,7 +355,7 @@ 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++) { + /**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(){ @@ -361,7 +364,7 @@ if($("#vatorgstflag").val() == '29'){ $("#add_cussup_tin").focus(); return false; } - } + }**/ } } diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 05b2794f..2d183777 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -128,13 +128,13 @@
{% if vatorgstflag != '7' %}
- +
{% endif %}
- +
diff --git a/gkwebapp/templates/editcustomersupplier.jinja2 b/gkwebapp/templates/editcustomersupplier.jinja2 index 349347a0..048deda1 100644 --- a/gkwebapp/templates/editcustomersupplier.jinja2 +++ b/gkwebapp/templates/editcustomersupplier.jinja2 @@ -90,7 +90,7 @@
- +
{% endif %}
@@ -271,7 +271,7 @@ - + {% endif %} -- GitLab From 8b08a51bf6d86c6156b880695094d23a1043b72b Mon Sep 17 00:00:00 2001 From: reshma1 Date: Thu, 12 Oct 2017 12:17:35 +0530 Subject: [PATCH 008/121] now gstin is not compulsory field in edit customer/supplier --- gkwebapp/static/js/addcustomersupplier.js | 29 ++++++------ gkwebapp/static/js/editcustomersupplier.js | 53 ++++++++++++---------- 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index dbea9ab5..dc013c6c 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -134,7 +134,7 @@ $("#add_state").keydown(function(event) { var gstin = $(this).val(); if(gstin != ''){ var gstnint = parseInt(gstin[0] + gstin[1]); - if(!($.isNumeric(gstnint)) || gstnint > 37 || gstin.length !=15){ + 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(); @@ -370,14 +370,14 @@ if($("#vatorgstflag").val() == '29'){ 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())=="" ) { + /**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; - } + }**/ } } @@ -404,16 +404,19 @@ if($("#vatorgstflag").val() == '7'){ 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(){ - $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus().select(); - }); - return false; - } + if(gstin != '') { + 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(){ + $("#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(); } } diff --git a/gkwebapp/static/js/editcustomersupplier.js b/gkwebapp/static/js/editcustomersupplier.js index f7684d37..5c6fc184 100644 --- a/gkwebapp/static/js/editcustomersupplier.js +++ b/gkwebapp/static/js/editcustomersupplier.js @@ -20,7 +20,7 @@ $(document).ready(function() { $(".hidden-load").show(); $("#edit_cussup").val(result["csflag"]); if(result["csflag"] == 3){ - + $("#edit_cussup").val("Customer"); } else { @@ -247,15 +247,18 @@ $(document).ready(function() { $(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; + if(gstin != ''){ + 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; + } } + }); $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) @@ -272,7 +275,7 @@ $(document).ready(function() { } else { if (numberofstates > 0) { - if ($('#gstintable tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="") { + /**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(); @@ -287,7 +290,7 @@ $(document).ready(function() { }); $('#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(''); @@ -361,7 +364,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(){ @@ -401,16 +404,18 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { 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(){ - $("#gstin-improper-alert").hide(); - $('#gstintable tbody tr:eq('+curindex1+') td:eq(1) input').focus().select(); - }); - return false; - } + if(gstin != '') { + 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(){ + $("#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(); } } @@ -503,7 +508,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 +526,7 @@ $("#cussup_delete").click(function(event) { xhr.setRequestHeader('gktoken',sessionStorage.gktoken ); }, success: function(resp) - + { if (resp["gkstatus"]==0) { $("#customersupplier_edit").click(); -- GitLab From 59c9657bef9c9a8d7dde58374ed0c2ba24c3250c Mon Sep 17 00:00:00 2001 From: reshma1 Date: Fri, 13 Oct 2017 15:48:47 +0530 Subject: [PATCH 009/121] gstin is not a mandatory field and commented code is removed from addcustomersupplier.js --- gkwebapp/static/js/addcustomersupplier.js | 46 +------------- gkwebapp/static/js/addinvoice.js | 13 +++- gkwebapp/static/js/createcustsuppopup.js | 63 ++++++++------------ gkwebapp/static/js/editcustomersupplier.js | 17 +----- gkwebapp/templates/createcustsuppopup.jinja2 | 26 ++++---- 5 files changed, 51 insertions(+), 114 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index dc013c6c..0b718e26 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -160,22 +160,7 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) } 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; - }**/ + $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); if (curindex1 == 0) { $("#gstintable tbody tr:last td:last").append(''); @@ -352,35 +337,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(){ diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index f0c5f69c..080c8ed2 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -41,7 +41,7 @@ $(document).ready(function() { } else { $(".gstinfield").show(); } - + //Initialising some variables. var issuername = ""; var designation = ""; @@ -421,10 +421,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. diff --git a/gkwebapp/static/js/createcustsuppopup.js b/gkwebapp/static/js/createcustsuppopup.js index c8e208fc..6b76b556 100644 --- a/gkwebapp/static/js/createcustsuppopup.js +++ b/gkwebapp/static/js/createcustsuppopup.js @@ -29,7 +29,7 @@ Contributors: $(document).ready(function() { $("#add_cussup_name").focus(); - + $("#add_cussup_name").keydown(function(event) { if (event.which==13) { if ($.trim($("#add_cussup_name").val())=="") { @@ -115,14 +115,16 @@ $("#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; + if(gstin != '') { + 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; + } } }); @@ -140,22 +142,7 @@ $(document).off("keydown",".gstin").on("keydown",".gstin",function(event) } 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; - } + $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); if (curindex1 == 0) { $("#gstintable tbody tr:last td:last").append(''); @@ -309,11 +296,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 +317,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(){ @@ -362,15 +349,17 @@ else{ 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; + if(gstin != '') { + 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(); } diff --git a/gkwebapp/static/js/editcustomersupplier.js b/gkwebapp/static/js/editcustomersupplier.js index 5c6fc184..a3f7f782 100644 --- a/gkwebapp/static/js/editcustomersupplier.js +++ b/gkwebapp/static/js/editcustomersupplier.js @@ -275,22 +275,7 @@ $(document).ready(function() { } 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; - }**/ + $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); if (curindex1 == 0) { $("#gstintable tbody tr:last td:last").append(''); diff --git a/gkwebapp/templates/createcustsuppopup.jinja2 b/gkwebapp/templates/createcustsuppopup.jinja2 index 3e2f27ac..b8974dca 100644 --- a/gkwebapp/templates/createcustsuppopup.jinja2 +++ b/gkwebapp/templates/createcustsuppopup.jinja2 @@ -111,7 +111,7 @@ th { - +
@@ -142,12 +142,12 @@ th {
- + Press Enter key twice to shift focus to Fax
- +
@@ -158,18 +158,18 @@ th {
- +
{% if vatorgstflag != '7' %}
- +
{% endif %}
- +
@@ -256,12 +256,12 @@ th { - +
-
@@ -274,13 +274,13 @@ th {
- +
- + -
+ {% endif %} - + '+ - ''+ - ''+ - ''+ - ''+ - ''); + $('#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"]); } + $(".tax_name").change(); } }) @@ -570,64 +516,8 @@ $("#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"}); } @@ -685,7 +575,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) { @@ -807,44 +697,7 @@ $(document).off("change",".tax_name").on("change",".tax_name",function(event) 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); + $("#product_tax_table tbody tr:eq("+curindex+") td:eq(1) select").append(stateshtml).prop('disabled',false); if (curindex > 0) { for (var i = 1; i < curindex+1; i++) { for (var j = 0; j < curindex; j++) { -- GitLab From 2367b686f5b7478f93460b8b98c25210521e5cf9 Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Sat, 14 Oct 2017 17:40:07 +0530 Subject: [PATCH 011/121] Now GST appears on top instead of VAT --- gkwebapp/static/js/addproduct.js | 175 +++++++-------------------- gkwebapp/templates/addproduct.jinja2 | 9 +- 2 files changed, 46 insertions(+), 138 deletions(-) diff --git a/gkwebapp/static/js/addproduct.js b/gkwebapp/static/js/addproduct.js index 185a5e75..eb3e4913 100644 --- a/gkwebapp/static/js/addproduct.js +++ b/gkwebapp/static/js/addproduct.js @@ -38,7 +38,13 @@ $(".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; @@ -47,8 +53,6 @@ $(".productclass").hide(); var selectedgodown; var selectedtaxname; var selectedtaxstate = 0; - var taxfieldhtml = $("#product_tax_table tbody").html(); - var stateshtml = $("#product_tax_table tbody tr:first td:eq(1) select").html(); $(".numtype").numeric({negative: false}); $("#moresmall").on('shown.bs.collapse', function(event) { event.preventDefault(); @@ -463,13 +467,16 @@ $("#addcatselect").change(function(event) { $('#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() { @@ -518,12 +525,11 @@ $("#addcatselect").change(function(event) { $('#product_tax_table tbody tr').remove(); $('#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; @@ -641,28 +647,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' || $("#product_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='CESS') && 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' || $(".tax_name",this).val()=='CESS' ) { - 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) { @@ -690,32 +676,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(stateshtml).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" || $("#product_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "CESS" ) { - 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) @@ -745,24 +728,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(); } }); @@ -776,13 +741,13 @@ $(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 { @@ -803,66 +768,10 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) return false; } - $('#product_tax_table tbody').append(''+ - ''+ - ''+ - ''+ - ''+ - ''); - $(".tax_rate").numeric(); + $('#product_tax_table tbody').append(taxfieldhtml); + + $(".tax_rate").numeric(); + $(".tax_name:last").change(); if (selectedtaxname == "CVAT" || selectedtaxname == "IGST" || selectedtaxname == "CESS") { $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select option[value='+selectedtaxname+']').prop('hidden', true).prop('disabled', true); } diff --git a/gkwebapp/templates/addproduct.jinja2 b/gkwebapp/templates/addproduct.jinja2 index 8971d4ca..2050f5c1 100644 --- a/gkwebapp/templates/addproduct.jinja2 +++ b/gkwebapp/templates/addproduct.jinja2 @@ -99,13 +99,12 @@ '+ 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"); @@ -648,7 +650,7 @@ $("#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' || $("#product_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val() =='CESS') && 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(){ @@ -709,65 +711,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" || $("#product_edit_tax_table tbody tr:eq("+i+") td:eq(0) select").val() == "CESS") { - 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) @@ -797,26 +761,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(); } }); @@ -828,30 +772,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" || $('#product_edit_tax_table tbody tr:eq('+curindex1+') td:eq(0) select option:selected').val()=="CESS" && $("#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(){ @@ -879,72 +799,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" || selectedtaxname == "CESS") { - $('#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) { diff --git a/gkwebapp/templates/editproductspecs.jinja2 b/gkwebapp/templates/editproductspecs.jinja2 index a4667465..afb33a63 100644 --- a/gkwebapp/templates/editproductspecs.jinja2 +++ b/gkwebapp/templates/editproductspecs.jinja2 @@ -136,22 +136,23 @@ - - + + + +
'+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
'+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
'+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
-- GitLab From 0f5946e227c59af4efc67345440a0be556c565ca Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Sat, 14 Oct 2017 18:32:34 +0530 Subject: [PATCH 012/121] Add Category Tax Events working properly --- gkwebapp/static/js/addproduct.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gkwebapp/static/js/addproduct.js b/gkwebapp/static/js/addproduct.js index eb3e4913..bb3ce7a4 100644 --- a/gkwebapp/static/js/addproduct.js +++ b/gkwebapp/static/js/addproduct.js @@ -769,12 +769,17 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) } $('#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(); - if (selectedtaxname == "CVAT" || selectedtaxname == "IGST" || selectedtaxname == "CESS") { - $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select option[value='+selectedtaxname+']').prop('hidden', true).prop('disabled', true); - } $('#product_tax_table tbody tr:eq('+nextindex1+') td:eq(0) select').focus().select(); } } -- GitLab From 51d3be6ebc775fb5b4425983c7df3ac871ca25cd Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Mon, 16 Oct 2017 14:21:26 +0530 Subject: [PATCH 013/121] Applied changes in Edit Product too --- gkwebapp/static/js/editproduct.js | 227 +++++---------------- gkwebapp/templates/editproductspecs.jinja2 | 13 +- 2 files changed, 55 insertions(+), 185 deletions(-) diff --git a/gkwebapp/static/js/editproduct.js b/gkwebapp/static/js/editproduct.js index 68ee1602..cc45b131 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(); @@ -18,14 +20,14 @@ $(document).ready(function() { }); - 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")) @@ -158,7 +160,7 @@ $(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'){ @@ -207,7 +209,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 +288,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(); - - $('#product_edit_tax_table tbody tr').remove(); + 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(); for (tax of resp["gkresult"]) { - $('#product_edit_tax_table tbody').append('
'+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
-- GitLab From 9237d0c6710926d1488853754d85d3055d7a65a0 Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Mon, 16 Oct 2017 16:43:32 +0530 Subject: [PATCH 014/121] Added Select Tax and Select State to options --- gkwebapp/static/js/addproduct.js | 12 ++++++------ gkwebapp/templates/addproduct.jinja2 | 14 ++++++++++++-- gkwebapp/templates/editinvoice.jinja2 | 2 +- gkwebapp/templates/editproductspecs.jinja2 | 3 ++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/gkwebapp/static/js/addproduct.js b/gkwebapp/static/js/addproduct.js index bb3ce7a4..eea6a975 100644 --- a/gkwebapp/static/js/addproduct.js +++ b/gkwebapp/static/js/addproduct.js @@ -133,7 +133,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()); @@ -750,17 +750,17 @@ $(document).off("keydown",".tax_rate").on("keydown",".tax_rate",function(event) 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(); }); diff --git a/gkwebapp/templates/addproduct.jinja2 b/gkwebapp/templates/addproduct.jinja2 index 2050f5c1..d996abbc 100644 --- a/gkwebapp/templates/addproduct.jinja2 +++ b/gkwebapp/templates/addproduct.jinja2 @@ -85,7 +85,15 @@
-
+ + +
@@ -99,6 +107,7 @@ diff --git a/gkwebapp/templates/editinvoice.jinja2 b/gkwebapp/templates/editinvoice.jinja2 index 89a8ea3d..9f345808 100644 --- a/gkwebapp/templates/editinvoice.jinja2 +++ b/gkwebapp/templates/editinvoice.jinja2 @@ -8,7 +8,7 @@
- - - - - - - - - - - -
- +
- - {% for tn in transfernote %} - - {% endfor %}> - +
+
+ + -
- - + +
- -
- - - - -
-
- - + + -- GitLab From a5187e87914690be0ddea0d918e1365e90096033 Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Tue, 17 Oct 2017 15:30:52 +0530 Subject: [PATCH 016/121] corrected issue --- gkwebapp/static/js/receivedtransfernote.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gkwebapp/static/js/receivedtransfernote.js b/gkwebapp/static/js/receivedtransfernote.js index 2781fa01..3de4d71f 100644 --- a/gkwebapp/static/js/receivedtransfernote.js +++ b/gkwebapp/static/js/receivedtransfernote.js @@ -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,14 +348,14 @@ 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(); - // }); + $("#confirm_yes").on('hidden.bs.modal', function(event) { + $("#rec_tn_list").focus(); + }); }); -- GitLab From fa753a0f367c92f83b3692b87d998ed110ea0009 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Fri, 20 Oct 2017 13:51:21 +0530 Subject: [PATCH 017/121] Heading is given to the Godown Table in Create user. --- gkwebapp/templates/createusergodowntable.jinja2 | 1 + 1 file changed, 1 insertion(+) diff --git a/gkwebapp/templates/createusergodowntable.jinja2 b/gkwebapp/templates/createusergodowntable.jinja2 index f9442291..f48d724f 100644 --- a/gkwebapp/templates/createusergodowntable.jinja2 +++ b/gkwebapp/templates/createusergodowntable.jinja2 @@ -1,3 +1,4 @@ + -- GitLab From ef92fca64c1444ece4e6f36735972061da487fbd Mon Sep 17 00:00:00 2001 From: reshma1 Date: Fri, 20 Oct 2017 15:35:47 +0530 Subject: [PATCH 018/121] In customer/supplier, 'Phone No.' is replaced with 'Contact Number'. --- gkwebapp/templates/addcustomersupplier.jinja2 | 4 ++-- gkwebapp/templates/createcustsuppopup.jinja2 | 4 ++-- gkwebapp/templates/editcustomersupplier.jinja2 | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 2d183777..eda7a84d 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -89,7 +89,7 @@
- +
@@ -175,7 +175,7 @@
- +
diff --git a/gkwebapp/templates/createcustsuppopup.jinja2 b/gkwebapp/templates/createcustsuppopup.jinja2 index b8974dca..11de0de4 100644 --- a/gkwebapp/templates/createcustsuppopup.jinja2 +++ b/gkwebapp/templates/createcustsuppopup.jinja2 @@ -123,7 +123,7 @@ th {
- +
@@ -210,7 +210,7 @@ th {
- +
diff --git a/gkwebapp/templates/editcustomersupplier.jinja2 b/gkwebapp/templates/editcustomersupplier.jinja2 index 048deda1..dec4efd4 100644 --- a/gkwebapp/templates/editcustomersupplier.jinja2 +++ b/gkwebapp/templates/editcustomersupplier.jinja2 @@ -125,7 +125,7 @@
@@ -205,7 +205,7 @@ +
@@ -148,7 +152,8 @@ {% else %} - + + {% endif%} -- GitLab From 92226743687a9979ce926c71e9f8adf766fe8aeb Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Mon, 16 Oct 2017 17:09:52 +0530 Subject: [PATCH 021/121] Solved State Code Issue in Print Invoice --- gkwebapp/templates/printinvoice.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkwebapp/templates/printinvoice.jinja2 b/gkwebapp/templates/printinvoice.jinja2 index 38b7bafe..d20a8d40 100644 --- a/gkwebapp/templates/printinvoice.jinja2 +++ b/gkwebapp/templates/printinvoice.jinja2 @@ -173,7 +173,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 %}
-- GitLab From 4d6afbd520937172fe3f4c9ae4d2f3946f0e903f Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Fri, 20 Oct 2017 14:59:28 +0530 Subject: [PATCH 022/121] Tax issue solved in add category --- gkwebapp/static/js/addcategory.js | 12 +++++++----- gkwebapp/templates/addcategory.jinja2 | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gkwebapp/static/js/addcategory.js b/gkwebapp/static/js/addcategory.js index a881e89d..5da5d205 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/templates/addcategory.jinja2 b/gkwebapp/templates/addcategory.jinja2 index 22be5d3b..1c096b72 100644 --- a/gkwebapp/templates/addcategory.jinja2 +++ b/gkwebapp/templates/addcategory.jinja2 @@ -349,10 +349,10 @@ {% else %} + + - - {% endif%} @@ -368,7 +368,7 @@
-- GitLab From 3e01065d9bf46828bdaa57478b7d6a033cbe266c Mon Sep 17 00:00:00 2001 From: abhi1tb Date: Mon, 23 Oct 2017 11:17:04 +0530 Subject: [PATCH 023/121] Pressing Insert button saves Customer Supplier --- gkwebapp/static/js/addcustomersupplier.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index 0b718e26..b58f54a0 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 @@ -37,7 +37,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; @@ -292,9 +292,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; -- GitLab From 0cbad8c6751ca94c1f97808108dab1d9473813b5 Mon Sep 17 00:00:00 2001 From: nitesh Date: Tue, 24 Oct 2017 13:41:37 +0530 Subject: [PATCH 024/121] Solved tax rate bug in Invoice --- gkwebapp/static/js/addinvoice.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index 080c8ed2..0af88eb1 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -214,6 +214,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 +271,6 @@ $(document).ready(function() { $("#vathelp").show(); } } - $(this).val(yearpad($(this).val(), 4)); }); //Key Event for Invoice Date Field. @@ -1928,8 +1928,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'); @@ -2031,7 +2031,6 @@ if (event.which == 13) { var productqtys = []; var quantity; var ppu; - if($("#consigneename").val() != ""){ consignee["consigneename"] = $.trim($("#consigneename").val()); consignee["tinconsignee"] = $.trim($("#tinconsignee").val()); @@ -2130,7 +2129,7 @@ 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()); + 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()); @@ -2242,7 +2241,6 @@ if (event.which == 13) { 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) { -- GitLab From d290eefc7a54dd70bf30f51dea979b66644bbb0a Mon Sep 17 00:00:00 2001 From: nitesh Date: Tue, 24 Oct 2017 13:50:41 +0530 Subject: [PATCH 025/121] Fixed tax error in cashmemo --- gkwebapp/static/js/addcashmemo.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index 1e79db8e..47547a97 100644 --- a/gkwebapp/static/js/addcashmemo.js +++ b/gkwebapp/static/js/addcashmemo.js @@ -149,7 +149,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 +161,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 +172,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) { @@ -214,7 +215,6 @@ $("#totalinvoicevalue").text(parseFloat(totalamount).toFixed(2)); $("#vathelp").show(); } } - $(this).val(yearpad($(this).val(), 4)); }); //Key Event for Cash Memo Date Field. @@ -1011,7 +1011,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(); -- GitLab From 5ab92b89a3c49c2145479282c59665676fc1930e Mon Sep 17 00:00:00 2001 From: nitesh Date: Tue, 24 Oct 2017 15:31:36 +0530 Subject: [PATCH 026/121] 'Delivery Note' is replaced by 'Deli. Note No.' in invoice. --- gkwebapp/templates/addinvoice.jinja2 | 2 +- gkwebapp/templates/printinvoice.jinja2 | 2 +- gkwebapp/templates/viewsingleinvoice.jinja2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index fb4a7fbf..5420cdb3 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -69,7 +69,7 @@

Details of Invoice:

- +
- + + @@ -409,6 +410,8 @@ + +
- +
{% if gkresult["dcno"] %} - + {{gkresult["dcno"]}} {% endif %}
diff --git a/gkwebapp/templates/viewsingleinvoice.jinja2 b/gkwebapp/templates/viewsingleinvoice.jinja2 index 157440e1..47d85f56 100644 --- a/gkwebapp/templates/viewsingleinvoice.jinja2 +++ b/gkwebapp/templates/viewsingleinvoice.jinja2 @@ -10,7 +10,7 @@ {% endif %}
{% if gkresult["dcno"] %} - + {{gkresult["dcno"]}} {% endif %}
-- GitLab From 878f412c7d3e691492629351f6300e1459e4adbc Mon Sep 17 00:00:00 2001 From: reshma1 Date: Tue, 24 Oct 2017 19:01:34 +0530 Subject: [PATCH 027/121] made adjustment in navigation of last few fields in invoice. --- gkwebapp/static/js/addinvoice.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index 0af88eb1..cecdb555 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -1773,6 +1773,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(); @@ -1803,7 +1804,7 @@ if (event.which == 13) { } } } - $(this).val(yearpad($(this).val(), 4)); + }); //Events for last fields - Bank Details, Reverse charge etc.. @@ -1814,6 +1815,9 @@ 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(); } @@ -1823,6 +1827,10 @@ if (event.which == 13) { } 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") { @@ -1904,7 +1912,7 @@ if (event.which == 13) { datatype: "text/json", beforeSend: function(xhr) { xhr.setRequestHeader("gktoken", sessionStorage.gktoken); - }, + } }) .done(function(resp) { var custs = resp["customers"]; -- GitLab From 93910bb9005c52b602614d317ac1281aa8a8cc56 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Wed, 25 Oct 2017 14:52:56 +0530 Subject: [PATCH 028/121] Validaion on PAN in Create Customer/Supplier. --- gkwebapp/static/js/addcustomersupplier.js | 28 +++++++++++++++++++ gkwebapp/templates/addcustomersupplier.jinja2 | 9 ++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index b58f54a0..c61e2255 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -264,6 +264,33 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { } }); + // Validation for PAN + $("#add_cussup_pan").keydown(function (event) { + if (event.which==13) { + event.preventDefault(); + if ($.trim($("#add_cussup_pan").val())==""){ + $("#add_cussup_tan").focus(); + } + else { + $("#add_cussup_pan").focus(); + } + var regExp = /[a-zA-z]{5}\d{4}[a-zA-Z]{1}/; + var txtpan = $(this).val(); + if (txtpan.length == 10 && txtpan.match(regExp) ) { + $("#add_cussup_tan").focus(); + } + else { + if ($.trim($("#add_cussup_pan").val())!="") { + $("#pan-incorrect-alert").alert(); + $("#pan-incorrect-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#pan-incorrect-alert").hide(); + }); + } + } + } + + }); + $("#add_cussup_tan").keydown(function(event) { @@ -363,6 +390,7 @@ if($("#vatorgstflag").val() == '22'){ $("#add_cussup_address").focus(); return false; } + var gobj = {}; // Creating a dictionary for storing godown wise opening stock $("#gstintable tbody tr").each(function(){ var curindex1 = $(this).index(); diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index eda7a84d..30a55354 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -42,6 +42,11 @@ {% trans %}Please enter address!{% endtrans %} + + {% if vatorgstflag != '7' %} @@ -236,7 +241,7 @@
- +
-- GitLab From 4b2839ca0d851c46ac3902bf752690dc35527ca5 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Wed, 25 Oct 2017 17:14:09 +0530 Subject: [PATCH 029/121] PAN validation is corrected in Add Customer/Supplier --- gkwebapp/static/js/addcustomersupplier.js | 21 ++++++++++++++----- gkwebapp/static/js/editcustomersupplier.js | 21 ++++++++++++++++++- .../templates/editcustomersupplier.jinja2 | 6 ++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index c61e2255..16a30c84 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -251,11 +251,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) { @@ -265,7 +276,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { }); // Validation for PAN - $("#add_cussup_pan").keydown(function (event) { + /**$("#add_cussup_pan").keydown(function (event) { if (event.which==13) { event.preventDefault(); if ($.trim($("#add_cussup_pan").val())==""){ @@ -289,7 +300,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { } } - }); + });**/ diff --git a/gkwebapp/static/js/editcustomersupplier.js b/gkwebapp/static/js/editcustomersupplier.js index a3f7f782..e5e3a95b 100644 --- a/gkwebapp/static/js/editcustomersupplier.js +++ b/gkwebapp/static/js/editcustomersupplier.js @@ -186,7 +186,26 @@ $(document).ready(function() { $("#edit_cussup_pan").keydown(function(event) { if (event.which==13) { event.preventDefault(); - $("#edit_cussup_tan").focus().select(); + //$("#edit_cussup_tan").focus().select(); + if ($.trim($("#edit_cussup_pan").val())==""){ + $("#edit_cussup_tan").focus(); + } + else { + $("#edit_cussup_pan").focus(); + } + var regExp = /[a-zA-z]{5}\d{4}[a-zA-Z]{1}/; + var txtpan = $(this).val(); + if (txtpan.length == 10 && txtpan.match(regExp) ) { + $("#edit_cussup_tan").focus(); + } + else { + if ($.trim($("#edit_cussup_pan").val())!="") { + $("#pan-incorrect-alert").alert(); + $("#pan-incorrect-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#pan-incorrect-alert").hide(); + }); + } + } } if (event.which==38){ event.preventDefault(); diff --git a/gkwebapp/templates/editcustomersupplier.jinja2 b/gkwebapp/templates/editcustomersupplier.jinja2 index dec4efd4..99dd4046 100644 --- a/gkwebapp/templates/editcustomersupplier.jinja2 +++ b/gkwebapp/templates/editcustomersupplier.jinja2 @@ -69,6 +69,12 @@
+ + {% if vatorgstflag != '7' %} @@ -270,7 +270,7 @@ + + +
- +
@@ -272,7 +279,7 @@ th {
- +
-- GitLab From 3ae43d015aa469126cd1cfe43605fb7fbc78823a Mon Sep 17 00:00:00 2001 From: abhijith Date: Wed, 25 Oct 2017 15:35:24 +0530 Subject: [PATCH 032/121] Added fields for cess in Invoice Product Table --- gkwebapp/templates/addinvoice.jinja2 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 5420cdb3..54020520 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -398,8 +398,9 @@
{% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% trans %}CGST{% endtrans %}{% trans %}SGST{% endtrans %}{% trans %}SGST/UTGST{% endtrans %} {% trans %}IGST{% endtrans %}{% trans %}CESS{% endtrans %}
{% trans %}Amount{% endtrans %} {% trans %}Rate{% endtrans %} % {% trans %}Amount{% endtrans %}{% trans %}Rate{% endtrans %} %{% trans %}Amount{% endtrans %}
@@ -460,8 +463,12 @@
+ +
@@ -475,6 +482,7 @@ +
-- GitLab From d69ae219ebc2e925cf064e1627c9d7a56f35758a Mon Sep 17 00:00:00 2001 From: abhijith Date: Wed, 25 Oct 2017 17:19:50 +0530 Subject: [PATCH 033/121] Adjusted javascript in calculate tax functon for gst and footer of invoice product table to acommodate cess --- gkwebapp/static/js/addinvoice.js | 10 ++++++++-- gkwebapp/templates/addinvoice.jinja2 | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index cecdb555..cc30839f 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -63,6 +63,7 @@ $(document).ready(function() { 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 cessamount = 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; @@ -73,6 +74,7 @@ $(document).ready(function() { 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. @@ -80,13 +82,17 @@ $(document).ready(function() { //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; + let cessrate = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(10) input').val()).toFixed(2); + cessamount = (rowtaxableamount * cessrate)/100; //Amount of Cess to be applied is found out. + rowtotal = rowtaxableamount + taxamount + cessamount; $('#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); + let cessrate = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(12) input').val()).toFixed(2); + cessamount = (rowtaxableamount * cessrate)/100; //Amount of Cess to be applied is found out. + rowtotal = rowtaxableamount + (2*taxamount) + cessamount; $('#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 diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 54020520..d4746a26 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -482,7 +482,7 @@ - +
-- GitLab From 15ac5771ef44f6df0a59c296a42be3d2602a47e7 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 27 Oct 2017 11:01:53 +0530 Subject: [PATCH 034/121] Conditions for cess added in invoice --- gkwebapp/views/invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gkwebapp/views/invoice.py b/gkwebapp/views/invoice.py index 61906974..81b67a08 100644 --- a/gkwebapp/views/invoice.py +++ b/gkwebapp/views/invoice.py @@ -137,6 +137,12 @@ def getappliedtax(request): try: taxdetails = requests.get("http://127.0.0.1:6543/products?type=pt&productcode=%d&source=%s&destination=%s&taxflag=%d"%(int(request.params["productcode"]),request.params["source"],request.params["destination"],int(request.params["taxflag"])), headers=header) data = taxdetails.json()["gkresult"] + if data.has_key('VAT'): + return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":"VAT","taxrate":data["VAT"]} + if data.has_key('SGST'): + if data.has_key('CESS'): + return{"gkstatus":taxdetails.json()["gkstatus"],"tax":data} + return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":"SGST","taxrate":data["SGST"]} return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":data["taxname"],"taxrate":data["taxrate"]} except: return {"gkstatus":1} -- GitLab From 4873f8380fa49bc0daf811f380ac269c8b94527d Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 27 Oct 2017 13:57:09 +0530 Subject: [PATCH 035/121] Added new classes to tax fields so that they can be set blank on change of product --- gkwebapp/templates/addinvoice.jinja2 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index d4746a26..59038dcb 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -453,19 +453,19 @@ - - + + - - + + - - + + - - + + -- GitLab From 37d3a934f4172a6b054dd694c2e12c835533f171 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 27 Oct 2017 14:51:11 +0530 Subject: [PATCH 036/121] Fixed getapplied tax --- gkwebapp/static/js/addinvoice.js | 40 ++++++++++++++++++++------------ gkwebapp/views/invoice.py | 8 +------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index cc30839f..0dedd77c 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -690,7 +690,7 @@ $(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)); + $('#invoice_product_table_vat tbody tr:eq(' + curindex + ') td:eq(6) input').val(parseFloat(resp['tax']['VAT']).toFixed(2)); } else if (resp["gkstatus"] == 1) { $("#notax-alert").alert(); @@ -724,7 +724,7 @@ $(document).ready(function() { }) .fail(function() { - console.log("error"); + console.log("error"); }) .always(function() { console.log("complete"); @@ -1307,19 +1307,29 @@ $(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) { + $(".trate", ".tname").val(parseFloat(0).toFixed(2)); //Sets all tax fields to zero on change of product + //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() { diff --git a/gkwebapp/views/invoice.py b/gkwebapp/views/invoice.py index 81b67a08..daedeae2 100644 --- a/gkwebapp/views/invoice.py +++ b/gkwebapp/views/invoice.py @@ -137,13 +137,7 @@ def getappliedtax(request): try: taxdetails = requests.get("http://127.0.0.1:6543/products?type=pt&productcode=%d&source=%s&destination=%s&taxflag=%d"%(int(request.params["productcode"]),request.params["source"],request.params["destination"],int(request.params["taxflag"])), headers=header) data = taxdetails.json()["gkresult"] - if data.has_key('VAT'): - return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":"VAT","taxrate":data["VAT"]} - if data.has_key('SGST'): - if data.has_key('CESS'): - return{"gkstatus":taxdetails.json()["gkstatus"],"tax":data} - return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":"SGST","taxrate":data["SGST"]} - return{"gkstatus":taxdetails.json()["gkstatus"],"taxname":data["taxname"],"taxrate":data["taxrate"]} + return{"gkstatus":taxdetails.json()["gkstatus"],"tax":data} except: return {"gkstatus":1} -- GitLab From 970c9782c190621e467d2131295e87d355726b58 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 27 Oct 2017 17:02:16 +0530 Subject: [PATCH 037/121] Fixed Calculate Tax of GST in Invoice Product Table --- gkwebapp/static/js/addinvoice.js | 46 ++++++++++++++-------------- gkwebapp/templates/addinvoice.jinja2 | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index 0dedd77c..a4dd77cb 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -22,7 +22,7 @@ "Krishnakant Mane" "Ishan Masdekar " "Navin Karkera" - "Prajkta Patkar" + "Prajkta Patkar" "Vaibhav Kurhe" "Abhijith Balan" "Rohini Baraskar" @@ -61,9 +61,6 @@ $(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 cessamount = 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; @@ -78,30 +75,26 @@ $(document).ready(function() { 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)); - let cessrate = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(10) input').val()).toFixed(2); - cessamount = (rowtaxableamount * cessrate)/100; //Amount of Cess to be applied is found out. - rowtotal = rowtaxableamount + taxamount + cessamount; - $('#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)); - let cessrate = parseFloat($('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(12) input').val()).toFixed(2); - cessamount = (rowtaxableamount * cessrate)/100; //Amount of Cess to be applied is found out. - rowtotal = rowtaxableamount + (2*taxamount) + cessamount; - $('#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 + 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()); 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()); 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. @@ -110,6 +103,7 @@ $(document).ready(function() { $('#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)); } @@ -658,6 +652,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 = ""; @@ -690,7 +685,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['tax']['VAT']).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(); diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 59038dcb..57ff2c54 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -482,7 +482,7 @@ - +
-- GitLab From a4b120d6bc089540760392146a30170db6957a31 Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Fri, 27 Oct 2017 17:39:42 +0530 Subject: [PATCH 038/121] states input format chnaged to selection box. also if state is saved it will be shown --- gkwebapp/static/js/editorganisation.js | 4 +- gkwebapp/templates/editorganisation.jinja2 | 10 +- gkwebapp/views/organisation.py | 109 +++++++++++---------- 3 files changed, 67 insertions(+), 56 deletions(-) diff --git a/gkwebapp/static/js/editorganisation.js b/gkwebapp/static/js/editorganisation.js index a8d58986..4d0ef9c6 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 @@ -29,7 +29,7 @@ $(document).ready(function(){ $("#msspinmodal").modal("hide"); $(".regdate").autotab('number'); $(".fcradate").autotab('number'); - + $("#orgstate").val($("#state").val()); $(".regdate").numeric({negative: false}); $(".fcradate").numeric({negative: false}); diff --git a/gkwebapp/templates/editorganisation.jinja2 b/gkwebapp/templates/editorganisation.jinja2 index db0dd9dd..025b32ca 100644 --- a/gkwebapp/templates/editorganisation.jinja2 +++ b/gkwebapp/templates/editorganisation.jinja2 @@ -105,7 +105,15 @@ - + + + diff --git a/gkwebapp/views/organisation.py b/gkwebapp/views/organisation.py index 0b03e0fd..6ff34676 100644 --- a/gkwebapp/views/organisation.py +++ b/gkwebapp/views/organisation.py @@ -6,7 +6,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 @@ -25,6 +25,8 @@ Contributors: "Ishan Masdekar " "Navin Karkera" "Vanita Rajpurohit" +'Prajkta Patkar' + """ from pyramid.view import view_config @@ -40,100 +42,101 @@ import cStringIO @view_config(route_name='locale') def set_locale_cookie(request): - if request.GET['language']: - language = request.GET['language'] - response = Response() - response.set_cookie('_LOCALE_', - value=language, - max_age=31536000) # max_age = year - return HTTPFound(location=request.environ['HTTP_REFERER'], - headers=response.headers) + if request.GET['language']: + language = request.GET['language'] + response = Response() + response.set_cookie('_LOCALE_', + value=language, + max_age=31536000) # max_age = year + return HTTPFound(location=request.environ['HTTP_REFERER'], + headers=response.headers) @view_config(route_name="showeditOrg", renderer="gkwebapp:templates/editorganisation.jinja2") def showeditOrg(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/organisation", headers=header) - return {"gkresult":result.json()["gkdata"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/organisation", headers=header) + states = requests.get("http://127.0.0.1:6543/state", headers=header) + return {"gkresult":result.json()["gkdata"],"gkstatus":result.json()["gkstatus"],"states": states.json()["gkresult"]} @view_config(route_name="editorganisation", request_param="edit=inventoryactivate", renderer="json") def inventoryActivate(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.put("http://127.0.0.1:6543/organisations?type=getinventory", data=json.dumps({"invflag":1}), headers=header) + header={"gktoken":request.headers["gktoken"]} + result = requests.put("http://127.0.0.1:6543/organisations?type=getinventory", data=json.dumps({"invflag":1}), headers=header) - return {"gkstatus":result.json()["gkstatus"]} + return {"gkstatus":result.json()["gkstatus"]} @view_config(route_name="oexists", renderer="json") def oexists(request): - result = requests.get("http://127.0.0.1:6543/organisations?type=exists&orgname=%s&orgtype=%s&finstart=%s&finend=%s"%(request.params["orgname"],request.params["orgtype"],request.params["finstart"],request.params["finend"])) - return {"gkstatus":result.json()["gkstatus"]} + result = requests.get("http://127.0.0.1:6543/organisations?type=exists&orgname=%s&orgtype=%s&finstart=%s&finend=%s"%(request.params["orgname"],request.params["orgtype"],request.params["finstart"],request.params["finend"])) + return {"gkstatus":result.json()["gkstatus"]} @view_config(route_name="editorganisation", renderer="json") def editOrganisation(request): - header={"gktoken":request.headers["gktoken"]} + header={"gktoken":request.headers["gktoken"]} - gkdata= {"orgcity":request.params["orgcity"],"orgaddr":request.params["orgaddr"],"orgpincode":request.params["orgpincode"],"orgstate":request.params["orgstate"], "orgcountry":request.params["orgcountry"],"orgtelno":request.params["orgtelno"], "orgfax":request.params["orgfax"],"orgwebsite":request.params["orgwebsite"],"orgemail":request.params["orgemail"],"orgpan":request.params["orgpan"],"orgmvat":request.params["orgmvat"],"orgstax":request.params["orgstax"],"orgregno":request.params["orgregno"],"orgregdate":request.params["orgregdate"], "orgfcrano":request.params["orgfcrano"],"orgfcradate":request.params["orgfcradate"]} - filelogo={} - try: - if request.POST['logo'].file: + gkdata= {"orgcity":request.params["orgcity"],"orgaddr":request.params["orgaddr"],"orgpincode":request.params["orgpincode"],"orgstate":request.params["orgstate"], "orgcountry":request.params["orgcountry"],"orgtelno":request.params["orgtelno"], "orgfax":request.params["orgfax"],"orgwebsite":request.params["orgwebsite"],"orgemail":request.params["orgemail"],"orgpan":request.params["orgpan"],"orgmvat":request.params["orgmvat"],"orgstax":request.params["orgstax"],"orgregno":request.params["orgregno"],"orgregdate":request.params["orgregdate"], "orgfcrano":request.params["orgfcrano"],"orgfcradate":request.params["orgfcradate"]} + filelogo={} + try: + if request.POST['logo'].file: - img=request.POST['logo'].file - image=Image.open(img) - imgbuffer = cStringIO.StringIO() - image.save(imgbuffer, format="JPEG") - img_str = base64.b64encode(imgbuffer.getvalue()) - image.close() - filelogo=img_str + img=request.POST['logo'].file + image=Image.open(img) + imgbuffer = cStringIO.StringIO() + image.save(imgbuffer, format="JPEG") + img_str = base64.b64encode(imgbuffer.getvalue()) + image.close() + filelogo=img_str - gkdata["logo"]=filelogo - except: - print "no file found " + gkdata["logo"]=filelogo + except: + print "no file found " - result = requests.put("http://127.0.0.1:6543/organisations", headers=header, data=json.dumps(gkdata)) - return {"gkstatus":result.json()["gkstatus"]} + result = requests.put("http://127.0.0.1:6543/organisations", headers=header, data=json.dumps(gkdata)) + return {"gkstatus":result.json()["gkstatus"]} @view_config(route_name="getorgcode", renderer="json") def getOrgcode(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/organisations?orgcode", headers=header) - return {"gkdata":result.json()["gkdata"],"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/organisations?orgcode", headers=header) + return {"gkdata":result.json()["gkdata"],"gkstatus":result.json()["gkstatus"]} @view_config(route_name="closebooks", renderer="json") def closebooks(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/rollclose?task=closebooks&financialend=%s"%(request.params["financialend"]), headers=header) + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/rollclose?task=closebooks&financialend=%s"%(request.params["financialend"]), headers=header) - return {"gkstatus":result.json()["gkstatus"]} + return {"gkstatus":result.json()["gkstatus"]} @view_config(route_name="rollover", renderer="json") def rollover(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/rollclose?task=rollover&financialend=%s&financialstart=%s"%(request.params["financialend"],request.params["financialstart"]), headers=header) + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/rollclose?task=rollover&financialend=%s&financialstart=%s"%(request.params["financialend"],request.params["financialstart"]), headers=header) - return {"gkstatus":result.json()["gkstatus"]} + return {"gkstatus":result.json()["gkstatus"]} @view_config(route_name="deleteorg", renderer="json") def deleteorg(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.delete("http://127.0.0.1:6543/organisations", headers=header) - return {"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.delete("http://127.0.0.1:6543/organisations", headers=header) + return {"gkstatus":result.json()["gkstatus"]} @view_config(route_name="editorganisation", request_param="action=getattachment", renderer="json") def getattachment(request): - header={"gktoken":request.headers["gktoken"]} - result = requests.get("http://127.0.0.1:6543/organisation?attach=image", headers=header) - return {"logo":result.json()["logo"]} + header={"gktoken":request.headers["gktoken"]} + result = requests.get("http://127.0.0.1:6543/organisation?attach=image", headers=header) + return {"logo":result.json()["logo"]} @view_config(route_name="editorganisation",request_param="action=orgpref", renderer="json") def editOrganisationPreferences(request): - header={"gktoken":request.headers["gktoken"]} - gkdata= {"invflag":request.params["invflag"],"invsflag":request.params["invsflag"],"billflag":request.params["billflag"]} - result = requests.put("http://127.0.0.1:6543/organisations", headers=header, data=json.dumps(gkdata)) - return {"gkstatus":result.json()["gkstatus"]} + header={"gktoken":request.headers["gktoken"]} + gkdata= {"invflag":request.params["invflag"],"invsflag":request.params["invsflag"],"billflag":request.params["billflag"]} + result = requests.put("http://127.0.0.1:6543/organisations", headers=header, data=json.dumps(gkdata)) + return {"gkstatus":result.json()["gkstatus"]} -- GitLab From a40744ce23cf107082887a37b097eb5bdcdb446d Mon Sep 17 00:00:00 2001 From: Prajkta_Patkar Date: Fri, 27 Oct 2017 17:51:55 +0530 Subject: [PATCH 039/121] select state option added for some convinience. also shown state --- gkwebapp/static/js/editorganisation.js | 5 +++-- gkwebapp/templates/addcustomersupplier.jinja2 | 2 +- gkwebapp/templates/editorganisation.jinja2 | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gkwebapp/static/js/editorganisation.js b/gkwebapp/static/js/editorganisation.js index 4d0ef9c6..d70c1c9e 100644 --- a/gkwebapp/static/js/editorganisation.js +++ b/gkwebapp/static/js/editorganisation.js @@ -28,8 +28,9 @@ Contributors: $(document).ready(function(){ $("#msspinmodal").modal("hide"); $(".regdate").autotab('number'); - $(".fcradate").autotab('number'); - $("#orgstate").val($("#state").val()); + $(".fcradate").autotab('number'); + if($("#state").val() != "" ){ + $("#orgstate").val($("#state").val());} $(".regdate").numeric({negative: false}); $(".fcradate").numeric({negative: false}); diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 30a55354..a0dbd84f 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -102,7 +102,7 @@
+ - - - + + + + + +
@@ -326,10 +330,12 @@ Total - - - - + + + + + +
@@ -349,8 +355,8 @@ - - + + diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 57ff2c54..33a8d139 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -476,13 +476,13 @@ Total - - - + + + - - - + + + @@ -503,8 +503,8 @@ - - + + -- GitLab From 204556b23c80d6e7936b7a23bedbd8b09e698af4 Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 28 Oct 2017 12:09:40 +0530 Subject: [PATCH 043/121] Made Calculate tax functions in Cash Memo more readable --- gkwebapp/static/js/addcashmemo.js | 157 +++++++++++++++--------------- 1 file changed, 80 insertions(+), 77 deletions(-) diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index 47547a97..c7d74be5 100644 --- a/gkwebapp/static/js/addcashmemo.js +++ b/gkwebapp/static/js/addcashmemo.js @@ -45,85 +45,88 @@ $(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 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 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)); + 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)); + } - //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 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)); + } + + //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'); -- GitLab From 7acd9aa59be9060da733e3628e5b910418f0f6ca Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 28 Oct 2017 12:19:08 +0530 Subject: [PATCH 044/121] Modified Calculate GST Tax function in cashmemo by considering CESS --- gkwebapp/static/js/addcashmemo.js | 24 +++++++++++++++--------- gkwebapp/static/js/addinvoice.js | 16 ++++++++++++---- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index c7d74be5..76d961f6 100644 --- a/gkwebapp/static/js/addcashmemo.js +++ b/gkwebapp/static/js/addcashmemo.js @@ -51,7 +51,6 @@ $(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")) { @@ -66,21 +65,27 @@ $(document).ready(function() { 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)); - 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)); - } + $('#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()); } @@ -89,6 +94,7 @@ $(document).ready(function() { $('#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)); } diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index b4396b7b..f4a7987e 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -65,6 +65,7 @@ $(document).ready(function() { 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; @@ -74,20 +75,26 @@ $(document).ready(function() { 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. + 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 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 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. + + 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 + + //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()); @@ -97,6 +104,7 @@ $(document).ready(function() { 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)); -- GitLab From 453a44360deb59b398defe87f4da0ba6509b619b Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 28 Oct 2017 15:23:19 +0530 Subject: [PATCH 045/121] CESS gets saved in Cash Memo. Fixed change event of product in Invoice Prouct Table --- gkwebapp/static/js/addcashmemo.js | 66 ++++++++++++++++----------- gkwebapp/static/js/addinvoice.js | 18 +++++--- gkwebapp/templates/addcashmemo.jinja2 | 12 ++--- gkwebapp/views/cashmemo.py | 4 +- 4 files changed, 58 insertions(+), 42 deletions(-) diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index 76d961f6..ca625897 100644 --- a/gkwebapp/static/js/addcashmemo.js +++ b/gkwebapp/static/js/addcashmemo.js @@ -192,7 +192,7 @@ $(document).ready(function() { $("#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(); @@ -340,7 +340,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(); @@ -443,15 +448,19 @@ $(document).ready(function() { } }); - $(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', @@ -464,14 +473,15 @@ $(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(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() { @@ -481,7 +491,7 @@ $(document).ready(function() { console.log("complete"); }); $.ajax({ - url: '/invoice?action=getproduct', + url: '/invoice?action=getproduct', type: 'POST', dataType: 'json', async: false, @@ -562,7 +572,7 @@ $(document).ready(function() { 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(); } }); @@ -900,7 +910,7 @@ else if (event.which == 38) { if ($(this).is("select")) { if ($(this).val() == "Road") { f[previndex].focus(); - f[previndex].select(); + f[previndex].select(); } } else { @@ -983,6 +993,7 @@ $(document).off("keyup").on("keyup", function(event) { } var tax = {}; + var cess = {}; var contents = {}; var stock = {}; var freeqty = {}; @@ -1069,7 +1080,9 @@ $(document).off("keyup").on("keyup", function(event) { contents[productcode] = obj; items[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val(); freeqty[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(3) input").val(); - discount[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(5) input").val(); + discount[productcode] = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(5) input").val(); + tax[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(7) input").val()) + parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(9) input").val()); + cess[productcode] = parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(11) input").val()); } invoicetotal = $('#total_product_gst').text(); stock["items"] = items; @@ -1082,6 +1095,7 @@ $(document).off("keyup").on("keyup", function(event) { form_data.append("invoicedate", $("#invoice_year").val() + '-' + $("#invoice_month").val() + '-' + $("#invoice_date").val()); form_data.append("contents", JSON.stringify(contents)); form_data.append("tax", JSON.stringify(tax)); + form_data.append("cess", JSON.stringify(cess)); form_data.append("stock", JSON.stringify(stock)); form_data.append("invoicetotal", invoicetotal); form_data.append("taxstate", $("#invoice_state option:selected").val()); @@ -1481,14 +1495,14 @@ $(document).off("keyup").on("keyup", function(event) { event.preventDefault(); /* Act on the event */ - var curindex = $(this).closest('#invoice_product_table_gst tbody tr').index(); + var curindex = $(this).closest('#invoice_product_table_gst tbody tr').index(); if ($(this).val() == "") { $(this).val(0); } calculategstaxamt(curindex); }); - $(document).off("keydown", ".invoice_product_quantity_gst").on("keydown", ".invoice_product_quantity_gst", function(event) { - var curindex = $(this).closest('tr').index(); + $(document).off("keydown", ".invoice_product_quantity_gst").on("keydown", ".invoice_product_quantity_gst", function(event) { + var curindex = $(this).closest('tr').index(); var nextindex = curindex + 1; var previndex = curindex - 1; diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index f4a7987e..aa3026f8 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -1281,12 +1281,17 @@ $(document).ready(function() { //GST events start here //Change event for Product Name field. $(document).off('change', '.product_name_gst').on('change', '.product_name_gst', function(event) { - event.preventDefault(); - /* Act on the event */ - var productcode = $(this).find('option:selected').val(); - var curindex = $(this).closest('tbody tr').index(); - var destinationstate = ""; - var sourcestate = ""; + event.preventDefault(); + var productcode = $(this).find('option:selected').val(); + var curindex = $(this).closest('tbody tr').index(); + var destinationstate = ""; + var sourcestate = ""; + + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(7) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(9) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(11) input').val(parseFloat(0).toFixed(2)); + $('#invoice_product_table_gst tbody tr:eq(' + curindex + ') td:eq(13) input').val(parseFloat(0).toFixed(2)); + if ($("#status").val() == 9) { destinationstate = $("#invoicestate option:selected").val(); sourcestate = $("#invoice_customerstate").val(); @@ -1316,7 +1321,6 @@ $(document).ready(function() { }) .done(function(resp) { if (resp["gkstatus"] == 0) { - $(".trate", ".tname").val(parseFloat(0).toFixed(2)); //Sets all tax fields to zero on change of product //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)); diff --git a/gkwebapp/templates/addcashmemo.jinja2 b/gkwebapp/templates/addcashmemo.jinja2 index 03db4e65..ab2cb4d1 100644 --- a/gkwebapp/templates/addcashmemo.jinja2 +++ b/gkwebapp/templates/addcashmemo.jinja2 @@ -312,14 +312,14 @@ - - + + - - + + - - + + diff --git a/gkwebapp/views/cashmemo.py b/gkwebapp/views/cashmemo.py index 1657a2e5..51689bb6 100644 --- a/gkwebapp/views/cashmemo.py +++ b/gkwebapp/views/cashmemo.py @@ -70,9 +70,7 @@ def getproducts(request): def savecashmemo(request): header={"gktoken":request.headers["gktoken"]} - cashmemodata = {"invoiceno":request.params["invoiceno"],"invoicetotal":request.params["invoicetotal"],"icflag":3,"taxstate":request.params["taxstate"],"sourcestate":request.params["sourcestate"],"invoicedate":request.params["invoicedate"], - "tax":json.loads(request.params["tax"]), - "contents":json.loads(request.params["contents"]),"freeqty":json.loads(request.params["freeqty"]),"taxflag":request.params["taxflag"]} + cashmemodata = {"invoiceno":request.params["invoiceno"],"invoicetotal":request.params["invoicetotal"],"icflag":3,"taxstate":request.params["taxstate"],"sourcestate":request.params["sourcestate"],"invoicedate":request.params["invoicedate"],"tax":json.loads(request.params["tax"]), "cess":json.loads(request.params["cess"]), "contents":json.loads(request.params["contents"]),"freeqty":json.loads(request.params["freeqty"]),"taxflag":request.params["taxflag"]} if request.params.has_key("discount"): cashmemodata["discount"]=json.loads(request.params["discount"]) -- GitLab From 39ac0ea02e5af4a923b20417c655c88bf7e69788 Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 28 Oct 2017 15:34:28 +0530 Subject: [PATCH 046/121] CESS appears in View Cash Memo --- gkwebapp/templates/viewsinglecashmemo.jinja2 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gkwebapp/templates/viewsinglecashmemo.jinja2 b/gkwebapp/templates/viewsinglecashmemo.jinja2 index 14da37ec..e3e8fe0b 100644 --- a/gkwebapp/templates/viewsinglecashmemo.jinja2 +++ b/gkwebapp/templates/viewsinglecashmemo.jinja2 @@ -118,7 +118,8 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% if gkresult["taxname"]=='SGST' %}{% trans %}CGST{% endtrans %}{% endif %} - {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST{% endtrans %}{% endif %} + {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST/UTGST{% endtrans %}{% endif %} + {% trans %}CESS{% endtrans %} @@ -126,6 +127,8 @@ {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Rate{% endtrans %} %{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -163,6 +166,8 @@ {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxrate"] }}{% endif %} {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxamount"] }}{% endif %} + {{ gkresult["invcontents"][product]["cessrate"] }} + {{ gkresult["invcontents"][product]["cess"] }} {% endfor %} @@ -177,6 +182,7 @@ {{ gkresult["totaltaxablevalue"] }} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }} -- GitLab From f1dba3bfaa3e4678485bcbed918700f6706aaacc Mon Sep 17 00:00:00 2001 From: abhijith Date: Sat, 28 Oct 2017 15:38:45 +0530 Subject: [PATCH 047/121] CESS appears in Print of Cash Memo too --- gkwebapp/templates/printcashmemo.jinja2 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gkwebapp/templates/printcashmemo.jinja2 b/gkwebapp/templates/printcashmemo.jinja2 index f100118d..f10ce9be 100644 --- a/gkwebapp/templates/printcashmemo.jinja2 +++ b/gkwebapp/templates/printcashmemo.jinja2 @@ -202,7 +202,7 @@ {% trans %}Discount Amount{% endtrans %} {% trans %}Taxable Value {% endtrans %} {% if gkresult["taxname"]=='SGST' %}{% trans %}CGST{% endtrans %}{% endif %} - {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST{% endtrans %}{% endif %} + {% if gkresult["taxname"]=='SGST' %}{% trans %}SGST/UTGST{% endtrans %}{% endif %} Total @@ -211,6 +211,8 @@ {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Rate{% endtrans %} %{% endif %} {% if gkresult["taxname"]=='SGST' %}{% trans %}Amount{% endtrans %}{% endif %} + {% trans %}Rate{% endtrans %} % + {% trans %}Amount{% endtrans %} @@ -244,7 +246,8 @@ {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxrate"] }}{% endif %} {% if gkresult["invcontents"][product]["taxname"]=='SGST' %}{{ gkresult["invcontents"][product]["taxamount"] }}{% endif %} - + {{ gkresult["invcontents"][product]["cessrate"] }} + {{ gkresult["invcontents"][product]["cess"] }} {{ gkresult["invcontents"][product]["totalAmount"] }} {% endfor %} @@ -256,6 +259,7 @@ {{ gkresult["totaltaxablevalue"] }} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} {% if gkresult["taxname"]=='SGST' %}{{ gkresult["totaltaxamt"] }}{% endif %} + {{ gkresult["totalcessamt"] }} {{ gkresult["invoicetotal"] }} -- GitLab From ab7ac5d443846b39834d27c72c27a6c7821117ca Mon Sep 17 00:00:00 2001 From: reshma1 Date: Thu, 26 Oct 2017 11:47:59 +0530 Subject: [PATCH 048/121] in gstin field automaticaly state code is coming --- gkwebapp/static/js/addcustomersupplier.js | 7 +++++++ gkwebapp/templates/addcustomersupplier.jinja2 | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index 191e3765..50b2bce0 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -129,6 +129,13 @@ $("#add_state").keydown(function(event) { $("#cussup_save").focus(); } }); + // + $(".gstinstate").change(function(event) { + event.preventDefault(); + $("#statecodeforcussup").text($(".gstinstate option:selected").attr("stateid")); + + }); + $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { var curindex = $(this).closest('tr').index(); var gstin = $(this).val(); diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 30a55354..2a24778d 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -162,7 +162,8 @@ - + + -- GitLab From 8ad5840c8b5380749268b1644dba79bd7ee31811 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Thu, 26 Oct 2017 16:35:14 +0530 Subject: [PATCH 049/121] Three text fields are added in GSTIN column . --- gkwebapp/static/js/addcustomersupplier.js | 12 +++++++++--- gkwebapp/templates/addcustomersupplier.jinja2 | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index 50b2bce0..d371ca32 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -121,8 +121,11 @@ $("#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(); + } + //$('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); } else if (event.which==27) { event.preventDefault(); @@ -132,7 +135,10 @@ $("#add_state").keydown(function(event) { // $(".gstinstate").change(function(event) { event.preventDefault(); - $("#statecodeforcussup").text($(".gstinstate option:selected").attr("stateid")); + var curindex = $(this).closest('tr').index(); + var cusstatecode = $('#gstintable tbody tr:eq('+curindex+') td:eq(0) select option:selected').attr("stateid"); + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:first').val(cusstatecode); + }); diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 2a24778d..7229bdd6 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -162,8 +162,14 @@ - - +
+
+ + + + +
+
-- GitLab From 7f4fbceabe2a0381c3354243ad63dde0888e4527 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Thu, 26 Oct 2017 19:42:37 +0530 Subject: [PATCH 050/121] Navigation is added for GSTIN. --- gkwebapp/static/js/addcustomersupplier.js | 36 +++++++++++++++++-- gkwebapp/templates/addcustomersupplier.jinja2 | 7 ++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index d371ca32..44baffd1 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -125,7 +125,9 @@ $("#add_state").keydown(function(event) { if ($.trim($("#add_cussup_pan").val()) !="") { $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:last').focus(); } - //$('#gstintable tbody tr:eq('+curindex+') td:eq(1) input').focus().select(); + else { + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(1)').focus(); + } } else if (event.which==27) { event.preventDefault(); @@ -137,9 +139,39 @@ $("#add_state").keydown(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"); - $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:first').val(cusstatecode); + $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:first').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:second').prop("disabled",false); + } + }); + + $(".panno").keydown(function(event) { + var curindex = $(this).closest('tr').index(); + var previndex = curindex-1; + if (event.which == 13) { + event.preventDefault(); + console.log("HEloo pan"); + 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(); + }); + } + + } + /*if (event.which == 38) { + event.preventDefault(); + $('#gstintable tbody tr:eq('+previndex+') td:eq(0) input').focus(); + }*/ }); $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 7229bdd6..7d7975c3 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -48,6 +48,13 @@ {% trans %}Please enter proper PAN!{% endtrans %} + + + + + + + +
- {% if vatorgstflag != '7' %} + {% if vatorgstflag != '7' %}
@@ -179,27 +186,34 @@ th {
- - - - - - - - - - + + + + + + + + + - + -- GitLab From 562ddab62df4e8bc0e2877ad601c6877f7656eb8 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Sat, 28 Oct 2017 14:17:06 +0530 Subject: [PATCH 061/121] Three separate fields are added for GSTIN. --- gkwebapp/static/js/createcustsuppopup.js | 7 ++++++- gkwebapp/templates/createcustsuppopup.jinja2 | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gkwebapp/static/js/createcustsuppopup.js b/gkwebapp/static/js/createcustsuppopup.js index eed69f57..c1d1c24f 100644 --- a/gkwebapp/static/js/createcustsuppopup.js +++ b/gkwebapp/static/js/createcustsuppopup.js @@ -104,7 +104,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(); diff --git a/gkwebapp/templates/createcustsuppopup.jinja2 b/gkwebapp/templates/createcustsuppopup.jinja2 index 097e36e5..45552b03 100644 --- a/gkwebapp/templates/createcustsuppopup.jinja2 +++ b/gkwebapp/templates/createcustsuppopup.jinja2 @@ -207,8 +207,7 @@ th { ' + rowhtml + ''); for(var gstin in result["gstin"]){ - var gstinstr = result["gstin"][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:eq(0)').val(gstinstr.substring(0, 2)); $('#gstintable tbody tr:last td:eq(1) input:eq(1)').val(gstinstr.substring(2, 12)); @@ -312,7 +312,7 @@ $(document).ready(function() { $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { var curindex = $(this).closest('tr').index(); - gstinstring = $(".statecode").val() + $(".panno").val() + $(".gstin").val(); + 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(); @@ -452,7 +452,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() { $("#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 = $(".statecode").val() + $(".panno").val() + $(".gstin").val(); + 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(); -- GitLab From 2b6616a6c946591803a162ee796f6cf836dca878 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Mon, 30 Oct 2017 11:19:34 +0530 Subject: [PATCH 064/121] said bug is removed from add customer/Supplier. --- gkwebapp/static/js/addcustomersupplier.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index 1efa924a..746ca1aa 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -185,7 +185,7 @@ $("#add_state").keydown(function(event) { $('#gstintable tbody tr:eq('+curindex+') td:eq(1) input:eq(2)').focus().select(); }); return false; - } + } } }); @@ -198,15 +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) { - + 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); -- GitLab From 616660be3015ddc3a2ee61f706b414ec04feb2ac Mon Sep 17 00:00:00 2001 From: reshma1 Date: Mon, 30 Oct 2017 12:42:29 +0530 Subject: [PATCH 065/121] Bug is removed from Customer/Supplier. --- gkwebapp/static/js/createcustsuppopup.js | 17 ++++++++++++++--- gkwebapp/static/js/editcustomersupplier.js | 13 ++++++++++++- gkwebapp/templates/createcustsuppopup.jinja2 | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gkwebapp/static/js/createcustsuppopup.js b/gkwebapp/static/js/createcustsuppopup.js index bddb1d8b..e33a20c1 100644 --- a/gkwebapp/static/js/createcustsuppopup.js +++ b/gkwebapp/static/js/createcustsuppopup.js @@ -179,13 +179,24 @@ $(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) { $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); diff --git a/gkwebapp/static/js/editcustomersupplier.js b/gkwebapp/static/js/editcustomersupplier.js index 1614ec73..4f6ffba6 100644 --- a/gkwebapp/static/js/editcustomersupplier.js +++ b/gkwebapp/static/js/editcustomersupplier.js @@ -338,7 +338,18 @@ $(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) { $('#gstintable tbody').append(''+$(this).closest('tr').html()+''); diff --git a/gkwebapp/templates/createcustsuppopup.jinja2 b/gkwebapp/templates/createcustsuppopup.jinja2 index 45552b03..3c8a285c 100644 --- a/gkwebapp/templates/createcustsuppopup.jinja2 +++ b/gkwebapp/templates/createcustsuppopup.jinja2 @@ -110,7 +110,7 @@ th { {% trans %}Please select a state.{% endtrans %} -
{% trans %}State{% endtrans %}{% trans %}GSTIN{% endtrans %}
-
{% trans %}State{% endtrans %}{% trans %}GSTIN{% endtrans %}
+ - - + + +
+
+ + + + +
+
-
- +
-- GitLab From a067529e7c39279c6ec40cfb5d930fa5ab395128 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Sat, 28 Oct 2017 14:25:35 +0530 Subject: [PATCH 062/121] Change event is written for GSTIN state. --- gkwebapp/static/js/createcustsuppopup.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gkwebapp/static/js/createcustsuppopup.js b/gkwebapp/static/js/createcustsuppopup.js index c1d1c24f..f3c020eb 100644 --- a/gkwebapp/static/js/createcustsuppopup.js +++ b/gkwebapp/static/js/createcustsuppopup.js @@ -117,6 +117,24 @@ $("#add_state").keydown(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 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:second').prop("disabled",false); + } + + }); + $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { var curindex = $(this).closest('tr').index(); var gstin = $(this).val(); -- GitLab From c57a3df09003e13b4daa287539e9cfe218d7d806 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Sat, 28 Oct 2017 15:33:56 +0530 Subject: [PATCH 063/121] GSTIN validation is done on Customer/Supplier. --- gkwebapp/static/js/addcustomersupplier.js | 4 +- gkwebapp/static/js/createcustsuppopup.js | 83 +++++++++++++--------- gkwebapp/static/js/editcustomersupplier.js | 6 +- 3 files changed, 56 insertions(+), 37 deletions(-) diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index 394490a5..1efa924a 100644 --- a/gkwebapp/static/js/addcustomersupplier.js +++ b/gkwebapp/static/js/addcustomersupplier.js @@ -176,7 +176,7 @@ $("#add_state").keydown(function(event) { $(document).off("focusout",".gstin").on("focusout",".gstin",function(event) { var curindex = $(this).closest('tr').index(); - gstinstring = $(".statecode").val() + $(".panno").val() + $(".gstin").val(); + 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(); @@ -421,7 +421,7 @@ if($("#vatorgstflag").val() == '22'){ $("#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 = $(".statecode").val() + $(".panno").val() + $(".gstin").val(); + 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(); diff --git a/gkwebapp/static/js/createcustsuppopup.js b/gkwebapp/static/js/createcustsuppopup.js index f3c020eb..bddb1d8b 100644 --- a/gkwebapp/static/js/createcustsuppopup.js +++ b/gkwebapp/static/js/createcustsuppopup.js @@ -29,6 +29,7 @@ Contributors: $(document).ready(function() { $("#add_cussup_name").focus(); + var gstinstring = ""; $("#add_cussup_name").keydown(function(event) { if (event.which==13) { @@ -135,20 +136,41 @@ $("#add_state").keydown(function(event) { }); + //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("focusout",".gstin").on("focusout",".gstin",function(event) { - var curindex = $(this).closest('tr').index(); - var gstin = $(this).val(); - if(gstin != '') { - 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; + 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) @@ -194,7 +216,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(); @@ -378,27 +400,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()); - if(gstin != '') { - 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/editcustomersupplier.js b/gkwebapp/static/js/editcustomersupplier.js index 2717ed5d..1614ec73 100644 --- a/gkwebapp/static/js/editcustomersupplier.js +++ b/gkwebapp/static/js/editcustomersupplier.js @@ -49,7 +49,7 @@ $(document).ready(function() { $('#gstintable tbody').empty(); $('#gstintable tbody').append('
@@ -38,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%} -- GitLab From 65df1ecb729a079add242914b6790ae6003abbe7 Mon Sep 17 00:00:00 2001 From: nitesh Date: Mon, 30 Oct 2017 14:24:26 +0530 Subject: [PATCH 067/121] Sequence is changed for Administration Menu. --- gkwebapp/templates/mainshell.jinja2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gkwebapp/templates/mainshell.jinja2 b/gkwebapp/templates/mainshell.jinja2 index 37869063..7cec29a7 100755 --- a/gkwebapp/templates/mainshell.jinja2 +++ b/gkwebapp/templates/mainshell.jinja2 @@ -117,8 +117,9 @@
  • {% trans %}Close Books/Roll Over{% endtrans %}
  • {% trans %}Organisation Preferences{% endtrans %}
  • {% trans %}Export Data{% endtrans %}
  • +
  • {% trans %}Import Data{% endtrans %}
  • {% trans %}Delete Organisation{% endtrans %}
  • -
  • {% trans %}Import Data{% endtrans %}
  • +
  • {% trans %}Consolidated Final Accounts{% endtrans %}
  • {% trans %}Profit & Loss{% endtrans %}
  • {% trans %}List of Accounts{% endtrans %}
  • -
  • {% trans %}List of Deleted Vouchers{% endtrans %}
  • -
  • List of Users
  • +
  • {% trans %}List of Deleted Vouchers{% endtrans %}
  • +
  • List of Users
  • {% trans %}Registers{% endtrans %}
  • {% trans %}Product Report{% endtrans %}
  • {% trans %}Stock on Hand Report{% endtrans %}
  • -- GitLab From 2efeef8d353481f7a74dfe3387ce98e8d475a82d Mon Sep 17 00:00:00 2001 From: abhijith Date: Wed, 1 Nov 2017 14:16:34 +0530 Subject: [PATCH 073/121] View Sale and Purchase Invoices have seperate tabs --- gkwebapp/static/js/editinvoice.js | 2 +- gkwebapp/static/js/invoice.js | 24 ++++++++- gkwebapp/templates/invoice.jinja2 | 4 +- .../templates/viewinvoices_purchase.jinja2 | 53 +++++++++++++++++++ ...nvoice.jinja2 => viewinvoices_sale.jinja2} | 2 +- gkwebapp/views/invoice.py | 11 ++-- 6 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 gkwebapp/templates/viewinvoices_purchase.jinja2 rename gkwebapp/templates/{editinvoice.jinja2 => viewinvoices_sale.jinja2} (98%) diff --git a/gkwebapp/static/js/editinvoice.js b/gkwebapp/static/js/editinvoice.js index 3c8131d6..96a330c8 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/invoice.js b/gkwebapp/static/js/invoice.js index 8f51b359..87af200a 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/templates/invoice.jinja2 b/gkwebapp/templates/invoice.jinja2 index 249ab70a..7d30b953 100644 --- a/gkwebapp/templates/invoice.jinja2 +++ b/gkwebapp/templates/invoice.jinja2 @@ -70,8 +70,8 @@
    diff --git a/gkwebapp/templates/viewinvoices_purchase.jinja2 b/gkwebapp/templates/viewinvoices_purchase.jinja2 new file mode 100644 index 00000000..063bde23 --- /dev/null +++ b/gkwebapp/templates/viewinvoices_purchase.jinja2 @@ -0,0 +1,53 @@ + +{% trans %}GNUKhata{% endtrans %} | {% trans %}INVOICE{% endtrans %} + +
    +
    +
    +
    +
    + + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + diff --git a/gkwebapp/templates/editinvoice.jinja2 b/gkwebapp/templates/viewinvoices_sale.jinja2 similarity index 98% rename from gkwebapp/templates/editinvoice.jinja2 rename to gkwebapp/templates/viewinvoices_sale.jinja2 index 9f345808..30162bf4 100644 --- a/gkwebapp/templates/editinvoice.jinja2 +++ b/gkwebapp/templates/viewinvoices_sale.jinja2 @@ -6,7 +6,7 @@
    - +
    - + diff --git a/gkwebapp/templates/editproductspecsvat.jinja2 b/gkwebapp/templates/editproductspecsvat.jinja2 index c7ce6b81..2288de3f 100644 --- a/gkwebapp/templates/editproductspecsvat.jinja2 +++ b/gkwebapp/templates/editproductspecsvat.jinja2 @@ -284,7 +284,7 @@ - + -- GitLab From 6d502a9ef45a0f85d1c9453476ce0d7488d91e42 Mon Sep 17 00:00:00 2001 From: abhijith Date: Fri, 3 Nov 2017 10:39:23 +0530 Subject: [PATCH 075/121] Changed labels of Tax Table --- gkwebapp/templates/editproductspecs.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gkwebapp/templates/editproductspecs.jinja2 b/gkwebapp/templates/editproductspecs.jinja2 index c5f1176e..3e0c8f7e 100644 --- a/gkwebapp/templates/editproductspecs.jinja2 +++ b/gkwebapp/templates/editproductspecs.jinja2 @@ -136,7 +136,7 @@ - {% endfor %} - -
    {% trans %}Godown{% endtrans %}{% trans %}Opening Stock{% endtrans %}{% trans %}Opening Stock{% endtrans %}
    {% trans %}Godown{% endtrans %}{% trans %}Opening Stock{% endtrans %}{% trans %}Opening Stock{% endtrans %}
    +
    -- GitLab From 696bd0287f0d6e38610f07993cf2503fb9444123 Mon Sep 17 00:00:00 2001 From: abhijith Date: Mon, 6 Nov 2017 12:05:10 +0530 Subject: [PATCH 077/121] Multiple account issue resolved --- gkwebapp/views/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gkwebapp/views/account.py b/gkwebapp/views/account.py index ecbe5432..800f61c9 100644 --- a/gkwebapp/views/account.py +++ b/gkwebapp/views/account.py @@ -269,8 +269,8 @@ def addmultiaccount(request): gkdata["openingbal"]=acc["openbal"] result = requests.post("http://127.0.0.1:6543/accounts", data =json.dumps(gkdata),headers=header) if result.json()["gkstatus"] == 0: - gkdata = {"activity":acc["accountname"] + " account created"} - resultlog = requests.post("http://127.0.0.1:6543/log", data =json.dumps(gkdata),headers=header) + gkdata2 = {"activity":acc["accountname"] + " account created"} + resultlog = requests.post("http://127.0.0.1:6543/log", data =json.dumps(gkdata2),headers=header) return {"gkstatus":result.json()["gkstatus"]} -- GitLab From b7bba3a82a33a74762f1eb6ab879d80e6d967998 Mon Sep 17 00:00:00 2001 From: nitesh Date: Tue, 31 Oct 2017 17:55:52 +0530 Subject: [PATCH 078/121] Godown in charge can only view stock on hand report of godown which they have assigned. --- gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 | 2 +- gkwebapp/templates/viewstockonhandreport.jinja2 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 index 12ac2231..3c2a82f7 100644 --- a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 +++ b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 @@ -81,7 +81,7 @@
    {%else%} @@ -101,10 +101,10 @@
    -- GitLab From 785e00b1fe8cc71f49bee0dfeac75c2d0eff665d Mon Sep 17 00:00:00 2001 From: nitesh Date: Wed, 1 Nov 2017 12:42:05 +0530 Subject: [PATCH 079/121] If none of the product is exits then there will be message "No Products Found". --- .../templates/viewstockonhandreport.jinja2 | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/gkwebapp/templates/viewstockonhandreport.jinja2 b/gkwebapp/templates/viewstockonhandreport.jinja2 index e41ffe91..996fe080 100644 --- a/gkwebapp/templates/viewstockonhandreport.jinja2 +++ b/gkwebapp/templates/viewstockonhandreport.jinja2 @@ -43,15 +43,28 @@ +
    + {% if not gkresult %} +
    + +
    + +
    + {% else %} +
    + {% if userrole != 3 %} + + {% endif %} + +
    @@ -85,9 +98,7 @@ {% for gods in godown %} - {% endfor %} -
    {%else%} @@ -120,6 +131,7 @@
    + {%endif%} -- GitLab From c5b6361587374daee44517cfeab9fc5998f0de9f Mon Sep 17 00:00:00 2001 From: nitesh Date: Wed, 1 Nov 2017 14:10:41 +0530 Subject: [PATCH 080/121] Now Enter Event is working on year in stock on hand report. --- gkwebapp/static/js/viewstockonhandreport.js | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/gkwebapp/static/js/viewstockonhandreport.js b/gkwebapp/static/js/viewstockonhandreport.js index 57a9f26c..6ec54e25 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 @@ -148,8 +148,14 @@ $(document).ready(function() { { $('#viewstock_submit').focus().click(); } - else { - $("#godownflag").focus().select(); + else { + if($("#godownflag").is (":visible")){ + + $("#godownflag").focus().select(); + } + else{ + $("#editgoddet").focus(); + } } } @@ -204,7 +210,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 +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; } -- GitLab From 971e1765b62658ff06e58d04502f1baa3c6c32f4 Mon Sep 17 00:00:00 2001 From: nitesh Date: Wed, 1 Nov 2017 17:58:20 +0530 Subject: [PATCH 081/121] changes in categorywisestockonhand report. --- .../js/viewcategorywisestockonhandreport.js | 17 ++++++- gkwebapp/static/js/viewstockonhandreport.js | 8 ++-- .../viewcategorywisestockonhandreport.jinja2 | 10 +++++ .../templates/viewstockonhandreport.jinja2 | 45 ++++++++++--------- 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/gkwebapp/static/js/viewcategorywisestockonhandreport.js b/gkwebapp/static/js/viewcategorywisestockonhandreport.js index 5ebbdbf4..81b90b27 100644 --- a/gkwebapp/static/js/viewcategorywisestockonhandreport.js +++ b/gkwebapp/static/js/viewcategorywisestockonhandreport.js @@ -255,8 +255,21 @@ $(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{ + $("#editgoddet").focus(); + } + } } if(e.which==38){ e.preventDefault(); diff --git a/gkwebapp/static/js/viewstockonhandreport.js b/gkwebapp/static/js/viewstockonhandreport.js index 6ec54e25..c89818b9 100644 --- a/gkwebapp/static/js/viewstockonhandreport.js +++ b/gkwebapp/static/js/viewstockonhandreport.js @@ -193,15 +193,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; } @@ -275,7 +275,7 @@ $(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){ diff --git a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 index 3c2a82f7..6bfc2eac 100644 --- a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 +++ b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 @@ -38,6 +38,15 @@ + +
    + {% if not gkresult %} +
    + +
    + +
    + {% else %}
    -
    @@ -78,30 +77,34 @@
    -
    + {% if not godown %} - - + + + {% else %} +
    + {% if userrole == 3 %} +
    + + + +
    +
    + + {#{% if godown|length > 1 %}#} + + {#{% else %}#} + {##} + {#{% endif %}#} +
    {% else %} -
    - {% if userrole == 3 %} -
    - - - -
    -
    - - -
    - {%else%}
    -- GitLab From cffcb3cef0c1142621c8df7f584075455aca2630 Mon Sep 17 00:00:00 2001 From: nitesh Date: Thu, 2 Nov 2017 12:44:04 +0530 Subject: [PATCH 082/121] changes in viewstockonhand report, to get data if we have single godown. --- gkwebapp/static/js/viewstockonhandreport.js | 23 ++++++++++++++----- .../viewcategorywisestockonhandreport.jinja2 | 2 +- .../templates/viewstockonhandreport.jinja2 | 8 +++---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/gkwebapp/static/js/viewstockonhandreport.js b/gkwebapp/static/js/viewstockonhandreport.js index c89818b9..a80eb870 100644 --- a/gkwebapp/static/js/viewstockonhandreport.js +++ b/gkwebapp/static/js/viewstockonhandreport.js @@ -65,6 +65,10 @@ $(document).ready(function() { return str } } + + + + // function to toggle godown option depending on check box. @@ -196,7 +200,7 @@ $(document).ready(function() { $('#viewstock_productname').focus(); return false; } - if ($("#editgoddet").val()==null && $("#godownflag").val()==1 /*&& $("#godwn").data("data-value") !=null*/){ + 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(); @@ -279,21 +283,28 @@ $(document).ready(function() { 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 = {"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/templates/viewcategorywisestockonhandreport.jinja2 b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 index 6bfc2eac..03ee01d5 100644 --- a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 +++ b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 @@ -42,7 +42,7 @@
    {% if not gkresult %}
    - +
    diff --git a/gkwebapp/templates/viewstockonhandreport.jinja2 b/gkwebapp/templates/viewstockonhandreport.jinja2 index c5993243..74afe777 100644 --- a/gkwebapp/templates/viewstockonhandreport.jinja2 +++ b/gkwebapp/templates/viewstockonhandreport.jinja2 @@ -93,16 +93,16 @@
    - {#{% if godown|length > 1 %}#} + {% if godown|length > 1 %} - {#{% else %}#} - {##} - {#{% endif %}#} + {% else %} + + {% endif %}
    {% else %}
    -- GitLab From 9b394c31ca46ca4fe7f70722f30957cf65bdb9ca Mon Sep 17 00:00:00 2001 From: nitesh Date: Fri, 3 Nov 2017 19:29:22 +0530 Subject: [PATCH 083/121] Pressing enter from toyear in view stock on hand report triggered view button in only one godown is selected. --- gkwebapp/static/js/viewstockonhandreport.js | 9 +++++++-- gkwebapp/templates/viewstockonhandreport.jinja2 | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gkwebapp/static/js/viewstockonhandreport.js b/gkwebapp/static/js/viewstockonhandreport.js index a80eb870..fc2938b1 100644 --- a/gkwebapp/static/js/viewstockonhandreport.js +++ b/gkwebapp/static/js/viewstockonhandreport.js @@ -148,7 +148,7 @@ $(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(); } @@ -158,7 +158,12 @@ $(document).ready(function() { $("#godownflag").focus().select(); } else{ - $("#editgoddet").focus(); + if($("#editgoddet").length>0){ //if there is no select box then view button is triggered. + $("#editgoddet").focus(); + } + else{ + $('#viewstock_submit').focus().click(); + } } } diff --git a/gkwebapp/templates/viewstockonhandreport.jinja2 b/gkwebapp/templates/viewstockonhandreport.jinja2 index 74afe777..5d29f598 100644 --- a/gkwebapp/templates/viewstockonhandreport.jinja2 +++ b/gkwebapp/templates/viewstockonhandreport.jinja2 @@ -67,7 +67,7 @@
    - +
    @@ -101,6 +101,7 @@ {% endfor %} {% else %} +
    {% endif %}
    @@ -116,7 +117,6 @@ {% for gods in godown %} - {% endfor %} -- GitLab From 3aee109a3963d816344ce920cf850fae2e2d70d1 Mon Sep 17 00:00:00 2001 From: nitesh Date: Sat, 4 Nov 2017 12:33:56 +0530 Subject: [PATCH 084/121] Now stock on hand report and categorywise stock on hand report working properly. --- .../js/viewcategorywisestockonhandreport.js | 19 ++++++++++++++++--- .../viewcategorywisestockonhandreport.jinja2 | 13 ++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/gkwebapp/static/js/viewcategorywisestockonhandreport.js b/gkwebapp/static/js/viewcategorywisestockonhandreport.js index 81b90b27..59171a36 100644 --- a/gkwebapp/static/js/viewcategorywisestockonhandreport.js +++ b/gkwebapp/static/js/viewcategorywisestockonhandreport.js @@ -267,7 +267,12 @@ $(document).ready(function() { $("#godownflag").focus().select(); } else{ - $("#editgoddet").focus(); + if($("#editgoddet").length>0){ + $("#editgoddet").focus(); + } + else{ + $('#viewstock_submit').focus().click(); + } } } } @@ -346,9 +351,17 @@ $(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')}; } + 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/templates/viewcategorywisestockonhandreport.jinja2 b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 index 03ee01d5..c223e6cd 100644 --- a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 +++ b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 @@ -89,13 +89,16 @@
    - {% for gods in godown %} - - + {% endfor %} - + + {% else %} +
    + + {% endif %}
    {%else%}
    -- GitLab From c37c5b50fd305818387ee5579ffd674d07194068 Mon Sep 17 00:00:00 2001 From: nitesh Date: Sat, 4 Nov 2017 13:04:47 +0530 Subject: [PATCH 085/121] Comment is added. --- gkwebapp/static/js/viewcategorywisestockonhandreport.js | 3 ++- gkwebapp/static/js/viewstockonhandreport.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gkwebapp/static/js/viewcategorywisestockonhandreport.js b/gkwebapp/static/js/viewcategorywisestockonhandreport.js index 59171a36..95a54586 100644 --- a/gkwebapp/static/js/viewcategorywisestockonhandreport.js +++ b/gkwebapp/static/js/viewcategorywisestockonhandreport.js @@ -355,7 +355,8 @@ $(document).ready(function() { 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')}; } - else{ + // 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')}; } } diff --git a/gkwebapp/static/js/viewstockonhandreport.js b/gkwebapp/static/js/viewstockonhandreport.js index fc2938b1..3b43e7f3 100644 --- a/gkwebapp/static/js/viewstockonhandreport.js +++ b/gkwebapp/static/js/viewstockonhandreport.js @@ -306,7 +306,9 @@ $(document).ready(function() { 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 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')}; } } -- GitLab From a575d2c3e43010ffc86b299cae2a019dff296b1e Mon Sep 17 00:00:00 2001 From: Nitesh Date: Wed, 8 Nov 2017 16:54:14 +0530 Subject: [PATCH 086/121] In product report no product is avail then give massage "No Product Found". --- .../templates/viewcategorywisestockonhandreport.jinja2 | 1 - gkwebapp/templates/viewstockonhandreport.jinja2 | 1 - gkwebapp/templates/viewstockreport.jinja2 | 9 +++++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 index c223e6cd..f6c2e8ee 100644 --- a/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 +++ b/gkwebapp/templates/viewcategorywisestockonhandreport.jinja2 @@ -96,7 +96,6 @@ {% endfor %} {% else %} -
    {% endif %}
    diff --git a/gkwebapp/templates/viewstockonhandreport.jinja2 b/gkwebapp/templates/viewstockonhandreport.jinja2 index 5d29f598..b2d5f84a 100644 --- a/gkwebapp/templates/viewstockonhandreport.jinja2 +++ b/gkwebapp/templates/viewstockonhandreport.jinja2 @@ -101,7 +101,6 @@ {% endfor %} {% else %} -
    {% endif %}
    diff --git a/gkwebapp/templates/viewstockreport.jinja2 b/gkwebapp/templates/viewstockreport.jinja2 index 160026d0..234a4a02 100644 --- a/gkwebapp/templates/viewstockreport.jinja2 +++ b/gkwebapp/templates/viewstockreport.jinja2 @@ -38,6 +38,14 @@
    + +
    + {% if not gkresult %} +
    + +
    +
    + {% else %}
    +
    -
    {% if not gkresult["category"] %} @@ -83,6 +87,7 @@ + {% if userrole|int != 3 %}
    + {% endif %}
    {% if not godown %} @@ -280,8 +286,10 @@
    - + {% if userrole|int != 3 %} +
    + {% endif %}
    diff --git a/gkwebapp/templates/editproduct.jinja2 b/gkwebapp/templates/editproduct.jinja2 index 1164402f..96dfccf8 100644 --- a/gkwebapp/templates/editproduct.jinja2 +++ b/gkwebapp/templates/editproduct.jinja2 @@ -1,46 +1,46 @@ - -
    + +
    -
    -
    -
    +
    + +
    -
    +
    -
    - - -
    +
    + + +
    -
    -
    -
    +
    +
    +
    -
    - +
    +
    -
    +
    -
    -
    -
    - - - - - - - - - - - - - - - - - + + +
    {% 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 %} diff --git a/gkwebapp/views/product.py b/gkwebapp/views/product.py index 61c522e4..8b27ceba 100644 --- a/gkwebapp/views/product.py +++ b/gkwebapp/views/product.py @@ -63,7 +63,8 @@ def addproducttab(request): result2 = requests.get("http://127.0.0.1:6543/godown", headers=header) resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) states = requests.get("http://127.0.0.1:6543/state", headers=header) - return{"gkresult":{"category":result.json()["gkresult"],"uom":result1.json()["gkresult"]},"godown":result2.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} + userrole = requests.get("http://127.0.0.1:6543/user?type=role", headers=header) + return{"gkresult":{"category":result.json()["gkresult"],"uom":result1.json()["gkresult"]},"godown":result2.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"], "userrole": userrole.json()["gkresult"]} @view_config(route_name="product",request_param="type=specs", renderer="gkwebapp:templates/addproductspecs.jinja2") def getcatspecs(request): @@ -277,7 +278,8 @@ def editproducttab(request): header={"gktoken":request.headers["gktoken"]} result = requests.get("http://127.0.0.1:6543/products",headers=header) resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) - return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"]} + userrole = requests.get("http://127.0.0.1:6543/user?type=role", headers=header) + return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "userrole":userrole.json()["gkresult"]} @view_config(route_name="product",request_param="type=edittabvat", renderer="gkwebapp:templates/editproductvat.jinja2") def editProductTabVat(request): @@ -293,6 +295,7 @@ def productdetails(request): prodspecs={} result = requests.get("http://127.0.0.1:6543/products?qty=single&productcode=%d"%(int(request.params['productcode'])),headers=header) resultgstvat = requests.get("http://127.0.0.1:6543/products?tax=vatorgst",headers=header) + userrole = requests.get("http://127.0.0.1:6543/user?type=role", headers=header) states = requests.get("http://127.0.0.1:6543/state", headers=header) if result.json()["gkresult"]["gsflag"]==7: @@ -305,7 +308,7 @@ def productdetails(request): result3 = requests.get("http://127.0.0.1:6543/categories", headers=header) result4 = requests.get("http://127.0.0.1:6543/godown", headers=header) numberofgodowns = int(result.json()["numberofgodowns"]) - return{"proddesc":result.json()["gkresult"],"prodspecs":prodspecs,"uom":result2.json()["gkresult"],"category":result3.json()["gkresult"],"godown":result4.json()["gkresult"],"numberofgodowns":numberofgodowns,"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} + return{"proddesc":result.json()["gkresult"],"prodspecs":prodspecs,"uom":result2.json()["gkresult"],"category":result3.json()["gkresult"],"godown":result4.json()["gkresult"],"numberofgodowns":numberofgodowns,"gkstatus":result.json()["gkstatus"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"], "userrole": userrole.json()["gkresult"]} else: return{"proddesc":result.json()["gkresult"],"vatorgstflag":resultgstvat.json()["gkresult"], "states": states.json()["gkresult"]} -- GitLab From 36a66325a006e320ea11c159b978924989a49788 Mon Sep 17 00:00:00 2001 From: abhijith Date: Thu, 9 Nov 2017 07:36:49 +0530 Subject: [PATCH 090/121] Tax table and add godown button are hidden for godown keeper in VAT organisation also --- gkwebapp/static/js/addproductvat.js | 7 +- gkwebapp/static/js/editproductvat.js | 18 +- gkwebapp/templates/addproductvat.jinja2 | 122 ++++++------ gkwebapp/templates/editproductspecsvat.jinja2 | 184 +++++++++--------- gkwebapp/templates/editproductvat.jinja2 | 42 ++-- gkwebapp/views/product.py | 9 +- 6 files changed, 202 insertions(+), 180 deletions(-) diff --git a/gkwebapp/static/js/addproductvat.js b/gkwebapp/static/js/addproductvat.js index 8dbe8a41..9ca1382c 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/editproductvat.js b/gkwebapp/static/js/editproductvat.js index b5433d79..3448a6e2 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/templates/addproductvat.jinja2 b/gkwebapp/templates/addproductvat.jinja2 index c139b6ea..aee7391a 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 @@ -
    +
    +
    - -
    + {% endif %}
    + {% 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 %} diff --git a/gkwebapp/templates/editproductvat.jinja2 b/gkwebapp/templates/editproductvat.jinja2 index a7c29269..12110f87 100644 --- a/gkwebapp/templates/editproductvat.jinja2 +++ b/gkwebapp/templates/editproductvat.jinja2 @@ -1,32 +1,32 @@ -
    +
    -
    -
    -
    +
    + +
    -
    +
    -
    - - -
    +
    + + +
    -
    -
    -
    +
    +
    +
    -
    - +
    +
    -
    +
    -- GitLab From d07f206aeff563d3d62f6fa461e42edcac75bf62 Mon Sep 17 00:00:00 2001 From: nitesh Date: Sun, 5 Nov 2017 18:43:26 +0530 Subject: [PATCH 093/121] Now if we select reversecharge "yes" then only display reversecharge. --- gkwebapp/static/js/addinvoice.js | 12 ++++++++++-- gkwebapp/templates/printinvoice.jinja2 | 2 +- gkwebapp/templates/viewsingleinvoice.jinja2 | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index 857e8d7c..8e6e71c5 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -2213,7 +2213,7 @@ if (event.which == 13) { calculategstaxamt(i); 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(); + productcreverseode = $("#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; @@ -2278,7 +2278,15 @@ 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++) { diff --git a/gkwebapp/templates/printinvoice.jinja2 b/gkwebapp/templates/printinvoice.jinja2 index f1eb9eb4..c6691425 100644 --- a/gkwebapp/templates/printinvoice.jinja2 +++ b/gkwebapp/templates/printinvoice.jinja2 @@ -479,7 +479,7 @@ - {% if gkresult["reversecharge"] %}{{ gkresult["reversecharge"] }}{% else %}N/A{% endif %} + {% if gkresult["reversecharge"]|int == 1 %}Y{% endif %} diff --git a/gkwebapp/templates/viewsingleinvoice.jinja2 b/gkwebapp/templates/viewsingleinvoice.jinja2 index d539158b..f3592e77 100644 --- a/gkwebapp/templates/viewsingleinvoice.jinja2 +++ b/gkwebapp/templates/viewsingleinvoice.jinja2 @@ -379,10 +379,12 @@ {% if gkresult["transportationmode"] %}{{ gkresult["transportationmode"] }}{% else %}N/A{% endif %}
    - + {% if gkresult["vehicleno"] %} + + {% endif %}
    @@ -391,11 +393,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 %}
    -- GitLab From 815ea2b447aed0bb86e5fe6f22500ab0f8b84960 Mon Sep 17 00:00:00 2001 From: Nitesh Date: Wed, 8 Nov 2017 19:25:42 +0530 Subject: [PATCH 094/121] Write event to radio buttons or save button in invoice --- gkwebapp/static/js/addinvoice.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gkwebapp/static/js/addinvoice.js b/gkwebapp/static/js/addinvoice.js index 8e6e71c5..cadf1aed 100644 --- a/gkwebapp/static/js/addinvoice.js +++ b/gkwebapp/static/js/addinvoice.js @@ -1855,7 +1855,7 @@ if (event.which == 13) { f[nextIndex].focus(); } else if (nextIndex == n) { - $("#rev2radio").focus().click(); + $("#invoice_save").focus().click(); } } else if (event.which == 38) { @@ -1885,6 +1885,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') { @@ -2213,7 +2220,7 @@ if (event.which == 13) { calculategstaxamt(i); productqtys.push(parseFloat($("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(2) input").val())); let obj = {}; - productcreverseode = $("#invoice_product_table_gst tbody tr:eq(" + i + ") td:eq(0) select option:selected").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; -- GitLab From d713e25409043d94cdff40e0bf739cb57321f648 Mon Sep 17 00:00:00 2001 From: Nitesh Date: Fri, 10 Nov 2017 13:27:37 +0530 Subject: [PATCH 095/121] Remove reverse charge field in sales invoice print. --- gkwebapp/templates/addinvoice.jinja2 | 6 +++--- gkwebapp/templates/printinvoice.jinja2 | 10 ++-------- gkwebapp/templates/viewsingleinvoice.jinja2 | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 32795a5b..d6f5f7fa 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -515,10 +515,10 @@ {% endif %} -
    +
    - - + +
    diff --git a/gkwebapp/templates/printinvoice.jinja2 b/gkwebapp/templates/printinvoice.jinja2 index c6691425..5a0d3f69 100644 --- a/gkwebapp/templates/printinvoice.jinja2 +++ b/gkwebapp/templates/printinvoice.jinja2 @@ -402,8 +402,8 @@
    {% endif %}
    - - + +


    @@ -475,12 +475,6 @@ {% if gkresult["dateofsupply"] %}{{ gkresult["dateofsupply"] }}{% else %}N/A{% endif %} - - - - - {% if gkresult["reversecharge"]|int == 1 %}Y{% endif %} - diff --git a/gkwebapp/templates/viewsingleinvoice.jinja2 b/gkwebapp/templates/viewsingleinvoice.jinja2 index f3592e77..d9d2efef 100644 --- a/gkwebapp/templates/viewsingleinvoice.jinja2 +++ b/gkwebapp/templates/viewsingleinvoice.jinja2 @@ -342,10 +342,10 @@
    {% endif %} -
    +
    - - + +
    -- GitLab From 7e7cd3c8f1a19dde79bd759a45d048161f25ba47 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Fri, 10 Nov 2017 13:34:18 +0530 Subject: [PATCH 096/121] headers also right alligned and max-width of table is 100% --- gkwebapp/templates/registerreport.jinja2 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gkwebapp/templates/registerreport.jinja2 b/gkwebapp/templates/registerreport.jinja2 index 32797800..9d9527eb 100644 --- a/gkwebapp/templates/registerreport.jinja2 +++ b/gkwebapp/templates/registerreport.jinja2 @@ -37,7 +37,8 @@ } .registertablecss{ overflow-y:scroll; - overflow-x:scroll; + overflow-x:scroll; + max-height:100%; } .ralign{ text-align:right; @@ -92,13 +93,13 @@ {% trans %}Suppl TIN{% endtrans %} {% trans %}Suppl GSTIN{% endtrans %} {% endif %} - {% trans %}Gross Amt{% endtrans %} - {% trans %}TAX Free{% endtrans %} + {% trans %}Gross Amt{% endtrans %} + {% trans %}TAX Free{% endtrans %} {% for tax in taxcolumns %} - {% trans %}Net @ {{tax}}%{% endtrans %} + {% trans %}Net @ {{tax}}%{% endtrans %} {% endfor %} {% for tax in taxcolumns %} - {% trans %}{{tax}}% TAX{% endtrans %} + {% trans %}{{tax}}% TAX{% endtrans %} {% endfor %} @@ -152,7 +153,7 @@ {% endfor %} - + Total -- GitLab From fa222b2132e961530c2f2d7fb3346124c576d612 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Fri, 10 Nov 2017 13:35:37 +0530 Subject: [PATCH 097/121] removed print statements --- gkwebapp/views/invoice.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gkwebapp/views/invoice.py b/gkwebapp/views/invoice.py index 3316824a..0c477fac 100644 --- a/gkwebapp/views/invoice.py +++ b/gkwebapp/views/invoice.py @@ -224,8 +224,7 @@ def showregisterreport(request): header={"gktoken":request.headers["gktoken"]} result = requests.get("http://127.0.0.1:6543/report?type=register&flag=%d&calculatefrom=%s&calculateto=%s"%(int(request.params["flag"]), str(request.params["calculatefrom"]), str(request.params["calculateto"])), headers=header) registerheader = {"flag": request.params["flag"], "calculatefrom": request.params["calculatefrom"], "calculateto": request.params["calculateto"]} - print result.json()["taxcolumns"] - print result.json()["gkresult"] + return {"gkstatus":result.json()["gkstatus"], "gkresult": result.json()["gkresult"], "totalrow": result.json()["totalrow"], "taxcolumns":result.json()["taxcolumns"], "registerheader": registerheader} @view_config(route_name="invoice",request_param="action=listofinvspreadsheet", renderer="") -- GitLab From 0e73b42c491cb39815e359e2ce44a034a4cdffb9 Mon Sep 17 00:00:00 2001 From: Prajkta Patkar Date: Fri, 10 Nov 2017 14:27:26 +0530 Subject: [PATCH 098/121] right align in excel spreadsheet --- gkwebapp/views/invoice.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gkwebapp/views/invoice.py b/gkwebapp/views/invoice.py index 0c477fac..c283ce96 100644 --- a/gkwebapp/views/invoice.py +++ b/gkwebapp/views/invoice.py @@ -360,16 +360,16 @@ def registerspreadsheet(request): sheet.getCell(3,3).stringValue("Suppl. Name").setBold(True) sheet.getCell(4,3).stringValue("Suppl. TIN").setBold(True) sheet.getCell(5,3).stringValue("Suppl. GSTIN").setBold(True) - sheet.getCell(6,3).stringValue("Gross Amt.").setBold(True) - sheet.getCell(7,3).stringValue("TAX Free").setBold(True) + sheet.getCell(6,3).stringValue("Gross Amt.").setBold(True).setAlignHorizontal("right") + sheet.getCell(7,3).stringValue("TAX Free").setBold(True).setAlignHorizontal("right") i = 9 for taxc in taxcolumns: sheet.getColumn(i).setWidth("4cm") - sheet.getCell(i-1,3).stringValue("Net @" + taxc + "%").setBold(True) + sheet.getCell(i-1,3).stringValue("Net @" + taxc + "%").setBold(True).setAlignHorizontal("right") i += 1 for taxc in taxcolumns: sheet.getColumn(i).setWidth("4cm") - sheet.getCell(i-1,3).stringValue(taxc + "% TAX").setBold(True) + sheet.getCell(i-1,3).stringValue(taxc + "% TAX").setBold(True).setAlignHorizontal("right") i += 1 row = 4 for invoice in result: @@ -383,38 +383,38 @@ def registerspreadsheet(request): else: sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue(invoice["grossamount"]) - sheet.getCell(7, row).stringValue(invoice["taxfree"]) + sheet.getCell(6, row).stringValue(invoice["grossamount"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(invoice["taxfree"]).setAlignHorizontal("right") i = 8 for taxc in taxcolumns: if taxc in invoice["tax"]: - sheet.getCell(i,row).stringValue(invoice["tax"][taxc]) + sheet.getCell(i,row).stringValue(invoice["tax"][taxc]).setAlignHorizontal("right") else: - sheet.getCell(i,row).stringValue("0.00") + sheet.getCell(i,row).stringValue("0.00").setAlignHorizontal("right") i += 1 for taxc in taxcolumns: if taxc in invoice["taxamount"]: - sheet.getCell(i,row).stringValue(invoice["taxamount"][taxc]) + sheet.getCell(i,row).stringValue(invoice["taxamount"][taxc]).setAlignHorizontal("right") else: - sheet.getCell(i,row).stringValue("0.00") + sheet.getCell(i,row).stringValue("0.00").setAlignHorizontal("right") i += 1 row += 1 - sheet.getCell(0, row).stringValue("Total").setBold(True) + sheet.getCell(0, row).stringValue("Total").setBold(True).setAlignHorizontal("right") ods.content.mergeCells(0,row,6,1) - sheet.getCell(6, row).stringValue(totalrow["grossamount"]).setBold(True) - sheet.getCell(7, row).stringValue(totalrow["taxfree"]).setBold(True) + sheet.getCell(6, row).stringValue(totalrow["grossamount"]).setBold(True).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(totalrow["taxfree"]).setBold(True).setAlignHorizontal("right") i = 8 for taxc in taxcolumns: if taxc in totalrow["tax"]: - sheet.getCell(i,row).stringValue(totalrow["tax"][taxc]).setBold(True) + sheet.getCell(i,row).stringValue(totalrow["tax"][taxc]).setBold(True).setAlignHorizontal("right") else: - sheet.getCell(i,row).stringValue("0.00").setBold(True) + sheet.getCell(i,row).stringValue("0.00").setBold(True).setAlignHorizontal("right") i += 1 for taxc in taxcolumns: if taxc in totalrow["taxamount"]: - sheet.getCell(i,row).stringValue(totalrow["taxamount"][taxc]).setBold(True) + sheet.getCell(i,row).stringValue(totalrow["taxamount"][taxc]).setBold(True).setAlignHorizontal("right") else: - sheet.getCell(i,row).stringValue("0.00").setBold(True) + sheet.getCell(i,row).stringValue("0.00").setBold(True).setAlignHorizontal("right") i += 1 ods.save("response.ods") -- GitLab From 874b296e6f0fcd9a52832d989a1f8a2316ffd96c Mon Sep 17 00:00:00 2001 From: Nitesh Date: Thu, 9 Nov 2017 17:06:41 +0530 Subject: [PATCH 099/121] Rejection Note is removed from product report. Missing semicolon id added in "showstockreport.js" & "viewstockreport.js". --- gkwebapp/static/js/showstockreport.js | 8 +++--- gkwebapp/static/js/viewstockreport.js | 24 ++++++++--------- gkwebapp/templates/showstockreport.jinja2 | 32 +++++++++++------------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/gkwebapp/static/js/showstockreport.js b/gkwebapp/static/js/showstockreport.js index 29ad432d..706782e6 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/viewstockreport.js b/gkwebapp/static/js/viewstockreport.js index 6c1e7d02..6d75963d 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/showstockreport.jinja2 b/gkwebapp/templates/showstockreport.jinja2 index f904e9e7..a1cad022 100644 --- a/gkwebapp/templates/showstockreport.jinja2 +++ b/gkwebapp/templates/showstockreport.jinja2 @@ -93,13 +93,13 @@ {% trans %}INV No.{% endtrans %} {% if godown != "" %} - + {% trans %}TN No.{% endtrans %} {% endif %} - + {# {% trans %}RN No.{% endtrans %} - + #} {% trans %}Inward{% endtrans %} @@ -131,11 +131,11 @@ {% if godown != "" %} - + {% endif %} - - + {# + #} {{record["inward"]}} @@ -178,9 +178,9 @@ {% if record["trntype"] == "transfer note" %} Transfer Note {% endif %} - {% if record["trntype"] == "Rejection Note" %} + {#{% if record["trntype"] == "Rejection Note" %} Rejection Note - {% endif %} + {% endif %}#} @@ -194,17 +194,17 @@ {% endif %} {% if godown != "" %} - + {% if record["tnno"] != "" %} {{record["tnno"]}} {% endif %} {% endif %} - + {# {% if record["rnno"] != "" %} {{record["rnno"]}} {% endif %} - + #} {{record["inwardqty"]}} @@ -234,11 +234,11 @@ {% if godown != "" %} - + {% endif %} - - + {# + #} {{record["totalinwardqty"]}} @@ -257,9 +257,9 @@ Deli Note No. : Delivery Note Number,   INV No. : Invoice Number,   {% if godown != "" %} - TN No. : Transfer Note Number,   + TN No. : Transfer Note Number {% endif %} - RN No. : Rejection Note Number

    + {#RN No. : Rejection Note Number

    #}
    -- GitLab From b7b7909af90fa66cc1e3e400f3983ae50d1c2625 Mon Sep 17 00:00:00 2001 From: Nitesh Date: Fri, 10 Nov 2017 14:53:16 +0530 Subject: [PATCH 100/121] Removed Rejection Note from Export Spredsheet & Print report in Product Report. --- gkwebapp/templates/printstockreport.jinja2 | 28 +++++----- gkwebapp/views/product.py | 60 +++++++++++----------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gkwebapp/templates/printstockreport.jinja2 b/gkwebapp/templates/printstockreport.jinja2 index ec928cdb..4ab66e6d 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/views/product.py b/gkwebapp/views/product.py index fa89f9fe..12de6461 100644 --- a/gkwebapp/views/product.py +++ b/gkwebapp/views/product.py @@ -530,10 +530,10 @@ def stockreportspreadsheet(request): sheet.getCell(3,4).stringValue("Deli Note No.").setBold(True).setAlignHorizontal("center") sheet.getCell(4,4).stringValue("INV No.").setBold(True).setAlignHorizontal("center") sheet.getCell(5,4).stringValue("TN No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(6,4).stringValue("RN No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(7,4).stringValue("Inward").setBold(True).setAlignHorizontal("right") - sheet.getCell(8,4).stringValue("Outward").setBold(True).setAlignHorizontal("right") - sheet.getCell(9,4).stringValue("Balance").setBold(True).setAlignHorizontal("right") + #sheet.getCell(6,4).stringValue("RN No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(6,4).stringValue("Inward").setBold(True).setAlignHorizontal("right") + sheet.getCell(7,4).stringValue("Outward").setBold(True).setAlignHorizontal("right") + sheet.getCell(8,4).stringValue("Balance").setBold(True).setAlignHorizontal("right") row = 5 for stock in result: if stock["particulars"]=="opening stock" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": @@ -543,10 +543,10 @@ def stockreportspreadsheet(request): sheet.getCell(3, row).stringValue("") sheet.getCell(4, row).stringValue("") sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue("") - sheet.getCell(7, row).stringValue(stock["inward"]).setAlignHorizontal("right") + #sheet.getCell(6, row).stringValue("") + sheet.getCell(6, row).stringValue(stock["inward"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue("") sheet.getCell(8, row).stringValue("") - sheet.getCell(9, row).stringValue("") if stock["particulars"]!="Total" and (stock["dcno"]!="" or stock["invno"]!="" or stock["tnno"]!="" or stock["rnno"] != "") and stock["date"]!="": sheet.getCell(0, row).stringValue(stock["date"]) sheet.getCell(1, row).stringValue(stock["particulars"]) @@ -554,10 +554,10 @@ def stockreportspreadsheet(request): sheet.getCell(3, row).stringValue(stock["dcno"]) sheet.getCell(4, row).stringValue(stock["invno"]) sheet.getCell(5, row).stringValue(stock["tnno"]) - sheet.getCell(6, row).stringValue(stock["rnno"]) - sheet.getCell(7, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") - sheet.getCell(9, row).stringValue(stock["balance"]).setAlignHorizontal("right") + #sheet.getCell(6, row).stringValue(stock["rnno"]) + sheet.getCell(6, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue(stock["balance"]).setAlignHorizontal("right") if stock["particulars"]=="Total" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": sheet.getCell(0, row).stringValue("") sheet.getCell(1, row).stringValue(stock["particulars"]) @@ -565,10 +565,10 @@ def stockreportspreadsheet(request): sheet.getCell(3, row).stringValue("") sheet.getCell(4, row).stringValue("") sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue("") - sheet.getCell(7, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") - sheet.getCell(9, row).stringValue("") + #sheet.getCell(6, row).stringValue("") + sheet.getCell(6, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") + sheet.getCell(8, row).stringValue("") row += 1 else: sheet.getCell(0,0).stringValue(orgname).setBold(True).setAlignHorizontal("center").setFontSize("16pt") @@ -588,10 +588,10 @@ def stockreportspreadsheet(request): sheet.getCell(2,3).stringValue("Document Type").setBold(True).setAlignHorizontal("center") sheet.getCell(3,3).stringValue("Deli Note No.").setBold(True).setAlignHorizontal("center") sheet.getCell(4,3).stringValue("INV No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(5,3).stringValue("RN No.").setBold(True).setAlignHorizontal("center") - sheet.getCell(6,3).stringValue("Inward").setBold(True).setAlignHorizontal("right") - sheet.getCell(7,3).stringValue("Outward").setBold(True).setAlignHorizontal("right") - sheet.getCell(8,3).stringValue("Balance").setBold(True).setAlignHorizontal("right") + #sheet.getCell(5,3).stringValue("RN No.").setBold(True).setAlignHorizontal("center") + sheet.getCell(5,3).stringValue("Inward").setBold(True).setAlignHorizontal("right") + sheet.getCell(6,3).stringValue("Outward").setBold(True).setAlignHorizontal("right") + sheet.getCell(7,3).stringValue("Balance").setBold(True).setAlignHorizontal("right") row = 4 for stock in result: if stock["particulars"]=="opening stock" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": @@ -600,30 +600,30 @@ def stockreportspreadsheet(request): sheet.getCell(2, row).stringValue("") sheet.getCell(3, row).stringValue("") sheet.getCell(4, row).stringValue("") - sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue(stock["inward"]).setAlignHorizontal("right") + #sheet.getCell(5, row).stringValue("") + sheet.getCell(5, row).stringValue(stock["inward"]).setAlignHorizontal("right") + sheet.getCell(6, row).stringValue("") sheet.getCell(7, row).stringValue("") - sheet.getCell(8, row).stringValue("") if stock["particulars"]!="Total" and (stock["dcno"]!="" or stock["invno"]!="" or stock["rnid"] != "") and stock["date"]!="": sheet.getCell(0, row).stringValue(stock["date"]) sheet.getCell(1, row).stringValue(stock["particulars"]) sheet.getCell(2, row).stringValue(stock["trntype"]) sheet.getCell(3, row).stringValue(stock["dcno"]) sheet.getCell(4, row).stringValue(stock["invno"]) - sheet.getCell(5, row).stringValue(stock["rnno"]) - sheet.getCell(6, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") - sheet.getCell(7, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue(stock["balance"]).setAlignHorizontal("right") + #sheet.getCell(5, row).stringValue(stock["rnno"]) + sheet.getCell(5, row).stringValue(stock["inwardqty"]).setAlignHorizontal("right") + sheet.getCell(6, row).stringValue(stock["outwardqty"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue(stock["balance"]).setAlignHorizontal("right") if stock["particulars"]=="Total" and stock["dcno"]=="" and stock["invno"]=="" and stock["date"]=="": sheet.getCell(0, row).stringValue("") sheet.getCell(1, row).stringValue(stock["particulars"]) sheet.getCell(2, row).stringValue("") sheet.getCell(3, row).stringValue("") sheet.getCell(4, row).stringValue("") - sheet.getCell(5, row).stringValue("") - sheet.getCell(6, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") - sheet.getCell(7, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") - sheet.getCell(8, row).stringValue("") + #sheet.getCell(5, row).stringValue("") + sheet.getCell(5, row).stringValue(stock["totalinwardqty"]).setAlignHorizontal("right") + sheet.getCell(6, row).stringValue(stock["totaloutwardqty"]).setAlignHorizontal("right") + sheet.getCell(7, row).stringValue("") row += 1 ods.save("response.ods") -- GitLab From 92e02bbc8ce6885f0bec7e93867882a020226777 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Wed, 1 Nov 2017 17:52:24 +0530 Subject: [PATCH 101/121] Now organisation logo at left side. --- gkwebapp/templates/editorganisation.jinja2 | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gkwebapp/templates/editorganisation.jinja2 b/gkwebapp/templates/editorganisation.jinja2 index 40946a9a..b13ead51 100644 --- a/gkwebapp/templates/editorganisation.jinja2 +++ b/gkwebapp/templates/editorganisation.jinja2 @@ -38,28 +38,27 @@
    + {% trans %}Connection Failed.{% endtrans %} + +
    -
    -
    +
    -
    -
    +
    -
    -
    +
    @@ -224,12 +223,13 @@ - +
    +
    +
    + + +
    - -
    - - GSTIN : - + {% if resultgstvat != '22' %} +
    + GSTIN :
    - + {% endif %} {% if gkstatus=="out" %} diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 7a3e6479..1e67c968 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -113,10 +113,12 @@
    -
    + {% if resultgstvat != '22' %} + +
    + {% endif %} diff --git a/gkwebapp/templates/printinvoice.jinja2 b/gkwebapp/templates/printinvoice.jinja2 index 5a0d3f69..a6026a0c 100644 --- a/gkwebapp/templates/printinvoice.jinja2 +++ b/gkwebapp/templates/printinvoice.jinja2 @@ -83,6 +83,12 @@ {% if org["orgwebsite"]!='' %} Website : {{org["orgwebsite"]}} {% endif %} + {% if gkresult["inoutflag"] == 15 %} +
    + + {% if gkresult["orgstategstin"] %}{{ gkresult["orgstategstin"] }}{% endif %} +
    + {% endif %} @@ -125,16 +131,6 @@ {% if gkresult["inoutflag"] == 15 %}{{ gkresult["sourcestatecode"] }}{% endif %}{% if gkresult["inoutflag"] == 9 %}{{ gkresult["taxstatecode"] }}{% endif %} -
    diff --git a/gkwebapp/templates/viewsinglecashmemo.jinja2 b/gkwebapp/templates/viewsinglecashmemo.jinja2 index e3e8fe0b..10f0bcc8 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 %}

    diff --git a/gkwebapp/templates/viewsingleinvoice.jinja2 b/gkwebapp/templates/viewsingleinvoice.jinja2 index d9d2efef..26a7c28d 100644 --- a/gkwebapp/templates/viewsingleinvoice.jinja2 +++ b/gkwebapp/templates/viewsingleinvoice.jinja2 @@ -37,6 +37,10 @@ {% if gkresult["inoutflag"] == 15 %}{{ gkresult["sourcestatecode"] }}{% endif %}{% if gkresult["inoutflag"] == 9 %}{{ gkresult["taxstatecode"] }}{% endif %}
    {% if gkresult["inoutflag"] == 15 %} +
    + + {% if gkresult["orgstategstin"] %}{{ gkresult["orgstategstin"] }}{% endif %} +
    {{ gkresult["issuername"] }}
    -- GitLab From 25400818379c41e527ad0017e2ce85fb65228465 Mon Sep 17 00:00:00 2001 From: reshma1 Date: Fri, 10 Nov 2017 13:25:53 +0530 Subject: [PATCH 117/121] Organisation GSTIN is hidden on the basis of date. --- gkwebapp/static/js/addcashmemo.js | 3 ++- gkwebapp/templates/addcashmemo.jinja2 | 4 ++-- gkwebapp/templates/addinvoice.jinja2 | 4 ++-- gkwebapp/templates/printinvoice.jinja2 | 2 +- gkwebapp/templates/viewsingleinvoice.jinja2 | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gkwebapp/static/js/addcashmemo.js b/gkwebapp/static/js/addcashmemo.js index 915f49f3..7123c031 100644 --- a/gkwebapp/static/js/addcashmemo.js +++ b/gkwebapp/static/js/addcashmemo.js @@ -219,7 +219,8 @@ $(document).ready(function() { else { $("#taxapplicabletext").text("VAT"); $("#taxapplicable").val("22"); - $("#gstproducttable").hide(); + $("#gstproducttable").hide(); + $(".gstinfield").hide(); $("#invoice_product_table_vat").show(); $("#vathelp").show(); } diff --git a/gkwebapp/templates/addcashmemo.jinja2 b/gkwebapp/templates/addcashmemo.jinja2 index b4b1d86d..ccc49e97 100644 --- a/gkwebapp/templates/addcashmemo.jinja2 +++ b/gkwebapp/templates/addcashmemo.jinja2 @@ -126,8 +126,8 @@ {% if resultgstvat != '22' %} -
    - GSTIN : +
    +
    {% endif %} {% if gkstatus=="out" %} diff --git a/gkwebapp/templates/addinvoice.jinja2 b/gkwebapp/templates/addinvoice.jinja2 index 1e67c968..88b8f38a 100644 --- a/gkwebapp/templates/addinvoice.jinja2 +++ b/gkwebapp/templates/addinvoice.jinja2 @@ -115,8 +115,8 @@
    {% if resultgstvat != '22' %} {% endif %}