31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
45$langs->loadLangs(array(
'stocks',
'productbatch'));
48$hookmanager->initHooks(array(
'stockindex'));
61$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
62llxHeader(
"", $langs->trans(
"Stocks"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock');
69print
'<div class="fichecenter"><div class="fichethirdleft">';
73 print
'<form method="post" action="'.DOL_URL_ROOT.
'/product/stock/list.php">';
74 print
'<input type="hidden" name="token" value="'.newToken().
'">';
75 print
'<div class="div-table-responsive-no-min">';
76 print
'<table class="noborder nohover centpercent">';
77 print
"<tr class=\"liste_titre\">";
78 print
'<td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
79 print
'<tr class="oddeven"><td>';
80 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>';
81 print
"</table></div></form><br>";
86$sql =
"SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
87$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
89$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
90$sql .= $db->order(
'e.statut',
'DESC');
91$sql .= $db->plimit($max + 1, 0);
93$result = $db->query($sql);
96 $num = $db->num_rows($result);
98 print
'<div class="div-table-responsive-no-min">';
99 print
'<table class="noborder centpercent">';
100 print
'<tr class="liste_titre">';
101 print
'<th colspan="2">';
102 print $langs->trans(
"Warehouses").
' ';
103 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php">';
106 print
'<span class="badge">'.$num.
'</span>';
113 while ($i < min($max, $num)) {
114 $objp = $db->fetch_object($result);
116 $warehouse->id = $objp->rowid;
117 $warehouse->statut = $objp->status;
118 $warehouse->label = $objp->label;
119 $warehouse->lieu = $objp->lieu;
121 print
'<tr class="oddeven">';
123 print $warehouse->getNomUrl(1);
125 print
'<td class="right">';
126 print $warehouse->getLibStatut(5);
133 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td></tr>';
136 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"More").
'...</span></td><td></td></tr>';
146print
'</div><div class="fichetwothirdright">';
151$sql =
"SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
152$sql .=
" e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
153$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
154$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
155$sql .=
", ".MAIN_DB_PREFIX.
"stock_mouvement as m";
156$sql .=
", ".MAIN_DB_PREFIX.
"product as p";
157$sql .=
" WHERE m.fk_product = p.rowid";
158$sql .=
" AND m.fk_entrepot = e.rowid";
159$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
161 $sql .=
" AND p.fk_product_type = ".Product::TYPE_PRODUCT;
163$sql .= $db->order(
"datem",
"DESC");
164$sql .= $db->plimit($max, 0);
166dol_syslog(
"Index:list stock movements", LOG_DEBUG);
167$resql = $db->query($sql);
169 $num = $db->num_rows($resql);
171 print
'<div class="div-table-responsive-no-min">';
172 print
'<table class="noborder centpercent">';
173 print
'<tr class="liste_titre">';
174 print
'<th>'.$langs->trans(
"LastMovements", min($num, $max)).
'</th>';
175 print
'<th>'.$langs->trans(
"Product").
'</th>';
176 if (isModEnabled(
'productbatch')) {
177 print
'<th>'.$langs->trans(
"Batch").
'</th>';
185 print
'<th>'.$langs->trans(
"Warehouse").
'</th>';
186 print
'<th class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php">'.$langs->trans(
"FullList").
'</a></th>';
192 while ($i < min($num, $max)) {
193 $objp = $db->fetch_object($resql);
195 $producttmp->id = $objp->rowid;
196 $producttmp->ref = $objp->produit;
197 $producttmp->status_batch = $objp->tobatch;
198 $producttmp->status_sell = $objp->tosell;
199 $producttmp->status_buy = $objp->tobuy;
201 $warehouse->id = $objp->warehouse_id;
202 $warehouse->ref = $objp->warehouse_ref;
203 $warehouse->statut = $objp->warehouse_status;
204 $warehouse->label = $objp->warehouse_label;
205 $warehouse->lieu = $objp->lieu;
207 $tmplotstatic->batch = $objp->batch;
208 $tmplotstatic->sellby = $objp->sellby;
209 $tmplotstatic->eatby = $objp->eatby;
211 print
'<tr class="oddeven">';
212 print
'<td class="nowraponall">'.img_picto($langs->trans(
"Ref").
' '.$objp->mid,
'movement',
'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
213 print
'<td class="tdoverflowmax150">';
214 print $producttmp->getNomUrl(1);
216 if (isModEnabled(
'productbatch')) {
218 print $tmplotstatic->getNomUrl(0,
'nolink');
227 print
'<td class="tdoverflowmax150">';
228 print $warehouse->getNomUrl(1);
230 print
'<td class="right">';
231 if ($objp->qty > 0) {
234 print $objp->qty.
'</td>';
248$parameters = array(
'user' => $user);
249$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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.