New: Add page to make mass stock transfert.

This commit is contained in:
Laurent Destailleur 2013-10-11 13:12:21 +02:00
parent 559b75c49b
commit 56730741bc
5 changed files with 248 additions and 25 deletions

View File

@ -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

View File

@ -105,3 +105,6 @@ ReplenishmentOrdersDesc=Voici la liste des commandes fournisseurs en cours
Replenishments=Réapprovisionnement
NbOfProductBeforePeriod=Quantité du produit <b>%s</b> en stock avant la période sélectionnée (< <b>%s</b>)
NbOfProductAfterPeriod=Quantité du produit <b>%s</b> en stock après la période sélectionnée (> <b>%s</b>)
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

View File

@ -0,0 +1,201 @@
<?php
/* Copyright (C) 2013 Laurent Destaileur <ely@users.sourceforge.net>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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")).'<br><br>';
print $langs->trans("SelectProductInAndOutWareHouse").'<br>';
// Form to add a line
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
print '<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="addline">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
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 '</tr>';
print '<tr>';
// Product
print '<td>';
$filtertype=0;
if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype='';
print $form->select_produits('','productid',$filtertype);
print '</td>';
// Qty
print '<td align="center"><input type="input" size="4" class="flat"></td>';
// In warehouse
print '<td>';
print '</td>';
// Out warehouse
print '<td>';
print '</td>';
// Button to add line
print '<td align="right"><input type="submit" class="button" name="addline" value="'.dol_escape_htmltag($langs->trans("Add")).'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br>';
// List movement prepared
print '<table class="liste" width="100%">';
// Lignes des titres
print '<tr class="liste_titre">';
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 '</tr>';
// Lignes des champs de filtre
/*print '<tr class="liste_titre">'.
'<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre">'.
'<input class="flat" type="text" name="sref" size="8" value="'.dol_escape_htmltag($sref).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input class="flat" type="text" name="snom" size="8" value="'.dol_escape_htmltag($snom).'">'.
'</td>';
if (!empty($conf->service->enabled) && $type == 1)
{
print '<td class="liste_titre">&nbsp;</td>';
}
print '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" name="salert" ' . $alertchecked . '></td>'.
'<td class="liste_titre" align="right">&nbsp;</td>'.
'<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre" align="right">'.
'<input type="image" class="liste_titre" name="button_search"'.
'src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" alt="' . $langs->trans("Search") . '">'.
'<input type="image" class="liste_titre" name="button_removefilter"
src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'.
'</td>'.
'</tr>';
*/
print '</table>';
// Generate
$value=$langs->trans("RecordMovement");
print '<div class="center"><input class="button" type="submit" name="valid" value="'.$value.'"></div>';
print '</form>';
llxFooter();
$db->close();
?>

View File

@ -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&oacute;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 '<form action="replenish.php" method="post" name="formulaire">'.
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">'.
'<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">'.
'<input type="hidden" name="sortfield" value="' . $sortfield . '">'.
'<input type="hidden" name="sortorder" value="' . $sortorder . '">'.
@ -304,7 +303,7 @@ print '<tr class="liste_titre">'.
'<td><input type="checkbox" onClick="toggle(this)" /></td>';
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 '</table>'.
'</div>'.
'<table width="100%">'.
'<tr><td align="center">'.
'<input class="button" type="submit" name="valid" value="' . $value . '">'.
'</td></tr></table>'.
'</form>';
$value=$langs->trans("CreateOrders");
print '<div class="center"><input class="button" type="submit" name="valid" value="'.$value.'"></div>';
print '</form>';
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 '
<script type="text/javascript">
function toggle(source)

View File

@ -18,9 +18,10 @@
/**
* \file htdocs/product/stock/replenishorders.php
* \ingroup produit
* \ingroup stock
* \brief Page to list replenishment orders
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -37,10 +38,18 @@ $langs->load("orders");
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service');
/*
* View
*/
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
$helpurl .= 'ES:M&oacute;dulo_Stocks';
$texte = $langs->trans('ReplenishmentOrders');
llxHeader('', $texte, $helpurl, $texte);
llxHeader('', $texte, $helpurl, '');
$head = array();
$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
$head[0][1] = $langs->trans('Status');
@ -150,7 +159,7 @@ if ($resql)
print_barre_liste(
'',
$page,
'replenishorders.php',
$_SERVER["PHP_SELF"],
'',
$sortfield,
$sortorder,
@ -159,7 +168,7 @@ if ($resql)
0,
''
);
print '<form action="replenishorders.php" method="GET">'.
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'.
'<table class="noborder" width="100%">'.
'<tr class="liste_titre">';
print_liste_field_titre(
@ -308,6 +317,8 @@ if ($resql)
'</form>';
$db->free($resql);
dol_fiche_end();
}
else
{
@ -315,4 +326,6 @@ else
}
llxFooter();
$db->close();
?>