From 56730741bc9f66621b3df05024290d98312195b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2013 13:12:21 +0200 Subject: [PATCH] New: Add page to make mass stock transfert. --- htdocs/langs/en_US/stocks.lang | 3 + htdocs/langs/fr_FR/stocks.lang | 3 + htdocs/product/stock/massstockmove.php | 201 +++++++++++++++++++++++ htdocs/product/stock/replenish.php | 45 ++--- htdocs/product/stock/replenishorders.php | 21 ++- 5 files changed, 248 insertions(+), 25 deletions(-) create mode 100644 htdocs/product/stock/massstockmove.php diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 78b4f9d916e..34afeaffb41 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -105,3 +105,6 @@ ReplenishmentOrdersDesc=This is list of all opened supplier orders Replenishments=Replenishments NbOfProductBeforePeriod=Quantity of product %s in stock before selected period (< %s) NbOfProductAfterPeriod=Quantity of product %s in stock after selected period (> %s) +MassStockMovement=Mass stock movement +SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "Add". Once this is done for all required movements, click onto "Record Tranferts". +RecordMovement=Record transfert \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index d9ffd5d5574..0630cab213e 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -105,3 +105,6 @@ ReplenishmentOrdersDesc=Voici la liste des commandes fournisseurs en cours Replenishments=Réapprovisionnement NbOfProductBeforePeriod=Quantité du produit %s en stock avant la période sélectionnée (< %s) NbOfProductAfterPeriod=Quantité du produit %s en stock après la période sélectionnée (> %s) +MassStockMovement=Mouvement de stock en masse +SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur ajouter. Une fois tous les mouvements enregistrés, cliquer sur "Enregistrer transferts". +RecordMovement=Enregistrer transferts \ No newline at end of file diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php new file mode 100644 index 00000000000..28a7dcb9bc7 --- /dev/null +++ b/htdocs/product/stock/massstockmove.php @@ -0,0 +1,201 @@ + + * + * 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 3 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, see . + */ + +/** + * \file htdocs/product/stock/massstockmove.php + * \ingroup stock + * \brief This page allows to select several products, then incoming warehouse and + * outgoing warehouse and create all stock movements for this. + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + +$langs->load("products"); +$langs->load("stocks"); +$langs->load("orders"); + +// Security check +if ($user->societe_id) { + $socid = $user->societe_id; +} +$result=restrictedArea($user,'produit|service'); + +//checks if a product has been ordered + +$action = GETPOST('action','alpha'); +$sref = GETPOST('sref', 'alpha'); +$snom = GETPOST('snom', 'alpha'); +$sall = GETPOST('sall', 'alpha'); +$type = GETPOST('type','int'); +$tobuy = GETPOST('tobuy', 'int'); +$salert = GETPOST('salert', 'alpha'); + +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); + +if (!$sortfield) { + $sortfield = 'p.ref'; +} + +if (!$sortorder) { + $sortorder = 'ASC'; +} +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +/* + * Actions + */ + +if (isset($_POST['button_removefilter']) || isset($_POST['valid'])) +{ + $sref = ''; + $snom = ''; + $sal = ''; + $salert = ''; +} + +if ($action == 'createmovement' && isset($_POST['valid'])) +{ + + + + +} + + +/* + * View + */ + +$form=new Form($db); +$prodstatic = new Product($db); +$warehousestatic = new Entrepot($db); + +$title = $langs->trans('MassMovement'); + +llxHeader('', $title, $helpurl, ''); + +print_fiche_titre($langs->trans("MassStockMovement")).'

'; + +print $langs->trans("SelectProductInAndOutWareHouse").'
'; + + +// Form to add a line +print '
'; +print ''; +print ''; + +print ''; + +print ''; +print_liste_field_titre($langs->trans('Product'),$_SERVER["PHP_SELF"],'',$param,'','',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('Qty'),$_SERVER["PHP_SELF"],'',$param,'','align="center"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('WarehouseSource'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('WarehouseTarget'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); +print_liste_field_titre(''); +print ''; + +print ''; +// Product +print ''; +// Qty +print ''; +// In warehouse +print ''; +// Out warehouse +print ''; +// Button to add line +print ''; + +print ''; +print '
'; +$filtertype=0; +if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype=''; +print $form->select_produits('','productid',$filtertype); +print ''; +print ''; +print '
'; + +print '
'; + +print '
'; + +// List movement prepared +print ''; + +// Lignes des titres +print ''; +print_liste_field_titre($langs->trans('ProductRef'),$_SERVER["PHP_SELF"],'p.ref',$param,'','',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('ProductLabel'),$_SERVER["PHP_SELF"],'p.label',$param,'','',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('Qty'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('WarehouseSource'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('WarehouseTarget'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); +print_liste_field_titre(''); +print ''; + +// Lignes des champs de filtre +/*print ''. +''. +''. +''; +if (!empty($conf->service->enabled) && $type == 1) +{ + print ''; +} +print ''. + ''. + ''. + ''. + ''. + ''; +*/ + + + + + + +print '
 '. +''. +''. +''. +'  ' . $langs->trans('AlertOnly') . '   '. + ''. + ''. + '
'; + +// Generate +$value=$langs->trans("RecordMovement"); +print '
'; + + +print ''; + + +llxFooter(); + +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 25f5a1a112a..ace77f1a0ef 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -18,7 +18,7 @@ /** * \file htdocs/product/stock/replenish.php - * \ingroup produit + * \ingroup stock * \brief Page to list stocks to replenish */ @@ -75,8 +75,7 @@ if (isset($_POST['button_removefilter']) || isset($_POST['valid'])) $salert = ''; } -//orders creation -//TODO: could go in the lib +// Create orders if ($action == 'order' && isset($_POST['valid'])) { $linecount = GETPOST('linecount', 'int'); @@ -240,7 +239,7 @@ $i = 0; $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|'; $helpurl .= 'ES:Módulo_Stocks'; -llxHeader('', $title, $helpurl, $title); +llxHeader('', $title, $helpurl, ''); $head = array(); $head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php'; @@ -285,7 +284,7 @@ if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) { ); } -print '
'. +print ''. ''. ''. ''. @@ -304,7 +303,7 @@ print ''. ''; print_liste_field_titre( $langs->trans('Ref'), - 'replenish.php', + $_SERVER["PHP_SELF"], 'p.ref', $param, '', @@ -314,7 +313,7 @@ print_liste_field_titre( ); print_liste_field_titre( $langs->trans('Label'), - 'replenish.php', + $_SERVER["PHP_SELF"], 'p.label', $param, '', @@ -326,7 +325,7 @@ if (!empty($conf->service->enabled) && $type == 1) { print_liste_field_titre( $langs->trans('Duration'), - 'replenish.php', + $_SERVER["PHP_SELF"], 'p.duration', $param, '', @@ -337,7 +336,7 @@ if (!empty($conf->service->enabled) && $type == 1) } print_liste_field_titre( $langs->trans('DesiredStock'), - 'replenish.php', + $_SERVER["PHP_SELF"], 'p.desiredstock', $param, '', @@ -355,7 +354,7 @@ else } print_liste_field_titre( $stocklabel, - 'replenish.php', + $_SERVER["PHP_SELF"], 'stock_physique', $param, '', @@ -365,7 +364,7 @@ print_liste_field_titre( ); print_liste_field_titre( $langs->trans('Ordered'), - 'replenish.php', + $_SERVER["PHP_SELF"], '', $param, '', @@ -375,7 +374,7 @@ print_liste_field_titre( ); print_liste_field_titre( $langs->trans('StockToBuy'), - 'replenish.php', + $_SERVER["PHP_SELF"], '', $param, '', @@ -385,7 +384,7 @@ print_liste_field_titre( ); print_liste_field_titre( $langs->trans('Supplier'), - 'replenish.php', + $_SERVER["PHP_SELF"], '', $param, '', @@ -427,7 +426,7 @@ while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); - if ($conf->global->STOCK_SUPPORTS_SERVICES || $objp->fk_product_type == 0) + if (! empty($conf->global->STOCK_SUPPORTS_SERVICES) || $objp->fk_product_type == 0) { // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) @@ -541,14 +540,14 @@ while ($i < min($num, $limit)) } $i++; } -$value = $langs->trans("CreateOrders"); print ''. - ''. - ''. - '
'. - ''. - '
'. - '
'; + + +$value=$langs->trans("CreateOrders"); +print '
'; + + +print ''; if ($num > $conf->liste_limit) { @@ -591,6 +590,10 @@ if ($num > $conf->liste_limit) $db->free($resql); +dol_fiche_end(); + + +// TODO Replace this with jquery print '