simplification du code

This commit is contained in:
Regis Houssin 2007-03-30 11:55:36 +00:00
parent 780bf6b929
commit d05bd5e400

View File

@ -92,25 +92,21 @@ if ($socid)
{ {
$sql .= ' AND s.idp = '.$socid; $sql .= ' AND s.idp = '.$socid;
} }
if ($viewstatut <> '' && $viewstatut < 4) if ($viewstatut <> '')
{ {
if ($viewstatut == 3) if ($viewstatut < 4)
{ {
$sql .= ' AND c.fk_statut ='.$viewstatut.' AND c.facture = 0'; $sql .= ' AND c.fk_statut ='.$viewstatut; // brouillon, validée, en cours, annulée
if ($viewstatut == 3)
{
$sql .= ' AND c.facture = 0'; // à facturer
}
} }
else else if ($viewstatut == 4)
{ {
$sql .= ' AND c.fk_statut ='.$viewstatut; $sql .= ' AND c.facture = 1'; // facturée
} }
} }
if ($viewstatut <> '' && $viewstatut == 4)
{
$sql .= ' AND c.facture = 1';
}
else if (isset($_GET['afacturer']) && $_GET['afacturer'] == 1)
{
$sql .= ' AND c.facture = 0';
}
if ($_GET['month'] > 0) if ($_GET['month'] > 0)
{ {
$sql .= " AND date_format(c.date_commande, '%Y-%m') = '$year-$month'"; $sql .= " AND date_format(c.date_commande, '%Y-%m') = '$year-$month'";