6f1704c6 by Manish Mihsra

Added two more new columns into campaign wise report

1 parent 5ee2c380
......@@ -20,7 +20,6 @@ use App\Models\UserLog;
use DB;
use Log;
use Session;
use App\lib\PHP_XLSXWriter_master\XLSXWriter;
class ReportController extends Controller
{
......@@ -70,89 +69,89 @@ class ReportController extends Controller
if($id=="liveusers")
{
$campStr = "";
$ratio = 0;
$totalCall = 0;
$dialedCall = 0;
$waitCall = 0;
$inCall = 0;
$availChnl = 0;
$freeUsr = 0;
$usrIdArr = array();
$tabHeadStr = "";
$tabBodyStr = "";
foreach($oclientlst as $c)
{
$s="";
if($c==$campaign)$s='selected';
$campStr .= "<option value='$c' $s>$c</option>";
}
if ($campaign != "Select") {
$mastersdata=$wakka->getCompanyMaster($campaign);
if(!empty($mastersdata["autodialercampaign"]))$ratio=$mastersdata["autodialercampaign"];
$userArr = User::where('presence', '=', "1")->where('usertype', '=', 'User')->where('sel_campaign', '=', $campaign)->select('id','username','fullname', 'sel_campaign','current_dialmode')->get();
$diallineArr = Dialline::where('server', '=', env('app_ip'))->where("enabled","=","1")->get();
$totalChnl = $diallineArr->count();
foreach ($diallineArr as $dialline) {
if($dialline->regexstr== $campaign){
if($dialline->status!= 'Free')$totalCall++;
if($dialline->status!= 'Free' && $dialline->status!= 'Auto')$dialedCall++;
if($dialline->status== 'Auto' && $dialline->conf== '' && $dialline->src_channel!= '' && $dialline->channel!= '')$waitCall++;
if($dialline->status!= 'Free' && $dialline->conf!= '')$inCall++;
}
}
$availChnl = $totalChnl - $totalCall;
$tabHeadStr .= "<tr>
<th>User</th>
<th>Campaign</th>
<th>Mode</th>
<th>Status</th>
</tr>";
foreach ($userArr as $usr) {
$statusStr = "<span class='btn btn-xs btn-warning'><strong>Free</strong></span>";
$sipIdArr = Sipid::where('server', '=', env('app_ip'))->where('user', "=", $usr->id)->where('status', '=', 1)->select('id', 'status', 'ready', 'patched','prepare_call')->first();
//if($sipIdArr->user!=$usr->id) continue;
if($sipIdArr->patched==0) $freeUsr++;
if($sipIdArr->ready==1)$statusStr = "<span class='btn btn-xs btn-success'><strong>Available</strong></span>";
if($sipIdArr->patched==1)$statusStr = "<span class='btn btn-xs btn-info'><strong>InCall</strong></span>";
$wrapUp = DB::table('crmcalls')->where('user_id', '=', $usr->id)->where('state', '=', 'Hangup')->orderBy('id', 'desc')->select('id', 'userstatus')->first();
if($wrapUp->userstatus=="")$statusStr = "<span class='btn btn-xs btn-info'><strong>WrapUp</strong></span>";
$tabBodyStr .= "<tr><td>".$usr->fullname."</td>";
$tabBodyStr .= "<td>".$usr->sel_campaign."</td>";
$tabBodyStr .= "<td>".$usr->current_dialmode."</td>";
$tabBodyStr .= "<td>".$statusStr."</td></tr>";
}
$data['ratio'] = $ratio;
$data['totalUsr'] = $userArr->count();
$data['totalChnl'] = $totalChnl;
$data['availChnl'] = $availChnl;
$data['dialedCall'] = $dialedCall;
$data['waitCall'] = $waitCall;
$data['inCall'] = $inCall;
$data['freeUsr'] = $freeUsr;
$data['tabHeadStr'] = $tabHeadStr;
$data['tabBodyStr'] = $tabBodyStr;
}
$data['campStr'] = $campStr;
return view("layout.module.reports.liveusers", $data);
/*$campStr = "";
$ratio = 0;
$totalCall = 0;
$dialedCall = 0;
$waitCall = 0;
$inCall = 0;
$availChnl = 0;
$freeUsr = 0;
$usrIdArr = array();
$tabHeadStr = "";
$tabBodyStr = "";
foreach($oclientlst as $c)
{
$s="";
if($c==$campaign)$s='selected';
$campStr .= "<option value='$c' $s>$c</option>";
}
if ($campaign != "Select") {
$mastersdata=$wakka->getCompanyMaster($campaign);
if(!empty($mastersdata["autodialercampaign"]))$ratio=$mastersdata["autodialercampaign"];
$userArr = User::where('presence', '=', "1")->where('usertype', '=', 'User')->where('sel_campaign', '=', $campaign)->select('id','username','fullname', 'sel_campaign','current_dialmode')->get();
$diallineArr = Dialline::where('server', '=', env('app_ip'))->where("enabled","=","1")->get();
$totalChnl = $diallineArr->count();
foreach ($diallineArr as $dialline) {
if($dialline->regexstr== $campaign){
if($dialline->status!= 'Free')$totalCall++;
if($dialline->status!= 'Free' && $dialline->status!= 'Auto')$dialedCall++;
if($dialline->status== 'Auto' && $dialline->conf== '' && $dialline->src_channel!= '' && $dialline->channel!= '')$waitCall++;
if($dialline->status!= 'Free' && $dialline->conf!= '')$inCall++;
}
}
$availChnl = $totalChnl - $totalCall;
$tabHeadStr .= "<tr>
<th>User</th>
<th>Campaign</th>
<th>Mode</th>
<th>Status</th>
</tr>";
foreach ($userArr as $usr) {
$statusStr = "<span class='btn btn-xs btn-warning'><strong>Free</strong></span>";
$sipIdArr = Sipid::where('server', '=', env('app_ip'))->where('user', "=", $usr->id)->where('status', '=', 1)->select('id', 'status', 'ready', 'patched','prepare_call')->first();
if($sipIdArr->user!=$usr->id) continue;
if($sipIdArr->patched==0) $freeUsr++;
if($sipIdArr->ready==1)$statusStr = "<span class='btn btn-xs btn-success'><strong>Available</strong></span>";
if($sipIdArr->patched==1)$statusStr = "<span class='btn btn-xs btn-info'><strong>InCall</strong></span>";
$wrapUp = DB::table('crmcalls')->where('user_id', '=', $usr->id)->where('state', '=', 'Hangup')->orderBy('id', 'desc')->select('id', 'userstatus')->first();
if($wrapUp->userstatus=="")$statusStr = "<span class='btn btn-xs btn-info'><strong>WrapUp</strong></span>";
$tabBodyStr .= "<tr><td>".$usr->fullname."</td>";
$tabBodyStr .= "<td>".$usr->sel_campaign."</td>";
$tabBodyStr .= "<td>".$usr->current_dialmode."</td>";
$tabBodyStr .= "<td>".$statusStr."</td></tr>";
}
$data['ratio'] = $ratio;
$data['totalUsr'] = $userArr->count();
$data['totalChnl'] = $totalChnl;
$data['availChnl'] = $availChnl;
$data['dialedCall'] = $dialedCall;
$data['waitCall'] = $waitCall;
$data['inCall'] = $inCall;
$data['freeUsr'] = $freeUsr;
$data['tabHeadStr'] = $tabHeadStr;
$data['tabBodyStr'] = $tabBodyStr;
}
$data['campStr'] = $campStr;*/
return view("layout.module.dialer.liveusers", $data);
}
if($id=="calllog")
......@@ -221,6 +220,9 @@ class ReportController extends Controller
if($crmcallObj->user_id != 0) $reportArr[$crmcallObj->client]['connects']++;
if(strstr($crmcallObj->userstatus, "Contacted"))$reportArr[$crmcallObj->client]['contacts']++;
if(stristr($crmcallObj->usersubstatus, "follow"))$reportArr[$crmcallObj->client]['callbacks']++;
if(strstr($crmcallObj->status, "NOANSWER"))$reportArr[$crmcallObj->client]['no_answer']++;
if(stristr($crmcallObj->status, "busy"))$reportArr[$crmcallObj->client]['busy']++;
if($crmcallObj->status == "ANSWER" && $crmcallObj->user_id == 0)$reportArr[$crmcallObj->client]['abandoned']++;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!