507 lines
14 KiB
JavaScript
507 lines
14 KiB
JavaScript
var records = new Array(1);
|
|
var recIndx = 0;
|
|
var recpos = 0;
|
|
var currow = 0;
|
|
var lastrow = 0;
|
|
var curopr = 0;
|
|
function ValidateSearch()
|
|
{
|
|
|
|
var keycount=0;
|
|
var port=$("#portlist").val();
|
|
var mvcode=$("#mvcode").val();
|
|
var applno=$("#applno").val();
|
|
var coid=$("#coid").val();
|
|
var bid=$("#bid").val();
|
|
var name=$("#customername").val();
|
|
var scname = $("#scompname").val();
|
|
var saddr = $("#saddress").val();
|
|
|
|
if(mvcode!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(applno!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(name!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(scname!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(saddr!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(keycount==0)
|
|
{
|
|
CallMessage('5005MQRY:error:Please provide MV Code / Appl No. / Name',3000,200,300);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if(checkForm())
|
|
{
|
|
$("#linkdiv").hide();
|
|
LoadingMsg("Loading records please wait...","ajaxmsg");
|
|
RunAjax("GET","queryrecords","val0="+port+"&val1="+mvcode+"&val2="+applno+"&val3="+name+"&val4="+coid+"&val5="+bid+"&val6="+scname+"&val7="+saddr,1);
|
|
}
|
|
}
|
|
}
|
|
function ValidateMDRSSearch()
|
|
{
|
|
var keycount=0;
|
|
var port=$("#portlist").val();
|
|
var mvcode=$("#mvcode").val();
|
|
var applno=$("#applno").val();
|
|
var coid=$("#coid").val();
|
|
var bid=$("#bid").val();
|
|
var name=$("#customername").val();
|
|
if(mvcode!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(applno!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(name!='')
|
|
{
|
|
keycount=keycount+1;
|
|
}
|
|
if(keycount==0)
|
|
{
|
|
CallMessage('5005MQRY:error:Please provide MV Code / Appl No. / Name',3000,200,300);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if(checkForm())
|
|
{
|
|
$("#linkdiv").hide();
|
|
LoadingMsg("Loading records please wait...","ajaxmsg");
|
|
RunAjax("GET","mdrsqueryrecords","val0="+port+"&val1="+mvcode+"&val2="+applno+"&val3="+name+"&val4="+coid+"&val5="+bid,2);
|
|
}
|
|
}
|
|
}
|
|
function AfterResponse(response,oprID)
|
|
{
|
|
if(oprID==1)
|
|
{
|
|
reccount=0;
|
|
if(response.trim().search('Error')==-1)
|
|
{
|
|
response=response.replace(/!C0L!/g,'');
|
|
var rows=response.split(RowDelim);
|
|
for(rindx=0;rindx<rows.length;rindx++)
|
|
{
|
|
var cols=rows[rindx].split(SQLColDelim);
|
|
records[reccount]=new Array(cols.length);
|
|
for(cindx=0;cindx<cols.length;cindx++)
|
|
{
|
|
records[reccount][cindx]=cols[cindx];
|
|
}
|
|
reccount=reccount+1;
|
|
}
|
|
}
|
|
recIndx= reccount==0 ? reccount : reccount-1;
|
|
$("#recfound").html("<b>( 0 / "+(recIndx==0 ? "0" : recIndx)+" )</b>");
|
|
document.forms[1].reset();
|
|
$("#ajaxmsg").remove();
|
|
HideControls(recIndx);
|
|
FillDetails(0);
|
|
}
|
|
if(oprID==2)
|
|
{
|
|
reccount=0;
|
|
if(response.trim().search('Error')==-1)
|
|
{
|
|
response=response.replace(/!C0L!/g,'');
|
|
var rows=response.split(RowDelim);
|
|
for(rindx=0;rindx<rows.length;rindx++)
|
|
{
|
|
var cols=rows[rindx].split(SQLColDelim);
|
|
records[reccount]=new Array(cols.length);
|
|
for(cindx=0;cindx<cols.length;cindx++)
|
|
{
|
|
records[reccount][cindx]=cols[cindx];
|
|
}
|
|
reccount=reccount+1;
|
|
}
|
|
}
|
|
recIndx= reccount==0 ? reccount : reccount-1;
|
|
$("#recfound").html("<b>( 0 / "+(recIndx==0 ? "0" : recIndx)+" )</b>");
|
|
document.forms[1].reset();
|
|
$("#ajaxmsg").remove();
|
|
HideControls(recIndx);
|
|
FillDetails(0);
|
|
$("#hiddendiv").hide();
|
|
}
|
|
if(oprID==101)
|
|
{
|
|
if(response.search('Error')>=0)
|
|
{
|
|
if(response.search('NULST')>=0)
|
|
{
|
|
CallMessage('2001:Info:No records found.',3000,200,300);
|
|
}
|
|
else
|
|
{
|
|
CallMessage('2001:Info:Fetching report editor list failed. '+response,3000,200,300);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
showEditorList(response, "Report Editors");
|
|
}
|
|
}
|
|
if(oprID==106)
|
|
{
|
|
if(response.search('Error')>=0)
|
|
{
|
|
if(response.search('NULST')>=0)
|
|
{
|
|
CallMessage('2001:Info:No records found.',3000,200,300);
|
|
}
|
|
else
|
|
{
|
|
CallMessage('2001:Info:Fetching change history failed. '+response,3000,200,300);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
showChangeList(response);
|
|
}
|
|
}
|
|
if(oprID==102)
|
|
{
|
|
if(response.search('Error')>=0)
|
|
{
|
|
CallMessage('2001LOCK:Info:Fetching contact numbers failed. '+response,3000,200,300);
|
|
}
|
|
else
|
|
{
|
|
showContactNos(response);
|
|
}
|
|
}
|
|
if(oprID==103)
|
|
{
|
|
CallMessage(response,3000,200,300);
|
|
if(curopr==1)
|
|
{
|
|
$("#rptlink").hide();
|
|
$("#cplink").hide();
|
|
$("#cdlink").show();
|
|
$("#bplink").hide();
|
|
$("#hclink").hide();
|
|
$("#sdone").val("0");
|
|
$("#fileclosed").val("0");
|
|
$("#senddate").val("");
|
|
$("#soldate").val("");
|
|
records[recpos][19]="0";
|
|
records[recpos][20]="";
|
|
records[recpos][21]="0";
|
|
records[recpos][22]="";
|
|
}
|
|
else if(curopr==2)
|
|
{
|
|
$("#bplink").hide();
|
|
$("#bdlink").show();
|
|
$("#hclink").hide();
|
|
$("#rptlink").hide();
|
|
$("#senddate").val("");
|
|
records[recpos][21]="0";
|
|
records[recpos][22]="";
|
|
}
|
|
else if(curopr==4 || curopr==5)
|
|
{
|
|
ValidateSearch();
|
|
}
|
|
}
|
|
if(oprID==104)
|
|
{
|
|
CallMessage(response,3000,200,300);
|
|
}
|
|
if(oprID==105)
|
|
{
|
|
if(response.toUpperCase().search("Error")>-1)
|
|
{
|
|
CallMessage(response,3000,200,300);
|
|
}
|
|
else
|
|
{
|
|
var povdetails=response.split(ColDelim);
|
|
POVUpdate(povdetails[0],povdetails[1],povdetails[2],povdetails[3]);
|
|
}
|
|
}
|
|
}
|
|
function HideControls(totrecs)
|
|
{
|
|
if(totrecs >= 1)
|
|
{
|
|
$("#linkdiv").show();
|
|
if(totrecs > 1)
|
|
{
|
|
$("#btnfirst").show();
|
|
$("#btnprev").show();
|
|
$("#btnnext").show();
|
|
$("#btnlast").show();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$("#btnfirst").hide();
|
|
$("#btnprev").hide();
|
|
$("#btnnext").hide();
|
|
$("#btnlast").hide();
|
|
}
|
|
}
|
|
function FillDetails(indx)
|
|
{
|
|
$("#rptlink").hide();
|
|
$("#cplink").hide();
|
|
$("#cdlink").hide();
|
|
$("#bplink").hide();
|
|
$("#bdlink").hide();
|
|
$("#hclink").hide();
|
|
$("#showphotor").hide();
|
|
$("#showphotoo").hide();
|
|
$("#showphotop").hide();
|
|
$("#tdrlink").hide();
|
|
$("#tdolink").hide();
|
|
$("#tdplink").hide();
|
|
//$("#oprdetlink").hide();
|
|
//$("#resendlink").hide();
|
|
if(recIndx > 0)
|
|
{
|
|
$("#uuid").val(records[indx][0]);
|
|
$("#recfound").html("<b>( "+(indx+1)+" / "+recIndx+" )</b>");
|
|
$("#ccode").val(records[indx][27]);
|
|
$("#cbranch").val(records[indx][29]);
|
|
$("#portbranch").val(records[indx][24]);
|
|
$("#mmvcode").val(records[indx][1]);
|
|
$("#mapplno").val(records[indx][2]);
|
|
$("#mcustomername").val(records[indx][3]);
|
|
$("#apptype").val(records[indx][4]);
|
|
$("#category").val(records[indx][5]);
|
|
$("#product").val(records[indx][6]);
|
|
$("#loanamount").val(records[indx][7]);
|
|
$("#contactpers").val(records[indx][8]);
|
|
$("#mmobile").val(records[indx][36]);
|
|
$("#specialinst").val(records[indx][9]);
|
|
$("#rv").val(records[indx][10]);
|
|
$("#ov").val(records[indx][11]);
|
|
$("#pv").val(records[indx][12]);
|
|
$("#rtv").val(records[indx][13]);
|
|
$("#otv").val(records[indx][14]);
|
|
$("#rfv").val(records[indx][68]);
|
|
$("#ear").val(records[indx][65].split('!SEPR!')[0]);
|
|
$("#neg").val(records[indx][66].split('!SEPR!')[0]);
|
|
$("#earrem").val(records[indx][65].split('!SEPR!')[1]);
|
|
$("#negrem").val(records[indx][66].split('!SEPR!')[1]);
|
|
$("#recdate").val(records[indx][15]);
|
|
$("#batch").val(records[indx][16]);
|
|
if(records[indx][17]=='NOT RECOMMENDED')
|
|
{
|
|
$("#fstatus").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$("#fstatus").css('color', 'black');
|
|
}
|
|
$("#fstatus").val(records[indx][17]);
|
|
$("#doneby").val(records[indx][18].split('!SEPR!')[1]);
|
|
if(records[indx][18].length > 0 && records[indx][18].split('!SEPR!')[1].length > 0 && records[indx][19] == 0)
|
|
{
|
|
$("#cdlink").show();
|
|
}
|
|
if(records[indx][73] > 0 && records[indx][21] == 0)
|
|
{
|
|
$("#bdlink").show();
|
|
}
|
|
$("#sdone").val(records[indx][19]);
|
|
$("#fileclosed").val(records[indx][21]);
|
|
$("#portfolio_id").val(records[indx][23]);
|
|
if($("#sdone").val()=='1')
|
|
{
|
|
if($("#usid").val()==21 || $("#usid").val()==81 || $("#usid").val()==84 || ($("#usid").val()==369 && $("#portfolio_id").val()==81) || records[indx][73] == 0)
|
|
{
|
|
$("#cplink").show();
|
|
}
|
|
$("#soldate").val(records[indx][20]);
|
|
}
|
|
if($("#fileclosed").val()=='1')
|
|
{
|
|
$("#senddate").val(records[indx][22]);
|
|
$("#hclink").show();
|
|
$("#rptlink").show();
|
|
$("#bplink").show();
|
|
}
|
|
if(records[indx][10]=='Y')
|
|
{
|
|
$("#raddr").val(records[indx][30]+" "+records[indx][31]+" "+records[indx][32]+" "+records[indx][34]+" "+records[indx][33]);
|
|
$("#rphone").val(records[indx][35]);
|
|
$("#rverifier").val(records[indx][38]);
|
|
$("#rvisdate").val(records[indx][37].split('!SEPR!')[0]);
|
|
$("#rvistime").val(records[indx][37].split('!SEPR!')[1]);
|
|
if(records[indx][37].split('!SEPR!')[2]=='NOT RECOMMENDED' || records[indx][37].split('!SEPR!')[2]=='NEGATIVE')
|
|
{
|
|
$("#rstatus").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$("#rstatus").css('color', 'black');
|
|
}
|
|
$("#rstatus").val(records[indx][37].split('!SEPR!')[2]);
|
|
$("#rnegres").val(records[indx][37].split('!SEPR!')[3]);
|
|
$("#vrremarks").val(records[indx][37].split('!SEPR!')[4]);
|
|
$("#srremarks").val(records[indx][37].split('!SEPR!')[5]);
|
|
}
|
|
if(records[indx][11]=='Y')
|
|
{
|
|
$("#oaddr").val(records[indx][67]+" "+records[indx][39]+" "+records[indx][40]+" "+records[indx][41]+" "+records[indx][43]+" "+records[indx][42]);
|
|
$("#ophone").val(records[indx][44]);
|
|
$("#extn").val(records[indx][45]);
|
|
$("#design").val(records[indx][48]);
|
|
$("#dept").val(records[indx][47]);
|
|
$("#overifier").val(records[indx][49]);
|
|
$("#ovisdate").val(records[indx][46].split('!SEPR!')[0]);
|
|
$("#ovistime").val(records[indx][46].split('!SEPR!')[1]);
|
|
if(records[indx][46].split('!SEPR!')[2]=='NOT RECOMMENDED' || records[indx][46].split('!SEPR!')[2]=='NEGATIVE')
|
|
{
|
|
$("#ostatus").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$("#ostatus").css('color', 'black');
|
|
}
|
|
$("#ostatus").val(records[indx][46].split('!SEPR!')[2]);
|
|
$("#onegres").val(records[indx][46].split('!SEPR!')[3]);
|
|
$("#voremarks").val(records[indx][46].split('!SEPR!')[4]);
|
|
$("#soremarks").val(records[indx][46].split('!SEPR!')[5]);
|
|
}
|
|
if(records[indx][12]=='Y')
|
|
{
|
|
$("#paddr").val(records[indx][50]+" "+records[indx][51]+" "+records[indx][52]+" "+records[indx][54]+" "+records[indx][53]);
|
|
$("#pverifier").val(records[indx][56]);
|
|
$("#pvisdate").val(records[indx][55].split('!SEPR!')[0]);
|
|
$("#pvistime").val(records[indx][55].split('!SEPR!')[1]);
|
|
if(records[indx][55].split('!SEPR!')[2]=='NOT RECOMMENDED' || records[indx][55].split('!SEPR!')[2]=='NEGATIVE')
|
|
{
|
|
$("#pstatus").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$("#pstatus").css('color', 'black');
|
|
}
|
|
$("#pstatus").val(records[indx][55].split('!SEPR!')[2]);
|
|
$("#pnegres").val(records[indx][55].split('!SEPR!')[3]);
|
|
$("#vpremarks").val(records[indx][55].split('!SEPR!')[4]);
|
|
$("#spremarks").val(records[indx][55].split('!SEPR!')[5]);
|
|
}
|
|
if(records[indx][13]=='Y' || records[indx][14]=='Y')
|
|
{
|
|
$("#trphone").val(records[indx][35]);
|
|
$("#tophone").val(records[indx][44]);
|
|
$("#textn").val(records[indx][45]);
|
|
$("#tmobile").val(records[indx][36]);
|
|
$("#tcaller").val(records[indx][57].split('!SEPR!')[0]);
|
|
$("#trcont").val(records[indx][57].split('!SEPR!')[1]);
|
|
$("#tocont").val(records[indx][57].split('!SEPR!')[2]);
|
|
if(records[indx][57].split('!SEPR!')[3]=='UNSATISFACTORY')
|
|
{
|
|
$("#trstatus").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$("#trstatus").css('color', 'black');
|
|
}
|
|
$("#trstatus").val(records[indx][57].split('!SEPR!')[3]);
|
|
if(records[indx][57].split('!SEPR!')[4]=='UNSATISFACTORY')
|
|
{
|
|
$("#tostatus").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$("#tostatus").css('color', 'black');
|
|
}
|
|
$("#tostatus").val(records[indx][57].split('!SEPR!')[4]);
|
|
$("#rtremarks").val(records[indx][57].split('!SEPR!')[5]);
|
|
$("#otremarks").val(records[indx][57].split('!SEPR!')[6]);
|
|
}
|
|
if(records[indx][68]=='Y')
|
|
{
|
|
$("#ref1name").val(records[indx][58]);
|
|
$("#ref2name").val(records[indx][61]);
|
|
$("#ref1addr").val(records[indx][59]);
|
|
$("#ref2addr").val(records[indx][62]);
|
|
$("#ref1cont").val(records[indx][60]);
|
|
$("#ref2cont").val(records[indx][63]);
|
|
$("#refcaller").val(records[indx][64].split('!SEPR!')[0]);
|
|
$("#ref1status").val(records[indx][64].split('!SEPR!')[1]);
|
|
$("#ref2status").val(records[indx][64].split('!SEPR!')[3]);
|
|
$("#ref1remarks").val(records[indx][64].split('!SEPR!')[2]);
|
|
$("#ref2remarks").val(records[indx][64].split('!SEPR!')[4]);
|
|
}
|
|
if(records[indx][70] > 0)
|
|
{
|
|
$("#showphotor").show();
|
|
$("#tdrlink").show();
|
|
}
|
|
if(records[indx][71] > 0)
|
|
{
|
|
$("#showphotoo").show();
|
|
$("#tdolink").show();
|
|
}
|
|
if(records[indx][72] > 0)
|
|
{
|
|
$("#showphotop").show();
|
|
$("#tdplink").show();
|
|
}
|
|
$("#cid").val(records[indx][69]);
|
|
}
|
|
else
|
|
{
|
|
CallMessage('5005MQRY:error:No records found',3000,200,300);
|
|
}
|
|
}
|
|
function findRecord(arrOpr)
|
|
{
|
|
tempPos= recpos;
|
|
maxLen= recIndx-1;
|
|
if ($("#inptDialog").length > 0)
|
|
{
|
|
$("#inptDialog").remove();
|
|
}
|
|
if(arrOpr==1) tempPos=0;
|
|
if(arrOpr==2)
|
|
{
|
|
if(tempPos>0) tempPos=tempPos-1;
|
|
else return false;
|
|
}
|
|
if(arrOpr==3)
|
|
{
|
|
if(tempPos<maxLen) tempPos=tempPos+1;
|
|
else return false;
|
|
}
|
|
if(arrOpr==4) tempPos=maxLen;
|
|
recpos= tempPos;
|
|
document.forms[1].reset();
|
|
FillDetails(recpos);
|
|
}
|
|
function showReport()
|
|
{
|
|
QueryStr="rand="+Math.round(Math.random()*4+1)+"&uuid="+($("#suuid").val())+"&cid="+($("#cid").val());
|
|
OpenMatrixDialog("openrep?"+QueryStr,"Report");
|
|
}
|
|
function tagDocs(vtype)
|
|
{
|
|
var uuid=$("#uuid").val();
|
|
QueryStr="rand="+Math.round(Math.random()*4+1)+"&uuid="+uuid+"&type="+vtype+"&pid="+($("#portfolio_id").val())+"&photo=1&mvcode="+($("#mvcode").val());
|
|
OpenMatrixDialog("tagdocs?"+QueryStr,"Tag Documents");
|
|
}
|