Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Terceros::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(['id_tercero' => $this->id_tercero, 'nit' => $this->nit, 'digito_verificacion' => $this->digito_verificacion]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'ciudad', $this->ciudad]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Finds the Terceros model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Terceros the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Terceros::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #3
0
use yii\helpers\ArrayHelper;
use app\models\Empresa;
use app\models\Terceros;
use yii\jui\DatePicker;
use kartik\widgets\ActiveForm;
//use kartik\widgets\Select2;
use kartik\builder\Form;
/* @var $this yii\web\View */
/* @var $model app\models\Cuentas */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="cuentas-form">
    <?php 
$empresas = ArrayHelper::map(Empresa::find()->all(), 'id_empresa', 'nombre');
?>
    <?php 
$terceros = ArrayHelper::map(Terceros::find()->all(), 'id_tercero', 'nombre');
?>
    <?php 
echo Html::panel(['heading' => 'Cuentas de cobro', 'body' => Html::a('<i class="glyphicon glyphicon-plus"></i> Crear Banco', ['/bancos/create'], ['class' => 'btn btn-success']) . " " . Html::a('<i class="glyphicon glyphicon-plus"></i> Crear Tercero', ['/terceros/create'], ['class' => 'btn btn-success'])]);
?>
    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['id_empresa' => ['label' => 'Tercero', 'type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $empresas], 'hint' => 'Seleccione la empresa'], 'id_tercero' => ['label' => 'Tercero', 'type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $terceros, 'options' => ['options' => ['placeholder' => 'Seleccione Tercero...']]], 'hint' => 'Seleccione el tercero', 'contentOptions' => ['style' => 'text-transform: uppercase']], 'fecha' => ['language' => 'es', 'type' => Form::INPUT_WIDGET, 'value' => '08-10-2004', 'widgetClass' => '\\kartik\\datecontrol\\DateControl', 'hint' => 'Fecha de la cuenta de cobro (yyyy/mm/dd)', 'pluginOptions' => ['format' => 'yyyy']], 'valor' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => 'kartik\\money\\MaskMoney', 'maskMoneyOptions' => ['prefix' => '$ ']], 'detalle' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Detalle de la cuenta de cobro']]]]);
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
//echo Html::button('Submit', ['type'=>'button', 'class'=>'btn btn-primary']);
ActiveForm::end();
?>

    
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdTercero()
 {
     return $this->hasOne(Terceros::className(), ['id_tercero' => 'id_tercero']);
 }