Gestion du paramtre $conf->compta->mode qui vaut 'DEPENSES-RECETTES' par dfaut, sinon 'CREANCES-DETTES'. Il dtermine le mode de calcul du CA.
This commit is contained in:
parent
f5b3c23fe8
commit
8a29fa7a75
@ -97,7 +97,12 @@ function factures ($db, $year, $month, $paye) {
|
||||
global $bc;
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, f.facnumber, f.total,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND f.paye = $paye";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||
$sql .= " AND f.paye = $paye";
|
||||
}
|
||||
$sql .= " AND f.fk_soc = s.idp";
|
||||
$sql .= " AND date_format(f.datef, '%Y') = $year ";
|
||||
$sql .= " AND round(date_format(f.datef, '%m')) = $month ";
|
||||
$sql .= " ORDER BY f.datef DESC ";
|
||||
@ -258,7 +263,12 @@ function ppt ($db, $year, $socidp)
|
||||
print "</td><td valign=\"top\" width=\"30%\">";
|
||||
|
||||
$sql = "SELECT sum(f.total) as sum, round(date_format(f.datef, '%m')) as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1 AND date_format(f.datef,'%Y') = $year ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||
$sql .= " AND f.paye = 1";
|
||||
}
|
||||
$sql .= " AND date_format(f.datef,'%Y') = $year ";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socidp";
|
||||
|
||||
@ -233,8 +233,12 @@ function ppt ($db, $year, $socidp)
|
||||
print "<tr><td valign=\"top\" width=\"30%\">";
|
||||
|
||||
$sql = "SELECT sum(f.total) as sum, round(date_format(f.datef, '%m')) as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1 AND date_format(f.datef,'%Y') = ".($year-1);
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||
$sql .= " AND f.paye = 1";
|
||||
}
|
||||
$sql.=" AND date_format(f.datef,'%Y') = ".($year-1);
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socidp";
|
||||
@ -247,8 +251,12 @@ function ppt ($db, $year, $socidp)
|
||||
print "</td><td valign=\"top\" width=\"30%\">";
|
||||
|
||||
$sql = "SELECT sum(f.total) as sum, round(date_format(f.datef, '%m')) as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1 AND date_format(f.datef,'%Y') = $year ";
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||
$sql .= " AND f.paye = 1";
|
||||
}
|
||||
$sql.=" AND date_format(f.datef,'%Y') = $year ";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socidp";
|
||||
|
||||
@ -45,7 +45,12 @@ function get_ca_propal ($db, $year, $socidp)
|
||||
function get_ca ($db, $year, $socidp)
|
||||
{
|
||||
|
||||
$sql = "SELECT sum(f.amount) as sum FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1 AND date_format(f.datef , '%Y') = $year ";
|
||||
$sql = "SELECT sum(f.amount) as sum FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||
$sql .= " AND f.paye = 1";
|
||||
}
|
||||
$sql .= " AND date_format(f.datef , '%Y') = $year ";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socidp";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user