diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang
index e2648b257e4..21f012afa81 100644
--- a/htdocs/langs/en_US/other.lang
+++ b/htdocs/langs/en_US/other.lang
@@ -54,6 +54,7 @@ CanceledBy=Canceled by %s
ClosedBy=Closed by %s
FileWasRemoved=File was deleted
DirWasRemoved=Directory was removed
+FeatureNotYetAvailableShort=Available in a next version
FeatureNotYetAvailable=Feature not yet available in this version
FeatureExperimental=Experimental feature. Not stable in this version
FeatureDevelopment=Development feature. Not stable in this version
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index b1303c96169..05958d2bf33 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -34,6 +34,7 @@ NumberOfUnit=Number of units
TotalStock=Total in stock
StockTooLow=Stock too low
EnhancedValue=Value
+PMPValue=Value
EnhancedValueOfWarehouses=Warehouses value
UserWarehouseAutoCreate=Create a stock automatically when creating a user
QtyDispatched=Quantity dispatched
diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang
index 432417a04a6..f7c4fd78356 100644
--- a/htdocs/langs/fr_FR/other.lang
+++ b/htdocs/langs/fr_FR/other.lang
@@ -54,6 +54,7 @@ CanceledBy=Annul
ClosedBy=Cloturé par %s
FileWasRemoved=Le fichier a été supprimé
DirWasRemoved=Le répertoire a été supprimé
+FeatureNotYetAvailableShort=Disponible dans une prochaine version
FeatureNotYetAvailable=Fonctionnalité pas encore disponible dans cette version
FeatureExperimental=Fonctionnalité expérimentale. Non stable dans cette version
FeatureDevelopment=Fonctionnalité en développement. Non stable dans cette version
diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang
index 1f99d60ae31..3e61885cd1c 100644
--- a/htdocs/langs/fr_FR/stocks.lang
+++ b/htdocs/langs/fr_FR/stocks.lang
@@ -34,6 +34,7 @@ NumberOfUnit=Nombre de pi
TotalStock=Total en stock
StockTooLow=Stock insuffisant
EnhancedValue=Valorisation
+PMPValue=Valorisation (PMP)
EnhancedValueOfWarehouses=Valorisation des stocks
UserWarehouseAutoCreate=Créer un stock automatiquement à la création d'un utilisateur
QtyDispatched=Quantité ventilée
diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php
index 1dcbb48d93c..8857e6a863c 100644
--- a/htdocs/product/stock/fiche.php
+++ b/htdocs/product/stock/fiche.php
@@ -265,11 +265,13 @@ else
// Statut
print '
| '.$langs->trans("Status").' | '.$entrepot->getLibStatut(4).' |
';
+ // Nb of products
print '| '.$langs->trans("NumberOfProducts").' | ';
- print $entrepot->nb_products();
+ $nb=$entrepot->nb_products();
+ print empty($nb)?'0':$nb;
print " |
";
- // Dernier mouvement
+ // Last movement
$sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
$sql .= " FROM llx_stock_mouvement as m";
$sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
@@ -320,12 +322,14 @@ else
print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PMP"),"", "ps.pmp","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
if ($user->rights->stock->mouvement->creer) print ' | ';
if ($user->rights->stock->creer) print ' | ';
print "";
- $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value ";
- $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
+ $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit,";
+ $sql.= " ps.reel as value";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
@@ -375,8 +379,11 @@ else
print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref;
print "";
print ''.$objp->produit.' | ';
+
print ''.$objp->value.' | ';
-
+
+ print ''.$langs->trans("FeatureNotYetAvailableShort").' | ';
+
if ($user->rights->stock->mouvement->creer)
{
print '';
diff --git a/htdocs/product/stock/mouvementstock.class.php b/htdocs/product/stock/mouvementstock.class.php
index 72e1aae3d8f..98f585ce492 100644
--- a/htdocs/product/stock/mouvementstock.class.php
+++ b/htdocs/product/stock/mouvementstock.class.php
@@ -45,7 +45,7 @@ class MouvementStock
function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0)
{
global $conf;
-
+
$error = 0;
dolibarr_syslog("MouvementStock::_Create $user->id, $fk_product, $entrepot_id, qty=$qty, type=$type, $price");
@@ -59,7 +59,7 @@ class MouvementStock
$sql.= " (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author, price)";
$sql.= " VALUES (".$this->db->idate(mktime()).", ".$fk_product.", ".$entrepot_id.", ".$qty.", ".$type.", ".$user->id;
$sql.= ",'".price2num($price)."')";
-
+
dolibarr_syslog("MouvementStock::_create sql=".$sql, LOG_DEBUG);
if ($resql = $this->db->query($sql))
{
@@ -70,8 +70,8 @@ class MouvementStock
dolibarr_syslog("MouvementStock::_Create ".$this->error);
$error = -1;
}
-
- // Get current value of stock
+
+ // Test if there is already a record for couple (warehouse / product)
$num = 0;
if ($error == 0)
{
@@ -108,7 +108,9 @@ class MouvementStock
dolibarr_syslog("MouvementStock::_Create sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
-
+ // TODO
+ // Update value of PMP in product_stock
+
}
else
{
@@ -117,24 +119,26 @@ class MouvementStock
}
}
+ /*
if ($error == 0)
{
$valo_mouvement = 0;
$error = $this->CalculateValoPmp($mvid, $fk_product, $qty, $price, $valo_mouvement);
}
-
+
if ($error == 0)
{
$error = $this->CalculateEntrepotValoPmp($user, $entrepot_id, $valo_mouvement);
}
+ */
}
-
- // Add movement for sub products
+
+ // Add movement for sub products
if ($error == 0 && $conf->global->PRODUIT_SOUSPRODUITS)
{
$error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, $price=0);
}
-
+
// composition module
if ($error == 0 && $qty < 0 && $conf->global->MAIN_MODULE_COMPOSITION)
{
@@ -157,7 +161,7 @@ class MouvementStock
/**
- * \brief Create movement in databse for all subproducts
+ * \brief Create movement in database for all subproducts
* \return int <0 si ko, 0 si ok
*/
function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price=0)
@@ -198,52 +202,93 @@ class MouvementStock
return $error;
}
+
+ /**
+ * \brief Crée un mouvement en base pour toutes les compositions de produits
+ * \return int <0 si ko, 0 si ok
+ */
+ function _createProductComposition($user, $fk_product, $entrepot_id, $qty, $type, $price=0)
+ {
+
+
+ dolibarr_syslog("MouvementStock::_createComposition $user->id, $fk_product, $entrepot_id, $qty, $type, $price");
+ $products_compo = array();
+
+ $sql = "SELECT fk_product_composition, qte, etat_stock";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_composition";
+ $sql.= " WHERE fk_product = $fk_product;";
+
+ $all = $this->db->query($sql);
+
+ if ($all)
+ {
+ while($item = $this->db->fetch_object($all) )
+ {
+ if($item->etat_stock != 0) array_push($products_compo,$item);
+ }
+ $this->db->free($resql);
+ }
+ else
+ {
+ dolibarr_syslog("MouvementStock::_Create echec update ".$this->error);
+ return -1;
+ }
+
+ foreach($products_compo as $product)
+ {
+ $this->_create($user, $product->fk_product_composition, $entrepot_id, ($qty*$product->qte), $type, $price=0);
+ }
+
+ return 0;
+ }
+
+
+ /**
+ * \brief Decrease stock for product and subproducts
+ * \return int <0 if KO, >0 if OK
+ */
+ function livraison($user, $fk_product, $entrepot_id, $qty)
+ {
+ return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2);
+ }
/**
- * \brief Crée un mouvement en base pour toutes les compositions de produits
- * \return int <0 si ko, 0 si ok
- */
- function _createProductComposition($user, $fk_product, $entrepot_id, $qty, $type, $price=0)
- {
-
-
- dolibarr_syslog("MouvementStock::_createComposition $user->id, $fk_product, $entrepot_id, $qty, $type, $price");
- $products_compo = array();
-
- $sql = "SELECT fk_product_composition, qte, etat_stock";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_composition";
- $sql.= " WHERE fk_product = $fk_product;";
-
- $all = $this->db->query($sql);
-
- if ($all)
- {
- while($item = $this->db->fetch_object($all) )
- {
- if($item->etat_stock != 0) array_push($products_compo,$item);
- }
- $this->db->free($resql);
- }
- else
- {
- dolibarr_syslog("MouvementStock::_Create echec update ".$this->error);
- return -1;
- }
-
- foreach($products_compo as $product)
- {
- $this->_create($user, $product->fk_product_composition, $entrepot_id, ($qty*$product->qte), $type, $price=0);
- }
-
- return 0;
- }
+ * \brief Increase stock for product and subproducts
+ * \return int <0 if KO, >0 if OK
+ */
+ function reception($user, $fk_product, $entrepot_id, $qty, $price=0)
+ {
+ return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price);
+ }
- /**
+ /**
+ * Return nb of subproducts for a product
+ *
+ * @param unknown_type $id
+ * @return unknown
+ */
+ function nbOfSubProdcuts($id)
+ {
+ $nbSP=0;
+
+ $resql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."product_association";
+ $resql.= " WHERE fk_product_pere = ".$id;
+ if ($this->db->query($resql))
+ {
+ $obj=$this->db->fetch_object($resql);
+ $nbSP=$obj->nb;
+ }
+ $this->db->free($resql);
+ return $nbSP;
+ }
+
+ /**
* \brief Calcul ???
* \return int <0 si ko, >0 si ok
*/
+ /*
function CalculateEntrepotValoPmp($user, $entrepot_id, $valo_mouvement)
{
$error = 0;
@@ -251,94 +296,94 @@ class MouvementStock
if ( $valo_mouvement <> 0 )
{
- $entrepot_value_pmp = 0;
+ $entrepot_value_pmp = 0;
- if ($error === 0)
- {
- $sql = "SELECT valo_pmp,".$this->db->pdate("date_calcul")." FROM ".MAIN_DB_PREFIX."entrepot_valorisation";
- $sql.= " WHERE fk_entrepot = $entrepot_id ORDER BY date_calcul DESC LIMIT 1;";
-
- if ($this->db->query($sql))
- {
- while ($row = $this->db->fetch_row($resql) )
- {
- $entrepot_value_pmp = $row[0];
- $entrepot_value_date = $row[1];
- }
- $this->db->free($resql);
- }
- else
- {
- $error = -26;
- dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp ERRORSQL[$error]");
- }
- }
+ if ($error === 0)
+ {
+ $sql = "SELECT valo_pmp,".$this->db->pdate("date_calcul")." FROM ".MAIN_DB_PREFIX."entrepot_valorisation";
+ $sql.= " WHERE fk_entrepot = $entrepot_id ORDER BY date_calcul DESC LIMIT 1;";
+
+ if ($this->db->query($sql))
+ {
+ while ($row = $this->db->fetch_row($resql) )
+ {
+ $entrepot_value_pmp = $row[0];
+ $entrepot_value_date = $row[1];
+ }
+ $this->db->free($resql);
+ }
+ else
+ {
+ $error = -26;
+ dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp ERRORSQL[$error]");
+ }
+ }
- $new_value = $entrepot_value_pmp + $valo_mouvement;
+ $new_value = $entrepot_value_pmp + $valo_mouvement;
- $now = time();
+ $now = time();
- if ($error === 0)
- {
- if ( strftime('%Y%m%d',$entrepot_value_date) == strftime('%Y%m%d',$now) )
- {
- $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot_valorisation";
- $sql.= " SET valo_pmp='".price2num($new_value)."'";
- $sql.= " WHERE fk_entrepot = $entrepot_id ";
- $sql.= " AND ".$this->db->pdate("date_calcul")."='".$entrepot_value_date."';";
- }
- else
- {
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot_valorisation";
- $sql.= " (date_calcul, fk_entrepot, valo_pmp)";
- $sql.= " VALUES (".$this->db->idate(mktime()).", ".$entrepot_id;
- $sql.= ",'".price2num($new_value)."')";
- }
-
- if ($this->db->query($sql))
- {
+ if ($error === 0)
+ {
+ if ( strftime('%Y%m%d',$entrepot_value_date) == strftime('%Y%m%d',$now) )
+ {
+ $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot_valorisation";
+ $sql.= " SET valo_pmp='".price2num($new_value)."'";
+ $sql.= " WHERE fk_entrepot = $entrepot_id ";
+ $sql.= " AND ".$this->db->pdate("date_calcul")."='".$entrepot_value_date."';";
+ }
+ else
+ {
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot_valorisation";
+ $sql.= " (date_calcul, fk_entrepot, valo_pmp)";
+ $sql.= " VALUES (".$this->db->idate(mktime()).", ".$entrepot_id;
+ $sql.= ",'".price2num($new_value)."')";
+ }
+
+ if ($this->db->query($sql))
+ {
- }
- else
- {
- $error = -27;
- dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp ERRORSQL[$error]");
- }
- }
+ }
+ else
+ {
+ $error = -27;
+ dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp ERRORSQL[$error]");
+ }
+ }
- if ($error === 0)
- {
- $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot";
- $sql.= " SET valo_pmp='".price2num($new_value)."'";
- $sql.= " WHERE rowid = $entrepot_id ";
-
- if ($this->db->query($sql))
- {
+ if ($error === 0)
+ {
+ $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot";
+ $sql.= " SET valo_pmp='".price2num($new_value)."'";
+ $sql.= " WHERE rowid = $entrepot_id ";
+
+ if ($this->db->query($sql))
+ {
- }
- else
- {
- $error = -28;
- dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp ERRORSQL[$error]");
- }
- }
+ }
+ else
+ {
+ $error = -28;
+ dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp ERRORSQL[$error]");
+ }
+ }
- if ($error === 0)
- {
- return 0;
- }
- else
- {
- dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp RETURN IN ERROR[$error]");
- return $error;
- }
+ if ($error === 0)
+ {
+ return 0;
+ }
+ else
+ {
+ dolibarr_syslog("MouvementStock::CalculateEntrepotValoPmp RETURN IN ERROR[$error]");
+ return $error;
+ }
}
else
{
- return 0;
+ return 0;
}
}
-
+ */
/**
* \brief ???
@@ -349,6 +394,7 @@ class MouvementStock
* \param value_ope float Valeur du mouvement en retour
* \return int <0 si ko, 0 si ok
*/
+ /*
function CalculateValoPmp($mvid, $fk_product, $qty, $price=0, &$value_ope)
{
$error = 0;
@@ -382,9 +428,7 @@ class MouvementStock
}
}
- /*
- * Calcul
- */
+ // Calcul
if ($qty > 0)
{
// on stock
@@ -405,9 +449,8 @@ class MouvementStock
$new_stock_qty = $qty_stock + $qty;
$new_stock_value_pmp = $stock_value_pmp + $value_ope;
- /*
- * Fin calcul
- */
+
+ // Fin calcul
if ($error === 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_valorisation";
@@ -446,48 +489,6 @@ class MouvementStock
return 0;
}
}
-
-
- /**
- * \brief Decrease stock for product and subproducts
- * \return int <0 if KO, >0 if OK
- */
- function livraison($user, $fk_product, $entrepot_id, $qty)
- {
- return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2);
- }
-
-
- /**
- * \brief Increase stock for product and subproducts
- * \return int <0 if KO, >0 if OK
- */
- function reception($user, $fk_product, $entrepot_id, $qty, $price=0)
- {
- return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price);
- }
-
-
- /**
- * Return nb of subproducts for a product
- *
- * @param unknown_type $id
- * @return unknown
- */
- function nbOfSubProdcuts($id)
- {
- $nbSP=0;
-
- $resql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."product_association";
- $resql.= " WHERE fk_product_pere = ".$id;
- if ($this->db->query($resql))
- {
- $obj=$this->db->fetch_object($resql);
- $nbSP=$obj->nb;
- }
- $this->db->free($resql);
- return $nbSP;
- }
-
+ */
}
?>
diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php
index 399345e3e28..e29b2219e4f 100644
--- a/htdocs/product/stock/valo.php
+++ b/htdocs/product/stock/valo.php
@@ -18,11 +18,11 @@
*/
/**
- \file htdocs/product/stock/valo.php
- \ingroup stock
- \brief Page de valorisation des stocks
- \version $Id$
-*/
+ * \file htdocs/product/stock/valo.php
+ * \ingroup stock
+ * \brief Page de valorisation des stocks
+ * \version $Id$
+ */
require("./pre.inc.php");
require_once("./entrepot.class.php");
@@ -30,7 +30,7 @@ require_once("./entrepot.class.php");
$langs->load("stocks");
if (!$user->rights->stock->lire)
- accessforbidden();
+accessforbidden();
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
@@ -38,8 +38,8 @@ $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
-if (! $sortfield) $sortfield="valo";
-if (! $sortorder) $sortorder="DESC";
+if (! $sortfield) $sortfield="e.label";
+if (! $sortorder) $sortorder="ASC";
$page = $_GET["page"];
if ($page < 0) $page = 0;
$limit = $conf->liste_limit;
@@ -47,22 +47,22 @@ $offset = $limit * $page;
$year = strftime("%Y",time());
-
+
/*
* View
*/
// Affichage valorisation par entrepot
-$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu, e.valo_pmp as valo";
+$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE 1=1";
if ($sref)
{
- $sql .= " AND e.ref like '%".$sref."%'";
+ $sql .= " AND e.ref like '%".$sref."%'";
}
if ($sall)
{
- $sql .= " AND (e.label like '%".addslashes($sall)."%' OR e.description like '%".addslashes($sall)."%' OR e.lieu like '%".addslashes($sall)."%' OR e.address like '%".addslashes($sall)."%' OR e.ville like '%".addslashes($sall)."%')";
+ $sql .= " AND (e.label like '%".addslashes($sall)."%' OR e.description like '%".addslashes($sall)."%' OR e.lieu like '%".addslashes($sall)."%' OR e.address like '%".addslashes($sall)."%' OR e.ville like '%".addslashes($sall)."%')";
}
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->plimit($limit + 1, $offset);
@@ -70,52 +70,55 @@ $sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql) ;
if ($result)
{
- $num = $db->num_rows($result);
-
- $i = 0;
-
- llxHeader("","",$langs->trans("EnhancedValueOfWarehouses"));
-
- print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, "valo.php", "", $sortfield, $sortorder,'',$num);
-
- print '';
- print "";
- print_liste_field_titre($langs->trans("Ref"),"valo.php", "e.label","","","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("LocationSummary"),"valo.php", "e.lieu","","","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("EnhancedValue"),"valo.php", "valo",'','','align="right"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder);
- print " \n";
+ $num = $db->num_rows($result);
- if ($num)
- {
- $entrepot=new Entrepot($db);
- $total = 0;
- $var=false;
- while ($i < min($num,$limit))
+ $i = 0;
+
+ llxHeader("","",$langs->trans("EnhancedValueOfWarehouses"));
+
+ print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, "valo.php", "", $sortfield, $sortorder,'',$num);
+
+ print '';
+ print "";
+ print_liste_field_titre($langs->trans("Ref"),"valo.php", "e.label","","","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("LocationSummary"),"valo.php", "e.lieu","","","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PMPValue"),"valo.php", "valo",'','','align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder);
+ print " \n";
+
+ if ($num)
{
- $objp = $db->fetch_object($result);
- print "";
- print '| '.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.' | ';
- print ''.$objp->lieu.' | ';
- print ''.price($objp->valo).' '.$langs->trans('Currency'.$conf->monnaie).' | ';
- print ''.$entrepot->LibStatut($objp->statut,5).' | ';
- print " \n";
- $total += $objp->valo;
- $var=!$var;
- $i++;
+ $entrepot=new Entrepot($db);
+ $total = 0;
+ $var=false;
+ while ($i < min($num,$limit))
+ {
+ $objp = $db->fetch_object($result);
+ print "";
+ print '| '.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.' | ';
+ print ''.$objp->lieu.' | ';
+ print '';
+ // This value is real QTY * PMP of products in llx_product_stock for the warehouse
+ print $langs->trans("FeatureNotYetAvailableShort");
+ print ' | ';
+ print ''.$entrepot->LibStatut($objp->statut,5).' | ';
+ print " \n";
+ $total += $objp->valo;
+ $var=!$var;
+ $i++;
+ }
+
+ print '';
+ print '| '.$langs->trans("Total").' | ';
+ print ''.price($total).' '.$langs->trans('Currency'.$conf->monnaie).' | ';
+ print ' | ';
+ print " \n";
+
}
+ $db->free($result);
+ print " ";
- print '';
- print '| '.$langs->trans("Total").' | ';
- print ''.price($total).' '.$langs->trans('Currency'.$conf->monnaie).' | ';
- print ' | ';
- print " \n";
-
- }
- $db->free($result);
- print " ";
-
- print ' ';
+ print ' ';
$file='entrepot-'.$year.'.png';
if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file))
@@ -126,15 +129,15 @@ if ($result)
$file='entrepot-'.($year-1).'.png';
if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file))
- {
- $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
- print '
';
- }
+ {
+ $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
+ print '
';
+ }
}
else
{
- dolibarr_print_error($db);
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/mysql/migration/2.5.0-2.6.0.sql b/mysql/migration/2.5.0-2.6.0.sql
index b8e6c0835ac..0df8d3ff5ca 100644
--- a/mysql/migration/2.5.0-2.6.0.sql
+++ b/mysql/migration/2.5.0-2.6.0.sql
@@ -13,3 +13,6 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (71, 'facture_fourn', 'external', 'BILLING', 'Contact fournisseur facturation', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
+
+alter table llx_product_stock add column pmp double(24,8) default 0 NOT NULL;
+
diff --git a/mysql/tables/llx_product_stock.sql b/mysql/tables/llx_product_stock.sql
index 7f6d37e2875..893390535f6 100644
--- a/mysql/tables/llx_product_stock.sql
+++ b/mysql/tables/llx_product_stock.sql
@@ -24,6 +24,7 @@ create table llx_product_stock
tms timestamp,
fk_product integer NOT NULL,
fk_entrepot integer NOT NULL,
- reel integer -- stock réel
+ reel integer -- physical stock
+ pmp double(24,8) default 0 NOT NULL -- PMP value for product in this warehous
)type=innodb;
|