Ejemplo n.º 1
0
 /**
  * Método para listar
  */
 public function listar($order = 'order.id.asc', $page = 'page.1')
 {
     $page = Filter::get($page, 'page') > 0 ? Filter::get($page, 'page') : 1;
     $usuario = new Empleados();
     $this->usuarios = $usuario->getListado('todos', $order, $page);
     $this->order = $order;
     $this->page_title = 'Listado de Empleados';
 }
Ejemplo n.º 2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Empleados the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Empleados::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 3
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $a = $this->loadModel($id);
     $b = Asignaciones::model()->findByAttributes(array('id' => $a->id_asignacion));
     $c = Deducciones::model()->findByAttributes(array('id' => $a->id_deduccion));
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Nomina'], $_POST['Asignaciones'], $_POST['Deducciones'])) {
         // populate input data to $a and $b
         $a->attributes = $_POST['Nomina'];
         $b->attributes = $_POST['Asignaciones'];
         $c->attributes = $_POST['Deducciones'];
         // validate BOTH $a and $b
         $valid = $a->validate();
         $valid = $b->validate() && $valid;
         $valid = $c->validate() && $valid;
         if ($valid) {
             $a->total_asig = $a->b_alimenticio($b->b_alimenticio, $a->id_empleado) + $a->asistencia($b->asistencia, $a->id_empleado) + $a->hdiurnas($b->horasextra_diurna, $a->id_empleado) + $a->hnocturnas($b->horasextras_nocturna, $a->id_empleado) + $a->sabado($b->sabado, $a->id_empleado) + $a->feriado($b->feriado, $a->id_empleado) + $a->prestamos + $a->vaciado + $a->otros;
             $a->total_deduc = $a->sso($c->sso, $a->id_empleado) + $a->spf($c->spf, $a->id_empleado) + $a->lph($c->lph, $a->id_empleado) + $a->inasistencia($c->inasistencia, $a->id_empleado) + $a->descuento;
             $empleado = Empleados::model()->findByAttributes(array('id' => $a->id_empleado));
             $cargo = Cargos::model()->findByAttributes(array('id' => $empleado->id_cargo));
             if ($cargo->tipo_sueldo == 1) {
                 $a->neto = $cargo->sueldo + $a->total_asig - $a->total_deduc;
             } else {
                 $a->neto = $cargo->sueldo / 2 + $a->total_asig - $a->total_deduc;
             }
             // use false parameter to disable validation
             $b->save(false);
             $c->save(false);
             $a->id_asignacion = $b->id;
             $a->id_deduccion = $c->id;
             $a->save(false);
             date_default_timezone_set('America/Caracas');
             $auditoria = new Auditoria();
             $auditoria->id_user = Yii::app()->user->getId();
             $auditoria->accion = 3;
             $auditoria->modelo = $this->modelo;
             $auditoria->id_registro = $a->id;
             $auditoria->fecha = date("Y-m-d h:i:s");
             $auditoria->save(false);
             $this->redirect(array('admin'));
         }
     }
     $this->render('update', array('a' => $a, 'b' => $b, 'c' => $c));
 }
Ejemplo n.º 4
0
    $fecha_seguimiento = $model->fecha_seguimiento = date('d-m-Y', strtotime($model->fecha_seguimiento));
}
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'fecha_seguimiento', 'language' => 'es', 'model' => $model, 'attribute' => 'fecha_seguimiento', 'value' => $fecha_seguimiento, 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2015:2020'), 'htmlOptions' => array('style' => 'height:20px;width:80px;')));
?>
						</div>
		<?php 
echo $form->error($model, 'fecha_seguimiento');
?>
	</div>

	<div class="span4">
		<?php 
echo $form->labelEx($model, 'responsable_id');
?>
		<?php 
echo $form->dropDownList($model, 'responsable_id', CHtml::listData(Empleados::model()->findAll('activo = 1 and responsable_seguimiento = 1'), 'id', 'NombreCompleto'), array('class' => 'input-xlarge', 'empty' => ""));
?>
		<?php 
echo $form->error($model, 'responsable_id');
?>
	</div>

	<div class="span4">
		<?php 
