From f1743daf2109699853ea5c57f2a7e90b1edee822 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 21 Dec 2006 21:06:34 +0000 Subject: [PATCH] Nouvelle gestion des PDF --- .../paiement/cheque/remisecheque.class.php | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/cheque/remisecheque.class.php b/htdocs/compta/paiement/cheque/remisecheque.class.php index 41e2de65ea0..d726ba2971a 100644 --- a/htdocs/compta/paiement/cheque/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/remisecheque.class.php @@ -310,9 +310,7 @@ class RemiseCheque if ($this->errno === 0) { - require_once(DOL_DOCUMENT_ROOT ."/compta/paiement/cheque/pdf/pdf_blochet.class.php"); - $pdf = new BordereauChequeBlochet($db); - $pdf->write_pdf_file(DOL_DATA_ROOT.'/compta/bordereau', ($num+1) ); + $this->GeneratePdf(); } if ($this->errno === 0) @@ -328,6 +326,37 @@ class RemiseCheque return $this->errno; } + function GeneratePdf() + { + require_once(DOL_DOCUMENT_ROOT ."/compta/paiement/cheque/pdf/pdf_blochet.class.php"); + $pdf = new BordereauChequeBlochet($db); + + $sql = "SELECT b.banque, b.emetteur, b.amount "; + $sql .= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba "; + $sql .= " , ".MAIN_DB_PREFIX."bordereau_cheque as bc"; + $sql .= " WHERE b.fk_account = ba.rowid AND b.fk_bordereau = bc.rowid"; + $sql .= " AND bc.rowid = ".$this->id.";"; + + $result = $this->db->query($sql); + + if ($result) + { + $i = 0; + $var=True; + + while ( $objp = $this->db->fetch_object($result) ) + { + $pdf->lines[$i][0] = $objp->banque; + $pdf->lines[$i][1] = $objp->emetteur; + $pdf->lines[$i][2] = price($objp->amount); + $i++; + } + } + $pdf->number = $this->number; + + $pdf->write_pdf_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number ); + } + /** \brief Mets a jour le montant total \return int, 0 en cas de succes