Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = InfracConceptos::find();
     $pageSize = isset($_GET['per-page']) ? $_GET['per-page'] : \Yii::$app->params['infracConceptos.defaultPageSize'];
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize], 'sort' => ['defaultOrder' => ['id' => SORT_ASC], 'enableMultiSort' => true]]);
     $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' => $this->id, 'es_multa' => $this->es_multa, 'dias_verif' => $this->dias_verif, 'multa_unidad' => $this->multa_unidad, 'multa_precio' => str_replace(",", ".", $this->multa_precio), 'multa_reincidencia' => $this->multa_reincidencia, 'multa_reinc_porc' => str_replace(",", ".", $this->multa_reinc_porc), 'multa_reinc_dias' => $this->multa_reinc_dias, 'multa_personas' => $this->multa_personas, 'multa_personas_precio' => str_replace(",", ".", $this->multa_personas_precio), 'created_by' => $this->created_by, 'created_at' => $this->created_at, 'updated_by' => $this->updated_by, 'updated_at' => $this->updated_at, 'estado' => $this->estado]);
     $query->andFilterWhere(['like', 'concepto', $this->concepto])->andFilterWhere(['like', 'motivo_baja', $this->motivo_baja]);
     return $dataProvider;
 }
Exemplo n.º 2
0
$this->title = 'Detalle de concepto';
$this->params['breadcrumbs'][] = ['label' => 'Conceptos de infracciones', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
// esto es para que las columnas del detailView no cambien de tamaño
$this->registerCss('table.detail-view th {width: 25%;} table.detail-view td {width: 75%;}');
?>
<div class="infrac-conceptos-view">

    <h3><?php 
echo Html::encode($this->title . ' (Infracciones)');
?>
</h3>

      
	<?php 
echo '<p>';
if ($model->estado == InfracConceptos::ESTADO_ACTIVO) {
    if (\Yii::$app->user->can('modificarParametros')) {
        echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
        echo ' ' . Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger']);
    }
}
echo '</p>';
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'concepto', ['attribute' => 'es_multa', 'value' => InfracConceptos::getSiNo($model->es_multa)], 'dias_verif', 'multa_unidad', 'multa_precio:decimal', ['attribute' => 'multa_reincidencia', 'value' => InfracConceptos::getSiNo($model->multa_reincidencia)], 'multa_reinc_porc:decimal', 'multa_reinc_dias', ['attribute' => 'multa_personas', 'value' => InfracConceptos::getSiNo($model->multa_personas)], 'multa_personas_precio:decimal', 'userCreatedBy.username', 'created_at:datetime', 'userUpdatedBy.username', 'updated_at:datetime', ['attribute' => 'estado', 'value' => InfracConceptos::getEstados($model->estado)], 'motivo_baja']]);
?>

