diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php new file mode 100644 index 00000000000..ded44c484c2 --- /dev/null +++ b/htdocs/commande/commande.class.php @@ -0,0 +1,100 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Commande { + var $db ; + + var $id ; + var $client_name ; + + Function Commande($DB, $id=0) { + $this->db = $DB; + $this->id = $id ; + } + /* + * + * + * + */ + Function fetch ($id) { + + $sql = "SELECT o.orders_id, o.customers_name, o.orders_status FROM ".DB_NAME_OSC.".orders as o"; + + $sql .= " WHERE o.orders_id = $id"; + + $result = $this->db->query($sql) ; + + if ( $result ) { + $result = $this->db->fetch_array(); + + $this->id = $result["rowid"]; + $this->client_name = $result["customers_name"]; + + $this->nom_url = ''.$result["nom"].''; + + } + $this->db->free(); + + return $result; + } + /* + * + * + */ + Function liste_products () + { + $ga = array(); + + $sql = "SELECT a.rowid, a.title FROM llx_album as a, llx_album_to_groupart as l"; + $sql .= " WHERE a.rowid = l.fk_album AND l.fk_groupart = ".$this->id; + $sql .= " ORDER BY a.title"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $ga[$obj->rowid] = $obj->title; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + /* + * + * + */ + + +} +?> diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php new file mode 100644 index 00000000000..4d2703d8d46 --- /dev/null +++ b/htdocs/commande/fiche.php @@ -0,0 +1,74 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + +if ($id) +{ + + $commande = new Commande($db); + $result = $commande->fetch($id); + + if ( $result ) + { + print '
Fiche Commande

'; + + print ''; + print ""; + print "\n"; + print ""; + + + print "
Client$commande->client_name
Description".nl2br($commande->description)."
"; + } + +} +else +{ + print "Error"; +} + + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
-----

'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php new file mode 100644 index 00000000000..90cbf94d133 --- /dev/null +++ b/htdocs/commande/index.php @@ -0,0 +1,74 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); +if ($sortfield == "") { + $sortfield="o.orders_status ASC, o.date_purchased"; +} +if ($sortorder == "") { + $sortorder="DESC"; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des Commandes", $page, $PHP_SELF); + +$sql = "SELECT o.orders_id, o.customers_name, o.orders_status FROM ".DB_NAME_OSC.".orders as o"; + +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Client",$PHP_SELF, "p.ref"); + print "
orders_id\">$objp->customers_name$objp->orders_status
"; + $db->free(); +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/commande/pre.inc.php b/htdocs/commande/pre.inc.php new file mode 100644 index 00000000000..fa95ac1e61d --- /dev/null +++ b/htdocs/commande/pre.inc.php @@ -0,0 +1,45 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("../main.inc.php3"); +require("./commande.class.php"); + +function llxHeader($head = "", $urlp = "") { + global $user, $conf; + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("/commande/", "Commandes"); + + left_menu($menu->liste); + /* + * + * + */ + +} +?>