Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/02/2012, 14h09   #1
Nouveau Membre du Club
 
Inscription : juin 2005
Messages : 140
Détails du profil
Informations forums :
Inscription : juin 2005
Messages : 140
Points : 28
Points : 28
Envoyer un message via MSN à jules_diedhiou Envoyer un message via Yahoo à jules_diedhiou
Par défaut affichage en dernier enregistrement fpdf

je suis entrain de faire une commande avec fpdf j'aimerai que la somme total se trouve a la fin du dernier enregistrement mais j'y arrive pas
Code :
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
250
251
252
253
254
255
256
257
258
259
260
261
262
 
 
<?php 
require('fpdf/fpdf.php'); 
include "connexion/connexion.php"; 
$code_cde=( @$_POST["code_cde"] ) 
             ?  @$_POST["code_cde"] 
			 :  @$_GET["code_cde"] ;  
 
//echo "<input type=hidden value=$code_cde name=\"code_cde\" />";			  
ob_end_clean();  
 
$pdf=new FPDF('P','mm','A4'); 
$pdf->AcceptPageBreak(true); 
$pdf->AliasNbPages(); 
mysql_select_db($database_connexion, $connexion); 
$insertSQL1 = "select code_article,designation,quantite,colisage,remise,tarif,prix_unitaire,total_ligne,nom_client,date_commande,cdemateriel,dossier,correspondant from commandes where code_commande =".$code_cde."";	 
$query1 = mysql_query($insertSQL1,$connexion) or die(mysql_error()); 
$row1  = mysql_fetch_row($query1);		 
$num = mysql_num_rows($query1);	  
	if($row1){ 
 
$pdf->Open(); 
$pdf->AddPage(); 
$pdf->Image('images/Logo SOLEA Afrique.jpg',5,5, 35, 25); 
 
//Police Arial gras 12 
	//Arial gras 15 
	$pdf->SetFont('Arial','B',9); 
	$pdf->SetDrawColor(255,255,255); 
	$pdf->SetFillColor(255,255,255); 
	$pdf->SetTextColor(0,0,0); 
		//Epaisseur du cadre (1 mm) 
$pdf->SetLineWidth(0.00); 
 
$bp='BP:27250 - Dakar'; 
$tel ='Tél.: 33 842 55 05'; 
$tel = utf8_decode($tel); 
$fax= 'Fax : 33821 10 09'; 
$email = 'E-mail:solea@solea-afrique.fr'; 
$site = 'Site : www.solea-afrique.fr'; 
$pdf->SetXY(43,5); 
$pdf->Cell(20,4,$bp,1,1,'C',true); 
$pdf->SetXY(43,10); 
$pdf->Cell(20,4,$tel,1,1,'C',true); 
$pdf->SetXY(43,15); 
$pdf->Cell(20,4,$fax,1,1,'C',true); 
$pdf->SetXY(54,20); 
$pdf->Cell(20,4,$email,1,1,'C',true); 
$pdf->SetXY(52,25); 
$pdf->Cell(20,4,$site,1,1,'C',true); 
/****/ 
$pdf->SetFont('Times','B',15); 
$pdf->SetTextColor(51,102,255); 
$pdf->SetXY(110,5); 
$pdf->Cell(20,4,'GLOBO',1,1,'C',true); 
$pdf->SetXY(146,5); 
$pdf->Cell(20,4,'LINEA VERDACE',1,1,'C',true); 
$pdf->SetXY(185,5); 
$pdf->Cell(20,4,'KANLUX',1,1,'C',true); 
$pdf->SetXY(115,20); 
$pdf->Cell(20,4,'PAULMAN',1,1,'C',true); 
$pdf->SetXY(146,20); 
$pdf->Cell(20,4,'NAEVE',1,1,'C',true); 
$pdf->SetXY(185,20); 
$pdf->Cell(20,4,'SLV',1,1,'C',true); 
/*$pdf->SetXY(83,10); 
$pdf->Cell(20,4,'LINEA VERDACE',1,1,'C',true); 
$pdf->SetXY(43,15); 
$pdf->Cell(20,4,'KANLUX',1,1,'C',true); 
$pdf->SetXY(54,20); 
$pdf->Cell(20,4,'PAULMAN',1,1,'C',true); 
$pdf->SetXY(52,25); 
$pdf->Cell(20,4,'NAEVE',1,1,'C',true); 
$pdf->Cell(20,4,'PAULMAN',1,1,'C',true); 
$pdf->SetXY(52,25); 
$pdf->Cell(20,4,'SLV',1,1,'C',true); 
/***/ 
	} 
	$pdf->SetFont('Arial','B',9); 
	$pdf->SetTextColor(0,0,0); 
	$pdf->SetLineWidth(0.05); 
