...
 
Commits (429)
"""
Copyright (C) 2013, 2014, 2015, 2016 Digital Freedom Foundation
This file is part of GNUKhata:A modular,robust and Free Accounting System.
Copyright (C) 2017, 2018 Digital Freedom Foundation & Accion Labs Pvt. Ltd.
This file is part of GNUKhata:A modular,robust and Free Accounting System.
GNUKhata is Free Software; you can redistribute it and/otyper 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'
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.
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,
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, United States
Contributors:
......@@ -28,6 +29,7 @@ Contributors:
"Vanita Rajpurohit" <vanita.rajpurohit9819@gmail.com>
"Bhavesh Bawadhane" <bbhavesh07@gmail.com>
"Sachin Patil" <sachpatil@openmailbox.org>
'Prajkta Patkar'<prajkta@riseup.net>
"""
from pyramid.config import Configurator
......@@ -171,6 +173,7 @@ def main(global_config, **settings):
config.add_route('showconsolidationpopup','/showconsolidationpopup')
config.add_route('rejectionnote','/rejectionnote')
config.add_route('billwise','/billwise')
config.add_route('gstsummary','/gstsummary')
config.add_route('drcrnote','/drcrnote')
config.scan('gkwebapp')
return config.make_wsgi_app()
#drcrnote_product_table_gst tbody tr {
display:table;
width:100%;
table-layout:fixed;
}
#drcrnote_product_table_gst tbody {
display:block;
width:100%;
height: calc(100vh - 31em);
}
#drcrnote_product_table_gst_heading thead {
display:table;
width: calc( 100% - 0.75em );
table-layout:fixed;
}
#drcrnote_product_table_gst_tfoot tfoot {
display:block;
width: calc( 100% - 0.75em );
}
#drcrnote_product_table_total tbody {
display:block;
height: calc(100vh - 31em);
overflow-y:scroll;
}
#drcrnote_product_table_total tbody tr {
display:table;
width:100%;
table-layout:fixed;
}
#drcrnote_product_table_total tfoot {
display:block;
width:calc( 100% - 0.75em );
}
#drcrnote_table_vat tbody {
display:block;
height: calc(100vh - 31em);
overflow-y:scroll;
}
#drcrnote_table_vat tfoot {
display:table;
width: calc( 100% - 0.75em );
}
.nopadding{
padidng:0 !important;
padding:0 !important;
}
td {
font-size: 65%;
color: black;
}
th {
font-size: 75%;
}
.crosswrap{
width :2.5%;
}
.mdwrap{
width:16%;
}
.qtywrap {
width:9%
}
.smwrap{
width:6%;
}
.taxwrap{
width:12%
}
.taxcell {
width:6%
}
.totalwrap {
width:52%;
}
.mdvwrap{
width:19.5%;
}
.smvwrap{
width:9.75%;
}
.ratewrap {
width: 6.75%;
}
.qtyvwrap {
width: 11.25%;
}
.unitaddon {
overflow:hidden;
text-overflow:clip;
white-space:nowrap;
max-width:20px;
}
@page {
size : 21cm 29.7cm;
margin : 10mm 10mm 20mm 10mm
}
thead{
display: table-header-group;
}
tfoot{
display: table-footer-group;
}
.rightJustified {
text-align: right;
}
.product_name_gst,.product_name_vat {
max-width: 100% !important;
min-width: 100% !important;
width: 100% !important;
}
.selectfieldwidth {
max-width: 180px !important;
}
.borderdiv {
border-left-style:solid;
border-width: 1px;
}
.rborderdiv {
border-right-style:solid;
border-width: 1px;
}
.hborderdiv {
border-top-style:solid;
padding-top: 10px;
border-width: 1px;
}
label {
font-size:95% !important;
}
.noborder {
border-style: none !important;
}
......@@ -41,3 +41,8 @@ a:focus,
}
input[type="radio"]:focus {outline: 2px #1f0e5e solid !important;}
input[type="checkbox"]:focus {outline: 2px #1f0e5e solid !important;}
.dropdown-toggle:focus{
outline: 2px #1f0e5e solid !important;
}
This diff is collapsed.
......@@ -69,7 +69,20 @@ $(document).ready(function() {
$("#add_cussup_name").focus().select();
}
});
$("#checkbnk").click(function(e){
if ($(this).is(":checked")) {
checkbnk = 1;
$("#checkbnk").val(1);
$("#bankdiv").show();
}
else {
checkbnk = 0;
$("#checkbnk").val(0);
$("#bankdiv").hide();
}
});
$("#add_cussup_name").keydown(function(event) {
if (event.which==13) {
if ($.trim($("#add_cussup_name").val())=="") {
......@@ -156,12 +169,27 @@ $("#add_state").keydown(function(event) {
else if (event.which==27) {
event.preventDefault();
if($("#add_cussup").val() == '19'){
$("#accountno").focus();
$("#checkbnk").focus();
} else {
$("#cussup_save").focus();
}
}
});
$(document).off("keydown", "#checkbnk").on("keydown", "#checkbnk", function(event) {
if(event.which == 13){
event.preventDefault();
$("#accountno").focus().select();
}
else if(event.which == 38){
if ($("#vatorgstflag").val() == '22'){
$("#add_cussup_tan").focus();
} else {
$(".gstin").focus().select();
}
}
});
//Change event on GSTIN State
$(document).off('change', '.gstinstate').on('change', '.gstinstate', function(event) {
event.preventDefault();
......@@ -285,7 +313,7 @@ $("#add_state").keydown(function(event) {
else if (event.which==27) {
event.preventDefault();
if($("#add_cussup").val() == '19'){
$("#accountno").focus();
$("#checkbnk").focus();
} else {
$("#cussup_save").focus();
}
......@@ -300,11 +328,7 @@ $("#add_state").keydown(function(event) {
}
else if (event.which==38){
event.preventDefault();
if ($("#vatorgstflag").val() == '22'){
$("#add_cussup_tan").focus();
} else {
$(".gstin").focus().select();
}
$("#checkbnk").focus();
}
});
......@@ -592,7 +616,7 @@ $(document).off("click",".state_del").on("click", ".state_del", function() {
$("#add_cussup_tan").focus();
return false;
} else if($("#add_cussup").val() == '19'){
$("#accountno").focus();
$("#checkbnk").focus();
} else {
$("#cussup_save").focus();
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -32,11 +32,13 @@
"Sachin Patil" <sachin619patil@rediffmail.com>
*/
$(document).ready(function() {
$(".serviceclass").hide();
$(".productclass").hide();
$(".productclass").hide();
var stkhtml;
$(".common").hide();
var godownflag = 0;
$('.modal-backdrop').remove();
......@@ -1040,7 +1042,7 @@ $(document).off("keydown",".godown_name").on("keydown",".godown_name",function(e
}
else if (event.which==13) {
event.preventDefault();
$('#godown_ob_table tbody tr:eq('+curindex+') td:eq(1) input').focus().select();
$('#godown_ob_table tbody tr:eq('+curindex+') td:eq(1) input').focus().select();
}
});
......@@ -1206,8 +1208,230 @@ $("#addgodown").click(function() {
}
);
});
/* -----------------------AddStock Key events start here----------------------------------------- */
/*For rendering of addstock popup window*/
$('#addstockmodal').on('shown.bs.modal', function() {
$.ajax({
url: '/product?type=stkmodal&tax=gst',
type: "POST",
datatype: 'text/html',
global: false,
async: false,
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
}
})
.done(function(resp) {
$('#gststkmodal').html(resp);
stkhtml = $('#stocktable tbody tr:first').html();
$("#godown_name").focus();/*For shifting focus of addstock button to select godown button of pop up window*/
$("#godown_name").val("").focus();
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
$(document).off("change",".prodstock").on("change", '.prodstock', function(event) {
let curindex= $(this).closest('tr').index();
$.ajax({
url: '/product?type=hsnuom',
type: 'POST',
global: false,
async: false,
datatype: 'json',
data: {"productcode": $(this).val()},
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
}
})
.done(function(resp) /*This function will return spec name of the product*/
{
$('.unitname:eq('+ curindex +')').text(resp.gkresult.unitname);
$('.add_product_hsncode:eq('+ curindex +')').html(resp.gkresult.gscode);
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
$(document).off("click","#stock_done").on("click", '#stock_done', function(event) {
var gobj = {};
var stockallow = 1;
if ($.trim($("#godown_name").val())=="") {
stockallow = 0;
$("#emptygodownalert").alert();
$("#emptygodownalert").fadeTo(2250, 500).slideUp(500, function(){
$("#emptygodownalert").hide();
});
$("#godown_name").focus();
return false;
}
$("#stocktable tbody tr").each(function(){
if ($.trim($(".prodstock",this).val())=="") {
stockallow = 0;
$("#emptyproductalert").alert();
$("#emptyproductalert").fadeTo(2250, 500).slideUp(500, function(){
$("#emptyproductalert").hide();
});
$(".prodstock",this).focus();
return false;
}
if ($.trim($(".open_stock",this).val())=="") {
stockallow = 0;
$("#emptyopstkalert").alert();
$("#emptyopstkalert").fadeTo(2250, 500).slideUp(500, function(){
$("#emptyopstkalert").hide();
});
$(".open_stock",this).focus();
return false;
}
if ($.trim($(".prodstock",this).val())!="") {
if ($.trim($(".open_stock",this).val())!="" ) {
gobj[$(".prodstock",this).val()] = $(".open_stock",this).val();
}
}
});
console.log(gobj);
var goid=$("#godown_name option:selected").attr("value");
if (stockallow == 1){
$.ajax({
type: "POST",
url: "/product?type=stockproduct",
global: false,
async: false,
datatype: "json",
data: {"goid":goid, "productdetails":JSON.stringify(gobj)},
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken',sessionStorage.gktoken );
},
success: function(resp)
{
if(resp["gkstatus"]==0)
{
$("#stocksuccess").alert();
$("#stocksuccess").fadeTo(2250, 500).slideUp(500, function(){
$("#stocksuccess").hide();
$("#gststkmodal").html("");/*To refresh the modal after saving one or more selected products*/
/*For the rendering of modal after refreshing it*/
$.ajax({
url: '/product?type=stkmodal&tax=gst',
type: "POST",
datatype: 'text/html',
global: false,
async: false,
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
}
})
.done(function(resp) {
$('#gststkmodal').html(resp);
stkhtml = $('#stocktable tbody tr:first').html();
$("#godown_name").focus();/*For shifting focus of addstock button to select godown button of pop up window*/
$("#godown_name").val("").focus();
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
}
else if(resp["gkstatus"]==1)
{
$("#uniquestockalert").alert();
$("#uniquestockalert").fadeTo(2250, 500).slideUp(500, function(){
$("#uniquestockalert").hide();
});
$("#openingstock").focus().select();
}
else
{
$("#failure-alert").alert();
$("#failure-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#failure-alert").hide();
});
$("#godownname").focus().select();
}
}
});
}
});
/*Event for deleting a particular row*/
$(document).off("click",".product_del").on("click", ".product_del", function() {
$(this).closest('tr').fadeOut(200, function(){
$(this).closest('tr').remove();//closest method gives the closest element specified
if($('#stocktable tbody tr').length == 0){// After deleting 0th row gives field to adding new gstin.
$('#stocktable tbody').append('<tr>'+stkhtml+'</tr>');
}
$('#stocktable tbody tr:last td:eq(0) select').focus().select();
});
$('#stocktable tbody tr:last td:eq(0) select').select();
});
$(document).off("keydown", "#godown_name").on("keydown", "#godown_name", function(event) {
if (event.which == 13) {
event.preventDefault();
$(".prodstock:first").focus().select();
}
});
/*Event for validation of shifting focus*/
$(document).off("keydown", ".prodstock").on("keydown", ".prodstock", function(event) {
let curindex = $(this).closest('tr').index();
let nextindex = curindex + 1;
let previndex = curindex - 1;
console.log(curindex);
if (event.which == 13) {
event.preventDefault();
$('.open_stock:eq('+ curindex +')').focus().select();
}
return false;
});
$(document).off("keydown", ".open_stock").on("keydown", ".open_stock", function(event) {
let curindex = $(this).closest('tr').index();
var selectedpro = $('#stocktable tbody tr:eq('+curindex+') td:eq(0) select option:selected').val();
let nextindex = curindex + 1;
let previndex = curindex - 1;
if (event.which == 13){
event.preventDefault();
if (selectedpro==""){
$("#Product-blank-alert").alert();
$("#Product-blank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#Product-blank-alert").hide();
});
return false;
}
$('#stocktable tbody').append('<tr>' + $(this).closest('tr').html() + '</tr>');
$('#stocktable tbody tr:eq('+nextindex+') td:eq(0) select option[value='+selectedpro+']').prop('hidden', true).prop('disabled', true);
$('#stocktable tbody tr:eq('+nextindex+') td:eq(0) select option[value=""]').prop('selected', true);
$('#stocktable tbody tr:eq('+nextindex+') td:eq(1) label').text("");
$('.prodstock:eq('+ nextindex +')').focus().select();
}
});
$(document).off("click","#apsubmit").on("click", '#apsubmit', function(event) {
event.preventDefault();
/* Act on the event */
......@@ -1412,7 +1636,8 @@ else{
}
})
.done(function(resp) {
.done(function(resp) {
if (resp["gkstatus"] ==0) {
//$("#addproduct").click();
......@@ -1422,18 +1647,16 @@ else{
else{
$("#productinmaster").click();
}
$('.modal-backdrop').remove();
$("#addproduct-success-alert").alert();
$("#addproduct-success-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#addproduct-success-alert").hide();
});
$('.modal-backdrop').remove();
$("#addproduct-success-alert").alert();
$("#addproduct-success-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#addproduct-success-alert").hide();
});
}
else if (resp["gkstatus"] ==1)
{
$('.modal-backdrop').remove();
if ($("#additem option:selected").val() == 7){
$("#duplicate-alert").alert();
$("#duplicate-alert").fadeTo(2250, 500).slideUp(500, function(){
......@@ -1459,5 +1682,12 @@ $(document).on('click', '#apreset', function(event) {
event.preventDefault();
/* Act on the event */
$("#addproduct").click();
});
/*code for reseting the fields*/
$(document).on('click', '#stockreset', function(event) {
event.preventDefault();
$("#stocktable tbody").html("");
$('#stocktable tbody').append('<tr>'+stkhtml+'</tr>');
$("#godown_name").val("").focus();
});
});
......@@ -33,6 +33,8 @@
*/
$(document).ready(function() {
var stkhtml = $('#stocktable tbody tr:first').html();
if (sessionStorage.invflag==0){
$(".noinventory").hide();
......@@ -111,6 +113,19 @@ $(document).off('blur', '#addproddesc').on('blur', '#addproddesc',function(event
});
$("#adduom").change(function(event) {
if ($("#adduom option:selected").val()!='') {
$("#unitaddon").html($("#adduom option:selected").text());
}
});
$("#openingstock").focus(function(event) {
if ($("#adduom option:selected").val()!='') {
$("#unitaddon").html($("#adduom option:selected").text());
}
});
$(document).off('keyup').on('keyup',function(event)
{
/* Act on the event */
......@@ -164,7 +179,7 @@ $("#addproddesc").keydown(function(event) {
}
});
/*opening stock events in addstock popup*/
$("#adduom").change(function(event) {
if ($("#adduom option:selected").val()!='') {
$("#unitaddon").html($("#adduom option:selected").text());
......@@ -316,6 +331,238 @@ $(document).off('keydown', '#newuom').on('keydown', '#newuom', function(event) {
}
});
/*-------------------------------------Add Stock key events starts here-------------------------------------------------------------*/
//For shifting focus of addstock button to select godown button of pop up window
$('#addstockmodal').on('shown.bs.modal', function() {
$.ajax({
url: '/product?type=stkmodal&tax=vat',
type: "POST",
datatype: 'text/html',
global: false,
async: false,
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
}
})
.done(function(resp) {
$('#vatstkmodal').html(resp);
stkhtml = $('#stocktable tbody tr:first').html();
$("#godown_name").focus();
$("#godown_name").val("").focus();
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
$(document).off("change",".prodstock").on("change", '.prodstock', function(event) {
let curindex= $(this).closest('tr').index();
$.ajax({
url: '/product?type=hsnuom',
type: 'POST',
global: false,
async: false,
datatype: 'json',
data: {"productcode": $(this).val()},
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
}
})
.done(function(resp) /*This function will return spec name of the product*/
{
$('.unitname:eq('+ curindex +')').text(resp.gkresult.unitname);
$('.add_product_hsncode:eq('+ curindex +')').html(resp.gkresult.gscode);
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
$(document).off("click","#stock_done").on("click", '#stock_done', function(event) {
var gobj = {};
var stockallow = 1;
if ($.trim($("#godown_name").val())=="") {
stockallow = 0;
$("#emptygodownalert").alert();
$("#emptygodownalert").fadeTo(2250, 500).slideUp(500, function(){
$("#emptygodownalert").hide();
});
$("#godown_name").focus();
return false;
}
$("#stocktable tbody tr").each(function(){
if ($.trim($(".prodstock",this).val())=="") {
stockallow = 0;
$("#emptyproductalert").alert();
$("#emptyproductalert").fadeTo(2250, 500).slideUp(500, function(){
$("#emptyproductalert").hide();
});
$(".prodstock",this).focus();
return false;
}
if ($.trim($(".open_stock",this).val())=="") {
stockallow = 0;
$("#emptyopstkalert").alert();
$("#emptyopstkalert").fadeTo(2250, 500).slideUp(500, function(){
$("#emptyopstkalert").hide();
});
$(".open_stock",this).focus();
return false;
}
if ($.trim($(".prodstock",this).val())!="") {
if ($.trim($(".open_stock",this).val())!="" ) {
gobj[$(".prodstock",this).val()] = $(".open_stock",this).val();
}
}
});
var goid=$("#godown_name option:selected").attr("value");
if (stockallow == 1){
$.ajax({
type: "POST",
url: "/product?type=stockproduct",
global: false,
async: false,
datatype: "json",
data: {"goid":goid, "productdetails":JSON.stringify(gobj)},
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken',sessionStorage.gktoken );
},
success: function(resp)
{
if(resp["gkstatus"]==0)
{
$("#stocksuccess").alert();
$("#stocksuccess").fadeTo(2250, 500).slideUp(500, function(){
$("#stocksuccess").hide();
$("#vatstkmodal").html("");/*To refresh the modal after saving one or more selected products*/
/*For the rendering of modal after refreshing it*/
$.ajax({
url: '/product?type=stkmodal&tax=vat',
type: "POST",
datatype: 'text/html',
global: false,
async: false,
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
}
})
.done(function(resp) {
$('#vatstkmodal').html(resp);
stkhtml = $('#stocktable tbody tr:first').html();
$("#godown_name").focus();
$("#godown_name").val("").focus();
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
}
else if(resp["gkstatus"]==1)
{
$("#uniquestockalert").alert();
$("#uniquestockalert").fadeTo(2250, 500).slideUp(500, function(){
$("#uniquestockalert").hide();
});
$("#openingstock").focus().select();
}
else
{
$("#failure-alert").alert();
$("#failure-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#failure-alert").hide();
});
$("#godownname").focus().select();
}
}
});
}
});
/*Event for deleting a particular row*/
$(document).off("click",".product_del").on("click", ".product_del", function() {
$(this).closest('tr').fadeOut(200, function(){
$(this).closest('tr').remove();//closest method gives the closest element specified
if($('#stocktable tbody tr').length == 0){// After deleting 0th row gives field to adding new gstin.
$('#stocktable tbody').append('<tr>'+stkhtml+'</tr>');
}
$('#stocktable tbody tr:last td:eq(0) select').focus().select();
});
$('#stocktable tbody tr:last td:eq(0) select').select();
});
$(document).off("keydown", "#godown_name").on("keydown", "#godown_name", function(event){
if (event.which == 13) {
event.preventDefault();
$(".prodstock:first").focus().select();
}
});
/*Event for validation of shifting focus*/
$(document).off("keydown", ".prodstock").on("keydown", ".prodstock", function(event) {
let curindex = $(this).closest('tr').index();
let nextindex = curindex + 1;
let previndex = curindex - 1;
console.log(curindex);
if (event.which == 13) {
event.preventDefault();
$('.open_stock:eq('+ curindex +')').focus().select();
}
return false;
});
$(document).off("keydown", ".open_stock").on("keydown", ".open_stock", function(event) {
let curindex = $(this).closest('tr').index();
var selectedpro = $('#stocktable tbody tr:eq('+curindex+') td:eq(0) select option:selected').val();
let nextindex = curindex + 1;
let previndex = curindex - 1;
if (event.which == 13){
event.preventDefault();
if (selectedpro==""){
$("#Product-blank-alert").alert();
$("#Product-blank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#Product-blank-alert").hide();
});
return false;
}
$('#stocktable tbody').append('<tr>' + $(this).closest('tr').html() + '</tr>');
$('#stocktable tbody tr:eq('+nextindex+') td:eq(0) select option[value='+selectedpro+']').prop('hidden', true).prop('disabled', true);
$('#stocktable tbody tr:eq('+nextindex+') td:eq(0) select option[value=""]').prop('selected', true);
$('.prodstock:eq('+ nextindex +')').focus().select();
}
});
$("#addcatselect").change(function(event) {
/* Act on the event */
......@@ -795,7 +1042,7 @@ $(document).off('keydown', '#openingstock').on('keydown', '#openingstock', funct
event.preventDefault();
$("#apsubmit").focus().select();
}
});
});
/* -----------------------Godown Key events start here----------------------------------------- */
$(document).off("change",".godown_name").on("change",".godown_name",function(event)
{
......@@ -1013,8 +1260,10 @@ $("#addgodown").click(function() {
}
}
);
});
$(document).off("click","#apsubmit").on("click", '#apsubmit', function(event) {
event.preventDefault();
......@@ -1184,4 +1433,14 @@ $(document).on('click', '#apreset', function(event) {
/* Act on the event */
$("#addproduct").click();
});
$(document).on('click', '#stockreset', function(event) {
event.preventDefault();
$("#stocktable tbody").html("");
$('#stocktable tbody').append('<tr>'+stkhtml+'</tr>');
$("#godown_name").val("").focus();
});
});
This diff is collapsed.
......@@ -31,7 +31,15 @@ $(document).ready(function() {
$("#unit_name").keydown(function(event) {
if (event.which==13) {
event.preventDefault();
event.preventDefault();
if ($.trim($('#unit_name').val())=="") {
$("#unit-blank-alert").alert();
$("#unit-blank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#unit-blank-alert").hide();
});
$('#unit_name').focus().select();
return false;
}
$("#sub_unit_of").focus().select();
}
});
......@@ -39,7 +47,7 @@ $(document).ready(function() {
$("#sub_unit_of").keydown(function(event) {
if (event.which==13 && $("#sub_unit_of option:selected").val()=='') {
event.preventDefault();
$("#unit_save").click();
$("#unit_save").click();
}
else if(event.which==13 && $("#sub_unit_of option:selected").val()!='') {
event.preventDefault();
......@@ -54,7 +62,7 @@ $(document).ready(function() {
$("#conversion_rate").keydown(function(event) {
if (event.which==13){
event.preventDefault();
$("#unit_save").click();
$("#unit_save").click();
}
if (event.which==38){
event.preventDefault();
......
......@@ -50,7 +50,7 @@ $(document).ready(function() {
if ($('#vtype').val()=="sales" || $('#vtype').val()=="purchase") {
$(".billhide").hide();
if (sessionStorage.invsflag==0){
$(".invhide").hide(); //Hides list of invoices in Sale and Purchase vouchers when invoice flag is set to zero.
$(".invhide").hide(); //Hides list of invoices in Sale and Purchase voucher when invoice flag is set to zero.
}
else
{
......@@ -267,10 +267,11 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
if (!curdate.between(financialstart,financialend)) {
$("#between-date-alert").alert();
$("#between-date-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#between-date-alert").hide();
});
$("#postdate-alert").hide();
$("#between-date-alert").hide();
$("#postdate-alert").hide();
$('#vdate').focus().select();
});
return false;
}
if (Date.today().compareTo(curdate)==-1) {
......@@ -322,6 +323,13 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
}
}
else if(event.which==13 && $('#vno').val()==""){
$("#voucherno-alert").alert();
$("#voucherno-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#voucherno-alert").hide();
});
}
if (event.which==190 && event.ctrlKey) {
$("#vdate").focus().select();
event.preventDefault();
......@@ -338,7 +346,8 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
if(event.which==13 && $('#vdate').val()!=""){
$('#vmonth').select().focus();
}
}
}
if (event.which==38) {
$("#vno").select().focus();
}
......@@ -352,13 +361,28 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
$('#vmonth').focus().select();
event.preventDefault();
}
else if (event.which==13 && $('#vdate').val()=="") {
$("#voucherdate-alert").alert();
$("#voucherdate-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#voucherdate-alert").hide();
});
$('#vdate').focus();
return false;
}
//else {
//$("#vmonth").focus().select();
//}
});
$('#vmonth').keyup(function(event) {
if(event.which==13 && $('#vmonth').val()!=""){
if(event.which==13 && $('#vmonth').val()){
event.preventDefault();
$('#vyear').focus().select();
}
if (event.which==38) {
event.preventDefault();
$("#vdate").select().focus();
......@@ -369,6 +393,18 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
$('#vdate').focus().select();
event.preventDefault();
}
else if (event.which==13 && $('#vmonth').val()=="") {
$("#voucherdate-alert").alert();
$("#voucherdate-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#voucherdate-alert").hide();
});
$('#vmonth').focus();
return false;
}
// else {
// $("#vyear").focus().select();
//}
if (event.which==190 && event.ctrlKey) {
$('#vyear').focus();
event.preventDefault();
......@@ -395,9 +431,10 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
$('#vyear').keyup(function(event) {
if(event.which==13 && $('#vyear').val()!=""){
$('#vtable tbody tr:first select:enabled').focus();
event.preventDefault();
event.preventDefault();
}
if (event.which==38) {
$("#vmonth").select().focus();
}
......@@ -408,11 +445,22 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
$('#vyear').keydown(function(event) {
if (event.which==188 && event.ctrlKey) {
$('#vmonth').focus().select();
event.preventDefault();
event.preventDefault();
}
else if (event.which==13 && $('#vyear').val()=="") {
$("#date-alert").alert();
$("#date-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#date-alert").hide();
});
$('#vdate').focus();
return false;
}
if (event.which==190 && event.ctrlKey) {
event.preventDefault();
event.preventDefault();
$('#vtable tbody tr:first select:enabled').focus();
}
......@@ -1379,7 +1427,8 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
if ($('#vdate').val()=="" || $('#vmonth').val()=="" || $('#vyear').val()==""||$('#vdate').val()==0 || $('#vmonth').val()==0 || $('#vyear').val()==0) {
$("#date-alert").alert();
$("#date-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#date-alert").hide();
$("#date-alert").hide();
});
$('#vdate').focus().select();
return false;
......@@ -1387,7 +1436,8 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
if(!Date.parseExact($("#vdate").val()+$("#vmonth").val()+$("#vyear").val(), "ddMMyyyy")){
$("#date-alert").alert();
$("#date-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#date-alert").hide();
$("#date-alert").hide();
});
$('#vdate').focus().select();
return false;
......@@ -1396,7 +1446,9 @@ $(document).off("change","#invsel").on('change', '#invsel', function(event) {
if (!curdate.between(financialstart,financialend)) {
$("#between-date-alert").alert();
$("#between-date-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#between-date-alert").hide();
$("#between-date-alert").hide();
});
$('#vdate').focus().select();
return false;
......
......@@ -27,6 +27,29 @@
$(document).ready(function() {
//This ajax will call 'Record Cash Memo' Tab with 'status'='in'.
$("#cashmemo_record").click(function() {
$.ajax(
{
type: "POST",
url: "/cashmemos?action=showadd&status=in",
global: false,
async: false,
datatype: "text/html",
beforeSend: function(xhr)
{
xhr.setRequestHeader('gktoken',sessionStorage.gktoken );
},
success: function(resp)
{
$("#cashmemo_div").html(resp);
}
}
);
});
//This ajax will call 'Create cash memo' Tab with 'status'='out'.
$("#cashmemo_create").click(function() {
$.ajax(
{
......@@ -68,7 +91,7 @@ $(document).ready(function() {
);
});
$("#cashmemo_create").click();
$("#cashmemo_record").click();
return false;
});
......@@ -35,60 +35,12 @@ $(document).ready(function()
$("#obal").hide();
$("#openbal").hide();
$("#baltbl").hide();
var sel1 = 0;
var sel2 = 0;
$("#groupname").focus(function() {
sel1 = 1;
});
$("#groupname").blur(function(){
sel1 = 0;
});
$("#subgroupname").focus(function() {
sel2 = 1;
});
$("#subgroupname").blur(function(){
sel2 = 0;
});
$('input:text,select, input:checkbox').keydown( function(event) {
var n = $("input:text:visible,select, input:checkbox").length;
var f = $('input:text:visible,select, input:checkbox');
if (event.which == 13)
{
var nextIndex = f.index(this) + 1;
if(nextIndex < n){
event.preventDefault();
f[nextIndex].focus();
f[nextIndex].select();
}
}
var s2 = $("#subgroupname option:selected").index();
if ((event.which == 38 && sel2 == 1 && s2 == 0) || (event.which == 38 && (sel1 == 0 && sel2==0)))
{
var prevIndex = f.index(this) - 1;
if(prevIndex < n){
event.preventDefault();
f[prevIndex].focus();
f[prevIndex].select();
}
}
});
$("#baltbl").hide();
$("#groupname").focus().select();
$("#accountform").validate();
$("#groupname").bind("change keyup", function(){
var gname = $("#groupname option:selected").text();
if (gname=="Direct Expense" || gname=="Direct Income" || gname=="Indirect Expense" || gname=="Indirect Income")
var gname = $("#groupname option:selected").text();
if (gname=="Direct Expense" || gname=="Direct Income" || gname=="Indirect Expense" || gname=="Indirect Income" || gname=="Select Group")
{
$("#obal").hide();
$("#openbal").hide();
......@@ -155,15 +107,87 @@ $(document).ready(function()
$('#addaccount').click();
}
);
// Keydown event for Opening Balance.
$("#openbal").keydown(function(event){
if (event.which == 13) {
event.preventDefault();
$("#submit").click();
}
});
else if (event.which == 38){
event.preventDefault();
$("#accountname").focus().select();
}
});
// Keydown event for Group Name.
// Validations for Group Name.
$("#groupname").keydown(function(event) {
if(event.which==13 || event.which == 9) {
event.preventDefault();
if ($.trim($("#groupname option:selected").val())=="") {
$("#grpblank-alert").alert();
$("#grpblank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#grpblank-alert").hide();
});
$("#groupname").focus();
$("#groupname").select();
return false;
}
}
if(event.which==13){
event.preventDefault();
$("#subgroupname").focus().select();
}
});
// Keydown event for Sub-Group Name.
$("#subgroupname").keydown(function(event){
if(event.which==13) {
event.preventDefault();
$("#maccounts").focus().select();
}
if (event.which==38 && (document.getElementById('subgroupname').selectedIndex==0)) {
event.preventDefault();
$("#groupname").focus().select();
}
$("#accountform").submit(function(e)
});
// Keydown event for Create Multiple Accounts Checkbox.
$("#maccounts").keydown(function(event){
if(event.which==13) {
event.preventDefault();
$("#accountname").focus().select();
}
else if (event.which == 38){
event.preventDefault();
$("#subgroupname").focus().select();
}
});
// Keydown event for Account Name.
//Validations for Account Name.
$("#accountname").keydown(function(event){
if(event.which==13||event.which==9) {
event.preventDefault();
var gname = $("#groupname option:selected").text(); //Storing selected value from Goup Name dropdown list.
if (gname=="Direct Expense" || gname=="Direct Income" || gname=="Indirect Expense" || gname=="Indirect Income" || gname=="Select Group"){