Пример #1
0
 public function actionReport()
 {
     //		$model=Exp::model()->with(array('city','concert','expence'))->findByPk($id);
     $model = new Exp('search');
     $show = false;
     $model->unsetAttributes();
     // clear any default values
     $model->arr_cur = Currency::model()->findAll();
     if (empty($_POST)) {
         $model->from_date = Constants::model()->getCvalue('repf_' . Yii::app()->user->uid);
         $model->to_date = Constants::model()->getCvalue('rept_' . Yii::app()->user->uid);
     } else {
         $show = true;
         Constants::model()->setCvalue('repf_' . Yii::app()->user->uid, $_POST['Exp']['from_date']);
         Constants::model()->setCvalue('rept_' . Yii::app()->user->uid, $_POST['Exp']['to_date']);
         if (isset($_POST['Exp'])) {
             foreach ($_POST['Exp'] as $key => $row) {
                 switch ($key) {
                     case 'from_date':
                         $model->from_date = $row;
                         break;
                     case 'to_date':
                         $model->to_date = $row;
                         break;
                     case 'state_pay':
                         $model->state_pay = $row;
                         break;
                     case 'state_cur':
                         $model->state_cur = $row;
                         break;
                     case 'report_type':
                         $model->report_type = $row;
                         break;
                 }
             }
         }
     }
     $this->render('report', array('model' => $model, 'show' => $show));
 }