<?php 
$this->breadcrumbs=array(
	'Datos Txt Integrados'=>array('index'),
	$model->id,
);
$this->menu=array(
	array('label'=>'List DatosTxtIntegrado','url'=>array('index')),
	array('label'=>'Create DatosTxtIntegrado','url'=>array('create')),
	array('label'=>'Update DatosTxtIntegrado','url'=>array('update','id'=>$model->id)),
	array('label'=>'Delete DatosTxtIntegrado','url'=>'#','linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage DatosTxtIntegrado','url'=>array('admin')),
);
?>


    <table class="table table-bordered">
        <tr>
            <td  style="text-align: center;"  colspan="4"><b>Informaci&oacute;n de la carga realizada</b></td>
        </tr>
        <tr>
            <td><b><?php echo $model->getAttributeLabel('nombre_archivo')?></b></td>
            <td><?php echo $model->nombre_archivo?></td>
            <td><b><?php echo $model->getAttributeLabel('descripcion')?></b></td>
            <td><?php echo $model->descripcion?></td>
        </tr>
        <tr>
            <td><b><?php echo $model->getAttributeLabel('cant_aportantes')?></b></td>
            <td><?php echo $model->cant_aportantes?></td>
            <td><b><?php echo $model->getAttributeLabel('total_aportes')?></b></td>
            <td><?php echo number_format($model->total_aportes,2,',','.');?></td>
        </tr>
        <tr>
            <td><b><?php echo $model->getAttributeLabel('fecha_aporte')?></b></td>
            <td><?php echo date('d-m-Y',strtotime($model->fecha_aporte))?></td>
            <td><b><?php echo $model->getAttributeLabel('fecha_registro')?></b></td>
            <td><?php echo date('d-m-Y',strtotime($model->fecha_registro)) ?></td>
        </tr>
       <!--  <tr>
            <td><b><?php echo $model->getAttributeLabel('total_aportes')?></b></td>
            <td><?php echo $model->total_aportes?></td>
            <td><b><?php echo $model->getAttributeLabel('cant_aportantes')?></b></td>
            <td><?php echo $model->cant_aportantes?></td>
        </tr> -->
       
        <tr>
            <td colspan="1"><b>Asociado con aporte en cero (0)</b></td>
            <td colspan="3"><?php echo $aportesCeroSocio;?></td>
        </tr>
         <tr>
            <td colspan="1"><b><?php echo $model->getAttributeLabel('estatus')?></b></td>
            <td colspan="3" style="text-align: center;"><?php echo $model->getEstatus(); ?></td>
        </tr>
    </table>
<?php
   Yii::import('application.modules.configuracion.models.*',true);
   Yii::import('application.modules.contable.models.*',true);
    if (ConfContable::config('CONFCONTABLE')=='SI'){ 

?>
<div style="text-align: center;">
    <h3>Información contable</h3>
    <table class="table table-hover">
    <tr>
        <th>Fecha</th>
        <th>N° compropante</th>
        <th>Descripcion</th>
        <th>N° referencia</th>
        <th>Estatus</th>
    </tr>
<?php 

    $modeloComprobante= Comprobante::model()->findAll('nro_documento=:doc',array(':doc'=>$model->id)); 
//    echo "<pre>";    print_r($modeloComprobante); exit;
 foreach ($modeloComprobante as $comprobante):
     
     $num_comprobante= CHtml::link('<i class="icon-file"></i> '.$comprobante->num_comprobante, Yii::app()->createUrl('contable/comprobante/view&id='.$comprobante->id),array());
     
     $fecha=date('d-m-Y',  strtotime($comprobante->fecha_comprobante));
     if($comprobante->status==1){
       $comprobante->status='Contabilizado';  
     }else{
       $comprobante->status='No Contabilizado';  
     }
 echo " <tr>
        <td>$fecha</td>
        <td>$num_comprobante</td>
        <td>$comprobante->descripcion</td>
        <td>$comprobante->nro_documento</td>
        <td>$comprobante->status</td>
    </tr>";
 
 
 endforeach;
  
?>
         
</table>
</div>
<?php } ?>
<div style="text-align: center;">
<?php  echo CHtml::link('Ir a bandeja de Aportes', Yii::app()->createUrl('/aportes/datosTxtIntegrado/adminAF'),array('class'=>'btn btn-inverse')); ?>
</div>
<div class="col-xs-12"><hr></div>

<h3 style="text-align: center;color: #0A2A0A;">Aportantes activos</h3>

<?php $this->widget('bootstrap.widgets.TbGridView',array(
    'id'=>'aporte-voluntario-grid',
    'dataProvider'=>$modelAportes->searchV($model->id),
    'filter'=>$modelAportes,
    'columns'=>array(
        //'id',
        
                array(
                    'name'=>'cedula',
                    'value'=>'$data->idAsociado->cedula',
                    //'filter'=>true
                ),
                array(
                    'name'=>'nombre',
                    'value'=>'$data->idAsociado->nombre',
                    //'filter'=>true
                ),
                array(
                    'name'=>'apellido',
                    'value'=>'$data->idAsociado->apellidos',
                    //'filter'=>true
                ),
               
                /*array(
                    'name'=>'sueldo_base',
                    'value'=>'number_format($data->sueldo_base,2,",", ".")',
                    'htmlOptions' => array('style' => 'text-align: right'), // Opciones HTML

                ),
                array(
                    'name'=>'aporte_patrono',
                    'value'=>'number_format($data->aporte_patrono,2,",", ".")',
                    'htmlOptions' => array('style' => 'text-align: right'), // Opciones HTML

                ),*/
        
                array(
                    'name'=>'aporte',
                    'value'=>'number_format($data->aporte,2,",", ".")',
                    'htmlOptions' => array('style' => 'text-align: right'), // Opciones HTML
                ),
//      'aporte_patrono',
//                'aporte_asociado',
                array(
                    'name'=>'fecha_aporte',
                    'value'=>'implode("-",array_reverse(explode("-",$data->fecha_aporte)))',
                    'class'=>'SYDateColumn',
                    'htmlOptions' => array('style' => 'text-align: center'), // Opciones HTML

                ),
                    
        array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
                        
                        'template' => '',
                ),
    ),
)); ?>

