/**
  *
  */
 function getData()
 {
     $report = trim(@$_GET['report']);
     $start = formatRussianDate2MysqlDate(@$_GET['dateFrom']);
     $end = formatRussianDate2MysqlDate(@$_GET['dateTo']);
     $start2 = formatRussianDate2MysqlDate(@$_GET['dateFrom2']);
     $end2 = formatRussianDate2MysqlDate(@$_GET['dateTo2']);
     $account = (int) @$_GET['account'];
     $currency = (int) @$_GET['currency'];
     $acclist = @$_GET['acclist'];
     if (!empty($account)) {
         $accounts = $account;
     } else {
         $accounts = '';
         $acc = explode(',', $_GET['acclist']);
         foreach ($acc as $value) {
             if ((int) $value > 0) {
                 if (!empty($accounts)) {
                     $accounts .= ',';
                 }
                 $accounts .= (int) $value;
             }
         }
     }
     switch ($report) {
         case 'graph_profit':
             //Доходы
             $this->_renderJson($this->_model->getPie(1, $start, $end, $accounts, $currency));
         case 'graph_loss':
             // Расходы
             $this->_renderJson($this->_model->getPie(0, $start, $end, $accounts, $currency));
         case 'graph_profit_loss':
             //Сравнение расходов и доходов
             $this->_renderJson($this->_model->getBars($start, $end, $accounts, $currency));
         case 'txt_profit':
             //Детальные доходы
             $this->_renderJson($this->_model->SelectDetailed(1, $start, $end, $accounts, $currency));
         case 'txt_loss':
             //Детальные расходы
             $this->_renderJson($this->_model->SelectDetailed(0, $start, $end, $accounts, $currency));
         case 'txt_loss_difference':
             //Сравнение расходов за периоды
             $this->_renderJson($this->_model->CompareForPeriods(0, $start, $end, $start2, $end2, $accounts, $currency));
         case 'txt_profit_difference':
             //Сравнение доходов за периоды
             $this->_renderJson($this->_model->CompareForPeriods(1, $start, $end, $start2, $end2, $accounts, $currency));
         default:
             die('
                 "elements": [{
                     "type": "pie",
                     "alpha": 0.6,
                     "start-angle": 35,
                     "animate": [ { "type": "fade" } ],
                     "colours": [ "#1C9E05", "#FF368D" ],
                     "values": [1,2,3,4,5,6,7]
                 }]');
     }
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->model = Report_Model::instance();
     $this->privacys = array(1 => '所有好友可见', 3 => '仅自己可见', 5 => '仅指定群可见');
     //$this->user_id = 10614401;
 }
Example #3
0
 public static function &instance()
 {
     if (!is_object(Report_Model::$instances)) {
         // Create a new instance
         Report_Model::$instances = new Report_Model();
     }
     return Report_Model::$instances;
 }