<?php
$cuotas = $_POST["cuotas"];
$dias = $_POST["dias"];
$hoy = @date('Y-m-d');
$tipo = $_POST["tipo"];
$cuota = $_POST["cuota"];
$tasa0 = $_POST["tasa"];
$ganancia = $_POST["ganancia"];
$monto = $_POST["monto"];
$mora = $_POST["mora"];
$diasmora = $_POST["diasmora"];
$capital  = $_POST["capital"];
$interes  = $_POST["interes"];

$tabla = "<table align='center' id='tbl'>";
$tabla .= "<th>CAPITAL</th><th>INTERES</th><th>TOTAL</th><th>VENNCE</th>";
for($i=0; $i<$cuotas; $i++){
	$vence = @date('Y-m-d', strtotime($vence. ' + '.$dias.' days'));
	$vence = @date($vence);
	$tabla.="<tr>";	
		$total = $capital + $interes;
		$i = $i+1;
		if($i==$cuotas and $tipo=="Solo interes"){
		$total=$monto+$interes;
		$capital=$monto;
		}
		
		$tabla.="<td>".round($capital,2)."</td>";
	 	$tabla.="<td>".round($interes,2)."</td>";
		$tabla.= "<td>".$total."</td>";
		$tabla.="<td>".$vence."</td>";
	$tabla.="</tr>";
}
$tabla.="</table>";

echo $tabla;
?>