$pdf->Ln(1); 
$pdf->SetDrawColor(0,80,180); 
$pdf->SetFillColor(221,221,221); 
$pdf->SetXY(110,40); 
$pdf->SetFont('Arial','B',6); 
$pdf->Cell(25,4,'Client:',1,0,'C',true); 
 
$pdf->Cell(40,4,$row1[8],1,0,'C'); 
$pdf->SetXY(110,45); 
$pdf->Cell(25,4,'Date:',1,0,'C',true); 
$ref = "Référence" ; 
$ref = utf8_decode($ref); 
$mat = "Votre CDE Matériel"; 
$mat = utf8_decode($mat); 
$pdf->Cell(40,4,$row1[9],1,0,'C'); 
$pdf->SetXY(25,40); 
$pdf->SetFont('Arial','B',8); 
$pdf->Cell(35,4,''.$ref.' de l\'affaire',1,0,'C',true); 
$pdf->SetFont('Arial','B',6); 
$pdf->SetXY(25,45); 
$pdf->Cell(25,4,''.$mat.':',1,0,'C',true); 
$pdf->Cell(40,4,$row1[10],1,0,'C'); 
$pdf->SetXY(25,50); 
$pdf->Cell(25,4,'Notre Dossier:',1,0,'C',true); 
$pdf->Cell(40,4,$row1[11],1,0,'C'); 
$pdf->SetXY(25,55); 
$pdf->Cell(25,4,'Correspondant:',1,0,'C',true); 
$pdf->Cell(40,4,$row1[12],1,0,'C'); 
$pdf->SetXY(78,62); 
$pdf->SetFont('Arial','B',16); 
$pdf->Cell(40,4,'DESCRIPTIF',0,0,'C'); 
$pdf->Ln(12); 
$pdf->SetFont('Arial','B',6); 
$qte="Qté"; 
$qte = utf8_decode($qte); 
	$pdf->SetX(5); 
	$pdf->SetFillColor(200,200,200); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(35,4,'Image',1,0,'C',true); 
	$pdf->SetFont('Arial','B',8); 
$pdf->Cell(20,4,'REFERENCE',1,0,'C',true); 
$pdf->SetFont('Arial','B',8); 
$pdf->Cell(65,4,'DESIGNATION',1,0,'C',true); 
$pdf->Cell(10,4,$qte,1,0,'C',true); 
$pdf->Cell(10,4,'Colis',1,0,'C',true); 
$pdf->Cell(15,4,'Remise',1,0,'C',true); 
$pdf->Cell(15,4,'TARIF',1,0,'C',true); 
$pdf->Cell(15,4,'PU NET',1,0,'C',true); 
$pdf->Cell(15,4,'TOTAL',1,0,'C',true); 
 
