Resultado não gerando no PDF
Bom dia, sou novato tanto no fórum, como nesta area, seguinte, estou com um pouco de dificuldade em gerar um PDF, na realidade, chega a gerar O PDF, mas nao coloca o resultado, segue a baixo PRINT e o codigo.
ps1: tenho um sistema em PHP 5.4, sistema de clinica, estou querendo gerar relatório de glosa.
<?
include("frmvalidarcookie.php");
$idfatu=0;
$data1='';
$data2='';
if (isset($_POST["data1"])) $data1=$_POST["data1"];
if (isset($_POST["data2"])) $data2=$_POST["data2"];
if (isset($_POST["idfatu"])) $idfatu=$_POST["idfatu"];
$sql="select b.diaexame,a.idresultados, a.idexame, e.exame as nm_exame, a.quant, a.vr_glosa,
a.pa_sa, a.quant*a.pa_sa as pr_total, a.glosado, a.glosado_usu, a.glosado_dat,
c.convenio as nm_convenio,p.paciente as nm_paciente,g.id as nm_id
from lab_itemresultados a
left join lab_resultados b on b.idresultado=a.idresultados
left join lab_convenios c on c.idconvenio=b.idconvenio
left join lab_exames e on e.idexame=a.idexame
left join lab_pacientes p on p.idpaciente=b.idpaciente
left join fatu00 f on f.id=b.idlote
left join fatu02 g on g.id=f.idfatu02
where a.glosado='S' and g.id=$idfatu order by p.paciente ";
echo $sql;
require_once("../fpdf/fpdf.php");class PDF extends FPDF
{
function Header(){
$this->SetLeftMargin(30);
$this->Image('LOGO.jpg' , 72 ,12, 55 , 58,'JPG','');
$this->SetFont('Arial','',12);
$this->Cell(0,10,"EMPRESA",0,1,'C');
$this->SetFont('Arial','',8);
$this->Cell(0,12," Mossoró/RN",0,1,'C');
$this->SetFont('Arial','BI',10);
$this->Ln(10);
$this->Cell(0,14,$this->title2,0,1,'C');
$this->Ln(10);
//cabeçalho da tabela
$this->SetFont('arial','B',8);
$this->SetFillColor(212,208,200);
$this->Cell(50,15,'Data',1,0,"C",1);
$this->Cell(40,15,'OS',1,0,"C",1);
$this->Cell(150,15,'Convenio',1,0,"C",1);
$this->Cell(150,15,'Paciente',1,0,"C",1);
$this->Cell(150,15,'Exame',1,0,"C",1);
$this->Cell(30,15,'Quant',1,0,"C",1);
$this->Cell(40,15,'Pr.Unit',1,0,"C",1);
$this->Cell(50,15,'Total',1,0,"C",1);
$this->Cell(50,15,'Glosa em',1,0,"C",1);
$this->Cell(50,15,'Vr. Glosa',1,0,"C",1);
$this->Cell(30,15,'Fatura',1,1,"C",1);
}
function Footer()
{
$this->SetY(-20); //quanto menor,mais distante da base da folha
$this->SetFont('Arial','I',8);
$this->Cell(0,10,'Pagina '.$this->PageNo(),0,0,'C');
}
}
$pdf= new PDF("L","pt","A4");
//$pdf->title=$usuario;
$pdf->title2='GLOSAS - '.$dt1.' - '.$dt2;
$pdf->SetLeftMargin(30);
$pdf->SetAutoPageBreak(true,32);
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial','',8);
//$pdf->MultiCell(200,20,$sql,1,'L',false);
$r=ibase_query($sql);
$i=0;
$t1=0;
$t2=0;while($row=ibase_fetch_assoc($r)){
$pdf->Cell(50,15,dataBR($row->DIAEXAME),1,0,"C");
$pdf->Cell(40,15,$row->IDRESULTADOS,1,0,"R");
$pdf->Cell(150,15,substr($row->NM_CONVENIO,0,25),1,0,"L");
$pdf->Cell(150,15,substr($row->NM_PACIENTE,0,25),1,0,"L");
$pdf->Cell(150,15,substr($row->NM_EXAME,0,25),1,0,"L");
$pdf->Cell(30,15,tran0($row->QUANT),1,0,"C");
$pdf->Cell(40,15,tran($row->PA_SA),1,0,"R");
$pdf->Cell(50,15,tran($row->PR_TOTAL),1,0,"R");
$pdf->Cell(50,15,dataBR($row->GLOSADO_DAT),1,0,"C");
$pdf->Cell(50,15,tran($row->VR_GLOSA),1,0,"R");
$pdf->Cell(30,15,$row->NM_ID,1,1,"R");
$i++;
$t1=$t1+$row->PR_TOTAL;
$t2=$t2+$row->VR_GLOSA;
}
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(212,208,200);
$pdf->Cell(610,15,"Total: ".$i,1,0,"L",1);
$pdf->Cell(50,15,tran($t1),1,0,"R",1);
$pdf->Cell(50,15,'',1,0,"R",1);
$pdf->Cell(50,15,tran($t2),1,1,"R",1);
ob_start();
$pdf->Output("arquivo.pdf","I");
?>

Discussão (0)
Carregando comentários...