Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.15.225.164
var fldorder = '';
var mandfields = '';
function onfocusvalidate(event)
{
function processkey3()
{
}
document.body.onkeydown = processkey3;
forder = {};
mfields = {};
if(fldorder.length == fldorder.lastIndexOf(",")+1)
var tflorder = fldorder.substring(0, fldorder.length - 1);
else
var tflorder = fldorder;
if(mandfields.length == mandfields.lastIndexOf(",")+1)
var tmfields = mandfields.substring(0, mandfields.length - 1);
else
var tmfields = mandfields;
var forder = tflorder.split(',');
var mfields = tmfields.split(',');
if ( event.keyCode == 9 )
{
event.preventDefault();
event.stopPropagation();
}
if(event.keyCode == 13)
{
var focusid = document.activeElement.id;
return formcontrol(forder,mfields,focusid);
}
/* if(event.keyCode == 9)
{
var focusid = document.activeElement.id;
return formcontrol(forder,mfields,focusid);
} */
if(event.keyCode == 38)
{
var focusid = document.activeElement.id;
var Tindex = forder.indexOf(focusid);
if(Tindex > 0)
document.getElementById(forder[Tindex-1]).focus();
}
if(event.keyCode == 40)
{
var focusid = document.activeElement.id;
var Tindex = forder.indexOf(focusid);
if(Tindex > 0 && Tindex< forder.length-1)
document.getElementById(forder[Tindex+1]).focus();
}
}
function onsavevalidate(lobj,lval)
{
forder = {};
msfields = {};
findex = {};
if(mandfields.length == mandfields.lastIndexOf(",")+1)
var mdfields = mandfields.substring(0, mandfields.length - 1);
else
var mdfields = mandfields;
var msfields = mdfields.split(',');
var validateStr ='';
var findex = new Array();
for(var i=0,j=0;i<msfields.length;i++)
{
if(trim(document.getElementById(msfields[i]).value) == '')
{
findex[j]=msfields[i];
fieldtitle = document.getElementById(msfields[i]).title;
fieldtitlearr = fieldtitle.split(',');
validateStr += fieldtitlearr[0]+'\r\n';
j++;
}
}
if(validateStr != '')
{
alert("Following fields are missing / invalid\r\n\r\n"+validateStr);
document.getElementById(findex[0]).focus();
return findex[0];
}
else
{
return 999;
}
}
function formcontrol(fcorder,mffields,lastfocus)
{
var Tindex = mffields.indexOf(lastfocus);
if(Tindex != -1)
{
if(trim(document.getElementById(lastfocus).value) =='')
{
fieldtitle = document.getElementById(lastfocus).title;
fieldtitlearr = fieldtitle.split(',');
alert("Enter " +fieldtitlearr[0]);
document.getElementById(lastfocus).focus();
return lastfocus;
}
else
{
var Tcurrindex = fcorder.indexOf(lastfocus);
if(Tcurrindex < fcorder.length-1)
{
document.getElementById(fcorder[Tcurrindex+1]).focus();
return 999;
}
else
{
return 999;
}
}
}
else
{
var Tcurrindex = fcorder.indexOf(lastfocus);
if(Tcurrindex < fcorder.length-1)
{
document.getElementById(fcorder[Tcurrindex+1]).focus();
return false;
}
else
{
return 999;
}
}
}
var GTName='';
var GTFields;
var GTSFields = new Array();
var GTLeftFields = new Array();
var GTWhere ;
var GTTwidth;
var GTColwidth;
var GTHeader;
var GTColcnt;
var GTFirst;
var GPK;
function srchHeaderGrid(TName,TFields,TWhere,TTwidth,TColwidth,THeader,TColcnt,TPK)
{
var event = '';
var id = '' ;
GTFirst = true;
GTName = TName;
GTFields = TFields;
GTWhere = TWhere;
GTTwidth = TTwidth;
GTColwidth = TColwidth;
GTHeader = THeader;
GTColcnt = TColcnt;
GPK = TPK;
var tabHeader ='';
tabHeader +="<table class='scroll' align='center' width='"+TTwidth+"px' cellspacing='0' cellpadding='0' border='0px' id='item_table' >";
tabHeader +="<tr class='ui-state-default ui-jqgrid-hdiv'>";
for(var hindex=0;hindex<TColcnt;hindex++)
tabHeader +="<td style='padding:2px; width:"+TColwidth[hindex]+"px; text-align:center;border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>"+THeader[hindex]+"</td>";
tabHeader +="</tr><tr>";
tabHeader +="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>";
tabHeader +="<input style='width:"+TColwidth[0]+"px;' class='form-control input-md'/></td>";
for(var hindex=0;hindex<TColcnt-1;hindex++)
{
var srchid = TFields[hindex].toUpperCase();
var strext = srchid.search(' AS ');
if(strext > 0)
{
var strid = srchid.split(' AS ');
GTSFields[hindex] = strid[1];
GTLeftFields[hindex] = strid[0].toLowerCase();
}
else
{
GTSFields[hindex] = srchid;
GTLeftFields[hindex] = srchid;
}
tabHeader +="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>";
tabHeader +="<input id='"+GTLeftFields[hindex]+"' style='width:"+TColwidth[hindex+1]+"px;' onkeyup='srchDetailGrid(event,this.id);' value ='' class='form-control input-md'/></td>";
}
tabHeader +="</tr></table><div id='dynamicrow'></div>";
document.getElementById('grid_view').innerHTML =tabHeader;
$("#grid_view").show();
srchDetailGrid(event,id);
document.getElementById(GTLeftFields[0]).focus();
return false;
}
function srchDetailGrid(event,id)
{
if(event.keyCode!=38 && event.keyCode != 40 && event.keyCode != 13)
{
var fckempty = '';
var srcfield='';
var srchKeyqry = '';
for(var i=0;i<GTColcnt-1;i++)
{ var fckempty = trim(document.getElementById(GTLeftFields[i]).value);
if(fckempty.length >0 && fckempty.length !=0)
srchKeyqry += " and "+GTLeftFields[i]+" like "+"'"+document.getElementById(GTLeftFields[i]).value+"%'";
}
if(trim(srchKeyqry).length > 0 || GTFirst==true )
{
var dataString = '&TName='+GTName+'&TFields='+GTFields+"&TWhere="+GTWhere+"&TColcnt="+GTColcnt+"&srchKeyqry="+srchKeyqry;
$.ajax({
type:"POST",
url:$host_url+"srchDetailGrid",
data:dataString,
cache:false,
success:function($responce)
{
$responce=eval('('+ $responce+')');
if($responce.error_code==0)
{
if(trim(srchKeyqry).length >= 1)
GTFirst=true;
else
GTFirst=false;
var modulename = document.getElementById('module_name_for_save').value;
var count=$responce.data.length;
var new_row ='';
var arrIndex = 0;
new_row +="<div class='CSSTableGenerator'><table class='scroll' align='center' width=''"+GTTwidth+"px' cellspacing='0' cellpadding='0' border='0px' id='mstrTable' >";
for(var rows=0;rows< count;rows++)
{
var index = rows+1;
var rowdt = $responce.data[rows];
lsupcode = rowdt[GTSFields[0]];
catcode = rowdt[GTSFields[1]];
feecode = rowdt[GTSFields[2]];
if(modulename == 'HeadFee')
click = "ondblclick = edit"+modulename+"Master('"+lsupcode+"','"+catcode+"','"+feecode+"')";
else
click = "ondblclick = edit"+modulename+"Master('"+lsupcode+"')";
new_row +="<tr id="+lsupcode+" "+click+" "+" onkeydown='processkey()'>";
new_row +="<td style='width:"+GTColwidth[0]+"px;text-align:center;border:1px solid #C5DBEC;padding:5px' >"+index+"</td>";
for(var i=0;i<GTColcnt-1;i++)
{
var rowfname = GTSFields[i];
new_row +="<td style='width:"+GTColwidth[i+1]+"px;padding:5px;border:1px solid #C5DBEC;' >"+rowdt[rowfname] +"</td>";
}
new_row +="</tr>";
}
new_row +="</table></div>";
document.getElementById('dynamicrow').innerHTML = new_row;
var trows = document.getElementById('mstrTable').rows;
var t = trows.length;
var trow;
function processkey(e){
if(document.getElementById('is_add_edit').value == 'view')
{
e = e || event;
switch(e.keyCode){
case 38: {//up arrow
return movehighlightUP(-1, e);
}
case 40: {//down arrow
return movehighlight(1, e);
}
case 13:{
return selecthighlight(1, e);
}
default: {
return true;
}
}
}
}
while (--t > -1) {
trow = trows[t];
trow.className = 'normal';
//trow.onclick = highlightRow;
}//end while
function highlightRow(gethighlight) {
gethighlight = gethighlight === true;
var t = trows.length, hrow;
while (--t > -1) {
trow = trows[t];
if(gethighlight && trow.className === 'highlighted'){ return t;}
else if (!gethighlight && trow !== this) { trow.className = 'normal'; }
}//end while
return gethighlight? null : this.className = this.className === 'highlighted'? 'normal' : 'highlighted';
}//end function
function movehighlight(way, e){
//e.preventDefault && e.preventDefault();
//e.returnValue = false;
var idx = highlightRow(true), nextrow;
if(typeof idx === 'number'){
idx += way;
if(idx && (nextrow = trows[idx])){ return highlightRow.apply(nextrow); }
else if(idx){ return highlightRow.apply(trows[0]); }
return highlightRow.apply(trows[trows.length - 1]);
}
return highlightRow.apply(trows[way > 0? 0 : trows.length-1]);
}
function movehighlightUP(way, e){
//e.preventDefault && e.preventDefault();
//e.returnValue = false;
var idx = highlightRow(true), nextrow;
if(typeof idx === 'number'){
if(idx !=1)
idx += way;
else
{
return highlightRow.apply(trows[0]);
}
if(idx && (nextrow = trows[idx])){ return highlightRow.apply(nextrow); }
else if(idx){ return highlightRow.apply(trows[0]); }
return highlightRow.apply(trows[trows.length - 1]);
}
return highlightRow.apply(trows[way > 0 ? 0 :trows.length-1]);
}
function selecthighlight(way, e){
//e.preventDefault && e.preventDefault();
e.returnValue = false;
gethighlight=true;
gethighlight = gethighlight === true;
var t = trows.length, hrow;
while (--t > -1) {
trow = trows[t];
if(gethighlight && trow.className === 'highlighted'){
method_prefix = "edit"+modulename+"Master";
window[method_prefix](trow.id);
exit();
}
}
}
document.body.onkeydown = processkey;
/* var t = trows.length;
while (--t > -1) {
trow = trows[t];
alert(trow.id);
document.getElementById(trow.id).onkeydown = processkey;
}//
document.getElementById('mstrTable').onkeydown = processkey; */
}
else
{
var new_row ='';
GTFirst=true;
document.getElementById('dynamicrow').innerHTML = new_row;
}
}
});
}
}
}
var PGTName='';
var PGDbclick ='';
var PGTFields;
var PGTSFields = new Array();
var PGTLeftFields = new Array();
var PGTWhere ;
var PGTTwidth;
var PGTColwidth
var PGTHeader;
var PGTColcnt;
var GTFirst;
function srchPOPHeaderGrid(PTName,PTFields,PTWhere,PDbclick,PTTwidth,PTColwidth,PTHeader,PTColcnt)
{
var event ='';
var id = '';
GTFirst = true;
PGTName = PTName;
PGTFields = PTFields;
PGTWhere = PTWhere;
PGDbclick = PDbclick;
PGTTwidth = PTTwidth;
PGTColwidth = PTColwidth;
PGTHeader = PTHeader;
PGTColcnt = PTColcnt;
var tabHeader ='';
tabHeader +="<table class='scroll' align='center' width='"+PTTwidth+"px' cellspacing='0' cellpadding='0' border='0px' id='item_table' >";
tabHeader +="<tr class='ui-state-default ui-jqgrid-hdiv'>";
for(var hindex=0;hindex<PTColcnt;hindex++)
tabHeader +="<td style='padding:2px; width:"+PTColwidth[hindex]+"px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>"+PTHeader[hindex]+"</td>";
tabHeader +="</tr><tr>";
tabHeader +="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>";
tabHeader +="<input style='width:"+PTColwidth[0]+"px;' class='form-control input-md'/></td>";
for(var hindex=0;hindex<PTColcnt-1;hindex++)
{
var srchid = PTFields[hindex].toUpperCase();
var strext = srchid.search(' AS ');
if(strext > 0)
{
var strid = srchid.split(' AS ');
PGTSFields[hindex] = strid[1];
PGTLeftFields[hindex] = strid[0].toLowerCase();
}
else
{
PGTSFields[hindex] = srchid;
PGTLeftFields[hindex] = srchid;
}
tabHeader +="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>";
tabHeader +="<input id='"+PGTLeftFields[hindex]+"' style='width:"+PTColwidth[hindex+1]+"px;' onkeyup='srchPopupDetailGrid(event,this.id)' class='form-control input-md'/></td>";
}
tabHeader +="</tr></table><div id='dynamicrow'></div>";
document.getElementById('popupgrid_view').innerHTML =tabHeader;
$("#popupgrid_view").show();
document.getElementById(PGTLeftFields[0]).focus();
srchPopupDetailGrid(event,id);
}
function srchPopupDetailGrid(event,id)
{
if(event.keyCode!=38 && event.keyCode != 40 && event.keyCode != 13)
{
var srcfield='';
var srchKeyqry = '';
for(var i=0;i<PGTColcnt-1;i++)
{
if(trim(document.getElementById(PGTLeftFields[i]).value) != '')
srchKeyqry += " and "+PGTLeftFields[i]+" like "+"'"+document.getElementById(PGTLeftFields[i]).value+"%'";
}
if(trim(PGTWhere).length > 0)
{
var dataString = '&TName='+PGTName+'&TFields='+PGTFields+"&TWhere="+PGTWhere+"&TColcnt="+PGTColcnt+"&srchKeyqry="+srchKeyqry;
$.ajax({
type:"POST",
url:$host_url+"srchDetailGrid",
data:dataString,
cache:false,
success:function($responce)
{
$responce=eval('('+ $responce+')');
if($responce.error_code==0)
{
//loadDynamicSrchTable($responce.data);
var modulename = document.getElementById('module_name_for_save').value;
var count=$responce.data.length;
var new_row ='';
GTFirst=false;
var arrIndex = 0;
new_row +="<div class='CSSTableGenerator' ><table class='scroll' align='center' onkeydown ='processkey()' width=''"+PGTTwidth+"px' cellspacing='0' cellpadding='0' border='0px' id='mstrTable1' >";
for(var rows=0;rows< count;rows++)
{
var index = rows+1;
var rowdt = $responce.data[rows];
new_row +="<tr id ='"+rowdt[PGTSFields[0]]+"' ondblclick=select"+PGDbclick+"('"+rowdt[PGTSFields[0]]+"') >";
new_row +="<td style='width:"+PGTColwidth[0]+"px;text-align:center;border:1px solid #C5DBEC;padding:5px' >"+index+"</td>";
for(var i=0;i<PGTColcnt-1;i++)
{
var rowfname = PGTSFields[i];
new_row +="<td style='width:"+PGTColwidth[i+1]+"px;padding:5px;border:1px solid #C5DBEC;' >"+rowdt[rowfname] +"</td>";
}
new_row +="</tr>";
}
new_row +="</table></div>";
document.getElementById('dynamicrow').innerHTML = new_row;
var trows = document.getElementById('mstrTable1').rows;
var t = trows.length;
var trow;
while (--t > -1) {
trow = trows[t];
trow.className = 'normal';
//trow.onclick = highlightRow;
}//end while
function highlightRow(gethighlight) {
gethighlight = gethighlight === true;
var t = trows.length, hrow;
while (--t > -1) {
trow = trows[t];
if(gethighlight && trow.className === 'highlighted'){ return t;}
else if (!gethighlight && trow !== this) { trow.className = 'normal'; }
}//end while
return gethighlight? null : this.className = this.className === 'highlighted'? 'normal' : 'highlighted';
}//end function
function movehighlight(way, e){
//e.preventDefault && e.preventDefault();
//e.returnValue = false;
var idx = highlightRow(true), nextrow;
if(typeof idx === 'number'){
idx += way;
if(idx && (nextrow = trows[idx])){ return highlightRow.apply(nextrow); }
else if(idx){ return highlightRow.apply(trows[0]); }
return highlightRow.apply(trows[trows.length - 1]);
}
return highlightRow.apply(trows[way > 0? 0 : trows.length-1]);
}
function movehighlightUP(way, e){
//e.preventDefault && e.preventDefault();
//e.returnValue = false;
var idx = highlightRow(true), nextrow;
if(typeof idx === 'number'){
if(idx !=1)
idx += way;
else
{
return highlightRow.apply(trows[0]);
}
if(idx && (nextrow = trows[idx])){ return highlightRow.apply(nextrow); }
else if(idx){ return highlightRow.apply(trows[0]); }
return highlightRow.apply(trows[trows.length - 1]);
}
return highlightRow.apply(trows[way > 0 ? 0 :trows.length-1]);
}
function selecthighlight(way, e){
//e.preventDefault && e.preventDefault();
//e.returnValue = false;
gethighlight=true;
gethighlight = gethighlight === true;
var t = trows.length;
var trow;
while (--t > -1)
{
var trow = trows[t];
if(gethighlight && trow.className === 'highlighted')
{
method_prefix = "select"+PGDbclick;
window[method_prefix](trow.id);
return 0;
}
}
}
function processkey2()
{
}
function processkey(e){
e = e || event;
switch(e.keyCode){
case 38: {//up arrow
return movehighlightUP(-1, e);
}
case 40: {//down arrow
return movehighlight(1, e);
}
case 13:{
document.body.onkeydown = processkey2;
return selecthighlight(1, e);
}
default: {
return true;
}
}
}
document.body.onkeydown = processkey;
}
else
{
var new_row ='';
document.getElementById('dynamicrow').innerHTML = new_row;
}
}
});
}
}
}
function processkey2()
{
}
////// open file in html page and link to print
function viewReportToPrint(report_filename)
{
url = 'printpreview.html';
var win = window.open(url, '_blank');
setCookie('reporturl',report_filename);
}
|