Пример #1
0
 public function reportdetailAction()
 {
     if (empty($this->view->app_credits_report)) {
         die;
     }
     $array_of_params = $this->_request->getParams();
     if (!isset($array_of_params['fromdate']) || $array_of_params['fromdate'] == '' || !isset($array_of_params['todate']) || $array_of_params['todate'] == '') {
         $array_of_params['fromdate'] = date('Y-m-d', strtotime("now -1 day"));
         $array_of_params['todate'] = date('Y-m-d', strtotime("now -1 day"));
     }
     $fromdate = $array_of_params['fromdate'] . ' 00:00:00';
     $todate = $array_of_params['todate'] . ' 23:59:59';
     $this->view->param = $array_of_params;
     $appIDs = $this->view->uApps;
     $reporter = new Reporter();
     $result = array();
     $keys = array_keys($appIDs);
     foreach ($keys as $appID) {
         if ($appID == 'zing' || $appID == 'admin') {
             continue;
         }
         $subresult = array();
         $subresult = $reporter->summaryDaily($appID, $fromdate, $todate);
         foreach ($subresult as $appByDate) {
             $result['' . $appByDate['analyticDate']]['' . $appByDate['appID']] = $appByDate['amount'];
         }
     }
     $subresult = $reporter->summaryDaily('zing', $fromdate, $todate);
     foreach ($subresult as $appByDate) {
         $result['' . $appByDate['analyticDate']]['zing'] = $appByDate['amount'];
     }
     $prevDate = date('Y-m-d', strtotime($fromdate . " -1 day"));
     $subresult = $reporter->getRemainBalance($prevDate . " 00:00:00", $todate);
     foreach ($subresult as $appByDate) {
         $result['' . $appByDate['analyticDate']]['remainbalance'] = $appByDate['remainBalance'];
     }
     $this->view->data = $result;
     if ($array_of_params['export'] == 'csv') {
         $this->exportDetailCSVReport();
         die;
     } else {
         $this->view->frmSearch = $this->view->render('index/app_report_detail.phtml');
         $this->view->container = $this->view->render('index/index.phtml');
     }
 }