Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Deposito::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;
     }
     //adicionado por Alisson
     if ($this->dataDeposito) {
         $query->joinWith(['caixaMovimentacao']);
         $dataInicial = substr($this->dataDeposito, 0, 10);
         $dataFinal = substr($this->dataDeposito, -10);
         $query->andFilterWhere(['between', 'caixaMovimentacao.data', $dataInicial . ' 00:00:00', $dataFinal . ' 23:59:59']);
     }
     if ($this->lojaId) {
         $query->joinWith(['lojaIdloja']);
         $query->andFilterWhere(['loja.idloja', $this->lojaId]);
     }
     $query->andFilterWhere(['iddeposito' => $this->iddeposito, 'caixa_movimentacao_id' => $this->caixa_movimentacao_id]);
     $query->andFilterWhere(['like', 'descricao', $this->descricao]);
     return $dataProvider;
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepositos()
 {
     return $this->hasMany(Deposito::className(), ['caixa_movimentacao_id' => 'id']);
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepositos()
 {
     return $this->hasMany(Deposito::className(), ['loja_idloja' => 'idloja']);
 }
 /**
  * Finds the Deposito model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Deposito the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Deposito::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }