<?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')),
);
?>

<h1 style="text-align: center;">Archivo de Carga Masiva <span style="color: #0B3B0B;"><?php echo $model->nombre_archivo; ?></span></h1>

<?php $this->widget('bootstrap.widgets.TbDetailView',array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		'nombre_archivo',
		'descripcion',
		'fecha_registro',
		//'total_aportes',
                array(
                    'name'=>'total_aportes',
                    'value'=>number_format($model->total_aportes,2,",", "."),
                ),
		'cant_aportantes',
		'fecha_aporte',
                
                array(
                    'label'=>'Estatus',
                    'type'=>'raw',
                    'value'=>$model->getEstatus(),
                ),
	),
)); ?>
<?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/adminMP'),array('class'=>'btn btn-inverse')); ?>
</div>
<div class="col-xs-12"><hr></div>
<h3 style="text-align: center;color: #0A2A0A;">Nomina de Monte Pío</h3>

<?php $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'aporte-voluntario-grid',
	'dataProvider'=>$modelAportes->searchMp($model->id),
	'filter'=>$modelAportes,
	'columns'=>array(
		//'id',
		
                array(
                    'name'=>'acedula',
                    'value'=>'$data->idAsociado->cedula',
                    //'filter'=>true
                ),
                array(
                    'name'=>'anombre',
                    'value'=>'$data->idAsociado->nombre',
                    //'filter'=>true
                ),
                array(
                    'name'=>'aapellido',
                    'value'=>'$data->idAsociado->apellidos',
                    //'filter'=>true
                ),

                array(
                    'name'=>'monto',
                    'value'=>'number_format($data->monto,2,",", ".")',
                ),

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



<!--<h3 style="text-align: center;color: #610B0B;">Aportes No definidos</h3>-->
<?php /*$this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'aporte-voluntario-diferido-grid',
	'dataProvider'=>$modelAportesDiferidos->searchD($model->id),
	'filter'=>$modelAportesDiferidos,
	'columns'=>array(
//		'id',
		'cedula',
		'monto',
//		'area',
                array(
                    'name'=>'area',
                    'value'=>'$data->getArea()',
                    'filter'=>CHtml::activeDropDownList($modelAportesDiferidos,'area',
                            CHtml::listData(Unidad::model()->findAll('blnborrado=FALSE'),'idunidad','descripcion'),
                            array('prompt'=>'SELECCIONE')
                            )
                ),
		'aportante',
                array(
                    'name'=>'id_estatus_avd',
                    'value'=>'$data->idEstatusAvd->nombre_estatus',
                    'filter'=>CHtml::activeDropDownList($modelAportesDiferidos,'id_estatus_avd',
                            CHtml::listData(EstatusAporteVoluntarioDiferido::model()->findAll('blnborrado=FALSE'),'id','nombre_estatus'),
                            array('prompt'=>'SELECCIONE')
                            )
                ),
//                array(
//                    'name'=>'blnborrado',
//                    'value'=>'($data->blnborrado)?"SI":"NO"',
//                    'filter'=>CHtml::activeDropDownList($modelAportesDiferidos,'blnborrado',
//                            array(1=>'SI',0=>'NO'),
//                            array('prompt'=>'SELECCIONE')
//                            )
//                ),

		array(
                    'class'=>'bootstrap.widgets.TbButtonColumn',
                    'header'=>"Acción",
                    'template' => '{update}',
                    'buttons'=>array(
                        'update' => array
                                    (
                                    'visible'=>'(Yii::app()->user->checkAccess("/aportes/aporteVoluntarioDiferido/update") && !'.$model->aprobado().')',
                                    'url'=>"CHtml::normalizeUrl(array('/aportes/aporteVoluntarioDiferido/update', 'id'=>\$data->id))",
                                    ),
                        
                    ),

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