diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 99b3531c757..c0e07cbb44b 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -20,11 +20,6 @@ * */ -/** -* Gestion d'une proposition commerciale -* @package propale -*/ - require("./pre.inc.php"); $user->getrights('commande'); @@ -40,22 +35,8 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } - - llxHeader(); -/******************************************************************************/ -/* Fin des Actions */ -/******************************************************************************/ - -/**************************************************************************** - * * - * * - * Mode Liste des propales * - * * - * * - ****************************************************************************/ - if ($sortfield == "") { $sortfield="c.rowid"; @@ -72,7 +53,7 @@ $offset = $limit * $page ; $pageprev = $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"; if ($socidp) @@ -80,6 +61,14 @@ if ($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) { @@ -93,32 +82,32 @@ if ( $db->query($sql) ) { $num = $db->num_rows(); print_barre_liste("Commandes", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); - - + $i = 0; print ''; print ''; - print_liste_field_titre_new ("Réf",$PHP_SELF,"p.ref","","&socidp=$socidp",'width="15%"',$sortfield); + print_liste_field_titre_new ("Réf",$PHP_SELF,"c.ref","","&socidp=$socidp",'width="15%"',$sortfield); print_liste_field_titre_new ("Société",$PHP_SELF,"s.nom","","&socidp=$socidp",'width="30%"',$sortfield); print_liste_field_titre_new ("Date",$PHP_SELF,"c.date_commande","","&socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield); - print_liste_field_titre_new ("Prix",$PHP_SELF,"p.price","","&socidp=$socidp", ' width="20%" align="right"',$sortfield); - print_liste_field_titre_new ("Statut",$PHP_SELF,"p.fk_statut","","&socidp=$socidp",'width="10%" align="center"',$sortfield); + print_liste_field_titre_new ("Statut",$PHP_SELF,"c.fk_statut","","&socidp=$socidp",'width="10%" align="center"',$sortfield); print "\n"; $var=True; + $generic_commande = new Commande($db); + while ($i < min($num,$limit)) { $objp = $db->fetch_object( $i); $var=!$var; - print ""; - print "\n"; - print "\n"; + print ""; + print "\n"; + print "\n"; $now = time(); $lim = 3600 * 24 * 15 ; @@ -132,19 +121,18 @@ if ( $db->query($sql) ) print ""; } - print "\n"; - - print "\n"; - print "\n"; - print "\n"; + + print ''; + print "\n"; $total = $total + $objp->price; $subtotal = $subtotal + $objp->price;
rowid\">$objp->refidp\">$objp->nom
rowid\">$objp->refidp\">$objp->nom "; + print ""; $y = strftime("%Y",$objp->date_commande); $m = strftime("%m",$objp->date_commande); print strftime("%d",$objp->date_commande)."\n"; - print " "; + print " "; print strftime("%B",$objp->date_commande)."\n"; - print " "; + print " "; print strftime("%Y",$objp->date_commande)."".price($objp->total_ht)."$objp->statut
'.$generic_commande->statuts[$objp->fk_statut].'