<?php
/* @var $this AjusteHaberesController */
/* @var $model AjusteHaberes */

$this->breadcrumbs=array(
	'Ajuste Haberes'=>array('index'),
	$model->id,
);

$this->menu=array(
	array('label'=>'List AjusteHaberes', 'url'=>array('index')),
	array('label'=>'Create AjusteHaberes', 'url'=>array('create')),
	array('label'=>'Update AjusteHaberes', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete AjusteHaberes', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage AjusteHaberes', 'url'=>array('admin')),
);
?>
<h3 style="text-align: center">Vista del ajuste de haberes</h3><hr>
	<?= ($model->id_estatus==1)?CHtml::link('Aprobar ajuste', ['aprobar', 'id' => $model->id], ['class' => 'btn btn-primary']):"";?>
	<?= CHtml::link('Ir a la bandeja de ajuste', ['admin'], ['class'=>'btn btn-inverse']);?>
  <br><br>
<?php $this->widget('bootstrap.widgets.TbAlert', array(
		'block' => true, // display a larger alert block?
		'fade' => true, // use transitions?
		'closeText' => '×', // close link text - if set to false, no close link is displayed
		'alerts' => array(// configurations per alert type
			'error' => array('block' => true, 'fade' => true, 'closeText' => '×'), // success, info, warning, error or danger
            'success'=>array('block'=>true, 'fade'=>true, 'Text'=>'&times;'), // success, info, warning, error or danger
		),
	))?>
<fieldset><legend style=" font-size: 17px;"><b>Datos del solicitante</b></legend>            
<table class="table table-bordered">
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('cedula'); ?></b></td>
            <td style="width: 25%"><?= $model->idAsociado->cedula ;?></td>
            <td style="width: 20%"><b>Nombres y apellidos</b></td>
            <td style="width: 30%"><?= $model->idAsociado->nombre.' '.$model->idAsociado->apellidos;?></td>
        </tr>
        <tr>
            <td><b>Empresa</b></td>
            <td><?= $model->idAsociado->lugartrabajo0->descripcion;?></td>
            <td><b>Unidad</b></td>
            <td><?= $model->idAsociado->unidad->descripcion;?></td>
        </tr>
        <tr>
            <td><b>&Uacute;ltimo sueldo</b></td>
            <td><?= $model->idAsociado->utltimoSueldoPorcentajeAporte($model->idasociado);?></td>
            <td><b>Porcentaje de aporte</b></td>
            <td><?php
            		$modelPorcentajeAporte = PorcentajeDescuentoAsociadoPatrono::model()->find('idasociado=:idasociado AND actual = true',array(':idasociado'=>$model->idasociado));
		            if($modelPorcentajeAporte)
		                $porcentaje = $modelPorcentajeAporte->idPorcentajeAsociado->descripcion;        
		            else 
		                $porcentaje = 10; 

		           	 echo $porcentaje.'%'?>
            </td>
        </tr>
        <tr>
            <td><b>Fecha de inscripci&oacute;n</b></td>
            <td><?=  $model->idAsociado->fechaingreso ?></td>
            <td><b>Estatus</b></td>
            <td><?=  $model->idAsociado->blnborrado=="1"?"Inacivo":"Activo"?></td>
        </tr>
    </table>
</fieldset>
<fieldset><legend style=" font-size: 17px;"><b>Datos del ajuste</b></legend>            
	<table class="table table-bordered" id="datos_prestamos_calculadora">
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('id_tipo_ajuste'); ?></b></td>
            <td> <?=$model->idTipoAjuste->descripcion?></td>
        </tr>
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('id_concepto_ajuste'); ?></b></td>
            <td> <?= $model->idConceptoAjuste->descripcion;?></td>
        </tr>
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('id_tipo_movimiento'); ?></b></td>
            <td> <?= $model->idTipoMovimiento->descripcion?></td>
        </tr>
        <?php if($model->id_tipo_movimiento ==1 || $model->id_tipo_movimiento ==3){?>
	        <tr>
	            <td><b><?= $model->getAttributeLabel('monto_asociado'); ?></b></td>
	            <td>Bs. <?= number_format($model->monto_asociado,2,',','.'); ?></td>
	        </tr>
	    <?php 
				}

	    	if($model->id_tipo_movimiento ==2 || $model->id_tipo_movimiento ==3){?>
	        <tr>
	            <td><b><?= $model->getAttributeLabel('monto_patrono'); ?></b></td>
	            <td>Bs. <?= number_format($model->monto_patrono,2,',','.')?></td>
	        </tr>
        <?php }?>
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('numero_operacion'); ?></b></td>
            <td> <?= $model->numero_operacion; ?></td>
        </tr>
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('fecha_operacion'); ?></b></td>
            <td> <?= date('d-m-Y',strtotime($model->fecha_operacion))?></td>
        </tr>
        <tr>
            <td style="width: 25%"><b><?= $model->getAttributeLabel('observacion'); ?></b></td>
            <td> <?= $model->observacion ?></td>
        </tr>
    </table>
</fieldset>

 <?php $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'conf-retiro-parcial-grid',
	'dataProvider'=> AjusteHaberesSeguimiento::model()->searchSeguimiento($model->id),
	//'filter'=>$model,
	'columns'=>array(
		array(
                    'name'=>'fecha_registro',
                    'value'=>'date("d-m-Y h:m:s",strtotime($data->fecha_registro))',
                ),
		array(
                    'name'=>'id_estatus_ajuste_haberes',
                    'value'=>'$data->idEstatusAjusteHaberes->descripcion',
                ),
		array(
                    'name'=>'observacion',
                    'value'=>'$data->observacion',
                ),
		array(
                    'header'=>'Usuario',
                    'name'=>'id_usuario',
                    'value'=>'$data->datosUsuario',
                ),
	),
)); ?>
    <br/>