29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
37$hookmanager->initHooks(array(
'stockindex'));
40$langs->loadLangs(array(
'stocks',
'productbatch'));
53$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
54llxHeader(
"", $langs->trans(
"Stocks"), $help_url);
61print
'<div class="fichecenter"><div class="fichethirdleft">';
64if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
65 print
'<form method="post" action="'.DOL_URL_ROOT.
'/product/stock/list.php">';
66 print
'<input type="hidden" name="token" value="'.newToken().
'">';
67 print
'<div class="div-table-responsive-no-min">';
68 print
'<table class="noborder nohover centpercent">';
69 print
"<tr class=\"liste_titre\">";
70 print
'<td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
71 print
'<tr class="oddevene"><td>';
72 print $langs->trans(
"Warehouse").
':</td><td><input class="flat" type="text" size="18" name="sall"></td><td rowspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
73 print
"</table></div></form><br>";
78$sql =
"SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
79$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
81$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
82$sql .= $db->order(
'e.statut',
'DESC');
83$sql .= $db->plimit($max + 1, 0);
85$result = $db->query($sql);
88 $num = $db->num_rows($result);
90 print
'<div class="div-table-responsive-no-min">';
91 print
'<table class="noborder centpercent">';
92 print
'<tr class="liste_titre">';
93 print
'<th colspan="2">';
94 print $langs->trans(
"Warehouses").
' ';
95 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php">';
98 print
'<span class="badge">'.$num.
'</span>';
105 while ($i < min($max, $num)) {
106 $objp = $db->fetch_object($result);
108 $warehouse->id = $objp->rowid;
109 $warehouse->statut = $objp->status;
110 $warehouse->label = $objp->label;
111 $warehouse->lieu = $objp->lieu;
113 print
'<tr class="oddeven">';
115 print $warehouse->getNomUrl(1);
117 print
'<td class="right">';
118 print $warehouse->getLibStatut(5);
125 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td></tr>';
128 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"More").
'...</span></td><td></td></tr>';
138print
'</div><div class="fichetwothirdright">';
143$sql =
"SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
144$sql .=
" e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
145$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
146$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
147$sql .=
", ".MAIN_DB_PREFIX.
"stock_mouvement as m";
148$sql .=
", ".MAIN_DB_PREFIX.
"product as p";
149$sql .=
" WHERE m.fk_product = p.rowid";
150$sql .=
" AND m.fk_entrepot = e.rowid";
151$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
152if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
153 $sql .=
" AND p.fk_product_type = ".Product::TYPE_PRODUCT;
155$sql .= $db->order(
"datem",
"DESC");
156$sql .= $db->plimit($max, 0);
158dol_syslog(
"Index:list stock movements", LOG_DEBUG);
159$resql = $db->query($sql);
161 $num = $db->num_rows($resql);
163 print
'<div class="div-table-responsive-no-min">';
164 print
'<table class="noborder centpercent">';
165 print
'<tr class="liste_titre">';
166 print
'<th>'.$langs->trans(
"LastMovements", min($num, $max)).
'</th>';
167 print
'<th>'.$langs->trans(
"Product").
'</th>';
168 if (isModEnabled(
'productbatch')) {
169 print
'<th>'.$langs->trans(
"Batch").
'</th>';
177 print
'<th>'.$langs->trans(
"Warehouse").
'</th>';
178 print
'<th class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php">'.$langs->trans(
"FullList").
'</a></th>';
184 while ($i < min($num, $max)) {
185 $objp = $db->fetch_object($resql);
187 $producttmp->id = $objp->rowid;
188 $producttmp->ref = $objp->produit;
189 $producttmp->status_batch = $objp->tobatch;
190 $producttmp->status_sell = $objp->tosell;
191 $producttmp->status_buy = $objp->tobuy;
193 $warehouse->id = $objp->warehouse_id;
194 $warehouse->ref = $objp->warehouse_ref;
195 $warehouse->statut = $objp->warehouse_status;
196 $warehouse->label = $objp->warehouse_label;
197 $warehouse->lieu = $objp->lieu;
199 $tmplotstatic->batch = $objp->batch;
200 $tmplotstatic->sellby = $objp->sellby;
201 $tmplotstatic->eatby = $objp->eatby;
203 print
'<tr class="oddeven">';
204 print
'<td class="nowraponall">'.img_picto($langs->trans(
"Ref").
' '.$objp->mid,
'movement',
'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
205 print
'<td class="tdoverflowmax150">';
206 print $producttmp->getNomUrl(1);
208 if (isModEnabled(
'productbatch')) {
210 print $tmplotstatic->getNomUrl(0,
'nolink');
219 print
'<td class="tdoverflowmax150">';
220 print $warehouse->getNomUrl(1);
222 print
'<td class="right">';
223 if ($objp->qty > 0) {
226 print $objp->qty.
'</td>';
240$parameters = array(
'user' => $user);
241$reshook = $hookmanager->executeHooks(
'dashboardWarehouse', $parameters, $object);
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.
const STATUS_OPEN_ALL
Warehouse open and any operations are allowed (customer shipping, supplier dispatch,...
Class to manage products or services.
Class with list of lots and properties.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.