コード例 #1
0
 public function generarReporte($atributosReceta, $labelCabecera, $labelDetalle, $labelPie, $datosCabecera, $datosDetalle, $datosExamen, $datosExamenUni, $datosGrupo, $datosPie, $modo, $nombreReceta, $parametros)
 {
     $lblCabecera = array();
     $lblDetalle = array();
     $lblPie = array();
     $styleCL = array();
     $styleCD = array();
     $styleDL = array();
     $styleDD = array();
     $stylePL = array();
     $stylePD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosReceta);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     $o_classGeneral->setLabelDetalle($labelDetalle, $atributosReceta);
     $styleDL = $o_classGeneral->getStyleDL();
     $styleDD = $o_classGeneral->getStyleDD();
     $lblDetalle = $o_classGeneral->getLblDetalle();
     $o_classGeneral->setLabelPie($labelPie, $atributosReceta);
     $stylePL = $o_classGeneral->getStylePL();
     $stylePD = $o_classGeneral->getStylePD();
     $lblPie = $o_classGeneral->getLblPie();
     $pdf = new MYPDF($parametros["PDF_PAGE_ORIENTATION"], PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Juan Carlos Ludeña Montesinos');
     $pdf->SetTitle('Generardor de Reportes');
     $pdf->SetSubject('Generardor de Reportes');
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->SetFont('helvetica', '', 6);
     $pdf->AddPage();
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $pdf->write1DBarcode($parametros["CODIGO_DE_BARRAS"], 'C39', 75, 278, 70, 8, 0.4, $style, 'N');
     $pdf->CargarDatos($lblCabecera, $lblDetalle, $lblPie, $datosCabecera, $datosDetalle, $datosExamen, $datosExamenUni, $datosGrupo, $datosPie, $styleCL, $styleDL, $stylePL, $styleCD, $styleDD, $stylePD, $modo);
     $pdf->lastPage();
     $pdf->Output($nombreReceta, 'I');
 }
