->select('disposition_plan.id as dispositionPlanId','disposition_plan.name as name','disposition_plan.status AS status','disposition.code AS code','disposition_plan_config.disposition as disposition','disposition_plan_config.sub_disposition as sub_disposition')
->select('disposition.id as dispoId', 'disposition.plan AS plan', 'disposition.name as disposition','disposition.code as code','disposition.status AS status',
DB::raw('count(*) as totalSubDispo, sub_disposition.id'),
DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name'))
returnResponse::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>");
elseif($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl");
elseif($bucket=="TotalData")$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl");
/*else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl");
else if($bucket=="TotalData")//$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl");
else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl");
else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl");
else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl");
else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl");
*/
elseif($bucket=="MissedCalls")
{
{/*
$udidlinesstr = array();
foreach($didlinesstr as $didlinestr){
$didlinestrArr=explode(":",$didlinestr);
...
...
@@ -972,8 +1201,6 @@ public function show($id)
if(count($number_list) > 0) {
$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC");
//$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number)");
$tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;");
//if($client!=''){
$tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;",$client);
$tusers=$wakka->getPersonshome("filter_condition = '1' and $campaign->where_cond$orderby limit 1;");
$tusers=$wakka->getPersonshome("filter_condition IN ('1','0') and dialer_callback ='0000-00-00 00:00:00' and $campaign->where_cond$orderby limit 1;",$client);
$avgdisposecObj=CRMCall::select(DB::Raw('(avg(disposec))/1000 as avgdisposec'))->where("client","=",$campaign)->where("user_id","=",$user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first();
$avgcallsecObj=CRMCall::select(DB::Raw('(avg(callsec))/1000 as avgcallsec'))->where("client","=",$campaign)->where("user_id","=",$user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first();
//$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr");
//$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr");
$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status");
//$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status");
$countStatuses=array('New','Called');
foreach($countStatusesas$status){
...
...
@@ -103,59 +114,59 @@ use App\Models\CRMCall;
if($prevData=='MTD'&&$legalStatus!='SECONDARY')
{
$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'");
//$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'");
$TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
//$TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
//$NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
//$TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
//$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
//$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
/*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/
$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
//$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
}
if($prevData=='YTD'&&$legalStatus!='SECONDARY')
{
$ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status");
/*$ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status");
$TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/
/*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/
$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
//$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
}
if($prevData=='MTD'&&$legalStatus=='SECONDARY')
{
$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'");
/*$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'");
$TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/
/*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/
$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
// $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
}
if($prevData=='YTD'&&$legalStatus=='SECONDARY')
{
$ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'");
/* $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'");
$TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");
$NotCalled=$wakka->getCount("records","old_status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$TotalCalled=$wakka->getCount("records","old_status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
/*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/
$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");
*//*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/
/* $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/
$campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'");
//$campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'");
$campaignContactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'");
$supervisorAppointmentCount=DB::select('select customer_name,cust_id,mobile,dialer_appointment,status,dialer_lastcall,client from records where usr_id in ('.$supervisorUsers.') and dialer_appointment>"'.date("Y-m-d H:i:s",time()-(7*24*60*60)).'"');
$supervisorCampaignTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'");
$supervisorcampaignAppointCount=DB::select('select customer_name,cust_id,mobile,dialer_appointment,status,dialer_lastcall,client from records where usr_id in ('.$supervisorUsers.') and client = "'.$client.'" and dialer_appointment>"'.date("Y-m-d H:i:s",time()-(7*24*60*60)).'"');