/** * Check KD_RO dan KD_BARANG * @author ptrnov <*****@*****.**> * @since 1.1 */ public function findcheck($attribute, $params) { if (!$this->hasErrors()) { //$kondisiTrue = Sodetail::find()->where(['KD_RO' => $this->kD_RO, 'KD_BARANG' => $this->kD_BARANG ])->one(); $kondisiTrue = Sodetail::find()->where("KD_RO='" . $this->kD_RO . "' AND KD_BARANG='" . $this->kD_BARANG . "' AND STATUS<>3")->one(); if ($kondisiTrue) { $this->addError($attribute, 'Duplicated Items Barang !, Better (-/+) Request.Qty '); } } }
public function actionHapusro($kd) { $model = Salesorder::find()->where(['KD_RO' => $kd])->one(); $model->STATUS = 3; $model->save(); $model = Sodetail::find()->where(['KD_RO' => $kd])->one(); $model->STATUS = 3; $model->save(); return Yii::$app->getResponse()->redirect(['/purchasing/sales-order/index']); }