public function searchHistorique($params, $id) { $query = Transferer::find()->where(['codebien' => $id]); $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(['codebien' => $this->codebien]); $query->andFilterWhere(['like', 'dt', $this->dt])->andFilterWhere(['like', 'codebureau', $this->codebureau])->andFilterWhere(['like', 'motif', $this->motif]); return $dataProvider; }
/** * Displays a single Transferer model. * @param string $codebien * @param string $dt * @param string $codebureau * @return mixed */ public function actionView($codebien, $dt, $codebureau) { $model = new Transferer(); $model = Transferer::find()->where(['codebien' => $codebien, 'dt' => $dt, 'codebureau' => $codebureau])->one(); return $this->render('view', ['model' => $model]); }
protected function dernierTransfert($code) { $burDe = ''; $burVer = ''; $models = Transferer::find()->where(['codebien' => $code])->orderBy(['dt' => SORT_ASC])->all(); if ($models) { $cont = Transferer::find()->where(['codebien' => $code])->orderBy('dt')->count(); $i = 0; foreach ($models as $model) { $bureau[$i] = $model->codebureau; $i++; } if ($cont == 1) { $burVer = $bureau[0]; } if ($cont != 1) { for ($i = 0; $i < $cont - 1; $i++) { $burDe = $bureau[$i]; $burVer = $bureau[$i + 1]; } } } return $burVer; }