/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PartidaGenerica::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(['cuenta' => $this->cuenta, 'partida' => $this->partida, 'generica' => $this->generica, 'estatus' => $this->estatus]); $query->andFilterWhere(['estatus' => $this->nombreEstatus]); $query->andFilterWhere(['like', 'nombre', $this->nombre]); return $dataProvider; }
/** * Finds the PartidaGenerica model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param char(1) $cuenta * @param char(2) $partida * @param char(2) $generica * @return el modelo * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($cuenta, $partida, $generica) { if (($model = PartidaGenerica::findOne(['cuenta' => $cuenta, 'partida' => $partida, 'generica' => $generica])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Funcion de respuesta para el AJAX de * partidas generales * @return array JSON */ public function actionGenerica() { $request = Yii::$app->request; if ($request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; if ($request->isPost) { //Partidas GE $ge = PartidaGenerica::find()->select(["id AS id", "CONCAT(generica,' - ',nombre) AS name"])->where(['id_partida' => $request->post('depdrop_parents'), 'estatus' => 1])->asArray()->all(); return ['output' => $ge]; } } }
/** * @return \yii\db\ActiveQuery */ public function getCuenta0() { return $this->hasOne(PartidaGenerica::className(), ['cuenta' => 'cuenta', 'partida' => 'partida', 'generica' => 'generica']); }
/** * @return \yii\db\ActiveQuery */ public function getPartidaGenericas() { return $this->hasMany(PartidaGenerica::className(), ['cuenta' => 'cuenta', 'partida' => 'partida']); }