예제 #1
0
파일: Finance.php 프로젝트: Galihom/phpVMS
 /**
  * Loop through month by month, and pull any data for that month.
  * If there's nothing for that month, then blank it 
  */
 protected function getyearly($year)
 {
     $params = $this->formfilter();
     $all_finances = array();
     $months = StatsData::getMonthsInRange('January ' . $year, 'December ' . $year);
     foreach ($months as $month) {
         $date_filter = array("DATE_FORMAT(p.submitdate, '%Y%m') = '" . date('Ym', $month) . "'");
         $this_filter = array_merge($date_filter, $params);
         $data = PIREPData::getIntervalData($this_filter);
         if (!$data) {
             $data = new stdClass();
             $data->ym = date('Y-m', $month);
             $data->timestamp = $month;
             $data->total = 0;
             $data->revenue = 0;
             $data->gross = 0;
             $data->fuelprice = 0;
             $data->price = 0;
             $data->expenses = 0;
             $data->pilotpay = 0;
         } else {
             $data = FinanceData::calculateFinances($data[0]);
         }
         $all_finances[] = $data;
     }
     return $all_finances;
 }