echo $form->labelEx($model, 'tema_id');
?>
		<?php 
echo $form->dropDownList($model, 'tema_id', CHtml::listData(TemaSeguimiento::model()->findAll('activo = 1'), 'id', 'tema'), array('class' => 'input', 'empty' => ""));
?>
		<?php 
echo $form->error($model, 'tema_id');
Ejemplo n.º 5
0
}
?>

<h1><?php 
echo $titulo;
?>
</h1>

<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'seguimiento-comercial-prospectos-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerSeguimiento', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '20')), array('header' => 'Fecha de acción', 'name' => 'fecha_seguimiento', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_seguimiento', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_seguimiento', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_seguimiento\']);', 'htmlOptions' => array('width' => '80')), array('header' => 'Prospecto', 'name' => 'prospecto_id', 'filter' => CHtml::listData(Prospectos::model()->findAll(), 'id', 'nombreCompleto'), 'value' => '$data->prospecto->nombreCompleto', 'htmlOptions' => array('width' => '220')), array('header' => 'Tema', 'name' => 'tema_id', 'filter' => CHtml::listData(TemaSeguimiento::model()->findAll(), 'id', 'tema'), 'value' => '$data[\'tema\'][\'tema\']'), array('header' => 'Observaciones', 'name' => 'comentario', 'value' => '$data->comentario'), array('header' => 'Responsable de Seguimiento', 'name' => 'responsable_id', 'filter' => CHtml::listData(Empleados::model()->findAll(), 'id', 'nombreCompleto'), 'value' => '$data[\'responsable\'][\'nombreCompleto\']'), 'usuario_id', 'ultimo_seguimiento')));
?>

<?php 
Yii::app()->clientScript->registerScript('re-install-date-picker', "\n\tfunction reinstallDatePickerSeguimiento(id, data) {\n\t        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n\t    \$('#datepicker_for_fecha_seguimiento').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n\t    //\$('#datepicker_for_fecha_seguimiento').datepicker(\$.datepicker.regional[ 'es' ]);\n\t  //\$('#datepicker_for_fecha_seguimiento').datepicker({dateFormat: 'dd-mm-yy'});\n\t}\n\t");
?>

<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#seguimiento-comercial-prospectos-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#seguimiento-comercial-prospectos-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();
Ejemplo n.º 6
0
		<?php 
echo $a->isNewRecord ? 'Nueva Nomina' : 'Modificar: ' . $a->persona->nombre . ' ' . $a->persona->apellido;
?>
	</div>
		<div class="panel-body">
			<fieldset>
				<div class="form-group input-group col-sm-12<?php 
echo $a->hasErrors('id_empleado') ? ' has-error' : '';
?>
">
					<div class="input-group">
						<span class="input-group-addon">
							<i class="fa fa-male fa-fw"></i>
						</span>
						 <?php 
echo $form->dropDownList($a, 'id_empleado', Empleados::items(1), array('class' => 'form-control', 'title' => 'Indique el nombre del Empleado'));
?>
						<?php 
echo $a->hasErrors('id_empleado') ? "<span class='input-group-addon danger'><span class='glyphicon glyphicon-remove'></span></span>" : '';
?>
					</div>
					<?php 
echo $form->error($a, 'id_empleado');
?>
				</div>
				
				<div class="form-group input-group col-sm-12<?php 
echo $a->hasErrors('fecha') ? ' has-error' : '';
?>
">
					<div class="input-group">
Ejemplo n.º 7
0
 public function asistencia($asistencia, $id)
 {
     $empleado = Empleados::model()->findByAttributes(array('id' => $id));
     $cargo = Cargos::model()->findByAttributes(array('id' => $empleado->id_cargo));
     if ($asistencia == 0) {
         return $asistencia;
     } else {
         if ($cargo->tipo_sueldo == 1) {
             $semana_mes = 7;
         } else {
             $semana_mes = 30;
         }
         $sueldo_diario = $cargo->sueldo / $semana_mes;
         $asistencia = $sueldo_diario * 6;
         return $asistencia;
     }
 }