Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cuentas::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->joinWith(['idEmpresa', 'idTercero']);
     //$this->load($params);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     //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_cuenta' => $this->id_cuenta, 'fecha' => $this->fecha, 'valor' => $this->valor])->andFilterWhere(['LIKE', 'empresa.nombre', $this->id_empresa])->andFilterWhere(['LIKE', 'terceros.nombre', $this->id_tercero]);
     return $dataProvider;
 }
 /**
  * Finds the Cuentas model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Cuentas the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Cuentas::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCuentas()
 {
     return $this->hasMany(Cuentas::className(), ['id_tercero' => 'id_tercero']);
 }
Exemple #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCuentas()
 {
     return $this->hasMany(Cuentas::className(), ['id_empresa' => 'id_empresa']);
 }