/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = OperadorRed::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id_sui' => $this->id_sui, 'nit' => $this->nit, 'telefono' => $this->telefono, 'celular' => $this->celular]); $query->andFilterWhere(['like', 'razon_social', $this->razon_social])->andFilterWhere(['like', 'represetante_legal', $this->represetante_legal])->andFilterWhere(['like', 'revisor_fiscal', $this->revisor_fiscal])->andFilterWhere(['like', 'contador', $this->contador])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'correo', $this->correo])->andFilterWhere(['like', 'direccion_web', $this->direccion_web]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getNitEjecuto() { return $this->hasOne(OperadorRed::className(), ['nit' => 'nit_ejecuto']); }
/** * Finds the OperadorRed model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return OperadorRed the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = OperadorRed::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
$global_acum = 0; ?> <div class="faer-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_search3', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'responsive' => true, 'resizableColumns' => true, 'panel' => ['before' => ''], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'faer_no', ['attribute' => 'nit_ejecuto', 'value' => function ($data) { return $data->nitEjecuto->razon_social; }, 'filter' => \kartik\select2\Select2::widget(['name' => 'nit_ejecuto', 'data' => ArrayHelper::map(\app\models\OperadorRed::find()->all(), 'nit', 'razon_social'), 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'fecha_radicacion', 'value' => function ($data) { return $data->fecha_radicacion; }, 'filter' => DateRangePicker::widget(['model' => $searchModel, 'attribute' => 'fecha_radicacion', 'convertFormat' => true, 'pluginOptions' => ['timePicker' => false, 'format' => 'Y-m-d']])], 'proyecto', ['attribute' => 'Dpto', 'value' => function ($data) { if (count($data->detalleProyectos) > 0) { return app\models\Divipola::findOne(['id_dpto' => $data->detalleProyectos[0]->id_departamento])->dpto; } else { return ""; } }, 'filter' => \kartik\select2\Select2::widget(['name' => 'dpto', 'data' => ArrayHelper::map(\app\models\Divipola::find()->all(), 'id_dpto', 'dpto'), 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'Total Beneficiarios', 'contentOptions' => ['style' => 'text-align: right;'], 'value' => function ($data, $acum) use(&$global_acum_beneficiarios) { if (count($data->detalleProyectos) > 0) { foreach ($data->detalleProyectos as $d) { $acum += $d->usuarios_nuevos; } $global_acum_beneficiarios += $acum; return $global_acum_beneficiarios; } else {
echo $form->field($model, 'radicado')->textInput(); ?> </div> </div> <?php echo $form->field($model, 'proyecto')->textarea(['maxlength' => true]); ?> <div class="row"> <div class="col-lg-6"> <?php echo $form->field($model, 'nit_presento')->widget(Select2::classname(), ['data' => ArrayHelper::map(\app\models\OperadorRed::find()->all(), 'nit', 'razon_social'), 'options' => ['placeholder' => 'Seleccione una opción'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-lg-6"> <?php echo $form->field($model, 'nit_ejecuto')->widget(Select2::classname(), ['data' => ArrayHelper::map(\app\models\OperadorRed::find()->all(), 'nit', 'razon_social'), 'options' => ['placeholder' => 'Seleccione una opción'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <div class="row"> <div class="col-lg-4"> <?php echo $form->field($model, 'fecha_radicacion')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE]); ?> </div> <div class="col-lg-4">