1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
<?php
// Appel de la librairie FPDF
include("_connexion.php");
//require('../fpdf.php');
include("../phpToPDF.php");
$dateform1 = $datedeb;
list($jour,$mois,$annee) = explode("/",$dateform1);
$C1 = $annee."/".$mois."/".$jour;
$dateform2 = $datefin;
list($jour,$mois,$annee) = explode("/",$dateform2);
$C2 = $annee."/".$mois."/".$jour;
$req2 ="SELECT DATE_FORMAT(datesortie,'%d/%m/%Y') AS DateTempS, DATE_FORMAT(datentree,'%d/%m/%Y') AS DateTempE, stock, types, chassis, prestations, prixhtmvt,codecarburant, carburant, totalcarburant, bon FROM tempfact1
WHERE client='$pseudo' && datesortie >='$datedeb' && datesortie <='$datefin' && neuf='$neuf' order by datesortie asc";
$inventaire = mysql_query($req2);
$PDF = new phpToPDF('L','mm','A4');
$PDF->AliasNbPages();
$PDF->AddPage();
$PDF->SetAutoPageBreak(true,10);
$PDF->setXY(0,5);
//la j'ai juste ajouté un titre
$PDF->SetFont('Arial','B',12);
$PDF->Cell(0,6,'',0,1,'L');
$PDF->Cell(0,5,'Client : '.$pseudo.'',0,1,'L');
$PDF->Cell(0,5,'Facturation entre : '.$C1.' et '.$C2.' -- Vehicules neufs',0,1,'L');
// Définition des propriétés du tableau.
$proprietesTableau = array(
'TB_ALIGN' => 'C',
'L_MARGIN' => 0,
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0.3,
);
// Définition des propriétés du header du tableau.
$proprieteHeader = array(
'T_COLOR' => array(150,10,10),
'T_SIZE' => 12,
'T_FONT' => 'Arial',
'T_ALIGN_COLO' => 'C',
'T_ALIGN' => 'C',
'V_ALIGN' => 'M',
'T_TYPE' => 'B',
'LN_SIZE' => 4,
'BG_COLOR_COL0' => array(192, 192, 192),
'BG_COLOR' => array(192, 192, 192),
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0.2,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
// Contenu du header du tableau.
// la j'ai modifié pour coller à ma table mais ça reviens au même
$contenuHeader = array(
30, 20 , 30 ,30 ,60 , 30 , 15, 20, 20, 20,
"Date Sortie", "Stock", "Type","Chassis","Prestations","Prix HT en euros","Carb.","NB li Carb.","Tot Carb.","Bon");
// Définition des propriétés du reste du contenu du tableau.
$proprieteContenu = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 10,
'T_FONT' => 'Arial',
'T_ALIGN_COLO' => 'C',
'T_ALIGN' => 'C',
'V_ALIGN' => 'M',
'T_TYPE' => '',
'LN_SIZE' => 4,
'BG_COLOR_COL0' => array(255, 255, 255),
'BG_COLOR' => array(255,255,255),
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0.1,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
// Contenu du tableau.
$contenuTableau = array();
// pareil modification pour coller aux tables.
while ($tab = mysql_fetch_array($inventaire)) {
array_push($contenuTableau,
$tab['DateTempS'],
$tab['stock'],
$tab['types'],
$tab['chassis'],
$tab['prestations'],
$tab['prixhtmvt'],
$tab['codecarburant'],
$tab['carburant'],
$tab['totalcarburant'],
$tab['bon']);
}
$PDF->drawTableau($PDF, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau);
$PDF->Ln(10);
// tableau 2
// 3 eme tableau recapitulatif facture
$requete2=("Select prestations,COUNT(prestations) as nbprest,prixhtmvt FROM tempfact1
WHERE client='$pseudo' && datesortie >='$datedeb' && datesortie <='$datefin' && neuf='$neuf' GROUP BY prestations,prixhtmvt ");
$var_prest = mysql_query($requete2);
$contenuHeader = array(40,40,40,"Prestations", "Nombre de Prestations", "Prix Unit Prestation");
// Contenu du tableau.
$contenuTableau = array();
// pareil modification pour coller aux tables.
while ($tab = mysql_fetch_array($var_prest)) {
array_push($contenuTableau,
$tab['prestations'],
$tab['nbprest'],
$tab['prixhtmvt']);
}
$PDF->drawTableau($PDF, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau);
$PDF->Ln(10);
//---------------------------------------------------------
// 3 eme tableau recapitulatif facture
//on renseigne le tableau
//requete2=mysql_query("Select SUM(prixhtmvt) as totprest, SUM(totalcarburant) as totcarb, (SUM(prixhtmvt)+SUM(totalcarburant)) as totht, FORMAT(((SUM(prixhtmvt)+SUM(totalcarburant))*20)/100,2) as tva, FORMAT((SUM(prixhtmvt)+SUM(totalcarburant))*1.196,2) as ttc FROM tempfact1 WHERE client='GEMYCOGOLIN' && datesortie >='2018-08-01' && datesortie <='2018-08-31' && neuf='O' order by datesortie asc");
$requete3=mysql_query("Select FORMAT(SUM(prixhtmvt),2) as totprest,
FORMAT(SUM(totalcarburant),2) as totcarb,
FORMAT((SUM(prixhtmvt)+SUM(totalcarburant)),2) as totht,
FORMAT(((SUM(prixhtmvt)+SUM(totalcarburant))*20)/100,2) as tva,
FORMAT((SUM(prixhtmvt)+SUM(totalcarburant))*1.200,2) as ttc
FROM tempfact1
WHERE client='$pseudo' && datesortie >='$datedeb' && datesortie <='$datefin' && neuf='$neuf'
order by datesortie asc");
//on renseigne le tableau
$contenuHeader = array(45,40,40,40,40,"Total Prestations HT", "Total carburant HT","Total HT", "T.V.A","Total TTC en euros");
// Contenu du tableau.
$contenuTableau = array();
// pareil modification pour coller aux tables.
while ($tab = mysql_fetch_array($requete3)) {
array_push($contenuTableau,
$tab['totprest'],
$tab['totcarb'],
$tab['totht'],
$tab['tva'],
$tab['ttc']);
}
$PDF->drawTableau($PDF, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau);
$PDF->Output();
?> |
Partager