* Copyright (C) 2008-2009 Laurent Destailleur * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/product/stock/fiche-valo.php * \ingroup stock * \brief Page fiche de valorisation du stock dans l'entrepot */ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'companies')); $id = GETPOSTINT('id'); // Security check $result = restrictedArea($user, 'stock'); /* * View */ $form = new Form($db); $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("", $langs->trans("WarehouseCard"), $help_url, '', 0, 0, '', '', '', 'mod-product page-stock_fiche_valo'); if ($id > 0) { $entrepot = new Entrepot($db); $result = $entrepot->fetch($id); if ($result < 0) { dol_print_error($db); } $head = stock_prepare_head($entrepot); print dol_get_fiche_head($head, 'value', $langs->trans("Warehouse"), 0, 'stock'); print ''; // Ref print ''; print ''; // Description print ''; print ''; print ''; print ''; print ''; // Statut print ''; $calcproducts = $entrepot->nb_products(); // Nb of products print '"; // Value print '"; print "
'.$langs->trans("Ref").''; print $form->showrefnav($entrepot, 'id', '', 1, 'rowid', 'libelle'); print '
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans('Address').''; print $entrepot->address; print '
'.$langs->trans('Zip').''.$entrepot->zip.''.$langs->trans('Town').''.$entrepot->town.'
'.$langs->trans('Country').''; print $entrepot->country; print '
'.$langs->trans("Status").''.$entrepot->getLibStatut(4).'
'.$langs->trans("NumberOfProducts").''; print empty($calcproducts['nb']) ? '0' : $calcproducts['nb']; print "
'.$langs->trans("EstimatedStockValueShort").''; print empty($calcproducts['value']) ? '0' : $calcproducts['value']; print "
"; print ''; /* ************************************************************************** */ /* */ /* Graph */ /* */ /* ************************************************************************** */ print "
\n"; $year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $file = $conf->stock->dir_temp.'/entrepot-'.$entrepot->id.'-'.($year).'.png'; // TODO Build graph in $file from a table called llx_stock_log if (file_exists($file)) { $url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file=entrepot-'.$entrepot->id.'-'.$year.'.png'; print 'Valorisation du stock annee '.($year).''; if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/entrepot-'.$entrepot->id.'-'.((int) $year - 1).'.png')) { $url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file=entrepot-'.$entrepot->id.'-'.((int) $year - 1).'.png'; print '
Valorisation du stock annee '.((int) $year - 1).''; } } else { $langs->load("errors"); print $langs->trans("FeatureNotYetAvailable"); } print "
"; } // End of page llxFooter(); $db->close();