Example #1
0
 public function get_get_monthly_payment($center = null)
 {
     $startDate = null;
     $endDate = null;
     $month = $this->param('month');
     if (!is_null($month) || strlen($month) > 4) {
         $monthSplit = explode('-', $month);
         $startDate = date("Y-m-d", mktime(0, 0, 0, (int) $monthSplit[0], 1, (int) $monthSplit[1]));
         $endDate = date("Y-m-d", mktime(0, 0, 0, (int) $monthSplit[0] + 1, 1, (int) $monthSplit[1]));
     }
     $reportArray = Controller_Reports::generate_monthly_payment_report($center, $startDate, $endDate);
     return $this->response(array('start' => $startDate, 'reports' => $reportArray['reports'], 'payments' => array("aaData" => $reportArray['clients'], "bDestroy" => true, "bPaginate" => true, "bProcessing" => true, "aoColumnDefs" => array(array("iDataSort" => 2, "asSorting" => array("asc"), "aTargets" => array(0))), "aoColumns" => array(array("sTitle" => "Client ID", "sType" => "string"), array("sTitle" => "Client Name", "sType" => "string"), array("sTitle" => "Introducer", "sType" => "string"), array("sTitle" => "Amount In", "sType" => "numeric"), array("sTitle" => "Expected", "sType" => "numeric"), array("sTitle" => "Remaining Debt", "sType" => "numeric"), array("sTitle" => "Product", "sType" => "string"), array("sTitle" => "Notes", "sType" => "string"), array("sTitle" => "Reached", "bSortable" => false))), 'expected' => array("aaData" => $reportArray['expected'], "bDestroy" => true, "bPaginate" => true, "bProcessing" => true, "aoColumnDefs" => array(array("iDataSort" => 2, "asSorting" => array("asc"), "aTargets" => array(0))), "aoColumns" => array(array("sTitle" => "Client ID", "sType" => "string"), array("sTitle" => "Client Name", "sType" => "string"), array("sTitle" => "Expected", "sType" => "numeric"), array("sTitle" => "Amount Expected", "sType" => "numeric"), array("sTitle" => "Received", "sType" => "numeric"), array("sTitle" => "Completed", "sType" => "numeric"))), 'introducer' => array("aaData" => $reportArray['introducer'], "bDestroy" => true, "bPaginate" => false, "bProcessing" => true, "aoColumnDefs" => array(array("iDataSort" => 2, "asSorting" => array("asc"), "aTargets" => array(0))), "aoColumns" => array(array("sTitle" => "Introducer", "sType" => "string"), array("sTitle" => "Unique Payers", "sType" => "numeric"), array("sTitle" => "Total Value", "sType" => "numeric"), array("sTitle" => "Average Payment", "sType" => "numeric")))));
 }