<?php 
require('fpdf/fpdf.php');
include('../../config.php');
if(isset($_GET['id_bilan'])){
$id_bilan=$_GET['id_bilan'];
 $req_get_p="SELECT *  FROM patients as p where  p.id='$id_patient'";
              $query_get_p=mysqli_query($con,$req_get_p);
              $row_p= mysqli_fetch_array($query_get_p); 
              $nom_patient=$row_p['nom'];
              $prenom_patient=$row_p['prenom'];
              $date_naiss=new DateTimeImmutable($row_p['date_naissance']);
              $date_naissance=date_format($date_naiss,'d-m-Y');
$req_sql_bilan= "SELECT * FROM bilans as b,consultations as c, consultation_bilan as cb  
     WHERE b.id_bilan=cb.id_bilan and  c.id=cb.id_consult and b.id_bilan='$id_bilan' "; 
      $result_bilan= mysqli_query($con,$req_sql_bilan);
//$total = mysqli_num_rows($result_bilan);
$item = mysqli_fetch_array($result_bilan);  
$pdf = new FPDF('P','mm','A5');
$pdf->AddPage();
$pdf->Image('../../assets/img/logo.png', 20, 10, 40,25);
$X=80;
$Y=10;
$pdf->SetXY($X,$Y);
$pdf->SetFont('Arial','B','18');
$pdf->SetTextColor(27,74,209);
$pdf->Cell('0','10','ALGERMED','0','c');
$pdf->SetFont('Arial','','11');
$pdf->SetTextColor(27,74,209);
$X=90;
$Y=20;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','DR.BENABBAS','0','c');
$X=90;
$Y=25;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','Cabinet de pediatrie','0','c');
$X=90;
$Y=30;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','C.R.O 8241 / TZO','0','c');
$pdf->SetFont('Arial','','12');
$X=80;
$Y=35;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','Cite 1406 logement batiment 25','0','c');
$X=80;
$Y=40;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','35000 Boumerdes, Algerie','0','c');
$X=90;
$Y=45;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','+213 555 199 879','0','c');
$X=90;
$Y=50;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','info@algermed.com','0','c');
$X=90;
$Y=55;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','www.algermed.com','0','c');
$pdf->SetFont('Arial','','12');
$X=10;
$Y=35;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','Boumerdes,le:','0');
$X=40;
$Y=35;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10',$d_aj,'0');
$pdf->Ln(3);
$X=10;
$Y=43;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','Nom:','0','C');
$X=25;
$Y=43;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10',$nom_patient,'0','C');
$pdf->Ln(1);
$X=10;
$Y=51;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','Prenom:','0','C');
$X=30;
$Y=51;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10',$prenom_patient,'0','C');
$pdf->Ln(5);
$X=10;
$Y=58;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10','Date de naissance:','0','C');
$X=47;
$Y=58;
$pdf->SetXY($X,$Y);
$pdf->Cell('0','10',$date_naissance,'0','C');
$pdf->Ln(50);
$X=35;
$Y=80;
$pdf->SetXY($X,$Y);
$pdf->SetFont('Arial','B','20');
$pdf->Cell('0','10','DEMANDE DE BILAN','0','C');
$pdf->Ln(10);
$X=10;
$Y=90;
$pdf->SetXY($X,$Y);
$pdf->SetTextColor(0,0,0);
//Bold Font for Field Name
$pdf->SetFont('Arial','I',12);
if($item['fns']==1){$fns="FNS";$pdf->Cell(0,10,$fns,0,0,'L');$pdf->Ln(10);}   
if($item['feritne']==1){$feritne="Feritne";$pdf->Cell(0,10,$feritne,0,0,'L');$pdf->Ln(10);}
if($item['groupage_sanguin']==1){$groupage_sanguin="Groupage Sanguin";$pdf->Cell(0,10,$groupage_sanguin,0,0,'L');$pdf->Ln(10);}
if($item['glecemie']==1){$glecemie="Glécémie";$pdf->Cell(0,10,$glecemie,0,0,'L');$pdf->Ln(10);}
if($item['hba1c']==1){$hba1c="HBA1C";$pdf->Cell(0,10,$hba1c,0,0,'L');$pdf->Ln(10);}
if($item['hgpo']==1){$hgpo="HGPO";$pdf->Cell(0,10,$hgpo,0,0,'L');$pdf->Ln(10);}
if($item['uree_creatinemie']==1){$uree_creatinemie="Urée Créatinémie";$pdf->Cell(0,10,$uree_creatinemie,0,0,'L');$pdf->Ln(10);}
if($item['ecbu']==1){$ecbu="ECBU";$pdf->Cell(0,10,$ecbu,0,0,'L');$pdf->Ln(10);}
if($item['proteinurie']==1){$proteinurie="Protéinurie ";$pdf->Cell(0,10,$proteinurie,0,0,'L');$pdf->Ln(10);}
if($item['microalbuminurie']==1){$microalbuminurie="Microalbuminurie ";$pdf->Cell(0,10,$microalbuminurie,0,0,'L');$pdf->Ln(10);}
if($item['vs']==1){$vs="VS";$pdf->Cell(0,10,$vs,0,0,'L');$pdf->Ln(10);}
if($item['crp']==1){$crp="CRP";$pdf->Cell(0,10,$crp,0,0,'L');$pdf->Ln(10);}
if($item['fibrinogene']==1){$fibrinogene="Fibrinogène ";$pdf->Cell(0,10,$fibrinogene,0,0,'L');$pdf->Ln(10);}
if($item['tgo_tgp']==1){$tgo_tgp="TGO-TGP ";$pdf->Cell(0,10,$tgo_tgp,0,0,'L');$pdf->Ln(10);}
if($item['phosphatase_alcalines']==1){$phosphatase_alcalines="Phosphatases alcalines";$pdf->Cell(0,10,$phosphatase_alcalines,0,0,'L');$pdf->Ln(10);}
if($item['gamma_gt']==1){$gamma_gt="Gamma GT";$pdf->Cell(0,10,$gamma_gt,0,0,'L');$pdf->Ln(10);}
if($item['bilirubinemie_total']==1){$bilirubinemie_total="Bilirubine Totale";$pdf->Cell(0,10,$bilirubinemie_total,0,0,'L');$pdf->Ln(10);}
if($item['bilirubinemie_total']==1){$bilirubinemie_conjugue="Bilirubine Conjuguée";$pdf->Cell(0,10,$bilirubinemie_conjugue,0,0,'L');$pdf->Ln(10);}
if($item['bilirubinemie_non_conjugue']==1){$bilirubinemie_non_conjugue="Bilirubine Non conjuguée";$pdf->Cell(0,10,$bilirubinemie_non_conjugue,0,0,'L');$pdf->Ln(10);}
if($item['cholesterol']==1){$cholesterol="Cholestérol";$pdf->Cell(0,10,$cholesterol,0,0,'L');$pdf->Ln(10);}
if($item['hdl_cholesterol']==1){$hdl_cholesterol="HDL Cholestérol" ;$pdf->Cell(0,10,$hdl_cholesterol,0,0,'L');$pdf->Ln(10);}
if($item['ldl_cholesterol']==1){$ldl_cholesterol="LDL Cholestérol";$pdf->Cell(0,10,$ldl_cholesterol,0,0,'L');$pdf->Ln(10);}
if($item['triglyceride']==1){$triglyceride="Triglycérides  ";$pdf->Cell(0,10,$triglyceride,0,0,'L');$pdf->Ln(10);}
if($item['tp']==1){$tp="TP ";$pdf->Cell(0,10,$tp,0,0,'L');$pdf->Ln(10);}
if($item['tck']==1){$tck="TCK";$pdf->Cell(0,10,$tck,0,0,'L');$pdf->Ln(10);}
if($item['kaltemie_natremie']==1){$kaltemie_natremie="Kaliémie ";$pdf->Cell(0,10,$kaltemie_natremie,0,0,'L');$pdf->Ln(10);}
if($item['calcemie_phosphoremie']==1){$calcemie_phosphoremie="Calcémie-Phosphérémie ";$pdf->Cell(0,10,$calcemie_phosphoremie,0,0,'L');$pdf->Ln(10);}
if($item['autres_bilans']!=null){$pdf->Cell(0,10,$item['autres_bilans'],0,0,'L');$pdf->Ln(10);}
$pdf->Output();
}
?>


