142 lines
5.1 KiB
JavaScript
142 lines
5.1 KiB
JavaScript
var childCnt='';
|
|
var curProc='ear';
|
|
var curStatus='Waiting';
|
|
|
|
function ExpandList(elmId)
|
|
{
|
|
$("#"+elmId+"child").toggle();
|
|
}
|
|
function showDedupePanel(cutList)
|
|
{
|
|
var optDiv=document.createElement("div");
|
|
optDiv.setAttribute("id","FormPanel");
|
|
optDiv.setAttribute("class","FormPanel");
|
|
optDiv.setAttribute("style","font-family:Tahoma;overflow:visible;padding-right:3px;width:480px");
|
|
var ControlsPanel="<table border='0' cellspacing='0' width='100%' class='matrix-form-controls'>";
|
|
ControlsPanel=ControlsPanel+"<tr><td style='height:5px;width:210px'></td><td></td></tr>";
|
|
ControlsPanel=ControlsPanel+"<tr><td id='tdearlabel' style='height:35px;padding-left:15px;font-weight:normal;font-size:13px' valign='center'>Checking for Earlier</td><td id='tdearrun' height='30' valign='center' style='font-weight:normal;font-size:13px'><font color='#fe8900'>Waiting...</font></td></tr>";
|
|
ControlsPanel=ControlsPanel+"<tr><td id='tdneglabel' style='height:35px;font-weight:normal;padding-left:15px;font-size:13px' valign='center'>Checking for Negative</td><td id='tdnegrun' height='30' valign='center' style='font-weight:normal;font-size:13px'><font color='#fe8900'>Waiting...</font></td></tr>";
|
|
ControlsPanel=ControlsPanel+"<tr><td colspan='2'><input type='button' class='button' name='btncancel' style='margin-top:5px;float:right' value='Close' id='btncancel' accesskey='C' onclick=\"RemoveDialog(document.getElementById('ProcDialog'))\" /> <input type='button' class='button' name='btnstart' style='margin-top:5px;float:right' value='Start' id='btnstart' accesskey='S' onclick=\"StartDedupeRun('"+cutList+"',document.getElementById('ProcDialog'))\" /></td></tr>";
|
|
ControlsPanel=ControlsPanel+"</table>";
|
|
optDiv.innerHTML=ControlsPanel;
|
|
ShowInputDialog(optDiv,"Checking Earlier and Negative","dedupe","ProcDialog");
|
|
}
|
|
function StartDedupeRun(cutList,ProcDialog)
|
|
{
|
|
StartEarlierRun(cutList);
|
|
}
|
|
function StartEarlierRun(cutList)
|
|
{
|
|
curProc='ear';
|
|
curStatus='Checking for Earlier';
|
|
var label="<img src='/matrix/images/arrow_green_r.png' align='absmiddle'/> <font color='black'><b>"+curStatus+"</b></font>";
|
|
$("#tdearlabel").html(label);
|
|
ProgressBar("tdearrun","Record",cutList,12,"REGULAR");
|
|
StartDedupeProcess(cutList,'ear',1);
|
|
}
|
|
function StartNegativeRun(cutList)
|
|
{
|
|
curProc='neg';
|
|
curStatus='Checking for Negative';
|
|
var label="<img src='/matrix/images/arrow_green_r.png' align='absmiddle'/> <font color='black'><b>"+curStatus+"</b></font>";
|
|
$("#tdneglabel").html(label);
|
|
ProgressBar("tdnegrun","Record",cutList,12,"REGULAR");
|
|
StartDedupeProcess(cutList,'neg',2);
|
|
}
|
|
function updateLabels(Proc)
|
|
{
|
|
var label="<img src='/matrix/images/check.png' align='absmiddle'/> <font color='black'><b>"+curStatus+"</b></font>";
|
|
$("#td"+Proc+"label").html(label);
|
|
$("#td"+Proc+"run").html("<font size='1'>Processed : <b>"+nextPos+"</b> Success : <font color='green'><b>"+success+"</b></font> Failed : <font color='red'><b>"+failed+"</b></font> Skipped : <font color='blue'><b>"+skipped+"</b></font></font>");
|
|
}
|
|
function StartDedupeProcess(cutList,Childid,OprID)
|
|
{
|
|
success=0;
|
|
failed=0;
|
|
nextPos=1;
|
|
skipped=0;
|
|
progresswidth=0;
|
|
curPos=1;
|
|
SourceTable=cutList;
|
|
RowId='';
|
|
found=$("#"+SourceTable+" tr").length-1;
|
|
progbarwidth=$("#progressbar").width();
|
|
ProgPerRec=(progbarwidth/found).toFixed(2);
|
|
if(found>0)
|
|
{
|
|
ExtractSendRecord(Childid,OprID);
|
|
}
|
|
else
|
|
{
|
|
CallMessage('EMPTOBX:info:List is empty or already processed.',3000,200,300);
|
|
}
|
|
}
|
|
function ExtractSendRecord(Childid,oprId)
|
|
{
|
|
RowId=$("#"+SourceTable+" tr:eq("+curPos+")").attr("id").replace("row","");
|
|
var uuid=$("#uuid"+RowId).val();
|
|
var process=$("#row"+RowId+""+Childid);
|
|
var val3=$("#curu").val();
|
|
childCnt=Childid;
|
|
if($(process).val()=="Y")
|
|
{
|
|
QryStr="val="+uuid+"&val1="+oprId+"&val2=Y&val3="+val3;
|
|
RunAjax("GET","checkdedupe",QryStr,oprId);
|
|
}
|
|
else
|
|
{
|
|
AfterResponse('skipped:',oprId);
|
|
}
|
|
}
|
|
function AfterResponse(AjaxResponse,OprID)
|
|
{
|
|
if(OprID==1 || OprID==2)
|
|
{
|
|
if(AjaxResponse.search("success:")==0)
|
|
{
|
|
success=success+1;
|
|
$("#td"+RowId+""+childCnt).attr("bgcolor", '#a6fc8e');
|
|
$("#sp"+RowId+""+childCnt).html("D");
|
|
$("#row"+RowId+""+childCnt).val("D");
|
|
}
|
|
else if(AjaxResponse.search("skipped:")==0)
|
|
{
|
|
skipped=skipped+1;
|
|
/*if(OprID==1)
|
|
{
|
|
curPos=curPos+1;
|
|
}
|
|
else
|
|
{
|
|
$("#row"+RowId).remove();
|
|
}*/
|
|
}
|
|
else
|
|
{
|
|
failed=failed+1;
|
|
///$("#imgstatus"+RowId).attr("src", "/matrix/images/smsfailed.png");
|
|
$("#row"+RowId).attr("title", AjaxResponse);
|
|
$("#sp"+RowId+""+childCnt).html("F");
|
|
$("#td"+RowId+""+childCnt).attr("bgcolor", "#ffcabf");
|
|
}
|
|
if((nextPos==found))
|
|
{
|
|
if(OprID==1)
|
|
{
|
|
curStatus='Earlier Check Completed.';
|
|
updateLabels(curProc);
|
|
StartNegativeRun(SourceTable);
|
|
}
|
|
else
|
|
{
|
|
curStatus='Negative Check Completed.';
|
|
updateLabels(curProc);
|
|
}
|
|
return 0;
|
|
}
|
|
curPos=curPos+1;
|
|
UpdateProgress();
|
|
nextPos=nextPos+1;
|
|
ExtractSendRecord(childCnt,OprID);
|
|
}
|
|
} |