fa27a3e9 by Manish Mihsra

Added some important value in the dialline table and report changes

1 parent a02abcee
...@@ -365,7 +365,10 @@ $users=$this->getCallSequencing(1); ...@@ -365,7 +365,10 @@ $users=$this->getCallSequencing(1);
365 365
366 if($dialline) 366 if($dialline)
367 { 367 {
368 $dialline->user_id=Auth::user()->id;
369 $dialline->number=$callnumber;
368 $dialline->status="Blocked"; 370 $dialline->status="Blocked";
371 $dialline->regexstr=$client;
369 $dialline->save(); 372 $dialline->save();
370 $nowts=microtime(true)*1000; 373 $nowts=microtime(true)*1000;
371 374
......
...@@ -9,21 +9,14 @@ use Input; ...@@ -9,21 +9,14 @@ use Input;
9 use Response; 9 use Response;
10 use Config; 10 use Config;
11 use App\Http\Requests; 11 use App\Http\Requests;
12 use App\Models\Group;
13 use App\Models\Master;
14 use App\Models\Record;
15 use App\Models\CRMCall; 12 use App\Models\CRMCall;
16 use App\Models\CRMCallArchive; 13 use App\Models\CRMCallArchive;
17 use App\Models\CRM;
18 use App\Models\CRMCampaign;
19 use App\Models\CRMList;
20 use App\Models\Cutoff; 14 use App\Models\Cutoff;
21 use App\Jobs\KHRMSLib; 15 use App\Jobs\KHRMSLib;
22 use App\Models\Sipid; 16 use App\Models\Sipid;
23 use App\Models\Dialline; 17 use App\Models\Dialline;
24 use App\Models\User; 18 use App\Models\User;
25 use App\Models\UserLog; 19 use App\Models\UserLog;
26 use App\Models\Kqueue;
27 use DB; 20 use DB;
28 use Log; 21 use Log;
29 use Session; 22 use Session;
...@@ -81,6 +74,7 @@ class ReportController extends Controller ...@@ -81,6 +74,7 @@ class ReportController extends Controller
81 $waitCall = 0; 74 $waitCall = 0;
82 $inCall = 0; 75 $inCall = 0;
83 $availChnl = 0; 76 $availChnl = 0;
77 $freeUsr = 0;
84 $usrIdArr = array(); 78 $usrIdArr = array();
85 $tabHeadStr = ""; 79 $tabHeadStr = "";
86 $tabBodyStr = ""; 80 $tabBodyStr = "";
...@@ -97,18 +91,19 @@ class ReportController extends Controller ...@@ -97,18 +91,19 @@ class ReportController extends Controller
97 $mastersdata=$wakka->getCompanyMaster($campaign); 91 $mastersdata=$wakka->getCompanyMaster($campaign);
98 if(!empty($mastersdata["autodialercampaign"]))$ratio=$mastersdata["autodialercampaign"]; 92 if(!empty($mastersdata["autodialercampaign"]))$ratio=$mastersdata["autodialercampaign"];
99 93
100 $userArr = User::where('presence', '=', "1")->where('sel_campaign', '=', $campaign)->select('id','username','fullname','current_dialmode')->get(); 94 $userArr = User::where('presence', '=', "1")->where('usertype', '=', 'User')->where('sel_campaign', '=', $campaign)->select('id','username','fullname', 'sel_campaign','current_dialmode')->get();
101 $diallineArr = Dialline::where("enabled","=","1")->get(); 95 $diallineArr = Dialline::where('server', '=', env('app_ip'))->where("enabled","=","1")->get();
102 96
103 $totalChnl = $diallineArr->count(); 97 $totalChnl = $diallineArr->count();
104 98
105 foreach ($diallineArr as $dialline) { 99 foreach ($diallineArr as $dialline) {
100 if($dialline->regexstr== $campaign){
106 101
107 if($dialline->status!= 'Free')$totalCall++; 102 if($dialline->status!= 'Free')$totalCall++;
108 if($dialline->status!= 'Free' && $dialline->src_channel!= '' && $dialline->channel== '')$dialedCall++; 103 if($dialline->status!= 'Free' && $dialline->status!= 'Auto')$dialedCall++;
109 if($dialline->status== 'Auto' && $dialline->conf== '' && $dialline->src_channel!= '' && $dialline->channel!= '')$waitCall++; 104 if($dialline->status== 'Auto' && $dialline->conf== '' && $dialline->src_channel!= '' && $dialline->channel!= '')$waitCall++;
110 if($dialline->status!= 'Free' && $dialline->conf!= '')$inCall++; 105 if($dialline->status!= 'Free' && $dialline->conf!= '')$inCall++;
111 106 }
112 } 107 }
113 108
114 $availChnl = $totalChnl - $totalCall; 109 $availChnl = $totalChnl - $totalCall;
...@@ -121,23 +116,24 @@ class ReportController extends Controller ...@@ -121,23 +116,24 @@ class ReportController extends Controller
121 </tr>"; 116 </tr>";
122 117
123 foreach ($userArr as $usr) { 118 foreach ($userArr as $usr) {
124 $usrIdArr[] = $usr->id; 119 $statusStr = "<span class='btn btn-xs btn-warning'><strong>Free</strong></span>";
125 $statusStr = "<span class='btn btn-sm btn-warning'>Free</span>";
126 120
127 $sipIdArr = Sipid::where('user', "=", $usr->id)->where('status', '=', 1)->select('id', 'status', 'ready', 'patched')->first(); 121 $sipIdArr = Sipid::where('server', '=', env('app_ip'))->where('user', "=", $usr->id)->where('status', '=', 1)->select('id', 'status', 'ready', 'patched','prepare_call')->first();
122 //if($sipIdArr->user!=$usr->id) continue;
123 if($sipIdArr->patched==0) $freeUsr++;
128 124
129 if($sipIdArr->ready==1)$statusStr = "<span class='btn btn-sm btn-success'>Available</span>"; 125 if($sipIdArr->ready==1)$statusStr = "<span class='btn btn-xs btn-success'><strong>Available</strong></span>";
130 if($sipIdArr->patched==1)$statusStr = "<span class='btn btn-sm btn-info'>OnCall</span>"; 126 if($sipIdArr->patched==1)$statusStr = "<span class='btn btn-xs btn-info'><strong>InCall</strong></span>";
131 if($sipIdArr->prepare_call==1&&$sipIdArr->patched==0)$statusStr = "<span class='btn btn-sm btn-info'>Wrap-Up</span>"; 127
128 $wrapUp = DB::table('crmcalls')->where('user_id', '=', $usr->id)->where('state', '=', 'Hangup')->orderBy('id', 'desc')->select('id', 'userstatus')->first();
129 if($wrapUp->userstatus=="")$statusStr = "<span class='btn btn-xs btn-info'><strong>WrapUp</strong></span>";
132 130
133 $tabBodyStr .= "<tr><td>".$usr->fullname."</td>"; 131 $tabBodyStr .= "<tr><td>".$usr->fullname."</td>";
134 $tabBodyStr .= "<td>".$campaign."</td>"; 132 $tabBodyStr .= "<td>".$usr->sel_campaign."</td>";
135 $tabBodyStr .= "<td>".$usr->current_dialmode."</td>"; 133 $tabBodyStr .= "<td>".$usr->current_dialmode."</td>";
136 $tabBodyStr .= "<td>".$statusStr."</td></tr>"; 134 $tabBodyStr .= "<td>".$statusStr."</td></tr>";
137 } 135 }
138 136
139 $freeUsr = Sipid::whereIn('user',$usrIdArr)->where('status', '=', 1)->where('ready', '=', 1)->where('patched', '=', 0)->count();
140
141 $data['ratio'] = $ratio; 137 $data['ratio'] = $ratio;
142 $data['totalUsr'] = $userArr->count(); 138 $data['totalUsr'] = $userArr->count();
143 $data['totalChnl'] = $totalChnl; 139 $data['totalChnl'] = $totalChnl;
...@@ -145,7 +141,7 @@ class ReportController extends Controller ...@@ -145,7 +141,7 @@ class ReportController extends Controller
145 $data['dialedCall'] = $dialedCall; 141 $data['dialedCall'] = $dialedCall;
146 $data['waitCall'] = $waitCall; 142 $data['waitCall'] = $waitCall;
147 $data['inCall'] = $inCall; 143 $data['inCall'] = $inCall;
148 $data['freeUsr'] = $totalChnl; 144 $data['freeUsr'] = $freeUsr;
149 $data['tabHeadStr'] = $tabHeadStr; 145 $data['tabHeadStr'] = $tabHeadStr;
150 $data['tabBodyStr'] = $tabBodyStr; 146 $data['tabBodyStr'] = $tabBodyStr;
151 147
...@@ -181,9 +177,9 @@ class ReportController extends Controller ...@@ -181,9 +177,9 @@ class ReportController extends Controller
181 return view("layout.module.reports.statusreport",array()); 177 return view("layout.module.reports.statusreport",array());
182 } 178 }
183 179
184 if($id=="relationshipreport") 180 if($id=="campaignwise")
185 { 181 {
186 return view("layout.module.reports.relationshipreport",array()); 182 return view("layout.module.reports.campaignwise",array());
187 } 183 }
188 } 184 }
189 } 185 }
......
...@@ -205,7 +205,7 @@ class KPAMIListen implements IEventListener ...@@ -205,7 +205,7 @@ class KPAMIListen implements IEventListener
205 $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client); 205 $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client);
206 if($record) 206 if($record)
207 { 207 {
208 DB::table('records_'.$crmcall->client)->where($crmcall->crm_id)->update(['filter_condition'=>'4']); 208 DB::table('records_'.$crmcall->client)->where('id', '=', $crmcall->crm_id)->update(['filter_condition'=>'4']);
209 $record["peopledata"]["dialer_status"]="FORCEDCLOSE"; 209 $record["peopledata"]["dialer_status"]="FORCEDCLOSE";
210 $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE"; 210 $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE";
211 $record["peopledata"]["dialer_callback"]=""; 211 $record["peopledata"]["dialer_callback"]="";
...@@ -467,10 +467,12 @@ class KPAMIListen implements IEventListener ...@@ -467,10 +467,12 @@ class KPAMIListen implements IEventListener
467 $dialline=Dialline::find($crmcall->dialline_id); 467 $dialline=Dialline::find($crmcall->dialline_id);
468 if($dialline) 468 if($dialline)
469 { 469 {
470 $dialline->user_id=0;
470 $dialline->status="Free"; 471 $dialline->status="Free";
471 $dialline->conf=""; 472 $dialline->conf="";
472 $dialline->number=""; 473 $dialline->number="";
473 $dialline->uniqueid=""; 474 $dialline->uniqueid="";
475 $dialline->src_channel="";
474 $dialline->channel=""; 476 $dialline->channel="";
475 $dialline->did=""; 477 $dialline->did="";
476 $dialline->save(); 478 $dialline->save();
...@@ -579,12 +581,15 @@ class KPAMIListen implements IEventListener ...@@ -579,12 +581,15 @@ class KPAMIListen implements IEventListener
579 { 581 {
580 $tsip->patched=0; 582 $tsip->patched=0;
581 $tsip->save(); 583 $tsip->save();
582 }
583 584
584 $newqueue=new Kqueue(); 585 $newqueue=new Kqueue();
585 $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); 586 $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
586 } 587 }
587 588
589 //$newqueue=new Kqueue();
590 //$newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
591 }
592
588 $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); 593 $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt");
589 594
590 $crmcall->save(); 595 $crmcall->save();
...@@ -844,7 +849,7 @@ class KPAMIListen implements IEventListener ...@@ -844,7 +849,7 @@ class KPAMIListen implements IEventListener
844 $dialline=Dialline::find($crmcall->dialline_id); 849 $dialline=Dialline::find($crmcall->dialline_id);
845 if($dialline) 850 if($dialline)
846 { 851 {
847 $dialline->conf="1000".$tsip->id; 852 if($dialline->status!="AutoCall")$dialline->conf="1000".$tsip->id;
848 $dialline->channel=$channel; 853 $dialline->channel=$channel;
849 $dialline->save(); 854 $dialline->save();
850 } 855 }
...@@ -1100,7 +1105,7 @@ class KPAMIListen implements IEventListener ...@@ -1100,7 +1105,7 @@ class KPAMIListen implements IEventListener
1100 $dialline=Dialline::find($crmcall->dialline_id); 1105 $dialline=Dialline::find($crmcall->dialline_id);
1101 if($dialline) 1106 if($dialline)
1102 { 1107 {
1103 $dialline->conf="1000".$tsip->id; 1108 if($dialline->status!="AutoCall")$dialline->conf="1000".$tsip->id;
1104 $dialline->channel=$channel; 1109 $dialline->channel=$channel;
1105 $dialline->save(); 1110 $dialline->save();
1106 } 1111 }
......
1 <style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;}
2 /*#logtable.table thead tr{
3 display:block;
4 }
5
6 #logtable.table tbody{
7 display:block;
8 height:500px;
9 overflow:auto;//set tbody to auto
10 }*/
11 </style>
12
13 <div class=innerAll>
14 <h4 style="float:left;width:50%;margin:10px 0;">Campaign Report </small></h4>
15 <div style="float:right;width:50%">
16 @if(Auth::user()->username=='admin')
17 <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button>
18 @endif
19 </div>
20 <div style="clear:both"></div>
21 <hr style="margin-bottom: 5px;">
22 <div>
23 Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;">&nbsp;&nbsp;
24 Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' />
25 <select id="modtime" style="border:1px solid #efefef;">
26 <?php
27 foreach (range(0,23) as $hour) {
28 $selected = ($hour == $logtime) ? "selected" : "";
29 echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
30 }
31 ?>
32 </select>
33 To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>'/>
34 <select id="modtimeto" style="border:1px solid #efefef;">
35 <?php
36 foreach (range(0,23) as $hour) {
37 $selected = ($hour == $logtimeto) ? "selected" : "";
38 echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>";
39 }
40 ?></select>&nbsp;&nbsp;
41 <input type="button" value='Submit' class="btn btn-xs btn-info">
42 </div>
43
44 <div style="clear:both"></div>
45 <hr style="margin:5px;">
46
47 <div style="overflow: auto; margin-top: 10px;">
48 <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;'>
49 <thead>
50 <th>Campaign</th>
51 <th>Dials</th>
52 <th>Connects</th>
53 <th>Contacts</th>
54 <th>Callbacks</th>
55 <th>Sales</th>
56 <th>No Answer</th>
57 <th>Busy</th>
58 <th>Sit Tones</th>
59 <th>Abandoned</th>
60 <th>Connect %</th>
61 <th>No Answer %</th>
62 <th>Busy %</th>
63 <th>Sit Tones %</th>
64 <th>Abandoned %</th>
65 </thead>
66
67 <tbody>
68 <tr>
69 <td></td>
70 <td></td>
71 <td></td>
72 <td></td>
73 <td></td>
74 <td></td>
75 <td></td>
76 <td></td>
77 <td></td>
78 <td></td>
79 <td></td>
80 <td></td>
81 <td></td>
82 <td></td>
83 <td></td>
84 </tr>
85 </tbody>
86 </table>
87 </div>
88
89 <div id=dialoglog></div>
90 </div>
91
92 <script>
93 $(document).ready(function() {
94 if(!$('#dialoglog').hasClass('ui-dialog-content'))
95 {
96 $('#dialoglog').dialog({
97 autoOpen: false,
98 width: '70%',
99 buttons: {
100 "Ok": function() {
101 $(this).dialog("close");
102 },
103 "Cancel": function() {
104 $(this).dialog("close");
105 }
106 }
107 });
108 }
109 waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logTableData') },"2000");
110 $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
111 $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
112 });
113
114 function dataString()
115 {
116 return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+$("#campaign").val();
117 }
118 function statusLogReloadFun(sortby)
119 {
120 var sortstr='';if(sortby!="")sortstr="&sort="+sortby
121 var searchStr = dataString();
122 doAjax('dialer/campaignwise?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
123 }
124 function dlAgentlogXls()
125 {
126 var searchStr = dataString();
127 //window.open('dialer/agenttime?dllogxls=1&'+searchStr);
128 return false;
129 }
130 </script>
1 <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>
2 2
3 <div class=innerAll> 3 <div class=innerAll>
4 <h4 style="float:left;width:50%;margin:10px 0;">Monitor</h4> 4 <h4 style="float:left;width:50%;margin:10px 0;">Campaign Monitor</h4>
5 <div style="float:right;width:50%"> 5 <div style="float:right;width:50%">
6 </div> 6 </div>
7 <div style="clear:both"></div> 7 <div style="clear:both"></div>
...@@ -98,6 +98,8 @@ ...@@ -98,6 +98,8 @@
98 </div> 98 </div>
99 99
100 <script> 100 <script>
101 var selectedCampaign = $("#campaign").val();
102 console.log(selectedCampaign);
101 function dataString() 103 function dataString()
102 { 104 {
103 return 'campaign='+$("#campaign").val(); 105 return 'campaign='+$("#campaign").val();
...@@ -109,5 +111,5 @@ function statusLogReloadFun(sortby) ...@@ -109,5 +111,5 @@ function statusLogReloadFun(sortby)
109 doAjax('report/liveusers?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); 111 doAjax('report/liveusers?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
110 } 112 }
111 113
112 setTimeout(function(){ statusLogReloadFun("") }, 10000); 114 if(selectedCampaign!="Select")setTimeout(function(){ statusLogReloadFun("") }, 10000);
113 </script> 115 </script>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!