Пример #1
0
 public function actionCreate()
 {
     $famil_bud = new FamilyBudget();
     if ($famil_bud->load(Yii::$app->request->post()) && $famil_bud->validate()) {
         //return print_r($_POST);
         $famil_bud['fam_bud_create'] = date("Y-m-d");
         // проверяем расходы или доходs
         $query = $famil_bud->IncoExpens($_POST['FamilyBudget']['categ_id']);
         if ($query == 5) {
             $famil_bud['summa'] = -$_POST['FamilyBudget']['summa'];
         }
         $famil_bud->save();
         return $this->redirect('index');
     }
     $users = new Users();
     $categ = new Categories();
     $inco_exp = new IncoExpenso();
     $mony = new CoursesMoney();
     $users = $users->find()->where('user_active_to is null')->all();
     //$categ = $categ->find()->all();
     $categ = $categ->find()->where('categ_active_to is null')->all();
     $inco_exp = $inco_exp->find()->all();
     $mony = $mony->find()->all();
     return $this->render('create', ['users' => $users, 'categ' => $categ, 'inco_exp' => $inco_exp, 'mony' => $mony, 'famil_bud' => $famil_bud]);
 }
Пример #2
0
 public function actionCreate()
 {
     $famil_bud = new FamilyBudget();
     if ($famil_bud->load(Yii::$app->request->post()) && $famil_bud->validate()) {
         //return print_r($_POST);
         $famil_bud['fam_bud_create'] = date("Y-m-d");
         $famil_bud->save();
         return $this->redirect('index');
     }
     $users = new Users();
     $categ = new Categories();
     $inco_exp = new IncoExpenso();
     $mony = new CoursesMoney();
     $users = $users->find()->all();
     $categ = $categ->find()->all();
     $inco_exp = $inco_exp->find()->all();
     $mony = $mony->find()->all();
     return $this->render('create', ['users' => $users, 'categ' => $categ, 'inco_exp' => $inco_exp, 'mony' => $mony, 'famil_bud' => $famil_bud]);
 }