/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     //$query = DraftPlanDetail::find()->orderBy(['TGL'=>SORT_ASC,'SCDL_GROUP'=>SORT_ASC,]);
     $query = DraftPlanDetail::find()->where('STATUS<>2 AND STATUS<>3')->groupBy(['TGL', 'SCDL_GROUP', 'CUST_ID'])->orderBy(['TGL' => SORT_ASC, 'SCDL_GROUP' => SORT_ASC]);
     //$query = DraftPlanDetail::find()->where('STATUS<>2')->orderBy(['TGL'=>SORT_ASC]);
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 1000]]);
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ID' => $this->ID, 'TGL' => $this->TGL, 'SCDL_GROUP' => $this->SCDL_GROUP, 'LAT' => $this->LAT, 'CUST_ID' => $this->custlayernm, 'LAG' => $this->LAG, 'RADIUS' => $this->RADIUS, 'STATUS' => $this->STATUS, 'CREATE_AT' => $this->CREATE_AT, 'UPDATE_AT' => $this->UPDATE_AT, 'ODD_EVEN' => $this->weekofDate]);
     $query->andFilterWhere(['like', 'CUST_ID', $this->custNm])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]);
     //	$query->orderby(['CUST_ID'=>SORT_ASC]); //SORT PENTING UNTUK RECURSIVE BIAR TREE BISA URUTAN, save => (IF (PATENT =0) {SORT=ID}, ELSE {SORT=PATENT}, note Parent=ID header
     return $dataProvider;
 }
Example #2
0
 public function getScdlPlan()
 {
     // $ary_scdlplan = DraftPlanDetail::find()->where(['CUST_ID'=>$this->CUST_KD,'STATUS'=>0])->distinct()->one();
     $ary_scdlplan = DraftPlanDetail::find()->where('LEFT(TGL,4) ="' . $this->YEAR . '" AND CUST_ID="' . $this->CUST_KD . '" AND STATUS = 0')->distinct()->one();
     return $ary_scdlplan;
 }
 public function Schdelete($id)
 {
     $model = DraftPlanDetail::deleteAll('CUST_ID = :cus_id', [':cus_id' => $id]);
     $this->conn_esm()->CreateCommand('UPDATE c0002scdl_plan SET STATUS=0 WHERE  CUST_KD="' . $id . '" AND STATUS = 1')->execute();
     return true;
 }