Ajout filtre sur les années et les mois

This commit is contained in:
Rodolphe Quiedeville 2003-11-17 10:12:30 +00:00
parent 92524592cc
commit 55b8f24cab

View File

@ -20,11 +20,6 @@
* *
*/ */
/**
* Gestion d'une proposition commerciale
* @package propale
*/
require("./pre.inc.php"); require("./pre.inc.php");
$user->getrights('commande'); $user->getrights('commande');
@ -40,22 +35,8 @@ if ($user->societe_id > 0)
$socidp = $user->societe_id; $socidp = $user->societe_id;
} }
llxHeader(); llxHeader();
/******************************************************************************/
/* Fin des Actions */
/******************************************************************************/
/****************************************************************************
* *
* *
* Mode Liste des propales *
* *
* *
****************************************************************************/
if ($sortfield == "") if ($sortfield == "")
{ {
$sortfield="c.rowid"; $sortfield="c.rowid";
@ -72,7 +53,7 @@ $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$sql = "SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,".$db->pdate("c.date_commande")." as date_commande" ; $sql = "SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,".$db->pdate("c.date_commande")." as date_commande, c.fk_statut" ;
$sql .= " FROM llx_societe as s, llx_commande as c WHERE c.fk_soc = s.idp"; $sql .= " FROM llx_societe as s, llx_commande as c WHERE c.fk_soc = s.idp";
if ($socidp) if ($socidp)
@ -80,6 +61,14 @@ if ($socidp)
$sql .= " AND s.idp = $socidp"; $sql .= " AND s.idp = $socidp";
} }
if ($_GET["month"] > 0)
{
$sql .= " AND date_format(c.date_commande, '%Y-%m') = '$year-$month'";
}
if ($_GET["year"] > 0)
{
$sql .= " AND date_format(c.date_commande, '%Y') = $year";
}
if (strlen($HTTP_POST_VARS["sf_ref"]) > 0) if (strlen($HTTP_POST_VARS["sf_ref"]) > 0)
{ {
@ -94,31 +83,31 @@ if ( $db->query($sql) )
$num = $db->num_rows(); $num = $db->num_rows();
print_barre_liste("Commandes", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); print_barre_liste("Commandes", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num);
$i = 0; $i = 0;
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">'; print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
print '<TR class="liste_titre">'; print '<TR class="liste_titre">';
print_liste_field_titre_new ("Réf",$PHP_SELF,"p.ref","","&amp;socidp=$socidp",'width="15%"',$sortfield); print_liste_field_titre_new ("Réf",$PHP_SELF,"c.ref","","&amp;socidp=$socidp",'width="15%"',$sortfield);
print_liste_field_titre_new ("Société",$PHP_SELF,"s.nom","","&amp;socidp=$socidp",'width="30%"',$sortfield); print_liste_field_titre_new ("Société",$PHP_SELF,"s.nom","","&amp;socidp=$socidp",'width="30%"',$sortfield);
print_liste_field_titre_new ("Date",$PHP_SELF,"c.date_commande","","&amp;socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield); print_liste_field_titre_new ("Date",$PHP_SELF,"c.date_commande","","&amp;socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield);
print_liste_field_titre_new ("Prix",$PHP_SELF,"p.price","","&amp;socidp=$socidp", ' width="20%" align="right"',$sortfield);
print_liste_field_titre_new ("Statut",$PHP_SELF,"p.fk_statut","","&amp;socidp=$socidp",'width="10%" align="center"',$sortfield); print_liste_field_titre_new ("Statut",$PHP_SELF,"c.fk_statut","","&amp;socidp=$socidp",'width="10%" align="center"',$sortfield);
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
$generic_commande = new Commande($db);
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<tr $bc[$var]>";
print "<TD><a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></TD>\n"; print "<td><a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
print "<TD><a href=\"../comm/fiche.php?socid=$objp->idp\">$objp->nom</a></TD>\n"; print "<td><a href=\"../comm/fiche.php?socid=$objp->idp\">$objp->nom</a></td>\n";
$now = time(); $now = time();
$lim = 3600 * 24 * 15 ; $lim = 3600 * 24 * 15 ;
@ -132,19 +121,18 @@ if ( $db->query($sql) )
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
} }
print "<TD align=\"right\">"; print "<td align=\"right\">";
$y = strftime("%Y",$objp->date_commande); $y = strftime("%Y",$objp->date_commande);
$m = strftime("%m",$objp->date_commande); $m = strftime("%m",$objp->date_commande);
print strftime("%d",$objp->date_commande)."\n"; print strftime("%d",$objp->date_commande)."\n";
print " <a href=\"propal.php?year=$y&amp;month=$m\">"; print " <a href=\"liste.php?year=$y&amp;month=$m\">";
print strftime("%B",$objp->date_commande)."</a>\n"; print strftime("%B",$objp->date_commande)."</a>\n";
print " <a href=\"propal.php?year=$y\">"; print " <a href=\"liste.php?year=$y\">";
print strftime("%Y",$objp->date_commande)."</a></TD>\n"; print strftime("%Y",$objp->date_commande)."</a></TD>\n";
print "<TD align=\"right\">".price($objp->total_ht)."</TD>\n"; print '<td align="center">'.$generic_commande->statuts[$objp->fk_statut].'</td>';
print "<TD align=\"center\">$objp->statut</TD>\n"; print "</tr>\n";
print "</TR>\n";
$total = $total + $objp->price; $total = $total + $objp->price;
$subtotal = $subtotal + $objp->price; $subtotal = $subtotal + $objp->price;