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);
if($dialline)
{
$dialline->user_id=Auth::user()->id;
$dialline->number=$callnumber;
$dialline->status="Blocked";
$dialline->regexstr=$client;
$dialline->save();
$nowts=microtime(true)*1000;
......
......@@ -9,21 +9,14 @@ use Input;
use Response;
use Config;
use App\Http\Requests;
use App\Models\Group;
use App\Models\Master;
use App\Models\Record;
use App\Models\CRMCall;
use App\Models\CRMCallArchive;
use App\Models\CRM;
use App\Models\CRMCampaign;
use App\Models\CRMList;
use App\Models\Cutoff;
use App\Jobs\KHRMSLib;
use App\Models\Sipid;
use App\Models\Dialline;
use App\Models\User;
use App\Models\UserLog;
use App\Models\Kqueue;
use DB;
use Log;
use Session;
......@@ -81,6 +74,7 @@ class ReportController extends Controller
$waitCall = 0;
$inCall = 0;
$availChnl = 0;
$freeUsr = 0;
$usrIdArr = array();
$tabHeadStr = "";
$tabBodyStr = "";
......@@ -97,18 +91,19 @@ class ReportController extends Controller
$mastersdata=$wakka->getCompanyMaster($campaign);
if(!empty($mastersdata["autodialercampaign"]))$ratio=$mastersdata["autodialercampaign"];
$userArr = User::where('presence', '=', "1")->where('sel_campaign', '=', $campaign)->select('id','username','fullname','current_dialmode')->get();
$diallineArr = Dialline::where("enabled","=","1")->get();
$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->src_channel!= '' && $dialline->channel== '')$dialedCall++;
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;
......@@ -121,23 +116,24 @@ class ReportController extends Controller
</tr>";
foreach ($userArr as $usr) {
$usrIdArr[] = $usr->id;
$statusStr = "<span class='btn btn-sm btn-warning'>Free</span>";
$statusStr = "<span class='btn btn-xs btn-warning'><strong>Free</strong></span>";
$sipIdArr = Sipid::where('user', "=", $usr->id)->where('status', '=', 1)->select('id', 'status', 'ready', 'patched')->first();
$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-sm btn-success'>Available</span>";
if($sipIdArr->patched==1)$statusStr = "<span class='btn btn-sm btn-info'>OnCall</span>";
if($sipIdArr->prepare_call==1&&$sipIdArr->patched==0)$statusStr = "<span class='btn btn-sm btn-info'>Wrap-Up</span>";
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>".$campaign."</td>";
$tabBodyStr .= "<td>".$usr->sel_campaign."</td>";
$tabBodyStr .= "<td>".$usr->current_dialmode."</td>";
$tabBodyStr .= "<td>".$statusStr."</td></tr>";
}
$freeUsr = Sipid::whereIn('user',$usrIdArr)->where('status', '=', 1)->where('ready', '=', 1)->where('patched', '=', 0)->count();
$data['ratio'] = $ratio;
$data['totalUsr'] = $userArr->count();
$data['totalChnl'] = $totalChnl;
......@@ -145,7 +141,7 @@ class ReportController extends Controller
$data['dialedCall'] = $dialedCall;
$data['waitCall'] = $waitCall;
$data['inCall'] = $inCall;
$data['freeUsr'] = $totalChnl;
$data['freeUsr'] = $freeUsr;
$data['tabHeadStr'] = $tabHeadStr;
$data['tabBodyStr'] = $tabBodyStr;
......@@ -181,9 +177,9 @@ class ReportController extends Controller
return view("layout.module.reports.statusreport",array());
}
if($id=="relationshipreport")
if($id=="campaignwise")
{
return view("layout.module.reports.relationshipreport",array());
return view("layout.module.reports.campaignwise",array());
}
}
}
......
......@@ -205,7 +205,7 @@ class KPAMIListen implements IEventListener
$record=$wakka->getPerson($crmcall->crm_id,$crmcall->client);
if($record)
{
DB::table('records_'.$crmcall->client)->where($crmcall->crm_id)->update(['filter_condition'=>'4']);
DB::table('records_'.$crmcall->client)->where('id', '=', $crmcall->crm_id)->update(['filter_condition'=>'4']);
$record["peopledata"]["dialer_status"]="FORCEDCLOSE";
$record["peopledata"]["dialer_substatus"]="FORCEDCLOSE";
$record["peopledata"]["dialer_callback"]="";
......@@ -467,10 +467,12 @@ class KPAMIListen implements IEventListener
$dialline=Dialline::find($crmcall->dialline_id);
if($dialline)
{
$dialline->user_id=0;
$dialline->status="Free";
$dialline->conf="";
$dialline->number="";
$dialline->uniqueid="";
$dialline->src_channel="";
$dialline->channel="";
$dialline->did="";
$dialline->save();
......@@ -579,12 +581,15 @@ class KPAMIListen implements IEventListener
{
$tsip->patched=0;
$tsip->save();
}
$newqueue=new Kqueue();
$newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
}
//$newqueue=new Kqueue();
//$newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
}
$crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt");
$crmcall->save();
......@@ -844,7 +849,7 @@ class KPAMIListen implements IEventListener
$dialline=Dialline::find($crmcall->dialline_id);
if($dialline)
{
$dialline->conf="1000".$tsip->id;
if($dialline->status!="AutoCall")$dialline->conf="1000".$tsip->id;
$dialline->channel=$channel;
$dialline->save();
}
......@@ -1100,7 +1105,7 @@ class KPAMIListen implements IEventListener
$dialline=Dialline::find($crmcall->dialline_id);
if($dialline)
{
$dialline->conf="1000".$tsip->id;
if($dialline->status!="AutoCall")$dialline->conf="1000".$tsip->id;
$dialline->channel=$channel;
$dialline->save();
}
......
<style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;}
/*#logtable.table thead tr{
display:block;
}
#logtable.table tbody{
display:block;
height:500px;
overflow:auto;//set tbody to auto
}*/
</style>
<div class=innerAll>
<h4 style="float:left;width:50%;margin:10px 0;">Campaign Report </small></h4>
<div style="float:right;width:50%">
@if(Auth::user()->username=='admin')
<button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button>
@endif
</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); ?>' />
<select id="modtime" style="border:1px solid #efefef;">
<?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); ?>'/>
<select id="modtimeto" style="border:1px solid #efefef;">
<?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;
<input type="button" value='Submit' class="btn btn-xs btn-info">
</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>
<th>Campaign</th>
<th>Dials</th>
<th>Connects</th>
<th>Contacts</th>
<th>Callbacks</th>
<th>Sales</th>
<th>No Answer</th>
<th>Busy</th>
<th>Sit Tones</th>
<th>Abandoned</th>
<th>Connect %</th>
<th>No Answer %</th>
<th>Busy %</th>
<th>Sit Tones %</th>
<th>Abandoned %</th>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</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'), '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();
}
function statusLogReloadFun(sortby)
{
var sortstr='';if(sortby!="")sortstr="&sort="+sortby
var searchStr = dataString();
doAjax('dialer/campaignwise?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
}
function dlAgentlogXls()
{
var searchStr = dataString();
//window.open('dialer/agenttime?dllogxls=1&'+searchStr);
return false;
}
</script>
<style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style>
<div class=innerAll>
<h4 style="float:left;width:50%;margin:10px 0;">Monitor</h4>
<h4 style="float:left;width:50%;margin:10px 0;">Campaign Monitor</h4>
<div style="float:right;width:50%">
</div>
<div style="clear:both"></div>
......@@ -98,6 +98,8 @@
</div>
<script>
var selectedCampaign = $("#campaign").val();
console.log(selectedCampaign);
function dataString()
{
return 'campaign='+$("#campaign").val();
......@@ -109,5 +111,5 @@ function statusLogReloadFun(sortby)
doAjax('report/liveusers?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
}
setTimeout(function(){ statusLogReloadFun("") }, 10000);
if(selectedCampaign!="Select")setTimeout(function(){ statusLogReloadFun("") }, 10000);
</script>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!