<fieldset>
    <legend>Datos del asociado</legend>
        <table class="table table-condensed table-bordered">
            <tr>
                <th>C&eacute;dula de identidad</th>
                <th>Nombre</th>
                <th>Apellido</th>
                <th>Unidad</th>
                <th>Fecha de Ingreso</th>
                <th>Estatus</th>    
            </tr>
            <tr>
                <td><?= $modelAsociado->cedula?></td>
                <td><?= $modelAsociado->nombre?></td>
                <td><?= $modelAsociado->apellidos?></td>
                <td><?= ($modelAsociado->unidad)?$modelAsociado->unidad->descripcion:""; ?></td>
                <td><?= $modelAsociado->fechaingreso?></td>
                <td><?= ($modelAsociado->idEstatus)?$modelAsociado->idEstatus->nombre_estatus:""?></td>
            </tr>
        </table>
    </fieldset>   
<fieldset>
    <legend>Datos de los pr&eacute;stamo</legend>
        <table class="table table-condensed table-bordered">
            <tr>
                <td style="text-align: center; width: 6%;"><b>Clave del pr&eacute;stamo</b></td>
                <td style="text-align: center"><b>Categor&iacute;a del pr&eacute;stamo</b></td>
                <td style="text-align: center"><b>Plazo</b></td>
                <td style="text-align: center"><b>Tipo de solicitud</b></td>
                <td style="text-align: center"><b>Fecha de registro</b></td>
                <td style="text-align: center"><b>Estatus</b></td>
                <td style="text-align: center"><b>Monto del pr&eacute;stamo</b></td>
                <td style="text-align: center"><b>Monto cuota</b></td>
                <td style="text-align: center"><b>Saldo deudor</b></td>
                <td style="text-align: center"><b>Acci&oacute;n</b></td>
            </tr>
            <?php foreach ($data as $key => $value) {?>
                <tr>
                    <td style="text-align: center"><?= $value['id_tipo_credito']?></td>
                    <td><?= $value['categoria']?></td>
                    <td><?= $value['plazo']?></td>
                    <td><?= ($value['refinanciado']==0)?"Ordinario":(($value['refinanciado']==1)?"Refinanciado":"Reestructuración")?></td>
                    <td><?= date('d-m-Y',strtotime($value['fecha_registro']))?></td>
                    <td><?= $value['estatus_credito']?></td>
                    <td style="text-align: right;">Bs. <?= number_format($value['monto_credito'],2,',','.')?></td>
                    <td style="text-align: right;">Bs. <?= number_format($value['cuota_pagar'],2,',','.')?></td>
                    <td style="text-align: right;">
                        <?php $reporte = ReporteCreditos::model()->find('idcredito=:idcredito',[':idcredito'=>$value['id']]);
                            if(!$reporte)
                                $reporte = new ReporteCreditos;?>
                        Bs. <?= number_format(($reporte->capital+ $reporte->capital_especial)-($reporte->capital_pagados),2,',','.')?></td>
                    <td style="text-align: center;">
                        <?php  echo CHtml::link('Ver', Yii::app()->createUrl('/prestamo/credito/view',['id'=>$value['id']]),['class'=>'btn btn-success','target'=>'_blank']); ?>

                    </td>
                </tr>
            <?php }?>
        </table>
    </fieldset>  