예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cuentas::find();
     // En el caso de que sea Vendedor se muestran solo sus contactos
     if (\common\models\User::isUserVendedor(Yii::$app->user->identity->id)) {
         $query->where('user_id = ' . Yii::$app->user->identity->id);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['cuenta' => SORT_ASC, 'subcuenta' => SORT_ASC]]]);
     $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(['cuentasid' => $this->cuentasid, 'tipocuenta_id' => $this->tipocuenta_id, 'user_id' => $this->user_id, 'sector_id' => $this->sector_id, 'estado_id' => $this->estado_id, 'categoria_id' => $this->categoria_id, 'freunion' => $this->freunion, 'monto_propuesta' => $this->monto_propuesta, 'fcampana' => $this->fcampana]);
     $query->andFilterWhere(['like', 'cuenta', $this->cuenta])->andFilterWhere(['like', 'subcuenta', $this->subcuenta])->andFilterWhere(['like', 'productos', $this->productos])->andFilterWhere(['like', 'comentario', $this->comentario])->andFilterWhere(['like', 'siglas', $this->siglas])->andFilterWhere(['like', 'cab_sector', $this->cab_sector])->andFilterWhere(['like', 'docto_propuesta', $this->docto_propuesta]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCuenta()
 {
     return $this->hasOne(Cuentas::className(), ['cuentasid' => 'cuenta_id']);
 }
예제 #3
0
        } else {
            alert("No ha seleccionado nada para eliminar!");
            return false;
        }
    });', \yii\web\View::POS_READY);
?>


    <?php 
$gridColumns = [['width' => '25px', 'class' => 'kartik\\grid\\SerialColumn'], ['class' => '\\kartik\\grid\\CheckboxColumn', 'rowSelectedClass' => GridView::TYPE_DANGER], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} &nbsp;&nbsp; {delete}', 'width' => '25px'], ['width' => '80px', 'attribute' => 'cuenta.user_id', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->user->username;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\common\models\User::find()->asArray()->all(), 'id', 'nombre'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Gerente']], ['width' => '100px', 'label' => 'Estatus', 'attribute' => 'cuenta.estado_id', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->estado->estado;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\backend\models\Estado::find()->asArray()->all(), 'estadoid', 'estado'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Estatus']], ['attribute' => 'cuenta_id', 'label' => 'Empresa', 'width' => '140px', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->cuenta;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\backend\models\Cuentas::find()->asArray()->orderBy('cuenta')->groupBy('cuenta')->where('tipocuenta_id = ' . $tipo_empresa)->all(), 'cuentasid', 'cuenta'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Cuenta'], 'group' => true], ['width' => '180px', 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'nombre', 'pageSummary' => true, 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Nombre del Contacto', 'size' => 'md'];
}], ['width' => '180px', 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'apellido', 'pageSummary' => true, 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Apellido del Contacto', 'size' => 'md'];
}], ['width' => '140px', 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'puesto', 'label' => 'Cargo', 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Nombre del Puesto', 'size' => 'md'];
}], ['width' => '100px', 'label' => 'Teléfono', 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'telefono', 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Telefono', 'size' => 'md'];
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'correo', 'label' => 'Dirección Electrónica', 'width' => '140px', 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Correo', 'size' => 'md'];
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'direccion', 'label' => 'Dirección Oficina', 'width' => '140px', 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXTAREA, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Dirección', 'size' => 'md', 'inputType' => \kartik\editable\Editable::INPUT_TEXTAREA];
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'asistente', 'label' => 'Asistente', 'width' => '140px', 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['asPopover' => false, 'inputType' => \kartik\editable\Editable::INPUT_TEXTAREA, 'formOptions' => ['action' => Url::to(['contactos/change', 'id' => $model->contactosid])], 'header' => 'Asistente', 'size' => 'md', 'inputType' => \kartik\editable\Editable::INPUT_TEXTAREA];
}], ['width' => '80px', 'attribute' => 'cuenta.i2010', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->i2010;
예제 #4
0
        <div class="row">
            <div class="col-xs-3">
                <?php 
// Estado
$lista = ArrayHelper::map(\backend\models\Estado::find()->asArray()->all(), 'estadoid', 'estado');
echo $form->field($model, 'estado_id')->dropDownList($lista)->label('Estatus');
?>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-3">
                <?php 
// Cuenta
$data = \backend\models\Cuentas::find()->select(['cuenta'])->distinct()->asArray()->createCommand()->queryColumn();
//echo $form->field($model, 'cuenta')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => $data],]);
echo $form->field($model, 'cuenta')->widget(\yii\jui\AutoComplete::className(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $data]])->label('Dependencia / Entidad');
?>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-3">
                <?php 
// Siglas
echo $form->field($model, 'siglas')->textInput(['maxlength' => true])->textInput();
?>
            </div>
        </div>
