public function actionShow()
 {
     $date = explode('-', $_GET['daterange']);
     $branch = $_GET['branch'];
     $d1 = date('Y-m-d', strtotime($date[0]));
     $d2 = date('Y-m-d', strtotime($date[1]));
     $inflow = [];
     $outflow = [];
     $totalArr = [];
     // Формирование моделей
     $criteria = new CDbCriteria();
     if ($branch == "all") {
         $criteria->condition = 'date =:date1';
     } else {
         $criteria->condition = 'date =:date1 AND branch_id=:br';
     }
     $arr = [];
     $in = 0;
     $out = 0;
     $totalIn = 0;
     $totalOut = 0;
     $total = 0;
     while ($d1 <= $d2) {
         if ($branch == "all") {
             $criteria->params = [":date1" => $d1];
         } else {
             $criteria->params = [":date1" => $d1, 'br' => $branch];
         }
         $inflowArr = Inflow::model()->findAll($criteria);
         if ($inflowArr) {
             foreach ($inflowArr as $value) {
                 array_push($inflow, $value);
                 $in += $value->price;
                 $totalIn += $in;
             }
         }
         $outflowArr = Outflow::model()->findAll($criteria);
         if ($outflowArr) {
             foreach ($outflowArr as $value) {
                 array_push($outflow, $value);
                 $out += (int) $value->price;
                 $totalOut += $out;
             }
         }
         if ($inflowArr || $outflowArr) {
             $arr['date'] = $d1;
             $arr['inflow'] = $in;
             $arr['outflow'] = $out;
             $total += $in - $out;
             $arr['total'] = $total;
             array_push($totalArr, $arr);
         }
         $d1 = date('Y-m-d', strtotime("+1 day", strtotime($d1)));
         $in = 0;
         $out = 0;
     }
     //$this->render('search', array('inflow' => $inflow, 'outflow' => $outflow, 'totalflow' => $totalArr));
     $this->actionPrint($inflow, $outflow, $totalArr, $totalIn, $totalOut);
 }
 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет HTTP-исключение.
  *
  * @param integer идентификатор нужной модели
  *
  * @return void
  */
 public function loadModel($id)
 {
     $model = Inflow::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('BalanceModule.balance', 'Запрошенная страница не найдена.'));
     }
     return $model;
 }