diff --git a/gkwebapp/static/js/addcategory.js b/gkwebapp/static/js/addcategory.js index a881e89d44fbaaa1fa55deb2c80bd5a3c8669f5c..5da5d20513a1571348bda9b9bb325cf8a7e1c4b6 100644 --- a/gkwebapp/static/js/addcategory.js +++ b/gkwebapp/static/js/addcategory.js @@ -600,11 +600,13 @@ $(document).ready(function() { }); taxes = []; $("#category_tax_table tbody tr").each(function() { - var obj = {}; // dict for storing tax details - obj.taxname = $.trim($("td:eq(0) select option:selected", this).val()); - obj.state = $.trim($("td:eq(1) select option:selected", this).val()); - obj.taxrate = $.trim($("input", this).val()); - taxes.push(obj); + var obj = {}; // dict for storing tax details + if($("td:eq(0) select option:selected", this).val() != ""){ + obj.taxname = $.trim($("td:eq(0) select option:selected", this).val()); + obj.state = $.trim($("td:eq(1) select option:selected", this).val()); + obj.taxrate = $.trim($("input", this).val()); + taxes.push(obj); + } }); $.ajax({ url: '/category?action=save', diff --git a/gkwebapp/static/js/addcustomersupplier.js b/gkwebapp/static/js/addcustomersupplier.js index 0b718e264d865999a56a0d24dc81d6bf5faec0d1..b58f54a02c82c4d4c960158fadbe90d9f3b1b80e 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; diff --git a/gkwebapp/static/js/editcategory.js b/gkwebapp/static/js/editcategory.js index f6d6c7d0db63ddad7578232aa8a08f53964cafce..7052c37a3bfddf51c712009d35e4e093af3b13c5 100644 --- a/gkwebapp/static/js/editcategory.js +++ b/gkwebapp/static/js/editcategory.js @@ -104,7 +104,7 @@ $(document).ready(function() { $('#category_edit_tax_table tbody tr:last').attr({value: tax["taxid"]}); $('#category_edit_tax_table tbody tr:last td:eq(0) select').val(tax["taxname"]); $('#category_edit_tax_table tbody tr:last td:eq(1) select').val(tax["state"]); - if(tax["taxname"] == "CVAT" || tax["taxname"] == "IGST"){ + if(tax["taxname"] != "VAT"){ $('#category_edit_tax_table tbody tr:last td:eq(1) select').prop("disabled", true); } $('#category_edit_tax_table tbody tr:last td:eq(2) input').val(tax["taxrate"]); @@ -116,7 +116,7 @@ $(document).ready(function() { $('#category_edit_tax_table tbody').append(taxfieldhtml); $(".tax_del:first").hide(); } - + }) .fail(function() { console.log("error"); @@ -290,8 +290,34 @@ $(document).ready(function() { $('#category_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').focus(); event.preventDefault(); } - else if (($("#category_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='CVAT' || $("#category_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val()=='IGST') && event.which==13 ) { + else if (($("#category_edit_tax_table tbody tr:eq("+curindex+") td:eq(0) select").val() !='VAT') && event.which==13 ) { event.preventDefault(); + var types = []; + $('#category_edit_tax_table tbody tr').each(function(){ + if($(".tax_name",this).val()=='IGST') { + types.push($(".tax_name",this).val()); + } + if($(".tax_name",this).val()=='CESS') { + types.push($(".tax_name",this).val()); + } + if ($(".tax_name",this).val()=='CVAT') { + types.push($(".tax_name",this).val()); + } + }); + types.sort(); + var duplicatetypes = []; + for (var i = 0; i < types.length - 1; i++) { + if (types[i + 1] == types[i]) { + duplicatetypes.push(types[i]); + } + } + if (duplicatetypes.length > 0) { + $("#cvat-alert").alert(); + $("#cvat-alert").fadeTo(2250, 500).slideUp(500, function(){ + $("#cvat-alert").hide(); + }); + return false; + } $('#category_edit_tax_table tbody tr:eq('+curindex+') td:eq(1) select').prop("disabled", true); $('#category_edit_tax_table tbody tr:eq('+curindex+') td:eq(2) input').focus().select(); } diff --git a/gkwebapp/templates/addcategory.jinja2 b/gkwebapp/templates/addcategory.jinja2 index 6a770f44b6fb9e6922efda3683f27ae6333dcaa5..1c096b723f6ba92e6a0feaf48d41531cce2303e6 100644 --- a/gkwebapp/templates/addcategory.jinja2 +++ b/gkwebapp/templates/addcategory.jinja2 @@ -349,9 +349,10 @@ {% else %} + + - {% endif%} @@ -367,7 +368,7 @@ - + diff --git a/gkwebapp/templates/editcategory.jinja2 b/gkwebapp/templates/editcategory.jinja2 index 14c47961c608b706d08b9ace59ec3559494ff9de..b19e0336bc9d625096f5a6909c13919b61d65915 100644 --- a/gkwebapp/templates/editcategory.jinja2 +++ b/gkwebapp/templates/editcategory.jinja2 @@ -124,6 +124,10 @@ {% trans %}Duplicate Tax!{% endtrans %} +
@@ -148,7 +152,8 @@ {% else %} - + + {% endif%} diff --git a/gkwebapp/templates/printinvoice.jinja2 b/gkwebapp/templates/printinvoice.jinja2 index 38b7bafe73ab17e239100d820f1d62dc5f3c5371..d20a8d40f7d0da00b12e6348d02cc9b2b3b237de 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 %}