예제 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCuentas()
 {
     return $this->hasMany(Cuentas::className(), ['user_id' => 'tipocuentaid']);
 }
예제 #6
0
            return false;
        }
    });', \yii\web\View::POS_READY);
?>


    <?php 
$gridColumns = [['width' => '25px', 'class' => 'kartik\\grid\\SerialColumn'], ['class' => '\\kartik\\grid\\CheckboxColumn', 'rowSelectedClass' => GridView::TYPE_DANGER], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} &nbsp;&nbsp; {delete}', 'width' => '25px'], ['width' => '80px', 'attribute' => 'cuenta.user_id', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->user->username;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\common\models\User::find()->asArray()->all(), 'id', 'nombre'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Gerente']], ['width' => '100px', 'label' => 'Estatus', 'attribute' => 'cuenta.estado_id', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->estado->estado;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\backend\models\Estado::find()->asArray()->all(), 'estadoid', 'estado'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Estatus']], ['width' => '120px', 'attribute' => 'cuenta.categoria_id', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->categoria->categoria;
}], ['attribute' => 'cuenta_id', 'width' => '140px', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->cuenta;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\backend\models\Cuentas::find()->asArray()->orderBy('cuenta')->groupBy('cuenta')->where('tipocuenta_id = ' . $tipo_empresa)->all(), 'cuentasid', 'cuenta'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Cuenta'], 'group' => true], ['width' => '120px', 'attribute' => 'cuenta.subcuenta', 'value' => function ($model, $key, $index, $widget) {
    return $model->cuenta->subcuenta;
}, 'group' => true, 'subGroupOf' => 6], ['label' => 'Manager', 'value' => function ($model, $key, $index, $widget) {
    $valores = null;
    $managers = $model->cuentasManagers;
    if ($managers !== null) {
        if (!empty($managers)) {
            foreach ($managers as $manager) {
                if ($manager->cuenta->subcuenta !== null && trim($manager->cuenta->subcuenta) !== '') {
                    $valores .= $manager->cuenta->subcuenta . ', ';
                } else {
                    $valores .= $manager->cuenta->cuenta . ', ';
                }
            }
        }
    }
예제 #7
0
            <div class="row">
                <div class="col-xs-3">
                    <?php 
//Prellenando los datos de las cuentas;
$cuentas = $model->cuentasManagers;
$valores = array();
if ($cuentas !== null) {
    if (!empty($cuentas)) {
        foreach ($cuentas as $cuenta) {
            $valores[] = $cuenta->cuenta_id;
        }
    }
}
$model->cuentasmanager = $valores;
$lista = ArrayHelper::map(\backend\models\Cuentas::find()->where(['user_id' => Yii::$app->user->identity->id])->orderBy('cuenta')->all(), 'cuentasid', 'cuentaLarga');
echo $form->field($model, 'cuentasmanager')->widget(Select2::classname(), ['data' => $lista, 'name' => 'invitado', 'options' => ['placeholder' => 'Selecciona ...', 'multiple' => true, 'options' => []], 'pluginOptions' => ['allowClear' => true, 'tags' => true, 'tokenSeparators' => [',', ' ']]]);
?>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-3">
                <?php 
echo $form->field($model, 'puesto')->textInput();
?>
            </div>

            <div class="col-xs-3">
                <?php 
예제 #8
0
파일: _form.php 프로젝트: rvences/tele_sept
/* @var $this yii\web\View */
/* @var $model backend\models\Contactos */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="contactos-form">

    <?php 
$form = ActiveForm::begin();
?>

    <div class="row">
        <div class="col-xs-4">

            <?php 
echo $form->field($model, 'cuenta_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\backend\models\Cuentas::find()->orderBy('cuenta')->all(), 'cuentasid', 'cuentalarga'), 'options' => ['placeholder' => 'Selecciona la cuenta'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>

        <div class="col-xs-4">

            <?php 
echo $form->field($model, 'sectorcontacto_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\backend\models\Sector::find()->orderBy('sector')->all(), 'sectorid', 'sector'), 'options' => ['placeholder' => 'Selecciona el sector'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>

    </div>

    <div class="row">
        <div class="col-xs-3">
            <?php 
예제 #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCuentas()
 {
     return $this->hasMany(Cuentas::className(), ['estado_id' => 'estadoid']);
 }
예제 #10
0
 public function actionBorra()
 {
     $pk = Yii::$app->request->post('pks');
     /*
      * Elimina todo el arreglo de ID que se envian via AJAX
      * */
     Contactos::deleteAll(['cuenta_id' => $pk]);
     return Cuentas::deleteAll(['cuentasid' => $pk]);
 }
예제 #11
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCuentas()
 {
     return $this->hasMany(Cuentas::className(), ['sector_id' => 'sectorid']);
 }