/**
  * 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;
 }
 /**
  * Finds the DraftPlandetail count  model based on its CUST_KD value AND    STATUS equal 1.
  * @param string $CUST_KD
  * @return @var ary_scdlplndetail
  */
 protected function findCountStatus($custId, $tgl)
 {
     // $ary_scdlplndetail = DraftPlanDetail::find()->where(['CUST_ID'=>$custId,'STATUS' => 1])->count();
     $ary_scdlplndetail = DraftPlanDetail::find()->where('LEFT(TGL,4) ="' . $tgl . '" AND CUST_ID="' . $custId . '" AND STATUS = 1')->count();
     return $ary_scdlplndetail;
 }