public function searchmapdetail($params)
 {
     $query = Scheduledetail::find()->where(['CUST_ID' => $params['cust_kd']])->andWhere(['not', ['CHECKOUT_LAT' => null]])->andWhere(['not', ['CHECKOUT_LAG' => null]]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50]]);
     $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(['ID' => $this->ID, 'TGL' => $this->TGL, 'SCDL_GROUP' => $this->SCDL_GROUP, 'LAT' => $this->LAT, 'LAG' => $this->LAG, 'RADIUS' => $this->RADIUS, 'STATUS' => $this->STATUS, 'CHECKOUT_LAT' => $this->CHECKOUT_LAT, 'CHECKOUT_LAG' => $this->CHECKOUT_LAG]);
     // $query->andFilterWhere(['like', 'CUST_KD', $this->CUST_KD])
     // ->andFilterWhere(['like', 'CUST_KD_ALIAS', $this->CUST_KD_ALIAS])
     // ->andFilterWhere(['like', 'TLP1', $this->TLP1])
     // ->andFilterWhere(['like', 'TLP2', $this->TLP2])
     // ->andFilterWhere(['like', 'FAX', $this->FAX])
     // ->andFilterWhere(['like', 'CUST_KTG', $this->getAttribute('c0001k.CUST_KTG')])
     // ->andFilterWhere(['like', 'CUST_TYPE', $this->getAttribute('custype.CUST_KTG_NM')])
     // ->andFilterWhere(['like', 'CUST_NM', $this->CUST_NM])
     // ->andFilterWhere(['like', 'CUST_GRP', $this->CUST_GRP])
     // ->andFilterWhere(['like', 'MAP_LAT', $this->MAP_LAT])
     // ->andFilterWhere(['like', 'MAP_LNG', $this->MAP_LNG])
     // ->andFilterWhere(['like', 'PIC', $this->PIC])
     // ->andFilterWhere(['like', 'ALAMAT', $this->ALAMAT])
     // ->andFilterWhere(['like', 'EMAIL', $this->EMAIL])
     // ->andFilterWhere(['like', 'WEBSITE', $this->WEBSITE])
     // ->andFilterWhere(['like', 'NOTE', $this->NOTE])
     // ->andFilterWhere(['like', 'NPWP', $this->NPWP])
     // ->andFilterWhere(['like', 'DATA_ALL', $this->DATA_ALL])
     // ->andFilterWhere(['like', 'JOIN_DATE', $this->JOIN_DATE])
     // ->andFilterWhere(['like', 'CUST_GRP', $this->parentName])
     // ->andFilterWhere(['like', 'LAYER', $this->LAYER])
     // ->andFilterWhere(['like', 'GEO', $this->GEO])
     // ->andFilterWhere(['like', 'c0001.STATUS', $this->STATUS])
     // ->andFilterWhere(['like', 'c0001.DC_STATUS', $this->DC_STATUS]);
     //     // ->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID])
     //     // ->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])
     //     // ->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]);
     //     $query->orderby(['CUST_GRP'=>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 CheckExistDetailCustomers($model)
 {
     $cari_customersdetail = Scheduledetail::find()->where(['CUST_ID' => $this->CUST_ID, 'TGL' => $this->TGL])->one();
     if ($cari_customersdetail) {
         $this->addError($model, 'duplicate Customers');
     }
 }
 public function actionSetOutCase($tgl, $userid, $group, $grpid, $username)
 {
     $model = new Scheduledetail();
     if ($model->load(Yii::$app->request->post())) {
         $model->USER_ID = $userid;
         $model->SCDL_GROUP = $group;
         $model->CREATE_AT = date('Y-m-d');
         $model->CREATE_BY = Yii::$app->user->identity->username;
         $model->STATUS_CASE = 1;
         $model->save();
         return $this->redirect(['index?tab=3']);
     } else {
         return $this->renderAjax('_setoutcase', ['model' => $model, 'user' => $username, 'tgl' => $tgl, 'group' => $grpid, 'cus' => self::ary_customers(), 'note' => self::get_aryUserSalesmanager()]);
     }
 }
 /**
  * Finds the Scheduledetail model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Scheduledetail the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Scheduledetail::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }