diff --git a/htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php b/htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php index 1254041b838..84289c8430e 100644 --- a/htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php @@ -66,14 +66,17 @@ class BordereauChequeBlochet $pdf->SetFont('Arial','B',10); $pdf->Text(11, 10, $title); - $pdf->SetFont('Arial','B',10); - $pdf->Text(91, 10, $langs->transnoentities("Numero")." : ".$this->number); - - $pdf->SetFont('Arial','B',10); - $pdf->Text(11, 16, $langs->transnoentities("Date")." : ".dolibarr_print_date(time(),"%d %b %Y")); - $pdf->SetFont('Arial','',10); - $pdf->Text(91, 16, $langs->transnoentities("Page")." : ".$page); + $pdf->Text(10, 19, $langs->transnoentities("Numero")); + + $pdf->SetFont('Arial','',12); + $pdf->Text(42, 19, $this->number); + + $pdf->SetFont('Arial','',10); + $pdf->Text(10, 27, $langs->transnoentities("Date") ); + + $pdf->SetFont('Arial','',12); + $pdf->Text(42, 27, dolibarr_print_date(time(),"%d %b %Y")); $pdf->SetFont('Arial','',8); $pdf->Text(11,$this->tab_top + 6,$langs->transnoentities("Bank")); @@ -92,13 +95,17 @@ class BordereauChequeBlochet $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); - $pdf->Rect(9, 30, 192, 15); - $pdf->line(9, 38, 201, 38); + $pdf->Rect(9, 14, 192, 31); + $pdf->line(9, 22, 112, 22); + $pdf->line(9, 30, 112, 30); + $pdf->line(9, 38, 112, 38); - $pdf->line(40, 30, 40, 45); + $pdf->line(40, 14, 40, 45); $pdf->line(55, 38, 55, 45); $pdf->line(70, 38, 70, 45); $pdf->line(102, 38, 102, 45); + $pdf->line(112, 14, 112, 45); + // $pdf->line(132, 30, 132, 45); $pdf->SetFont('Arial','',10); $pdf->Text(10, 35, "Titulaire"); @@ -113,6 +120,14 @@ class BordereauChequeBlochet $pdf->Text(72, 43, $this->account->number); $pdf->Text(104, 43, $this->account->cle_rib); + $pdf->SetFont('Arial','',10); + $pdf->Text(114, 19, "Signature"); + + $pdf->Rect(9, 47, 192, 7); + $pdf->line(55, 47, 55, 54); + $pdf->line(140, 47, 140, 54); + $pdf->line(180, 47, 180, 54); + $pdf->SetFont('Arial','',10); } diff --git a/htdocs/compta/paiement/cheque/remisecheque.class.php b/htdocs/compta/paiement/cheque/remisecheque.class.php index f1d70ec2d89..34bd4d163d6 100644 --- a/htdocs/compta/paiement/cheque/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/remisecheque.class.php @@ -290,7 +290,7 @@ class RemiseCheque { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " SET statut=1, number='".($num+1)."'"; - $sql .= " WHERE rowid = $this->id;"; + $sql .= " WHERE rowid = $this->id AND statut=0;"; $resql = $this->db->query($sql); if ( $resql ) @@ -334,7 +334,6 @@ class RemiseCheque \return int, 0 en cas de succes \todo Finir la gestion multi modèle */ - function GeneratePdf($model='Blochet') { require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php"); @@ -381,20 +380,24 @@ class RemiseCheque { $this->errno = 0; $this->db->begin(); + $total = 0; - $sql = "SELECT sum(amount) "; + $sql = "SELECT amount "; $sql.= " FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE fk_bordereau = $this->id;"; $resql = $this->db->query($sql); if ( $resql ) { - $row = $this->db->fetch_row($resql); - $total = $row[0]; - + while ( $row = $this->db->fetch_row($resql) ) + { + $total += $row[0]; + } + + $this->db->free($resql); $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET amount='$total'"; + $sql.= " SET amount='".ereg_replace(",",".",$total)."'"; $sql.= " WHERE rowid='".$this->id."';"; $resql = $this->db->query($sql); if (!$resql) @@ -437,8 +440,12 @@ class RemiseCheque $sql.= " SET fk_bordereau = 0 "; $sql.= " WHERE rowid = '".$account_id."' AND fk_bordereau='".$this->id."';"; $resql = $this->db->query($sql); - if (!$resql) - { + if ($resql) + { + $this->UpdateAmount(); + } + else + { $this->errno = -1032; dolibarr_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)"); }