/** * Creates a new SoT2 model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new SoT2(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->ID]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreateNewAdd($cust_kd, $user_id, $id, $cust_nm, $tgl) { $model = new SoT2(); # code... if ($model->load(Yii::$app->request->post())) { $explode = explode(',', $model->KD_BARANG); $model->NM_BARANG = $explode[1]; $model->KD_BARANG = $explode[0]; $model->CUST_KD = $cust_kd; # set cust_kd $model->USER_ID = $user_id; $model->CUST_NM = $cust_nm; $model->KODE_REF = $id; $model->SO_TYPE = 10; $model->POS = 'WEB'; $model->WAKTU_INPUT_INVENTORY = date("Y-m-d H:i:s"); #set datetime $model->TGL = $tgl; #set date $model->save(); return $this->redirect(['/purchasing/salesman-order/review', 'id' => $id, 'stt' => 1]); } else { return $this->renderAjax('new_som', ['model' => $model, 'data_barang' => self::get_aryBarang(), 'kode_som' => $id]); } }
/** * Validation Alias Barang * @author waawan update ptrnov <*****@*****.**> * @since 1.1 */ public function actionValidAliasBarang() { $model = new SoT2(); $model->scenario = "create"; if (Yii::$app->request->isAjax && $model->load($_POST)) { Yii::$app->response->format = 'json'; return ActiveForm::validate($model); } }