30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
38$hookmanager->initHooks(array(
'stockindex'));
41$langs->loadLangs(array(
'stocks',
'productbatch'));
54$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
55llxHeader(
"", $langs->trans(
"Stocks"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock');
62print
'<div class="fichecenter"><div class="fichethirdleft">';
66 print
'<form method="post" action="'.DOL_URL_ROOT.
'/product/stock/list.php">';
67 print
'<input type="hidden" name="token" value="'.newToken().
'">';
68 print
'<div class="div-table-responsive-no-min">';
69 print
'<table class="noborder nohover centpercent">';
70 print
"<tr class=\"liste_titre\">";
71 print
'<td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
72 print
'<tr class="oddeven"><td>';
73 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>';
74 print
"</table></div></form><br>";
79$sql =
"SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
80$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
82$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
83$sql .= $db->order(
'e.statut',
'DESC');
84$sql .= $db->plimit($max + 1, 0);
86$result = $db->query($sql);
89 $num = $db->num_rows($result);
91 print
'<div class="div-table-responsive-no-min">';
92 print
'<table class="noborder centpercent">';
93 print
'<tr class="liste_titre">';
94 print
'<th colspan="2">';
95 print $langs->trans(
"Warehouses").
' ';
96 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php">';
99 print
'<span class="badge">'.$num.
'</span>';
106 while ($i < min($max, $num)) {
107 $objp = $db->fetch_object($result);
109 $warehouse->id = $objp->rowid;
110 $warehouse->statut = $objp->status;
111 $warehouse->label = $objp->label;
112 $warehouse->lieu = $objp->lieu;
114 print
'<tr class="oddeven">';
116 print $warehouse->getNomUrl(1);
118 print
'<td class="right">';
119 print $warehouse->getLibStatut(5);
126 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td></tr>';
129 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"More").
'...</span></td><td></td></tr>';
139print
'</div><div class="fichetwothirdright">';
144$sql =
"SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
145$sql .=
" e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
146$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
147$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
148$sql .=
", ".MAIN_DB_PREFIX.
"stock_mouvement as m";
149$sql .=
", ".MAIN_DB_PREFIX.
"product as p";
150$sql .=
" WHERE m.fk_product = p.rowid";
151$sql .=
" AND m.fk_entrepot = e.rowid";
152$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
154 $sql .=
" AND p.fk_product_type = ".Product::TYPE_PRODUCT;
156$sql .= $db->order(
"datem",
"DESC");
157$sql .= $db->plimit($max, 0);
159dol_syslog(
"Index:list stock movements", LOG_DEBUG);
160$resql = $db->query($sql);
162 $num = $db->num_rows($resql);
164 print
'<div class="div-table-responsive-no-min">';
165 print
'<table class="noborder centpercent">';
166 print
'<tr class="liste_titre">';
167 print
'<th>'.$langs->trans(
"LastMovements", min($num, $max)).
'</th>';
168 print
'<th>'.$langs->trans(
"Product").
'</th>';
169 if (isModEnabled(
'productbatch')) {
170 print
'<th>'.$langs->trans(
"Batch").
'</th>';
178 print
'<th>'.$langs->trans(
"Warehouse").
'</th>';
179 print
'<th class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php">'.$langs->trans(
"FullList").
'</a></th>';
185 while ($i < min($num, $max)) {
186 $objp = $db->fetch_object($resql);
188 $producttmp->id = $objp->rowid;
189 $producttmp->ref = $objp->produit;
190 $producttmp->status_batch = $objp->tobatch;
191 $producttmp->status_sell = $objp->tosell;
192 $producttmp->status_buy = $objp->tobuy;
194 $warehouse->id = $objp->warehouse_id;
195 $warehouse->ref = $objp->warehouse_ref;
196 $warehouse->statut = $objp->warehouse_status;
197 $warehouse->label = $objp->warehouse_label;
198 $warehouse->lieu = $objp->lieu;
200 $tmplotstatic->batch = $objp->batch;
201 $tmplotstatic->sellby = $objp->sellby;
202 $tmplotstatic->eatby = $objp->eatby;
204 print
'<tr class="oddeven">';
205 print
'<td class="nowraponall">'.img_picto($langs->trans(
"Ref").
' '.$objp->mid,
'movement',
'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
206 print
'<td class="tdoverflowmax150">';
207 print $producttmp->getNomUrl(1);
209 if (isModEnabled(
'productbatch')) {
211 print $tmplotstatic->getNomUrl(0,
'nolink');
220 print
'<td class="tdoverflowmax150">';
221 print $warehouse->getNomUrl(1);
223 print
'<td class="right">';
224 if ($objp->qty > 0) {
227 print $objp->qty.
'</td>';
241$parameters = array(
'user' => $user);
242$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.