public function lol() { $get_paid_details = \GAB\Debtsolv::change_center('1170344', 'GAB'); print_r($get_paid_details); }
public function get_commission() { $start_date = $this->param('startdate'); $end_date = $this->param('enddate'); $get_paid_details = \GAB\Debtsolv::paid_in_report($start_date, $end_date); $valids = array(); foreach ($get_paid_details['valids'] as $name => $valid) { $valids[] = array($name, '£' . number_format($valid['External'], 2), '£' . number_format($valid['Weekly'], 2), '£' . number_format($valid['Internal'], 2), '£' . number_format($valid['TotalDue'], 2)); } $invalids = array(); foreach ($get_paid_details['invalids'] as $invalid) { $invalids[] = array($invalid['Consolidator'], $invalid['ClientID'], $invalid['Name'], $invalid['Office'], '£' . number_format($invalid['DI'] / 100, 2), $invalid['TotalPayments'], '£' . number_format($invalid['TotalPaid'] / 100, 2)); } $all_clients = array(); foreach ($get_paid_details['all-clients'] as $client) { $all_clients[] = array($client['Consolidator'], $client['ClientID'], $client['Name'], $client['Office'], '£' . number_format($client['DI'] / 100, 2), $client['TotalPayments'], '£' . number_format($client['TotalPaid'] / 100, 2)); } $this->response(array('valids' => array("aaData" => $valids, "bDestroy" => true, "bProcessing" => true, "aoColumnDefs" => array(array("iDataSort" => 0, "asSorting" => array("asc"), "aTargets" => array(0))), "aoColumns" => array(array("sTitle" => "Senior Name", "bSortable" => false), array("sTitle" => "External Commission", "sType" => "numeric"), array("sTitle" => "WK/F Commission", "sType" => "numeric"), array("sTitle" => "Internal Commission", "sType" => "numeric"), array("sTitle" => "Total", "sType" => "numeric"))), 'invalids' => array("aaData" => $invalids, "bDestroy" => true, "bProcessing" => true, "aoColumnDefs" => array(array("iDataSort" => 0, "asSorting" => array("asc"), "aTargets" => array(0))), "aoColumns" => array(array("sTitle" => "Senior Name", "sType" => "numeric"), array("sTitle" => "ClientID", "bSortable" => false), array("sTitle" => "Client Name", "bSortable" => false), array("sTitle" => "Office", "sType" => "numeric"), array("sTitle" => "DI", "sType" => "numeric"), array("sTitle" => "Total Payments", "sType" => "numeric"), array("sTitle" => "Total Paid", "sType" => "numeric"))), 'all-clients' => array("aaData" => $all_clients, "bDestroy" => true, "bProcessing" => true, "aoColumnDefs" => array(array("iDataSort" => 0, "asSorting" => array("asc"), "aTargets" => array(0))), "aoColumns" => array(array("sTitle" => "Senior Name", "sType" => "numeric"), array("sTitle" => "ClientID", "bSortable" => false), array("sTitle" => "Client Name", "bSortable" => false), array("sTitle" => "Office", "sType" => "numeric"), array("sTitle" => "DI", "sType" => "numeric"), array("sTitle" => "Total Payments", "sType" => "numeric"), array("sTitle" => "Total Paid", "sType" => "numeric"))))); }