diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index ca245a5165cfdb2b98c997cc8f8fd6b0e01ba63b..0b718e264d865999a56a0d24dc81d6bf5faec0d1 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 || 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) { var curindex1 = $(this).closest('tr').index(); @@ -157,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(''); @@ -349,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(){ @@ -401,16 +360,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/addinvoice.js b/gkwebapp/static/js/addinvoice.js index f0c5f69c831232c2447f39108079017bf00bb0ba..080c8ed2da195cafcfa578247b0104ae27611f7d 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 c8e208fcfc5e0778dd0791d2e8e77e39750467cf..6b76b5567dcc73b435bce142a34ce3acf2ee8b9e 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 f7684d3736d5c025953a652b70323a5ac20bf782..a3f7f782b4dbd0aa9b781f85a7522f8f9bc8b6d9 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,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(''); @@ -361,7 +349,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 +389,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 +493,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 +511,7 @@ $("#cussup_delete").click(function(event) { xhr.setRequestHeader('gktoken',sessionStorage.gktoken ); }, success: function(resp) - + { if (resp["gkstatus"]==0) { $("#customersupplier_edit").click(); diff --git a/gkwebapp/templates/addcustomersupplier.jinja2 b/gkwebapp/templates/addcustomersupplier.jinja2 index 05b2794f92376f344518f22aa0e67ae8e1d8bb3e..2d183777cfb3f20be5f491fb4e1787f62b5d35f3 100644 --- a/gkwebapp/templates/addcustomersupplier.jinja2 +++ b/gkwebapp/templates/addcustomersupplier.jinja2 @@ -128,13 +128,13 @@ {% if vatorgstflag != '7' %}
- +
{% endif %}
- +
diff --git a/gkwebapp/templates/createcustsuppopup.jinja2 b/gkwebapp/templates/createcustsuppopup.jinja2 index 3e2f27ac2903948edc2cf03cf3b6a2741d775516..b8974dcae9892c8b921e8908e5fa441b5151b952 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 %} - +
- +
{% endif %}
@@ -271,7 +271,7 @@ - + {% endif %}