public function actionCreateNext()
 {
     $model = new BalanceSheet();
     $model->prepareNext();
     if ($model->save()) {
         $model->initAmounts();
         return $this->redirect(['balance-item/index']);
     } else {
         var_dump($model->errors);
     }
 }
Esempio n. 2
0
 public function performStep($step)
 {
     if (parent::performStep($step)) {
         // ...custom code here...
         if ($step->code == 'init1') {
             //init two months on the first step
             $model = new BalanceSheet();
             $model->prepareNext();
             if ($model->save()) {
                 $model->initAmounts();
             }
             $model = new BalanceSheet();
             $model->prepareNext();
             if ($model->save()) {
                 $model->initAmounts();
             }
         }
         return $this->createBalanceItem($step);
     } else {
         return false;
     }
 }