public function actionSimpantambah() { $roDetail = new Rodetail(); if ($roDetail->load(Yii::$app->request->post()) && $roDetail->validate()) { $hsl = \Yii::$app->request->post(); $kdro = $hsl['Rodetail']['KD_RO']; $kdBarang = $hsl['Rodetail']['KD_BARANG']; $nmBarang = Barangumum::findOne(['KD_BARANG' => $kdBarang]); $kdUnit = $hsl['Rodetail']['UNIT']; $rqty = $hsl['Rodetail']['RQTY']; $note = $hsl['Rodetail']['NOTE']; /* * Detail Request Order **/ $roDetail->KD_RO = $kdro; $roDetail->CREATED_AT = date('Y-m-d H:i:s'); $roDetail->NM_BARANG = $nmBarang->NM_BARANG; $roDetail->KD_BARANG = $kdBarang; $roDetail->UNIT = $kdUnit; $roDetail->RQTY = $rqty; $roDetail->NOTE = $note; $roDetail->STATUS = 0; $roDetail->save(); return $this->redirect(['index?RequestorderSearch[KD_RO]=' . $kdro]); } else { return $this->redirect(['index']); } }
protected function namaBarang($kdBarang) { $nmBarang = Barangumum::findOne(['KD_BARANG' => $kdBarang]); return $nmBarang->NM_BARANG; }