31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
38require_once
'./lib/replenishment.lib.php';
49$langs->loadLangs(array(
'products',
'stocks',
'orders'));
52$hookmanager->initHooks(array(
'stockatdate'));
56$action =
GETPOST(
'action',
'aZ09');
58$mode =
GETPOST(
'mode',
'alpha');
60$ext = (GETPOSTISSET(
'output') && in_array(
GETPOST(
'output'), array(
'csv'))) ?
GETPOST(
'output') :
'';
64if (GETPOSTISSET(
'dateday') && GETPOSTISSET(
'datemonth') && GETPOSTISSET(
'dateyear')) {
69$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
70$search_nom =
GETPOST(
'search_nom',
'alphanohtml');
76 $search_fk_warehouse =
GETPOST(
'search_fk_warehouse',
'array:int');
78 $search_fk_warehouse = array(
GETPOSTINT(
'search_fk_warehouse'));
82 $search_fk_warehouse = array(
GETPOSTINT(
'fk_warehouse'));
85foreach ($search_fk_warehouse as $key => $val) {
86 if ($val == -1 || empty($val)) {
87 unset($search_fk_warehouse[$key]);
91$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
92$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
94if (empty($page) || $page == -1) {
98$offset = $limit * $page;
100 $sortfield =
'p.ref';
106$parameters = array();
107$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
113if ($mode ==
'future') {
114 if ($date && $date < $now) {
116 $dateIsValid =
false;
119 if ($date && $date > $now) {
120 setEventMessages($langs->trans(
"ErrorDateMustBeBeforeToday"),
null,
'errors');
121 $dateIsValid =
false;
127 $socid = $user->socid;
138if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
141 $search_fk_warehouse = array();
146$warehouseStatus = array();
154$stock_prod_warehouse = array();
155$stock_prod = array();
156if ($date && $dateIsValid) {
157 $sql =
"SELECT ps.fk_product, ps.fk_entrepot as fk_warehouse,";
158 $sql .=
" SUM(ps.reel) AS stock";
159 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps";
160 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
161 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
162 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
163 $sql .=
" AND w.rowid = ps.fk_entrepot AND p.rowid = ps.fk_product";
165 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
167 if ($productid > 0) {
168 $sql .=
" AND ps.fk_product = ".((int) $productid);
170 if (! empty($search_fk_warehouse)) {
171 $sql .=
" AND ps.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
179 $sql .=
" GROUP BY fk_product, fk_entrepot";
182 $resql = $db->query($sql);
184 $num = $db->num_rows($resql);
188 $obj = $db->fetch_object($resql);
190 $tmp_fk_product = $obj->fk_product;
191 $tmp_fk_warehouse = $obj->fk_warehouse;
192 $stock = $obj->stock;
194 $stock_prod_warehouse[$tmp_fk_product][$tmp_fk_warehouse] = $stock;
195 $stock_prod[$tmp_fk_product] = (isset($stock_prod[$tmp_fk_product]) ? $stock_prod[$tmp_fk_product] : 0) + $stock;
205} elseif ($action ==
'filter') {
206 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
210$movements_prod_warehouse = array();
211$movements_prod = array();
212$movements_prod_warehouse_nb = array();
213$movements_prod_nb = array();
214if ($date && $dateIsValid) {
215 $sql =
"SELECT sm.fk_product, sm.fk_entrepot, SUM(sm.value) AS stock, COUNT(sm.rowid) AS nbofmovement";
216 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as sm";
217 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
218 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
219 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
220 $sql .=
" AND w.rowid = sm.fk_entrepot AND p.rowid = sm.fk_product ";
222 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
224 if ($mode ==
'future') {
225 $sql .=
" AND sm.datem <= '".$db->idate($dateendofday).
"'";
227 $sql .=
" AND sm.datem >= '".$db->idate($dateendofday).
"'";
229 if ($productid > 0) {
230 $sql .=
" AND sm.fk_product = ".((int) $productid);
232 if (!empty($search_fk_warehouse)) {
233 $sql .=
" AND sm.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
236 $sql .=
" AND p.ref LIKE '%".$db->escape($search_ref).
"%' ";
239 $sql .=
" AND p.label LIKE '%".$db->escape($search_nom).
"%' ";
241 $sql .=
" GROUP BY sm.fk_product, sm.fk_entrepot";
243 $resql = $db->query($sql);
246 $num = $db->num_rows($resql);
250 $obj = $db->fetch_object($resql);
251 $fk_product = $obj->fk_product;
252 $fk_entrepot = $obj->fk_entrepot;
253 $stock = $obj->stock;
254 $nbofmovement = $obj->nbofmovement;
257 $movements_prod_warehouse[$fk_product][$fk_entrepot] = $stock;
258 $movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement;
261 $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod) ? $movements_prod[$fk_product] : 0);
262 $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb) ? $movements_prod_nb[$fk_product] : 0);
280$form =
new Form($db);
286$title = $langs->trans(
'StockAtDate');
288$sql =
'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,';
289$sql .=
' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
290$sql .=
' p.tms as datem, p.duration, p.tobuy, p.stock, ';
291if (!empty($search_fk_warehouse)) {
292 $sql .=
" SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue";
293 $sql .=
', SUM(ps.reel) as stock_reel';
295 $sql .=
" SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue";
298$parameters = array();
299$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
300$sql .= $hookmanager->resPrint;
302$sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
303if (!empty($search_fk_warehouse)) {
304 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot IN ('.$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
307$parameters = array();
308$reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters);
309$sql .= $hookmanager->resPrint;
310$sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
312 $sql .=
" AND p.rowid = ".((int) $productid);
315 $sql .=
" AND p.fk_product_type = 0";
317if (!empty($canvas)) {
318 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
326$sql .=
' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
327$sql .=
' p.tms, p.duration, p.tobuy, p.stock';
329$parameters = array();
330$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
331$sql .= $hookmanager->resPrint;
333if ($sortfield ==
'stock_reel' && empty($search_fk_warehouse)) {
334 $sortfield =
'stock';
336if ($sortfield ==
'stock' && !empty($search_fk_warehouse)) {
337 $sortfield =
'stock_reel';
339$sql .= $db->order($sortfield, $sortorder);
341$nbtotalofrecords =
'';
342if ($date && $dateIsValid) {
344 $result = $db->query($sql);
345 $nbtotalofrecords = $db->num_rows($result);
346 if (($page * $limit) > $nbtotalofrecords || $ext ==
'csv') {
354 $sql .= $db->plimit($limit + 1, $offset);
355 $resql = $db->query($sql);
365 $num = $db->num_rows($resql);
370$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|';
371$helpurl .=
'ES:Módulo_Stocks';
373$stocklabel = $langs->trans(
'StockAtDate');
374if ($mode ==
'future') {
375 $stocklabel = $langs->trans(
"VirtualStockAtDate");
382 header(
"Content-Disposition: attachment; filename=stock".($date ?
'-'.date(
"Y-m-d", $date) :
'').
".csv");
385 print implode(
";", ($mode ==
'future') ?
386 array(
'"Product Reference"',
'"Label"',
'"Current Stock"',
'"'.$stocklabel.
'"',
'"Virtual Stock"') :
387 array(
'"Product Reference"',
'"Label"',
'"'.$stocklabel.
'"',
'"Estimated Stock Value"',
'"Estimate Sell Value"',
'"Movements"',
'"Current Stock"')).
"\r\n";
389 llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_stockatdate');
393 $head[0][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php';
394 $head[0][1] = $langs->trans(
"StockAtDateInPast");
395 $head[0][2] =
'stockatdatepast';
397 $head[1][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php?mode=future';
398 $head[1][1] = $langs->trans(
"StockAtDateInFuture");
399 $head[1][2] =
'stockatdatefuture';
404 print
dol_get_fiche_head($head, ($mode ==
'future' ?
'stockatdatefuture' :
'stockatdatepast'),
'', -1,
'');
406 $desc = $langs->trans(
"StockAtDatePastDesc");
407 if ($mode ==
'future') {
408 $desc = $langs->trans(
"StockAtDateFutureDesc");
410 print
'<span class="opacitymedium">'.$desc.
'</span><br>'.
"\n";
413 print
'<form name="formFilterWarehouse" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
414 print
'<input type="hidden" name="token" value="'.newToken().
'">';
415 print
'<input type="hidden" name="action" value="filter">';
416 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
418 print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
419 print
'<span class="fieldrequired">'.$langs->trans(
'Date').
'</span> '.$form->selectDate(($date ? $date : -1),
'date');
421 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
422 print
img_picto(
'',
'product',
'class="pictofixedwidth"').
' ';
424 print $form->select_produits($productid,
'productid',
'', 0, 0, -1, 2,
'', 0, array(), 0, $langs->trans(
'Product'), 0,
'maxwidth300', 0,
'',
null, 1);
426 if ($mode !=
'future') {
428 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
429 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$langs->trans(
"Warehouse").
' :';
431 $selected = ((GETPOSTISSET(
'search_fk_warehouse') || GETPOSTISSET(
'fk_warehouse')) ? $search_fk_warehouse :
'ifonenodefault');
432 print $formproduct->selectWarehouses($selected,
'search_fk_warehouse',
'', 1, 0, 0, $langs->trans(
'Warehouse'), 0, 0, array(),
'minwidth200', array(), 1,
false,
'e.ref', 1);
437 $parameters = array();
438 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
439 if (empty($reshook)) {
440 print $hookmanager->resPrint;
443 print
'<div class="inline-block valignmiddle">';
444 print
'<input type="submit" class="button" name="valid" value="'.$langs->trans(
'Refresh').
'">';
450 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
451 $param .=
'&contextpage='.urlencode($contextpage);
453 if ($limit > 0 && $limit !=
$conf->liste_limit) {
454 $param .=
'&limit='.((int) $limit);
456 $param .=
'&mode='.$mode;
457 $param_warehouse =
'';
458 if (!empty($search_fk_warehouse)) {
459 foreach ($search_fk_warehouse as $val) {
460 $param_warehouse .=
'&search_fk_warehouse[]='.$val;
462 $param .= $param_warehouse;
464 if ($productid > 0) {
465 $param .=
'&productid='.(int) $productid;
468 $param .=
'&dateday='.GETPOSTINT(
'dateday');
471 $param .=
'&datemonth='.GETPOSTINT(
'datemonth');
474 $param .=
'&dateyear='.GETPOSTINT(
'dateyear');
478 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'stock', 0,
'',
'', $limit, 0, 0, 1);
480 print
'<div class="div-table-responsive">';
483 print
'<a href="stockatdate.php?output=csv&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder).
'&type='.((int) $type).
'&mode='.urlencode($mode).
484 (($productid > 0) ?
"&productid=".((
int) $productid) :
'').
488 (GETPOSTISSET(
'dateday') ?
"&dateday=".
GETPOSTINT(
'dateday') :
'').
489 (GETPOSTISSET(
'datemonth') ?
"&datemonth=".
GETPOSTINT(
'datemonth') :
'').
490 (GETPOSTISSET(
'dateyear') ?
"&dateyear=".
GETPOSTINT(
'dateyear') :
'').
491 '" title="Download CSV" />';
492 print
img_picto(
'',
'download',
'class="pictofixedwidth"');
493 print
'Download CSV';
497 print
'<table class="liste centpercent">';
499 print
'<input type="hidden" name="token" value="'.newToken().
'">';
500 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
501 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
502 print
'<input type="hidden" name="type" value="'.$type.
'">';
503 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
506 print
'<tr class="liste_titre_filter">';
507 print
'<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'"></td>';
508 print
'<td class="liste_titre"><input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).
'"></td>';
509 print
'<td class="liste_titre"></td>';
510 print
'<td class="liste_titre"></td>';
511 print
'<td class="liste_titre"></td>';
512 if ($mode ==
'future') {
513 print
'<td class="liste_titre"></td>';
515 print
'<td class="liste_titre"></td>';
516 print
'<td class="liste_titre"></td>';
519 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
520 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
521 print $hookmanager->resPrint;
523 print
'<td class="liste_titre maxwidthsearch">';
524 $searchpicto = $form->showFilterAndCheckAddButtons(0);
529 $fieldtosortcurrentstock =
'stock';
530 if (!empty($search_fk_warehouse)) {
531 $fieldtosortcurrentstock =
'stock_reel';
535 print
'<tr class="liste_titre">';
539 if ($mode ==
'future') {
540 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock, $param,
'',
'', $sortfield, $sortorder,
'right ');
542 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ',
'VirtualStockAtDateDesc');
543 print_liste_field_titre(
'VirtualStock', $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
545 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ');
546 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
')';
547 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"estimatedvalue",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
548 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
')';
549 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
550 $tooltiptext = $langs->trans(
"MovementsSinceDate");
551 print_liste_field_titre(
'', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'',
'',
'',
'right ', $tooltiptext, 1);
552 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock, $param,
'',
'', $sortfield, $sortorder,
'right ');
556 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
557 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
558 print $hookmanager->resPrint;
565$totalbuyingprice = 0;
566$totalsellingprice = 0;
567$totalcurrentstock = 0;
568$totalvirtualstock = 0;
571while ($i < ($limit ? min($num, $limit) : $num)) {
572 $objp = $db->fetch_object($resql);
575 $prod->fetch($objp->rowid);
596 if (!empty($search_fk_warehouse)) {
598 foreach ($search_fk_warehouse as $val) {
599 if (!is_numeric($currentstock)) {
602 $currentstock += empty($stock_prod_warehouse[$objp->rowid][$val]) ? 0 : $stock_prod_warehouse[$objp->rowid][$val];
609 $currentstock = empty($stock_prod[$objp->rowid]) ? 0 : $stock_prod[$objp->rowid];
615 if ($mode ==
'future') {
616 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
617 $stock = $prod->stock_theorique;
618 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0);
619 $virtualstock = $prod->stock_theorique;
621 $stock = $currentstock;
623 if (!empty($search_fk_warehouse)) {
624 foreach ($search_fk_warehouse as $val) {
625 $stock -= empty($movements_prod_warehouse[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse[$objp->rowid][$val];
626 $nbofmovement += empty($movements_prod_warehouse_nb[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse_nb[$objp->rowid][$val];
629 $stock -= empty($movements_prod[$objp->rowid]) ? 0 : $movements_prod[$objp->rowid];
630 $nbofmovement += empty($movements_prod_nb[$objp->rowid]) ? 0 : $movements_prod_nb[$objp->rowid];
636 if ($mode ==
'future') {
637 print implode(
";", array(
639 '"'.$objp->label.
'"',
640 '"'.price2num($currentstock,
'MS').
'"',
641 '"'.price2num($stock,
'MS').
'"',
642 '"'.price2num($virtualstock,
'MS').
'"')).
"\r\n";
643 $totalvirtualstock += $virtualstock;
645 print implode(
";", array(
647 '"'.$objp->label.
'"',
649 price2num($stock * $objp->pmp,
'MT') ?
'"'.price2num($stock * $objp->pmp,
'MT').
'"' :
'',
650 !
getDolGlobalString(
'PRODUIT_MULTIPRICES') ?
'"'.
price2num($stock * $objp->
price,
'MT').
'"' :
'"'.$langs->trans(
"Variable").
'('.$langs->trans(
"OptionMULTIPRICESIsOn").
')"',
652 '"'.
price2num($currentstock,
'MS').
'"')).
"\r\n";
653 $totalbuyingprice += $stock * $objp->pmp;
654 $totalsellingprice += $stock * $objp->price;
656 $totalcurrentstock += $currentstock;
658 print
'<tr class="oddeven">';
661 print
'<td class="nowrap">'.$prod->getNomUrl(1,
'').
'</td>';
668 if ($mode ==
'future') {
670 print
'<td class="right">'.price(
price2num($currentstock,
'MS')).
'</td>';
673 print
'<td class="right"></td>';
676 print
'<td class="right">'.price(
price2num($stock,
'MS')).
'</td>';
679 print
'<td class="right">'.price(
price2num($virtualstock,
'MS')).
'</td>';
680 $totalvirtualstock += $virtualstock;
683 print
'<td class="right">'.($stock ?
price(
price2num($stock,
'MS')) : (
'<span class="opacitymedium">0</span>')).
'</td>';
686 $estimatedvalue = $stock * $objp->pmp;
687 print
'<td class="right" title="'.dolPrintHTMLForAttribute($langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->pmp,
'MU'), 1)).
'">';
689 print
'<span class="amount">'.price(
price2num($estimatedvalue,
'MT'), 1).
'</span>';
693 $totalbuyingprice += $estimatedvalue;
697 print
'<td class="right"';
699 print
' title="'.dolPrintHTMLForAttribute($langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->price,
'MU'), 1));
703 print
'<span class="amount">';
704 if ($stock || (
float) ($stock * $objp->price)) {
708 $totalsellingprice += $stock * $objp->price;
710 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
711 print $form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
716 print
'<td class="right">';
717 if ($nbofmovement > 0) {
718 $url = DOL_URL_ROOT.
'/product/stock/movement_list.php?idproduct='.$objp->rowid;
719 if (GETPOSTISSET(
'datemonth')) {
720 $url .=
'&search_date_startday='.GETPOSTINT(
'dateday');
721 $url .=
'&search_date_startmonth='.GETPOSTINT(
'datemonth');
722 $url .=
'&search_date_startyear='.GETPOSTINT(
'dateyear');
724 if (count($search_fk_warehouse) > 1) {
727 foreach ($search_fk_warehouse as $val) {
728 $url .= ($val > 0 ?
'&search_warehouse='.((int) $val) :
'');
732 print
'<a href="'.$url.
'">';
734 print $langs->trans(
"Movements");
735 print
'<span class="tabs paddingleft"><span class="badge">'.$nbofmovement.
'</span></span>';
743 print
'<td class="right">'.($currentstock ?
price(
price2num($currentstock,
'MS')) :
'<span class="opacitymedium">0</span>').
'</td>';
745 $totalcurrentstock += $currentstock;
748 $parameters = array(
'objp' => $objp);
749 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
750 print $hookmanager->resPrint;
753 print
'<td class="right"></td>';
761$parameters = array(
'sql' => $sql);
762$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
764 print $hookmanager->resPrint;
768if ($mode ==
'future') {
775 ($mode ==
'future') ? array(
776 '"'.$langs->trans(
"Totalforthispage").
'"',
778 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
'',
782 '"'.$langs->trans(
"Totalforthispage").
'"',
785 '"'.
price2num($totalbuyingprice,
'MT').
'"',
788 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
'')
791 if (empty($date) || !$dateIsValid) {
792 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"EnterADateCriteria").
'</span></td></tr>';
794 print
'<tr class="liste_total">';
795 print
'<td>'.$langs->trans(
"Totalforthispage").
'</td>';
797 if ($mode ==
'future') {
798 print
'<td class="right">'.price(
price2num($totalcurrentstock,
'MS')).
'</td>';
801 print
'<td class="right">'.price(
price2num($totalvirtualstock,
'MS')).
'</td>';
804 print
'<td class="right">'.price(
price2num($totalbuyingprice,
'MT')).
'</td>';
806 print
'<td class="right">'.price(
price2num($totalsellingprice,
'MT')).
'</td>';
811 print
'<td class="right">'.($productid > 0 ?
price(
price2num($totalcurrentstock,
'MS')) :
'').
'</td>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
const STATUS_OPEN_INTERNAL
Warehouse open and only operations for stock transfers/corrections allowed (not for customer shipping...
const STATUS_OPEN_ALL
Warehouse open and any operations are allowed (customer shipping, supplier dispatch,...
Class to manage products or services.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.