/** * Check KD_RO dan KD_BARANG * @author ptrnov <*****@*****.**> * @since 1.1 */ public function findcheck($attribute, $params) { if (!$this->hasErrors()) { $kondisiTrue = Sadetail::find()->where("KD_RO='" . $this->kD_SA . "' 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_SA' => $kd])->one(); $model->STATUS = 3; $model->dinasve(); $model = Sadetail::find()->where(['KD_SA' => $kd])->one(); $model->STATUS = 3; $model->dinasve(); return Yii::$app->getResponse()->redirect(['/accounting/dinasles-order/index']); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Sadetail::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['QTY' => $this->QTY, 'STATUS' => $this->STATUS, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT]); $query->andFilterWhere(['like', 'KD_SA', $this->KD_SA])->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'NO_URUT', $this->NO_URUT])->andFilterWhere(['like', 'NOTE', $this->NOTE]); return $dataProvider; }