398d70ff by Yashwant

Login Report changes

1 parent 4079cd55
......@@ -21,7 +21,7 @@ $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logt
$campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "All";
// testing input
// $logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-03 ".$logtime.":00:00");$logdateto = strtotime("2017-10-03 ".$logtimeto.":00:00");$campaign = 'All';
$logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-03 ".$logtime.":00:00");$logdateto = strtotime("2017-10-03 ".$logtimeto.":00:00");$campaign = 'All';
// testing input
$alist=CRMCallArchive::where('user_id','!=',0)->where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset));
......@@ -49,7 +49,7 @@ if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="")
}
$breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime");
$reporthead=array_merge(array("#","Telecaller","TelecallerID","Supervisor","Sessions","CallCount","Duration","Total","Wait","Call","Talk","Dispo","P-Call","P-Talk","P-Dispo","M-Call","M-Talk","M-Dispo","I-Call","I-Talk","I-Dispo"),$breaks);
$reporthead=array_merge(array("#","Telecaller","TelecallerID","Supervisor","Sessions","CallCount","SessionTotal","Total","Wait","Call","Talk","Dispo","ProgressiveTotal","P-Call","P-Talk","P-Dispo","ManualTotal","M-Call","M-Talk","M-Dispo","IncomingTotal","I-Call","I-Talk","I-Dispo","PausedTotal"),$breaks);
$reportarray=array();
$i=1;
......@@ -113,6 +113,7 @@ foreach($alist as $aline)
$reportarray[$userid]["P-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["P-Talk"]+=$talktime/1000;
$reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000;
$reportarray[$userid]["ProgressiveTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000);
}
if($aline->type == 'Manual')
......@@ -120,6 +121,7 @@ foreach($alist as $aline)
$reportarray[$userid]["M-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["M-Talk"]+=$talktime/1000;
$reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000;
$reportarray[$userid]["ManualTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000);
}
if($aline->type == 'Inbound')
......@@ -127,6 +129,7 @@ foreach($alist as $aline)
$reportarray[$userid]["I-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["I-Talk"]+=$talktime/1000;
$reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000;
$reportarray[$userid]["IncomingTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000);
}
}
$reportarray[$userid]["CallCount"]++;
......@@ -182,9 +185,8 @@ if(count($userLogin)) foreach ($userLogin as $userid => $value)
$break_time=0;
foreach ($breaks as $break) {
$break_time+=$reportarray[$userid][$break];
$reportarray[$userid]["PausedTotal"]+=$reportarray[$userid][$break];
}
// print_r($value);
$sessionsStr = "";
for($i = 0; $i < count($value['start']); $i++){
if($sessionsStr == ""){
......@@ -192,26 +194,25 @@ if(count($userLogin)) foreach ($userLogin as $userid => $value)
}else{
$sessionsStr .= ",\n".date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset);
}
}
// echo $sessionsStr."<br>-----------<br>";
}
$reportarray[$userid]["Sessions"]=$sessionsStr;
// $reportarray[$userid]["Signin"]=date("Y-m-d H:i:s", min($value['start'])-$timeoffset);
// $reportarray[$userid]["Signout"]=date("Y-m-d H:i:s", max($value['end'])-$timeoffset);
$reportarray[$userid]["Duration"]=$value['duration'];
$reportarray[$userid]["SessionTotal"]=$value['duration'];
$reportarray[$userid]["Total"]=$value['duration']-$break_time;
$reportarray[$userid]["Wait"]=$reportarray[$userid]["Total"]-$reportarray[$userid]['oncall'];
}
// echo "<pre>"; print_r($userLogin);
// exit;
$highestColumn = sizeof($reporthead);
if(count($reportarray)) {
$outhead="<tr>";$outstr="";
for ($head = 0; $head < $highestColumn; $head++){
if($reporthead[$head] == "Sessions"){
$outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>";
}elseif($reporthead[$head] == "PausedTotal" || $reporthead[$head] == "ProgressiveTotal" || $reporthead[$head] == "ManualTotal" || $reporthead[$head] == "IncomingTotal"){
$outhead.="<td class='warning'>".$reporthead[$head]."</td>";
}elseif($reporthead[$head] == "Paused"){
$outhead.="<td>ManualPaused</td>";
}else{
$outhead.="<td>".$reporthead[$head]."</td>";
}
......@@ -222,7 +223,7 @@ if(count($reportarray)) {
$reportRowNo = 1;
foreach($reportarray as $uid=>$uarr)
{
if(array_key_exists('Duration',$uarr) && array_key_exists('TelecallerID',$uarr))
if(array_key_exists('SessionTotal',$uarr) && array_key_exists('TelecallerID',$uarr))
{
$outstr.="<tr>";
for ($head = 0; $head < $highestColumn; $head++){
......@@ -240,7 +241,11 @@ if(count($reportarray)) {
$data_str = secToDuration(round($uarr[$reporthead[$head]]));
$utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
}
$outstr.="<td>".$data_str."</td>";
if($head == 12 || $head == 16 || $head == 20 || $head == 24){
$outstr.="<td class='warning'>".$data_str."</td>";
}else{
$outstr.="<td>".$data_str."</td>";
}
}
$outstr.="</tr>";
}
......@@ -254,7 +259,11 @@ if(count($reportarray)) {
else {
$data_str = secToDuration($utotalarr[$reporthead[$head]]);
}
$outstr.="<td>".$data_str."</td>";
if($head == 12 || $head == 16 || $head == 20 || $head == 24){
$outstr.="<td class='warning'>".$data_str."</td>";
}else{
$outstr.="<td>".$data_str."</td>";
}
}
$outstr.="</tr>";
} else {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!