public function daily_stats() { $gab_day_stats = @\Controller_Reports::generate_disposition_report('GAB', TRUE, TRUE, null, null, TRUE); $pcc_day_stats = @\Controller_Reports::generate_disposition_report('GBS', TRUE, TRUE, null, null, TRUE); $burton_day_stats = @\Controller_Reports::generate_disposition_report('RESOLVE', TRUE, TRUE, null, null, TRUE); $all_day_stats = @\Controller_Reports::generate_disposition_report(null, TRUE, TRUE, null, null, TRUE); $day_stats = array('referrals' => array('total' => $all_day_stats['totals']['referrals']['count']), 'pack_out' => array('total' => $all_day_stats['totals']['pack_outs']['count'], 'value' => number_format((double) str_replace(",", "", $all_day_stats['totals']['pack_outs']['value']), 2)), 'pack_in' => array('total' => $all_day_stats['totals']['pack_ins']['count'], 'value' => number_format((double) str_replace(",", "", $all_day_stats['totals']['pack_ins']['value']), 2)), 'paid' => array('total' => $all_day_stats['totals']['paid']['count'], 'value' => number_format((double) str_replace(",", "", $all_day_stats['totals']['paid']['value']), 2))); /* $day_stats = array( 'referrals' => array( 'total' => ($gab_day_stats['totals']['referrals']['count']+$pcc_day_stats['totals']['referrals']['count']+$burton_day_stats['totals']['referrals']['count']), ), 'pack_out' => array( 'total' => ($gab_day_stats['totals']['pack_outs']['count']+$pcc_day_stats['totals']['pack_outs']['count']+$burton_day_stats['totals']['pack_outs']['count']), 'value' => number_format(((float)str_replace(",","",$gab_day_stats['totals']['pack_outs']['value'])+(float)str_replace(",","",$pcc_day_stats['totals']['pack_outs']['value'])+(float)str_replace(",","",$burton_day_stats['totals']['pack_outs']['value'])),2), ), 'pack_in' => array( 'total' => ($gab_day_stats['totals']['pack_ins']['count']+$pcc_day_stats['totals']['pack_ins']['count']+$burton_day_stats['totals']['pack_ins']['count']), 'value' => number_format(((float)str_replace(",","",$gab_day_stats['totals']['pack_ins']['value'])+(float)str_replace(",","",$pcc_day_stats['totals']['pack_ins']['value'])+(float)str_replace(",","",$burton_day_stats['totals']['pack_ins']['value'])),2), ), 'paid' => array( 'total' => "?", 'value' => "?", ), ); */ if ($day_stats['referrals']['total'] > 0) { $send_string1 = "Stats for " . date("d/m/Y") . "\n"; $send_string1 .= $gab_day_stats['totals']['referrals']['count'] + $pcc_day_stats['totals']['referrals']['count'] > 0 ? $gab_day_stats['totals']['referrals']['count'] + $pcc_day_stats['totals']['referrals']['count'] . " Internal, " . ($gab_day_stats['totals']['pack_outs']['count'] + $pcc_day_stats['totals']['pack_outs']['count']) . " pack out.\n" : ""; //$send_string1 .= ($pcc_day_stats['totals']['referrals']['count'] > 0) ? $pcc_day_stats['totals']['referrals']['count']." PCC, ".$pcc_day_stats['totals']['pack_outs']['count']." pack out.\n" : ""; $send_string1 .= $burton_day_stats['totals']['referrals']['count'] > 0 ? $burton_day_stats['totals']['referrals']['count'] . " Burton, " . $burton_day_stats['totals']['pack_outs']['count'] . " pack out.\n" : ""; $send_string1 .= $all_day_stats['totals']['referrals']['count'] > 0 ? $all_day_stats['totals']['referrals']['count'] - ($burton_day_stats['totals']['referrals']['count'] + $gab_day_stats['totals']['referrals']['count'] + $pcc_day_stats['totals']['referrals']['count']) . " External, " . ($all_day_stats['totals']['pack_outs']['count'] - ($burton_day_stats['totals']['pack_outs']['count'] + $gab_day_stats['totals']['pack_outs']['count'] + $pcc_day_stats['totals']['pack_outs']['count'])) . " pack out." : ""; $send_string2 = $day_stats['pack_out']['total'] . " pack out £" . $day_stats['pack_out']['value'] . "\n" . $day_stats['pack_in']['total'] . " pack in £" . $day_stats['pack_in']['value'] . "\n" . $day_stats['paid']['total'] . " paid £" . $day_stats['paid']['value'] . "\nEnjoy your evening! :)"; Adam::send_push_message($send_string1); Adam::send_push_message($send_string2); print $send_string1 . "\n"; print $send_string2; } }
public function get_dispositions() { if (strtotime($this->param('enddate')) - strtotime($this->param('startdate')) < -2678400) { $this->response(array('status' => 'FAIL', 'message' => 'Sorry, you cannot get a disposition report for a larger period than one month!')); } else { $this->response(Controller_Reports::generate_disposition_report($this->param('center'), Auth::has_access('reports.disposition'), Auth::has_access('reports.all_centers'), $this->param('startdate'), $this->param('enddate'))); } }