/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Pembelian::find(); $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; } $query->andFilterWhere(['TGL' => $this->TGL, 'JMLLOT' => $this->JMLLOT, 'JMLSAHAM' => $this->JMLSAHAM, 'HARGA' => $this->HARGA, 'KOM_BELI' => $this->KOM_BELI]); $query->andFilterWhere(['like', 'NOMOR', $this->NOMOR])->andFilterWhere(['like', 'EMITEN_KODE', $this->EMITEN_KODE])->andFilterWhere(['like', 'SECURITAS_KODE', $this->SECURITAS_KODE]); return $dataProvider; }
public function getLatestDate() { $pembelian = Pembelian::find()->select('TGL')->orderBy('TGL desc')->one(); $dates = [0, 1]; if ($pembelian !== null) { $dates = $this->getDates($pembelian->TGL); } return $dates; }