How to use count method of calls class

Best Atoum code snippet using calls.count

OutboundController.php

Source:OutboundController.php Github

copy

Full Screen

...61 $rollover = VicidialInboundGroup::getAllInboundGroupData($human_answered_list);62 63 $total_calldetails = VicidialLog::whereIn('campaign_id',$group)64 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])65 ->select(DB::raw('count(*) as calls, sum(length_in_sec) as total_length'))66 ->get();67 $campaignstatuslist = array();68 $status_all = VicidialStatuses::where('human_answered','Y')->select(DB::raw('status'))->get();69 $i=0;70 while ($i < count($status_all)) { array_push($campaignstatuslist, $status_all[$i]['status']); $i++; }71 $campaign_statuses = VicidialCampaignStatuses::where('human_answered','Y')->whereIn('campaign_id',$group)->select(DB::raw('status,status_name'))->get();72 $i = 0;73 while ($i < count($campaign_statuses)) { array_push($campaignstatuslist, $campaign_statuses[$i]['status']); $i++; }74 75 $rollover_calls = VicidialCloserLog::whereIn('campaign_id',$human_answered_list)->whereIn('status',$campaignstatuslist)76 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])77 ->select(DB::raw('campaign_id,status,count(*) as calls,sum(length_in_sec) as total_length'))78 ->get();79 80 $human_answered1 = VicidialLog::whereIn('campaign_id',$group)81 ->whereIn('status',$campaignstatuslist)82 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])83 ->select(DB::raw('count(*) as calls,sum(length_in_sec) as total_length'))84 ->get();85 86 $agent_time_details = VicidialAgentLog::whereIn('campaign_id',$group)87 ->where([['event_time','<=',$enddate],['event_time','>=',$startdate],['pause_sec','<','65000'],['wait_sec','<','65000'],['talk_sec','<','65000'],['dispo_sec','<','65000']])88 ->select(DB::raw('sum(pause_sec + wait_sec + talk_sec + dispo_sec) as total_length'))89 ->get();90 $agentsec = $agent_time_details[0]['total_length'];91 92 $totalrollover_calls = 0;93 $k = 0;94 for ($i = 0; $i < count($rollover_calls); $i++) {95 $totalrollover_calls+=$rollover_calls[$i]['calls'];96 $k++;97 }98 $total_calls_count = $total_calldetails[0]['calls'];99 $totalsec = $total_calldetails[0]['total_length'];100 $total_length = $total_calldetails[0]['total_length'];101 102 $total_calls_average = $this->getDivision($total_length, $total_calls_count);103 $total_callsinfo['total_calls'] = $total_calls_count;104 $total_callsinfo['total_calls_avg'] = number_format((float)$total_calls_average, 2, '.', '');105 $total_callsinfo['rollover'] = count($rollover_calls) > 1 ? count($rollover_calls) : 0;106 107 $human_answered['total_calls'] = $human_answered1[0]['calls'];108 $human_answeredtotal_length = $human_answered1[0]['total_length'];109 if ($rollstatus == 'YES') {110 $human_answered['total_calls']+=$totalrollover_calls;111 }112 $human_answered_calls_average = $this->getDivision($human_answeredtotal_length, $human_answered['total_calls']);113 $human_answered['total_calls_avg'] = $human_answered_calls_average;114 $human_answered['total_calls_time'] = $this->secConvert($human_answered1[0]['total_length'], 'H');115 $drop_calls = VicidialLog::whereIn('campaign_id',$group)116 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate],['length_in_sec','<=','6000']])117 ->where('status','DROP')118 ->select(DB::raw('count(*) as calls,sum(length_in_sec) as total_length'))119 ->get();120 121 $answered_calls = VicidialLog::whereIn('campaign_id',$group)122 ->whereIn('status',$campaignstatuslist)123 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])124 ->select(DB::raw('count(*) as calls, sum(length_in_sec) as total_length'))125 ->get();126 127 $drop_details['dropcount'] = $drop_calls[0]['calls'];128 $drop_details['anscount'] = $answered_calls[0]['calls'];129 $drop_details['droptotpercent'] = round($this->MathZDC($drop_calls[0]['calls'], $total_calls_count) * 100, 2);130 $drop_details['dropanspercent'] = round($this->MathZDC($drop_calls[0]['calls'],$answered_calls[0]['calls']) * 100, 2);131 $drop_details['dropanscountwithroll'] = ($answered_calls[0]['calls'] + $totalrollover_calls);132 $drop_details['dropanspercentwithroll'] = round($this->MathZDC($drop_calls[0]['calls'], $drop_details['dropanscountwithroll']) * 100, 2);133 $drop_details['dropavglength'] = $this->getDivision($drop_calls[0]['total_length'], $drop_calls[0]['calls']);134 135 $closer_campaign_query = VicidialCampaign::whereIn('campaign_id',$group)->select(DB::raw('closer_campaigns'))->get();136 $c = 0;137 $closer_campaigns_sql = [];138 while ($c < count($closer_campaign_query)) {139 array_push($closer_campaigns_sql, $closer_campaign_query[$c]['closer_campaigns']);140 $c++;141 }142 $total_answers_1 = VicidialCloserLog::whereIn('campaign_id',$closer_campaigns_sql)143 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate],['status','<>',array('DROP', 'XDROP', 'HXFER', 'QVMAIL', 'HOLDTO', 'LIVE', 'QUEUE')]])144 ->select(DB::raw('COUNT(*) AS `count`'))->get();145 146 $total_answers = ($total_answers_1[0]['count'] + $answered_calls[0]['calls']);147 148 $agent_non_pause_sec = VicidialAgentLog::whereIn('campaign_id',$group)149 ->where([['event_time','<=',$enddate],['event_time','>=',$startdate],['pause_sec','<','65000'],['wait_sec','<','65000'],['talk_sec','<','65000'],['dispo_sec','<','65000']])150 ->select(DB::raw('sum(wait_sec + talk_sec + dispo_sec) as total_length'))151 ->get();152 $agent_non_pause_sec = isset($agent_non_pause_sec[0]['total_length']) ? $agent_non_pause_sec[0]['total_length'] : "0";153 $avg_answer_agent_non_pause_sec = ($this->getDivision($total_answers, $agent_non_pause_sec) * 60);154 $drop_details['prodrating'] = round($avg_answer_agent_non_pause_sec, 2);155 156 $auto_na_calls = VicidialLog::whereIn('campaign_id',$group)157 ->whereIn('status',array('NA', 'ADC', 'AB', 'CPDB', 'CPDUK', 'CPDATB', 'CPDNA', 'CPDREJ', 'CPDINV', 'CPDSUA', 'CPDSI', 'CPDSNC', 'CPDSR', 'CPDSUK', 'CPDSV', 'CPDERR'))158 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate],['length_in_sec','<=','60']])159 ->select(DB::raw('count(*) as calls, sum(length_in_sec) as total_length'))160 ->get(); 161 $manual_na_calls = VicidialLog::whereIn('campaign_id',$group)162 ->whereIn('status', array('B', 'DC', 'N'))163 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate],['length_in_sec','<=','60']])164 ->select(DB::raw('count(*) as calls, sum(length_in_sec) as total_length'))165 ->get(); 166 $hangupstats = VicidialLog::whereIn('campaign_id',$group)167 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])168 ->select(DB::raw('count(*) as calls, term_reason'))169 ->groupBy('term_reason')170 ->get();171 172 $statusstats = VicidialLog::whereIn('campaign_id',$group)173 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])174 ->select(DB::raw('count(*) as calls, sum(length_in_sec) as total_length, status'))175 ->groupBy('status')176 ->get();177 $liststats = VicidialLog::whereIn('campaign_id',$group)178 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate]])179 ->select(DB::raw('count(*) as calls, list_id'))180 ->groupBy('list_id')181 ->get();182 183 $statuscatlist = VicidialStatusCategories::select(DB::raw('vsc_id, vsc_name'))184 ->get();185 $agentstats = VicidialLog::join('vicidial_users', 'vicidial_log.user', '=','vicidial_users.user')186 ->select(DB::raw('vicidial_log.user, vicidial_users.full_name, count(*) as calls, avg(vicidial_log.length_in_sec) as avg_length, sum(vicidial_log.length_in_sec) as total_length '))187 ->where([['call_date','<=',$enddate],['call_date','>=',$startdate],['length_in_sec','>','0']])188 ->whereIn('campaign_id',$group)189 ->groupBy('user')190 ->get();191 $get_avg_time_1 = VicidialAgentLog::whereIn('campaign_id',$group)192 ->where([['event_time','<=',$enddate],['event_time','>=',$startdate],['pause_sec','<','65000'],['wait_sec','<','65000'],['talk_sec','<','65000'],['dispo_sec','<','65000']])193 ->select(DB::raw('avg(wait_sec) as avgwait_time'))194 ->get();195 $avgwait_time = isset($get_avg_time_1[0]['avgwait_time']) ? $this->secConvert($get_avg_time_1[0]['avgwait_time'], 'H') : "0";196 197 $hi_hour_count = 0;198 $last_full_record = 0;199 $i = 0;200 $h = 0;201 $hour_count = [];202 $drop_count = [];203 $timebottomstats = [];204 $bottom_tab_header_array = $bottom_tab_data_array = $bottom_tab_data_array_temp = [];205 if ($bottom_graph == "YES") {206 $startdate_array = explode(" ", $startdate);207 $query_date = $startdate_array[0];208 $hi_hour_count = 0;209 $last_full_record = 0;210 $i = 0;211 $h = 0;212 while ($i <= 96) {213 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':14:59'],['call_date','>=',$query_date.' '.$h.':00:00']])214 ->whereIn('campaign_id',$group)215 ->select(DB::raw('count(*) as calls'))216 ->get()->toArray();217 $hour_count[$i] = $rslt[0]['calls'];218 if ($hour_count[$i] > $hi_hour_count) { $hi_hour_count = $hour_count[$i]; }219 if ($hour_count[$i] > 0) { $last_full_record = $i; }220 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':14:59'],['call_date','>=',$query_date.' '.$h.':00:00']])221 ->whereIn('campaign_id',$group)222 ->where('status','DROP')223 ->select(DB::raw('count(*) as calls'))224 ->get()->toArray();225 $drop_count[$i] = $rslt[0]['calls'];226 $i++;227 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':29:59'],['call_date','>=',$query_date.' '.$h.':15:00']])228 ->whereIn('campaign_id',$group)229 ->select(DB::raw('count(*) as calls'))230 ->get()->toArray();231 $hour_count[$i] = $rslt[0]['calls'];232 if ($hour_count[$i] > $hi_hour_count) { $hi_hour_count = $hour_count[$i]; }233 if ($hour_count[$i] > 0) { $last_full_record = $i; }234 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':29:59'],['call_date','>=',$query_date.' '.$h.':15:00']])235 ->whereIn('campaign_id',$group)236 ->where('status','DROP')237 ->select(DB::raw('count(*) as calls'))238 ->get()->toArray();239 $drop_count[$i] = $rslt[0]['calls'];240 $i++;241 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':44:59'],['call_date','>=',$query_date.' '.$h.':30:00']])242 ->whereIn('campaign_id',$request['selected_groups'])243 ->select(DB::raw('count(*) as calls'))244 ->get()->toArray();245 246 $hour_count[$i] = $rslt[0]['calls'];247 if ($hour_count[$i] > $hi_hour_count) { $hi_hour_count = $hour_count[$i]; }248 if ($hour_count[$i] > 0) { $last_full_record = $i; }249 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':44:59'],['call_date','>=',$query_date.' '.$h.':30:00']])250 ->whereIn('campaign_id',$group)251 ->where('status','DROP')252 ->select(DB::raw('count(*) as calls'))253 ->get()->toArray();254 $drop_count[$i] = $rslt[0]['calls'];255 $i++;256 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':59:59'],['call_date','>=',$query_date.' '.$h.':45:00']])257 ->whereIn('campaign_id',$group)258 ->select(DB::raw('count(*) as calls'))259 ->get()->toArray();260 $hour_count[$i] = $rslt[0]['calls'];261 if ($hour_count[$i] > $hi_hour_count) { $hi_hour_count = $hour_count[$i]; }262 if ($hour_count[$i] > 0) { $last_full_record = $i; }263 $rslt = VicidialLog::where([['call_date','<=',$query_date.' '.$h.':59:59'],['call_date','>=',$query_date.' '.$h.':45:00']])264 ->whereIn('campaign_id',$group)265 ->where('status','DROP')266 ->select(DB::raw('count(*) as calls'))267 ->get()->toArray();268 $drop_count[$i] = $rslt[0]['calls'];269 $i++;270 $h++;271 }272 $hour_multiplier = $this->MathZDC(100, $hi_hour_count);273 $k = 1;274 $mk = 0;275 $call_scale = '0';276 while ($k <= 102) {277 if ($mk >= 5) {278 $mk = 0;279 $scale_num = $this->MathZDC($k, $hour_multiplier, 100);280 $scale_num = round($scale_num, 0);281 $len_scale_num = (strlen($scale_num));282 $k = ($k + $len_scale_num);283 array_push($bottom_tab_header_array, $scale_num);284 285 } else { 286 $k++; $mk++;287 }288 }289 290 $zz = '00';291 $i = 0;292 $h = 4;293 $hour = -1;294 $no_lines_yet = 1;295 while ($i <= 96) {296 $bottom_tab_data_array_temp = [];297 $char_counter = 0;298 $time = ' ';299 if ($h >= 4) {300 $hour++;301 $h = 0;302 if ($hour < 10) { $hour = "0$hour"; }303 $time = "+$hour$zz+";304 }305 if ($h == 1) { $time = " 15 "; }306 if ($h == 2) { $time = " 30 "; }307 if ($h == 3) { $time = " 45 "; }308 $ghour_count = $hour_count[$i];309 if ($ghour_count < 1) {310 if (($no_lines_yet) or ( $i > $last_full_record)) {311 $do_nothing = 1;312 } else {313 $hour_count[$i] = sprintf("%-5s", $hour_count[$i]);314 array_push($bottom_tab_data_array, $time);315 array_push($bottom_tab_data_array, '');316 $k = 0; 317 while ($k <= 102) {$k++;}318 array_push($bottom_tab_data_array, $hour_count[$i]);319 array_push($bottom_tab_data_array, '');320 }321 } else {322 $no_lines_yet = 0;323 $xhour_count = ($ghour_count * $hour_multiplier);324 $yhour_count = (99 - $xhour_count);325 $gdrop_count = $drop_count[$i];326 if ($gdrop_count < 1) {327 $hour_count[$i] = sprintf("%-5s", $hour_count[$i]);328 array_push($bottom_tab_data_array, $time);329 $tb_data ='';330 $k = 0; 331 while ($k <= $xhour_count) 332 {333 $tb_data .= '*';334 $k++;335 $char_counter++;336 }337 $tb_data .='*X';338 array_push($bottom_tab_data_array, $tb_data);339 $char_counter++;340 $k = 0;341 while ($k <= $yhour_count) {$k++; $char_counter++; }342 while ($char_counter <= 101) { $char_counter++; }343 array_push($bottom_tab_data_array, '0');344 array_push($bottom_tab_data_array, $hour_count[$i]);345 } else {346 $xdrop_count = ($gdrop_count * $hour_multiplier);347 $xxhour_count = ( ($xhour_count - $xdrop_count) - 1 );348 $hour_count[$i] = sprintf("%-5s", $hour_count[$i]);349 $drop_count[$i] = sprintf("%-5s", $drop_count[$i]);350 array_push($bottom_tab_data_array, $time);351 $tb_data ='';352 $k = 0;353 while ($k <= $xdrop_count)354 {355 $tb_data .= ">";356 $k++;357 $char_counter++;358 }359 $tb_data .= "D";360 $char_counter++;361 $k = 0;362 while ($k <= $xxhour_count)363 {364 $tb_data .="*";365 $k++;366 $char_counter++;367 }368 $tb_data .= "X";369 array_push($bottom_tab_data_array, $tb_data);370 $char_counter++;371 $k = 0; $tb_data = "";372 while ($k <= $yhour_count)373 {374 $tb_data .= " ";375 $k++;376 $char_counter++;377 }378 while ($char_counter <= 102)379 {380 $tb_data .= " ";381 $char_counter++;382 }383 384 array_push($bottom_tab_data_array, $drop_count[$i]);385 array_push($bottom_tab_data_array, $hour_count[$i]);386 }387 }388 $i++;389 $h++;390 if (!empty($bottom_tab_data_array_temp)) {391 array_push($bottom_tab_data_array, $bottom_tab_data_array_temp);392 }393 394 }395 }396 $agent_preset = [];397 $agent_preset_head = [];398 array_push($agent_preset_head, 'PRESET NAME');399 array_push($agent_preset_head, 'CALLS');400 $agent_preset['agent_preset_head'] = $agent_preset_head;401 $userlisttotalcalls = 0;402 $custom_stats = [];403 $custom_stats_head = [];404 array_push($custom_stats_head, 'CATEGORY');405 array_push($custom_stats_head, 'DESCRIPTION');406 array_push($custom_stats_head, 'CALLS');407 $custom_stats['custom_stats_head'] = $custom_stats_head;408 $statuscattotalcalls = 0;409 410 $agent_statastics = [];411 $agent_statastics_head = [];412 array_push($agent_statastics_head, 'AGENT');413 array_push($agent_statastics_head, 'CALLS');414 array_push($agent_statastics_head, 'TOTAL TIME');415 array_push($agent_statastics_head, 'AVG TIME');416 $agent_statastics['agent_statastics_head'] = $agent_statastics_head;417 $totalagents = 0;418 $totalagenttime = 0;419 $listtotalcalls = 0;420 $hanguptotalcalls = 0;421 $agent_preset_data = [];422 $custom_stats_data = [];423 $agent_statastics_data = [];424 $agent_statastics_total = [];425 $list_id_stats = [];426 $call_hangup_stats = [];427 for ($i = 0; $i < count($userlist); $i++) {428 $userlisttotalcalls+=$userlist[$i]['calls'];429 $agent_preset_data[$i]['preset_name'] = $userlist[$i]['preset_name'];430 $agent_preset_data[$i]['calls'] = $userlist[$i]['calls'];431 }432 $agent_preset['agent_preset_data'] = $agent_preset_data;433 for ($i = 0; $i < count($statuscatlist); $i++) {434 $custom_stats_data[$i]['vsc_id'] = $statuscatlist[$i]['vsc_id'];435 $custom_stats_data[$i]['vsc_name'] = $statuscatlist[$i]['vsc_name'];436 $custom_stats_data[$i]['statuscattotalcalls'] = $statuscattotalcalls;437 }438 $custom_stats['custom_stats_data'] = $custom_stats_data;439 for ($i = 0; $i < count($agentstats); $i++) {440 $totalagents += $agentstats[$i]['calls'];441 $totalagenttime += $agentstats[$i]['total_length'];442 $agent_statastics_data[$i]['user'] = $agentstats[$i]['user'];443 $agent_statastics_data[$i]['full_name'] = $agentstats[$i]['full_name'];444 $agent_statastics_data[$i]['calls'] = $agentstats[$i]['calls'];445 $agent_statastics_data[$i]['total_length'] = $this->secConvert($agentstats[$i]['total_length'], 'H');446 $agent_statastics_data[$i]['avg_length'] = $this->secConvert($agentstats[$i]['avg_length'], 'H');447 }448 $agent_statastics['agent_statastics_data'] = $agent_statastics_data;449 $totalagentavgtime = 0;450 if($totalagents>0){451 $totalagentavgtime = $totalagenttime / $totalagents;452 }453 454 $agent_statastics_total['totalagents'] = $totalagents;455 $agent_statastics_total['totalagenttime'] = $this->secConvert($totalagenttime, 'H');456 $agent_statastics_total['totalagentavgtime'] = $this->secConvert($totalagentavgtime, 'H');457 458 $agent_statastics['agent_statastics_total'] = $agent_statastics_total;459 $agent_statastics['avgwait_time'] = $avgwait_time;460 for ($i = 0; $i < count($liststats); $i++) {461 $listtotalcalls += $liststats[$i]['calls'];462 $list_id_stats[$i]['list_id'] = $liststats[$i]['list_id'];463 $list_id_stats[$i]['calls'] = $liststats[$i]['calls'];464 }465 for ($i = 0; $i < count($hangupstats); $i++) {466 $hanguptotalcalls += $hangupstats[$i]['calls'];467 $call_hangup_stats[$i]['term_reason'] = $hangupstats[$i]['term_reason'];468 $call_hangup_stats[$i]['calls'] = $hangupstats[$i]['calls'];469 }470 $agent_preset['userlisttotalcalls'] = $userlisttotalcalls;471 $custom_stats['statuscattotalcalls'] = $statuscattotalcalls;472 $list_id_stats['listtotalcalls'] = $listtotalcalls;473 $call_hangup_stats['hanguptotalcalls'] = $hanguptotalcalls;474 $statusstatsarray = array();475 $statusstatsinfoarray = array();476 $statusstatstotalcalls = 0;477 $statustotaltime = 0;478 $totalstatusrate = 0;479 $totalagentrate = 0;480 $finalstatusdetails = array();481 for ($i = 0; $i < count($statusstats); $i++) {482 if (($statusstats[$i]['status'] == 'DROP') && ($rollstatus == "YES")) {483 484 } else {485 array_push($statusstatsinfoarray, $statusstats[$i]['status']);486 }487 }488 if ($rollstatus == "YES") {489 for ($i = 0; $i < count($rollover_calls); $i++) {490 array_push($statusstatsinfoarray, $rollover_calls[$i]['status']);491 }492 }493 $statusdetails1 = VicidialCampaignStatuses::whereIn('status',$statusstatsinfoarray)494 ->select(DB::raw('status_name,category,status'))495 ->get();496 497 $statusdetails2 = VicidialStatuses::whereIn('status',$statusstatsinfoarray)498 ->select(DB::raw('status_name,category,status'))499 ->get();500 $maxstatusstatsarray = array();501 $maxstatustotalavg = array();502 $maxstatustotalrate = array();503 $maxstatustotalstatusrate = array();504 $rescarr = [];505 foreach($statusdetails1 as $key => $rows){506 array_push($rescarr, $rows['status']);507 }508 $ressarr = [];509 foreach($statusdetails2 as $key => $rows){510 array_push($ressarr, $rows['status']);511 }512 $callsdesc = $statusstats->sortByDesc('calls');513 $totaldesc = $statusstats->sortByDesc('total_length');514 $smax = 0;515 $armax = 0;516 $srmax = 0;517 $call_status_stat = [];518 $stat1 = ""; $stat2 = ""; $stat3 = ""; $stat4 = ""; $stat5 = "";519 for ($i = 0; $i < count($statusstats); $i++) 520 {521 $statusinfo = '';522 $key = "";523 $key = array_search($statusstats[$i]['status'], $rescarr);524 525 if ($key != "") {526 $statusinfo = $statusdetails1[$key]['status_name']."-".$statusdetails1[$key]['category'];527 }528 if ($statusinfo == '') {529 $key = array_search($statusstats[$i]['status'], $ressarr);530 if ("$key" != "") {531 $statusinfo = $statusdetails2[$key]['status_name']."-".$statusdetails2[$key]['category'];532 }533 }534 if (($statusstats[$i]['status'] == 'DROP') && ($rollstatus == "YES")) {535 536 } else {537 538 $statusstatstotalcalls += $statusstats[$i]['calls'];539 $statustotaltime += $statusstats[$i]['total_length'];540 $statusavg_sec = 0;541 if($statusstats[$i]['calls']>0){542 $statusavg_sec = ($statusstats[$i]['total_length'] / $statusstats[$i]['calls']);543 }544 545 if ($agentsec < 1) { $agentsec = 1; }546 $agentrate = $statusstats[$i]['calls'] / ($agentsec / 3600);547 $agentrate = sprintf("%.2f", $agentrate);548 if($totalsec>0){549 $statusrate = $statusstats[$i]['calls'] / ($totalsec / 3600);550 }551 $totalstatusrate+=$statusrate;552 $totalagentrate+=$agentrate;553 $singlearray = array('status' => $statusstats[$i]['status']."-".$statusinfo, 'calls' => $statusstats[$i]['calls'], 'status_hours' => $this->secConvert($statusstats[$i]['total_length'], 'H'), 'stats_avg_hours' => $this->secConvert($statusavg_sec, 'H'), 'statusrate' => number_format((float)$statusrate, 2, '.', ''), 'agentrate' => $agentrate);554 array_push($maxstatustotalavg, $statusavg_sec);555 array_push($maxstatustotalrate, $agentrate);556 array_push($maxstatustotalstatusrate, $statusrate);557 array_push($statusstatsarray, $singlearray);558 }559 }560 $maxstatustotalavgcount = '';561 if (count($maxstatustotalavg) > 0) { $maxstatustotalavgcount = max($maxstatustotalavg); } else { $maxstatustotalavgcount = 0; }562 $maxstatustotalavgcount = round($this->secConvert($maxstatustotalavgcount, 'S'));563 $maxstatustotalratecount = '';564 if (count($maxstatustotalrate) > 0) { $maxstatustotalratecount = max($maxstatustotalrate); } else { $maxstatustotalratecount = 0; }565 $maxstatustotalratecount = $maxstatustotalratecount;566 $maxstatustotalstatusratecount = '';567 if (count($maxstatustotalstatusrate) > 0) { $maxstatustotalstatusratecount = max($maxstatustotalstatusrate); } else { $maxstatustotalstatusratecount = 0; }568 $maxstatustotalstatusratecount = $maxstatustotalstatusratecount;569 if ($rollstatus == "YES") {570 $callsdesc = $rollover_calls->sortByDesc('calls');571 $totaldesc = $rollover_calls->sortByDesc('total_length');572 for ($i = 0; $i < count($rollover_calls); $i++) {573 if ($rollover_calls[$i]['calls'] > 0) {574 $key = "";575 $key = array_search($rollover_calls[$i]['status'], $rescarr);576 if ($key != "") {577 $statusinfo = $statusdetails1[$key]['status_name']."-".$statusdetails1[$key]['category'];578 }579 if ($statusinfo == '') {580 $key = array_search($rollover_calls[$i]['status'], $ressarr);581 if ($key != "") {582 $statusinfo = $statusdetails2[$key]['status_name']."-".$statusdetails2[$key]['category'];583 }584 }585 $statusstatstotalcalls += $rollover_calls[$i]['calls'];586 $statustotaltime += $rollover_calls[$i]['total_length'];587 $statusavg_sec = 0;588 if($rollover_calls[$i]['calls']>0){589 $statusavg_sec = ($rollover_calls[$i]['total_length'] / $rollover_calls[$i]['calls']);590 }591 if($agentsec>0){592 $agentrate = ($rollover_calls[$i]['calls'] / ($agentsec / 3600) );593 }594 595 $agentrate = sprintf("%.2f", $agentrate);596 $statusrate = 0;597 if($totalsec>0){598 $statusrate = ($rollover_calls[$i]['calls'] / ($totalsec / 3600) );599 }600 601 $totalstatusrate+=$statusrate;602 $totalagentrate+=$agentrate;603 $call_status_stat[$i]['status'] = $statusstats[$i]['status'].'-'.$statusinfo;604 $call_status_stat[$i]['calls'] = $statusstats[$i]['calls'];605 $call_status_stat[$i]['total_length'] = $this->secConvert($statusstats[$i]['total_length'], 'H');606 $call_status_stat[$i]['statusavg_sec'] = $this->secConvert($statusavg_sec, 'H');607 $call_status_stat[$i]['statusrate'] = number_format($statusrate, 2);608 $call_status_stat[$i]['agentrate'] = $agentrate;609 $singlearray = array('status' => $rollover_calls[$i]['status']."-".$statusinfo, 'calls' => $rollover_calls[$i]['calls'], 'status_hours' => $this->secConvert($rollover_calls[$i]['total_length'], 'H'), 'stats_avg_hours' => $this->secConvert($statusavg_sec, 'H'), 'statusrate' => $statusrate, 'agentrate' => $agentrate);610 array_push($statusstatsarray, $singlearray);611 }612 }613 }614 $call_status_stat['statusstatsarray'] = $statusstatsarray;615 $call_status_stat['callsdesc'] = $callsdesc;616 $call_status_stat['totaldesc'] = $totaldesc;617 $statusavgsec = '';618 if ($statusstatstotalcalls > 0) { $statusavgsec = $statustotaltime / $statusstatstotalcalls; } else { $statusavgsec = 0; }619 if ($reportdisplaytype == "HTML") {620 $call_status_stat['statusstatstotalcalls'] = $statusstatstotalcalls;621 $call_status_stat['stat2'] = $stat2;622 $call_status_stat['statustotaltime'] = $this->secConvert($statustotaltime, 'H');623 } else {624 $call_status_stat['statusstatstotalcalls'] = $statusstatstotalcalls;625 $call_status_stat['statustotaltime'] = $this->secConvert($statustotaltime, 'H');626 $call_status_stat['statusavgsec'] = $this->secConvert($statusavgsec, 'H');627 $call_status_stat['totalstatusrate'] = number_format($totalstatusrate, 2);628 $call_status_stat['totalagentrate'] = $totalagentrate;629 }630 $singlearray = array('status' => 'TOTAL', 'calls' => $statusstatstotalcalls, 'status_hours' => $this->secConvert($statustotaltime, 'H'), 'stats_avg_hours' => $this->secConvert($statusavgsec, 'H'), 'statusrate' => $totalstatusrate, 'agentrate' => $totalagentrate);631 array_push($statusstatsarray, $singlearray);632 $total_na_calls = ($auto_na_calls[0]['calls'] + $manual_na_calls[0]['calls']);633 $total_na_callspercent = round($this->MathZDC($total_na_calls, $total_calls_count) * 100, 2);634 $auto_na_callscount = $auto_na_calls[0]['calls'];635 $manual_na_callscount = $manual_na_calls[0]['calls'];636 $tot_nacalllength = ($auto_na_calls[0]['total_length'] + $manual_na_calls[0]['total_length']);637 $avglength = round($this->getDivision($manual_na_calls[0]['total_length'], $manual_na_calls[0]['calls']), 2);638 $na_calls_info['total_na_calls'] = $total_na_calls;639 $na_calls_info['total_na_callspercent'] = $total_na_callspercent;640 $na_calls_info['auto_na_calls'] = $auto_na_callscount;641 $na_calls_info['manual_na_calls'] = $manual_na_callscount;642 $na_calls_info['tot_nacalllength'] = $tot_nacalllength;643 $na_calls_info['avglength'] = $avglength;644 $bottom_graph = ['header' => $bottom_tab_header_array, 'data' => array_chunk($bottom_tab_data_array, 4)];645 date_default_timezone_set('America/Los_Angeles');646 $hanguparray = $userlistarray = $statuscatarray = $agentsarray = $maxagentarraycount = $maxhanguparraycount = $maxliststatsarraycount = $maxstatusstatsarraycount = $maxuserlistarraycount = $maxtotagentarraycount = $maxavgagentarraycount = [];647 return response()->json([648 'status'=>200, 649 'message' => 'Successfully.',650 'data'=>array("agent_preset" => $agent_preset, 'custom_stats' => $custom_stats, 'agent_statastics' => $agent_statastics, 'list_id_stats' => $list_id_stats, 'call_hangup_stats' => $call_hangup_stats, 'call_status_stat' => $call_status_stat, "total_callsinfo" => $total_callsinfo, "human_answered" => $human_answered, "drop_details" => $drop_details, 'na_calls_info' => $na_calls_info,651 "hangupstats" => $hanguparray, "statusstats" => $statusstatsarray, "userlist" => $userlistarray652 , "statuscatstats" => $statuscatarray, 'agentstats' => $agentsarray, 'timebottomstats' => $timebottomstats, 'maxagentarraycount' => $maxagentarraycount,653 'maxhanguparraycount' => $maxhanguparraycount, 'maxliststatsarraycount' => $maxliststatsarraycount, 'maxstatusstatsarray' => $maxstatusstatsarraycount,654 'maxstatustotalavgcount' => $maxstatustotalavgcount, 'maxuserlistarraycount' => $maxuserlistarraycount,655 'maxtotagentarraycount' => $maxtotagentarraycount, 'maxavgagentarraycount' => $maxavgagentarraycount, 'maxstatustotalratecount' => $maxstatustotalratecount, 'maxstatustotalstatusratecount' => $maxstatustotalstatusratecount,656 'startdate' => $startdate, 'enddate' => $enddate, 'bottom_graph' => $bottom_graph, 'nowtime' => date("Y-m-d H:i:s"))657 ]);658 659 } catch (Exception $e) {660 $this->postLogs(config('errorcontants.outbound_calling_report'), $e);661 throw $e;662 }663 }664 public function sortMultiArray($a, $b) {665 if ($a['status'] == $b['status']) {666 return $a['age'] - $b['age'];667 }668 return strcmp($a['status'], $b['status']);669 }670 public function MathZDC($dividend, $divisor, $quotient = 0)671 {672 if ($divisor == 0) {673 return $quotient;674 } else if ($dividend == 0) {675 return 0;676 } else {677 return ($dividend / $divisor);678 }679 }680 public function secConvert($sec, $precision)681 {682 $sec = round($sec, 0);683 if ($sec < 1) {684 if ($precision == 'HF') {685 return "00:00:00";686 } else {687 return "00:00:00";688 }689 } else {690 if ($precision == 'HF') {691 $precision = 'H';692 } else {693 if (($sec < 3600) and ( $precision != 'S')) {694 $precision = 'H';695 }696 }697 if ($precision == 'H') {698 $fhours_h = ($sec / 3600);699 $fhours_h_int = floor($fhours_h);700 $fhours_h_int = intval("$fhours_h_int");701 $fhours_h_int = ($fhours_h_int < 10) ? "0$fhours_h_int" : $fhours_h_int;702 $fhours_m = ($fhours_h - $fhours_h_int);703 $fhours_m = ($fhours_m * 60);704 $fhours_m_int = floor($fhours_m);705 $fhours_m_int = intval("$fhours_m_int");706 $fhours_s = ($fhours_m - $fhours_m_int);707 $fhours_s = ($fhours_s * 60);708 $fhours_s = round($fhours_s, 0);709 if ($fhours_s < 10) {710 $fhours_s = "0$fhours_s";711 }712 if ($fhours_m_int < 10) {713 $fhours_m_int = "0$fhours_m_int";714 }715 $ftime = "$fhours_h_int:$fhours_m_int:$fhours_s";716 }717 if ($precision == 'M') {718 $fminutes_m = ($sec / 60);719 $fminutes_m_int = floor($fminutes_m);720 $fminutes_m_int = intval("$fminutes_m_int");721 $fminutes_s = ($fminutes_m - $fminutes_m_int);722 $fminutes_s = ($fminutes_s * 60);723 $fminutes_s = round($fminutes_s, 0);724 if ($fminutes_s < 10) {725 $fminutes_s = "0$fminutes_s";726 }727 $ftime = "$fminutes_m_int:$fminutes_s";728 }729 if ($precision == 'S') {730 $ftime = $sec;731 }732 return "$ftime";733 }734 }735 public function getDivision($part, $whole)736 {737 if ($whole != 0) {738 if ($part != 0) {739 return ($part / $whole);740 } else return 0;741 } else return 0;742 }743 public function setTimeBegin($shift, $startdate, $enddate)744 {745 $query_date_begin = $query_date_end = $time_begin = $time_end = $am_shift_begin = $am_shift_end = $pm_shift_begin = $pm_shift_end = '';746 if ($shift == 'AM') {747 $time_begin = $am_shift_begin;748 $time_end = $am_shift_end;749 if (strlen($time_begin) < 6) { $time_begin = "03:45:00"; }750 if (strlen($time_end) < 6) { $time_end = "17:45:00"; }751 }752 if ($shift == 'PM') {753 $time_begin = $pm_shift_begin;754 $time_end = $pm_shift_end;755 if (strlen($time_begin) < 6) { $time_begin = "17:45:01"; }756 if (strlen($time_end) < 6) { $time_end = "23:59:59"; }757 }758 if ($shift == 'ALL') {759 if (strlen($time_begin) < 6) { $time_begin = "00:00:00"; }760 if (strlen($time_end) < 6) { $time_end = "23:59:59"; }761 }762 $query_date_begin = $startdate." ".$time_begin;763 $query_date_end = $enddate." ".$time_end;764 return(array('query_date_begin' => $query_date_begin, 'query_date_end' => $query_date_end));765 }766 public function outboundSummaryIntervalReport(Request $request) {767 try{768 ini_set("memory_limit", "1000M");769 // if (isset($request['selected_groups'])) {770 // $request['selected_groups'] = $this->getAcceptValue(ACCESS_TYPE_CAMPAIGN, $request['selected_groups'], ACCESS_READ, RETURN_ALL_SELECTOR, NOT_ALLOW_NULL);771 // }772//------------------------- Error --------------------------------773 // {774 // "status": 500,775 // "msg": "Class 'App\\Traits\\ClassRegistry' not found"776 // }777 $shift = $request['shift'];778 $startdate = date("Y-m-d", strtotime($request['startdate']));779 $enddate = date("Y-m-d", strtotime($request['enddate']));780 $selectedgroups = $request['selectedgroups'];781 $include_rollover = $request['include_rollover'];782 $timeinterval = $request['timeinterval'];783 $userlist = VicidialUser::get(['user_id','user_group']);784 785 $userlist = $userlist->unique('user_group');786 787 $viewablegrouplist = VicidialUserGroup::whereIn('user_group', $userlist)->get(['allowed_campaigns'])->toArray();788 array_push($viewablegrouplist, ['---ALL---']);789 $allowcampiagnarray = $list = $listy = $finalallow = array();790 foreach ($viewablegrouplist as $key => $value) {791 foreach ($value as $key_1 => $value1) {792 if ($key_1 == 'allowed_campaigns') {793 $allowcampaign = $value1;794 array_push($allowcampiagnarray, $allowcampaign);795 }796 }797 }798 $allowcampiagnarray = array_unique($allowcampiagnarray);799 $allowcampiagnarray = array_values($allowcampiagnarray);800 foreach ($allowcampiagnarray as $value) {801 $arra = explode(' ', $value);802 for ($j = 0; $j < count($arra); $j++) {803 $allowarr = $arra[$j];804 array_push($finalallow, $allowarr);805 } 806 }807 $finalallow = array_unique($finalallow); 808 $list = VicidialCampaign::get(['campaign_id'])->toArray();809 $allcam = array();810 foreach ($list as $row_key => $rows) {811 foreach ($rows as $key => $value) {812 array_push($allcam, $value);813 }814 }815 if (in_array('--ALL--', $selectedgroups)) {816 $campaignslistingall = $allcam;817 $selectedgroups = $allcam;818 } else {819 $campaignslistingall = $selectedgroups;820 }821 $group_string = '|';822 $i = 0;823 $group_ct = count($campaignslistingall);824 while ($i < $group_ct) {825 $group_string .= "$campaignslistingall[$i]|";826 $i++;827 }828 $query_date_begin = "$startdate 00:00:00";829 $query_date_end = "$enddate 23:59:59";830 $gct_default_start = isset($gct_default_start) ? $gct_default_start:'';831 $gct_default_stop = isset($gct_default_stop) ? $gct_default_stop:'';832 $ctstart = $gct_default_start."00";833 $ctstop = $gct_default_stop."59";834 if ($shift == 'ALL') {835 $gct_default_start = "0";836 $gct_default_stop = "2400";837 } else {838 $shiftdata = VicidialCallTime::where('call_time_id',$shift)->get(['ct_default_start','ct_default_stop']);839 if ($shiftdata->count() > 0) {840 $gct_default_start = $shiftdata[0]['ct_default_start'];841 $gct_default_stop = $shiftdata[0]['ct_default_stop'];842 } else {843 $gct_default_start = "0";844 $gct_default_stop = "2400";845 }846 }847 $campaign_wise_details = $hcalltime_hhmm = []; 848 $hf = $interval_count = $h_test = '';849 for ($i = 0; $i < count($campaign_wise_details); $i++) {850 $campaign_wise_details[$i]['campaign_name'] = $groupnamearray[$i];851 }852 if ($timeinterval <= 900) {853 $interval_count = 96;854 $hf = 45;855 }856 if (($timeinterval > 900) and ( $timeinterval <= 1800)) {857 $interval_count = 48;858 $hf = 30;859 }860 if ($timeinterval > 1800) {861 $interval_count = 24;862 }863 $h = 0;864 $hh = 0;865 $hcalltime = [];866 while ($h < $interval_count) {867 if ($interval_count >= 96) {868 if ($hf < 45) {869 $hf = ($hf + 15);870 } else {871 $hf = "00";872 if ($h > 0) {873 $hh++;874 }875 }876 $h_test = "$hh$hf";877 }878 if ($interval_count == 48) {879 if ($hf < 30) {880 $hf = ($hf + 30);881 } else {882 $hf = "00";883 if ($h > 0) {884 $hh++;885 }886 }887 $h_test = "$hh$hf";888 }889 if ($interval_count <= 24) {890 $h_test = $h."00";891 }892 if (($h_test >= $gct_default_start) and ( $h_test <= $gct_default_stop)) {893 $hcalltime[$h] = isset($hcalltime[$h]) ? $hcalltime[$h] : '';894 $hcalltime[$h] ++;895 $hcalltime_hhmm[$h] = "$h_test";896 }897 $h++;898 }899 if ($selectedgroups) {900 if (count($selectedgroups) > 0) {901 $campaign_wise_details = $this->getDetailsByCampaignId($selectedgroups, $startdate, $enddate, $gct_default_start, $gct_default_stop, $include_rollover, $timeinterval);902 903 $intervalcampaign_wise_details = $this->getDetailsByIntervalCampaignId($interval_count, $hcalltime_hhmm, $selectedgroups, $startdate, $enddate, $gct_default_start, $gct_default_stop, $include_rollover, $timeinterval);904 }905 }906 $allsubgraph = array();907 $i = $h = 0;908 $z = 0;909 while ($i < count($intervalcampaign_wise_details)) {910 $h = 0;911 $z = 0;912 while ($h < $interval_count) {913 if (isset($hcalltime[$h]) && $hcalltime[$h] > 0) {914 $intervalcampaign_wise_details[$i]['intervalcalls'][$h] = isset($intervalcampaign_wise_details[$i]['intervalcalls'][$h])?$intervalcampaign_wise_details[$i]['intervalcalls'][$h]:'';915 if (strlen($intervalcampaign_wise_details[$i]['intervalcalls'][$h]) < 1) {916 $hcalls_count[$h] = 0;917 } else {918 $hcalls_count[$h] = $intervalcampaign_wise_details[$i]['intervalcalls'][$h];919 }920 $intervalcampaign_wise_details[$i]['hsystem_count'][$h] = isset($intervalcampaign_wise_details[$i]['hsystem_count'][$h])?$intervalcampaign_wise_details[$i]['hsystem_count'][$h]:'';921 if (strlen($intervalcampaign_wise_details[$i]['hsystem_count'][$h]) < 1) {922 $hsystem_count[$h] = 0;923 } else {924 $hsystem_count[$h] = $intervalcampaign_wise_details[$i]['hsystem_count'][$h];925 }926 $intervalcampaign_wise_details[$i]['hagent_count'][$h] = isset($intervalcampaign_wise_details[$i]['hagent_count'][$h])?$intervalcampaign_wise_details[$i]['hagent_count'][$h]:'';927 if (strlen($intervalcampaign_wise_details[$i]['hagent_count'][$h]) < 1) {928 $hagent_count[$h] = 0;929 } else {930 $hagent_count[$h] = $intervalcampaign_wise_details[$i]['hagent_count'][$h];931 }932 $intervalcampaign_wise_details[$i]['hptp_count'][$h] = isset($intervalcampaign_wise_details[$i]['hptp_count'][$h])?$intervalcampaign_wise_details[$i]['hptp_count'][$h]:'';933 if (strlen($intervalcampaign_wise_details[$i]['hptp_count'][$h]) < 1) {934 $hptp_count[$h] = 0;935 } else {936 $hptp_count[$h] = $intervalcampaign_wise_details[$i]['hptp_count'][$h];937 }938 $intervalcampaign_wise_details[$i]['hrtp_count'][$h] = isset($intervalcampaign_wise_details[$i]['hrtp_count'][$h])?$intervalcampaign_wise_details[$i]['hrtp_count'][$h]:'';939 if (strlen($intervalcampaign_wise_details[$i]['hrtp_count'][$h]) < 1) {940 $hrtp_count[$h] = 0;941 } else {942 $hrtp_count[$h] = $intervalcampaign_wise_details[$i]['hrtp_count'][$h];943 }944 $intervalcampaign_wise_details[$i]['hna_count'][$h] = isset($intervalcampaign_wise_details[$i]['hna_count'][$h])?$intervalcampaign_wise_details[$i]['hna_count'][$h]:'';945 if (strlen($intervalcampaign_wise_details[$i]['hna_count'][$h]) < 1) {946 $hna_count[$h] = 0;947 } else {948 $hna_count[$h] = $intervalcampaign_wise_details[$i]['hna_count'][$h];949 }950 $intervalcampaign_wise_details[$i]['hdrop_count'][$h] = isset($intervalcampaign_wise_details[$i]['hdrop_count'][$h])?$intervalcampaign_wise_details[$i]['hdrop_count'][$h]:'';951 if (strlen($intervalcampaign_wise_details[$i]['hdrop_count'][$h]) < 1) {952 $hdrop_count[$h] = 0;953 } else {954 $hdrop_count[$h] = $intervalcampaign_wise_details[$i]['hdrop_count'][$h];955 }956 $intervalcampaign_wise_details[$i]['hagent_sec'][$h] = isset($intervalcampaign_wise_details[$i]['hagent_sec'][$h])?$intervalcampaign_wise_details[$i]['hagent_sec'][$h]:'';957 if (strlen($intervalcampaign_wise_details[$i]['hagent_sec'][$h]) < 1) {958 $hagent_sec[$h] = 0;959 } else {960 $hagent_sec[$h] = $intervalcampaign_wise_details[$i]['hagent_sec'][$h];961 }962 $intervalcampaign_wise_details[$i]['hpause_sec'][$h] = isset($intervalcampaign_wise_details[$i]['hpause_sec'][$h])?$intervalcampaign_wise_details[$i]['hpause_sec'][$h]:'';963 if (strlen($intervalcampaign_wise_details[$i]['hpause_sec'][$h]) < 1) {964 $hpause_sec[$h] = 0;965 } else {966 $hpause_sec[$h] = $intervalcampaign_wise_details[$i]['hpause_sec'][$h];967 }968 $hcalls_count[$h] = isset($hcalls_count[$h])?$hcalls_count[$h]:0;969 $hna_count[$h] = isset($hna_count[$h])?$hna_count[$h]:0;970 if (($hcalls_count[$h] < 1) || ($hna_count[$h] < 1)) {971 $hna_percent = 0.00;972 } else {973 $hna_percent = $this->calculatePercentage($hna_count[$h], $hcalls_count[$h]);974 }975 $hdrop_count[$h] = isset($hdrop_count[$h])?$hdrop_count[$h]:0;976 if (($hcalls_count[$h] < 1) || ($hdrop_count[$h] < 1)) {977 $h_drop_percent = 0.00;978 } else {979 $h_drop_percent = $this->calculatePercentage($hdrop_count[$h], $hcalls_count[$h]);980 }981 $hagent_sec1[$h] = $this->secConvert($hagent_sec[$h], 'H');982 $hpause_sec1[$h] = $this->secConvert($hpause_sec[$h], 'H');983 $sub_graph_stats[$i][$z][0] = "$hcalltime_hhmm[$h]";984 $sub_graph_stats[$i][$z][1] = $hcalls_count[$h];985 $sub_graph_stats[$i][$z][2] = $hsystem_count[$h];986 $sub_graph_stats[$i][$z][3] = $hagent_count[$h];987 $sub_graph_stats[$i][$z][4] = $hptp_count[$h];988 $sub_graph_stats[$i][$z][5] = $hrtp_count[$h];989 $sub_graph_stats[$i][$z][6] = $hna_percent;990 $sub_graph_stats[$i][$z][7] = $h_drop_percent;991 $sub_graph_stats[$i][$z][8] = $hagent_sec[$h];992 $sub_graph_stats[$i][$z][9] = $hpause_sec[$h];993 $sub_graph_stats[$i][$z][10] = $hagent_sec1[$h];994 $sub_graph_stats[$i][$z][11] = $hpause_sec1[$h];995 $z++;996 } else {997 $hcalls_count[$h] = 0;998 $hsystem_count[$h] = 0;999 $hagent_count[$h] = 0;1000 $hptp_count[$h] = 0;1001 $hrtp_count[$h] = 0;1002 }1003 $h++;1004 }1005 $i++;1006 }1007 $totalcampaigns = count($campaign_wise_details);1008 $loginagentt_secarray = array();1009 $totalagentpausetime = 0;1010 $loginagent_sectime = $loginagentt_sec = $pauselogin_sec = $naansarray = $totalcalls = $totalsystemcalls = $totalagentscalls = $totalsalecallsarray = $totaldnccallsarray = $gna_percent = $gdroppercent = $totaldrop = 0;1011 for ($i = 0; $i < count($campaign_wise_details); $i++) {1012 $totalcalls += $campaign_wise_details[$i]['totalcallevents'];1013 $totalsystemcalls += $campaign_wise_details[$i]['totalsystemcalls'];1014 $totaldrop += $campaign_wise_details[$i]['totaldrop'];1015 $totalagentscalls += $campaign_wise_details[$i]['totalagentscalls'];1016 $totalsalecallsarray += $campaign_wise_details[$i]['totalsalecallsarray'];1017 $totaldnccallsarray += $campaign_wise_details[$i]['totaldnccallsarray'];1018 $naansarray += $campaign_wise_details[$i]['naansarray'];1019 $pauselogin_sec += $campaign_wise_details[$i]['pauselogin_sec'];1020 $totalagentpausetime = $totalagentpausetime + $campaign_wise_details[$i]['pauselogin_sec'];1021 $loginagentt_sec += $campaign_wise_details[$i]['loginagentt_sec'];1022 $loginagent_sectime = $loginagent_sectime + $campaign_wise_details[$i]['loginagentt_sec'];1023 array_push($loginagentt_secarray, $loginagentt_sec);1024 }1025 $max_level = max($loginagentt_secarray);1026 // NA ANSWER %1027 if (($totalcalls < 1 || $naansarray < 1)) {1028 $gtotalnapercent = 0;1029 } else {1030 $gtotalnapercent1 = $this->getDivision($naansarray, $totalcalls);1031 $gtotalnapercent = round(($gtotalnapercent1 * 100), 2);1032 }1033 // ANSWER END1034 // DROP %1035 if (($totalcalls < 1 || $totaldrop < 1)) {1036 $gtotaldroppercent = 0;1037 } else {1038 $gtotaldroppercent1 = $this->getDivision($totaldrop, $totalcalls);1039 $gtotaldroppercent = round(($gtotaldroppercent1 * 100), 2);1040 }1041 // DROP END1042 //pause agent sec1043 $totalpauseagent_sec = $this->secConvert($pauselogin_sec, 'H');1044 $totalagentpausetimeall = $this->secConvert($totalagentpausetime, 'H');1045 //login agent sec1046 $totalloginagent_sec = $this->secConvert($loginagentt_sec, 'H');1047 $loginagent_sectimeall = $this->secConvert($loginagent_sectime, 'H');1048 // campaign name1049 $campaign_wise_detailss = $groupnamearray = array();1050 for ($i = 0; $i < count($campaign_wise_details); $i++) {1051 1052 $Grouplist = VicidialCampaigns::whereIn('campaign_id', [$campaign_wise_details[$i]['campaign_id']])->get(['campaign_name'])->toArray();1053 array_push($campaign_wise_detailss, $Grouplist);1054 }1055 foreach ($campaign_wise_detailss as $key => $value) {1056 foreach ($value as $key_1 => $value_1) {1057 $group_name = $value_1;1058 }1059 array_push($groupnamearray, $group_name);1060 }1061 for ($i = 0; $i < count($campaign_wise_details); $i++) {1062 $campaign_wise_details[$i]['campaign_name'] = $groupnamearray[$i];1063 }1064 $ivrarrayall = $ivrarray = array();1065 foreach ($campaign_wise_details as $key =>$value) {1066 foreach ($value as $ke => $val) {1067 if ($ke == 'totalcallevents') {1068 $value = $val;1069 array_push($ivrarray, $value);1070 }1071 }1072 }1073 $maxiver = max($ivrarray);1074 $datetime = $startdate ." ". date('H:i:s');1075 $sub_graph_stats = isset($sub_graph_stats)?$sub_graph_stats:[];1076 1077 $result = array(1078 'maxiver' => $max_level,1079 'group_string' => $group_string,1080 "datetime" => $datetime,1081 "sub_graph_stats" => $sub_graph_stats,1082 "totalloginagent_sec" => $totalloginagent_sec,1083 "totalpauseagent_sec" => $totalpauseagent_sec,1084 "gtotaldroppercent" => $gtotaldroppercent,1085 "gtotalnapercent" => $gtotalnapercent,1086 "totaldnccallsarray" => $totaldnccallsarray,1087 "totalsalecallsarray" => $totalsalecallsarray,1088 "totalcalls" => $totalcalls,1089 "totalsystemcalls" => $totalsystemcalls,1090 "totalagentscalls" => $totalagentscalls,1091 "campaign_wise_details" => $campaign_wise_details,1092 "totalcampaigns" => $totalcampaigns,1093 "totalagentlogintime" => $loginagent_sectimeall,1094 "totalagentpausetime" => $totalagentpausetimeall1095 );1096 1097 $download_csv = $request->input('download_csv');1098 if($download_csv == 'yes'){ # for download csv file .1099 return $result;1100 }1101 1102 return response()->json([1103 'status'=>200, 1104 'message' => 'Successfully.',1105 'maxiver' => $max_level,1106 'group_string' => $group_string,1107 "datetime" => $datetime,1108 "sub_graph_stats" => $sub_graph_stats,1109 "totalloginagent_sec" => $totalloginagent_sec,1110 "totalpauseagent_sec" => $totalpauseagent_sec,1111 "gtotaldroppercent" => $gtotaldroppercent,1112 "gtotalnapercent" => $gtotalnapercent,1113 "totaldnccallsarray" => $totaldnccallsarray,1114 "totalsalecallsarray" => $totalsalecallsarray,1115 "totalcalls" => $totalcalls,1116 "totalsystemcalls" => $totalsystemcalls,1117 "totalagentscalls" => $totalagentscalls,1118 "campaign_wise_details" => $campaign_wise_details,1119 "totalcampaigns" => $totalcampaigns,1120 "totalagentlogintime" => $loginagent_sectimeall,1121 "totalagentpausetime" => $totalagentpausetimeall1122 ]);1123 1124 } catch (Exception $e) {1125 $this->postLogs(config('errorcontants.outbound_summary_interval_report'), $e);1126 throw $e;1127 }1128 }1129 public function calculatePercentage($part, $whole)1130 {1131 if ($whole != 0) {1132 if ($part != 0) {1133 $percentage = $part * 100;1134 $percentage = $percentage / $whole;1135 return round($percentage);1136 } else return 0;1137 } else return 0;1138 }1139 public function getDetailsByIntervalCampaignId($interval_count, $hcalltime_hhmm, $campaignIdList, $startdate, $enddate, $gct_default_start, $gct_default_stop, $include_rollover, $timeinterval)1140 {1141 $mt = [];1142 $returndetailsintervalcampaignwise = array();1143 $query_date_begin = "$startdate 00:00:00";1144 $query_date_end = "$enddate 23:59:59";1145 $ctstart = $gct_default_start."00";1146 $ctstop = $gct_default_stop."59";1147 $hcalls_count = $mt;1148 $hcalls_count_in = $mt;1149 $hdrop_count = $mt;1150 $hdrop_count_out = $mt;1151 $hsystem_count = $mt;1152 $hagent_count = $mt;1153 $hptp_count = $mt;1154 $hrtp_count = $mt;1155 $hna_count = $mt;1156 $hanswer_count = $mt;1157 $statusarray = array(1158 'NA',1159 'NEW',1160 'QUEUE',1161 'INCALL',1162 'DROP',1163 'XDROP',1164 'AA',1165 'AM',1166 'AL',1167 'AFAX',1168 'AB',1169 'ADC',1170 'DNCL',1171 'DNCC',1172 'PU',1173 'PM',1174 'SVYEXT',1175 'SVYHU',1176 'SVYVM',1177 'SVYREC',1178 'QVMAIL'1179 );1180 $userlist = VicidialUser::get(['user_group'])->unique('user_group');1181 1182 $viewablegrouplist = VicidialUserGroup::whereIn('user_group', $userlist)->get(['allowed_campaigns'])->toArray();1183 array_push($viewablegrouplist, ['---ALL---']);1184 $allowcampiagnarray = $list = $listy = $finalallow = array();1185 foreach ($viewablegrouplist as $key => $value) {1186 foreach ($value as $key_1 => $value1) {1187 if ($key_1 == 'allowed_campaigns') {1188 $allowcampaign = $value1;1189 array_push($allowcampiagnarray, $allowcampaign);1190 }1191 }1192 }1193 $allowcampiagnarray = array_unique($allowcampiagnarray);1194 $allowcampiagnarray = array_values($allowcampiagnarray);1195 for ($i = 0; $i < count($allowcampiagnarray); $i++) {1196 $arra = explode(' ', $allowcampiagnarray[$i]);1197 for ($j = 0; $j < count($arra); $j++) {1198 $allowarr = $arra[$j];1199 array_push($finalallow, $allowarr);1200 }1201 }1202 $finalallow = array_unique($finalallow);1203 $finalallow = array_values($finalallow);1204 $list = VicidialCampaign::whereIn('campaign_id', $finalallow)->orderBy('campaign_id')->get(['campaign_id'])->toArray();1205 $allcam = array();1206 foreach ($list as $key => $rows) {1207 foreach ($rows as $ke => $value) {1208 array_push($allcam, $value);1209 }1210 }1211 if (in_array('--ALL--', $campaignIdList)) {1212 $campaignslistingall = $allcam;1213 } else {1214 $campaignslistingall = $campaignIdList;1215 }1216 foreach ($campaignslistingall as $key => $campaign) {1217 $totaloutboundlogdetails = VicidialLog::whereIn('campaign_id',[$campaign])1218 ->whereBetween('call_date',[$query_date_begin,$query_date_end])1219 ->get(['status', 'length_in_sec', 'call_date', 'call_date AS event_time', 'phone_number', 'campaign_id', 'uniqueid', 'lead_id'])->toArray();1220 1221 $totaloutboundcall = $hourarray = $testarray = array();1222 $i = 0;1223 foreach ($totaloutboundlogdetails as $key_11 => $li) {1224 $testarray[$i] = 0;1225 $call_date = [];1226 foreach ($li as $key => $value) {1227 if ($key == 'call_date') {1228 $call_date = explode(" ", $value);1229 }1230 }1231 $time = $call_date[1];1232 $time1 = explode(":", $time);1233 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1234 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1235 $time = $call_date[1];1236 $time1 = explode(":", $time);1237 array_push($hourarray, $time1[0]);1238 array_push($totaloutboundcall, $call_time);1239 $testarray[$i] = $time1[0];1240 }1241 $i++;1242 }1243 $hrarray = array();1244 foreach ($hcalltime_hhmm as $key => $value) {1245 $hour = $value;1246 array_push($hrarray, $hour);1247 }1248 $finaltotalcallperhour = $finalehourarray1 = array();1249 //total call per hour for group1250 $totalhourlycalls = array_count_values($hourarray);1251 1252 $u = $p = 0;1253 while ($p < count($totaloutboundlogdetails)) {1254 $cpstatus[$p] = $totaloutboundlogdetails[$p]['status'];1255 $cplength_in_sec[$p] = $totaloutboundlogdetails[$p]['length_in_sec'];1256 $cpcall_date[$p] = $totaloutboundlogdetails[$p]['call_date'];1257 $cpepoch[$p] = $totaloutboundlogdetails[$p]['event_time'];1258 $cpphone_number[$p] = $totaloutboundlogdetails[$p]['phone_number'];1259 $cpcampaign_id[$p] = $totaloutboundlogdetails[$p]['campaign_id'];1260 $cpvicidial_id[$p] = $totaloutboundlogdetails[$p]['uniqueid'];1261 $cplead_id[$p] = $totaloutboundlogdetails[$p]['lead_id'];1262 $testlead_id[$p] = $totaloutboundlogdetails[$p]['lead_id'];1263 $testuniqueid[$p] = $totaloutboundlogdetails[$p]['uniqueid'];1264 $cpin_out[$p] = 'OUT';1265 $p++;1266 $u++;1267 }1268 //TOTAL SALE CALLS1269 $totalsalecallsarray = array();1270 $totalcamapignstatus = VicidialStatuses::where('sale','=','Y')->get(['status']);1271 $sale_ct = 0;1272 $i = 0;1273 while ($i < count($totalcamapignstatus)) {1274 $sale_statuseslist[$sale_ct] = $totalcamapignstatus[$i]['status'];1275 $sale_ct++;1276 $i++;1277 }1278 // TOTAL DNC CALLS1279 $totaldnccallsarray = array();1280 $totalcamapignstatus = VicidialStatuses::where('dnc','=','Y')->get(['status']);1281 $dnc_ct = 0;1282 $i = 0;1283 while ($i < count($totalcamapignstatus)) {1284 $dnc_statuseslist[$dnc_ct] = $totalcamapignstatus[$i]['status'];1285 $dnc_ct++;1286 $i++;1287 }1288 // end1289 //AGENT LOGIN TIME, pause1290 ##### Gather Agent time records1291 $group_drop[$i] = isset($group_drop[$i])?$group_drop[$i]:'';1292 $totalagentlogdetails = VicidialAgentLog::whereIn('campaign_id',[$campaign,$group_drop[$i]])1293 ->whereBetween('event_time',[$query_date_begin,$query_date_end])1294 ->get(['event_time', 'event_time as unix_event_time', 'campaign_id', 'pause_sec', 'wait_sec', 'talk_sec', 'dispo_sec'])->toArray();1295 $atagentarray = $atpausearray = $atcall_date = array();1296 for ($s = 0; $s < count($totalagentlogdetails); $s++) {1297 $call_date1 = $totalagentlogdetails[$s]['event_time'];1298 $call_date = explode(" ", $call_date1);1299 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1300 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1301 $in_total_sec = ($totalagentlogdetails[$s]['pause_sec'] + $totalagentlogdetails[$s]['wait_sec'] + $totalagentlogdetails[$s]['talk_sec'] + $totalagentlogdetails[$s]['dispo_sec']);1302 $atcall_date[$s] = $totalagentlogdetails[$s]['event_time'];1303 $atepoch[$s] = $totalagentlogdetails[$s]['unix_event_time'];1304 $atcampaign_id[$s] = $totalagentlogdetails[$s]['campaign_id'];1305 $atpause_sec[$s] = $totalagentlogdetails[$s]['pause_sec'];1306 $atagent_sec[$s] = $in_total_sec;1307 if ($atagent_sec[$s] != 0) {1308 array_push($atagentarray, $atagent_sec[$s]);1309 }1310 if ($atpause_sec[$s] != 0) {1311 array_push($atpausearray, $atpause_sec[$s]);1312 }1313 }1314 }1315 // print_r($atcall_date);1316 $agent_sec = $pause_sec = 0;1317 for ($i = 0; $i < count($atagentarray); $i++) {1318 $agent_sec = $agent_sec + $atagentarray[$i];1319 }1320 $loginagent_sec = $this->secConvert($agent_sec, 'H');1321 for ($i = 0; $i < count($atpausearray); $i++) {1322 $pause_sec = $pause_sec + $atpausearray[$i];1323 }1324 $pauseagent_sec = $this->secConvert($pause_sec, 'H');1325 //end1326 ##### Parse through the agent time records to tally the time1327 $p = 0;1328 $cwday = 0;1329 $call_time1 = 0;1330 $hagent_sec = $hpause_sec = [];1331 while ($p < $s) 1332 {1333 if(!isset($atcall_date[$p])){1334 $chour = '0';1335 $cmin = '0';1336 } else {1337 $call_date = explode(" ", $atcall_date[$p]);1338 $call_time1 = preg_replace('/[^0-9]/', '', $call_date[1]);1339 $time1 = explode(":", $call_date[1]);1340 $chour = $time1[0];1341 $cmin = $time1[1];1342 }1343 1344 $ctstart = $gct_default_start."00";1345 $ctstop = $gct_default_stop."59";1346 $Gct_sunday_start = isset($Gct_sunday_start)?$Gct_sunday_start:'';1347 $Gct_sunday_stop = isset($Gct_sunday_stop)?$Gct_sunday_stop:'';1348 $Gct_monday_start = isset($Gct_monday_start)?$Gct_monday_start:'';1349 $Gct_monday_stop = isset($Gct_monday_stop)?$Gct_monday_stop:'';1350 $Gct_tuesday_start = isset($Gct_tuesday_start)?$Gct_tuesday_start:'';1351 $Gct_tuesday_stop = isset($Gct_tuesday_stop)?$Gct_tuesday_stop:'';1352 $Gct_wednesday_start = isset($Gct_wednesday_start)?$Gct_wednesday_start:'';1353 $Gct_wednesday_stop = isset($Gct_wednesday_stop)?$Gct_wednesday_stop:'';1354 1355 $Gct_thursday_start = isset($Gct_thursday_start)?$Gct_thursday_start:'';1356 $Gct_thursday_stop = isset($Gct_thursday_stop)?$Gct_thursday_stop:'';1357 1358 $Gct_friday_start = isset($Gct_friday_start)?$Gct_friday_start:'';1359 $Gct_friday_stop = isset($Gct_friday_stop)?$Gct_friday_stop:'';1360 1361 $Gct_saturday_start = isset($Gct_saturday_start)?$Gct_saturday_start:'';1362 $Gct_saturday_stop = isset($Gct_saturday_stop)?$Gct_saturday_stop:'';1363 if (($cwday == 0) and ( ($Gct_sunday_start > 0) and ( $Gct_sunday_stop > 0))) {1364 $ctstart = $Gct_sunday_start."00";1365 $ctstop = $Gct_sunday_stop."59";1366 }1367 if (($cwday == 1) and ( ($Gct_monday_start > 0) and ( $Gct_monday_stop > 0))) {1368 $ctstart = $Gct_monday_start."00";1369 $ctstop = $Gct_monday_stop."59";1370 }1371 if (($cwday == 2) and ( ($Gct_tuesday_start > 0) and ( $Gct_tuesday_stop > 0))) {1372 $ctstart = $Gct_tuesday_start."00";1373 $ctstop = $Gct_tuesday_stop."59";1374 }1375 if (($cwday == 3) and ( ($Gct_wednesday_start > 0) and ( $Gct_wednesday_stop > 0))) {1376 $ctstart = $Gct_wednesday_start."00";1377 $ctstop = $Gct_wednesday_stop."59";1378 }1379 if (($cwday == 4) and ( ($Gct_thursday_start > 0) and ( $Gct_thursday_stop > 0))) {1380 $ctstart = $Gct_thursday_start."00";1381 $ctstop = $Gct_thursday_stop."59";1382 }1383 if (($cwday == 5) and ( ($Gct_friday_start > 0) and ( $Gct_friday_stop > 0))) {1384 $ctstart = $Gct_friday_start."00";1385 $ctstop = $Gct_friday_stop."59";1386 }1387 if (($cwday == 6) and ( ($Gct_saturday_start > 0) and ( $Gct_saturday_stop > 0))) {1388 $ctstart = $Gct_saturday_start."00";1389 $ctstop = $Gct_saturday_stop."59";1390 }1391 if ($interval_count == 96) {1392 $chourX = ($chour * 4);1393 if ($cmin < 15) {1394 $cmin = "00";1395 $cminx = 0;1396 }1397 if (($cmin >= 15) and ( $cmin < 30)) {1398 $cmin = "15";1399 $cminx = 1;1400 }1401 if (($cmin >= 30) and ( $cmin < 45)) {1402 $cmin = "30";1403 $cminx = 2;1404 }1405 if ($cmin >= 45) {1406 $cmin = "45";1407 $cminx = 3;1408 }1409 $chour = ($chourX + $cminx);1410 }1411 if ($interval_count == 48) {1412 $chourX = ($chour * 2);1413 if ($cmin < 30) {1414 $cmin = "00";1415 $cminx = 0;1416 }1417 if ($cmin >= 30) {1418 $cmin = "30";1419 $cminx = 1;1420 }1421 $chour = ($chourX + $cminx);1422 }1423 1424 if (($call_time1 > $ctstart) && ($call_time1 < $ctstop)) {1425 if(!$chour == 0){1426 $atagent_sec[$p] = isset($atagent_sec[$p])?$atagent_sec[$p]:0;1427 $hagent_sec[$chour] = isset($hagent_sec[$chour])?$hagent_sec[$chour]:0;1428 $hagent_sec[$chour] = ($hagent_sec[$chour] + $atagent_sec[$p]);1429 $hpause_sec[$chour] = isset($hpause_sec[$chour])?$hpause_sec[$chour]:0;1430 $atpause_sec[$p] = isset($atpause_sec[$p])?$atpause_sec[$p]:0;1431 $hpause_sec[$chour] = ($hpause_sec[$chour] + $atpause_sec[$p]);1432 } 1433 }1434 $p++;1435 }1436 $i = 0;1437 while ($i < $u) {1438 $call_date = explode(" ", $cpcall_date[$i]);1439 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1440 $time1 = explode(":", $call_date[1]);1441 $chour = $time1[0];1442 $cmin = $time1[1];1443 if ($interval_count == 96) {1444 $chourX = ($chour * 4);1445 if ($cmin < 15) {1446 $cmin = "00";1447 $cminx = 0;1448 }1449 if (($cmin >= 15) && ($cmin < 30)) {1450 $cmin = "15";1451 $cminx = 1;1452 }1453 if (($cmin >= 30) && ($cmin < 45)) {1454 $cmin = "30";1455 $cminx = 2;1456 }1457 if ($cmin >= 45) {1458 $cmin = "45";1459 $cminx = 3;1460 }1461 $chour = ($chourX + $cminx);1462 }1463 if ($interval_count == 48) {1464 $chourX = ($chour * 2);1465 if ($cmin < 30) {1466 $cmin = "00";1467 $cminx = 0;1468 }1469 if ($cmin >= 30) {1470 $cmin = "30";1471 $cminx = 1;1472 }1473 $chour = ($chourX + $cminx);1474 }1475 $answer_count = $agent_count = $system_count = $na_count = $rtp_count = $drop_count_out = $drop_count = [];1476 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1477 $hcalls_count[$chour] = isset($hcalls_count[$chour])?($hcalls_count[$chour]):0;1478 $hcalls_count[$chour] ++;1479 if (preg_match("/DROP/i", $cpstatus[$i])) {1480 if ($cpin_out[$i] == 'OUT') {1481 $drop_count_out[$i] = isset($drop_count_out[$i])?($drop_count_out[$i]):0;1482 $drop_count_out[$i] ++;1483 $hdrop_count_out[$chour] = isset($hdrop_count_out[$chour])?($hdrop_count_out[$chour]):0;1484 $hdrop_count_out[$chour] ++;1485 }1486 $drop_count[$i] = isset($drop_count[$i])?($drop_count[$i]):0;1487 $drop_count[$i] ++;1488 $hdrop_count[$chour] = isset($hdrop_count[$chour])?($hdrop_count[$chour]):0;1489 $hdrop_count[$chour] ++;1490 } else {1491 $answer_count[$i] = isset($answer_count[$i])?($answer_count[$i]):0;1492 $answer_count[$i] ++;1493 $hanswer_count[$chour] = isset($hanswer_count[$chour])?($hanswer_count[$chour]):0;1494 $hanswer_count[$chour] ++;1495 }1496 if (in_array($cpstatus[$i], $statusarray)) {1497 $system_count[$i] = isset($system_count[$i])?($system_count[$i]):0;1498 $system_count[$i] ++;1499 $hsystem_count[$chour] = isset($hsystem_count[$chour])?($hsystem_count[$chour]):0;1500 $hsystem_count[$chour] ++;1501 } else {1502 $agent_count[$i] = isset($agent_count[$i])?($agent_count[$i]):0;1503 $agent_count[$i] ++;1504 $hagent_count[$chour] = isset($hagent_count[$chour])?($hagent_count[$chour]):0;1505 $hagent_count[$chour] ++;1506 }1507 $k = 0;1508 while ($k < $sale_ct) {1509 if ($sale_statuseslist[$k] == $cpstatus[$i]) {1510 $ptp_count[$i] = isset($ptp_count[$i])?($ptp_count[$i]):0;1511 $ptp_count[$i] ++;1512 $hptp_count[$chour] = isset($hptp_count[$chour])?($hptp_count[$chour]):0;1513 $hptp_count[$chour] ++;1514 }1515 $k++;1516 }1517 $k = 0;1518 while ($k < $dnc_ct) {1519 if ($dnc_statuseslist[$k] == $cpstatus[$i]) {1520 $rtp_count[$i] = isset($rtp_count[$i])?($rtp_count[$i]):0;1521 $rtp_count[$i] ++;1522 $hrtp_count[$chour] = isset($hrtp_count[$chour])?($hrtp_count[$chour]):0;1523 $hrtp_count[$chour] ++;1524 }1525 $k++;1526 }1527 if ($cpstatus[$i] == 'NA') {1528 $na_count[$i] = isset($na_count[$i])?($na_count[$i]):0;1529 $na_count[$i] ++;1530 $hna_count[$chour] = isset($hna_count[$chour])?($hna_count[$chour]):0;1531 $hna_count[$chour] ++;1532 }1533 }1534 $i++;1535 }1536 $intervalcalls = array();1537 if ($timeinterval == '3600') {1538 $intervalcalls = $totalhourlycalls;1539 //$intervalcalls=$hcalls_count;1540 $hsystem_count1 = $hsystem_count;1541 $hagent_count1 = $hagent_count;1542 $hptp_count1 = $hptp_count;1543 $hrtp_count1 = $hrtp_count;1544 $hna_count1 = $hna_count;1545 $hdrop_count1 = $hdrop_count;1546 $hagent_sec1 = $hagent_sec;1547 $hpause_sec1 = $hpause_sec;1548 } else {1549 $intervalcalls = $hcalls_count;1550 $hsystem_count1 = $hsystem_count;1551 $hagent_count1 = $hagent_count;1552 $hptp_count1 = $hptp_count;1553 $hrtp_count1 = $hrtp_count;1554 $hna_count1 = $hna_count;1555 $hdrop_count1 = $hdrop_count;1556 $hagent_sec1 = $hagent_sec;1557 $hpause_sec1 = $hpause_sec;1558 }1559 unset($hcalls_count);1560 $hcalls_count = $mt;1561 unset($hsystem_count);1562 $hsystem_count = $mt;1563 unset($hagent_count);1564 $hagent_count = $mt;1565 unset($hptp_count);1566 $hptp_count = $mt;1567 unset($hrtp_count);1568 $hrtp_count = $mt;1569 unset($hna_count);1570 $hna_count = $mt;1571 unset($hdrop_count);1572 $hdrop_count = $mt;1573 unset($hagent_sec);1574 $hagent_sec = $mt;1575 unset($hpause_sec);1576 $hpause_sec = $mt;1577 $singlecampaigncetails = array(1578 'campaign_id' => $campaign,1579 'intervalcalls' => $intervalcalls,1580 'hsystem_count' => $hsystem_count1,1581 'hagent_count' => $hagent_count1,1582 'hptp_count' => $hptp_count1,1583 'hrtp_count' => $hrtp_count1,1584 'hna_count' => $hna_count1,1585 'hdrop_count' => $hdrop_count1,1586 'hpause_sec' => $hpause_sec1,1587 'hagent_sec' => $hagent_sec11588 );1589 array_push($returndetailsintervalcampaignwise, $singlecampaigncetails);1590 unset($singlecampaigncetails);1591 $singlecampaigncetails = array();1592 }1593 return $returndetailsintervalcampaignwise;1594 }1595 public function getDetailsByCampaignId($campaignIdList, $startdate, $enddate, $gct_default_start, $gct_default_stop, $include_rollover, $timeinterval)1596 {1597 $returndetailscampaignwise = array();1598 $query_date_begin = "$startdate 00:00:00";1599 $query_date_end = "$enddate 23:59:59";1600 $ctstart = $gct_default_start."00";1601 $ctstop = $gct_default_stop."59";1602 $userlist = VicidialUser::get(['user_group'])->unique('user_group');1603 $viewablegrouplist = VicidialUserGroup::whereIn('user_group', $userlist)->get(['allowed_campaigns'])->toArray();1604 array_push($viewablegrouplist, ['---ALL---']);1605 $allowcampiagnarray = $list = $listy = $finalallow = array();1606 foreach ($viewablegrouplist as $key => $value) {1607 foreach ($value as $key_1 => $value1) {1608 if ($key_1 == 'allowed_campaigns') {1609 $allowcampaign = $value1;1610 array_push($allowcampiagnarray, $allowcampaign);1611 }1612 }1613 }1614 $allowcampiagnarray = array_unique($allowcampiagnarray);1615 $allowcampiagnarray = array_values($allowcampiagnarray);1616 1617 foreach ($allowcampiagnarray as $value) {1618 $arra = explode(' ', $value);1619 for ($j = 0; $j < count($arra); $j++) {1620 $allowarr = $arra[$j];1621 array_push($finalallow, $allowarr);1622 } 1623 }1624 $finalallow = array_unique($finalallow);1625 $finalallow = array_values($finalallow);1626 $list = VicidialCampaign::whereIn('campaign_id', $finalallow)->orderBy('campaign_id')->get(['campaign_id'])->toArray();1627 $allcam = array();1628 foreach ($list as $key) {1629 foreach ($key as $ke => $value) {1630 $val = $value;1631 array_push($allcam, $val);1632 }1633 }1634 if (in_array('--ALL--', $campaignIdList)) {1635 $campaignslistingall = $allcam;1636 } else {1637 $campaignslistingall = $campaignIdList;1638 }1639 $i=0;$group_drop = [];1640 foreach ($campaignslistingall as $key => $campaign) {1641 1642 $group_drop[$i] = isset($group_drop[$i])?$group_drop[$i]:'';1643 if($group_drop[$i]==''){1644 $group_drop[$i] =NULL;1645 }1646 $totaloutboundlogdetails = VicidialLog::whereIn('campaign_id',[$campaign, $group_drop[$i]])1647 ->whereBetween('call_date',[$query_date_begin,$query_date_end])1648 ->get(['status',1649 'length_in_sec',1650 'call_date',1651 'call_date as event_time',1652 'phone_number',1653 'campaign_id',1654 'uniqueid',1655 'lead_id'])->toArray();1656 1657 $totaloutboundcall = $hourarray = array();1658 1659 foreach ($totaloutboundlogdetails AS $li) {1660 foreach ($li As $key => $value) {1661 if ($key == 'call_date') {1662 $call_date = explode(" ", $value);1663 }1664 }1665 $time = $call_date[1];1666 $time1 = explode(":", $time);1667 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1668 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1669 $time = $call_date[1];1670 $time1 = explode(":", $time);1671 array_push($hourarray, $time1[0]);1672 array_push($totaloutboundcall, $call_time);1673 }1674 }1675 $totalanswercalls = $totaldrop = array();1676 for ($i = 0; $i < count($totaloutboundlogdetails); $i++) {1677 if ($totaloutboundlogdetails[$i]['status'] == 'DROP' || $totaloutboundlogdetails[$i]['status'] == 'PDROP') {1678 $call_date1 = $totaloutboundlogdetails[$i]['call_date'];1679 ;1680 $call_date = explode(" ", $call_date1);1681 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1682 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1683 $length_in_sec = $totaloutboundlogdetails[$i]['length_in_sec'];1684 array_push($totaldrop, $call_time);1685 }1686 } else {1687 $call_date1 = $totaloutboundlogdetails[$i]['call_date'];1688 ;1689 $call_date = explode(" ", $call_date1);1690 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1691 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1692 $length_in_sec = $totaloutboundlogdetails[$i]['length_in_sec'];1693 array_push($totalanswercalls, $call_time);1694 }1695 }1696 }1697 $statusarray = array(1698 'NA',1699 'NEW',1700 'QUEUE',1701 'INCALL',1702 'DROP',1703 'XDROP',1704 'AA',1705 'AM',1706 'AL',1707 'AFAX',1708 'AB',1709 'ADC',1710 'DNCL',1711 'DNCC',1712 'PU',1713 'PM',1714 'SVYEXT',1715 'SVYHU',1716 'SVYVM',1717 'SVYREC',1718 'QVMAIL'1719 );1720 $totalsystemcalls = $totalagentscalls = array();1721 for ($i = 0; $i < count($totaloutboundlogdetails); $i++) {1722 if (in_array($totaloutboundlogdetails[$i]['status'], $statusarray)) {1723 $call_date1 = $totaloutboundlogdetails[$i]['call_date'];1724 ;1725 $call_date = explode(" ", $call_date1);1726 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1727 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1728 $length_in_sec = $totaloutboundlogdetails[$i]['length_in_sec'];1729 array_push($totalsystemcalls, $call_time);1730 }1731 } else {1732 $call_date1 = $totaloutboundlogdetails[$i]['call_date'];1733 ;1734 $call_date = explode(" ", $call_date1);1735 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1736 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1737 $length_in_sec = $totaloutboundlogdetails[$i]['length_in_sec'];1738 array_push($totalagentscalls, $call_time);1739 }1740 }1741 }1742 //TOTAL SALE CALLS1743 $totalsalecallsarray = array();1744 $totalcamapignstatus =VicidialStatuses::where('sale','=','Y')->get(['status'])->toArray();1745 $sale_ct = 0;1746 $i = 0;1747 while ($i < count($totalcamapignstatus)) {1748 $sale_statuseslist[$sale_ct] = $totalcamapignstatus[$i]['status'];1749 $sale_ct++;1750 $i++;1751 }1752 for ($i = 0; $i < count($totaloutboundlogdetails); $i++) {1753 $call_date1 = $totaloutboundlogdetails[$i]['call_date'];1754 ;1755 $call_date = explode(" ", $call_date1);1756 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1757 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1758 for ($j = 0; $j < count($sale_statuseslist); $j++) {1759 if ($totaloutboundlogdetails[$i]['status'] == $sale_statuseslist[$j]) {1760 $statuscall = $totaloutboundlogdetails[$i]['status'];1761 array_push($totalsalecallsarray, $statuscall);1762 }1763 }1764 }1765 }1766 //end SALE CALLS1767 // TOTAL DNC CALLS1768 $totaldnccallsarray = array();1769 $totalcamapignstatus =VicidialStatuses::where('dnc','=','Y')->get(['status'])->toArray();1770 1771 $dnc_ct = 0;1772 $i = 0;1773 while ($i < count($totalcamapignstatus)) {1774 $dnc_statuseslist[$dnc_ct] = $totalcamapignstatus[$i]['status'];1775 $dnc_ct++;1776 $i++;1777 }1778 for ($i = 0; $i < count($totaloutboundlogdetails); $i++) {1779 $call_date1 = $totaloutboundlogdetails[$i]['call_date'];1780 ;1781 $call_date = explode(" ", $call_date1);1782 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1783 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1784 for ($j = 0; $j < count($dnc_statuseslist); $j++) {1785 if ($totaloutboundlogdetails[$i]['status'] == $dnc_statuseslist[$j]) {1786 $statuscall = $totaloutboundlogdetails[$i]['status'];1787 array_push($totaldnccallsarray, $statuscall);1788 }1789 }1790 }1791 }1792 //END DNC CALLS1793 //NA ANSWER CALL %1794 $naansarray = array();1795 for ($i = 0; $i < count($totaloutboundlogdetails); $i++) {1796 if ($totaloutboundlogdetails[$i]['status'] == 'NA') {1797 $NAstatus = $totaloutboundlogdetails[$i]['status'];1798 array_push($naansarray, $NAstatus);1799 }1800 }1801 if ((count($totaloutboundcall) < 1) || (count($naansarray) < 1)) {1802 $gna_percent = 0.00;1803 } else {1804 $gna_percent1 = $this->getDivision(count($naansarray), count($totaloutboundcall));1805 $gna_percent = round(($gna_percent1 * 100), 2);1806 }1807 //END ANSWER CALL1808 // DROP %1809 if ((count($totaloutboundcall) < 1) || (count($totaldrop) < 1)) {1810 $gdroppercent = 0.00;1811 } else {1812 $gdroppercent1 = $this->getDivision(count($totaldrop), count($totaloutboundcall));1813 $gdroppercent = round(($gdroppercent1 * 100), 2);1814 }1815 // DROP END1816 //AGENT LOGIN TIME, pause1817 ##### Gather Agent time records1818 1819 $group_drop[$i] = isset($group_drop[$i])?$group_drop[$i]:null;1820 $totalagentlogdetails = VicidialAgentLog::whereIn('campaign_id',[$campaign, $group_drop[$i]])1821 ->whereBetween('event_time',[$query_date_begin,$query_date_end])1822 ->get(['event_time',1823 'event_time as unix_event_time',1824 'campaign_id',1825 'pause_sec',1826 'wait_sec',1827 'talk_sec',1828 'dispo_sec']);1829 $atagentarray = $atpausearray = array();1830 for ($s = 0; $s < count($totalagentlogdetails); $s++) {1831 $call_date1 = $totalagentlogdetails[$s]['event_time'];1832 ;1833 $call_date = explode(" ", $call_date1);1834 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1835 if (($call_time > $ctstart) && ($call_time < $ctstop)) {1836 $in_total_sec = ($totalagentlogdetails[$s]['pause_sec'] + $totalagentlogdetails[$s]['wait_sec'] + $totalagentlogdetails[$s]['talk_sec'] + $totalagentlogdetails[$s]['dispo_sec']);1837 $atcall_date = $totalagentlogdetails[$s]['event_time'];1838 $atepoch = strtotime($totalagentlogdetails[$s]['unix_event_time']);1839 ;1840 $atcampaign_id = $totalagentlogdetails[$s]['campaign_id'];1841 $atpause_sec = $totalagentlogdetails[$s]['pause_sec'];1842 $atagent_sec = $in_total_sec;1843 if ($atagent_sec != 0) {1844 array_push($atagentarray, $atagent_sec);1845 }1846 if ($atpause_sec != 0) {1847 array_push($atpausearray, $atpause_sec);1848 }1849 }1850 }1851 $agent_sec = $pause_sec = 0;1852 for ($i = 0; $i < count($atagentarray); $i++) {1853 $agent_sec = $agent_sec + $atagentarray[$i];1854 }1855 $loginagent_sec = $this->secConvert($agent_sec, 'H'); 1856 for ($i = 0; $i < count($atpausearray); $i++) {1857 $pause_sec = $pause_sec + $atpausearray[$i];1858 }1859 $pauseagent_sec = $this->secConvert($pause_sec, 'H');1860 // END LOGIN AGENT SEC, pause1861 $p = 0;1862 while ($p < count($totaloutboundlogdetails)) {1863 $cpstatus = $totaloutboundlogdetails[$p]['status'];1864 $cplength_in_sec = $totaloutboundlogdetails[$p]['length_in_sec'];1865 $cpcall_date = $totaloutboundlogdetails[$p]['call_date'];1866 $cpepoch = $totaloutboundlogdetails[$p]['event_time'];1867 $cpphone_number = $totaloutboundlogdetails[$p]['phone_number'];1868 $cpcampaign_id = $totaloutboundlogdetails[$p]['campaign_id'];1869 $cpvicidial_id = $totaloutboundlogdetails[$p]['uniqueid'];1870 $cplead_id = $totaloutboundlogdetails[$p]['lead_id'];1871 $testlead_id = $totaloutboundlogdetails[$p]['lead_id'];1872 $testuniqueid = $totaloutboundlogdetails[$p]['uniqueid'];1873 $cpin_out = 'OUT';1874 $p++;1875 }1876 ##### Parse through the agent time records to tally the time1877 $p = $s = 0; $cwday = '';1878 while ($p < $s) {1879 $call_date = explode(" ", $atcall_date[$p]);1880 $call_time = preg_replace('/[^0-9]/', '', $call_date[1]);1881 $epoch = $atepoch[$p];1882 $cwday = date("w", $epoch);1883 $p++;1884 }1885 //end1886 $group_drop[$i] = isset($group_drop[$i])?$group_drop[$i]:'';1887 $rollover_groups_count = 0;1888 if (preg_match("/YES/i", $include_rollover)) {1889 ##### Gather inbound calls from drop inbound group if selected1890 $dropinboundgroplist = VicidialUserGroup::Select('vicidial_campaigns.drop_inbound_group')1891 ->join('vicidial_campaigns',function($join){1892 $join->whereIn('vicidial_campaigns.campaign_id',['ViciUserGroupallowed_campaigns','1000']);1893 $join->whereNotIn('vicidial_campaigns.drop_inbound_group',['NONE', 'NULL', '']);1894 })->get();1895 $in_groups_to_print = count($dropinboundgroplist);1896 if ($in_groups_to_print > 0) {1897 $group_drop[$i] = $dropinboundgroplist[0]['drop_inbound_group'];1898 $rollover_groups_count++;1899 }1900 1901 $length_in_secz = 0;1902 $queue_secondsz = 0;1903 $agent_alert_delayz = 0;1904 $closerinboundgroplist = VicidialCloserLog::whereBetween('call_date',[$query_date_begin,$query_date_end])1905 ->whereIn('campaign_id',[$campaign, $group_drop[$i]])1906 ->select(DB::raw('status,length_in_sec,queue_seconds,call_date,call_date as unix_call_date,phone_number,campaign_id,closecallid,lead_id,uniqueid '))1907 ->get();1908 }1909 $singlecampaigncetails = array(1910 'totaldrop' => count($totaldrop),1911 'campaign_id' => $campaign,1912 'loginagentt_sec' => $agent_sec,1913 'pauselogin_sec' => $pause_sec,1914 'naansarray' => count($naansarray),1915 'totalcallevents' => count($totaloutboundcall),1916 "totalsystemcalls" => count($totalsystemcalls),1917 "totalagentscalls" => count($totalagentscalls),1918 "totalsalecallsarray" => count($totalsalecallsarray),1919 "totaldnccallsarray" => count($totaldnccallsarray),1920 "gna_percent" => $gna_percent,1921 "gdroppercent" => $gdroppercent,1922 "loginagent_sec" => $loginagent_sec,1923 "pauseagent_sec" => $pauseagent_sec1924 );1925 array_push($returndetailscampaignwise, $singlecampaigncetails);1926 unset($singlecampaigncetails);1927 $singlecampaigncetails = array();1928 }1929 return $returndetailscampaignwise;1930 }1931 /**1932 * Outbound summary report interval report1933 * @author Harshal Pawar. <harshal.pawar@ytel.co.in>1934 * @param Request $request1935 * @return type1936 * @throws \App\Http\Controllers\Report\Exception1937 */1938 public function csvOutboundSummaryIntervalReport(Request $request) {1939 try {1940 $result = $this->outboundSummaryIntervalReport($request);1941 1942 $null = [];1943 $header = ['CAMPAIGN','TOTAL CALLS','SYSTEM RELEASE CALLS','AGENT RELEASE CALLS','SALE CALLS','DNC CALLS','NO ANSWER PERCENT','DROP PERCENT','AGENT LOGIN TIME(H:M:S)','AGENT PAUSE TIME(H:M:S)'];1944 $header2 = ['INTERVAL','TOTAL CALLS','SYSTEM RELEASE CALLS','AGENT RELEASE CALLS','SALE CALLS','DNC CALLS','NO ANSWER PERCENT','DROP PERCENT','AGENT LOGIN TIME(H:M:S)','AGENT PAUSE TIME(H:M:S)'];1945 1946 $filename = "Outbound_Summary_Interval_Report".date('Y-m-dh:i:s').".csv";1947 $handle = fopen($filename, 'w+');1948 1949 $row = ["Outbound Summary Interval Report:".$result['group_string'] . " " . $result['datetime'] ];1950 fputcsv($handle, $row, ";", '"');1951 1952 $row = ["MULTI-CAMPAIGN BREAKDOWN" ];1953 fputcsv($handle, $row, ";", '"');1954 1955 fputcsv($handle, $header, ";", '"');1956 1957 foreach ($result['campaign_wise_details'] as $key => $val) {1958 $row = [$val['campaign_id']."-".$val['campaign_name']['campaign_name'],$val['totalcallevents'],$val['totalsystemcalls'],$val['totalagentscalls'],$val['totalsalecallsarray'],$val['totaldnccallsarray'],$val['naansarray']."%",$val['gdroppercent']."%",$val['loginagent_sec'],$val['pauseagent_sec']];1959 fputcsv($handle, $row, ";", '"'); 1960 }1961 fputcsv($handle, $null, ";", '"');1962 $cnt_cmp = count($result['campaign_wise_details']);1963 for ( $i= 0 ; $i < $cnt_cmp ; $i++) {1964 if(isset($result['sub_graph_stats'][$i] ) && !empty($result['sub_graph_stats'][$i] )) {1965 $row = [$result['campaign_wise_details'][$i]['campaign_id'] ."".$result['campaign_wise_details'][$i]['campaign_name']['campaign_name'] . "  INTERVAL BREAKDOWN:"];1966 fputcsv($handle, $row, ";", '"'); 1967 fputcsv($handle, $header2, ";", '"');1968 foreach ($result['sub_graph_stats'][$i] as $key => $val) {1969 $row = [$val[0],$val[1],$val[2],$val[3],$val[4],$val[5],$val[6]."%",$val[7]."%",$val[10],$val[11]];1970 fputcsv($handle, $row, ";", '"'); 1971 }1972 $row = ["TOTAL:",$result['campaign_wise_details'][$i]['totalcallevents'],$result['campaign_wise_details'][$i]['totalsystemcalls'],$result['campaign_wise_details'][$i]['totalagentscalls'],$result['campaign_wise_details'][$i]['totalsalecallsarray'],$result['campaign_wise_details'][$i]['totaldnccallsarray'],$result['campaign_wise_details'][$i]['naansarray']."%",$result['campaign_wise_details'][$i]['gdroppercent']."%",$result['campaign_wise_details'][$i]['loginagent_sec'],$result['campaign_wise_details'][$i]['pauseagent_sec']];1973 fputcsv($handle, $row, ";", '"'); 1974 fputcsv($handle, $null, ";", '"');1975 }1976 }...

Full Screen

Full Screen

registrationTypeSuccess.php

Source:registrationTypeSuccess.php Github

copy

Full Screen

...129 $i=0;130 131 $conn = Propel::getConnection();132 $query = 'SELECT registration_type.id, registration_type.description133,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-01") AS day1_calls134 ,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-02") AS day2_calls135,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-03" ) AS day3_calls136,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-04" ) AS day4_calls137,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-05") AS day5_calls138,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-06") AS day6_calls139,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-07") AS day7_calls140,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-08") AS day8_calls141,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-09") AS day9_calls142,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-10") AS day10_calls143,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-11") AS day11_calls144,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-12") AS day12_calls145,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-13") AS day13_calls146,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-14") AS day14_calls147,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-15") AS day15_calls148,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-16") AS day16_calls149,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-17") AS day17_calls150,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-18") AS day18_calls151,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-19") AS day19_calls152,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-20") AS day20_calls153,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-21") AS day21_calls154,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-22") AS day22_calls155,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-23") AS day23_calls156,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-24") AS day24_calls157,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-25") AS day25_calls158,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-26") AS day26_calls159,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-27") AS day27_calls160,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-28") AS day28_calls161,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-29") AS day29_calls162,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-30") AS day30_calls163,(SELECT count( id ) FROM customer WHERE registration_type_id = registration_type.id AND customer_status_id=3 AND i_customer>0 AND DATE( created_at ) ="'.$year.'-'.$month.'-31") AS day31_calls 164FROM registration_type';165 $statement = $conn->prepare($query);166 $statement->execute();167 while ($rowObj = $statement->fetch(PDO::FETCH_OBJ))168 {169 170 if($i%2==0){171 $class= 'class="even"';172 }else{173 $class= 'class="odd"';174 }175?>176 <tr <?php echo $class;?>>177 ...

Full Screen

Full Screen

TaskCallbackHandlerTest.php

Source:TaskCallbackHandlerTest.php Github

copy

Full Screen

1<?php2namespace Zenstruck\ScheduleBundle\Tests\Schedule\Extension;3use PHPUnit\Framework\TestCase;4use Zenstruck\ScheduleBundle\Schedule\ScheduleRunContext;5use Zenstruck\ScheduleBundle\Schedule\Task;6use Zenstruck\ScheduleBundle\Tests\Fixture\MockScheduleBuilder;7use Zenstruck\ScheduleBundle\Tests\Fixture\MockTask;8/**9 * @author Kevin Bond <kevinbond@gmail.com>10 */11final class TaskCallbackHandlerTest extends TestCase12{13 /**14 * @test15 */16 public function false_when_filter_skips_task()17 {18 $task = MockTask::success()->when('boolean value', false);19 $context = self::createRunContext($task);20 $this->assertTrue($context->hasRun());21 $this->assertCount(0, $context->getRun());22 $this->assertCount(1, $skipped = $context->getSkipped());23 $this->assertSame('boolean value', $skipped[0]->getDescription());24 }25 /**26 * @test27 */28 public function callback_returning_false_when_filter_skips_task()29 {30 $task = MockTask::success()->when('callback value', function() { return false; });31 $context = self::createRunContext($task);32 $this->assertTrue($context->hasRun());33 $this->assertCount(0, $context->getRun());34 $this->assertCount(1, $skipped = $context->getSkipped());35 $this->assertSame('callback value', $skipped[0]->getDescription());36 }37 /**38 * @test39 */40 public function true_when_filter_allows_task_to_run()41 {42 $task = MockTask::success()->when('boolean value', true);43 $context = self::createRunContext($task);44 $this->assertTrue($context->hasRun());45 $this->assertCount(1, $context->getRun());46 $this->assertCount(0, $context->getSkipped());47 }48 /**49 * @test50 */51 public function callback_returning_true_when_filter_allows_task_to_run()52 {53 $task = MockTask::success()->when('callback value', function() { return true; });54 $context = self::createRunContext($task);55 $this->assertTrue($context->hasRun());56 $this->assertCount(1, $context->getRun());57 $this->assertCount(0, $context->getSkipped());58 }59 /**60 * @test61 */62 public function true_skip_filter_skips_task()63 {64 $task = MockTask::success()->skip('boolean value', true);65 $context = self::createRunContext($task);66 $this->assertTrue($context->hasRun());67 $this->assertCount(0, $context->getRun());68 $this->assertCount(1, $skipped = $context->getSkipped());69 $this->assertSame('boolean value', $skipped[0]->getDescription());70 }71 /**72 * @test73 */74 public function callback_returning_true_skip_filter_skips_task()75 {76 $task = MockTask::success()->skip('callback value', function() { return true; });77 $context = self::createRunContext($task);78 $this->assertTrue($context->hasRun());79 $this->assertCount(0, $context->getRun());80 $this->assertCount(1, $skipped = $context->getSkipped());81 $this->assertSame('callback value', $skipped[0]->getDescription());82 }83 /**84 * @test85 */86 public function false_skip_filter_allows_task_to_run()87 {88 $task = MockTask::success()->skip('boolean value', false);89 $context = self::createRunContext($task);90 $this->assertTrue($context->hasRun());91 $this->assertCount(1, $context->getRun());92 $this->assertCount(0, $context->getSkipped());93 }94 /**95 * @test96 */97 public function callback_returning_false_skip_filter_allows_task_to_run()98 {99 $task = MockTask::success()->skip('callback value', function() { return false; });100 $context = self::createRunContext($task);101 $this->assertTrue($context->hasRun());102 $this->assertCount(1, $context->getRun());103 $this->assertCount(0, $context->getSkipped());104 }105 /**106 * @test107 */108 public function successful_task_calls_proper_callback_extensions()109 {110 $calls = [];111 $task = MockTask::success()112 ->filter(function() use (&$calls) { $calls[] = 'filter'; })113 ->before(function() use (&$calls) { $calls[] = 'before'; })114 ->after(function() use (&$calls) { $calls[] = 'after'; })115 ->then(function() use (&$calls) { $calls[] = 'then'; })116 ->onSuccess(function() use (&$calls) { $calls[] = 'onSuccess'; })117 ->onFailure(function() use (&$calls) { $calls[] = 'onFailure'; })118 ;119 self::createRunContext($task);120 $this->assertSame([121 'filter',122 'before',123 'after',124 'then',125 'onSuccess',126 ], $calls);127 }128 /**129 * @test130 */131 public function failed_task_calls_proper_callback_extensions()132 {133 $calls = [];134 $task = MockTask::failure()135 ->filter(function() use (&$calls) { $calls[] = 'filter'; })136 ->before(function() use (&$calls) { $calls[] = 'before'; })137 ->after(function() use (&$calls) { $calls[] = 'after'; })138 ->then(function() use (&$calls) { $calls[] = 'then'; })139 ->onSuccess(function() use (&$calls) { $calls[] = 'onSuccess'; })140 ->onFailure(function() use (&$calls) { $calls[] = 'onFailure'; })141 ;142 self::createRunContext($task);143 $this->assertSame([144 'filter',145 'before',146 'after',147 'then',148 'onFailure',149 ], $calls);150 }151 /**152 * @test153 */154 public function skipped_task_calls_proper_callback_extensions()155 {156 $calls = [];157 $task = MockTask::skipped()158 ->filter(function() use (&$calls) { $calls[] = 'filter'; })159 ->before(function() use (&$calls) { $calls[] = 'before'; })160 ->after(function() use (&$calls) { $calls[] = 'after'; })161 ->then(function() use (&$calls) { $calls[] = 'then'; })162 ->onSuccess(function() use (&$calls) { $calls[] = 'onSuccess'; })163 ->onFailure(function() use (&$calls) { $calls[] = 'onFailure'; })164 ;165 self::createRunContext($task);166 $this->assertSame([167 'filter',168 'before',169 'after',170 'then',171 ], $calls);172 }173 private static function createRunContext(Task $task): ScheduleRunContext174 {175 return (new MockScheduleBuilder())176 ->addTask($task)177 ->run()178 ;179 }180}...

Full Screen

Full Screen

count

Using AI Code Generation

copy

Full Screen

1require_once 'calls.php';2$calls = new calls();3echo $calls->count();4require_once 'calls.php';5$calls = new calls();6echo $calls->count();7require_once 'calls.php';8$calls = new calls();9echo $calls->count();10require_once 'calls.php';11$calls = new calls();12echo $calls->count();13require_once 'calls.php';14$calls = new calls();15echo $calls->count();16require_once 'calls.php';17$calls = new calls();18echo $calls->count();19require_once 'calls.php';20$calls = new calls();21echo $calls->count();22require_once 'calls.php';23$calls = new calls();24echo $calls->count();25require_once 'calls.php';26$calls = new calls();27echo $calls->count();28require_once 'calls.php';29$calls = new calls();30echo $calls->count();31require_once 'calls.php';32$calls = new calls();33echo $calls->count();34require_once 'calls.php';35$calls = new calls();36echo $calls->count();37require_once 'calls.php';38$calls = new calls();39echo $calls->count();40require_once 'calls.php';41$calls = new calls();42echo $calls->count();43require_once 'calls.php';

Full Screen

Full Screen

count

Using AI Code Generation

copy

Full Screen

1require_once('calls.php');2$call = new calls();3$call->count();4require_once('calls.php');5$call = new calls();6$call->count();7require_once('calls.php');8$call = new calls();9$call->count();10require_once('calls.php');11$call = new calls();12$call->count();13require_once('calls.php');14$call = new calls();15$call->count();16require_once('calls.php');17$call = new calls();18$call->count();19require_once('calls.php');20$call = new calls();21$call->count();22require_once('calls.php');23$call = new calls();24$call->count();25require_once('calls.php');26$call = new calls();27$call->count();28require_once('calls.php');29$call = new calls();30$call->count();31require_once('calls.php');32$call = new calls();33$call->count();34require_once('calls.php');35$call = new calls();36$call->count();37require_once('calls.php');38$call = new calls();39$call->count();40require_once('calls.php');41$call = new calls();42$call->count();43require_once('calls.php');44$call = new calls();45$call->count();

Full Screen

Full Screen

count

Using AI Code Generation

copy

Full Screen

1$calls = new Calls();2echo $calls->count();3$calls = new Calls();4echo $calls->count();5$calls = new Calls();6echo $calls->count();7$calls = new Calls();8echo $calls->count();9$calls = new Calls();10echo $calls->count();11$calls = new Calls();12echo $calls->count();13$calls = new Calls();14echo $calls->count();15$calls = new Calls();16echo $calls->count();17$calls = new Calls();18echo $calls->count();19$calls = new Calls();20echo $calls->count();21$calls = new Calls();22echo $calls->count();23$calls = new Calls();24echo $calls->count();25$calls = new Calls();26echo $calls->count();27$calls = new Calls();28echo $calls->count();29$calls = new Calls();30echo $calls->count();31$calls = new Calls();32echo $calls->count();33$calls = new Calls();34echo $calls->count();

Full Screen

Full Screen

count

Using AI Code Generation

copy

Full Screen

1$call = new calls();2$call->count("1.php");3$call = new calls();4$call->count("2.php");5$call = new calls();6$call->count("3.php");7$call = new calls();8$call->count("4.php");9$call = new calls();10$call->count("5.php");11$call = new calls();12$call->count("6.php");13$call = new calls();14$call->count("7.php");15$call = new calls();16$call->count("8.php");17$call = new calls();18$call->count("9.php");19$call = new calls();20$call->count("10.php");21$call = new calls();22$call->count("11.php");23$call = new calls();24$call->count("12.php");25$call = new calls();26$call->count("13.php");27$call = new calls();28$call->count("14.php");29$call = new calls();30$call->count("15.php");31$call = new calls();32$call->count("16.php");

Full Screen

Full Screen

count

Using AI Code Generation

copy

Full Screen

1$call = new Calls;2$call->count();3$call = new Calls;4$call->count();5{6 private $count = 0;7 public function count()8 {9 $this->count++;10 echo $this->count;11 }12}13{14 private $count = 0;15 public function count()16 {17 $this->count++;18 echo $this->count;19 }20}21{22 private $count = 0;23 public function count()24 {25 $this->count++;26 echo $this->count;27 }28}29$call = new Calls;30$call->count();31$call = new Calls;32$call->count();33{34 public function count()35 {36 $date = date("j F Y");37 $date = str_replace(" ", "_", $date);38 return "Calls_$date.txt";39 }40}41{

Full Screen

Full Screen

count

Using AI Code Generation

copy

Full Screen

1require_once("calls.php");2require_once("sms.php");3$call = new calls();4$call->count();5$sms = new sms();6$sms->count();7class calls{8 public function count(){9 echo "I am in calls class";10 }11}12class sms{13 public function count(){14 echo "I am in sms class";15 }16}17require_once("parent.php");18require_once("child.php");19$child = new child();20$child->display();21class parent{22 public $name;23 public function __construct(){24 $this->name = "Parent Class";25 }26}27require_once("parent.php");28class child extends parent{29 public function display(){30 echo $this->name;31 }32}33require_once("interface.php");34require_once("child.php");35$child = new child();36$child->display();37interface parent{38 public function display();39}40require_once("interface.php");41class child implements parent{42 public function display(){43 echo "I am in child class";44 }45}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful