From 2807f217786000370876737abb00dd7552b02c14 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 17 Nov 2003 16:21:43 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/product/stock/index.php | 81 ++++++++++ htdocs/product/stock/pre.inc.php | 43 +++++ htdocs/product/stock/product.php | 266 +++++++++++++++++++++++++++++++ 3 files changed, 390 insertions(+) create mode 100644 htdocs/product/stock/index.php create mode 100644 htdocs/product/stock/pre.inc.php create mode 100644 htdocs/product/stock/product.php diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php new file mode 100644 index 00000000000..82b7021e5c1 --- /dev/null +++ b/htdocs/product/stock/index.php @@ -0,0 +1,81 @@ + + * + * 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("","","Stocks"); + +print_titre("Stocks"); + +print ''; +print '
'; + +$sql = "SELECT e.label, e.rowid FROM llx_entrepot as e"; +$sql .= " ORDER BY e.label DESC "; +$sql .= $db->plimit(15 ,0); +$result = $db->query($sql) ; + +if ($result) +{ + $num = $db->num_rows(); + + $i = 0; + + if ($num > 0) + { + print ''; + + print ''; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + $i++; + } + $db->free(); + + print "
Entrepôts
rowid\">$objp->label
"; + } +} +else +{ + print $db->error() . "
" .$sql; +} + +print '
'; + + +print '
'; + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/stock/pre.inc.php b/htdocs/product/stock/pre.inc.php new file mode 100644 index 00000000000..188543a1e0f --- /dev/null +++ b/htdocs/product/stock/pre.inc.php @@ -0,0 +1,43 @@ + + * + * 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.php"); +require("./entrepot.class.php"); +function llxHeader($head = "", $urlp = "", $title="") +{ + /* + * + * + */ + top_menu($head, $title); + + $menu = new Menu(); + + $menu->add(DOL_URL_ROOT."/product/stock/", "Stock"); + + $menu->add_submenu(DOL_URL_ROOT."/product/stock/fiche.php?action=create", "Nouvel entrepôt"); + + $menu->add(DOL_URL_ROOT."/product/stock/mouvement.php", "Mouvements"); + + left_menu($menu->liste); + +} +?> diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php new file mode 100644 index 00000000000..2ee9c2076cc --- /dev/null +++ b/htdocs/product/stock/product.php @@ -0,0 +1,266 @@ + + * + * 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"); + +$user->getrights('produit'); +$mesg = ''; + +if (!$user->rights->produit->lire) +{ + accessforbidden(); +} + +llxHeader("","","Fiche produit"); + +if ($HTTP_POST_VARS["action"] == "create_stock") +{ + $product = new Product($db); + $product->id = $_GET["id"]; + $product->create_stock($HTTP_POST_VARS["id_entrepot"], $HTTP_POST_VARS["nbpiece"]); +} + +if ($HTTP_POST_VARS["action"] == "correct_stock") +{ + $product = new Product($db); + $product->id = $_GET["id"]; + $product->correct_stock($user, + $HTTP_POST_VARS["id_entrepot"], + $HTTP_POST_VARS["nbpiece"], + $HTTP_POST_VARS["mouvement"]); +} + + +if ($cancel == 'Annuler') +{ + $action = ''; +} +/* + * + * + */ +if ($id) +{ + if ($action <> 're-edit') + { + $product = new Product($db); + $result = $product->fetch($id); + } + + if ( $result ) + { + if ($action <> 'edit' && $action <> 're-edit') + { + + print_fiche_titre('Fiche stock : '.$product->ref, $mesg); + + print ''; + print ""; + print ''; + print ''; + print ""; + print ''; + print ''; + print ''; + + print ''; + + print "
Référence'.$product->ref.''; + if ($product->envente) + { + print "En vente"; + } + else + { + print "Cet article n'est pas en vente"; + } + print '
Libellé$product->libelleStatistiques
Prix de vente'.price($product->price).''; + print 'Fournisseurs [Ajouter]'; + + $sql = "SELECT s.nom, s.idp"; + $sql .= " FROM llx_societe as s, llx_product_fournisseur as pf"; + $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product =$id"; + $sql .= " ORDER BY lower(s.nom)"; + + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + print ''; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print ''; + $i++; + } + print '
'.$objp->nom.'
'; + $db->free(); + } + + print '
Stock seuil'.$product->seuil_stock_alerte.'
"; + } + /* + * Contenu des stocks + * + */ + print '
'; + print ''; + $sql = "SELECT e.rowid, e.label, ps.reel FROM llx_entrepot as e, llx_product_stock as ps"; + $sql .= " WHERE ps.fk_entrepot = e.rowid AND ps.fk_product = $product->id"; + $sql .= " ORDER BY lower(e.label)"; + + if ($db->query($sql)) + { + $num = $db->num_rows(); + $i = 0; $total = 0; + while ($i < $num) + { + $obj = $db->fetch_object( $i); + print ''; ; + $total = $total + $obj->reel; + $i++; + } + } + print '
EntrepôtValeur du stock
'.$obj->label.''.$obj->reel.'
Total : '.$total."
"; + + + + } + /* + * Correction du stock + * + * + */ + if ($_GET["action"] == "correction") + { + print_titre ("Correction du stock"); + print "
\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
EntrepôtNb de pièce
 '; + print '
'; + print '
'; + + } + /* + * Correction du stock + * + * + */ + if ($_GET["action"] == "definir") + { + print_titre ("Créer un stock"); + print "
\n"; + print ''; + print ''; + print ''; + print ''; + print '
EntrepôtNb de pièce
 '; + print '
'; + print '
'; + } +} +else +{ + print "Error"; +} + + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print '
'; + +print ''; + +print ''; + +if ($action == '') +{ + if ($user->rights->produit->modifier || $user->rights->produit->creer) + { + print ''; + } + else + { + print ''; + } +} +else +{ + print ''; +} +print ''; +print ''; + +print '
--Editer---Correction stock

'; + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>