Bonjour,

j'essaie de créer un tableau en pdf ce tableau devrais avoir plusieurs lignes avec mes données récupéré dans ma base de donnée mysql mais il ne m'affiche qu'une seul ligne voici mon script ci dessous

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php 
include "".$_SERVER['DOCUMENT_ROOT']."/admin/include/mysql_connect.php"; 
 
$debut_periode = $_POST['periode'];
$debut_periode2 = strftime("%d/%m/%Y",strtotime($debut_periode));
 
$fin_periode = date ( 'Y-m-d' , mktime ( 0,0,0, substr( $debut_periode , 5 , 2 ) +1 ,substr( $debut_periode , 8 , 2 ) -1 ,substr( $debut_periode , 0 , 4 )));
$fin_periode2 = strftime("%d/%m/%Y",strtotime($fin_periode));
 
//$sql2 = "SELECT montant,description,type FROM paiement WHERE date>='$debut_periode' AND date<='$fin_periode' ORDER BY date DESC";
 
 
 
include("phpToPDF.php");
$PDF=new phpToPDF();
$PDF->AddPage();
$PDF->SetTextColor(0, 0, 0);
$PDF->SetFont('Arial','B',8);
$PDF->Write(4, "INFONET CREATION\n\n");
$PDF->SetFont('Arial','B',13);
$PDF->Write(4, "Chiffre d'affaire pour la période du ".$debut_periode2." au ".$fin_periode2." (en Euros)\n\n");
 
// Définition des propriétés du tableau.
$proprietesTableauA = array(
	'TB_ALIGN' => 'R',
	'L_MARGIN' => 1,
	'BRD_COLOR' => array(0,0,0),
	'BRD_SIZE' => '0.2',
	);
 
// Définition des propriétés du header du tableau.	
$proprieteHeaderA = array(
	'T_COLOR' => array(0,0,0),
	'T_SIZE' => 8,
	'T_FONT' => 'Arial',
	'T_ALIGN' => 'C',
	'V_ALIGN' => 'M',
	'T_TYPE' => 'B',
	'LN_SIZE' => 5,
	'BG_COLOR' => array(255, 255, 255),
	'BRD_COLOR' => array(0,0,0),
	'BRD_SIZE' => 0.2,
	'BRD_TYPE' => '1',
	'BRD_TYPE_NEW_PAGE' => '',
	);
 
// Définition des propriétés du header du tableau.	
$proprieteHeaderB = array(
	'T_COLOR' => array(0,0,0),
	'T_SIZE' => 8,
	'T_FONT' => 'Arial',
	'T_ALIGN' => 'C',
	'V_ALIGN' => 'M',
	'T_TYPE' => 'B',
	'LN_SIZE' => 5,
	'BG_COLOR' => array(216, 228, 232),
	'BRD_COLOR' => array(0,0,0),
	'BRD_SIZE' => 0.2,
	'BRD_TYPE' => '1',
	'BRD_TYPE_NEW_PAGE' => '',
	);
 
 
// Contenu du header du tableau.	
$contenuHeaderA = array(25, 25, 65, 25, 25, 25, "[CB]Date écriture", "[CB]N° de pièce", "[CB]Libellé de l'écriture", "[CB]Montant débit", "[CB]Mintant crédit", "[CB]Solde cumulé");
 
// Définition des propriétés du reste du contenu du tableau.	
$proprieteContenuA = array(
	'T_COLOR' => array(0,0,0),
	'T_SIZE' => 8,
	'T_FONT' => 'Arial',
	'T_ALIGN_COL0' => 'C',
	'T_ALIGN' => 'C',
	'V_ALIGN' => 'M',
	'T_TYPE' => '',
	'LN_SIZE' => 5,
	'BG_COLOR' => array(255, 255, 255),
	'BRD_COLOR' => array(0,0,0),
	'BRD_SIZE' => 0.1,
	'BRD_TYPE' => '1',
	'BRD_TYPE_NEW_PAGE' => '',
	);	
 
 
$sql2 = "SELECT DATE_FORMAT(date,'%d/%m/%Y') as  date,num_paie,description,type,id FROM paiement WHERE date>='".$debut_periode."' AND date<='".$fin_periode."'";
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql2.'<br>'.mysql_error());
 
$i = 1;
$debut_solde = 0;
while($data2 = mysql_fetch_array($req2)) 
{
$sql10 = mysql_query("SELECT montant FROM paiement WHERE id='".$data2['id']."'") or die (mysql_error());
list($montant) = mysql_fetch_row($sql10);
 
 
if ($data2['type']=='credit')
{
$credit_aff = "".sprintf('%.2f', $montant)."";
$debit_aff = '0.00';
}
if ($data2['type']=='debit')
{
$debit_aff = "".sprintf('%.2f', $montant)."";
$credit_aff = '0.00';
}
$solde = $debut_solde+$credit_aff-$debit_aff;
 
 
 
if ($montant=='')
{
$tarif = '0.00';
}
else
{
$tarif = "".sprintf('%.2f', $montant)."";
}
$tarif_nul = "0.00";
 
if ($i<10)
{
$aff_id = "000".$i."";
}
elseif ($i>=10 AND $i<100)
{
$aff_id = "00".$i."";
}
 
$contenuTableauA1 = "".$data2['date']."\n";
$contenuTableauA2 = "".$data2['num_paie']."\n";
$contenuTableauA3 = "[L]".$data2['description']."\n";
$contenuTableauA4 = "[R]".$debit_aff."\n";
$contenuTableauA5 = "[R]".$credit_aff."\n";
$contenuTableauA6 = "[R]".sprintf('%.2f', $solde)."\n";
$i++;
$debut_solde = $solde;
 
$contenuA = array($contenuTableauA1,$contenuTableauA2,$contenuTableauA3,$contenuTableauA4,$contenuTableauA5,$contenuTableauA6);
 
}	
 
 
 
 
 
 
$PDF->drawTableau($PDF, $proprietesTableauA, $proprieteHeaderB, $contenuHeaderA, $proprieteContenuA, $contenuA);
 
$sql20 = mysql_query("SELECT SUM(montant) FROM paiement WHERE type='debit' AND date>='".$debut_periode."' AND date<='".$fin_periode."'") or die (mysql_error());
list($total_debit) = mysql_fetch_row($sql20);
 
$sql30 = mysql_query("SELECT SUM(montant) FROM paiement WHERE type='credit' AND date>='".$debut_periode."' AND date<='".$fin_periode."'") or die (mysql_error());
list($total_credit) = mysql_fetch_row($sql30);
 
$total_cumule = $total_credit-$total_debit;
 
// Contenu du header du tableau.	
$contenuHeaderB = array(25, 25, 25, "[CB]Total débit", "[CB]Total crédit", "[CB]Total cumulé");
$contenuB = array("[R]".sprintf('%.2f', $total_debit)."", "[R]".sprintf('%.2f', $total_credit)."", "[R]".sprintf('%.2f', $total_cumule)."");
$PDF->drawTableau($PDF, $proprietesTableauA, $proprieteHeaderB, $contenuHeaderB, $proprieteContenuA, $contenuB);
 
 
 
 
 
 
$PDF->Output();
 
?>