$pdf->Ln(4); 
$montant_total = 0; 
$i = 20; 
$j = 0; 
while(($row1) and($j<9)){ 
 
	$montant_total = round(($montant_total+$row1[7]),2); 
	$designation=utf8_decode($row1[1]); 
	$maj =strtoupper($row1[0]); 
	$imageUrlpng= 'images/'.$row1[0].'.png'; 
	$imageUrljpg= 'images/'.$row1[0].'.jpg'; 
	/// $pdf->Image($imageUrl,5,0, 15, 10); 
$filenamepng = $imageUrlpng ;  
$filenamejpg = $imageUrljpg ; 
if ((file_exists($filenamepng ))and (!file_exists($filenamejpg ))) {  
   $image = $pdf->Image($filenamepng,9,60+$i, 20, 17); 
} else if ((!file_exists($filenamepng )) and (file_exists($filenamejpg ))){  
 $image = $pdf->Image($filenamejpg,9,60+$i, 20, 17); 
} else  if ((!file_exists($filenamepng)) and (!file_exists($filenamejpg ))){ 
	$image = "Pas d'image"; 
	} 
$pdf->SetX(5); 
 
$pdf->Cell(35,20,$image ,1,0,'C'); 
$pdf->Cell(20,20,$row1[0],1,0,'C'); 
$pdf->SetFont('Arial','',6); 
$pdf->Cell(65,20,$designation,1,0,'L'); 
$pdf->SetFont('Arial','B',8); 
$pdf->Cell(10,20,$row1[2],1,0,'C'); 
$pdf->Cell(10,20,$row1[3],1,0,'C'); 
$pdf->Cell(15,20,$row1[4],1,0,'C'); 
$pdf->Cell(15,20,$row1[5],1,0,'C'); 
$pdf->Cell(15,20,$row1[6],1,0,'C'); 
$pdf->Cell(15,20,$row1[7],1,0,'C'); 
$pdf->Ln(20); 
 
 
$row1  = mysql_fetch_row($query1); 
$i =$i+20; 
$j++; 
} 
if($row1) { 
	$pdf->AddPage(); 
	$pdf->SetX(5); 
	$pdf->SetFillColor(200,200,200); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(35,4,'Image',1,0,'C',true); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(20,4,'REFERENCE',1,0,'C',true); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(65,4,'DESIGNATION',1,0,'C',true); 
	$pdf->Cell(10,4,$qte,1,0,'C',true); 
	$pdf->Cell(10,4,'Colis',1,0,'C',true); 
	$pdf->Cell(15,4,'Remise',1,0,'C',true); 
	$pdf->Cell(15,4,'TARIF',1,0,'C',true); 
	$pdf->Cell(15,4,'PU NET',1,0,'C',true); 
	$pdf->Cell(15,4,'TOTAL',1,0,'C',true); 
	$j=0; 
	$i=-50; 
	$pdf->ln(4); 
} 
while(($row1) and($j<12)){ 
 
	$montant_total = round(($montant_total+$row1[7]),2); 
	$designation=utf8_decode($row1[1]); 
	$maj =strtoupper($row1[0]); 
	$imageUrlpng= 'images/'.$row1[0].'.png'; 
	$imageUrljpg= 'images/'.$row1[0].'.jpg'; 
	/// $pdf->Image($imageUrl,5,0, 15, 10); 
$filenamepng = $imageUrlpng ;  
$filenamejpg = $imageUrljpg ; 
if (file_exists($filenamepng )and !file_exists($filenamejpg )) {  
   $image = $pdf->Image($filenamepng ,9,65+$i, 20, 17); 
} else if (!file_exists($filenamepng )and file_exists($filenamejpg )){  
 $image = $pdf->Image($filenamejpg ,9,65+$i, 20, 17); 
} else  if ((!file_exists($filenamepng)) and (!file_exists($filenamejpg ))){ 
	$image = "Pas d'image"; 
	} 
	/// $pdf->Image($imageUrl,5,0, 15, 10); 
 
$pdf->SetX(5); 
 
$pdf->Cell(35,20, $image,1,0,'C'); 
$pdf->Cell(20,20,$row1[0],1,0,'C'); 
$pdf->SetFont('Arial','',6); 
$pdf->Cell(65,20,$designation,1,0,'L'); 
$pdf->SetFont('Arial','B',8); 
$pdf->Cell(10,20,$row1[2],1,0,'C'); 
$pdf->Cell(10,20,$row1[3],1,0,'C'); 
$pdf->Cell(15,20,$row1[4],1,0,'C'); 
$pdf->Cell(15,20,$row1[5],1,0,'C'); 
$pdf->Cell(15,20,$row1[6],1,0,'C'); 
$pdf->Cell(15,20,$row1[7],1,0,'C'); 
$pdf->Ln(20); 
 
 
$row1  = mysql_fetch_row($query1); 
$i =$i+20; 
$j++; 
if($j==12 and $row1) { 
	$pdf->AddPage(); 
	$pdf->SetX(5); 
	$pdf->SetFillColor(200,200,200); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(35,4,'Image',1,0,'C',true); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(20,4,'REFERENCE',1,0,'C',true); 
	$pdf->SetFont('Arial','B',8); 
	$pdf->Cell(65,4,'DESIGNATION',1,0,'C',true); 
	$pdf->Cell(10,4,$qte,1,0,'C',true); 
	$pdf->Cell(10,4,'Colis',1,0,'C',true); 
	$pdf->Cell(15,4,'Remise',1,0,'C',true); 
	$pdf->Cell(15,4,'TARIF',1,0,'C',true); 
	$pdf->Cell(15,4,'PU NET',1,0,'C',true); 
	$pdf->Cell(15,4,'TOTAL',1,0,'C',true); 
	$j=0; 
	$i=-50; 
	$pdf->ln(4); 
} 
} 
 
//$i =$i+20; 
//$pdf->Ln(50); 
$pdf->SetXY(150,$num+120); 
$pdf->Cell(30,4,'Total(FCFA):',1,0,'C',true); 
$pdf->SetXY(185,$num+120); 
$pdf->Cell(20,5,$montant_total,1,0,'L'); 
$pdf->Ln(20); 
$pdf->Output(); 
	?>
jules_diedhiou est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h56.


 
 
 
 
Partenaires

Hébergement Web