dolibarr 19.0.3
fiche-valo.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
29
30// Load translation files required by the page
31$langs->loadLangs(array('products', 'stocks', 'companies'));
32
33$id = GETPOST('id', 'int');
34
35// Security check
36$result = restrictedArea($user, 'stock');
37
38
39/*
40 * View
41 */
42
43$form = new Form($db);
44
45$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
46llxHeader("", $langs->trans("WarehouseCard"), $help_url);
47
48if ($id > 0) {
49 $entrepot = new Entrepot($db);
50 $result = $entrepot->fetch($id);
51 if ($result < 0) {
52 dol_print_error($db);
53 }
54
55 $head = stock_prepare_head($entrepot);
56
57 print dol_get_fiche_head($head, 'value', $langs->trans("Warehouse"), 0, 'stock');
58
59
60 print '<table class="border centpercent">';
61
62 // Ref
63 print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
64 print $form->showrefnav($entrepot, 'id', '', 1, 'rowid', 'libelle');
65 print '</td>';
66
67 print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>';
68
69 // Description
70 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
71
72 print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
73 print $entrepot->address;
74 print '</td></tr>';
75
76 print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->zip.'</td>';
77 print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->town.'</td></tr>';
78
79 print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
80 print $entrepot->country;
81 print '</td></tr>';
82
83 // Statut
84 print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
85
86 $calcproducts = $entrepot->nb_products();
87
88 // Nb of products
89 print '<tr><td class="tdtop">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
90 print empty($calcproducts['nb']) ? '0' : $calcproducts['nb'];
91 print "</td></tr>";
92
93 // Value
94 print '<tr><td class="tdtop">'.$langs->trans("EstimatedStockValueShort").'</td><td colspan="3">';
95 print empty($calcproducts['value']) ? '0' : $calcproducts['value'];
96 print "</td></tr>";
97
98 print "</table>";
99 print '</div>';
100
101
102 /* ************************************************************************** */
103 /* */
104 /* Graph */
105 /* */
106 /* ************************************************************************** */
107
108 print "<div class=\"graph\">\n";
109 $year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
110
111 $file = $conf->stock->dir_temp.'/entrepot-'.$entrepot->id.'-'.($year).'.png';
112
113 // TODO Build graph in $file from a table called llx_stock_log
114
115
116
117
118
119
120 if (file_exists($file)) {
121 $url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file=entrepot-'.$entrepot->id.'-'.$year.'.png';
122 print '<img src="'.$url.'" alt="Valorisation du stock annee '.($year).'">';
123
124 if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/entrepot-'.$entrepot->id.'-'.($year - 1).'.png')) {
125 $url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file=entrepot-'.$entrepot->id.'-'.($year - 1).'.png';
126 print '<br><img src="'.$url.'" alt="Valorisation du stock annee '.($year - 1).'">';
127 }
128 } else {
129 $langs->load("errors");
130 print $langs->trans("FeatureNotYetAvailable");
131 }
132
133 print "</div>";
134}
135
136// End of page
137llxFooter();
138$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage warehouses.
Class to manage generation of HTML components Only common components must be here.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
stock_prepare_head($object)
Prepare array with list of tabs.
Definition stock.lib.php:30