public function getKey_Employe() { //$a="asd1234"; $sql = 'SELECT max(KAR_ID) as KAR_ID FROM karyawan WHERE CORP_ID="WAN" AND CAB_ID="DDPX"'; $cnt = Karyawan::findBySql($sql)->one(); $arySplit = explode('.', $cnt->KAR_ID); $str_id_cnt0 = trim($arySplit[0]); $str_id_cnt1 = trim($arySplit[1]); $str_id_cnt2 = trim($arySplit[2]); //print_r($str_id_cnt+1); $id_cnt = $str_id_cnt2 + 1; /*Combine String and Digit Author: -ptr.nov- */ //$digit=str_pad($id_cnt,4,"0",STR_PAD_LEFT); //$thn=date("Y"); //$nl='LG'.'.'.$thn.'.'.$digit; //return $nl; return $str_id_cnt0 . '.' . $str_id_cnt1 . '.' . $id_cnt; }
public function search($params) { // [5.1] JOIN TABLE $query = Karyawan::find()->where('karyawan.KAR_STS<> 3'); // SUB JOIN //$query->leftJoin(['company'=>$queryCop],'company.CORP_ID=a0001.EMP_CORP_ID');//->orderBy(['company.CORP_ID'=>SORT_ASC]); //->andFilterWhere(['EMP_ID'=>'006']); $dataProvider = new ActiveDataProvider(['query' => $query]); /* //[5.2] SHORTING // SORTING CORPORATE Author -ptr.nov- $dataProvider->sort->attributes['corpOne.CORP_NM'] = [ 'asc' => ['a0001.CORP_NM' => SORT_ASC], 'desc' => ['a0001.CORP_NM' => SORT_DESC], ]; // SORTING DEPARTMENT Author -ptr.nov- $dataProvider->sort->attributes['deptOne.DEP_NM'] = [ 'asc' => ['a0002.DEP_NM' => SORT_ASC], 'desc' => ['a0002.DEP_NM' => SORT_DESC], ]; // SORTING JABATAN Author -ptr.nov- $dataProvider->sort->attributes['jabOne.JAB_NM'] = [ 'asc' => ['a0003.JAB_NM' => SORT_ASC], 'desc' => ['a0003.JAB_NM' => SORT_DESC], ]; // SORTING STATUS Author -ptr.nov- $dataProvider->sort->attributes['sttOne.STS_NM'] = [ 'asc' => ['b0009.STS_NM' => SORT_ASC], 'desc' => ['b0009.STS_NM' => SORT_DESC], ]; */ // [5.3] LOAD VALIDATION PARAMS //LOAD FARM VER 1 $this->load($params); if (!$this->validate()) { return $dataProvider; } /* ///LOAD FARM VER 2 // if (!($this->load($params) && $this->validate())) //return $dataProvider; */ //[5.4] FILTER WHERE LIKE (string/integer) // FILTER COLUMN Author -ptr.nov- $query->andFilterWhere(['like', 'KAR_ID', $this->KAR_ID])->andFilterWhere(['like', 'KAR_NM', $this->KAR_NM]); /* ->andFilterWhere(['like', 'EMP_NM_BLK', $this->EMP_NM_BLK]) ->andFilterWhere(['like', 'b0009.STS_NM', $this->getAttribute('sttOne.STS_NM')]) ->andFilterWhere(['like', 'a0001.CORP_NM', $this->getAttribute('corpOne.CORP_NM')]) ->andFilterWhere(['like', 'a0002.DEP_NM', $this->getAttribute('deptOne.DEP_NM')]) ->andFilterWhere(['like', 'a0003.JAB_NM', $this->getAttribute('jabOne.JAB_NM')]) ->andFilterWhere(['like', 'b0009.STS_NM', $this->getAttribute('sttOne.STS_NM')]); */ /* //[5.4] FILTER WHERE LIKE (date) // FILTER COLUMN DATE RANGE Author -ptr.nov- if(isset($this->EMP_JOIN_DATE) && $this->EMP_JOIN_DATE!=''){ $date_explode = explode("TO", $this->EMP_JOIN_DATE); $date1 = trim($date_explode[0]); $date2= trim($date_explode[1]); $query->andFilterWhere(['between', 'a0001.EMP_JOIN_DATE', $date1,$date2]); } */ return $dataProvider; }
public function getEmp() { return $this->hasOne(Karyawan::className(), ['KAR_ID' => 'EMP_ID']); }