From 83d240fbd9843d37a19cc70745ac99aff85a6930 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Jul 2008 16:30:43 +0000 Subject: [PATCH] Fix: Add social contributions in budget --- htdocs/chargesociales.class.php | 2 +- htdocs/compta/bank/treso.php | 5 ++--- htdocs/facture.class.php | 2 +- htdocs/lib/bank.lib.php | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index 7d5238b9b9f..35243274b64 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -314,7 +314,7 @@ class ChargeSociales function getSommePaiement() { $table='paiementcharge'; - $field='amount'; + $field='fk_charge'; $sql = 'SELECT sum(amount) as amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.$table; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index d3a0545e3c0..8ac7d764c2d 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -167,7 +167,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql2.= " ORDER BY dlr ASC"; // Social contributions - $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, cs.amount as total_ttc, ccs.libelle as type, ".$db->pdate("cs.date_ech")." as dlr"; + $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, ".$db->pdate("cs.date_ech")." as dlr"; $sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql3.= " WHERE cs.paye = 0"; // Not payed @@ -291,8 +291,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $socialcontribstatic->lib=$obj->type; $ref = $socialcontribstatic->getNomUrl(1,24); - $paiement = $socialcontribstatic->getSommePaiement(); // Payment already done - print 'x'.$paiement.'/'.$obj->total_ttc."x"; + $paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done } $total_ttc = $obj->total_ttc; diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index d9d8acebbed..92cff7258d7 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1638,7 +1638,7 @@ class Facture extends CommonObject /** - * \brief Return amount aof payments already done + * \brief Return amount of payments already done * \return int Amount of payment already done, <0 if KO */ function getSommePaiement() diff --git a/htdocs/lib/bank.lib.php b/htdocs/lib/bank.lib.php index ecf19db2558..def2b363b61 100644 --- a/htdocs/lib/bank.lib.php +++ b/htdocs/lib/bank.lib.php @@ -60,13 +60,13 @@ function bank_prepare_head($obj) $head[$h][2] = 'graph'; $h++; - if ($conf->global->MAIN_FEATURES_LEVEL >= 1) - { +// if ($conf->global->MAIN_FEATURES_LEVEL >= 1) +// { $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$obj->id; $head[$h][1] = $langs->trans("CashBudget"); $head[$h][2] = 'cash'; $h++; - } +// } if ($obj->courant != 2) {