';
print img_picto($langs->trans("StockMovement"),'uparrow.png').' '.$langs->trans("StockMovement");
@@ -434,8 +451,13 @@ else
print '| '.$langs->trans("Total").' | ';
print ''.$totalunit.' | ';
print ' | ';
- print ''.price(price2num($totalvalue,'MT')).' | ';
- print ' | ';
+ print ''.price(price2num($totalvalue,'MT')).' | ';
+ if (empty($conf->global->PRODUIT_MULTIPRICES))
+ {
+ print ' | ';
+ print ''.price(price2num($totalvaluesell,'MT')).' | ';
+ }
+ print ' | ';
print ' | ';
print '
';
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 4ec106c278a..fb992a6f0f9 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -198,11 +198,18 @@ if ($_GET["id"] || $_GET["ref"])
// PMP
print '| '.$langs->trans("AverageUnitPricePMP").' | ';
- print ''.price($product->pmp);
- print ' | ';
+ print ''.price($product->pmp).' '.$langs->trans("HT").' | ';
print '
';
- // Real stock
+ // Sell price
+ print '| '.$langs->trans("SellPriceMin").' | ';
+ print '';
+ if (empty($conf->global->PRODUIT_MULTIPRICES)) print price($product->price).' '.$langs->trans("HT");
+ else print $langs->trans("Variable");
+ print ' | ';
+ print '
';
+
+ // Real stock
print '| '.$langs->trans("PhysicalStock").' | ';
print ''.$product->stock_reel;
if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockTooLow"));
@@ -436,11 +443,13 @@ print ' |
| '.$langs->trans("Warehouse").''.$langs->trans("NumberOfUnit").' | ';
print ''.$langs->trans("AverageUnitPricePMPShort").' | ';
print ''.$langs->trans("EstimatedStockValueShort").' | ';
+print ''.$langs->trans("SellPriceMin").' | ';
+print ''.$langs->trans("EstimatedStockValueSellShort").' | ';
print '
';
$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp";
-$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
-$sql.= ", ".MAIN_DB_PREFIX."product_stock as ps";
+$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
+$sql.= " ".MAIN_DB_PREFIX."product_stock as ps";
$sql.= " WHERE ps.reel != 0";
$sql.= " AND ps.fk_entrepot = e.rowid";
$sql.= " AND e.entity = ".$conf->entity;
@@ -449,7 +458,7 @@ $sql.= " ORDER BY e.label";
$entrepotstatic=new Entrepot($db);
$total=0;
-$totalvalue=0;
+$totalvalue=$totalvaluesell=0;
$resql=$db->query($sql);
if ($resql)
@@ -464,21 +473,42 @@ if ($resql)
print '';
print '| '.$entrepotstatic->getNomUrl(1).' | ';
print ''.$obj->reel.($obj->reel<0?' '.img_warning():'').' | ';
+ // PMP
print ''.price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp),'MU').' | '; // Ditto : Show PMP from movement or from product
print ''.price(price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp)*$obj->reel,'MT')).' | '; // Ditto : Show PMP from movement or from product
+ // Sell price
+ print '';
+ if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($product->price,'MU'));
+ else print $langs->trans("Variable");
+ print ' | '; // Ditto : Show PMP from movement or from product
+ print '';
+ if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($product->price*$obj->reel,'MT')).' | '; // Ditto : Show PMP from movement or from product
+ else print $langs->trans("Variable");
print '
'; ;
$total = $total + $obj->reel;
$totalvalue = $totalvalue + price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp)*$obj->reel,'MT'); // Ditto : Show PMP from movement or from product
+ $totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MT'); // Ditto : Show PMP from movement or from product
$i++;
$var=!$var;
}
}
+else dol_print_error($db);
print '| '.$langs->trans("Total").': | ';
print ''.$total.' | ';
print '';
print ($total?price($totalvalue/$total):' ');
print ' | ';
-print ''.price($totalvalue).' | ';
+print '';
+print price($totalvalue);
+print ' | ';
+print '';
+if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print ($total?price($totalvaluesell/$total):' ');
+else print $langs->trans("Variable");
+print ' | ';
+print '';
+if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price($totalvaluesell);
+else print $langs->trans("Variable");
+print ' | ';
print "
";
print "";
diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php
index de198b1480e..ddf8d9860d9 100644
--- a/htdocs/product/stock/valo.php
+++ b/htdocs/product/stock/valo.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2009 Laurent Destailleur
+ * Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
/**
* \file htdocs/product/stock/valo.php
* \ingroup stock
- * \brief Page de valorisation des stocks
+ * \brief Page with stock values
* \version $Id$
*/
@@ -55,97 +55,108 @@ $year = strftime("%Y",time());
// Affichage valorisation par entrepot
$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,";
-$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue";
+$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql.= " WHERE e.entity = ".$conf->entity;
if ($sref)
{
- $sql.= " AND e.ref LIKE '%".$sref."%'";
+ $sql.= " AND e.ref LIKE '%".$sref."%'";
}
if ($sall)
{
- $sql.= " AND (e.label LIKE '%".$db->escape($sall)."%'";
- $sql.= " OR e.description LIKE '%".$db->escape($sall)."%'";
- $sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
- $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'";
- $sql.= " OR e.ville LIKE '%".$db->escape($sall)."%')";
+ $sql.= " AND (e.label LIKE '%".$db->escape($sall)."%'";
+ $sql.= " OR e.description LIKE '%".$db->escape($sall)."%'";
+ $sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
+ $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'";
+ $sql.= " OR e.ville LIKE '%".$db->escape($sall)."%')";
}
$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu";
-$sql.= " ORDER BY $sortfield $sortorder ";
+$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
$result = $db->query($sql) ;
if ($result)
{
- $num = $db->num_rows($result);
+ $num = $db->num_rows($result);
- $i = 0;
+ $i = 0;
- $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
- llxHeader("",$langs->trans("EnhancedValueOfWarehouses"),$help_url);
+ $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
+ llxHeader("",$langs->trans("EnhancedValueOfWarehouses"),$help_url);
- print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, "valo.php", "", $sortfield, $sortorder,'',$num);
+ 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("EstimatedStockValue"),"valo.php", "e.valo_pmp",'','','align="right"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder);
- print "
\n";
+ 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("EstimatedStockValue"),"valo.php", "e.valo_pmp",'','','align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("EstimatedStockValueSell"),"", "",'','','align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder);
+ print "
\n";
- if ($num)
- {
- $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 '';
- print price(price2num($objp->estimatedvalue,'MT'));
- print ' | ';
- print ''.$entrepot->LibStatut($objp->statut,5).' | ';
- print "
\n";
- $total += price2num($objp->estimatedvalue,'MU');
- $var=!$var;
- $i++;
- }
+ if ($num)
+ {
+ $entrepot=new Entrepot($db);
+ $total = $totalsell = 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.' | ';
+ // PMP value
+ print '';
+ print price(price2num($objp->estimatedvalue,'MT'));
+ print ' | ';
+ // Selling value
+ print '';
+ if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue,'MT'));
+ else print $langs->trans("Variable");
+ print ' | ';
+ // Status
+ print ''.$entrepot->LibStatut($objp->statut,5).' | ';
+ print "
\n";
+ $total += price2num($objp->estimatedvalue,'MU');
+ $totalsell += price2num($objp->sellvalue,'MU');
+ $var=!$var;
+ $i++;
+ }
- print '';
- print '| '.$langs->trans("Total").' | ';
- print ''.price($total).' '.$langs->trans('Currency'.$conf->monnaie).' | ';
- print ' | ';
- print "
\n";
+ print '';
+ print '| '.$langs->trans("Total").' | ';
+ print ''.price(price2num($total,'MT')).' '.$langs->trans('Currency'.$conf->monnaie).' | ';
+ print ''.price(price2num($totalsell,'MT')).' '.$langs->trans('Currency'.$conf->monnaie).' | ';
+ print ' | ';
+ print "
\n";
- }
- $db->free($result);
- print "
";
+ }
+ $db->free($result);
+ print "
";
- print '
';
+ print '
';
- $file='entrepot-'.$year.'.png';
- if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file))
- {
- $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
- print '
';
- }
+ $file='entrepot-'.$year.'.png';
+ if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file))
+ {
+ $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
+ print '
';
+ }
- $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 '
';
- }
+ $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 '
';
+ }
}
else
{
- dol_print_error($db);
+ dol_print_error($db);
}
$db->close();