</div>
 /**
  * Finds the InfracConceptos model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return InfracConceptos the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = InfracConceptos::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
?>

    
    <?php 
$lbl2 = '';
$pdfHeader = ['L' => ['content' => \Yii::$app->params['lblName']], 'C' => ['content' => $this->title . $lbl2, 'font-style' => 'B'], 'R' => ['content' => '']];
$pdfFooter = ['L' => ['content' => \Yii::$app->params['lblName2']], 'C' => ['content' => 'página {PAGENO} de {nb}'], 'R' => ['content' => 'Fecha:{DATE d/m/Y}']];
$columns = ['id', 'concepto', ['attribute' => 'es_multa', 'value' => function ($model) {
    return InfracConceptos::getSiNo($model->es_multa);
}, 'filter' => InfracConceptos::getSiNo()], ['attribute' => 'dias_verif', 'hAlign' => 'right'], ['attribute' => 'multa_unidad', 'value' => 'multaUnidad.unidad', 'filter' => InfracUnidades::getLista()], ['attribute' => 'multa_precio', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['attribute' => 'multa_reincidencia', 'value' => function ($model) {
    return InfracConceptos::getSiNo($model->multa_reincidencia);
}, 'filter' => InfracConceptos::getSiNo()], ['attribute' => 'multa_reinc_porc', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['attribute' => 'multa_reinc_dias', 'hAlign' => 'right'], ['attribute' => 'multa_personas', 'value' => function ($model) {
    return InfracConceptos::getSiNo($model->multa_personas);
}, 'filter' => InfracConceptos::getSiNo()], ['attribute' => 'multa_personas_precio', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['attribute' => 'estado', 'value' => function ($model) {
    return InfracConceptos::getEstados($model->estado);
}, 'filter' => InfracConceptos::getEstados()], ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create'], ['class' => 'btn-sm btn-primary', 'title' => Yii::t('app', 'Nuevo concepto')]), 'template' => '{view} {comentario}', 'buttons' => ['comentario' => function ($url, $model) {
    $c = Comentarios::getComentariosByModelId($model->className(), $model->id);
    $text = '<span class="glyphicon glyphicon-copyright-mark"';
    if (!empty($c)) {
        $text .= ' style="color:#FF8000"></span>';
        $titl = 'Ingresar nuevo/Ver comentarios';
    } else {
        $text .= '></span>';
        $titl = 'Ingresar nuevo comentario';
    }
    return Html::a($text, $url, ['title' => $titl, 'onclick' => '$.ajax({
							type     :"POST",
							cache    : false,
							url  : $(this).attr("href"),
							success  : function(response) {
										$("#divcomentarionuevo").html(response);
Exemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInfracConceptos()
 {
     return $this->hasMany(InfracConceptos::className(), ['multa_unidad' => 'id']);
 }
Exemplo n.º 6
0
if (\Yii::$app->session->get('infracFecDesde')) {
    $lbl = Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign', 'style' => 'color:#FF8000']) . '  ' . 'Filtro por fecha desde el ' . Yii::$app->formatter->asDate(\Yii::$app->session->get('infracFecDesde')) . ' hasta el ' . Yii::$app->formatter->asDate(\Yii::$app->session->get('infracFecHasta'));
} else {
    $lbl = 'Filtrar por rango de fechas';
}
echo Collapse::widget(['encodeLabels' => false, 'items' => [['label' => $lbl, 'content' => $this->render('_searchfec', ['model' => $searchModel])]]]);
if (\Yii::$app->session->get('infracFecDesde')) {
    $lbl2 = ' (' . Yii::$app->formatter->asDate(\Yii::$app->session->get('infracFecDesde')) . '-' . Yii::$app->formatter->asDate(\Yii::$app->session->get('infracFecHasta')) . ')';
} else {
    $lbl2 = '';
}
$pdfHeader = ['L' => ['content' => Html::img(Yii::$app->homeUrl . 'images/logoreportes.png')], 'C' => ['content' => $this->title . $lbl2, 'font-style' => 'B'], 'R' => ['content' => \Yii::$app->params['lblName']]];
$pdfFooter = ['L' => ['content' => \Yii::$app->params['lblName2']], 'C' => ['content' => 'página {PAGENO} de {nb}'], 'R' => ['content' => 'Fecha:{DATE d/m/Y}']];
$columns = ['id', ['attribute' => 'id_uf', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    return Html::a($model->id_uf, Yii::$app->urlManager->createUrl(['uf/view', 'id' => $model->id_uf]), ['title' => 'Ver detalle de la unidad funcional', 'target' => '_blank', 'data-pjax' => '0']);
}], ['attribute' => 'fecha', 'format' => 'date'], ['attribute' => 'hora', 'format' => 'time'], 'nro_acta', 'lugar', ['attribute' => 'rConcepto', 'value' => 'concepto.concepto', 'filter' => InfracConceptos::getLista()], 'descripcion', ['attribute' => 'notificado', 'value' => function ($model) {
    return Infracciones::getSiNo($model->notificado);
}, 'filter' => Infracciones::getSiNo()], ['attribute' => 'fecha_verif', 'format' => 'date'], ['attribute' => 'verificado', 'value' => function ($model) {
    return Infracciones::getSiNo($model->verificado);
}, 'filter' => Infracciones::getSiNo()], ['attribute' => 'rUnidad', 'value' => 'multaUnidad.unidad', 'filter' => InfracUnidades::getLista()], 'multa_total', ['attribute' => 'estado', 'value' => function ($model) {
    return Infracciones::getEstados($model->estado);
}, 'filter' => Infracciones::getEstados()], ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create'], ['class' => 'btn-sm btn-primary', 'title' => Yii::t('app', 'Alta de infracción/multa')]), 'template' => '{view} {comentario}', 'buttons' => ['comentario' => function ($url, $model) {
    $c = Comentarios::getComentariosByModelId($model->className(), $model->id);
    $text = '<span class="glyphicon glyphicon-copyright-mark"';
    if (!empty($c)) {
        $text .= ' style="color:#FF8000"></span>';
        $titl = 'Ingresar nuevo/Ver comentarios';
    } else {
        $text .= '></span>';
        $titl = 'Ingresar nuevo comentario';
    }
Exemplo n.º 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getConcepto()
 {
     return $this->hasOne(InfracConceptos::className(), ['id' => 'id_concepto']);
 }