Bonjour, j'ai un soucis avec des tableaux que je remplis à partir d'une base de donnée, sur un fichier pdf à l'aide de fpdf.
Mon tableau comporte une entête que j'ai placé dans l’entête de la classe FPDF. lorsque les information ne remplissent qu'une page , tout se déroule bien mais à partir de la deuxième page le corps du tableau remonte légèrement dans l’entête du tableau et je ne comprend pas pourquoi.

Merci de bien vouloir m'aider !

mon code :
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
<?php
require_once '../librairie/fpdf/fpdf.php';
 
class PDF extends FPDF
{
// Entête
    function Header()
    {
        require '../fonction/connexion.php';
        require_once '../fonction/Dates.php';
 
        if (isset($_GET['id']))
        {
            $idpot = $_GET['id'];
        }
        // Récupération des informations du dépôt
        $sql = "SELECT * FROM banque, client, depoterme, dossier, modrembours WHERE(banque.id_banq = client.id_banq AND client.id_client = depoterme.id_client AND depoterme.id_dossier = dossier.id_dossier AND depoterme.id_mod_rembours = modrembours.id_mod_rembours AND id_dpot = '$idpot')";
        $req = $DB->query($sql);
        $d = $req->fetch();
 
        //$this->ln(5);
        $this->Cell(60);
        $this->SetFont('Arial', 'B', 14);
        $this->SetLineWidth(0.5);
        $this->cell(75, 10, 'TABLEAU D\'AMORTISSEMENT', 1);
        $this->Cell(35);
        $this->SetFont('Arial', '', 7);
        $this->cell(0, 10, date('d/m/Y') , 0);
        $this->SetFont('Arial', '', 8);
        $this->ln(15);
        $this->Cell(4);
        $this->cell(15, 5, 'Capital : ', 0);
        $this->cell(50, 5, number_format($d['capt_dpot'],'0',',',' ').' Fcfa', 0);
        $this->cell(35, 5, utf8_decode('Bénéficiaire : '), 0);
        $this->cell(0, 5, utf8_decode($d['nom']), 0);
        $this->ln();
        $this->Cell(4);
        $this->cell(15, 5, utf8_decode('Durée : '), 0);
        $this->cell(50, 5, diffmois($d['deb_periode'],$d['fin_periode'] ).' mois', 0);
        $this->cell(35, 5, utf8_decode('Dossier : '), 0);
        $this->cell(0, 5, utf8_decode($d['lib_dossier']), 0);
        $this->ln();
        $this->Cell(4);
        $this->cell(15, 5, utf8_decode('Taux : '), 0);
        $this->cell(50, 5, ($d['tx_norm']*100).' %', 0);
        $this->cell(35, 5, utf8_decode('Mode remboursement : '), 0);
        $this->cell(0, 5, utf8_decode($d['lib_mod_rembours']), 0);
        $this->ln();
        $this->Cell(4);
        $this->cell(15, 5, utf8_decode('Date : '), 0);
        $this->cell(50, 5, dateFRW($d['date_operat']), 0);
        $this->cell(35, 5, utf8_decode('Domiciliataire : '), 0);
        $this->cell(45, 5, utf8_decode($d['sigle_banq']), 0);
        $this->SetFont('Arial', 'B', 7);
        $this->cell(0, 5, strtoupper(utf8_decode($d['lib_dpot'])), 0, 0, 'R');
 
        // Entete du tableau
        $this->SetFont('Arial', 'B', 8);
        $this->SetLineWidth(0);
        $this->ln(10);
        $this->cell(4, 10, " ", 0);
        $this->cell(5, 10, utf8_decode('N°'), 1, 0, 'C');
        $this->Cell(25, 10, utf8_decode('Date d\'échéance'), 1, 0, 'C');
        $this->Cell(35, 10, utf8_decode('Capital dû début période'), 1, 0, 'C');
        $this->Cell(25, 10, utf8_decode('Echéance'), 1, 0, 'C');
        $this->Cell(25, 10, utf8_decode('Intérêt'), 1, 0, 'C');
        $this->Cell(35, 10, utf8_decode('Amortissement capital'), 1, 0, 'C');
        $this->Cell(0, 10, utf8_decode('Capital dû fin période'), 1, 0, 'C');
 
    }
 
