Fix: Stock management debug
This commit is contained in:
parent
3691acd09a
commit
b728c133fb
@ -464,7 +464,7 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
print "</td></tr></table>";
|
print "</td></tr></table>";
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
show_list_sending_receive('commande',$commande->id);
|
show_list_sending_receive('commande',$commande->id);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -113,6 +113,7 @@ else
|
|||||||
// Check if GD installed
|
// Check if GD installed
|
||||||
if (! function_exists("imagecreate"))
|
if (! function_exists("imagecreate"))
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
|
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
|
||||||
// $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install)
|
// $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,9 +38,10 @@ EnhancedValueOfWarehouses=Warehouses value
|
|||||||
UserWarehouseAutoCreate=Create a stock automatically when creating a user
|
UserWarehouseAutoCreate=Create a stock automatically when creating a user
|
||||||
QtyDispatched=Quantity dispatched
|
QtyDispatched=Quantity dispatched
|
||||||
OrderDispatch=Order dispatching
|
OrderDispatch=Order dispatching
|
||||||
DeStockReStockOnBill=Decrease/increase stocks on invoices/credit notes
|
DeStockReStockOnBill=Decrease/increase real stocks on invoices/credit notes
|
||||||
DeStockReStockOnValidateOrder=Decrease/increase stocks on orders notes
|
DeStockReStockOnValidateOrder=Decrease/increase real stocks on orders notes
|
||||||
DeStockReStockOnShipment=Decrease/increase stocks on shipment
|
DeStockReStockOnShipment=Decrease/increase real stocks on shipment
|
||||||
|
StockDiffPhysicTeoric=Reason for difference stock physical and theorical
|
||||||
StockLimitShort=Limit
|
StockLimitShort=Limit
|
||||||
StockLimit=Stock limit for alerts
|
StockLimit=Stock limit for alerts
|
||||||
PhysicalStock=Physical stock
|
PhysicalStock=Physical stock
|
||||||
|
|||||||
@ -38,9 +38,10 @@ EnhancedValueOfWarehouses=Valorisation des stocks
|
|||||||
UserWarehouseAutoCreate=Créer un stock automatiquement à la création d'un utilisateur
|
UserWarehouseAutoCreate=Créer un stock automatiquement à la création d'un utilisateur
|
||||||
QtyDispatched=Quantité ventilée
|
QtyDispatched=Quantité ventilée
|
||||||
OrderDispatch=Ventilation commande
|
OrderDispatch=Ventilation commande
|
||||||
DeStockReStockOnBill=Décrémente/Incrémente les stocks sur les factures/avoirs
|
DeStockReStockOnBill=Décrémente/Incrémente les stocks réels sur les factures/avoirs
|
||||||
DeStockReStockOnValidateOrder=Décrémente/Incrémente les stocks sur les commandes
|
DeStockReStockOnValidateOrder=Décrémente/Incrémente les stocks réels sur les commandes
|
||||||
DeStockReStockOnShipment=Décrémente/Incrémente les stocks sur les expéditions
|
DeStockReStockOnShipment=Décrémente/Incrémente les stocks réels sur les expéditions
|
||||||
|
StockDiffPhysicTeoric=Raison écart stock physique-théorique
|
||||||
StockLimitShort=Seuil
|
StockLimitShort=Seuil
|
||||||
StockLimit=Seuil alerte stock
|
StockLimit=Seuil alerte stock
|
||||||
PhysicalStock=Stock physique
|
PhysicalStock=Stock physique
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -16,15 +16,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/product/liste.php
|
\file htdocs/product/reassort.php
|
||||||
\ingroup produit
|
\ingroup produit
|
||||||
\brief Page liste des produits ou services
|
\brief Page liste des produits ou services
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -181,13 +179,18 @@ if ($resql)
|
|||||||
print "</div><br />";
|
print "</div><br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<form action="reassort.php" method="post" name="formulaire">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
|
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
// Lignes des titres
|
// Lignes des titres
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"),"reassort.php", "p.ref","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"),"reassort.php", "p.ref","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
//print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->service->enabled && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="center"',$sortfield,$sortorder);
|
if ($conf->service->enabled && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||||
@ -195,10 +198,6 @@ if ($resql)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<form action="reassort.php" method="post" name="formulaire">';
|
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
||||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="sref" value="'.$sref.'">';
|
print '<input class="flat" type="text" name="sref" value="'.$sref.'">';
|
||||||
@ -212,7 +211,7 @@ if ($resql)
|
|||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td class="liste_titre" colspan="3">';
|
print '<td class="liste_titre" colspan="2">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
@ -220,7 +219,6 @@ if ($resql)
|
|||||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
|
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
$product_static=new Product($db);
|
$product_static=new Product($db);
|
||||||
|
|
||||||
@ -245,21 +243,12 @@ if ($resql)
|
|||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td nowrap="nowrap">';
|
print '<tr '.$bc[$var].'><td nowrap="nowrap">';
|
||||||
print "<a href=\"fiche.php?id=$objp->rowid\">";
|
$product_static->ref=$objp->ref;
|
||||||
if ($objp->fk_product_type==1)
|
$product_static->id=$objp->rowid;
|
||||||
{
|
$product_static->type=$objp->fk_product_type;
|
||||||
print img_object($langs->trans("ShowService"),"service");
|
print $product_static->getNomUrl(1,'',16);
|
||||||
}
|
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
|
||||||
else
|
print '</td>';
|
||||||
{
|
|
||||||
if ( $objp->stock_theorique > $objp->seuil_stock_alerte) {
|
|
||||||
print img_object($langs->trans("ShowProduct"),"product");
|
|
||||||
} else {
|
|
||||||
print img_warning($langs->trans("StockTooLow"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</a> ';
|
|
||||||
print '<a href="fiche.php?id='.$objp->rowid.'">'.$objp->ref.'</a></td>';
|
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
|
|
||||||
if ($conf->service->enabled && $type == 1)
|
if ($conf->service->enabled && $type == 1)
|
||||||
@ -271,7 +260,7 @@ if ($resql)
|
|||||||
else print $objp->duration;
|
else print $objp->duration;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right">'.$objp->stock_theorique.'</td>';
|
//print '<td align="right">'.$objp->stock_theorique.'</td>';
|
||||||
print '<td align="right">'.$objp->stock_physique.'</td>';
|
print '<td align="right">'.$objp->stock_physique.'</td>';
|
||||||
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
|
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||||
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>';
|
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>';
|
||||||
@ -279,6 +268,9 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
if ($num > $conf->liste_limit)
|
if ($num > $conf->liste_limit)
|
||||||
{
|
{
|
||||||
if ($sref || $snom || $sall || $_POST["search"])
|
if ($sref || $snom || $sall || $_POST["search"])
|
||||||
@ -293,8 +285,6 @@ if ($resql)
|
|||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,11 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/product/stock/product.php
|
\file htdocs/product/stock/product.php
|
||||||
\ingroup product
|
\ingroup product
|
||||||
\brief Page de la fiche stock d'un produit
|
\brief Page de la fiche stock d'un produit
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||||
@ -44,50 +44,50 @@ if (! $user->rights->produit->lire || ! $product->type == 0 || ! $conf->stock->e
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == "create_stock")
|
if ($_POST["action"] == "create_stock")
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->id = $_GET["id"];
|
$product->id = $_GET["id"];
|
||||||
$product->create_stock($_POST["id_entrepot"], $_POST["nbpiece"]);
|
$product->create_stock($_POST["id_entrepot"], $_POST["nbpiece"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == "correct_stock" && $_POST["cancel"] <> $langs->trans("Cancel"))
|
if ($_POST["action"] == "correct_stock" && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||||
{
|
{
|
||||||
if (is_numeric($_POST["nbpiece"]))
|
if (is_numeric($_POST["nbpiece"]))
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->id = $_GET["id"];
|
$product->id = $_GET["id"];
|
||||||
$product->correct_stock($user,
|
$product->correct_stock($user,
|
||||||
$_POST["id_entrepot"],
|
$_POST["id_entrepot"],
|
||||||
$_POST["nbpiece"],
|
$_POST["nbpiece"],
|
||||||
$_POST["mouvement"]);
|
$_POST["mouvement"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == "transfert_stock" && $_POST["cancel"] <> $langs->trans("Cancel"))
|
if ($_POST["action"] == "transfert_stock" && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||||
{
|
{
|
||||||
if ($_POST["id_entrepot_source"] <> $_POST["id_entrepot_destination"])
|
if ($_POST["id_entrepot_source"] <> $_POST["id_entrepot_destination"])
|
||||||
{
|
|
||||||
if (is_numeric($_POST["nbpiece"]))
|
|
||||||
{
|
{
|
||||||
|
if (is_numeric($_POST["nbpiece"]))
|
||||||
|
{
|
||||||
|
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->id = $_GET["id"];
|
$product->id = $_GET["id"];
|
||||||
|
|
||||||
$product->correct_stock($user,
|
$product->correct_stock($user,
|
||||||
$_POST["id_entrepot_source"],
|
$_POST["id_entrepot_source"],
|
||||||
$_POST["nbpiece"],
|
$_POST["nbpiece"],
|
||||||
1);
|
1);
|
||||||
|
|
||||||
$product->correct_stock($user,
|
$product->correct_stock($user,
|
||||||
$_POST["id_entrepot_destination"],
|
$_POST["id_entrepot_destination"],
|
||||||
$_POST["nbpiece"],
|
$_POST["nbpiece"],
|
||||||
0);
|
0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -96,244 +96,264 @@ if ($_POST["action"] == "transfert_stock" && $_POST["cancel"] <> $langs->trans("
|
|||||||
*/
|
*/
|
||||||
if ($_GET["id"] || $_GET["ref"])
|
if ($_GET["id"] || $_GET["ref"])
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||||
|
|
||||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$head=product_prepare_head($product, $user);
|
$head=product_prepare_head($product, $user);
|
||||||
$titre=$langs->trans("CardProduct".$product->type);
|
$titre=$langs->trans("CardProduct".$product->type);
|
||||||
dolibarr_fiche_head($head, 'stock', $titre);
|
dolibarr_fiche_head($head, 'stock', $titre);
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
print($mesg);
|
print($mesg);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Reference
|
// Reference
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
|
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $html->showrefnav($product,'ref','',1,'ref');
|
print $html->showrefnav($product,'ref','',1,'ref');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Libellé
|
// Libellé
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Prix
|
// Prix
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">';
|
||||||
if ($product->price_base_type == 'TTC')
|
if ($product->price_base_type == 'TTC')
|
||||||
{
|
|
||||||
print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print price($product->price).' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Statut
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
|
||||||
print $product->getLibStatut(2);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Stock
|
|
||||||
print '<tr><td>'.$langs->trans("StockLimit").'</td>';
|
|
||||||
print '<td>'.$product->seuil_stock_alerte.'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Stock
|
|
||||||
print '<tr><td>'.$langs->trans("PhysicalStock").'</td>';
|
|
||||||
if ($product->stock_reel < $product->seuil_stock_alerte)
|
|
||||||
{
|
{
|
||||||
print '<td>'.$product->stock_reel.' '.img_warning().'</td>';
|
print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td>".$product->stock_reel.'</td>';
|
print price($product->price).' '.$langs->trans($product->price_base_type);
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Stock
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("VirtualStock").'</td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
print "<td>".$langs->trans("FeatureNotYetAvailable").'</td>';
|
print $product->getLibStatut(2);
|
||||||
print '</tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Nbre de commande clients en cours
|
// Stock physique
|
||||||
if ($conf->commande->enabled)
|
print '<tr><td>'.$langs->trans("PhysicalStock").'</td>';
|
||||||
{
|
print '<td>'.$product->stock_reel.'</td>';
|
||||||
$result=$product->load_stats_commande(0,'2');
|
print '</tr>';
|
||||||
if ($result < 0) dolibarr_print_error($db,$product->error);
|
|
||||||
print '<tr><td>'.$langs->trans("CustomersOrdersRunning").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
print $product->stats_commande['qty'];
|
|
||||||
$result=$product->load_stats_commande(0,'0,1');
|
|
||||||
if ($result < 0) dolibarr_print_error($db,$product->error);
|
|
||||||
print ' ('.$langs->trans("DraftOrWaitingShipped").': '.$product->stats_commande['qty'].')';
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nbre de commande fournisseurs en cours
|
|
||||||
if ($conf->fournisseur->enabled)
|
|
||||||
{
|
|
||||||
$result=$product->load_stats_commande_fournisseur(0,'3');
|
|
||||||
if ($result < 0) dolibarr_print_error($db,$product->error);
|
|
||||||
print '<tr><td>'.$langs->trans("SuppliersOrdersRunning").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
print $product->stats_commande_fournisseur['qty'];
|
|
||||||
$result=$product->load_stats_commande_fournisseur(0,'0,1,2');
|
|
||||||
if ($result < 0) dolibarr_print_error($db,$product->error);
|
|
||||||
print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')';
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
// Calculating a theorical value of stock if stock increment is done on order
|
||||||
|
if ($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)
|
||||||
|
{
|
||||||
|
$stock_commande_client=$stock_commande_fournisseur=0;
|
||||||
|
|
||||||
}
|
if ($conf->commande->enabled)
|
||||||
print '</div>';
|
{
|
||||||
|
$result=$product->load_stats_commande(0,'2');
|
||||||
|
if ($result < 0) dolibarr_print_error($db,$product->error);
|
||||||
|
$stock_commande_client=$product->stats_commande['qty'];
|
||||||
|
}
|
||||||
|
if ($conf->fournisseur->enabled)
|
||||||
|
{
|
||||||
|
$result=$product->load_stats_commande_fournisseur(0,'3');
|
||||||
|
if ($result < 0) dolibarr_print_error($db,$product->error);
|
||||||
|
$stock_commande_fournisseur=$product->stats_commande_fournisseur['qty'];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
$product->stock_theorique=$product->stock_reel-$stock_commande_client+$stock_commande_fournisseur;
|
||||||
* Correction du stock
|
|
||||||
*/
|
|
||||||
if ($_GET["action"] == "correction")
|
|
||||||
{
|
|
||||||
print_titre($langs->trans("StockCorrection"));
|
|
||||||
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
|
||||||
print '<input type="hidden" name="action" value="correct_stock">';
|
|
||||||
print '<table class="border" width="100%"><tr>';
|
|
||||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td>';
|
|
||||||
|
|
||||||
// Entrepot
|
// Stock theorique
|
||||||
print '<td width="20%"><select class="flat" name="id_entrepot">';
|
print '<tr><td>'.$langs->trans("VirtualStock").'</td>';
|
||||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
print "<td>".$product->stock_theorique;
|
||||||
$sql .= " WHERE statut = 1";
|
if ($product->stock_theorique < $product->seuil_stock_alerte)
|
||||||
$sql .= " ORDER BY lower(e.label)";
|
{
|
||||||
|
print ' '.img_warning($langs->trans("StockTooLow"));
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
if ($product->stock_theorique != $product->stock_reel)
|
||||||
if ($resql)
|
{
|
||||||
{
|
print '<tr><td>'.$langs->trans("StockDiffPhysicTeoric").'</td>';
|
||||||
$num = $db->num_rows($resql);
|
print '<td>';
|
||||||
$i = 0;
|
$found=0;
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</select></td>';
|
|
||||||
print '<td width="20%">';
|
|
||||||
print '<select name="mouvement" class="flat">';
|
|
||||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
|
||||||
print '<option value="1">'.$langs->trans("Delete").'</option>';
|
|
||||||
print '</select></td>';
|
|
||||||
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
|
|
||||||
|
|
||||||
print '</tr>';
|
// Nbre de commande clients en cours
|
||||||
print '<tr><td colspan="5" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
if ($conf->commande->enabled)
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
{
|
||||||
print '</table>';
|
if ($found) print '<br>'; else $found=1;
|
||||||
print '</form>';
|
print $langs->trans("CustomersOrdersRunning").': '.$stock_commande_client;
|
||||||
|
$result=$product->load_stats_commande(0,'0,1');
|
||||||
|
if ($result < 0) dolibarr_print_error($db,$product->error);
|
||||||
|
print ' ('.$langs->trans("DraftOrWaitingShipped").': '.$product->stats_commande['qty'].')';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
// Nbre de commande fournisseurs en cours
|
||||||
|
if ($conf->fournisseur->enabled)
|
||||||
|
{
|
||||||
|
if ($found) print '<br>'; else $found=1;
|
||||||
|
print $langs->trans("SuppliersOrdersRunning").': '.$stock_commande_fournisseur;
|
||||||
|
$result=$product->load_stats_commande_fournisseur(0,'0,1,2');
|
||||||
|
if ($result < 0) dolibarr_print_error($db,$product->error);
|
||||||
|
print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
// Stock
|
||||||
* Transfert de pièces
|
print '<tr><td>'.$langs->trans("StockLimit").'</td>';
|
||||||
*/
|
print '<td>'.$product->seuil_stock_alerte.'</td>';
|
||||||
if ($_GET["action"] == "transfert")
|
print '</tr>';
|
||||||
{
|
|
||||||
print_titre($langs->trans("Transfer"));
|
|
||||||
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
|
||||||
print '<input type="hidden" name="action" value="transfert_stock">';
|
|
||||||
print '<table class="border" width="100%"><tr>';
|
|
||||||
print '<td width="20%">'.$langs->trans("Source").'</td><td width="20%"><select name="id_entrepot_source">';
|
|
||||||
|
|
||||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
print "</table>";
|
||||||
$sql .= " WHERE statut = 1";
|
|
||||||
$sql .= " ORDER BY lower(e.label)";
|
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
}
|
||||||
if ($resql)
|
print '</div>';
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</select></td>';
|
|
||||||
|
|
||||||
print '<td width="20%">'.$langs->trans("Target").'</td><td width="20%"><select name="id_entrepot_destination">';
|
/*
|
||||||
|
* Correction du stock
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == "correction")
|
||||||
|
{
|
||||||
|
print_titre($langs->trans("StockCorrection"));
|
||||||
|
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
||||||
|
print '<input type="hidden" name="action" value="correct_stock">';
|
||||||
|
print '<table class="border" width="100%"><tr>';
|
||||||
|
print '<td width="20%">'.$langs->trans("Warehouse").'</td>';
|
||||||
|
|
||||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
// Entrepot
|
||||||
$sql .= " WHERE statut = 1";
|
print '<td width="20%"><select class="flat" name="id_entrepot">';
|
||||||
$sql .= " ORDER BY lower(e.label)";
|
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||||
|
$sql .= " WHERE statut = 1";
|
||||||
|
$sql .= " ORDER BY lower(e.label)";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</select></td>';
|
print '</select></td>';
|
||||||
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
print '<td width="20%">';
|
||||||
print '<tr><td colspan="6" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
print '<select name="mouvement" class="flat">';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||||
print '</table>';
|
print '<option value="1">'.$langs->trans("Delete").'</option>';
|
||||||
print '</form>';
|
print '</select></td>';
|
||||||
|
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
|
||||||
|
|
||||||
}
|
print '</tr>';
|
||||||
|
print '<tr><td colspan="5" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
/*
|
}
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($_GET["action"] == "definir")
|
|
||||||
{
|
|
||||||
print_titre($langs->trans("SetStock"));
|
|
||||||
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
|
||||||
print '<input type="hidden" name="action" value="create_stock">';
|
|
||||||
print '<table class="border" width="100%"><tr>';
|
|
||||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td><td width="40%"><select name="id_entrepot">';
|
|
||||||
|
|
||||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
/*
|
||||||
$sql .= " ORDER BY lower(e.label)";
|
* Transfert de pièces
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == "transfert")
|
||||||
|
{
|
||||||
|
print_titre($langs->trans("Transfer"));
|
||||||
|
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
||||||
|
print '<input type="hidden" name="action" value="transfert_stock">';
|
||||||
|
print '<table class="border" width="100%"><tr>';
|
||||||
|
print '<td width="20%">'.$langs->trans("Source").'</td><td width="20%"><select name="id_entrepot_source">';
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||||
if ($resql)
|
$sql .= " WHERE statut = 1";
|
||||||
{
|
$sql .= " ORDER BY lower(e.label)";
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
$resql=$db->query($sql);
|
||||||
while ($i < $num)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$num = $db->num_rows($resql);
|
||||||
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
$i = 0;
|
||||||
$i++;
|
while ($i < $num)
|
||||||
}
|
{
|
||||||
}
|
$obj = $db->fetch_object($resql);
|
||||||
print '</select></td><td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
||||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
$i++;
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>';
|
}
|
||||||
print '</table>';
|
}
|
||||||
print '</form>';
|
print '</select></td>';
|
||||||
}
|
|
||||||
|
print '<td width="20%">'.$langs->trans("Target").'</td><td width="20%"><select name="id_entrepot_destination">';
|
||||||
|
|
||||||
|
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||||
|
$sql .= " WHERE statut = 1";
|
||||||
|
$sql .= " ORDER BY lower(e.label)";
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</select></td>';
|
||||||
|
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
||||||
|
print '<tr><td colspan="6" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == "definir")
|
||||||
|
{
|
||||||
|
print_titre($langs->trans("SetStock"));
|
||||||
|
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
||||||
|
print '<input type="hidden" name="action" value="create_stock">';
|
||||||
|
print '<table class="border" width="100%"><tr>';
|
||||||
|
print '<td width="20%">'.$langs->trans("Warehouse").'</td><td width="40%"><select name="id_entrepot">';
|
||||||
|
|
||||||
|
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||||
|
$sql .= " ORDER BY lower(e.label)";
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</select></td><td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
||||||
|
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error();
|
dolibarr_print_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -378,21 +398,21 @@ $entrepotstatic=new Entrepot($db);
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i=0; $total=0; $var=false;
|
$i=0; $total=0; $var=false;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$entrepotstatic->id=$obj->rowid;
|
$entrepotstatic->id=$obj->rowid;
|
||||||
$entrepotstatic->libelle=$obj->label;
|
$entrepotstatic->libelle=$obj->label;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$entrepotstatic->getNomUrl(1).'</td>';
|
print '<td>'.$entrepotstatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="right">'.$obj->reel.'</td>';
|
print '<td align="right">'.$obj->reel.'</td>';
|
||||||
print '</tr>'; ;
|
print '</tr>'; ;
|
||||||
$total = $total + $obj->reel;
|
$total = $total + $obj->reel;
|
||||||
$i++;
|
$i++;
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total"><td align="right" class="liste_total">'.$langs->trans("Total").':</td><td class="liste_total" align="right">'.$total."</td></tr>";
|
print '<tr class="liste_total"><td align="right" class="liste_total">'.$langs->trans("Total").':</td><td class="liste_total" align="right">'.$total."</td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user