28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35 $hookmanager->initHooks(array(
'stockindex'));
38 $langs->loadLangs(array(
'stocks',
'productbatch'));
51 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
52 llxHeader(
"", $langs->trans(
"Stocks"), $help_url);
59 print '<div class="fichecenter"><div class="fichethirdleft">';
62 if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))
64 print
'<form method="post" action="'.DOL_URL_ROOT.
'/product/stock/list.php">';
65 print
'<input type="hidden" name="token" value="'.newToken().
'">';
66 print
'<div class="div-table-responsive-no-min">';
67 print
'<table class="noborder nohover centpercent">';
68 print
"<tr class=\"liste_titre\">";
69 print
'<td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
70 print
'<tr class="oddevene"><td>';
71 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>';
72 print
"</table></div></form><br>";
77 $sql =
"SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
78 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
80 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
81 $sql .= $db->order(
'e.statut',
'DESC');
82 $sql .= $db->plimit($max + 1, 0);
84 $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>';
106 while ($i < min($max, $num))
108 $objp = $db->fetch_object($result);
110 $warehouse->id = $objp->rowid;
111 $warehouse->statut = $objp->status;
112 $warehouse->label = $objp->label;
113 $warehouse->lieu = $objp->lieu;
115 print
'<tr class="oddeven">';
117 print $warehouse->getNomUrl(1);
119 print
'<td class="right">';
120 print $warehouse->getLibStatut(5);
127 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td></tr>';
130 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"More").
'...</span></td><td></td></tr>';
141 print
'</div><div class="fichetwothirdright"><div class="ficheaddleft">';
146 $sql =
"SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
147 $sql .=
" e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
148 $sql .=
" m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
149 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
150 $sql .=
", ".MAIN_DB_PREFIX.
"stock_mouvement as m";
151 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
152 $sql .=
" WHERE m.fk_product = p.rowid";
153 $sql .=
" AND m.fk_entrepot = e.rowid";
154 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
155 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .=
" AND p.fk_product_type = ".Product::TYPE_PRODUCT;
156 $sql .= $db->order(
"datem",
"DESC");
157 $sql .= $db->plimit($max, 0);
159 dol_syslog(
"Index:list stock movements", LOG_DEBUG);
160 $resql = $db->query($sql);
163 $num = $db->num_rows(
$resql);
165 print
'<div class="div-table-responsive-no-min">';
166 print
'<table class="noborder centpercent">';
167 print
"<tr class=\"liste_titre\">";
168 print
'<th>'.$langs->trans(
"LastMovements", min($num, $max)).
'</th>';
169 print
'<th>'.$langs->trans(
"Product").
'</th>';
170 if (!empty($conf->productbatch->enabled))
172 print
'<th>'.$langs->trans(
"Batch").
'</th>';
173 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
174 print
'<th>'.$langs->trans(
"SellByDate").
'</th>';
176 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
177 print
'<th>'.$langs->trans(
"EatByDate").
'</th>';
180 print
'<th>'.$langs->trans(
"Warehouse").
'</th>';
181 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))
187 $objp = $db->fetch_object(
$resql);
189 $producttmp->id = $objp->rowid;
190 $producttmp->ref = $objp->produit;
191 $producttmp->status_batch = $objp->tobatch;
192 $producttmp->status_sell = $objp->tosell;
193 $producttmp->status_buy = $objp->tobuy;
195 $warehouse->id = $objp->warehouse_id;
196 $warehouse->ref = $objp->warehouse_ref;
197 $warehouse->statut = $objp->warehouse_status;
198 $warehouse->label = $objp->warehouse_label;
199 $warehouse->lieu = $objp->lieu;
201 print
'<tr class="oddeven">';
202 print
'<td class="nowraponall">'.dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
203 print
'<td class="tdoverflowmax200">';
204 print $producttmp->getNomUrl(1);
206 if (!empty($conf->productbatch->enabled))
208 print
'<td>'.$objp->batch.
'</td>';
209 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
210 print
'<td>'.dol_print_date($db->jdate($objp->sellby),
'day').
'</td>';
212 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
213 print
'<td>'.dol_print_date($db->jdate($objp->eatby),
'day').
'</td>';
216 print
'<td class="tdoverflowmax200">';
217 print $warehouse->getNomUrl(1);
219 print
'<td class="right">';
220 if ($objp->qty > 0) print
'+';
221 print $objp->qty.
'</td>';
234 print
'</div></div></div>';
236 $parameters = array(
'user' => $user);
237 $reshook = $hookmanager->executeHooks(
'dashboardWarehouse', $parameters, $object);
const STATUS_OPEN_ALL
Warehouse open and operations for customer shipping, supplier dispatch, internal stock transfers/corr...
Class to manage products or services.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage warehouses.