a02abcee by Manish Mihsra

Added New Monitoring Report

1 parent c5a7b341
...@@ -21,6 +21,7 @@ use App\Models\Cutoff; ...@@ -21,6 +21,7 @@ use App\Models\Cutoff;
21 use App\Jobs\KHRMSLib; 21 use App\Jobs\KHRMSLib;
22 use App\Models\Sipid; 22 use App\Models\Sipid;
23 use App\Models\Dialline; 23 use App\Models\Dialline;
24 use App\Models\User;
24 use App\Models\UserLog; 25 use App\Models\UserLog;
25 use App\Models\Kqueue; 26 use App\Models\Kqueue;
26 use DB; 27 use DB;
...@@ -37,14 +38,122 @@ class ReportController extends Controller ...@@ -37,14 +38,122 @@ class ReportController extends Controller
37 38
38 public function show($id) 39 public function show($id)
39 { 40 {
41 $data = array();
42 $wakka = new KHRMSLib();
43 $dashboarduser = Auth::user();
44 $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone;
45 $timeoffset = $timeoffset*60;
46
40 if($id=="reports") 47 if($id=="reports")
41 { 48 {
42 return view("layout.module.reports.reports",array()); 49 return view("layout.module.reports.reports");
43 } 50 }
44 51
45 if($id=="campaigns") 52 $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9;
53 $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20;
54
55 $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00")
56 : strtotime(date("Y-m-d")." 09:00:00");
57 $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00")
58 : strtotime(date("Y-m-d")." 20:00:00");
59 $campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "Select";
60
61 $oclientlst = $wakka->clientsReadAccess();
62 sort($oclientlst);
63 $oclientlst[0] = 'Select';
64
65 $data['wakka'] = $wakka;
66 $data['dashboarduser'] = $dashboarduser;
67 $data['timeoffset'] = $timeoffset;
68 $data['logtime'] = $logtime;
69 $data['logtimeto'] = $logtimeto;
70 $data['logdate'] = $logdate;
71 $data['logdateto'] = $logdateto;
72 $data['campaign'] = $campaign;
73 $data['oclientlst'] = $oclientlst;
74
75 if($id=="liveusers")
46 { 76 {
47 return view("layout.module.reports.campaigns",array()); 77 $campStr = "";
78 $ratio = 0;
79 $totalCall = 0;
80 $dialedCall = 0;
81 $waitCall = 0;
82 $inCall = 0;
83 $availChnl = 0;
84 $usrIdArr = array();
85 $tabHeadStr = "";
86 $tabBodyStr = "";
87
88 foreach($oclientlst as $c)
89 {
90 $s="";
91 if($c==$campaign)$s='selected';
92 $campStr .= "<option value='$c' $s>$c</option>";
93 }
94
95 if ($campaign != "Select") {
96
97 $mastersdata=$wakka->getCompanyMaster($campaign);
98 if(!empty($mastersdata["autodialercampaign"]))$ratio=$mastersdata["autodialercampaign"];
99
100 $userArr = User::where('presence', '=', "1")->where('sel_campaign', '=', $campaign)->select('id','username','fullname','current_dialmode')->get();
101 $diallineArr = Dialline::where("enabled","=","1")->get();
102
103 $totalChnl = $diallineArr->count();
104
105 foreach ($diallineArr as $dialline) {
106
107 if($dialline->status!= 'Free')$totalCall++;
108 if($dialline->status!= 'Free' && $dialline->src_channel!= '' && $dialline->channel== '')$dialedCall++;
109 if($dialline->status== 'Auto' && $dialline->conf== '' && $dialline->src_channel!= '' && $dialline->channel!= '')$waitCall++;
110 if($dialline->status!= 'Free' && $dialline->conf!= '')$inCall++;
111
112 }
113
114 $availChnl = $totalChnl - $totalCall;
115
116 $tabHeadStr .= "<tr>
117 <th>User</th>
118 <th>Campaign</th>
119 <th>Mode</th>
120 <th>Status</th>
121 </tr>";
122
123 foreach ($userArr as $usr) {
124 $usrIdArr[] = $usr->id;
125 $statusStr = "<span class='btn btn-sm btn-warning'>Free</span>";
126
127 $sipIdArr = Sipid::where('user', "=", $usr->id)->where('status', '=', 1)->select('id', 'status', 'ready', 'patched')->first();
128
129 if($sipIdArr->ready==1)$statusStr = "<span class='btn btn-sm btn-success'>Available</span>";
130 if($sipIdArr->patched==1)$statusStr = "<span class='btn btn-sm btn-info'>OnCall</span>";
131 if($sipIdArr->prepare_call==1&&$sipIdArr->patched==0)$statusStr = "<span class='btn btn-sm btn-info'>Wrap-Up</span>";
132
133 $tabBodyStr .= "<tr><td>".$usr->fullname."</td>";
134 $tabBodyStr .= "<td>".$campaign."</td>";
135 $tabBodyStr .= "<td>".$usr->current_dialmode."</td>";
136 $tabBodyStr .= "<td>".$statusStr."</td></tr>";
137 }
138
139 $freeUsr = Sipid::whereIn('user',$usrIdArr)->where('status', '=', 1)->where('ready', '=', 1)->where('patched', '=', 0)->count();
140
141 $data['ratio'] = $ratio;
142 $data['totalUsr'] = $userArr->count();
143 $data['totalChnl'] = $totalChnl;
144 $data['availChnl'] = $availChnl;
145 $data['dialedCall'] = $dialedCall;
146 $data['waitCall'] = $waitCall;
147 $data['inCall'] = $inCall;
148 $data['freeUsr'] = $totalChnl;
149 $data['tabHeadStr'] = $tabHeadStr;
150 $data['tabBodyStr'] = $tabBodyStr;
151
152 }
153
154 $data['campStr'] = $campStr;
155
156 return view("layout.module.reports.liveusers", $data);
48 } 157 }
49 158
50 if($id=="calllog") 159 if($id=="calllog")
...@@ -52,9 +161,14 @@ class ReportController extends Controller ...@@ -52,9 +161,14 @@ class ReportController extends Controller
52 return view("layout.module.reports.calllog",array()); 161 return view("layout.module.reports.calllog",array());
53 } 162 }
54 163
55 if($id=="agentreport") 164 if($id=="agenttime")
56 { 165 {
57 return view("layout.module.reports.agentreport",array()); 166 return view("layout.module.reports.agenttime",array());
167 }
168
169 if($id=="agenttimeAverage")
170 {
171 return view("layout.module.reports.agenttimeAverage",array());
58 } 172 }
59 173
60 if($id=="campreport") 174 if($id=="campreport")
...@@ -67,34 +181,9 @@ class ReportController extends Controller ...@@ -67,34 +181,9 @@ class ReportController extends Controller
67 return view("layout.module.reports.statusreport",array()); 181 return view("layout.module.reports.statusreport",array());
68 } 182 }
69 183
70 if($id=="questionnaire") 184 if($id=="relationshipreport")
71 {
72 return view("layout.module.reports.questairereport",array());
73 }
74
75 if($id=="callmanagement")
76 {
77 return view("layout.module.reports.callmanagementreport",array());
78 }
79
80 if($id=="supmessages")
81 {
82 return view("layout.module.reports.supmessagesreport",array());
83 }
84
85 if($id=="liveusers")
86 {
87 return view("layout.module.reports.liveusers",array());
88 }
89
90 if($id=="recarchive")
91 {
92 return view("layout.module.reports.recarchive",array());
93 }
94
95 if($id=="recqc")
96 { 185 {
97 return view("layout.module.reports.recqc",array()); 186 return view("layout.module.reports.relationshipreport",array());
98 } 187 }
99 } 188 }
100 } 189 }
......
...@@ -478,6 +478,12 @@ class KPAMIListen implements IEventListener ...@@ -478,6 +478,12 @@ class KPAMIListen implements IEventListener
478 478
479 $tsip=Sipid::find($crmcall->sipid_id); 479 $tsip=Sipid::find($crmcall->sipid_id);
480 480
481 if(!empty($tsip))
482 {
483 $tsip->patched=0;
484 $tsip->save();
485 }
486
481 //$newqueue=new Kqueue(); 487 //$newqueue=new Kqueue();
482 //$newqueue->playhangupfile($dialline->channel,$dialline->server); 488 //$newqueue->playhangupfile($dialline->channel,$dialline->server);
483 489
...@@ -733,6 +739,7 @@ class KPAMIListen implements IEventListener ...@@ -733,6 +739,7 @@ class KPAMIListen implements IEventListener
733 $dialline=Dialline::find($crmcall->dialline_id); 739 $dialline=Dialline::find($crmcall->dialline_id);
734 if($dialline) 740 if($dialline)
735 { 741 {
742 $dialline->src_channel=$dchannel;
736 $dialline->channel=$dchannel; 743 $dialline->channel=$dchannel;
737 $dialline->save(); 744 $dialline->save();
738 } 745 }
...@@ -745,7 +752,30 @@ class KPAMIListen implements IEventListener ...@@ -745,7 +752,30 @@ class KPAMIListen implements IEventListener
745 752
746 $crmcall->save(); 753 $crmcall->save();
747 } 754 }
748 } 755 }else if($accountcodearr[1]=="a")
756 {
757 $crmcall=CRMCall::find($accountcodearr[2]);
758 if($crmcall)
759 {
760 $nowts=microtime(true)*1000;
761
762 $crmcall->setTs('ts_Call',$nowts);
763
764 $crmcall->state=$eventname;
765
766 $dialline=Dialline::find($crmcall->dialline_id);
767 if($dialline)
768 {
769 $dialline->src_channel=$dchannel;
770 $dialline->save();
771 }
772
773 $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $channel $dialstring");
774
775 $crmcall->save();
776 }
777
778 }
749 } 779 }
750 780
751 } 781 }
...@@ -805,18 +835,22 @@ class KPAMIListen implements IEventListener ...@@ -805,18 +835,22 @@ class KPAMIListen implements IEventListener
805 835
806 $crmcall->state=$eventname; 836 $crmcall->state=$eventname;
807 $crmcall->status=$dialstatus; 837 $crmcall->status=$dialstatus;
838
839 $tsip=Sipid::find($crmcall->sipid_id);
840
841 $tsip->patched=1;
842 $tsip->save();
808 843
809 $dialline=Dialline::find($crmcall->dialline_id); 844 $dialline=Dialline::find($crmcall->dialline_id);
810 if($dialline) 845 if($dialline)
811 { 846 {
847 $dialline->conf="1000".$tsip->id;
812 $dialline->channel=$channel; 848 $dialline->channel=$channel;
813 $dialline->save(); 849 $dialline->save();
814 } 850 }
815 851
816 $recfile=$crmcall->newRecFilePath(); 852 $recfile=$crmcall->newRecFilePath();
817 853
818 $tsip=Sipid::find($crmcall->sipid_id);
819
820 //start recording 854 //start recording
821 $newqueue=new Kqueue(); 855 $newqueue=new Kqueue();
822 $newqueue->recordChannel($tsip->server,$dchannel,$recfile); 856 $newqueue->recordChannel($tsip->server,$dchannel,$recfile);
...@@ -957,6 +991,7 @@ class KPAMIListen implements IEventListener ...@@ -957,6 +991,7 @@ class KPAMIListen implements IEventListener
957 $dialline=Dialline::find($crmcall->dialline_id); 991 $dialline=Dialline::find($crmcall->dialline_id);
958 if($dialline) 992 if($dialline)
959 { 993 {
994 $dialline->src_channel=$dchannel;
960 $dialline->channel=$dchannel; 995 $dialline->channel=$dchannel;
961 $dialline->save(); 996 $dialline->save();
962 } 997 }
...@@ -969,7 +1004,30 @@ class KPAMIListen implements IEventListener ...@@ -969,7 +1004,30 @@ class KPAMIListen implements IEventListener
969 1004
970 $crmcall->save(); 1005 $crmcall->save();
971 } 1006 }
972 } 1007 }else if($accountcodearr[1]=="a")
1008 {
1009 $crmcall=CRMCall::find($accountcodearr[2]);
1010 if($crmcall)
1011 {
1012 $nowts=microtime(true)*1000;
1013
1014 $crmcall->setTs('ts_Call',$nowts);
1015
1016 $crmcall->state=$eventname;
1017
1018 $dialline=Dialline::find($crmcall->dialline_id);
1019 if($dialline)
1020 {
1021 $dialline->src_channel=$dchannel;
1022 $dialline->save();
1023 }
1024
1025 $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $channel $dialstring");
1026
1027 $crmcall->save();
1028 }
1029
1030 }
973 } 1031 }
974 1032
975 } 1033 }
...@@ -1034,17 +1092,21 @@ class KPAMIListen implements IEventListener ...@@ -1034,17 +1092,21 @@ class KPAMIListen implements IEventListener
1034 $crmcall->state=$eventname; 1092 $crmcall->state=$eventname;
1035 $crmcall->status=$dialstatus; 1093 $crmcall->status=$dialstatus;
1036 1094
1095 $tsip=Sipid::find($crmcall->sipid_id);
1096
1097 $tsip->patched=1;
1098 $tsip->save();
1099
1037 $dialline=Dialline::find($crmcall->dialline_id); 1100 $dialline=Dialline::find($crmcall->dialline_id);
1038 if($dialline) 1101 if($dialline)
1039 { 1102 {
1103 $dialline->conf="1000".$tsip->id;
1040 $dialline->channel=$channel; 1104 $dialline->channel=$channel;
1041 $dialline->save(); 1105 $dialline->save();
1042 } 1106 }
1043 1107
1044 $recfile=$crmcall->newRecFilePath(); 1108 $recfile=$crmcall->newRecFilePath();
1045 1109
1046 $tsip=Sipid::find($crmcall->sipid_id);
1047
1048 //start recording 1110 //start recording
1049 $newqueue=new Kqueue(); 1111 $newqueue=new Kqueue();
1050 $newqueue->recordChannel($tsip->server,$dchannel,$recfile); 1112 $newqueue->recordChannel($tsip->server,$dchannel,$recfile);
...@@ -1534,8 +1596,10 @@ class KPAMIListen implements IEventListener ...@@ -1534,8 +1596,10 @@ class KPAMIListen implements IEventListener
1534 1596
1535 $crmcall->save(); 1597 $crmcall->save();
1536 1598
1537 $dialline->conf="1000".$found->id; 1599 $dialline->user_id = $found->user;
1600 $dialline->conf = "1000".$found->id;
1538 $dialline->save(); 1601 $dialline->save();
1602
1539 if($crmcall->crm_id>0){ 1603 if($crmcall->crm_id>0){
1540 DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$found->user]); 1604 DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$found->user]);
1541 1605
......
...@@ -14,7 +14,7 @@ class User extends Authenticatable ...@@ -14,7 +14,7 @@ class User extends Authenticatable
14 protected $table = 'users'; 14 protected $table = 'users';
15 15
16 protected $hidden = array('password'); 16 protected $hidden = array('password');
17 protected $fillable = array('username','password','email','status','organization','group','data'); 17 protected $fillable = array('username','password','email','status','organization','group','data','sel_campaign','current_dialmode');
18 18
19 19
20 private $dataarr=array(); 20 private $dataarr=array();
......
1 <?php
2 use App\Models\CRMCall;
3 use App\Models\CRMCallArchive;
4 use App\Models\User;
5 use App\Models\UserLog;
6 use App\Jobs\KHRMSLib;
7
8 $wakka = new KHRMSLib();
9 $dashboarduser=Auth::user();
10 $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone;
11 $timeoffset = $timeoffset*60;
12
13 $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9;
14 $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20;
15
16 $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00")
17 : strtotime(date("Y-m-d")." 09:00:00");
18 $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00")
19 : strtotime(date("Y-m-d")." 20:00:00");
20
21 $oclientlst=$wakka->clientsReadAccess(); sort($oclientlst);
22
23 $alist=CRMCallArchive::whereIn('client',$oclientlst)->where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->orderBy('user_id', 'ASC')->orderBy('ts_Close', 'ASC')->get();
24
25 $userlog=UserLog::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->get();
26
27 $total_Accounts_loaded=DB::table('records')->whereIn('client',$oclientlst)->get();
28
29
30 $breaks=array("AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime");
31 $reporthead=array("Campaigns","Accounts Loaded","LoggedIn users","Unique accounts dialled","Total accounts Dialled","Disposed Calls","Contacts","RPC","PTP","Preview","Wrap","Idle","Talk","Hold");
32 $reportarray=array();
33
34 $campaign_wisearr= array();
35 $camp_userlist=array();
36 $uniquenumberarray=array();
37 $prev_close = 0;
38 foreach ($alist as $key => $value) {
39
40 if (!array_key_exists($value->client, $camp_userlist)) $camp_userlist[$value->client]=[];
41
42 if (!in_array($value->user_id, $camp_userlist[$value->client])) $camp_userlist[$value->client][]=$value->user_id;
43
44 $campaign_wisearr[$value->client]["LoggedIn users"] = count($camp_userlist[$value->client]);
45 $campaign_wisearr[$value->client]["Campaigns"] = $value->client;
46 $campaign_wisearr[$value->client]["Total accounts Dialled"]++;
47
48 if (!array_key_exists($value->client, $uniquenumberarray)) $uniquenumberarray[$value->client]=[];
49 if (!in_array($value->number, $uniquenumberarray[$value->client])) $uniquenumberarray[$value->client][]=$value->number;
50
51 $campaign_wisearr[$value->client]["Unique accounts dialled"] = count($uniquenumberarray[$value->client]);
52
53 if($value->userstatus == 'Contacted') {
54 $campaign_wisearr[$value->client]["Disposed Calls"]++;
55 }
56 if($value->resultCode =='PTP'|| $value->resultCode =='CB'||$value->resultCode =='RTP'||$value->resultCode =='CEREP'||$value->resultCode =='PV'||$value->resultCode =='DEAD'||$value->resultCode =='LM'||$value->resultCode =='TPC') {
57 $campaign_wisearr[$value->client]["Contacts"]++;
58 }
59 if($value->resultCode == 'PTP' || $value->resultCode == 'CEREP' || $value->resultCode == 'PV') {
60 $campaign_wisearr[$value->client]["PTP"]++;
61 }
62 if($value->resultCode == 'PTP' || $value->resultCode == 'CB' || $value->resultCode == 'CEREP' || $value->resultCode == 'RTP' || $value->resultCode == 'PV') {
63 $campaign_wisearr[$value->client]["RPC"]++;
64 }
65 if($prev_user != $value->user_id || $prev_close <= $value->ts_Wait)
66 {
67 $talktime=$value->talkSec+$value->recstartSec+$value->recendSec;
68 $totaltime=$value->callSec+$talktime+$value->dispoSec;
69
70 $campaign_wisearr[$value->client]["oncall"]+=$totaltime/1000;
71 // $campaign_wisearr[$value->client]["Preview"]+=$value->waitSec/1000;
72 $campaign_wisearr[$value->client]["Hold"]+=$value->callSec/1000;
73 $campaign_wisearr[$value->client]["Talk"]+=$talktime/1000;
74 $campaign_wisearr[$value->client]["Wrap"]+=$value->dispoSec/1000;
75 }
76
77 $prev_close = $value->ts_Close;//-ts_Wait
78 $prev_user = $value->user_id;//-ts_Wait
79
80 }
81 function cmp($a, $b) {
82 return $a["ts"] - $b["ts"];
83 }
84
85 $userLogin=array();
86 $checkhead = array_merge($reporthead, $breaks);
87 foreach($userlog as $ulog)
88 {
89 $data=json_decode($ulog->data,true);
90 usort($data, "cmp");
91
92 $lastSip = end($data);
93 $starttime = strtotime($ulog->startdate.' '.$ulog->starttime);
94 $endtime = round($lastSip['ts']/1000);
95 $userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime);
96
97 $prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000;
98 $previous="Paused-Paused";
99 foreach($data as $sdata)
100 {
101 $pts=$sdata['ts'];
102 if(isset($sdata['states']))
103 {
104 foreach($sdata['states'] as $ts=>$states)
105 {
106 $previous = str_replace('Paused-', '', $previous);
107 if(!in_array($previous,$checkhead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-'))) {
108 $previous = 'Paused';
109 }
110
111 $reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000;
112 $prets=$ts;
113 $previous=$states[0].'-'.$states[1];
114 }
115 $previous = str_replace('Paused-', '', $previous);
116 $reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000;
117 $prets=$pts;
118 }
119 }
120 }
121 if(count($userLogin)) foreach ($userLogin as $userid => $value)
122 {
123 $break_time=0;
124 foreach ($breaks as $break) {
125 $break_time+=$reportarray[$userid][$break];
126 }
127 $reportarray[$userid]["Duration"]=$value['duration'];
128 $reportarray[$userid]["Total"]=$value['duration']-$break_time-$reportarray[$userid]['Paused'];
129 $reportarray[$userid]["Preview"]=$reportarray[$userid]["Total"]-$reportarray[$userid]['oncall'];
130 $reportarray[$userid]["Breaks"]=$break_time;
131 $reportarray[$userid]["Idle"]=$reportarray[$userid]['Paused'];
132 }
133
134 $i=1;
135 foreach ($camp_userlist as $campaign => $campaignUserCountArr) {
136
137 // $campaign_wisearr[$campaign]['#']= $i++;
138
139 foreach ($campaignUserCountArr as $eachCampaignUserCount) {
140
141 if(array_key_exists($eachCampaignUserCount, $reportarray)) {
142 $campaign_wisearr[$campaign]['Duration'] += $reportarray[$eachCampaignUserCount]['Duration'];
143 $campaign_wisearr[$campaign]['Idle'] += $reportarray[$eachCampaignUserCount]['Idle'];
144 $campaign_wisearr[$campaign]['Breaks'] += $reportarray[$eachCampaignUserCount]['Breaks'];
145 $campaign_wisearr[$campaign]['Preview'] += $reportarray[$eachCampaignUserCount]['Preview'];
146 $campaign_wisearr[$campaign]['Total'] += $reportarray[$eachCampaignUserCount]['Total'];
147
148 }
149 }
150 }
151
152 foreach ($total_Accounts_loaded as $key => $value) {
153 $campaign_wisearr[$value->client]["Campaigns"] = $value->client;
154 $campaign_wisearr[$value->client]['Accounts Loaded']++;
155 }
156
157 $highestColumn = sizeof($reporthead);
158 if(count($campaign_wisearr)) {
159 $outhead="<tr>";$outstr="";
160 for ($head = 0; $head < $highestColumn; $head++){
161 if($reporthead[$head] == '#') {
162 $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>";
163 $outhead.="<td>".$mode_str."</td>";
164 }
165 else {
166 $outhead.="<td>".$reporthead[$head]."</td>";
167 }
168 }
169 $outhead.="</tr>";
170 $utotalarr = array("Campaigns"=>'Total');
171
172 foreach($campaign_wisearr as $uid=>$uarr)
173 {
174
175 $outstr.="<tr>";
176 for ($head = 0; $head < $highestColumn; $head++){
177 if($head < 1) {
178 $data_str = $uarr[$reporthead[$head]];
179 }
180 elseif($head < 9) {
181 $data_str = $uarr[$reporthead[$head]];
182 $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
183 }
184 else {
185 $data_str = secToDuration(round($uarr[$reporthead[$head]]));
186 $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]];
187 }
188 $outstr.="<td>".$data_str."</td>";
189 }
190 $outstr.="</tr>";
191 }
192 $outstr.="<tr>";
193 for ($head = 0; $head < $highestColumn; $head++)
194 {
195 if($head < 9) {
196 $data_str = $utotalarr[$reporthead[$head]];
197 }
198 else {
199 $data_str = secToDuration($utotalarr[$reporthead[$head]]);
200 }
201 $outstr.="<td>".$data_str."</td>";
202 }
203 $outstr.="</tr>";
204 }
205 else
206 {
207 $outhead.="<tr><td>No Records Found.</td></tr>";
208 }
209
210 if(Input::has("dllogxls"))
211 {
212 include_once(app_path().'/lib/phpexcel/PHPExcel.php');
213
214 $inputFileType = "Excel5";
215 $objReader = PHPExcel_IOFactory::createReader($inputFileType);
216 $objPHPExcel = $objReader->load("assets/extras/blank.xls");
217 $baseRow = 2;
218
219
220 $highestColumn = sizeof($reporthead);
221 for ($head = 0; $head < $highestColumn; $head++){
222 $colstr=PHPExcel_Cell::stringFromColumnIndex($head);
223 $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]);
224 }
225
226 foreach($campaign_wisearr as $uid=>$uarr)
227 {
228 $row = $baseRow++;
229 $col = 0;
230
231 for ($head = 0; $head < $highestColumn; $head++){
232 $excelval = ($head < 6) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]]));
233 $colstr=PHPExcel_Cell::stringFromColumnIndex($head);
234 $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval);
235 }
236 }
237
238 $row++;
239 for ($head = 0; $head < $highestColumn; $head++){
240 $excelval = ($head < 6) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]]));
241 $colstr=PHPExcel_Cell::stringFromColumnIndex($head);
242 $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval);
243 }
244
245 header('Content-Type: application/vnd.ms-excel');
246 header('Content-Disposition: attachment;filename="Campaignlevel.xls"');
247 header('Cache-Control: max-age=0');
248
249 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType);
250 $objWriter->save('php://output');
251
252 return ;
253 }
254
255 function secToDuration($sec) {
256 return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60);
257 }
258 ?>
259
260 <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> 1 <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style>
261 2
262 <div class=innerAll> 3 <div class=innerAll>
263 <h4 style="float:left;width:50%;margin:10px 0;">Campaign Level Report</h4> 4 <h4 style="float:left;width:50%;margin:10px 0;">Monitor</h4>
264 <div style="float:right;width:50%"> 5 <div style="float:right;width:50%">
265 <button class='pull-right btn btn-sm btn-default' onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button>
266 </div> 6 </div>
267 <div style="clear:both"></div> 7 <div style="clear:both"></div>
268 <hr style="margin-bottom: 5px;"> 8 <hr style="margin-bottom: 5px;">
269 <div> 9 <div>
270 Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;">&nbsp;&nbsp; 10 Campaign
271 Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> 11 <select id="campaign" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
272 <select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> 12 {!! $campStr !!}
273 <?php 13 </select>
274 foreach (range(0,23) as $hour) {
275 $selected = ($hour == $logtime) ? "selected" : "";
276 echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
277 }
278 ?></select>
279 To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' />
280 <select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'>
281 <?php
282 foreach (range(0,23) as $hour) {
283 $selected = ($hour == $logtimeto) ? "selected" : "";
284 echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
285 }
286 ?></select>
287 </div> 14 </div>
288 15
289 <div style="clear:both"></div> 16 <div style="clear:both"></div>
290 <hr style="margin:5px;"> 17 <hr style="margin:5px;">
291 18
292 <div style="overflow: auto; margin-top: 10px;"> 19 <div style="margin-top: 10px;">
293 <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;'> 20 @if($campaign != "Select")
294 <thead><?php echo $outhead; ?></thead> 21 <div class="row">
295 <?php echo $outstr; ?> 22 <div class="col-md-1">
296 </table> 23 <label for="total_agent" class="pull-right">Pacing:</label>
24 </div>
25 <div class="col-md-1">
26 <input type="text" class="form-control" disabled="disabled" value="{{$ratio}}">
27 </div>
28
29 <div class="col-md-1">
30 <label for="total_agent" class="pull-right">Total User:</label>
31 </div>
32 <div class="col-md-1">
33 <input type="text" class="form-control" disabled="disabled" value="{{$totalUsr}}">
34 </div>
35
36 <div class="col-md-1">
37 <label for="total_agent" class="pull-right">User InCall:</label>
38 </div>
39 <div class="col-md-1">
40 <input type="text" class="form-control" disabled="disabled" value="{{$inCall}}">
41 </div>
42
43 <div class="col-md-1">
44 <label for="total_agent" class="pull-right">Free User:</label>
45 </div>
46 <div class="col-md-1">
47 <input type="text" class="form-control" disabled="disabled" value="{{$freeUsr}}">
48 </div>
49 </div>
50
51 <div class="row" style="margin-top: 20px;">
52 <div class="col-md-1">
53 <label for="total_agent" class="pull-right">Total Channel:</label>
54 </div>
55 <div class="col-md-1">
56 <input type="text" class="form-control" disabled="disabled" value="{{$totalChnl}}">
57 </div>
58
59 <div class="col-md-1">
60 <label for="total_agent" class="pull-right">Avail Channel:</label>
61 </div>
62 <div class="col-md-1">
63 <input type="text" class="form-control" disabled="disabled" value="{{$availChnl}}">
64 </div>
65
66 <div class="col-md-1">
67 <label for="total_agent" class="pull-right">Call Dialing:</label>
68 </div>
69 <div class="col-md-1">
70 <input type="text" class="form-control" disabled="disabled" value="{{$dialedCall}}">
71 </div>
72
73 <div class="col-md-1">
74 <label for="total_agent" class="pull-right">Call Waiting:</label>
75 </div>
76 <div class="col-md-1">
77 <input type="text" class="form-control" disabled="disabled" value="{{$waitCall}}">
78 </div>
79 </div>
80
81 <div style="margin-top: 20px;">
82 <table class="table table-borderless">
83 <thead>
84 {!! $tabHeadStr !!}
85 </thead>
86 <tbody>
87 {!! $tabBodyStr !!}
88 </tbody>
89 </table>
297 </div> 90 </div>
298 91
299 <div id=dialoglog></div> 92 @else
300 </div> 93 <div class="panel panel-info"><span>Please Select Campaign From DropDown</span></div>
94 @endif
301 95
302 <script> 96 </div>
303 $(document).ready(function() {
304 if(!$('#dialoglog').hasClass('ui-dialog-content'))
305 {
306 $('#dialoglog').dialog({
307 autoOpen: false,
308 width: '70%',
309 buttons: {
310 "Ok": function() {
311 $(this).dialog("close");
312 },
313 "Cancel": function() {
314 $(this).dialog("close");
315 }
316 }
317 });
318 }
319 97
320 waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); 98 </div>
321 $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
322 $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
323 });
324 99
100 <script>
325 function dataString() 101 function dataString()
326 { 102 {
327 return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign=All';//+$("#campaign").val(); 103 return 'campaign='+$("#campaign").val();
328 } 104 }
329 function statusLogReloadFun(sortby) 105 function statusLogReloadFun(sortby)
330 { 106 {
331 var sortstr='';if(sortby!="")sortstr="&sort="+sortby 107 var sortstr='';if(sortby!="")sortstr="&sort="+sortby
332 var searchStr = dataString(); 108 var searchStr = dataString();
333 doAjax('dialer/campaignlevel?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); 109 doAjax('report/liveusers?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
334 }
335 function dlAgentlogXls()
336 {
337 var searchStr = dataString();
338 window.open('dialer/campaignlevel?dllogxls=1&'+searchStr);
339 return false;
340 } 110 }
111
112 setTimeout(function(){ statusLogReloadFun("") }, 10000);
341 </script> 113 </script>
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!