<h3 style="text-align: center;color: #610B0B;">Aportantes no definidos</h3>
<?php $this->widget('bootstrap.widgets.TbGridView',array(
    'id'=>'aporte-voluntario-diferido-grid',
    'dataProvider'=>$modelAportesDiferidos->search($model->id),
    'filter'=>$modelAportesDiferidos,
    'columns'=>array(
//      'id',
        'cedula',
                array(
                    'name'=>'unidad',
                    'value'=>'$data->getArea()',
                    'filter'=>CHtml::activeDropDownList($modelAportesDiferidos,'unidad',
                            CHtml::listData(Unidad::model()->findAll('blnborrado=FALSE'),'idunidad','descripcion'),
                            array('prompt'=>'SELECCIONE')
                            )
                ),
            /*array(
                    'name'=>'sueldo',
                    'value'=>'number_format($data->sueldo,2,",", ".")',
                    'htmlOptions' => array('style' => 'text-align: right'), // Opciones HTML

                ),*/
        
            array(
                    'name'=>'aporte_asociado',
                    'value'=>'number_format($data->aporte_asociado,2,",", ".")',
                    'htmlOptions' => array('style' => 'text-align: right'), // Opciones HTML
                ),
        
            /*array(
                    'name'=>'aporte_patrono',
                    'value'=>'number_format($data->aporte_patrono,2,",", ".")',
                    'htmlOptions' => array('style' => 'text-align: right'), // Opciones HTML
                ),*/
            array(
                    'name'=>'id_status',
                    'value'=>'$data->idStatus->nombre_estatus',
                    'htmlOptions' => array('style' => 'text-align: center'), // Opciones HTML

                ),
//      'sueldo',
//      
//      'aporte_asociado',
//      'aporte_patrono',
                


        array(
                    'class'=>'bootstrap.widgets.TbButtonColumn',
                    'header'=>"Acción",
                    'template' => '{update}',
                    'buttons'=>array(
                        'update' => array
                                    (
                                    'visible'=>'(Yii::app()->user->checkAccess("action_aporteFondoDiferido_update") && !$data->idTxt->aprobado() && !$data->idTxt->pagado() && !$data->idTxt->pagadoFaltante() && $data->idStatus->id != 5)',
                                    //'icon' => 'icon-ok',
                                    'url'=>"CHtml::normalizeUrl(array('/montepio/aporteFondoDiferido/update', 'id'=>\$data->id))",
                                    //'imageUrl'=>false,
                                    //'options'=>array('title'=>'Aprobar Archivo','id'=>"aprobar") ,
//                                               
                                    ),
                        
                    ),
        ),
    ),
)); ?>

<?php if (!empty($detalle)) { ?>
  <br>  
  <h3 style="text-align: center">Detalle del pago</h3>
    <table class="table table-bordered table-striped table-hover items table table-striped table-bordered table-condensed" >
      <tr class="info" >
        <td style="text-align: center"><b>Fecha del pago</b></td>
        <td style="text-align: center"><b>Banco origen</b></td>
        <td style="text-align: center"><b>Cuenta origen</b></td>
        <td style="text-align: center"><b>Referencia del pago</b></td>
        <td style="text-align: center"><b>Monto pagado</b></td>
        <td style="text-align: center"><b>Observaci&oacute;n</b></td>
      </tr>
      <tr>
          <td style="text-align: center"><?php echo date('d-m-Y',strtotime($detalle->fecha_pago)); ?></td>
          <td style="text-align: center"><?php echo $detalle["banco_desc"]["banco"]; ?></td>
          <td style="text-align: center"><?php echo $detalle["banco_desc"]["num_cuenta"]; ?></td>
          <td style="text-align: center"><?php echo $detalle->referencia; ?></td>
          <td style="text-align: center"><?php echo number_format($detalle->monto_pagado, 2, ",", "."); ?></td>
          <td style="text-align: center"><?php echo $detalle->observacion; ?></td>
      </tr>
    </table>
<?php } ?>

<?php $this->widget('bootstrap.widgets.TbGridView',array(
    'id'=>'estatus-grid',
    'dataProvider'=> EstatusTxtIntegrado::model()->searchStatus($model->id),
    //'filter'=>$model,
    'columns'=>array(
        array(
                    'name'=>'fecha_registro',
                    'value'=>'date("d-m-Y h:m:s",strtotime($data->fecha_registro))',
                ),
        array(
                    'header'=>'Estatus',
                    'name'=>'id_estatus_retiro',
                    'value'=>'($data->idEstatusTxt)?$data->idEstatusTxt->nombre_estatus:""',
                ),
        array(
                    'header'=>'Usuario',
                    'name'=>'id_usuario',
                    'value'=>'$data->datosUsuario',
                ),
    ),
)); ?>

<div style="text-align: center;">
<?php  echo CHtml::link('Ir a bandeja de Aportes', Yii::app()->createUrl('/aportes/datosTxtIntegrado/adminAF'),array('class'=>'btn btn-inverse')); ?>
</div>
