Fix: Correction plantage paiement charges sociales si virgule dans le total.

This commit is contained in:
Laurent Destailleur 2004-11-30 20:54:51 +00:00
parent 2e76e0c52f
commit 8378ed315f

View File

@ -20,6 +20,17 @@
* $Source$ * $Source$
*/ */
/**
\file htdocs/chargesociales.class.php
\ingroup facture
\brief Fichier de la classe des charges sociales
\version $Revision$
*/
/** \class PaiementCharge
\brief Classe permettant la gestion des paiements des charges
*/
class PaiementCharge { class PaiementCharge {
var $db; var $db;
@ -56,10 +67,11 @@ class PaiementCharge {
$total += $amount; $total += $amount;
} }
} }
$total = round(ereg_replace(",",".",$total), 2);
if ($total > 0) if ($total > 0)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_user_creat)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_user_creat)";
$sql .= " VALUES ($this->chid, now(), $this->datepaye, $total, $this->paiementtype, '$this->num_paiement', '$this->note', $user->id)"; $sql .= " VALUES ($this->chid, now(), $this->datepaye, '$total', $this->paiementtype, '$this->num_paiement', '$this->note', $user->id)";
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{ {
@ -108,9 +120,10 @@ class PaiementCharge {
} }
} }
/*
* La tva collectée n'est calculée que sur les factures payées. /** \class ChargeSociales
* \brief Classe permettant la gestion des paiements des charges
La tva collectée n'est calculée que sur les factures payées.
*/ */
class ChargeSociales { class ChargeSociales {
var $db; var $db;