Ejemplo n.º 1
0
 public function actionCreateID()
 {
     $model = new Pay();
     $val1 = $_POST['val_id'];
     sscanf($val1, "js:_id=%d;", $id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Pay'])) {
         $model->attributes = $_POST['Pay'];
         $model->setAttribute('date_g', $_POST['Pay']['date_g']);
         $model->dg_null = $_POST['Pay']['dg_null'];
         if ($model->save()) {
             //				$this->redirect(array('exp/admin'));
             $this->redirect(array('exp/admin', 'ret' => 1, '#' => 'e_' . $model->exp_id, 'tmp' => $model->attributes));
         }
     }
     $model->exp_id = $id;
     $row = Exp::model()->with('currency', 'paySum')->findByPk($id);
     if (!($row == null)) {
         $model->curname = $row->currency->name;
         $modelamount = $row->amount - $row->paySum;
         if ($modelamount < 0) {
             $model->amount = 0;
         } else {
             $model->amount = $modelamount;
         }
     }
     echo $this->renderPartial('_form', array('model' => $model));
 }