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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
<?php
//SHOW A DATABASE ON A PDF FILE
//CREATED BY: Carlos Vasquez S.
//E-MAIL: cvasquez@cvs.cl
//CVS TECNOLOGIA E INNOVACION
//SANTIAGO, CHILE
require('fpdf.php');
//Connect to your database
include_once("../db_connection.php");
//Select the Products you want to show in your PDF file
$result=mysql_query("select * from installation where identifiant='karim'");
$number_of_products = mysql_numrows($result);
//Initialize the 3 columns and the total
$column_identifiant = "";
$column_marque = "";
$column_type = "";
$column_date_fabrication = "";
$column_fusible= "";
$column_responsable = "";
$column_nom = "";
$column_gdo = "";
$column_date = "";
$column_identifiant11= "";
$column_puissance1 = "";
$column_type1= "";
$column_marque1 = "";
$column_date_fabrication1= "";
$column_fusible1= "";
$column_zone11= "";
//For each row, add the field to the corresponding column
while($row = mysql_fetch_array($result))
{
$identifiant = ($row["identifiant"]);
$marque = ($row["marque"]);
$type = ($row["type"]);
$date_fabrication = ($row["date_fabrication"]);
$fusible= ($row["fusible"]);
$responsable = ($row["responsable"]);
$nom = ($row["nom"]);
$gdo = ($row["gdo"]);
$date = ($row["date"]);
$identifiant11= ($row["identifiant11"]);
$puissance1 = ($row["puissance1"]);
$marque1 = ($row["marque1"]);
$type1 = ($row["type1"]);
$date_fabrication1 = ($row["date_fabrication1"]);
$fusible1= ($row["fusible1"]);
$zone11= ($row["zone11"]);
$column_identifiant = $column_identifiant.$identifiant."\n";
$column_marque = $column_marque.$marque."\n";
$column_type = $column_type.$type."\n";
$column_date_fabrication = $column_date_fabrication.$date_fabrication."\n";
$column_fusible= $column_fusible.$fusible."\n";
$column_responsable = $column_responsable.$responsable."\n";
$column_nom = $column_nom.$nom."\n";
$column_gdo = $column_gdo.$gdo."\n";
$column_date = $column_date.$date."\n";
$column_identifiant11 = $column_identifiant11.$identifiant11."\n";
$column_marque1 = $column_marque1.$marque1."\n";
$column_type1 = $column_type1.$type1."\n";
$column_date_fabrication1 = $column_date_fabrication1.$date_fabrication1."\n";
$column_fusible1= $column_fusible1.$fusible1."\n";
$column_zone11= $column_zone11.$zone11."\n";
}
mysql_close();
//Convert the Total Price to a number with (.) for thousands, and (,) for decimals.
//$total = number_format($total,',','.','.');
//Create a new PDF file
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',20);
$pdf->Cell(180,6,'TRANSFOMATEUR RESERVE',0,1,'C');
//Fields Name position
$Y_Fields_Name_position = 30;
//Table position, under Fields Name
$Y_Table_Position = 36;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(20);
$pdf->Cell(35,6,'IDENTIFIANT',1,0,'C',1);
$pdf->SetX(55);
$pdf->Cell(30,6,'MARQUE',1,0,'C',1);
$pdf->SetX(85);
$pdf->Cell(20,6,'TYPE',1,0,'C',1);
$pdf->SetX(105);
$pdf->Cell(50,6,'DATE FABRICATION',1,0,'C',1);
$pdf->SetX(155);
$pdf->Cell(30,6,'FUSIBLE',1,0,'C',1);
$pdf->Ln();
//Now show the 3 columns
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(20);
$pdf->MultiCell(35,6,$column_identifiant,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(55);
$pdf->MultiCell(30,6,$column_marque,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(85);
$pdf->MultiCell(20,6,$column_type,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(105);
$pdf->MultiCell(50,6,$column_date_fabrication,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(155);
$pdf->MultiCell(30,6,$column_fusible,1,'C');
$pdf->SetY(60);
$pdf->SetFont('Arial','B',20);
$pdf->Cell(180,6,'INFORMATIONS TRANSFORMATEUR A INSTALLER ',0,1,'C');
$Y_Fields_Name_position = 80;
//Table position, under Fields Name
$Y_Table_Position = 86;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(10);
$pdf->Cell(35,6,'RESPONSABLE',1,0,'C',1);
$pdf->SetX(45);
$pdf->Cell(40,6,'COMMUNE',1,0,'C',1);
$pdf->SetX(85);
$pdf->Cell(30,6,'GDO',1,0,'C',1);
$pdf->SetX(115);
$pdf->Cell(50,6,'DATE INSTALLATION',1,0,'C',1);
$pdf->SetX(165);
$pdf->Cell(30,6,'ECOLE',1,0,'C',1);
$pdf->Ln();
//Now show the 3 columns
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$column_responsable,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(45);
$pdf->MultiCell(40,6,$column_nom,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(85);
$pdf->MultiCell(30,6,$column_gdo,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(115);
$pdf->MultiCell(50,6,$column_date,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(165);
$pdf->MultiCell(30,6,'YYY',1,'C');
$pdf->SetY(60);
$pdf->SetFont('Arial','B',20);
$pdf->Cell(180,6,'INFORMATIONS TRANSFORMATEUR A INSTALLER ',0,1,'C');
$Y_Fields_Name_position = 80;
//Table position, under Fields Name
$Y_Table_Position = 86;
$pdf->SetY(110);
$pdf->SetFont('Arial','B',20);
$pdf->Cell(180,6,'TRANSFOMATEUR A RETOURNER AU PARC',0,1,'C');
//Fields Name position
$Y_Fields_Name_position = 130;
//Table position, under Fields Name
$Y_Table_Position = 136;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(10);
$pdf->Cell(35,6,'IDENTIFIANT',1,0,'C',1);
$pdf->SetX(45);
$pdf->Cell(30,6,'MARQUE',1,0,'C',1);
$pdf->SetX(75);
$pdf->Cell(20,6,'TYPE',1,0,'C',1);
$pdf->SetX(95);
$pdf->Cell(50,6,'DATE FABRICATION',1,0,'C',1);
$pdf->SetX(145);
$pdf->Cell(30,6,'FUSIBLE',1,0,'C',1);
$pdf->SetX(175);
$pdf->Cell(20,6,'ZONE',1,0,'C',1);
$pdf->Ln();
//Now show the 3 columns
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$column_identifiant11,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(45);
$pdf->MultiCell(30,6,$column_marque1,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(75);
$pdf->MultiCell(20,6,$column_type1,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(95);
$pdf->MultiCell(50,6,$column_date_fabrication1,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(145);
$pdf->MultiCell(30,6,$column_fusible1,1,'C');
$pdf->SetY($Y_Table_Position);
$pdf->SetX(175);
$pdf->MultiCell(20,6,$column_zone11,1,'C');
$pdf->Output();
?> |
Partager