Ejemplo n.º 1
0
 /**
  * HEADER SEARCH.
  * @return ActiveDataProvider.
  */
 public function searchGroup($params)
 {
     //$query = SalesRoadHeader::find()->groupBy(date_format(date_create('CREATED_AT'),"Y-m-d"));
     $query = SalesRoadHeader::find()->groupBy(['USER_ID', 'date(CREATED_AT)'])->orderBy(['date(CREATED_AT)' => SORT_DESC]);
     //$sql = 'SELECT *, date(CREATED_AT) as TGL FROM c0022Header GROUP BY USER_ID,date(CREATED_AT) ORDER BY date(CREATED_AT) DESC';
     //$query = SalesRoadHeader::findBySql($sql);
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ROAD_D' => $this->ROAD_D, 'LAT' => $this->LAT, 'LAG' => $this->LAG]);
     $query->andFilterWhere(['like', 'USER_ID', $this->USER_ID])->andFilterWhere(['like', 'CREATED_AT', $this->TGL])->andFilterWhere(['like', 'JUDUL', $this->JUDUL])->andFilterWhere(['like', 'CUSTOMER', $this->CUSTOMER])->andFilterWhere(['like', 'CASE_ID', $this->CASE_ID])->andFilterWhere(['like', 'CASE_NM', $this->CASE_NM])->andFilterWhere(['like', 'CASE_NOTE', $this->CASE_NOTE])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function getRoadTbl()
 {
     return $this->hasOne(SalesRoadHeader::className(), ['ROAD_D' => 'ID_ROAD']);
 }
Ejemplo n.º 3
0
 public function Ary_road()
 {
     return ArrayHelper::map(SalesRoadHeader::find()->all(), 'ROAD_D', 'JUDUL');
 }
Ejemplo n.º 4
0
 /**
  * Finds the SalesRoadHeader model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SalesRoadHeader the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SalesRoadHeader::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }