$lineSelect = 0;
 $count = count($rown);
 if ($count == 1) {
     $lineSelect = 2;
 }
 $changeColor = 0;
 $pdf->SetFormatCell(array());
 foreach ($rown as $val) {
     $pdf->SetAligns('L');
     $pdf->SetDibujaFondoTexto(false);
     if ($lineSelect == 0) {
         $pdf->SetFontAlignGeneral(1);
         $pdf->SetDibujaFondo(true);
         $pdf->SetFont('Arial', 'I', 14);
         $pdf->SetAltoLinea(7);
         $pdf->SetX(5);
         $pdf->SetFillColor(192, 192, 192);
         $pdf->SetTextColor(0, 0, 0);
         $changeColor = 0;
         $iline = 0;
     }
     if ($lineSelect == 1) {
         $pdf->SetX(5);
         $pdf->SetFontAlignGeneral(2);
         $pdf->SetAltoLinea(5);
         $pdf->SetFillColor(192, 192, 192);
         $pdf->SetTextColor(255, 255, 255);
         $pdf->SetFont('Arial', 'B', 7);
     }
     if ($lineSelect >= 2) {
         $pdf->SetX(5);
 $params[":siniestro"] = $_SESSION["ReportesSiniestros"]["ID"];
 $params[":orden"] = $_SESSION["ReportesSiniestros"]["ORDEN"];
 $stmt = DBExecSql($conn, $sql, $params);
 //-----------------------------------------------------------------------
 if (DBGetRecordCount($stmt) == 0) {
     echo "La consulta no devolviò datos.";
     exit;
 }
 $rowCabecera = DBGetQuery($stmt, 1, false);
 //-----------------------------------------------------------------------
 // $pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/varios/templates/ListadoJuiciosVerticalBlanco.pdf");
 $stmt = DBExecSql($conn, $sql, $params);
 $pdf->SetAutoPageBreak(true, 20);
 $pdf->AddPage('P', 'Legal');
 while ($row = DBGetQuery($stmt, 1, false)) {
     $pdf->SetX($pdf->margenDerecho);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFontAlignGeneral();
     $Newrow = array_values($row);
     $pdf->Row($Newrow);
     $pdf->LineaSepara();
 }
 unset($_SESSION['ReportesSiniestros']["ReporteDatosdelaEmpresa"]);
 // enviamos cabezales http para no tener problemas
 header('Content-Type: text/html; charset=UTF-8');
 //header('Content-Type: text/html; charset=iso-8859-1');
 header("Content-Transfer-Encoding", "binary");
 //header('Cache-Control: maxage=3600');
 header('Cache-Control: private, max-age=0, must-revalidate');
 header('Pragma: public');
 $pdf->Output('ReporteDatosdelaEmpresa.pdf', 'I');
 $params[":psiniestro"] = $_SESSION["ReportesSiniestros"]["ID"];
 $params[":porden"] = $_SESSION["ReportesSiniestros"]["ORDEN"];
 $stmt = DBExecSql($conn, $sql, $params);
 //-----------------------------------------------------------------------
 if (DBGetRecordCount($stmt) == 0) {
     echo "La consulta no devolviò datos.";
     exit;
 }
 $rowCabecera = DBGetQuery($stmt, 1, false);
 //-----------------------------------------------------------------------
 $pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"] . "/modules/varios/templates/ListadoJuiciosVerticalBlanco.pdf");
 $stmt = DBExecSql($conn, $sql, $params);
 $pdf->SetAutoPageBreak(true, 20);
 $pdf->AddPage('L', 'Legal');
 while ($row = DBGetQuery($stmt, 1, false)) {
     $pdf->SetX(5);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFontAlignGeneral();
     $Newrow = array_values($row);
     $pdf->Row($Newrow);
     $pdf->LineaSepara();
 }
 unset($_SESSION['ReportesSiniestros']["ReporteSeguimientodeIncapacidad"]);
 // enviamos cabezales http para no tener problemas
 //header('Content-Type: text/html; charset=UTF-8');
 //header('Cache-Control: maxage=3600');
 /*
 	header('Content-Type: text/html; charset=iso-8859-1');
 	header("Content-Transfer-Encoding", "binary");
 	header('Cache-Control: private, max-age=0, must-revalidate');
 	header('Pragma: public');