/** * 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]); } }
public function actionCreateNewAdd($id) { $soHeaderData = SoHeader::find()->where(['ID' => $id])->one(); $model = new SoT2(); # code... if ($model->load(Yii::$app->request->post())) { $explode = explode(',', $model->KD_BARANG); $setUser = explode('-', $soHeaderData->USER_SIGN1); $model->NM_BARANG = $explode[1]; $model->KD_BARANG = $explode[0]; $model->CUST_KD = $soHeaderData->CUST_ID; $model->USER_ID = $setUser[0]; $model->CUST_NM = $soHeaderData->custNm; $model->KODE_REF = $soHeaderData->KD_SO; $model->SO_TYPE = 10; $model->POS = 'WEB'; $model->WAKTU_INPUT_INVENTORY = date("Y-m-d H:i:s"); #set datetime $model->TGL = date_format(date_create($soHeaderData->TGL), "Y-m-d"); $model->save(); return $this->redirect(['/purchasing/salesman-order/review', 'id' => $id, 'stt' => 1]); } else { return $this->renderAjax('new_items', ['model' => $model, 'data_barang' => self::get_aryBarang(), 'kode_som' => $soHeaderData->KD_SO]); } }