398d70ff by Yashwant

Login Report changes

1 parent 4079cd55
...@@ -21,7 +21,7 @@ $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logt ...@@ -21,7 +21,7 @@ $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logt
21 $campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "All"; 21 $campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "All";
22 22
23 // testing input 23 // testing input
24 // $logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-03 ".$logtime.":00:00");$logdateto = strtotime("2017-10-03 ".$logtimeto.":00:00");$campaign = 'All'; 24 $logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-03 ".$logtime.":00:00");$logdateto = strtotime("2017-10-03 ".$logtimeto.":00:00");$campaign = 'All';
25 // testing input 25 // testing input
26 26
27 $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)); 27 $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!="") ...@@ -49,7 +49,7 @@ if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="")
49 } 49 }
50 50
51 $breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime"); 51 $breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime");
52 $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); 52 $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);
53 $reportarray=array(); 53 $reportarray=array();
54 54
55 $i=1; 55 $i=1;
...@@ -113,6 +113,7 @@ foreach($alist as $aline) ...@@ -113,6 +113,7 @@ foreach($alist as $aline)
113 $reportarray[$userid]["P-Call"]+=$aline->callSec/1000; 113 $reportarray[$userid]["P-Call"]+=$aline->callSec/1000;
114 $reportarray[$userid]["P-Talk"]+=$talktime/1000; 114 $reportarray[$userid]["P-Talk"]+=$talktime/1000;
115 $reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000; 115 $reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000;
116 $reportarray[$userid]["ProgressiveTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000);
116 } 117 }
117 118
118 if($aline->type == 'Manual') 119 if($aline->type == 'Manual')
...@@ -120,6 +121,7 @@ foreach($alist as $aline) ...@@ -120,6 +121,7 @@ foreach($alist as $aline)
120 $reportarray[$userid]["M-Call"]+=$aline->callSec/1000; 121 $reportarray[$userid]["M-Call"]+=$aline->callSec/1000;
121 $reportarray[$userid]["M-Talk"]+=$talktime/1000; 122 $reportarray[$userid]["M-Talk"]+=$talktime/1000;
122 $reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000; 123 $reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000;
124 $reportarray[$userid]["ManualTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000);
123 } 125 }
124 126
125 if($aline->type == 'Inbound') 127 if($aline->type == 'Inbound')
...@@ -127,6 +129,7 @@ foreach($alist as $aline) ...@@ -127,6 +129,7 @@ foreach($alist as $aline)
127 $reportarray[$userid]["I-Call"]+=$aline->callSec/1000; 129 $reportarray[$userid]["I-Call"]+=$aline->callSec/1000;
128 $reportarray[$userid]["I-Talk"]+=$talktime/1000; 130 $reportarray[$userid]["I-Talk"]+=$talktime/1000;
129 $reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000; 131 $reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000;
132 $reportarray[$userid]["IncomingTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000);
130 } 133 }
131 } 134 }
132 $reportarray[$userid]["CallCount"]++; 135 $reportarray[$userid]["CallCount"]++;
...@@ -182,9 +185,8 @@ if(count($userLogin)) foreach ($userLogin as $userid => $value) ...@@ -182,9 +185,8 @@ if(count($userLogin)) foreach ($userLogin as $userid => $value)
182 $break_time=0; 185 $break_time=0;
183 foreach ($breaks as $break) { 186 foreach ($breaks as $break) {
184 $break_time+=$reportarray[$userid][$break]; 187 $break_time+=$reportarray[$userid][$break];
188 $reportarray[$userid]["PausedTotal"]+=$reportarray[$userid][$break];
185 } 189 }
186 // print_r($value);
187
188 $sessionsStr = ""; 190 $sessionsStr = "";
189 for($i = 0; $i < count($value['start']); $i++){ 191 for($i = 0; $i < count($value['start']); $i++){
190 if($sessionsStr == ""){ 192 if($sessionsStr == ""){
...@@ -193,25 +195,24 @@ if(count($userLogin)) foreach ($userLogin as $userid => $value) ...@@ -193,25 +195,24 @@ if(count($userLogin)) foreach ($userLogin as $userid => $value)
193 $sessionsStr .= ",\n".date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); 195 $sessionsStr .= ",\n".date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset);
194 } 196 }
195 } 197 }
196 // echo $sessionsStr."<br>-----------<br>";
197
198 $reportarray[$userid]["Sessions"]=$sessionsStr; 198 $reportarray[$userid]["Sessions"]=$sessionsStr;
199 // $reportarray[$userid]["Signin"]=date("Y-m-d H:i:s", min($value['start'])-$timeoffset); 199 // $reportarray[$userid]["Signin"]=date("Y-m-d H:i:s", min($value['start'])-$timeoffset);
200 // $reportarray[$userid]["Signout"]=date("Y-m-d H:i:s", max($value['end'])-$timeoffset); 200 // $reportarray[$userid]["Signout"]=date("Y-m-d H:i:s", max($value['end'])-$timeoffset);
201 $reportarray[$userid]["Duration"]=$value['duration']; 201 $reportarray[$userid]["SessionTotal"]=$value['duration'];
202 $reportarray[$userid]["Total"]=$value['duration']-$break_time; 202 $reportarray[$userid]["Total"]=$value['duration']-$break_time;
203 $reportarray[$userid]["Wait"]=$reportarray[$userid]["Total"]-$reportarray[$userid]['oncall']; 203 $reportarray[$userid]["Wait"]=$reportarray[$userid]["Total"]-$reportarray[$userid]['oncall'];
204 } 204 }
205 205
206 // echo "<pre>"; print_r($userLogin);
207 // exit;
208
209 $highestColumn = sizeof($reporthead); 206 $highestColumn = sizeof($reporthead);
210 if(count($reportarray)) { 207 if(count($reportarray)) {
211 $outhead="<tr>";$outstr=""; 208 $outhead="<tr>";$outstr="";
212 for ($head = 0; $head < $highestColumn; $head++){ 209 for ($head = 0; $head < $highestColumn; $head++){
213 if($reporthead[$head] == "Sessions"){ 210 if($reporthead[$head] == "Sessions"){
214 $outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>"; 211 $outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>";
212 }elseif($reporthead[$head] == "PausedTotal" || $reporthead[$head] == "ProgressiveTotal" || $reporthead[$head] == "ManualTotal" || $reporthead[$head] == "IncomingTotal"){
213 $outhead.="<td class='warning'>".$reporthead[$head]."</td>";
214 }elseif($reporthead[$head] == "Paused"){
215 $outhead.="<td>ManualPaused</td>";
215 }else{ 216 }else{
216 $outhead.="<td>".$reporthead[$head]."</td>"; 217 $outhead.="<td>".$reporthead[$head]."</td>";
217 } 218 }
...@@ -222,7 +223,7 @@ if(count($reportarray)) { ...@@ -222,7 +223,7 @@ if(count($reportarray)) {
222 $reportRowNo = 1; 223 $reportRowNo = 1;
223 foreach($reportarray as $uid=>$uarr) 224 foreach($reportarray as $uid=>$uarr)
224 { 225 {
225 if(array_key_exists('Duration',$uarr) && array_key_exists('TelecallerID',$uarr)) 226 if(array_key_exists('SessionTotal',$uarr) && array_key_exists('TelecallerID',$uarr))
226 { 227 {
227 $outstr.="<tr>"; 228 $outstr.="<tr>";
228 for ($head = 0; $head < $highestColumn; $head++){ 229 for ($head = 0; $head < $highestColumn; $head++){
...@@ -240,8 +241,12 @@ if(count($reportarray)) { ...@@ -240,8 +241,12 @@ if(count($reportarray)) {
240 $data_str = secToDuration(round($uarr[$reporthead[$head]])); 241 $data_str = secToDuration(round($uarr[$reporthead[$head]]));
241 $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; 242 $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
242 } 243 }
244 if($head == 12 || $head == 16 || $head == 20 || $head == 24){
245 $outstr.="<td class='warning'>".$data_str."</td>";
246 }else{
243 $outstr.="<td>".$data_str."</td>"; 247 $outstr.="<td>".$data_str."</td>";
244 } 248 }
249 }
245 $outstr.="</tr>"; 250 $outstr.="</tr>";
246 } 251 }
247 } 252 }
...@@ -254,8 +259,12 @@ if(count($reportarray)) { ...@@ -254,8 +259,12 @@ if(count($reportarray)) {
254 else { 259 else {
255 $data_str = secToDuration($utotalarr[$reporthead[$head]]); 260 $data_str = secToDuration($utotalarr[$reporthead[$head]]);
256 } 261 }
262 if($head == 12 || $head == 16 || $head == 20 || $head == 24){
263 $outstr.="<td class='warning'>".$data_str."</td>";
264 }else{
257 $outstr.="<td>".$data_str."</td>"; 265 $outstr.="<td>".$data_str."</td>";
258 } 266 }
267 }
259 $outstr.="</tr>"; 268 $outstr.="</tr>";
260 } else { 269 } else {
261 $outhead.="<tr><td>No Records Found.</td></tr>"; 270 $outhead.="<tr><td>No Records Found.</td></tr>";
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!