public function excel($params) { $query = FormaPago::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => array('pageSize' => 10000)]); $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(['id' => $this->id]); $query->andFilterWhere(['like', 'descripcion', $this->descripcion]); return $dataProvider; }
<button type="button" class="add-item2 btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button> <button type="button" class="remove-item2 btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button> </div> <div class="clearfix"></div> </div> <div class="panel-body"> <?php // necessary for update action. if (!$modelPago->isNewRecord) { echo Html::activeHiddenInput($modelPago, "[{$i}]id"); } ?> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($modelPago, "[{$i}]forma_pago_id")->dropDownList(ArrayHelper::map(FormaPago::find()->all(), 'id', 'descripcion'), ['prompt' => 'Seleccionar Forma de Pago', 'style' => 'width:300px', 'disabled' => !$modelPago->isNewRecord]); ?> </div> <div class="col-sm-6"> <?php echo $form->field($modelPago, "[{$i}]monto")->textInput(['maxlength' => 128, 'disabled' => !$modelPago->isNewRecord]); ?> </div> </div><!-- .row --> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($modelPago, "[{$i}]comprobante")->textInput(['maxlength' => 128, 'disabled' => !$modelPago->isNewRecord]); ?> </div> <div class="col-sm-6">
/** * Finds the FormaPago model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return FormaPago the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FormaPago::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use yii\widgets\ActiveForm; use app\models\FormaPago; use app\models\RceExamen; /* @var $this yii\web\View */ /* @var $model app\models\Pago */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="pago-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'forma_pago_id')->dropDownList(ArrayHelper::map(FormaPago::find()->all(), 'id', 'descripcion'), ['prompt' => 'Seleccionar Forma de Pago', 'style' => 'width:300px']); ?> <?php echo $form->field($model, 'rce_examen_id')->dropDownList(ArrayHelper::map(RceExamen::find()->all(), 'id', 'DatosRce'), ['prompt' => 'Seleccionar RCE Examen', 'style' => 'width:300px']); ?> <?php echo $form->field($model, 'monto')->textInput(['style' => 'width:300px']); ?> <?php echo $form->field($model, 'comprobante')->textInput(['style' => 'width:300px']); ?> <?php
public function updateFormaPago() { $cat = FormaPago::find(Request::get('id')); $cat->fill(Request::all()); $cat->save(); }
/** * @return \yii\db\ActiveQuery */ public function getFormaPago() { return $this->hasOne(FormaPago::className(), ['id' => 'forma_pago_id']); }