コード例 #2
0
 function generarMYPDF_RME_ORDEN_MEDICA($atributosReceta, $labelCabecera, $labelPie, $datosCabecera, $datosDetalle, $datosPie, $modo, $nombreReporte, $parametros)
 {
     // create new PDF document
     $pdf = new TCPDF($parametros["PDF_PAGE_ORIENTATION"], PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('HMLO');
     $pdf->SetTitle('OrdenMedica');
     $pdf->SetSubject('HMLO');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     //        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 048', PDF_HEADER_STRING);
     // remove default header/footer
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     //set auto page breaks
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //        $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
     //$pdf->Cell(10, 5, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
     $pdf->write1DBarcode($parametros["CODIGO_DE_BARRAS"], 'C39', 68, 137, 70, 8, 0.4, $style, 'N');
     //        $pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
     $pdf->SetFont('helvetica', '', 8);
     //======================================================================================================
     $sizeDatos = 6;
     $sizeTitulo = 8;
     $sizeSubtitulo = 6;
     $family = "helvetica";
     $styleNormal = "N";
     $styleNegrita = "B";
     /* =======================================        Obs       ============================================ */
     // width->0, height->1, top->2, left->3, color->4 TipoLetra=>5 EstiloLetra=>6 TamañoLetra=>6
     /* ===================================================================================================== */
     $lblCabecera = array();
     //        $lblDetalle=array();
     $lblPie = array();
     $styleCL = array();
     $styleCD = array();
     //        $styleDL=array();
     //        $styleDD=array();
     $stylePL = array();
     $stylePD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosReceta);
     $o_classGeneral->setLabelPie($labelPie, $atributosReceta);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $stylePL = $o_classGeneral->getStylePL();
     $stylePD = $o_classGeneral->getStylePD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     $lblPie = $o_classGeneral->getLblPie();
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================   Cabecera   =================================================== */
     if (is_array($lblCabecera) && !empty($lblCabecera) && $modo == 1) {
         foreach ($lblCabecera as $i => $value) {
             $isImg = end(explode(".", $value));
             if ($isImg == "jpg" || $isImg == "png" || $isImg == "gif") {
                 $filename = '../../../tcPDF/tcpdf/tcpdf/images/' . $lblCabecera[$i];
                 if (file_exists($filename)) {
                     $pdf->Image($filename, $styleCL[$i][3], $styleCL[$i][2], $styleCL[$i][0], $styleCL[$i][1], '', '', '', false, 300);
                 }
             } else {
                 $color = $styleCL[$i][4];
                 $pdf->SetTextColor($color[0], $color[1], $color[2]);
                 $pdf->SetFont($styleCL[$i][5], $styleCL[$i][6], $styleCL[$i][7]);
                 $pdf->MultiCell($styleCL[$i][0], $styleCL[$i][1], $lblCabecera[$i], 0, 'L', 0, 1, $styleCL[$i][3], $styleCL[$i][2], true);
             }
         }
     }
     if (is_array($datosCabecera) && !empty($datosCabecera)) {
         $indice = array_keys($datosCabecera);
         foreach ($indice as $val => $z) {
             $color = $styleCD[$z][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($styleCD[$z][5], $styleCD[$z][6], $styleCD[$z][7]);
             $pdf->MultiCell($styleCD[$z][0], $styleCD[$z][1], $datosCabecera[$z], 0, 'L', 0, 1, $styleCD[$z][3], $styleCD[$z][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================   Fin Cabecera   ============================================== */
     /* ===============================    espacio despues de la cabecera    ================================ */
     $pdf->writeHTML("<br>", true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================     Antecedentes     ========================================== */
     $cadenaAntecedentes = $RP . '<table width="700" border="1" cellpadding="3" cellspacing="0" bgcolor="#ffffff">
                             <tr>
                                 <td width="35" align="center"><strong><br>NRO</strong></td>
                                 <td align="center" width="250">
                                 <strong>PROCEDIMIENTOS</strong><br/>
                                  <strong>Y/O</strong><br/>
                                 <strong>INTERCONSULTAS</strong></td>
                                 <td align="center" width="160"><strong><br>SERVICIO</strong></td>
                                 <td  align="center" width="270"><strong><br>INDICACIONES</strong></td>
                                 </tr>
                                 <tr>
                                
                               </tr>';
     $orden = 0;
     foreach ($datosDetalle as $key => $value) {
         $orden++;
         $cadenaAntecedentes .= '<tr>
                                 <td><font size="6"><strong>' . $orden . '.</strong></font></td>
                                 <td><font size="6">' . utf8_encode($value[0]) . '</font></td>
                                 <td><font size="6">' . utf8_encode($value[4][0][0]) . '</font></td>
                               
                                 <td><font size="6">' . utf8_encode($value[3]) . '</font></td>
                               </tr>';
     }
     $cadenaAntecedentes .= '</table>';
     $cadenaAntecedentes .= '<table border="0" cellspacing="3" cellpadding="0"><tr><td width="685">Utilizado hasta el regl&oacute;n ....................... Inclusive </td></tr></table>';
     //echo $cadenaAntecedentes;
     $pdf->SetFont($family, $styleNormal, $sizeTitulo);
     $pdf->writeHTML($cadenaAntecedentes, true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================     Pie     =================================================== */
     if (is_array($lblPie) && !empty($lblPie) && $modo == 1) {
         foreach ($lblPie as $i => $value) {
             $color = $stylePL[$i][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($stylePL[$i][5], $stylePL[$i][6], $stylePL[$i][7]);
             $pdf->MultiCell($stylePL[$i][0], $stylePL[$i][1], $lblPie[$i], 0, 'L', 0, 1, $stylePL[$i][3], $stylePL[$i][2], true);
         }
     }
     if (is_array($datosPie) && !empty($datosPie)) {
         foreach ($datosPie as $i => $value) {
             $color = $stylePD[$i][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($stylePD[$i][5], $stylePD[$i][6], $stylePD[$i][7]);
             $pdf->MultiCell($stylePD[$i][0], $stylePD[$i][1], $datosPie[$i], 0, 'L', 0, 1, $stylePD[$i][3], $stylePD[$i][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================    Fin Pie    ================================================= */
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($nombreReporte, 'I');
     //============================================================+
     // END OF FILE
     //============================================================+
 }
コード例 #3
0
 function generarMYPDF_HC_Completo($atributosHC, $labelCabecera, $datosCabecera, $datosPie, $antecedentes, $arrayHC, $modo, $nombreReporte, $parametros)
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 048');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 048', PDF_HEADER_STRING);
     // remove default header/footer
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     //set auto page breaks
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //        $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     //        $pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
     $pdf->SetFont('helvetica', '', 8);
     //======================================================================================================
     $sizeDatos = 6;
     $sizeTitulo = 9;
     $sizeSubtitulo = 6;
     $family = "helvetica";
     $styleNormal = "N";
     $styleNegrita = "B";
     /* =======================================        Obs       ============================================ */
     // width->0, height->1, top->2, left->3, color->4 TipoLetra=>5 EstiloLetra=>6 TamañoLetra=>6
     /* ===================================================================================================== */
     $lblCabecera = array();
     //        $lblDetalle=array();
     //        $lblPie=array();
     $styleCL = array();
     $styleCD = array();
     //        $styleDL=array();
     //        $styleDD=array();
     //        $stylePL=array();
     //        $stylePD=array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosHC);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================   Cabecera   =================================================== */
     if ($modo == 1) {
         foreach ($lblCabecera as $i => $value) {
             $isImg = substr($lblCabecera[$i], -4);
             if ($isImg == ".jpg" || $isImg == ".png" || $isImg == ".gif") {
                 $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/' . $lblCabecera[$i], $styleCL[$i][3], $styleCL[$i][2], $styleCL[$i][0], $styleCL[$i][1], '', '', '', false, 300);
             } else {
                 $color = $styleCL[$i][4];
                 $pdf->SetTextColor($color[0], $color[1], $color[2]);
                 $pdf->SetFont($styleCL[$i][5], $styleCL[$i][6], $styleCL[$i][7]);
                 $pdf->MultiCell($styleCL[$i][0], $styleCL[$i][1], $lblCabecera[$i], 0, 'L', 0, 1, $styleCL[$i][3], $styleCL[$i][2], true);
             }
         }
     }
     $indice = array_keys($datosCabecera);
     foreach ($indice as $val => $z) {
         $isImgx = substr($datosCabecera[$z], -4);
         if ($isImgx == ".jpg" || $isImgx == ".png" || $isImgx == ".gif") {
             $pdf->Image($datosCabecera[$z], $styleCD[$i][3], $styleCD[$i][2], $styleCD[$i][0], $styleCD[$i][1], '', '', '', false, 300);
         } else {
             $color = $styleCD[$z][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($styleCD[$z][5], $styleCD[$z][6], $styleCD[$z][7]);
             $pdf->MultiCell($styleCD[$z][0], $styleCD[$z][1], $datosCabecera[$z], 0, 'L', 0, 1, $styleCD[$z][3], $styleCD[$z][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================   Fin Cabecera   ============================================== */
     //-------------------------- espacio despues de la cabecera --------------------
     $pdf->writeHTML("<br>", true, false, false, false, '');
     // -----------------------------------------------------------------------------
     /* ===================================================================================================== */
     /* =====================================     Antecedentes     ========================================== */
     $cadenaAntecedentes = "";
     if ($antecedentes) {
         $fechaAnterior = "";
         $numAntecedente = 0;
         foreach ($antecedentes as $i => $value) {
             $numAntecedente++;
             if ($antecedentes[$i][5] == 1) {
                 $vive = "Si";
             } else {
                 if ($antecedentes[$i][5] == 0) {
                     $vive = "No";
                 }
             }
             $cadenaAntecedentes .= '<table width="700" border="0" cellspacing="1">
                                   <tr>
                                     <td width="40"><strong>' . $numAntecedente . '.</strong></td>
                                     <td width="210"><strong>Parentesco : </strong>' . $antecedentes[$i][7] . '</td>
                                     <td width="80"><strong>Vive : </strong>' . $vive . '</td>
                                     <td width="370"><strong>Sintoma : </strong>' . $antecedentes[$i][2] . ' - ' . $antecedentes[$i][3] . '</td>
                                   </tr>
                                   <tr><td>&nbsp;</td><td colspan="3"><strong>Descripci&oacute;n : </strong>' . utf8_decode($antecedentes[$i][4]) . '</td></tr>
                                 </table>';
         }
     } else {
         $cadenaAntecedentes .= '<table width="700" border="0" cellspacing="1"><tr><td align="center"><strong>No existe registro de antecedentes</strong></td></tr></table>';
     }
     $pdf->SetFont($family, $styleNegrita, $sizeTitulo);
     $pdf->Write(0, 'ANTECEDENTES', '', 0, 'L', true, 0, false, false, 0);
     $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', '', '', 190, 1);
     $pdf->writeHTML('<br>', true, false, false, false, '');
     $pdf->SetFont($family, $styleNormal, $sizeDatos);
     $pdf->writeHTML($cadenaAntecedentes, true, false, false, false, '');
     $pdf->writeHTML('<br>', true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================           HC            ======================================= */
     $datosmedico = "";
     foreach ($arrayHC as $i => $value) {
         //----------------------------
         $imprimeMotCon = false;
         $imprimeTriaje = false;
         $imprimeExaMed = false;
         $imprimeDiagnostico = false;
         $imprimeTratamientos = false;
         //----------------------------
         $medicamentoso = null;
         $practicaMedica = null;
         $motivoConsulta = $arrayHC[$i][0];
         $triaje = $arrayHC[$i][1];
         $examenesMedicos = $arrayHC[$i][2];
         $diagnosticos = $arrayHC[$i][3];
         $tratamientos = $arrayHC[$i][4];
         if ($tratamientos != null) {
             $medicamentoso = $tratamientos[0][0];
             $practicaMedica = $tratamientos[0][1];
         }
         $datosMed = $arrayHC[$i][5];
         $fechaAtencion = $arrayHC[$i][6];
         $instalacion = $datosMed[0][8] . " - " . $datosMed[0][7] . " - " . $datosMed[0][6];
         $medico = $datosMed[0][2] . " " . $datosMed[0][3] . " " . $datosMed[0][4];
         $datosmedico = '<table width="700" border="0" cellspacing="1"><tr><td width="100">' . $fechaAtencion . '</td> <td width="300">' . $instalacion . '</td><td width="300">' . $medico . '</td></tr></table>';
         //================================================================================
         //==================================  Motivo Consulta  ===========================
         //================================================================================
         $numMotConsulta = 0;
         $cadenaMotCon = "";
         if ($motivoConsulta != null) {
             foreach ($motivoConsulta as $x => $valuex) {
                 $numMotConsulta++;
                 $cadenaMotCon .= '<table width="660" border="0"><tr><td><table width="650" border="0" cellspacing="3">
                                   <tr><td width="15"><strong>' . $numMotConsulta . '.</strong></td><td width="55"><strong>Sintoma :</strong></td><td width="580">' . $motivoConsulta[$x][2] . ' - ' . $motivoConsulta[$x][3] . '</td> </tr>
                                   <tr><td></td><td><strong>Descripci&oacute;n :</strong></td><td>' . $motivoConsulta[$x][4] . '</td></tr>
                                 </table></td></tr></table><br>';
             }
             $imprimeMotCon = true;
         }
         //===================================   fin   ====================================
         //================================================================================
         //================================================================================
         //==================================      Triaje       ===========================
         //================================================================================
         $cadenaTriaje = "";
         if ($triaje != null) {
             $cadenaTriaje .= '<table width="660" border="0" cellspacing="3"><tr><td width="150"></td><td width="355">
                               <table width="300" border="0" cellspacing="3">
                               <tr>
                                 <td width="175"><strong>Peso (Kg.) : </strong>' . $triaje[0]["nPeso"] . '</td>
                                 <td width="175"><strong>Talla (m.) : </strong>' . $triaje[0]["nTalla"] . '</td>
                               </tr>
                               <tr>
                                 <td><strong>Temp. (ºC) : </strong>' . $triaje[0]["nTemperatura"] . '</td>
                                 <td><strong>Frec. Cardiaca (min) : </strong>' . $triaje[0]["iFrecuenciaCardiaca"] . '</td>
                               </tr>
                               <tr>
                                 <td><strong>Pres. Arterial (mmHg) : </strong>' . $triaje[0]["vPresionArterial"] . '</td>
                                 <td><strong>Frec. Respiratoria (min) : </strong>' . $triaje[0]["iFrecuenciaRespiratoria"] . '</td>
                               </tr>
                               <tr>
                               <td><strong>Sat. O2(%) : </strong>' . $triaje[0]["nSaturacionOxigeno"] . '</td><td></td>
                               </tr>
                             </table>
                             </td><td width="150"></td></tr></table>';
             $imprimeTriaje = true;
         }
         //===================================   fin   ====================================
         //================================================================================
         //================================================================================
         //==================================      Examenes      ===========================
         //================================================================================
         $cadenaExamenes = "";
         if ($examenesMedicos != null) {
             foreach ($examenesMedicos as $filaExamen) {
                 $pruebasExamenes = $filaExamen[0];
                 //$filaExamen[0]=$datosExamenes
                 //                    echo $idPrueba.'<br>';
                 //--------------------------------------------------------------------------------------
                 if ($pruebasExamenes != null) {
                     $idPruebaAux = "";
                     $numero = count($pruebasExamenes);
                     $m = 0;
                     $cadenaExamenesAux = "";
                     foreach ($pruebasExamenes as $fila) {
                         $m++;
                         $idPrueba = $fila[1];
                         //                            echo $idPrueba.'<br>';
                         $nombreCampo = $fila[4];
                         $iiDCombo = $fila[8];
                         if (!($idPrueba == $idPruebaAux)) {
                             $nombrePrueba = $fila[2];
                             if ($m == 1) {
                                 $cadenaExamenesAux .= '<table width="660" border="1" cellpadding="3" cellspacing="0" ><tr><td height="20" bgcolor="#F8F8F8" align="center"><strong>' . utf8_encode($nombrePrueba) . '</strong></td></tr><tr><td>';
                             }
                         }
                         $iIdTipoDato = $fila[5];
                         switch ($iIdTipoDato) {
                             case 1:
                                 //integer
                                 if ($fila[9] != "") {
                                     //                                            $cadenaExamenesAux.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                     //                                                    <tr><td width="150"><strong>' . utf8_encode($nombreCampo) . ':</strong></td>
                                     //                                                    <td width="500">' . $fila[9] . '</td></tr>
                                     //                                                    </table>';
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[9] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 2:
                                 //varchar
                                 if ($fila[10] != "") {
                                     //                                            $cadenaExamenesAux.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                     //                                                    <tr><td width="150"><strong>' . utf8_encode($nombreCampo) . ':</strong></td>
                                     //                                                    <td width="500">' . $fila[10] . '</td></tr>
                                     //                                                    </table>';
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[10] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 3:
                                 //datetime
                                 if ($fila[11] != "") {
                                     //                                            $cadenaExamenesAux.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                     //                                                    <tr><td width="150"><strong>' . utf8_encode($nombreCampo) . ':</strong></td>
                                     //                                                    <td width="500">' . $fila[11] . '</td></tr>
                                     //                                                    </table>';
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[11] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 4:
                                 //decimal
                                 if ($fila[12] != "") {
                                     //                                            $cadenaExamenesAux.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                     //                                                    <tr><td width="150"><strong>' . utf8_encode($nombreCampo) . ':</strong></td>
                                     //                                                    <td width="500">' . $fila[12] . '</td></tr>
                                     //                                                    </table>';
                                     $cadenaExamenesAux .= ' <strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[12] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 5:
                                 //bolean
                                 if ($fila[13] == 1 || $fila[13] == 0) {
                                     //                                            $cadenaExamenesAux.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                     //                                                    <tr><td width="150"><strong>' . utf8_encode($nombreCampo) . '</strong></td>
                                     //                                                    <td width="500">';
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>';
                                     if ($fila[13] == '1') {
                                         $cadenaExamenesAux .= "si";
                                     } else {
                                         if ($fila[13] == '0') {
                                             $cadenaExamenesAux .= "no";
                                         } else {
                                             $cadenaExamenesAux .= "null";
                                         }
                                     }
                                     $cadenaExamenesAux .= '&nbsp;&nbsp;&nbsp;&nbsp;';
                                     //                                            $cadenaExamenesAux.='</td></tr></table>';
                                 }
                                 break;
                             case 6:
                                 //combo
                                 require_once "../../clogica/LActoMedico.php";
                                 $_LActo = new LActoMedico();
                                 $iCombo = $fila[14];
                                 if ($iCombo != "") {
                                     $valorCombo = $_LActo->valorComboExamen($iCombo);
                                     $cadenaAuxCombo = "";
                                     if ($valorCombo) {
                                         foreach ($valorCombo as $v => $valorCbo) {
                                             if ($valorCbo[0] != "") {
                                                 //                                                    $cadenaAuxCombo.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                                 //                                                    <tr><td width="150"><strong>' . utf8_encode($nombreCampo) . ':</strong></td>
                                                 //                                                    <td width="500">' . $valorCbo[0] . '</td></tr>
                                                 //                                                    </table>';
                                                 $cadenaAuxCombo .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $valorCbo[0] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                             }
                                         }
                                         $cadenaExamenesAux .= $cadenaAuxCombo;
                                     }
                                 }
                                 break;
                             case 7:
                                 //texto
                                 if ($fila[15] != "") {
                                     //                                        $cadenaExamenesAux.='<table width="650" border="0" cellpadding="3" cellspacing="0">
                                     //                                                    <tr><td width="100"><strong>' . utf8_encode($nombreCampo) . ':</strong></td>
                                     //                                                    <td width="550">' . utf8_encode($fila[15]) . '</td></tr>
                                     //                                                    </table>';
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . utf8_encode($fila[15]) . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                         }
                         if ($m == $numero) {
                             $cadenaExamenesAux .= '</td></tr></table>';
                         }
                         $idPruebaAux = $fila[1];
                     }
                     $cadenaExamenes .= $cadenaExamenesAux;
                     //--------------------------------------------------------------------------------------
                 }
             }
             $imprimeExaMed = true;
         }
         //===================================   fin   ====================================
         //================================================================================
         //================================================================================
         //==================================    Diagnóstico    ===========================
         //================================================================================
         $numDiagnostico = 0;
         $cadenaDiagnostico = "";
         if ($diagnosticos != null) {
             //660
             $cadenaDiagnostico .= '<table width="660" border="1" cellpadding="3" cellspacing="0">
                    <tr><td height="20" width="100" bgcolor="#F8F8F8"><strong>C&oacute;digo Cie</strong></td><td width="400" bgcolor="#F8F8F8" align="center"><strong>Descripci&oacute;n</strong></td><td width="160" bgcolor="#F8F8F8" align="center"><strong>Tipo Diagn&oacute;stico</strong></td></tr>';
             foreach ($diagnosticos as $x => $valuex) {
                 $cadenaDiagnostico .= '<tr><td>' . utf8_encode($diagnosticos[$x][1]) . '</td><td>' . utf8_encode($diagnosticos[$x][2]) . '</td><td>' . utf8_encode($diagnosticos[$x][6]) . '</td></tr>';
             }
             $cadenaDiagnostico .= '<tr><td colspan="3">
                                   <table width="650" border="0">
                                   <tr>
                                   <td width="60"><strong>Observaci&oacute;n :</strong></td>
                                   <td width="590">' . utf8_encode($diagnosticos[0][5]) . '</td>
                                   </tr>
                                   </table></td></tr>';
             $cadenaDiagnostico .= '</table>';
             $imprimeDiagnostico = true;
         }
         //===================================   fin   ====================================
         //================================================================================
         //=============================================================================
         //==================================    Tratamientos    ==========================
         //================================================================================
         $numMedicamentoso = 0;
         $cadenaTratamientos = '';
         $cadenaMedicamentoso = '';
         if ($medicamentoso != null) {
             $cadenaMedicamentoso .= '<table width="660" border="1" cellpadding="0" cellspacing="0"><tr><td>
                                     <table width="660" cellpadding="3" cellspacing="0"><tr><td height="20" bgcolor="#F8F8F8" align="center">
                                     <strong>Receta médica</strong></td></tr></table></td></tr><tr><td>';
             $cadenaMedicamentoso .= '<table width="660" border="1" cellpadding="3" cellspacing="0">
                                    <tr>
                                         <td width="25" bgcolor="#F8F8F8" align="center"><strong> Nro. </strong></td>
                                         <td width="205"  bgcolor="#F8F8F8" align="center"><strong>Nombre </strong></td>
                                         <td width="100" bgcolor="#F8F8F8" align="center"><strong>Presentaci&oacute;n </strong></td>
                                         <td width="70" bgcolor="#F8F8F8" align="center"><strong>Cantidad </strong></td>
                                         <td width="260" bgcolor="#F8F8F8" align="center"><strong>Observaci&oacute;n </strong></td>
                                    </tr>';
             foreach ($medicamentoso as $x => $valuex) {
                 $numMedicamentoso++;
                 $cadenaMedicamentoso .= '<tr>
                                         <td><strong>' . $numMedicamentoso . '.</strong></td>
                                         <td>' . utf8_encode($medicamentoso[$x][2]) . '</td>
                                         <td>' . utf8_encode($medicamentoso[$x][5]) . '</td>
                                         <td align="center">' . utf8_encode($medicamentoso[$x][3]) . '</td>
                                         <td>' . utf8_encode($medicamentoso[$x][4]) . '</td>
                                       </tr>';
             }
             $cadenaMedicamentoso .= '</table>';
             $cadenaMedicamentoso .= '</td></tr></table>';
             $imprimeTratamientos = true;
         }
         $numPracticaMedica = 0;
         $cadenaPracticaMedica = '';
         if ($practicaMedica != null) {
             $cadenaPracticaMedica .= '<table width="660" border="1" cellpadding="0" cellspacing="0"><tr><td>
              <table width="660" cellpadding="3" cellspacing="0"><tr><td height="20" bgcolor="#F8F8F8" align="center">
              <strong>Procedimientos médicos</strong></td></tr></table></td></tr><tr><td>';
             $cadenaPracticaMedica .= '<table width="660" border="1" cellpadding="3" cellspacing="0">
                                     <tr>
                                         <td width="25" bgcolor="#F8F8F8" align="center"><strong> Nro. </strong></td>
                                         <td width="205" bgcolor="#F8F8F8" align="center"><strong>Nombre </strong></td>
                                         <td width="80"bgcolor="#F8F8F8" align="center"><strong>Codigo Seg </strong></td>
                                         <td width="350" bgcolor="#F8F8F8" align="center"><strong>Observaci&oacute;n </strong></td>
                                     </tr>';
             foreach ($practicaMedica as $x => $valuex) {
                 $numPracticaMedica++;
                 //                    $cadenaPracticaMedica.='<table width="660" border="0" cellpadding="0" cellspacing="0"><tr><td>';
                 //                    $cadenaPracticaMedica.='<table width="660" border="0" cellpadding="0" cellspacing="3">
                 $cadenaPracticaMedica .= '<tr>
                                             <td><strong>' . $numPracticaMedica . '.</strong></td>
                                             <td>' . utf8_encode($practicaMedica[$x][2]) . '</td>
                                             <td>' . utf8_encode($practicaMedica[$x][5]) . '</td>
                                             <td>' . utf8_encode($practicaMedica[$x][3]) . '</td>
                                           </tr>';
                 //                                        </table>';
                 //                    $cadenaPracticaMedica.='</td></tr></table>';
             }
             $cadenaPracticaMedica .= '</table>';
             $cadenaPracticaMedica .= '</td></tr></table>';
             $imprimeTratamientos = true;
         }
         if ($cadenaMedicamentoso != '' || $cadenaPracticaMedica != '') {
             $cadenaTratamientos .= $cadenaMedicamentoso . '<br><br>' . $cadenaPracticaMedica;
         } else {
             if ($cadenaMedicamentoso != '') {
                 $cadenaTratamientos .= $cadenaPracticaMedica;
             } else {
                 if ($cadenaPracticaMedica != '') {
                     $cadenaTratamientos .= $cadenaMedicamentoso;
                 }
             }
         }
         //===================================   fin   ====================================
         //================================================================================
         //--------------------------------------------------------------------------------
         $pdf->SetFont($family, $styleNegrita, $sizeTitulo);
         $pdf->writeHTML($datosmedico, false, false, false, false, '');
         $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', '', '', 190, 1);
         $pdf->writeHTML('<br>', true, false, false, false, '');
         //--------------------------------------------------------------------------------
         if ($imprimeMotCon) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'MOTIVO DE CONSULTA', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 25, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaMotCon, true, false, false, false, '');
             //            $pdf->writeHTML('<br>', true, false, false, false, '');
         }
         //--------------------------------------------------------------------------------
         if ($imprimeTriaje) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'TRIAJE', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 8, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaTriaje, true, false, false, false, '');
             //            $pdf->writeHTML('<br>', true, false, false, false, '');
         }
         //--------------------------------------------------------------------------------
         if ($imprimeExaMed) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'EXAMENES MEDICOS', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 23, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaExamenes, true, false, false, false, '');
             //            $pdf->writeHTML('<br>', true, false, false, false, '');
         }
         //--------------------------------------------------------------------------------
         if ($imprimeDiagnostico) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'DIAGNOSTICO', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 16, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaDiagnostico, true, false, false, false, '');
             //            $pdf->writeHTML('<br>', true, false, false, false, '');
         }
         //--------------------------------------------------------------------------------
         if ($imprimeTratamientos) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'TRATAMIENTOS', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 18, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaTratamientos, true, false, false, false, '');
             //            $pdf->writeHTML('<br>', true, false, false, false, '');
         }
     }
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($nombreReporte, 'I');
     //============================================================+
     // END OF FILE
     //============================================================+
 }
コード例 #4
0
 function generarMYPDF_HC_Completo($atributosHC, $labelCabecera, $datosCabecera, $datosPie, $antecedentes, $arrayHC, $modo, $dia, $parametros, $listaAtenciones)
 {
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', TRUE);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 023');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
         require_once dirname(__FILE__) . '/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     $pdf->AddPage();
     $pdf->SetFont('helvetica', '', 8);
     $sizeDatos = 6;
     $sizeTitulo = 9;
     $sizeSubtitulo = 6;
     $family = "helvetica";
     $styleNormal = "N";
     $styleNegrita = "B";
     $lblCabecera = array();
     $styleCL = array();
     $styleCD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosHC);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     require_once "../../clogica/LActoMedico.php";
     $_LActo = new LActoMedico();
     $cabecera = '
          <table border="0" width="1000">
                 <tr>
                 <td width="100"><img src="../../../imagen/logo/HMLO.jpg" width="90"></td>
                     <td>
                             <table border="0">
                                 <tr>
                                     <td>
                                         <table  border="0"  height="30">
                                             <tr>
                                                 <td align="center"><font size="16">HOSPITAL MUNICIPAL LOS OLIVOS</font></td>
                                                 </tr>
                                              <tr>
                                                 <td align="center"><font size="16">H.C. PREVENTIVAS DEL ' . $dia . '</font></td>
                                             </tr>
                                         </table>
                                     </td>
                                 </tr>
                             </table>
                     </td>
                 </tr>
             </table>
     ';
     $pdf->SetFont($family, $styleNegrita, $sizeTitulo);
     $pdf->writeHTML('<br>', true, false, false, false, '');
     $pdf->writeHTML($cabecera, false, false, false, false, '');
     $pdf->writeHTML('<br>', true, false, false, false, '');
     $pdf->writeHTML('<br>', true, false, false, false, '');
     $datosmedico = "";
     $x = 0;
     foreach ($arrayHC as $i => $value) {
         // echo $x."---". $listaAtenciones[$x][0]."<br>";
         //
         $valorDatosPaciente = $_LActo->datospaciente($listaAtenciones[$x][0]);
         $datosPaciente = '';
         foreach ($valorDatosPaciente as $keyPaciente => $valuePaciente) {
             $datosPaciente .= '
              <table>
                 <tr>
                     <td>
                             <table border="0">
                                 <tr>
                                     <td>
                                          <table  border="0"  height="30">
                                             <tr>
                                                 <td width="75"><strong>Numero H.C.:</strong></td>
                                                 <td width="200">' . utf8_encode($valuePaciente[0]) . ' </td>
                                                 <td width="90"><strong>Edad: </strong></td>
                                                 <td width="75">' . utf8_encode($valuePaciente[6] . '') . 'años</td>
                                             </tr>
                                         </table>
                                     </td>
                                 </tr>
                             </table>
                             <table border="0">
                                 <tr>
                                     <td>
                                          <table  border="0"  height="30">
                                             <tr>
                                                 <td width="75"><strong> Paciente:</strong></td>
                                                 <td width="200">' . utf8_encode($valuePaciente[1]) . ' </td>
                                                 <td width="90"> <strong>Sexo:</strong></td>
                                                 <td width="75">' . utf8_encode($valuePaciente[2]) . ' </td>  
                                                 <td width="90"> <strong>Fecha Nac.:</strong></td>
                                                 <td width="75">' . utf8_encode($valuePaciente[3]) . ' </td>  
                                             </tr>
                                         </table>
                                     </td>
                                 </tr>
                             </table>
                             <table border="0">
                                 <tr>
                                     <td>
                                          <table  border="0"  height="30">
                                             <tr>
                                                 <td width="75"><strong>DNI:</strong></td>
                                                 <td width="200">' . utf8_encode($valuePaciente[4]) . ' </td>
                                                 <td width="90"> <strong>Direccion:</strong> </td>
                                                 <td width="350">' . utf8_encode($valuePaciente[5]) . ' </td>  
                                             </tr>
                                         </table>
                                     </td>
                                 </tr>
                             </table>
                     </td>
                 </tr>
             </table>
         ';
         }
         $imprimeMotCon = false;
         $imprimeTriaje = false;
         $imprimeExaMed = false;
         $imprimeDiagnostico = false;
         $imprimeTratamientos = false;
         $medicamentoso = null;
         $practicaMedica = null;
         $motivoConsulta = $arrayHC[$i][0];
         $triaje = $arrayHC[$i][1];
         $examenesMedicos = $arrayHC[$i][2];
         $diagnosticos = $arrayHC[$i][3];
         $tratamientos = $arrayHC[$i][4];
         if ($tratamientos != null) {
             $medicamentoso = $tratamientos[0][0];
             $practicaMedica = $tratamientos[0][1];
         }
         $datosMed = $arrayHC[$i][5];
         $fechaAtencion = $arrayHC[$i][6];
         $instalacion = $datosMed[0][8] . " - " . $datosMed[0][7] . " - " . $datosMed[0][6];
         $medico = $datosMed[0][2] . " " . $datosMed[0][3] . " " . $datosMed[0][4];
         $datosmedico = '
             <table width="700" border="0" cellspacing="1">
                     <tr>
                         <td width="300"><strong>Ambiente: </strong>' . $instalacion . '</td>
                         <td width="370"><strong>Medico: </strong>' . $medico . '</td>
                     </tr>
                     <tr>
                         <td width="300"><strong>Fecha Atencion: </strong>' . $fechaAtencion . '</td>
                     </tr>
             </table>';
         //===================================   fin   ====================================
         //================================================================================
         //==================================      Examenes      ===========================
         //================================================================================
         $cadenaExamenes = "";
         if ($examenesMedicos != null) {
             foreach ($examenesMedicos as $filaExamen) {
                 $pruebasExamenes = $filaExamen[0];
                 if ($pruebasExamenes != null) {
                     $idPruebaAux = "";
                     $numero = count($pruebasExamenes);
                     $m = 0;
                     $cadenaExamenesAux = "";
                     foreach ($pruebasExamenes as $fila) {
                         $m++;
                         $idPrueba = $fila[1];
                         //                            echo $idPrueba.'<br>';
                         $nombreCampo = $fila[4];
                         $iiDCombo = $fila[8];
                         if (!($idPrueba == $idPruebaAux)) {
                             $nombrePrueba = $fila[2];
                             if ($m == 1) {
                                 $cadenaExamenesAux .= '<table width="660" border="1" cellpadding="3" cellspacing="0" ><tr><td height="20" bgcolor="#F8F8F8" align="center"><strong>' . utf8_encode($nombrePrueba) . '</strong></td></tr><tr><td>';
                             }
                         }
                         $iIdTipoDato = $fila[5];
                         switch ($iIdTipoDato) {
                             case 1:
                                 //integer
                                 if ($fila[9] != "") {
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[9] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 2:
                                 //varchar
                                 if ($fila[10] != "") {
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[10] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 3:
                                 //datetime
                                 if ($fila[11] != "") {
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[11] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 4:
                                 //decimal
                                 if ($fila[12] != "") {
                                     $cadenaExamenesAux .= ' <strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $fila[12] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 5:
                                 //bolean
                                 if ($fila[13] == 1 || $fila[13] == 0) {
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>';
                                     if ($fila[13] == '1') {
                                         $cadenaExamenesAux .= "si";
                                     } else {
                                         if ($fila[13] == '0') {
                                             $cadenaExamenesAux .= "no";
                                         } else {
                                             $cadenaExamenesAux .= "null";
                                         }
                                     }
                                     $cadenaExamenesAux .= '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                             case 6:
                                 //combo
                                 require_once "../../clogica/LActoMedico.php";
                                 $_LActo = new LActoMedico();
                                 $iCombo = $fila[14];
                                 if ($iCombo != "") {
                                     $valorCombo = $_LActo->valorComboExamen($iCombo);
                                     $cadenaAuxCombo = "";
                                     if ($valorCombo) {
                                         foreach ($valorCombo as $v => $valorCbo) {
                                             if ($valorCbo[0] != "") {
                                                 $cadenaAuxCombo .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . $valorCbo[0] . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                             }
                                         }
                                         $cadenaExamenesAux .= $cadenaAuxCombo;
                                     }
                                 }
                                 break;
                             case 7:
                                 //texto
                                 if ($fila[15] != "") {
                                     $cadenaExamenesAux .= '<strong>' . utf8_encode($nombreCampo) . ' : </strong>' . utf8_encode(nl2br($fila[15])) . '&nbsp;&nbsp;&nbsp;&nbsp;';
                                 }
                                 break;
                         }
                         if ($m == $numero) {
                             $resultadoGrupoetareo = $_LActo->grupoEtareoPersona($listaAtenciones[$x][0]);
                             foreach ($resultadoGrupoetareo as $keyResulEtareo => $valueResulEtareo) {
                                 $cadenaExamenesAux .= '<br><br>Se solicita paquete preventivo segunel grupo etareo ' . utf8_encode($valueResulEtareo[0]);
                             }
                             $cadenaExamenesAux .= '</td></tr></table>';
                         }
                         $idPruebaAux = $fila[1];
                     }
                     $cadenaExamenes .= $cadenaExamenesAux;
                 }
             }
             $imprimeExaMed = true;
         }
         //===================================   fin   ====================================
         //================================================================================
         //================================================================================
         //==================================    Diagnóstico    ===========================
         //================================================================================
         $numDiagnostico = 0;
         $cadenaDiagnostico = "";
         if ($diagnosticos != null) {
             //660
             $cadenaDiagnostico .= '<table width="660" border="1" cellpadding="3" cellspacing="0">
                    <tr><td height="20" width="100" bgcolor="#F8F8F8"><strong>C&oacute;digo Cie</strong></td><td width="400" bgcolor="#F8F8F8" align="center"><strong>Descripci&oacute;n</strong></td><td width="160" bgcolor="#F8F8F8" align="center"><strong>Tipo Diagn&oacute;stico</strong></td></tr>';
             foreach ($diagnosticos as $xy => $valuex) {
                 $cadenaDiagnostico .= '<tr><td>' . utf8_encode($diagnosticos[$xy][1]) . '</td><td>' . utf8_encode($diagnosticos[$xy][2]) . '</td><td>' . utf8_encode($diagnosticos[$xy][6]) . '</td></tr>';
             }
             $cadenaDiagnostico .= '</table>';
             $imprimeDiagnostico = true;
         }
         //===================================   fin   ====================================
         //================================================================================
         $pdf->SetFont($family, $styleNormal, $sizeTitulo);
         $pdf->writeHTML('<br>', true, false, false, false, '');
         $pdf->writeHTML($datosPaciente, false, false, false, false, '');
         $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', '', '', 190, 1);
         $pdf->writeHTML('<br>', true, false, false, false, '');
         $pdf->SetFont($family, $styleNormal, $sizeTitulo);
         $pdf->writeHTML($datosmedico, false, false, false, false, '');
         $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', '', '', 190, 1);
         $pdf->writeHTML('<br>', true, false, false, false, '');
         if ($imprimeExaMed) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'EXAMENES MEDICOS', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 23, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaExamenes, true, false, false, false, '');
         }
         if ($imprimeDiagnostico) {
             $pdf->SetFont($family, $styleNegrita, $sizeSubtitulo);
             $pdf->Write(0, 'DIAGNOSTICO', '', 0, 'L', true, 0, false, false, 0);
             $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', 11, '', 16, 1);
             $pdf->writeHTML('<br>', true, false, false, false, '');
             $pdf->SetFont($family, $styleNormal, $sizeDatos);
             $pdf->writeHTML($cadenaDiagnostico, true, false, false, false, '');
         }
         if ($x <= count($arrayHC) - 1) {
             $x++;
         }
     }
     $pdf->Output('preventivas.pdf', 'I');
 }
コード例 #5
0
 function generarMYPDF_RECIBO($atributosRecibo, $labelCabecera, $labelDetalle, $labelPie, $datosCabecera, $datosDetalle, $datosPie, $modo, $nombreReporte, $parametros)
 {
     // create new PDF document
     $pdf = new TCPDF($parametros["PDF_PAGE_ORIENTATION"], PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('HMLO');
     $pdf->SetTitle('Recibo de Pago');
     $pdf->SetSubject('HMLO');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 048', PDF_HEADER_STRING);
     // remove default header/footer
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     //set auto page breaks
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //        $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
     //$pdf->Cell(10, 5, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
     //$pdf->write1DBarcode($parametros["CODIGO_DE_BARRAS"], 'C39',68 ,137,70,8, 0.4, $style, 'N');
     //        $pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
     $pdf->SetFont('helvetica', '', 8);
     //======================================================================================================
     $sizeDatos = 6;
     $sizeTitulo = 8;
     $sizeSubtitulo = 6;
     $family = "helvetica";
     $styleNormal = "N";
     $styleNegrita = "B";
     /* =======================================        Obs       ============================================ */
     // width->0, height->1, top->2, left->3, color->4 TipoLetra=>5 EstiloLetra=>6 TamañoLetra=>6
     /* ===================================================================================================== */
     $lblCabecera = array();
     //        $lblDetalle=array();
     $lblPie = array();
     $styleCL = array();
     $styleCD = array();
     //        $styleDL=array();
     //        $styleDD=array();
     $stylePL = array();
     $stylePD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosRecibo);
     $o_classGeneral->setLabelPie($labelPie, $atributosRecibo);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $stylePL = $o_classGeneral->getStylePL();
     $stylePD = $o_classGeneral->getStylePD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     $lblPie = $o_classGeneral->getLblPie();
     /* ===================================================================================================== */
     /* =====================================   Cabecera   =================================================== */
     if ($modo == 1) {
         foreach ($lblCabecera as $i => $value) {
             $isImg = substr($lblCabecera[$i], -4);
             if ($isImg == ".jpg" || $isImg == ".png" || $isImg == ".gif") {
                 $pdf->Image('../../../images/logo' . $lblCabecera[$i], $styleCL[$i][3], $styleCL[$i][2], $styleCL[$i][0], $styleCL[$i][1], '', '', '', false, 300);
             } else {
                 $color = $styleCL[$i][4];
                 $pdf->SetTextColor($color[0], $color[1], $color[2]);
                 $pdf->SetFont($styleCL[$i][5], $styleCL[$i][6], $styleCL[$i][7]);
                 $pdf->MultiCell($styleCL[$i][0], $styleCL[$i][1], $lblCabecera[$i], 0, 'L', 0, 1, $styleCL[$i][3], $styleCL[$i][2], true);
             }
         }
     }
     $indice = array_keys($datosCabecera);
     // print_r($datosCabecera);
     foreach ($indice as $val => $z) {
         $isImgx = substr($datosCabecera[$z], -4);
         if ($isImgx == ".jpg" || $isImgx == ".png" || $isImgx == ".gif") {
             $pdf->Image($datosCabecera[$z], $styleCD[$val][3], $styleCD[$val][2], $styleCD[$val][0], $styleCD[$val][1], '', '', '', false, 300);
         } else {
             $color = $styleCD[$val][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($styleCD[$val][5], $styleCD[$val][6], $styleCD[$val][7]);
             $pdf->MultiCell($styleCD[$val][0], $styleCD[$val][1], $datosCabecera[$z], 0, 'L', 0, 1, $styleCD[$val][3], $styleCD[$val][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================   Fin Cabecera   ============================================== */
     //-------------------------- espacio despues de la cabecera --------------------
     //$pdf->writeHTML("<br>", true, false, false, false, '');
     /* ===================================================================================================== */
     /* =====================================     Detalle     ========================================== */
     $cantidad = $datosDetalle[0][3];
     $importe = $datosDetalle[0][4];
     $detalle = '';
     $cuerpoDetalle = '';
     $findetalle = '</table>';
     $cabeceraDetalle = '<table align="center" width="230" border="0" cellspacing="1">
                                   <tr>
                                     <td width="150"><strong>Descripcion</strong></td>
                                     <td width="40"><strong>Cantidad</strong></td>
                                     <td width="40"><strong>Importe</strong></td>
                                   </tr>
                                 ';
     if (!empty($datosDetalle)) {
         foreach ($datosDetalle as $i => $value) {
             $cuerpoDetalle .= '<tr>
                                     <td width="150">' . $value[0] . '</td>
                                     <td width="40">' . $value[1] . '</td>
                                     <td width="40">S/. ' . $value[2] . '</td>
                                    </tr>';
         }
         $detalle = $cabeceraDetalle . $cuerpoDetalle . $findetalle;
         $total = '<table align="center" width="230" border="0" cellspacing="1">
                                   <tr>
                                     <td width="150"></td>
                                     <td width="40">TOTAL</td>
                                     <td width="40">S/. ' . $importe . '</td>
                                   </tr>
                                 ';
     } else {
         $cuerpoDetalle .= '<table width="230" border="0"><tr><td align="center"><strong>No existe registro</strong></td></tr></table>';
         $detalle = $cabeceraDetalle . $findetalle . $cuerpoDetalle;
     }
     $pdf->SetFont($family, $styleNegrita, $sizeTitulo);
     //$pdf->Write(0, 'ANTECEDENTES', '', 0, 'L', true, 0, false, false, 0);
     //$pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', '', '', 190, 1);
     //$pdf->writeHTML('<br>', true, false, false, false, '');
     $pdf->SetFont($family, $styleNormal, $sizeDatos);
     $pdf->writeHTML($detalle, true, false, false, false, 'C');
     $pdf->writeHTML('<br>', true, false, false, false, '');
     $pdf->writeHTML($total, true, false, false, false, 'C');
     /* ===================================================================================================== */
     /* =====================================   Fin Detalle   ============================================== */
     /* ===================================================================================================== */
     /* =====================================     Pie     =================================================== */
     if ($modo == 1) {
         foreach ($lblPie as $i => $value) {
             $isImg = substr($lblPie[$i], -4);
             if ($isImg == ".jpg" || $isImg == ".png" || $isImg == ".gif") {
                 $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/' . $lblPie[$i], $stylePL[$i][3], $stylePL[$i][2], $stylePL[$i][0], $stylePL[$i][1], '', '', '', false, 300);
             } else {
                 $color = $stylePL[$i][4];
                 $pdf->SetTextColor($color[0], $color[1], $color[2]);
                 $pdf->SetFont($stylePL[$i][5], $stylePL[$i][6], $stylePL[$i][7]);
                 $pdf->MultiCell($stylePL[$i][0], $stylePL[$i][1], $lblPie[$i], 0, 'L', 0, 1, $stylePL[$i][3], $stylePL[$i][2], true);
             }
         }
     }
     $indice = array_keys($datosPie);
     // print_r($datosCabecera);
     foreach ($indice as $val => $z) {
         $isImgx = substr($datosPie[$z], -4);
         if ($isImgx == ".jpg" || $isImgx == ".png" || $isImgx == ".gif") {
             $pdf->Image($datosPie[$z], $stylePD[$val][3], $stylePD[$val][2], $stylePD[$val][0], $stylePD[$val][1], '', '', '', false, 300);
         } else {
             $color = $stylePD[$val][4];
             $pdf->SetTextColor($color[0], $color[1], $color[2]);
             $pdf->SetFont($stylePD[$val][5], $stylePD[$val][6], $stylePD[$val][7]);
             $pdf->MultiCell($stylePD[$val][0], $stylePD[$val][1], $datosPie[$z], 0, 'L', 0, 1, $stylePD[$val][3], $stylePD[$val][2], true);
         }
     }
     /* ===================================================================================================== */
     /* =====================================    Fin Pie    ================================================= */
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($nombreReporte, 'I');
     //============================================================+
     // END OF FILE
     //============================================================+
 }
コード例 #6
0
 function generarMYPDF_CARNET_SANIDAD($datosCabecera, $modo, $nombreReporte, $parametros, $labelCabecera, $atributosRecibo)
 {
     // create new PDF document
     $pdf = new TCPDF($parametros["PDF_PAGE_ORIENTATION"], PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('HMLO');
     //        $pdf->SetTitle('Receta medica estandarizada');
     $pdf->SetSubject('HMLO');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     //        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 048', PDF_HEADER_STRING);
     // remove default header/footer
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     //set auto page breaks
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //        $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
     //$pdf->Cell(10, 5, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
     //        $pdf->write1DBarcode($parametros["CODIGO_DE_BARRAS"], 'C39', 68, 137, 70, 8, 0.4, $style, 'N');
     //        $pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
     $pdf->SetFont('helvetica', '', 8);
     //======================================================================================================
     $sizeDatos = 6;
     $sizeTitulo = 8;
     $sizeSubtitulo = 6;
     $family = "helvetica";
     $styleNormal = "N";
     $styleNegrita = "B";
     /* =======================================        Obs       ============================================ */
     // width->0, height->1, top->2, left->3, color->4 TipoLetra=>5 EstiloLetra=>6 TamañoLetra=>6
     /* ===================================================================================================== */
     $lblCabecera = array();
     //        $lblDetalle=array();
     $lblPie = array();
     $styleCL = array();
     $styleCD = array();
     //        $styleDL=array();
     //        $styleDD=array();
     $stylePL = array();
     $stylePD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosRecibo);
     //        $o_classGeneral->setLabelPie($labelPie, $atributosReceta);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $stylePL = $o_classGeneral->getStylePL();
     $stylePD = $o_classGeneral->getStylePD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     $lblPie = $o_classGeneral->getLblPie();
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================   Cabecera   =================================================== */
     if (is_array($lblCabecera) && !empty($lblCabecera) && $modo == 1) {
         foreach ($lblCabecera as $i => $value) {
             $isImg = end(explode(".", $value));
             if ($isImg == "jpg" || $isImg == "png" || $isImg == "gif") {
                 $filename = '../../../tcPDF/tcpdf/tcpdf/images/' . $lblCabecera[$i];
                 if (file_exists($filename)) {
                     $pdf->Image($filename, $styleCL[$i][3], $styleCL[$i][2], $styleCL[$i][0], $styleCL[$i][1], '', '', '', false, 100);
                 }
             } else {
                 $color = $styleCL[$i][4];
                 $pdf->SetTextColor($color[0], $color[1], $color[2]);
                 $pdf->SetFont($styleCL[$i][5], $styleCL[$i][6], $styleCL[$i][7]);
                 $pdf->MultiCell($styleCL[$i][0], $styleCL[$i][1], $lblCabecera[$i], 0, 'L', 0, 1, $styleCL[$i][3], $styleCL[$i][2], true);
             }
         }
     }
     //
     //         $indice = array_keys($datosCabecera);
     //        foreach ($indice as $val => $i) {
     ////            $isImgx = substr($datosCabecera[$z], -4);
     ////            if ($isImgx == ".jpg" || $isImgx == ".png" || $isImgx == ".gif") {
     //                $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/img.png', $styleCD[$i][3], $styleCD[$i][2], $styleCD[$i][0], $styleCD[$i][1], '', '', '', false, 300);
     ////            }
     ////             else {
     ////                $color = $styleCD[$z][4];
     ////                $pdf->SetTextColor($color[0], $color[1], $color[2]);
     ////                $pdf->SetFont($styleCD[$z][5], $styleCD[$z][6], $styleCD[$z][7]);
     ////                $pdf->MultiCell($styleCD[$z][0], $styleCD[$z][1], $datosCabecera[$z], 0, 'L', 0, 1, $styleCD[$z][3], $styleCD[$z][2], true);
     ////            }
     //        }
     /* ===================================================================================================== */
     /* =====================================   Fin Cabecera   ============================================== */
     /* ===============================    espacio despues de la cabecera    ================================ */
     //$pdf->writeHTML("<br>", true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================     Antecedentes     ========================================== */
     //        $RP = '<table width="700" border="0" cellpadding="4" cellspacing="0" bgcolor="#ffffff">
     //            <tr>
     //                <td>RP</td>
     //            </tr>
     //            </table>';
     //        $cadenaAntecedentes = $RP . '<table width="700" border="1" cellpadding="3" cellspacing="0" bgcolor="#ffffff">
     //                                <tr>
     //                                    <td rowspan="2" width="25" align="center"><strong>Nro</strong></td>
     //                                    <td rowspan="2" align="center" width="290"><strong>Medicamento o Insumo</strong><br/>
     //                                    <strong>( obligatorio DCI )    /   Concentración</strong></td>
     //                                    <td rowspan="2" align="center" width="80"><strong>Forma Farmaceutica</strong></td>
     //                                    <td rowspan="2" align="center" width="50"><strong>Cantidad Prescrito</strong></td>
     //                                    <td colspan="4" align="center" width="260"><strong>INDICACIONES</strong></td>
     //                                    </tr>
     //                                    <tr>
     //                                    <td align="center"><strong>Dosis</strong></td>
     //                                    <td align="center"><strong>Frecuencia</strong></td>
     //                                    <td align="center"><strong>Via Administ.</strong></td>
     //                                    <td align="center"><strong>Duraci&oacute;n Tratamiento</strong></td>
     //                                  </tr>';
     ////        $orden = 0;
     ////        foreach ($datosDetalle as $key => $value) {
     ////            $orden++;
     ////            $cadenaAntecedentes.='<tr>
     ////                                    <td><strong>' . $orden . '.</strong></td>
     ////                                    <td>' . utf8_encode($value[0]) . '</td>
     ////                                    <td>' . utf8_encode($value[1]) . '</td>
     ////                                    <td>' . utf8_encode($value[2]) . '</td>
     ////                                    <td colspan="4">' . utf8_encode($value[3]) . '</td>
     ////                                  </tr>';
     ////        }
     //        $cadenaAntecedentes.='</table><br>';cellspacing="3" cellpadding="0"
     $cadenaAntecedentes .= '<br><br><br><br>';
     $cadenaAntecedentes .= '<table><tr><td width="80px">';
     $cadenaAntecedentes .= '<img width="80px" height="106px" align="left" src="../../../../carpetaDocumentos/materialesLaboratorio/fotosCarnet/' . $datosCabecera[3] . '.JPG"/>';
     //         $cadenaAntecedentes.="sssssssssssssssssss"    ;
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '<td>';
     $cadenaAntecedentes .= '<br><br><br>';
     $cadenaAntecedentes .= '<table border="1" >';
     $cadenaAntecedentes .= '<tr><td width="120px">';
     $cadenaAntecedentes .= '&nbsp;<b> ' . $datosCabecera[4] . '</b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '<tr>';
     $cadenaAntecedentes .= '<td >';
     $cadenaAntecedentes .= '&nbsp;  ' . $datosCabecera[5];
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '<tr>';
     $cadenaAntecedentes .= '<td >';
     $cadenaAntecedentes .= '&nbsp; DNI:  ' . $datosCabecera[0];
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '<tr>';
     $cadenaAntecedentes .= '<td >';
     $cadenaAntecedentes .= '&nbsp;&nbsp; <b>' . $datosCabecera[2] . '</b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '<tr>';
     $cadenaAntecedentes .= '<td >';
     $cadenaAntecedentes .= '<table border="1" >';
     $cadenaAntecedentes .= '<tr><td width="60px">';
     $cadenaAntecedentes .= '<b> Vigencia: </b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '<td>';
     $cadenaAntecedentes .= '<b>' . $datosCabecera[6] . '</b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '<tr><td width="60px">';
     $cadenaAntecedentes .= '<b> Al: </b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '<td>';
     $cadenaAntecedentes .= '<b>' . $datosCabecera[7] . '</b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '</table>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '</table>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '<td >';
     $cadenaAntecedentes .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>' . $datosCabecera[3] . '</b>';
     $cadenaAntecedentes .= '</td>';
     $cadenaAntecedentes .= '</tr>';
     $cadenaAntecedentes .= '</table>';
     //echo $cadenaAntecedentes;
     $pdf->writeHTML('<br>', true, false, false, false, '');
     //        $pdf->Image('../../../tcPDF/tcpdf/tcpdf/images/line.jpg', '', '', 100, 1);
     $pdf->SetFont($family, $styleNormal, $sizeTitulo);
     $pdf->writeHTML($cadenaAntecedentes, true, false, false, false, '');
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* ===================================================================================================== */
     /* =====================================     Pie     =================================================== */
     //        if (is_array($lblPie) && !empty($lblPie) && $modo == 1) {
     //            foreach ($lblPie as $i => $value) {
     //                $color = $stylePL[$i][4];
     //                $pdf->SetTextColor($color[0], $color[1], $color[2]);
     //                $pdf->SetFont($stylePL[$i][5], $stylePL[$i][6], $stylePL[$i][7]);
     //                $pdf->MultiCell($stylePL[$i][0], $stylePL[$i][1], $lblPie[$i], 0, 'L', 0, 1, $stylePL[$i][3], $stylePL[$i][2], true);
     //            }
     //        }
     //        if (is_array($datosPie) && !empty($datosPie)) {
     //            foreach ($datosPie as $i => $value) {
     //                $color = $stylePD[$i][4];
     //                $pdf->SetTextColor($color[0], $color[1], $color[2]);
     //                $pdf->SetFont($stylePD[$i][5], $stylePD[$i][6], $stylePD[$i][7]);
     //                $pdf->MultiCell($stylePD[$i][0], $stylePD[$i][1], $datosPie[$i], 0, 'L', 0, 1, $stylePD[$i][3], $stylePD[$i][2], true);
     //            }
     //        }
     /* ===================================================================================================== */
     /* =====================================    Fin Pie    ================================================= */
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($nombreReporte, 'I');
     //============================================================+
     // END OF FILE
     //============================================================+
 }
コード例 #7
0
 public function generarMYPDF($atributosReceta, $labelCabecera, $labelDetalle, $labelPie, $datosCabecera, $datosDetalle, $datosPie, $modo, $nombreReceta, $parametros)
 {
     /* =======================================        Obs       ============================================ */
     // width->0, height->1, top->2, left->3, color->4 TipoLetra=>5 EstiloLetra=>6 TamañoLetra=>6
     /* ===================================================================================================== */
     $lblCabecera = array();
     $lblDetalle = array();
     $lblPie = array();
     $styleCL = array();
     $styleCD = array();
     $styleDL = array();
     $styleDD = array();
     $stylePL = array();
     $stylePD = array();
     $o_classGeneral = new classGeneral();
     $o_classGeneral->setLabelCabecera($labelCabecera, $atributosReceta);
     $styleCL = $o_classGeneral->getStyleCL();
     $styleCD = $o_classGeneral->getStyleCD();
     $lblCabecera = $o_classGeneral->getLblCabecera();
     $o_classGeneral->setLabelDetalle($labelDetalle, $atributosReceta);
     $styleDL = $o_classGeneral->getStyleDL();
     $styleDD = $o_classGeneral->getStyleDD();
     $lblDetalle = $o_classGeneral->getLblDetalle();
     $o_classGeneral->setLabelPie($labelPie, $atributosReceta);
     $stylePL = $o_classGeneral->getStylePL();
     $stylePD = $o_classGeneral->getStylePD();
     $lblPie = $o_classGeneral->getLblPie();
     /* ====================================================================================================== */
     // create new PDF document  //PDF_PAGE_ORIENTATION(P,L)
     $pdf = new MYPDF($parametros["PDF_PAGE_ORIENTATION"], PDF_UNIT, $parametros["PDF_PAGE_FORMAT"], true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Juan Carlos Ludeña Montesinos');
     $pdf->SetTitle('Generardor de Reportes');
     $pdf->SetSubject('Generardor de Reportes');
     //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 011', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // remove default header/footer
     $pdf->setPrintHeader($parametros["PRINT_HEADER"]);
     $pdf->setPrintFooter($parametros["PRINT_FOOTER"]);
     //set margins
     $pdf->SetMargins($parametros["PDF_MARGIN_LEFT"], $parametros["PDF_MARGIN_TOP"], $parametros["PDF_MARGIN_RIGHT"]);
     $pdf->SetHeaderMargin($parametros["PDF_MARGIN_HEADER"]);
     $pdf->SetFooterMargin($parametros["PDF_MARGIN_FOOTER"]);
     //set auto page breaks
     $pdf->SetAutoPageBreak($parametros["AUTO_PAGE_BREAK"], $parametros["PDF_MARGIN_BOTTOM"]);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //$pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 6);
     // add a page
     $pdf->AddPage();
     //Data loading
     // print colored table
     $pdf->ColoredTable($lblCabecera, $lblDetalle, $lblPie, $datosCabecera, $datosDetalle, $datosPie, $styleCL, $styleDL, $stylePL, $styleCD, $styleDD, $stylePD, $modo);
     $pdf->lastPage();
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($nombreReceta, 'I');
     //$pdf->extractCSSproperties();
     //============================================================+
     // END OF FILE
     //============================================================+
 }