Added New Monitoring Report
Showing
4 changed files
with
195 additions
and
42 deletions
| ... | @@ -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(); | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment