4079cd55 by Yashwant

Login report changes

1 parent bb0764be
......@@ -1315,25 +1315,25 @@ function getURLLoad(varurl)
form.submit();
}
function filter2 (phrase, _id){
if(phrase)
{
var words = phrase.value.toLowerCase().split(" ");
var table = document.getElementById(_id);
var ele;
for (var r = 0; r < table.rows.length; r++){
ele = table.rows[r].innerHTML.replace(/<[^>]+>/g,"");
var displayStyle = 'none';
for (var i = 0; i < words.length; i++) {
if (ele.toLowerCase().indexOf(words[i])>=0)
displayStyle = '';
else {
displayStyle = 'none';
break;
}
}
table.rows[r].style.display = displayStyle;
if(phrase)
{
var words = phrase.value.toLowerCase().split(" ");
var table = document.getElementById(_id);
var ele;
for (var r = 0; r < table.rows.length; r++){
ele = table.rows[r].innerHTML.replace(/<[^>]+>/g,"");
var displayStyle = 'none';
for (var i = 0; i < words.length; i++) {
if (ele.toLowerCase().indexOf(words[i])>=0)
displayStyle = '';
else {
displayStyle = 'none';
break;
}
}
table.rows[r].style.display = displayStyle;
}
}
}
}
function mailFile(filepath,emailids,subject,from,mailbody)
{
......
......@@ -76,7 +76,7 @@ kstychAppObject['config']['colorInverse']='{!!$skinarr[8]!!}';
<script src="{!!url('/')!!}/assets/components/modules/admin/chat/chatboxmanager.js"></script>
<script src="{!!url('/')!!}/assets/js/highchart/highcharts.js"></script>
<script>
var envCallback = "{{ env(app_domain) }}";
var envCallback = "{{ env('app_domain') }}";
</script>
<script src="{!!url('/')!!}/jsbody?v={!!$v!!}"></script>
......
......@@ -15,11 +15,15 @@ $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9;
$logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20;
$logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00")
: strtotime(date("Y-m-d")." 09:00:00");
: strtotime(date("Y-m-d")." 09:00:00");
$logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00")
: strtotime(date("Y-m-d")." 20:00:00");
: strtotime(date("Y-m-d")." 20:00:00");
$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';
// 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));
$alist->orderBy('user_id', 'ASC')->orderBy('ts_Close', 'ASC');
......@@ -29,8 +33,8 @@ if($campaign != 'All') $alist->where('client','=',$campaign);
$userarr=array();
$allusers = DB::table('users as u1')->leftjoin('users AS u2', 'u2.username', '=', 'u1.supervisor')
->select('u1.id','u1.username','u1.fullname AS telecaller', 'u2.fullname AS sepervisor')
->where('u1.status','=','Active');
->select('u1.id','u1.username','u1.fullname AS telecaller', 'u2.fullname AS sepervisor')
->where('u1.status','=','Active');
$roclientstr=array();$didlinesstr=array();
if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten;
......@@ -38,34 +42,34 @@ $oclientlst=$wakka->clientsReadAccess(); sort($oclientlst); $oclientlst[0] = 'Al
if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="")
{
$roclientstr[]="$tclnt";
$mastersdata=$wakka->getCompanyMaster($tclnt);
if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"];
$roclientstr[]="$tclnt";
$mastersdata=$wakka->getCompanyMaster($tclnt);
if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"];
}
$breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime");
$reporthead=array_merge(array("#","Telecaller","TelecallerID","Supervisor","Signin","Signout","Count","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","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);
$reportarray=array();
$i=1;
if($dashboarduser->usertype != 'Admin')
{
$uidlist=array($dashboarduser->id);
$allusers=$allusers->where(function ($query) use($dashboarduser) {
$query->where('u1.supervisor','=',$dashboarduser->username)
->orWhere('u1.lteam2','=',$dashboarduser->username)
->orWhere('u1.lteam','=',$dashboarduser->username);
})->get();
foreach($allusers as $tuser)
{
$uidlist[]=$tuser->id;
$reportarray[$tuser->id]=array("#"=>$i++,"Telecaller"=>$tuser->telecaller,"TelecallerID"=>$tuser->username,"Supervisor"=>$tuser->sepervisor);
}
$reportarray[$dashboarduser->id]=array("#"=>$i++,"Telecaller"=>$dashboarduser->fullname,"TelecallerID"=>$dashboarduser->username,"Supervisor"=>$dashboarduser->supervisor);
$alist=$alist->whereIn('user_id',$uidlist);
$uidlist=array($dashboarduser->id);
$allusers=$allusers->where(function ($query) use($dashboarduser) {
$query->where('u1.supervisor','=',$dashboarduser->username)
->orWhere('u1.lteam2','=',$dashboarduser->username)
->orWhere('u1.lteam','=',$dashboarduser->username);
})->get();
foreach($allusers as $tuser)
{
$uidlist[]=$tuser->id;
$reportarray[$tuser->id]=array("#"=>$i++,"Telecaller"=>$tuser->telecaller,"TelecallerID"=>$tuser->username,"Supervisor"=>$tuser->sepervisor);
}
$reportarray[$dashboarduser->id]=array("#"=>$i++,"Telecaller"=>$dashboarduser->fullname,"TelecallerID"=>$dashboarduser->username,"Supervisor"=>$dashboarduser->supervisor);
$alist=$alist->whereIn('user_id',$uidlist);
/*$alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){
$query->orWhereIn('client',$roclientstr)
......@@ -74,219 +78,240 @@ if($dashboarduser->usertype != 'Admin')
$userlog=$userlog->whereIn('user_id',$uidlist);
}else{
$allusers=$allusers->get();
foreach($allusers as $tuser)
{
$reportarray[$tuser->id]=array("#"=>$i++,"Telecaller"=>$tuser->telecaller,"TelecallerID"=>$tuser->username,"Supervisor"=>$tuser->sepervisor);
}
$allusers=$allusers->get();
foreach($allusers as $tuser)
{
$reportarray[$tuser->id]=array("#"=>$i++,"Telecaller"=>$tuser->telecaller,"TelecallerID"=>$tuser->username,"Supervisor"=>$tuser->sepervisor);
}
}
// echo "<pre>"; print_r($allusers);exit;
$alist=$alist->get();
$userlog=$userlog->get();
$prev_close = 0;
// echo count($userlog);exit;
foreach($alist as $aline)
{
if($prev_user != $aline->user_id || $prev_close <= $aline->ts_Wait)
{
$userid=$aline->user_id;
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$totaltime=$aline->callSec+$talktime+$aline->dispoSec;
$reportarray[$userid]["oncall"]+=$totaltime/1000;
if($prev_user != $aline->user_id || $prev_close <= $aline->ts_Wait)
{
$userid=$aline->user_id;
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$totaltime=$aline->callSec+$talktime+$aline->dispoSec;
$reportarray[$userid]["oncall"]+=$totaltime/1000;
//$reportarray[$userid]["Wait"]+=$aline->waitSec/1000;
$reportarray[$userid]["Call"]+=$aline->callSec/1000;
$reportarray[$userid]["Talk"]+=$talktime/1000;
$reportarray[$userid]["Dispo"]+=$aline->dispoSec/1000;
if($aline->type == 'Progressive')
{
$reportarray[$userid]["P-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["P-Talk"]+=$talktime/1000;
$reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000;
$reportarray[$userid]["Call"]+=$aline->callSec/1000;
$reportarray[$userid]["Talk"]+=$talktime/1000;
$reportarray[$userid]["Dispo"]+=$aline->dispoSec/1000;
if($aline->type == 'Progressive')
{
$reportarray[$userid]["P-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["P-Talk"]+=$talktime/1000;
$reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000;
}
if($aline->type == 'Manual')
{
$reportarray[$userid]["M-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["M-Talk"]+=$talktime/1000;
$reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000;
}
if($aline->type == 'Inbound')
{
$reportarray[$userid]["I-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["I-Talk"]+=$talktime/1000;
$reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000;
}
}
if($aline->type == 'Manual')
{
$reportarray[$userid]["M-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["M-Talk"]+=$talktime/1000;
$reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000;
}
if($aline->type == 'Inbound')
{
$reportarray[$userid]["I-Call"]+=$aline->callSec/1000;
$reportarray[$userid]["I-Talk"]+=$talktime/1000;
$reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000;
}
}
$reportarray[$userid]["Count"]++;
$reportarray[$userid]["CallCount"]++;
$prev_close = $aline->ts_Close;//-ts_Wait
$prev_user = $aline->user_id;//-ts_Wait
}
function cmp($a, $b) {
return $a["ts"] - $b["ts"];
return $a["ts"] - $b["ts"];
}
$userLogin=array();
foreach($userlog as $ulog)
{
$data=json_decode($ulog->data,true);
usort($data, "cmp");
$lastSip = end($data);
$starttime = strtotime($ulog->startdate.' '.$ulog->starttime);
$endtime = round($lastSip['ts']/1000);
$userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime);
$userLogin[$ulog->user_id]['start'][] = $starttime;
$userLogin[$ulog->user_id]['end'][] = $endtime;
$prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000;
$previous="Paused-Paused";
foreach($data as $sdata)
{
$pts=$sdata['ts'];
if(isset($sdata['states']))
{
foreach($sdata['states'] as $ts=>$states)
{
if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous);
if(!in_array($previous,$reporthead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-','Paused-WRAPUP'))) {
$previous = 'Paused';
}
$reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000;
$prets=$ts;
$previous=$states[0].'-'.$states[1];
}
if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous);
$reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000;
$prets=$pts;
}
}
$data=json_decode($ulog->data,true);
usort($data, "cmp");
$lastSip = end($data);
$starttime = strtotime($ulog->startdate.' '.$ulog->starttime);
$endtime = round($lastSip['ts']/1000);
$userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime);
$userLogin[$ulog->user_id]['start'][] = $starttime;
$userLogin[$ulog->user_id]['end'][] = $endtime;
$prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000;
$previous="Paused-Paused";
foreach($data as $sdata)
{
$pts=$sdata['ts'];
if(isset($sdata['states']))
{
foreach($sdata['states'] as $ts=>$states)
{
if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous);
if(!in_array($previous,$reporthead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-','Paused-WRAPUP'))) {
$previous = 'Paused';
}
$reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000;
$prets=$ts;
$previous=$states[0].'-'.$states[1];
}
if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous);
$reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000;
$prets=$pts;
}
}
}
if(count($userLogin)) foreach ($userLogin as $userid => $value)
{
$break_time=0;
foreach ($breaks as $break) {
$break_time+=$reportarray[$userid][$break];
}
$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]["Total"]=$value['duration']-$break_time;
$reportarray[$userid]["Wait"]=$reportarray[$userid]["Total"]-$reportarray[$userid]['oncall'];
$break_time=0;
foreach ($breaks as $break) {
$break_time+=$reportarray[$userid][$break];
}
// print_r($value);
$sessionsStr = "";
for($i = 0; $i < count($value['start']); $i++){
if($sessionsStr == ""){
$sessionsStr .= date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset);
}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]["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] == '#') {
$mode_str = "<a onclick='displayMode(".'"summation"'.");return false;' href='#'><i class='fa fa-plus-square-o'></i></a> / <a onclick='displayMode(".'"percent"'.");return false;' href='#'>%</a>";
$outhead.="<td>".$mode_str."</td>";
}
else {
$outhead.="<td>".$reporthead[$head]."</td>";
}
}
$outhead.="</tr>";
$utotalarr = array("Telecaller"=>'Total');
foreach($reportarray as $uid=>$uarr)
{
if(array_key_exists('Signin',$uarr))
{
$outstr.="<tr>";
for ($head = 0; $head < $highestColumn; $head++){
if($head < 6) {
$data_str = $uarr[$reporthead[$head]];
}
elseif($head < 7) {
$data_str = $uarr[$reporthead[$head]];
$utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
}
else {
$data_str = secToDuration(round($uarr[$reporthead[$head]]));
$utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
}
$outstr.="<td>".$data_str."</td>";
}
$outstr.="</tr>";
}
}
$outstr.="<tr>";
for ($head = 0; $head < $highestColumn; $head++)
{
if($head < 7) {
$data_str = $utotalarr[$reporthead[$head]];
}
else {
$data_str = secToDuration($utotalarr[$reporthead[$head]]);
}
$outstr.="<td>".$data_str."</td>";
}
$outstr.="</tr>";
$outhead="<tr>";$outstr="";
for ($head = 0; $head < $highestColumn; $head++){
if($reporthead[$head] == "Sessions"){
$outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>";
}else{
$outhead.="<td>".$reporthead[$head]."</td>";
}
}
$outhead.="</tr>";
$utotalarr = array("Telecaller"=>'Total');
$reportRowNo = 1;
foreach($reportarray as $uid=>$uarr)
{
if(array_key_exists('Duration',$uarr) && array_key_exists('TelecallerID',$uarr))
{
$outstr.="<tr>";
for ($head = 0; $head < $highestColumn; $head++){
if($head < 1){
$data_str = $reportRowNo; $reportRowNo++;
}elseif($head < 5) {
// if($head < 6) {
$data_str = $uarr[$reporthead[$head]];
}
elseif($head < 6) {
$data_str = $uarr[$reporthead[$head]];
$utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
}
else {
$data_str = secToDuration(round($uarr[$reporthead[$head]]));
$utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
}
$outstr.="<td>".$data_str."</td>";
}
$outstr.="</tr>";
}
}
$outstr.="<tr>";
for ($head = 0; $head < $highestColumn; $head++)
{
if($head < 6) {
$data_str = $utotalarr[$reporthead[$head]];
}
else {
$data_str = secToDuration($utotalarr[$reporthead[$head]]);
}
$outstr.="<td>".$data_str."</td>";
}
$outstr.="</tr>";
} else {
$outhead.="<tr><td>No Records Found.</td></tr>";
}
else {
$outhead.="<tr><td>No Records Found.</td></tr>";
}
if(Input::has("dllogxls"))
{
include_once(app_path().'/lib/phpexcel/PHPExcel.php');
$inputFileType = "Excel5";
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load("assets/extras/blank.xls");
$baseRow = 2;
$highestColumn = sizeof($reporthead);
for ($head = 0; $head < $highestColumn; $head++){
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]);
}
foreach($reportarray as $uid=>$uarr)
{
$row = $baseRow++;
$col = 0;
for ($head = 0; $head < $highestColumn; $head++){
$excelval = ($head < 7) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]]));
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval);
}
}
$row++;
for ($head = 0; $head < $highestColumn; $head++){
$excelval = ($head < 7) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]]));
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval);
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="AgentTime.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType);
$objWriter->save('php://output');
return ;
include_once(app_path().'/lib/phpexcel/PHPExcel.php');
$inputFileType = "Excel5";
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load("assets/extras/blank.xls");
$baseRow = 2;
$highestColumn = sizeof($reporthead);
for ($head = 0; $head < $highestColumn; $head++){
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]);
}
foreach($reportarray as $uid=>$uarr)
{
$row = $baseRow++;
$col = 0;
for ($head = 0; $head < $highestColumn; $head++){
$excelval = ($head < 6) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]]));
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval);
}
}
$row++;
for ($head = 0; $head < $highestColumn; $head++){
$excelval = ($head < 6) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]]));
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval);
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="AgentTime.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType);
$objWriter->save('php://output');
return ;
}
function secToDuration($sec) {
return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60);
return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60);
}
?>
<style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;}
<style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;}
/*#logtable.table thead tr{
display:block;
}
......@@ -295,90 +320,90 @@ function secToDuration($sec) {
display:block;
height:500px;
overflow:auto;//set tbody to auto
}*/
}*/
</style>
<div class=innerAll>
<h4 style="float:left;width:50%;margin:10px 0;">Agent Time Report</h4>
<div style="float:right;width:50%">
<button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button>
</div>
<div style="clear:both"></div>
<hr style="margin-bottom: 5px;">
<div>
Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;">&nbsp;&nbsp;
Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' />
<select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
<?php
foreach (range(0,23) as $hour) {
$selected = ($hour == $logtime) ? "selected" : "";
echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
}
?></select>
To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' />
<select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
<?php
foreach (range(0,23) as $hour) {
$selected = ($hour == $logtimeto) ? "selected" : "";
echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
}
?></select>&nbsp;&nbsp;
Campaign
<select id="campaign" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
<?php foreach($oclientlst as $c){$s="";if($c==$campaign)$s='selected';echo "<option value='$c' $s>$c</option>";} ?>
</select>
</div>
<div style="clear:both"></div>
<hr style="margin:5px;">
<div style="overflow: auto; margin-top: 10px;">
<table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px; margin:0; border:1px solid #BBB;'>
<thead><?php echo $outhead; ?></thead>
<?php echo $outstr; ?>
</table>
</div>
<div id=dialoglog></div>
<h4 style="float:left;width:50%;margin:10px 0;">Login Report <small>(Agent Time Report)</small></h4>
<div style="float:right;width:50%">
<button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button>
</div>
<div style="clear:both"></div>
<hr style="margin-bottom: 5px;">
<div>
Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;">&nbsp;&nbsp;
Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' />
<select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
<?php
foreach (range(0,23) as $hour) {
$selected = ($hour == $logtime) ? "selected" : "";
echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
}
?>
</select>
To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' />
<select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
<?php
foreach (range(0,23) as $hour) {
$selected = ($hour == $logtimeto) ? "selected" : "";
echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
}
?></select>&nbsp;&nbsp;
Campaign
<select id="campaign" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
<?php foreach($oclientlst as $c){$s="";if($c==$campaign)$s='selected';echo "<option value='$c' $s>$c</option>";} ?>
</select>
</div>
<div style="clear:both"></div>
<hr style="margin:5px;">
<div style="overflow: auto; margin-top: 10px;">
<table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px; margin:0; border:1px solid #BBB;'>
<thead><?php echo $outhead; ?></thead>
<tbody id="logTableData"><?php echo $outstr; ?></tbody>
</table>
</div>
<div id=dialoglog></div>
</div>
<script>
$(document).ready(function() {
if(!$('#dialoglog').hasClass('ui-dialog-content'))
{
$('#dialoglog').dialog({
autoOpen: false,
width: '70%',
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
}
waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000");
$('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
$('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
if(!$('#dialoglog').hasClass('ui-dialog-content'))
{
$('#dialoglog').dialog({
autoOpen: false,
width: '70%',
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
}
waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logTableData') },"2000");
$('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
$('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
});
function dataString()
{
return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+$("#campaign").val();
return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+$("#campaign").val();
}
function statusLogReloadFun(sortby)
{
var sortstr='';if(sortby!="")sortstr="&sort="+sortby
var searchStr = dataString();
doAjax('dialer/agenttime?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
var sortstr='';if(sortby!="")sortstr="&sort="+sortby
var searchStr = dataString();
doAjax('dialer/agenttime?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
}
function dlAgentlogXls()
{
var searchStr = dataString();
window.open('dialer/agenttime?dllogxls=1&'+searchStr);
return false;
var searchStr = dataString();
window.open('dialer/agenttime?dllogxls=1&'+searchStr);
return false;
}
</script>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!