$pdf->SetX('2');
    $pdf->Cell(0, 0, $a, 0, 0, M);
    $pdf->SetX('15');
    $pdf->Cell(0, 0, $myrow['descripcionArticulo'], 0, 0, M);
    //$pdf->SetX('140');
    //$pdf->Cell(0,0,$myrow['hora'],0,0,M);
    //
    //
    //
    $pdf->SetX('140');
    $pdf->Cell(0, 0, $myrow['statusCargo'], 0, 0, M);
    $pdf->SetX('155');
    if ($myrow3ac['costo'] > 0) {
        $pdf->Cell(0, 0, '$' . number_format($myrow['costoHospital'], 2), 0, 0, M);
    }
    $pdf->SetX('180');
    $pdf->Cell(0, 0, $myrow['cantidad'], 0, 0, M);
    //$pdf->Cell(0,0,'$'.number_format(($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']),2),0,0,M);
    //*****************************************************************
    //$pdf->SetX('100');
    //$pdf->Cell(0,0,'Firma',0,0,L);
    //$pdf->line(2,$a+$vector,203,$a+$vector);
    $pdf->Ln(3);
    //salto de linea
}
//cierra while**************************---------------------------------------------------------------------------------------------------------------
$pdf->Ln(15);
//salto de linea
//Launch the print dialog
$pdf->AutoPrint(true);
$pdf->Output();
    if ($totalDescuento[0] > 0) {
        $pdf->SetY($Y + 10);
        $pdf->Cell(0, 0, "Descuento: " . "-\$ " . number_format($totalDescuento[0], 2), 0, 0, R);
        $pdf->SetY($Y + 15);
        $pdf->Cell(0, 0, "Total: " . "\$ " . number_format($TOTAL - $totalDescuento[0], 2), 0, 0, R);
    } else {
        $pdf->SetY($Y + 10);
        $pdf->Cell(0, 0, "Total: " . "\$ " . number_format($TOTAL, 2), 0, 0, R);
    }
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetXY(2, 120);
    $pdf->Cell(0, 0, '*** ' . $resultado . ' ' . $formula . ' ***', 0, 0, L);
    $pdf->SetXY(2, $Y + 10);
    $pdf->Cell(0, 0, 'Este documento no es deducible fiscalmente', 0, 0, L);
    //Launch the print dialog
    $pdf->AutoPrint(false);
    $pdf->Output();
} else {
    $pdf->Ln(10);
    //salto de linea
    //$pdf->Line(2,5, 199,5);
    $pdf->SetFont('Arial', '', 10);
    $pdf->Cell(0, 0, "Subtotal: " . "\$" . number_format($cargos[0] - $abonos[0], 2), 0, 0, R);
    $pdf->Ln(4);
    //salto de linea
    $pdf->Cell(0, 0, "Iva: " . "\$" . number_format($ivaCargos[0] - $ivaAbonos[0], 2), 0, 0, R);
    $pdf->Ln(4);
    //salto de linea
    $pdf->Cell(0, 0, "Total: " . "\$" . number_format($TOTAL, 2), 0, 0, R);
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetX(2);
                //echo "select optativa2b$n_z from matriculas_bach where id = '$id'<br />";
                $o_b = mysqli_fetch_array($opt_b);
                $reduce = substr($key, 0, -3);
                $opt_2b .= $o_b[0] . ". " . $val . "; ";
            }
        }
        //$opt_o = "\nOptativas de Bachillerato".$opt_2b;
        if ($curso == "1BACH") {
            $MiPDF->Cell(80, 5, $n_curso . "º DE BACH. ( " . $mod_registro . " )", 1, 0, 'C');
            $MiPDF->MultiCell(88, 5, $bil . $opt, 1);
            $MiPDF->Ln(2);
        }
        if ($curso == "2BACH") {
            $MiPDF->Cell(80, 5, $n_curso . "º DE BACH. ( " . $mod_registro2b . " )", 1, 0, 'C');
            $MiPDF->MultiCell(88, 5, $bil . $opt2b, 1);
            $MiPDF->Cell(165, 5, "MATERIAS OPTATIVAS", 0, 0, "C");
            $MiPDF->Ln(5);
            $MiPDF->MultiCell(168, 5, $opt_2b, 1);
            $MiPDF->Ln(8);
            if (!$repetidor) {
                $MiPDF->Cell(165, 5, "MODALIDAD Y OPTATIVAS DE 1º BACHILLERATO", 0, 0, "C");
                $MiPDF->Ln(5);
                $MiPDF->Cell(80, 5, "MODALIDAD " . $mod_registro . " )", 1, 0, 'C');
                $MiPDF->MultiCell(88, 5, $bil . $opt, 1);
                $MiPDF->Ln(2);
            }
        }
    }
}
$MiPDF->AutoPrint(true);
$MiPDF->Output();