27require
'../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
31$langs->load(
"stocks");
36$sref =
GETPOST(
"sref",
'alpha');
37$snom =
GETPOST(
"snom",
'alpha');
38$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
40$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
41$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
53$offset = $limit * $page;
62$sql =
"SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
63$sql .=
" SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
64$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
65$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_stock as ps ON e.rowid = ps.fk_entrepot";
66$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON ps.fk_product = p.rowid";
67$sql .=
" WHERE e.entity IN (".getEntity(
'stock').
")";
72 $sql .=
" AND (e.ref LIKE '%".$db->escape($sall).
"%'";
73 $sql .=
" OR e.description LIKE '%".$db->escape($sall).
"%'";
74 $sql .=
" OR e.lieu LIKE '%".$db->escape($sall).
"%'";
75 $sql .=
" OR e.address LIKE '%".$db->escape($sall).
"%'";
76 $sql .=
" OR e.town LIKE '%".$db->escape($sall).
"%')";
78$sql .=
" GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
79$sql .= $db->order($sortfield, $sortorder);
80$sql .= $db->plimit($limit + 1, $offset);
82$result = $db->query($sql);
84 $num = $db->num_rows($result);
88 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
89 llxHeader(
"", $langs->trans(
"EnhancedValueOfWarehouses"), $help_url);
91 print_barre_liste($langs->trans(
"EnhancedValueOfWarehouses"), $page, $_SERVER[
"PHP_SELF"],
"", $sortfield, $sortorder,
'', $num);
93 print
'<table class="noborder centpercent">';
94 print
"<tr class=\"liste_titre\">";
97 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"e.valo_pmp",
'',
'',
'', $sortfield, $sortorder,
'right ');
98 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'right ');
99 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"e.statut",
'',
'',
'', $sortfield, $sortorder,
'right ');
104 $total = $totalsell = 0;
106 while ($i < min($num, $limit)) {
107 $objp = $db->fetch_object($result);
108 print
'<tr class="oddeven">';
109 print
'<td><a href="card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowWarehouse"),
'stock').
' '.$objp->ref.
'</a></td>';
110 print
'<td>'.$objp->lieu.
'</td>';
112 print
'<td class="right">';
113 if (
price2num($objp->estimatedvalue,
'MT')) {
120 print
'<td class="right">';
121 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
124 print $langs->trans(
"Variable");
128 print
'<td class="right">'.$entrepot->LibStatut($objp->statut, 5).
'</td>';
130 $total +=
price2num($objp->estimatedvalue,
'MU');
131 $totalsell +=
price2num($objp->sellvalue,
'MU');
136 print
'<tr class="liste_total">';
137 print
'<td colspan="2" class="right">'.$langs->trans(
"Total").
'</td>';
138 print
'<td class="right">'.price(
price2num($total,
'MT'), 1, $langs, 0, 0, -1, $conf->currency).
'</td>';
139 print
'<td class="right">'.price(
price2num($totalsell,
'MT'), 1, $langs, 0, 0, -1, $conf->currency).
'</td>';
140 print
'<td class="right"> </td>';
150 $file =
'entrepot-'.$year.
'.png';
151 if (file_exists($conf->stock->dir_temp.
'/'.$file)) {
152 $url = DOL_URL_ROOT.
'/viewimage.php?modulepart=graph_stock&file='.$file;
153 print
'<img src="'.$url.
'">';
156 $file =
'entrepot-'.($year - 1).
'.png';
157 if (file_exists($conf->stock->dir_temp.
'/'.$file)) {
158 $url = DOL_URL_ROOT.
'/viewimage.php?modulepart=graph_stock&file='.$file;
159 print
'<br><img src="'.$url.
'">';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage warehouses.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.