public function generarrecetaTempPdf($titulo, $paciente, $plantilla, $consulta, $fecha, $urlLogo, $valores, $medico, $otros) { //public function generarConsultaReceta($urlLogo, $consulta, $medico, $otros){ $pdf = new \FPDF_FPDF(); $pdi = new \FPDF_FPDI(); $logo = $urlLogo . 'laplusbelle.jpg'; $logo2 = $urlLogo . 'sonodigest.jpg'; html_entity_decode("á"); $pdf->FPDF('P', 'mm', 'Letter'); $pdf->SetTopMargin(0); $pdf->SetLeftMargin(20); $pdf->SetAutoPageBreak(true, 6); $pdf->AddPage(); $pdf->SetFillColor(255); $pdf->SetFont('Arial', 'B', 16); // $pdf->Cell(120,32,$consulta[0]->getDetallePlantilla()->getPlantilla()->getNombre()); $pdf->Cell(70); //$pdf->Cell(120,32,utf8_decode($consulta[0]->getDetallePlantilla()->getPlantilla()->getNombre())); $pdf->Cell(120, 32, utf8_decode('Receta médica')); $pdf->Image($logo, 20, 5, 50, 20); $pdf->Image($logo2, 150, 5, 50, 20); $pdf->Line(20, 25.5, 200, 25.5); $pdf->Line(20, 26, 200, 26); $pdf->SetFont('Arial', '', 11); $pdf->SetY(20); $pdf->SetX(20); $pdf->Cell(88, 27, $medico['nombre']); $pdf->Ln(5); $pdf->SetX(20); $pdf->Cell(85, 27, $medico['cargo']); $pdf->Ln(5); $pdf->SetX(20); $pdf->Cell(85, 27, $medico['codigo']); //var_dump($otros); $i = 20; foreach ($otros as $key => $otro) { $pdf->SetY($i); $pdf->SetX(140); $pdf->Cell(20, 25, utf8_decode($otros[$key])); $i = $i + 4; } $pdf->SetFont('Arial', 'B', 13); $pdf->Ln(15); $pdf->Cell(20, 20, utf8_decode('Información general del paciente')); //$pdf->Line(20, 47, 200, 47); $pdf->Ln(5); $this->mostrarCelda($pdf, 32, 'Fecha: ', $fecha); $this->mostrarCelda($pdf, 32, 'Proxima cita: ', '_______________'); $pdf->Ln(7); //var_dump($paciente->getPersona()->getNombres()); $this->mostrarCelda($pdf, 32, 'Nombre: ', utf8_decode($paciente->getPersona()->getNombres() . ' ' . $paciente->getPersona()->getApellidos())); if ($paciente->getFechaNacimiento() != null) { $fecha = $paciente->getFechaNacimiento()->format("Y-m-d"); list($Y, $m, $d) = explode("-", $fecha); $edad = date("md") < $m . $d ? date("Y") - $Y - 1 : date("Y") - $Y; $this->mostrarCelda($pdf, 13, 'Edad: ', $edad); } else { $fecha = 'La fecha no registrada'; $this->mostrarCelda($pdf, 13, 'Edad: ', $fecha); } $pdf->Ln(7); // $this->mostrarCelda($pdf, 32, 'Expediente No.: ', $paciente->getExpediente()[0]->getNumero()); if ($paciente->getExpediente()[0] != null) { $this->mostrarCelda($pdf, 32, 'Expediente No.: ', $paciente->getExpediente()[0]->getNumero()); } else { $this->mostrarCelda($pdf, 32, 'Expediente No.: ', ' '); } $sexoPaciente = $paciente->getSexo(); $sexo = ''; if ($sexoPaciente == 'M') { $sexo = 'Masculino'; } if ($sexoPaciente == 'F') { $sexo = 'Femenino'; } $this->mostrarCelda($pdf, 13, 'Sexo: ', $sexo); $pdf->Ln(10); $pdf->SetFont('Arial', 'B', 13); $pdf->Cell(32, 27, 'FX:'); // $pdf->Cell(40, 27, $plantilla[0]->getPlantilla()->getNombre().': ', 0, 'L', false); $pdf->Line(20, 97, 200, 97); $pdf->Ln(18); // foreach ($consulta as $value) { // $pdf->SetX(25); // $pdf->SetFont('Arial','B',10); // // $pdf->SetX(30); // $pdf->SetFont('Arial','',10); // $pdf->MultiCell(170, 5, $value->getValorDetalle(), 0, 'J', false); // $this->pdf->Ln(10); // // } foreach ($plantilla as $key => $value) { $pdf->SetX(25); $pdf->SetFont('Arial', 'B', 10); //$pdf->SetY($break); //$break=$break-5; //$pdf->SetY($break); $pdf->SetFillColor(0, 0, 255); //$pdf->MultiCell(40, 4, $value->getNombre(), 0, 'L', true); $pdf->SetFont('Arial', '', 10); //$break=$break-1; //$pdf->SetY($break); //$pdf->SetX(66.6); //$pdf->MultiCell(135, 5, $valores[$key], 1, 'J', false); $pdf->SetFillColor(0, 255, 0); $pdf->MultiCell(170, 5, $valores[$key], 0, 'J', false); //$break=$break+5; //$pdf->SetY($break); $this->pdf->Ln(10); //$break=$break+10; //$pdf->SetY($break); } //$tam = count($consulta); //$espacio = //$pdf->Ln(55); $pdf->Line(20, 244, 200, 244); $pdf->Line(20, 245, 200, 245); $pdf->SetY(241); $pdf->SetX(20); $pdf->SetFont('Arial', '', 12); $pdf->Cell(85, 20, 'Tel.: 2519-2857 , 7861-0599'); $pdf->Ln(2); $pdf->Cell(55, 27, utf8_decode('Colonia Escalon, Calle Cuscatlan, No. 448, San Salvador.')); $pdf->Ln(5); $pdf->SetX(20); $pdf->Output(); // return $pdf; }
/** * See FPDF/TCPDF-Documentation ;-) */ function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') { //function Image($file, $x, $y, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300) { if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) { $this->Error('More than 7 arguments for the Image method are only available in TCPDF.'); } //parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi); parent::Image($file, $x, $y, $w, $h, $type, $link); if ($this->_intpl) { $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; } else { $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; } }