    // Pied de page
    function Footer()
    {
        // Positionnement à 1,5 cm du bas
        $this->SetY(-15);
        // Police Arial italique 8
        $this->SetFont('Arial', 'I', 8);
        // Numéro de page
        $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }
 
    function BasicTable()
    {
        require '../fonction/connexion.php';
 
        if (isset($_GET['id']))
        {
            $idpot = $_GET['id'];
        }
         // Récupération des échéances du dépôt
         $sql1 = "SELECT id_ech, num_ech, mont_ech, date_ech, cap_rest_deb, cap_rest_fin, part_cap, part_int, mont_rgl, date_rgl, id_etat FROM depoterme, version, echeancdepot WHERE (depoterme.id_dpot = version.id_dpot AND version.id_version = echeancdepot.id_version AND depoterme.id_dpot = '$idpot' AND version.id_version = (SELECT MAX(id_version) FROM version WHERE version.id_dpot = '$idpot'))";
         $req1 = $DB->query($sql1);
         $count = $req1->rowCount();
         $y = 1;
         while ($d1 = $req1->fetch())
         {   if($d1['id_etat'] == 2){
                 $x = '*';
             }else{
                 $x = ' ';
             }
             if($count > $y){
                 $this->SetFont('Arial', '', 8);
                 $this->ln();
                 $this->cell(4, 5, $x, 0, 0, 'C');
                 $this->cell(5, 5, $d1['num_ech'], 'LR', 0, 'C');
                 $this->Cell(25, 5, dateFRW($d1['date_ech']), 'LR', 0, 'C');
                 $this->Cell(35, 5, number_format($d1['cap_rest_deb'],'0',',',' '), 'LR', 0, 'R');
                 $this->Cell(25, 5, number_format($d1['mont_ech'],'0',',',' '), 'LR', 0, 'R');
                 $this->Cell(25, 5, number_format($d1['part_int'],'0',',',' '), 'LR', 0, 'R');
                 $this->Cell(35, 5, number_format($d1['part_cap'],'0',',',' '), 'LR', 0, 'R');
                 $this->Cell(0, 5, number_format($d1['cap_rest_fin'],'0',',',' '), 'LR', 0, 'R');
                 $y = $y + 1;
             }elseif($count == $y){
                 $this->SetFont('Arial', '', 8);
                 $this->ln();
                 $this->cell(4, 5, $x, 0, 0, 'C');
                 $this->cell(5, 5, $d1['num_ech'], 'LRB', 0, 'C');
                 $this->Cell(25, 5, dateFRW($d1['date_ech']), 'LRB', 0, 'C');
                 $this->Cell(35, 5, number_format($d1['cap_rest_deb'],'0',',',' '), 'LRB', 0, 'R');
                 $this->Cell(25, 5, number_format($d1['mont_ech'],'0',',',' '), 'LRB', 0, 'R');
                 $this->Cell(25, 5, number_format($d1['part_int'],'0',',',' '), 'LRB', 0, 'R');
                 $this->Cell(35, 5, number_format($d1['part_cap'],'0',',',' '), 'LRB', 0, 'R');
                 $this->Cell(0, 5, number_format($d1['cap_rest_fin'],'0',',',' '), 'LRB', 0, 'R');
             }
 
         }
 
        // Calcul des totaux
        $sql2 = "SELECT SUM(mont_ech) as montech, SUM(part_int) as partint, capt_dpot FROM echeancdepot, version, depoterme WHERE (depoterme.id_dpot = version.id_dpot AND version.id_version = echeancdepot.id_version AND depoterme.id_dpot = '$idpot' AND version.id_version = (SELECT MAX(id_version) FROM version WHERE version.id_dpot = '$idpot'))";
        $req2 = $DB->query($sql2);
        $d2 = $req2->fetch();
 
        $this->SetFont('Arial', 'B', 8);
        $this->ln();
        $this->cell(4);
        $this->Cell(65, 5, "TOTAL", 'LRB', 0, 'L');
        $this->Cell(25, 5, number_format($d2['montech'],'0',',',' '), 'LRB', 0, 'R');
        $this->Cell(25, 5, number_format($d2['partint'],'0',',',' '), 'LRB', 0, 'R');
        $this->Cell(35, 5, number_format($d2['capt_dpot'],'0',',',' '), 'LRB', 0, 'R');
        $this->Cell(0, 5, " ", 'LRB', 0, 'R');
     }
    }
 
// Instanciation de la classe dérivée
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->BasicTable();
$pdf->Output();