Problème affichage pdf avec fpdf page blanche

Fermé
ad3r - 27 févr. 2015 à 20:14
Bonjour,

J'ai un petit problème avec fpdf qui reste bloqué sur ma page php

require('fpdf/fpdf.php');
//include "function.php";
if(isset($_SESSION["clients"]) ){
if ( isset($_POST["actions"]) ) {
if ($_POST["actions"]=="imph"){
$codeCmd=$_POST["txtcodefco"];

$db->select("ec_panier.*,ec_angle.libelle","ec_panier LEFT JOIN ec_angle ON ec_angle.id_angle=ec_panier.type_angle"," ec_panier.n_com='".$codeCmd."'","1 asc",'','','');
$rowsPan=$db->db_result_ToArray(MYSQL_BOTH);


/*$db->select("*","ec_panier"," ec_panier.n_com='".$codeCmd."' and Fact_Status=0 ","",'','','1');
$rowsPan_fact=$db->db_result_ToArray(MYSQL_BOTH);
if(count($rowsPan_fact)){

$db->select("Fact_N","ec_panier"," Fact_Status=1 "," Fact_N desc",'','',"1");
$result_fact=$db->db_result_ToArray(MYSQL_BOTH);

if(count($result_fact)>0)
$N_Fact=$result_fact[0]["Fact_N"]+1;
else $N_Fact=1;


mysql_query("update ec_panier set Fact_N='".$N_Fact."',Fact_Status=1,Fact_DC='".$_POST["txtcodefco"]."' where ec_panier.n_com='".$codeCmd."' ");

}*/





$db->select("ec_abonnement.*,ec_panier.*,ec_angle.libelle","ec_abonnement,ec_panier LEFT JOIN ec_angle ON ec_angle.id_angle=ec_panier.type_angle"," ec_abonnement.ab_code=ec_panier.code_client and ec_panier.n_com='".$codeCmd."' ","",'','','');
$rowsClinet_=$db->db_result_ToArray(MYSQL_BOTH);

}

}else{
echo "<script>javascript:document.location='commandeslist.php'</script>";
}

class PDF extends FPDF{
//En-tête
function Header(){
//Police Arial gras 15
// déclaration d'un membre
$this->SetTextColor(150,150,150);
$this->SetFont('Arial','',8);
//Titre

//get la position y après ecriture du titre
$y=$this->GetY();
$x=$this->GetX();
//Logo
$h=$this->Image('web/images/logo.jpg',$x,$y,50);
$this->Cell(0,8,'',0,1,'C');
$this->Cell(0,10,'PLD',0,0,'L');
$this->Cell(0,5,'',0,1,'C');
$this->Cell(0,10,'Tél: 01 25 12 11 29',0,0,'L');
$this->Cell(0,5,'',0,1,'C');
$this->Cell(0,10,'E-mail: ***@***',0,0,'L');
$this->Cell(0,5,'',0,1,'C');

//Saut de ligne
$this->Ln($h);
}

//Pied de page
function Footer(){
//Positionnement à 1,5 cm du bas
$this->SetY(-15);
//Police Arial italique 8
$this->SetTextColor(0);
$this->SetFont('Arial','',9);



$this->Cell(0,0,"Espace a design, 116 Rue de Charenton - 75012 Paris (France)",0,1,'C');
$this->Cell(0,8,"Tél : 01 45 12 06 56 - E-mail : ***@*** ",0,1,'C');
//Numéro de page
//
// $this->Cell(0,0,''.$this->PageNo().'/{nb}',0,0,'R');
}
}

//Instanciation de la classe dérivée



$pdf=new PDF();
$pdf->titre = 'FACTURE';

$pdf->AddPage();
$pdf->AliasNbPages();

$titre1='FACTURE';


foreach($rowsClinet_ as $rows_FACT){
$Dat=dato($rows_FACT["pan_dc"]);
$DatFact=dato($rows_FACT["Fact_DC"]);
$NUM_FACT=$rows_FACT["n_com"];
$Nom_CLT=$rows_FACT["ab_civ"]." ".$rows_FACT["ab_nom"]." ".$rows_FACT["ab_prenom"];
$ab_societe=$rows_FACT["ab_societe"];
$ADRESS=(empty($rows_FACT['info_fac_adr']))?$rows_FACT['info_liv_adr']:$rows_FACT['info_fac_adr'];
$ADRESS=str_replace("\'", "'",$ADRESS);
$Code_POST=$rows_FACT["ab_cp"]." - ".$rows_FACT["ab_ville"];
$email=$rows_FACT["ab_email"];
$codefco=Reference_fac($rows_FACT["Fact_N"]);

if($rows_FACT["mode_pay"]=="virement")
$mode_p="Virement";
else if($rows_FACT["mode_pay"]=="cheque")
$mode_p="Chéque";
else if($rows_FACT["mode_pay"]=="RPcarte")
$mode_p= "Receive and Pay EN UNE FOIS";
else if($rows_FACT["mode_pay"]=="RPcreder")
$mode_p= "Receive and Pay EN PLUSIEURS";
else $mode_p= "Carte bancaire";
}




$SousTotal=0;
$ST_QteInit=0;$ST_Achat=0;$ST_Product=0;$ST_Sortie=0;$ST_Recyclage=0;$ST_Livraison=0;$ST_Stock=0;


$pdf->SetFont('Arial','B',9);
$pdf->Cell(0,10,"Facture N° : ".$codefco,0,1,'C');
$pdf->SetFont('Arial','',9);
$pdf->Cell(0,0,'',0,1,'C');

$pdf->SetTextColor(89,86,86);
$pdf->SetFont('Arial','B',8);

$pdf->Cell(80,5,"",0,'');
$pdf->Cell(80,5,$Nom_CLT,0,'','L');
$pdf->Cell(0,5,'',0,1,'C');

if(!empty($ab_societe)){
$pdf->Cell(80,5,"",0,'');
$pdf->Cell(80,5,$ADRESS,0,'','L');
$pdf->Cell(0,5,'',0,1,'C');
}
$pdf->Cell(80,5,"",0,'');
$pdf->Cell(80,5,$ADRESS,0,'','L');
$pdf->Cell(0,5,'',0,1,'C');

$pdf->Cell(80,5,"",0,'');
$pdf->Cell(80,5,$Code_POST,0,'','L');
$pdf->Cell(0,20,'',0,1,'C');

$pdf->Cell(40,5,"Adresse e-mail ",1,'','L');
$pdf->Cell(50,5,$email,1,'','L');
$pdf->Cell(0,5,'',0,1,'C');

$pdf->Cell(40,5,"Numéro de commande ",1,'','L');
$pdf->Cell(50,5,$codeCmd,1,'','L');

$pdf->Cell(30,5,"",0,'','L');
$pdf->Cell(40,5,"Date de commande ",1,'','L');
$pdf->Cell(32,5,$Dat,1,'','L');


$pdf->Cell(0,5,'',0,1,'C');

$pdf->Cell(40,5,"Mode de règlement ",1,'','L');
$pdf->Cell(50,5,$mode_p,1,'','L');

$pdf->Cell(30,5,"",0,'','L');
$pdf->Cell(40,5,"Date facture ",1,'','L');
$pdf->Cell(32,5,$DatFact,1,'','L');

$pdf->Cell(0,5,'',0,1,'C');

////$pdf->Cell(50,5,"Date : ".$Dat,0,'');
//$pdf->Cell(80,5,"",0,'');
////$pdf->Cell(30,5,"Adresse : ",0,'');
//$pdf->Cell(80,5,$ADRESS,0,'','L');
////$pdf->Cell(50,5,"Bon de Commande : ".$codeCmd,0,'');
//$pdf->Cell(80,5,"",0,'');
////$pdf->Cell(30,5,"Adresse : ",0,'');
//$pdf->Cell(80,5,$Code_POST,0,'','L');
//$pdf->Cell(0,5,'',0,1,'C');




//$pdf->SetTextColor(30,100,0);


$pdf->Cell(0,10,'',0,1,'C');
//$pdf->SetTextColor(10,98,199);
$pdf->Cell(15,5,"Référence",1,'','C');
$pdf->Cell(75,5,"Modèle",1,'','C');
$pdf->Cell(20,5,"Couleur",1,'','C');
$pdf->Cell(10,5,"Qté",1,'','C');
$pdf->Cell(20,5,"PU",1,'','C');
$pdf->Cell(32,5,"Montant",1,'','C');
$pdf->Cell(20,5,"TVA",1,'','C');
$pdf->Cell(0,5,'',0,1,'C');
$total=0;
$totalttc=0;

foreach($rowsClinet_ as $rows_FACT){
$pdf->Cell(15,5,$rows_FACT["ref"],1,'','C');
$model=explode('|',$rows_FACT["modele"]);
$pdf->Cell(75,5,$model[0]." ".$rows_FACT["libelle"],1,'','C');
$db->select("*","ec_color"," ec_color.ec_color_id='".$rows_FACT["couleur"]."'","",'','','');
$rowscolor=$db->db_result_ToArray(MYSQL_BOTH);
$pdf->Cell(20,5,$rowscolor[0]["ec_color_titre"],1,'','C');
$pdf->Cell(10,5,$rows_FACT["qte"],1,'','C');
$pdf->Cell(20,5,number_format($rows_FACT["prix"],2,'.',''),1,'','R');
$pdf->Cell(32,5,number_format($rows_FACT["qte"]*$rows_FACT["prix"],2,'.',''),1,'','R');
$pdf->Cell(20,5,"20%",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');

$total=$total + number_format($rows_FACT["qte"]*$rows_FACT["prix"],2,'.','');
$ecotaxe=$ecotaxe + number_format($rows_FACT["qte"]*$rows_FACT["ecotax"],2,'.','');
}

$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,"Total commandes ",1,'','L');
$pdf->Cell(52,5,number_format($total,2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');
if($rows_FACT["mod_liv"]==2){
$mod_live="Frais de livraison à l'étage ";
}else{
$mod_live="Frais de livraison ";
}
$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,$mod_live,1,'','L');
$pdf->Cell(52,5,number_format($rows_FACT["frais_liv"],2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');
$Totalreduction=number_format($rows_FACT["Reduction"],2,'.','');
$totalttc=number_format($total + $ecotaxe + $rows_FACT["frais_liv"] - $Totalreduction,2,'.','');

$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,"Ecotaxe ",1,'','L');
$pdf->Cell(52,5,number_format($ecotaxe,2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');
if($Totalreduction>0){
//Prix reduction
$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,"Reduction ",1,'','L');
$pdf->Cell(52,5,number_format($Totalreduction,2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');
}
//Prix total TTC
$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,"Prix total TTC ",1,'','L');
$pdf->Cell(52,5,number_format($totalttc,2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');

//Prix total TTC / 1,196
$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,"Prix total HT ",1,'','L');
$totalht= number_format($totalttc/1.2,2,'.','');
$pdf->Cell(52,5,number_format($totalht,2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');


//Prix total HT x 0,196
$pdf->Cell(110,5,"",0,'','C');
$pdf->Cell(30,5,"TVA à 20% ",1,'','L');
$pdf->Cell(52,5,number_format($totalht*0.20,2,'.','')." EUR",1,'','R');
$pdf->Cell(0,5,'',0,1,'C');


$pdf->Output();
}



J'ai une page blanche. j'ai vérifié si les requêtes elles récupèrent les données c'est ok
la page qui déclenche l'action aussi elle fonctionne
A voir également: