Bonsoir Imikado
Etant toujours sur mon projet je suis confronté a un problème de rendu. En effet au rendu avec Html2pdf, j'ai l'entête du tableau qui se répète :
Voici le code dans le main de mon module :
Code php : 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 public function _pdf(){ $tableauDobjet=model_mypaiment::getInstance()->findAll(); $sHTMLGlobal=''; foreach($tableauDobjet as $object){ $oView=$this->generateViewForObject($object); $sHTMLGlobal.=$oView->show(); } $html2pdf=new HTML2PDF('P','A4','fr'); $html2pdf->WriteHTML($sHTMLGlobal); $html2pdf->Output('fiche.pdf'); } public function generateViewForObject($object){ $oView=new _view('mypaiment::pdf'); $oView->tmypaiment=$object; $oView->tJoinmodel_naturepaiment=model_naturepaiment::getInstance()->getSelect(); $oView->tJoinmodel_modepaiment=model_modepaiment::getInstance()->getSelect(); $oView->tJoinmodel_paliers=model_paliers::getInstance()->getSelect(); return $oView; }
Le code de ma vue :
Code html : 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 <style type="text/css"> #centreur { width:100%; text-align:center; } .montableau { width:500px; margin:auto; } .montableau { border: medium solid #6495ed; border-collapse: collapse; width: 70%; } th { border: thin solid #6495ed; width: 20%; padding: 5px; background-color: #D0E3FA; } td { border: thin solid #6495ed; width: 20%; padding: 5px; text-align: center; background-color: #ffffff; } caption { font-family: sans-serif; } </style> <div id="centreur"> <table class="montableau" border="1"> <tr> <th>Code</th> <th>Nom Complet</th> <th>Palier</th> <th>Mode de Paiement</th> <th>Nature du Paiment</th> <th>Montant du Paiement</th> <th>Reference du Paiement</th> </tr> <tr> <td><?php echo $this->tmypaiment->codeunpai ?></td> <td><?php echo $this->tmypaiment->nomcomppai ?></td> <td><?php echo $this->tmypaiment->palierpai ?></td> <td><?php echo $this->tmypaiment->modepaie ?></td> <td><?php echo $this->tmypaiment->naturepai ?></td> <td><?php echo $this->tmypaiment->montpai ?></td> <td><?php echo $this->tmypaiment->refpai ?></td> </tr> </table> </div>
et voici mon rendu :
1 - Ici Code, Nom, Complet, Palier, Mode de Paiement, Nature du Paiement, Montant du Paiement, Reference du Paiement, se répètent pour chaque enregistrement, mais je ne sais comment résoudre se problème ? c'est à dire afficher une fois l’entête.
2 - Pour Palier, Mode de Paiement, Nature du Paiement je veux bien récupérer ces données afférentes mais il me ramène les clés étrangères. je pense qu'il est bien possible de le faire avec tJoinmodel_... un peu comme dans ma fonction liste :
extrait :
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <td><?php if(isset($this->tJoinmodel_paliers[$omypaiment->palierpai])) { echo $this->tJoinmodel_paliers[$omypaiment->palierpai];} else{ echo $omypaiment->palierpai ;}?></td>
Merci pour ton aide
Partager