<?php $cantidadCuotasOrdinarias =count($modelTablaAmortizacion)-$cuotasEspaciales;?>
<h3 style="text-align:center">Datos de Amotizaci&oacute;n</h3>
<table class="      table table-bordered table-striped table-hover">
	    <tr class="info">
			<td colspan="2"><b>Datos del Crédito:</b></td>
			<td colspan="2"><b>Resultados del Crédito:</b></td>
		</tr>

		<tr>
			<td><b>Monto a financiar:</b></td>
			<td><?php echo number_format($montoCredito,2,',','.');?> Bs.</td>
			<td><b>Monto promedio de las cuotas:</b></td>
			<td><?php echo number_format($modelTablaAmortizacion[0]->monto_cuota,2,',','.'); ?> Bs.</td>
		</tr>		
		<tr>
			<td><b>Gastos administrativos:</b></td>
			<td><?php echo number_format($modelTipoCredito->calculoGastoAdministrativo($montoCredito),2,',','.');?> Bs</td>
			<td><b>Monto total intereses:</b></td>
			<td><?php echo number_format($interesGenerado,2,',','.');?> Bs</td>
		</tr>	
                <?php if($modelTipoCredito->id_clasificacion_tipo_credito==2):?>
		<tr>
			<td><b>Gastos Administrativos afianzadora:</b></td>
			<td><?php echo number_format($modelTipoCredito->calculoGastoAdministrativoAfianzadora($montoCredito),2,',','.');?> Bs</td>
			<td><b>Forma de Pago:</b></td>
			<td><?php echo ($modelTipoNomina->idTipoNomina)?$modelTipoNomina->idTipoNomina->nombre_nomina:"";?></td>
		</tr>
                <?php endif;?>
		<tr>
			<td><b>Plazo ó período:</b></td>
			<td><?php echo $modelTipoCredito->duracion_credito;?> meses</td>
                        <?php if($modelTipoCredito->id_clasificacion_tipo_credito==2){?>
                            <td></td>
                            <td></td>
                        <?php }
                            else{?>
                                <td><b>Forma de Pago:</b></td>
                                <td><?php echo ($modelTipoNomina->idTipoNomina)?$modelTipoNomina->idTipoNomina->nombre_nomina:"";?></td>
                        <?php }?>
			
		</tr>		
		<tr>
			<td><b>Tasa de Interés:</b></td>
			<td><?php echo $modelTipoCredito->taza_interes;?>%</td>
			<td></td>
			<td></td>
		</tr>		
		
		<tr>
			<td><b>Total de Cuotas:	</b></td>
			<td> <?php echo $cantidadCuotasOrdinarias;?> </td>
			<td></td>
			<td></td>
		</tr>
		<?php if($cuotasEspaciales>0):?>
		<tr>
			<td><b>Total de Cuotas Especiales:	</b></td>
			<td> <?php echo $cuotasEspaciales;?> </td>
			<td></td>
			<td></td>
		</tr>
		<?php endif;?>
    </table>

	
<?php if($cuotasEspaciales>0)?><h3  style="text-align:center">Cuotas Ordinarias <?php echo ($modelTipoNomina->idTipoNomina)?$modelTipoNomina->idTipoNomina->nombre_nomina:"";?></h3>
<div id="tabla-amortizacion-grid" class="grid-view">
<table class="      table table-bordered table-striped table-hover">
	   <tr class="info">
        <td><b>Periodo</b></td>
        <td><b>Monto (Bs.)</b></td>
        <td><b>Amort. (Bs.)</b></td>
        <td><b>Interes (Bs.)</b></td>
        <td><b>Cuota (Bs.)</b></td>
        <td><b>Saldo (Bs.)</b></td>
      </tr>
	
	  <?php foreach($modelTablaAmortizacion as $key =>$value):
				if($key<= ($cantidadCuotasOrdinarias-1)):?>
			<tr>
				<td><?php echo $value->numero_cuota; ?></td>
				<td><?php echo number_format($value->monto_base,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_capital,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_interes,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_cuota,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_credito,2,',','.');?></td>
			</tr>
	  <?php endif;
			endforeach;?>
    </table>
  </div>
<?php if($cuotasEspaciales>0) :?>
<h3 style="text-align:center">Cuotas Especiales </h3>
<div id="tabla-amortizacion-grid" class="grid-view">
<table class="      table table-bordered table-striped table-hover">
	   <tr class="info">
        <td><b>Periodo</b></td>
        <td><b>Monto (Bs.)</b></td>
        <td><b>Amort. (Bs.)</b></td>
        <td><b>Interes (Bs.)</b></td>
        <td><b>Cuota (Bs.)</b></td>
        <td><b>Saldo (Bs.)</b></td>
      </tr>
	
	  <?php foreach($modelTablaAmortizacion AS $key =>$value):
				if($key > ($cantidadCuotasOrdinarias-1)):?>
			<tr>
				<td><?php echo $value->numero_cuota; ?></td>
				<td><?php echo number_format($value->monto_base,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_capital,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_interes,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_cuota,2,',','.'); ?></td>
				<td><?php echo number_format($value->monto_credito,2,',','.');?></td>
			</tr>
	  <?php endif;
			endforeach;?>
    </table>
  </div>
  <?php endif;?>
  