public function actionSimpantambah()
 {
     $roDetail = new Sodetail();
     if ($roDetail->load(Yii::$app->request->post()) && $roDetail->validate()) {
         $hsl = \Yii::$app->request->post();
         $kdro = $hsl['Sodetail']['KD_RO'];
         $kdBarang = $hsl['Sodetail']['KD_BARANG'];
         $nmBarang = Barang::findOne(['KD_BARANG' => $kdBarang]);
         $kdUnit = $hsl['Sodetail']['UNIT'];
         $rqty = $hsl['Sodetail']['RQTY'];
         $note = $hsl['Sodetail']['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?SalesorderSearch[KD_RO]=' . $kdro]);
     } else {
         return $this->redirect(['index']);
     }
 }
 /**
  * Saved Data Sodetail
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function additem_saved()
 {
     if ($this->validate()) {
         $rodetail = new Sodetail();
         $rodetail->CREATED_AT = date('Y-m-d H:i:s');
         $rodetail->KD_RO = $this->kD_RO;
         //required
         $rodetail->KD_CORP = $this->kD_CORP;
         //required
         $rodetail->PARENT_ROSO = 1;
         //required
         $rodetail->KD_BARANG = $this->kD_BARANG;
         //required
         $rodetail->NM_BARANG = $this->valuesBarang($this->kD_BARANG)->NM_BARANG;
         $rodetail->UNIT = $this->uNIT;
         $rodetail->RQTY = $this->rQTY;
         $rodetail->SQTY = $this->rQTY;
         $rodetail->HARGA = $this->valuesBarang($this->kD_BARANG)->HARGA_PABRIK;
         $rodetail->NOTE = $this->nOTE;
         $rodetail->STATUS = 0;
         if ($rodetail->save()) {
             return $rodetail;
         }
         return $rodetail;
     }
     return null;
 }