$tabla = $contra->showTablaAmortizacion($_GET['contrato']);
} else {
    $tabla = $contra->showNewTablaAmortizacion($_GET['contrato']);
}
while ($l = $tabla->NextRow()) {
    $fecha_generacion = $l['fecha_generacion'];
    $monto = $l['monto'];
    break;
}
$pdf = new ImprimeTabla();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetY(15);
$pdf->Cell(60);
$pdf->Cell(50, 5, utf8_decode("FECHA DE PRÉSTAMO: ") . $fecha_generacion, 0, 0, 'C');
$pdf->Ln();
$pdf->Cell(60);
$pdf->Cell(50, 5, utf8_decode("IMPORTE DEL PRÉSTAMO: \$") . $monto, 0, 0, 'C');
$pdf->Ln(20);
$pdf->SetFont('Times', '', 12);
//tabla de amortizacion
//cabeceras
$pdf->SetFillColor(192, 192, 192);
$fill = true;
if ($_GET['tipo_tabla'] == 'original') {
    $pdf->SetFont("Arial", "B", 8);
    $pdf->Cell(10, 6, "#", 1, "", "", $fill);
    $pdf->Cell(27, 6, "SALDO INSOLUTO", 1, "", "", $fill);
    $pdf->Cell(30, 6, "CAPITAL PAGADO", 1, "", "", $fill);
    $pdf->Cell(35, 6, "% INTERES ", 1, "", "", $fill);
    $pdf->Cell(33, 6, "INTERES", 1, "", "", $fill);
$fecha = $_GET['fecha'];
$fill = true;
$pdf->SetFont("Arial", "B", 8);
$pdf->Cell(10, 6, "#", 1, "", "", $fill);
$pdf->Cell(30, 6, "SALDO INSOLUTO", 1, "", "", $fill);
$pdf->Cell(30, 6, "CAPITAL PAGADO", 1, "", "", $fill);
$pdf->Cell(35, 6, "% INTERES " . $ti, 1, "", "", $fill);
$pdf->Cell(25, 6, "INTERES", 1, "", "", $fill);
$pdf->Cell(25, 6, "PAGO", 1, "", "", $fill);
$pdf->Cell(35, 6, "FECHA DE CORTE", 1, "", "", $fill);
//cuerpo de la tabla
$pdf->SetFillColor(224, 224, 224);
$fill = false;
$pdf->SetFont('', 'I');
$tota = $total;
$pdf->Ln();
$fecha = date('Y-m-d', strtotime($fecha . ' ' . $interval));
$pdf->Cell(10, 6, 1, 1, "", "", $fill);
$pdf->Cell(30, 6, '$' . number_format($total, 2), 1, "", "", $fill);
$pdf->Cell(30, 6, '$' . number_format($abono - $total * ($tasa / $tipop), 2), 1, "", "", $fill);
$pdf->Cell(35, 6, $tasa / $tipop * 100 . '%', 1, "", "C", $fill);
$pdf->Cell(25, 6, '$' . number_format($total * ($tasa / $tipop), 2), 1, "", "", $fill);
$pdf->Cell(25, 6, '$' . number_format($abono, 2), 1, "", "", $fill);
$pdf->Cell(35, 6, $util->convierteFecha($fecha), 1, "", "", $fill);
$pdf->Ln();
$ffcorte = $fecha;
$cpagado = $abono - $tota * ($tasa / $tipop);
for ($i = 2; $i <= $nabon + 1; $i++) {
    $ffcorte = date('Y-m-d', strtotime($ffcorte . ' ' . $interval));
    $fill = !$fill;
    $tota -= $cpagado;