/** * gera um pdf dos laudos * * @param array $r */ function pdfLaudos($rs){ //error_reporting(E_ALL); set_time_limit(1800); include 'lib/php/classes/class.ezpdf.php'; $pdf = new Cezpdf('a4','portrait'); $pdf -> ezSetMargins(50,70,50,50); $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0,0,0,1); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all,'all'); $mainFont = './fonts/Courier.afm'; $codeFont = './fonts/Courier.afm'; $pdf->selectFont($mainFont); $n_rows = sizeof($rs); $c = 0; $t=945; $fator = 25; foreach($rs as $id => $r){ $o = new Interpretacao($r["int_id"]); $hos = new Hospital($o->get("hos_id")); $hos_nome = $hos->get("hos_nome"); $con = new Convenio($o->get("con_id")); $con_nome = $con->get("con_nome"); $exa = new Exame($o->get("exa_id")); $exa_nome = $exa->get("exa_nome"); $pdf->ezText($hos_nome,18,array('justification'=>'center')); $pdf->ezText(" ",20,array('justification'=>'left')); $pdf->ezText("PACIENTE : ".$r["int_paciente_prontuario"]." ".$r["int_paciente_nome"],10,array('justification'=>'left')); if ($r["int_paciente_nascimento"] == "0000-00-00") $pdf->ezText("NASCIMENTO : SEXO: ".$r["int_paciente_sexo"],10,array('justification'=>'left')); else $pdf->ezText("NASCIMENTO : ".Formatacao::formatBrData($r["int_paciente_nascimento"])." SEXO: ".$r["int_paciente_sexo"],10,array('justification'=>'left')); $pdf->ezText("CONVÊNIO : ".$con_nome,10,array('justification'=>'left')); $pdf->ezText("EXAME : ".$exa_nome,10,array('justification'=>'left')); $pdf->ezText(" ",20,array('justification'=>'left')); $pdf->ezText(" DATA: ".Formatacao::formatBrDataHoraminSeg($r["int_data_interpretacao"]),10,array('justification'=>'left')); $pdf->ezText("N DO EXAME : ".$r["int_opcional"],10,array('justification'=>'left')); $pdf->ezText("MÉDICO REQUISITANTE : ".$r["int_requisitante"],10,array('justification'=>'left')); $pdf->ezText("EXAME INTERPRETADO POR : 9679 Ernesto Sousa Nunes",10,array('justification'=>'left')); $pdf->ezText("TÉCNICO RX : ".$r["int_tecnico_rx"],10,array('justification'=>'left')); $pdf->ezText(" ",20,array('justification'=>'left')); $pdf->ezText("I N T E R P R E T A Ç Ã O",18,array('justification'=>'center')); $pdf->ezText(" ",20,array('justification'=>'left')); $vet_txt = split("\n",$r["int_texto"]); $pdf->ezText("============================================================================",10,array('justification'=>'left')); $pdf->ezText(" ",8,array('justification'=>'left')); foreach($vet_txt as $linha){ $pdf->ezText(" ".$linha,10,array('justification'=>'left')); } $pdf->ezText(" ",8,array('justification'=>'left')); $pdf->ezText("============================================================================",10,array('justification'=>'left')); $pdf->ezText(" Exame interpretado por: 9676 - Dr. Ernesto Sousa Nunes",10,array('justification'=>'left')); $pdf->addJpegFromFile('ass.jpg',250, 0); $pdf->openHere('Fit'); if ($c+1 < $n_rows) $pdf->ezNewPage(); $c++; $o->informaImpressao(); //$sql = "update laudo set LAU_DATA_EXPORTACAO = now() where LAU_ID = ".$r["LAU_ID"]." LIMIT 1"; //$up = mysql_query($sql, $db) or die(mysql_error()); } $pdfcode = $pdf->Output(); //$pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode)); //$cont = trim($pdfcode); $fh = fopen("laudos_prontos.pdf", 'w+'); fwrite($fh, $pdfcode); fclose($fh); ?><script language="javascript">document.location.href="laudos_prontos.pdf";</script><? }
<? Util::VerificaChamada(); if($_GET[id]){ $o = new ValorExame($_GET[id]); //$o->setDependences(); //util::prt("", get_class_methods($o)); foreach($o->propertiesGetConfig() as $campo => $config){ $tpl->assign($campo, $o->get($campo)); } $exa = new Exame($o->get("exa_id")); $tpl->assign("exa_nome", $exa->get("exa_nome")); $con = new Convenio($o->get("con_id")); $tpl->assign("con_nome", $con->get("con_nome")); $hos = new Hospital($con->get("hos_id")); $tpl->assign("hos_nome", $hos->get("hos_nome")); if ($_GET[del] == "1" || $_POST[del] == "1"){ if ($o->delete($_GET[delete_dependences])){ Js::goto(array("url" => "index.php?s=valor_exame")); } else { $dep = $o->getDependences(); if (sizeof($dep)){ $tpl->assign("dependences", $dep); } } } } else { Js::goto(array("url" => "index.php?s=convenio")); }
<? Util::VerificaChamada(); if($_GET[id]){ $o = new Exame($_GET[id]); $_POST["med_id"] = $_SESSION["med_id"]; foreach($o->propertiesGetConfig() as $campo => $config){ $tpl->assign($campo, (empty($_POST[$campo]) ? $o->get($campo) : $_POST[$campo])); $o->set($campo, $_POST[$campo]); } if ($_POST[form] == "ok"){ if ($o->update()){ Js::goto(array("url" => "index.php?s=exame")); } else { foreach($o->errors as $campo => $erro){ $tpl->assign($campo."_erro", $erro); $tpl->assign($campo, ""); } } } } else { Js::goto(array("url" => "index.php?s=exame")); } $template_html = $path_tpl."formulario.tpl"; ?>
$template_html = $path_tpl."gerenciar.tpl"; } else { //util::prt("", $p->getRegistrosPagina()); $max_caracteres = 75; $rs = array(); $i = 0; foreach($p->getRegistrosPagina() as $id => $r){ //util::prt("", $r); $rs[$i] = $r; $o = new Interpretacao($r["int_id"]); $hos = new Hospital($o->get("hos_id")); $rs[$i]["hos_nome"] = $hos->get("hos_nome"); $con = new Convenio($o->get("con_id")); $rs[$i]["con_nome"] = $con->get("con_nome"); $exa = new Exame($o->get("exa_id")); $rs[$i]["exa_nome"] = $exa->get("exa_nome"); $vet_txt = split("\n",$r["int_texto"]); $rs[$i]["int_texto"] = ""; foreach($vet_txt as $linha){ if(strlen($linha) > $max_caracteres){ //util::prt(strlen($linha), $linha); $parte1 = substr($linha,0,$max_caracteres)."\n"; $parte2 = substr($linha,$max_caracteres,$max_caracteres)."\n"; $parte3 = substr($linha,$max_caracteres*2,$max_caracteres)."\n"; $parte4 = substr($linha,$max_caracteres*3,$max_caracteres)."\n"; //util::prt("1", $parte1); //util::prt("2", $parte2); //util::prt("3", $parte3); //util::prt("4", $parte4); $rs[$i]["int_texto"] = $parte1.$parte2.$parte3.$parte4; } else {