Fix: Add social contributions in budget

This commit is contained in:
Laurent Destailleur 2008-07-31 16:30:43 +00:00
parent ed159e1eaf
commit 83d240fbd9
4 changed files with 7 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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()

View File

@ -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)
{