30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
37require_once
'./lib/replenishment.lib.php';
40$langs->loadLangs(array(
'products',
'stocks',
'orders'));
43$hookmanager->initHooks(array(
'stockatdate'));
47$action =
GETPOST(
'action',
'aZ09');
49$mode =
GETPOST(
'mode',
'alpha');
51$ext=(GETPOSTISSET(
'output') && in_array(
GETPOST(
'output'), array(
'csv'))) ?
GETPOST(
'output') :
'';
55if (GETPOSTISSET(
'dateday') && GETPOSTISSET(
'datemonth') && GETPOSTISSET(
'dateyear')) {
60$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
61$search_nom =
GETPOST(
'search_nom',
'alphanohtml');
67 $search_fk_warehouse =
GETPOST(
'search_fk_warehouse',
'array:int');
69 $search_fk_warehouse = array(
GETPOSTINT(
'search_fk_warehouse'));
73 $search_fk_warehouse = array(
GETPOSTINT(
'fk_warehouse'));
76foreach ($search_fk_warehouse as $key => $val) {
77 if ($val == -1 || empty($val)) {
78 unset($search_fk_warehouse[$key]);
82$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
83$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
85if (empty($page) || $page == -1) {
89$offset = $limit * $page;
98$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
104if ($mode ==
'future') {
105 if ($date && $date < $now) {
107 $dateIsValid =
false;
110 if ($date && $date > $now) {
111 setEventMessages($langs->trans(
"ErrorDateMustBeBeforeToday"),
null,
'errors');
112 $dateIsValid =
false;
118 $socid = $user->socid;
129if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
132 $search_fk_warehouse = array();
137$warehouseStatus = array();
145$stock_prod_warehouse = array();
146$stock_prod = array();
147if ($date && $dateIsValid) {
148 $sql =
"SELECT ps.fk_product, ps.fk_entrepot as fk_warehouse,";
149 $sql .=
" SUM(ps.reel) AS stock";
150 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps";
151 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
152 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
153 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
154 $sql .=
" AND w.rowid = ps.fk_entrepot AND p.rowid = ps.fk_product";
156 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
158 if ($productid > 0) {
159 $sql .=
" AND ps.fk_product = ".((int) $productid);
161 if (! empty($search_fk_warehouse)) {
162 $sql .=
" AND ps.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
170 $sql .=
" GROUP BY fk_product, fk_entrepot";
173 $resql = $db->query($sql);
175 $num = $db->num_rows($resql);
179 $obj = $db->fetch_object($resql);
181 $tmp_fk_product = $obj->fk_product;
182 $tmp_fk_warehouse = $obj->fk_warehouse;
183 $stock = $obj->stock;
185 $stock_prod_warehouse[$tmp_fk_product][$tmp_fk_warehouse] = $stock;
186 $stock_prod[$tmp_fk_product] = (isset($stock_prod[$tmp_fk_product]) ? $stock_prod[$tmp_fk_product] : 0) + $stock;
196} elseif ($action ==
'filter') {
197 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
201$movements_prod_warehouse = array();
202$movements_prod = array();
203$movements_prod_warehouse_nb = array();
204$movements_prod_nb = array();
205if ($date && $dateIsValid) {
206 $sql =
"SELECT sm.fk_product, sm.fk_entrepot, SUM(sm.value) AS stock, COUNT(sm.rowid) AS nbofmovement";
207 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as sm";
208 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
209 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
210 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
211 $sql .=
" AND w.rowid = sm.fk_entrepot AND p.rowid = sm.fk_product ";
213 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
215 if ($mode ==
'future') {
216 $sql .=
" AND sm.datem <= '".$db->idate($dateendofday).
"'";
218 $sql .=
" AND sm.datem >= '".$db->idate($dateendofday).
"'";
220 if ($productid > 0) {
221 $sql .=
" AND sm.fk_product = ".((int) $productid);
223 if (!empty($search_fk_warehouse)) {
224 $sql .=
" AND sm.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
227 $sql .=
" AND p.ref LIKE '%".$db->escape($search_ref).
"%' ";
230 $sql .=
" AND p.label LIKE '%".$db->escape($search_nom).
"%' ";
232 $sql .=
" GROUP BY sm.fk_product, sm.fk_entrepot";
234 $resql = $db->query($sql);
237 $num = $db->num_rows($resql);
241 $obj = $db->fetch_object($resql);
242 $fk_product = $obj->fk_product;
243 $fk_entrepot = $obj->fk_entrepot;
244 $stock = $obj->stock;
245 $nbofmovement = $obj->nbofmovement;
248 $movements_prod_warehouse[$fk_product][$fk_entrepot] = $stock;
249 $movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement;
252 $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod)?$movements_prod[$fk_product]:0);
253 $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb)?$movements_prod_nb[$fk_product]:0);
271$form =
new Form($db);
277$title = $langs->trans(
'StockAtDate');
279$sql =
'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,';
280$sql .=
' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
281$sql .=
' p.tms as datem, p.duration, p.tobuy, p.stock, ';
282if (!empty($search_fk_warehouse)) {
283 $sql .=
" SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue";
284 $sql .=
', SUM(ps.reel) as stock_reel';
286 $sql .=
" SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue";
289$parameters = array();
290$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
291$sql .= $hookmanager->resPrint;
293$sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
294if (!empty($search_fk_warehouse)) {
295 $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)).
")";
298$parameters = array();
299$reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters);
300$sql .= $hookmanager->resPrint;
301$sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
303 $sql .=
" AND p.rowid = ".((int) $productid);
306 $sql .=
" AND p.fk_product_type = 0";
308if (!empty($canvas)) {
309 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
317$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,';
318$sql .=
' p.tms, p.duration, p.tobuy, p.stock';
320$parameters = array();
321$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
322$sql .= $hookmanager->resPrint;
324if ($sortfield ==
'stock_reel' && empty($search_fk_warehouse)) {
325 $sortfield =
'stock';
327if ($sortfield ==
'stock' && !empty($search_fk_warehouse)) {
328 $sortfield =
'stock_reel';
330$sql .= $db->order($sortfield, $sortorder);
332$nbtotalofrecords =
'';
333if ($date && $dateIsValid) {
335 $result = $db->query($sql);
336 $nbtotalofrecords = $db->num_rows($result);
337 if (($page * $limit) > $nbtotalofrecords || $ext ==
'csv') {
345 $sql .= $db->plimit($limit + 1, $offset);
346 $resql = $db->query($sql);
356 $num = $db->num_rows($resql);
361$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|';
362$helpurl .=
'ES:Módulo_Stocks';
364$stocklabel = $langs->trans(
'StockAtDate');
365if ($mode ==
'future') {
366 $stocklabel = $langs->trans(
"VirtualStockAtDate");
373 header(
"Content-Disposition: attachment; filename=stock".($date?
'-'.date(
"Y-m-d", $date):
'').
".csv");
376 print implode(
";", ($mode ==
'future') ?
377 array(
'"Product Reference"',
'"Label"',
'"Current Stock"',
'"'.$stocklabel.
'"',
'"Virtual Stock"'):
378 array(
'"Product Reference"',
'"Label"',
'"'.$stocklabel.
'"',
'"Estimated Stock Value"',
'"Estimate Sell Value"',
'"Movements"',
'"Current Stock"')).
"\r\n";
380 llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_stockatdate');
384 $head[0][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php';
385 $head[0][1] = $langs->trans(
"StockAtDateInPast");
386 $head[0][2] =
'stockatdatepast';
388 $head[1][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php?mode=future';
389 $head[1][1] = $langs->trans(
"StockAtDateInFuture");
390 $head[1][2] =
'stockatdatefuture';
395 print
dol_get_fiche_head($head, ($mode ==
'future' ?
'stockatdatefuture' :
'stockatdatepast'),
'', -1,
'');
397 $desc = $langs->trans(
"StockAtDatePastDesc");
398 if ($mode ==
'future') {
399 $desc = $langs->trans(
"StockAtDateFutureDesc");
401 print
'<span class="opacitymedium">'.$desc.
'</span><br>'.
"\n";
404 print
'<form name="formFilterWarehouse" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
405 print
'<input type="hidden" name="token" value="'.newToken().
'">';
406 print
'<input type="hidden" name="action" value="filter">';
407 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
409 print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
410 print
'<span class="fieldrequired">'.$langs->trans(
'Date').
'</span> '.$form->selectDate(($date ? $date : -1),
'date');
412 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
413 print
img_picto(
'',
'product',
'class="pictofiwedwidth"').
' ';
415 print $form->select_produits($productid,
'productid',
'', 0, 0, -1, 2,
'', 0, array(), 0, $langs->trans(
'Product'), 0,
'maxwidth300', 0,
'',
null, 1);
417 if ($mode !=
'future') {
419 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
420 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$langs->trans(
"Warehouse").
' :';
422 $selected = ((GETPOSTISSET(
'search_fk_warehouse') || GETPOSTISSET(
'fk_warehouse')) ? $search_fk_warehouse :
'ifonenodefault');
423 print $formproduct->selectWarehouses($selected,
'search_fk_warehouse',
'', 1, 0, 0, $langs->trans(
'Warehouse'), 0, 0,
null,
'minwidth200',
null, 1,
false,
'e.ref', 1);
428 $parameters = array();
429 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
430 if (empty($reshook)) {
431 print $hookmanager->resPrint;
434 print
'<div class="inline-block valignmiddle">';
435 print
'<input type="submit" class="button" name="valid" value="'.$langs->trans(
'Refresh').
'">';
441 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
442 $param .=
'&contextpage='.urlencode($contextpage);
444 if ($limit > 0 && $limit != $conf->liste_limit) {
445 $param .=
'&limit='.((int) $limit);
447 $param .=
'&mode='.$mode;
448 $param_warehouse =
'';
449 if (!empty($search_fk_warehouse)) {
450 foreach ($search_fk_warehouse as $val) {
451 $param_warehouse .=
'&search_fk_warehouse[]='.$val;
453 $param .= $param_warehouse;
455 if ($productid > 0) {
456 $param .=
'&productid='.(int) $productid;
459 $param .=
'&dateday='.GETPOSTINT(
'dateday');
462 $param .=
'&datemonth='.GETPOSTINT(
'datemonth');
465 $param .=
'&dateyear='.GETPOSTINT(
'dateyear');
469 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'stock', 0,
'',
'', $limit, 0, 0, 1);
471 print
'<div class="div-table-responsive">';
474 print
'<a href="stockatdate.php?output=csv&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder).
'&type='.((int) $type).
'&mode='.urlencode($mode).
475 (($productid > 0)?
"&productid=".((
int) $productid):
'').
479 (GETPOSTISSET(
'dateday')?
"&dateday=".
GETPOSTINT(
'dateday'):
'').
480 (GETPOSTISSET(
'datemonth')?
"&datemonth=".
GETPOSTINT(
'datemonth'):
'').
481 (GETPOSTISSET(
'dateyear')?
"&dateyear=".
GETPOSTINT(
'dateyear'):
'').
482 '" title="Download CSV" />';
483 print
img_picto(
'',
'download',
'class="pictofixedwidth"');
484 print
'Download CSV';
488 print
'<table class="liste centpercent">';
490 print
'<input type="hidden" name="token" value="'.newToken().
'">';
491 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
492 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
493 print
'<input type="hidden" name="type" value="'.$type.
'">';
494 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
497 print
'<tr class="liste_titre_filter">';
498 print
'<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'"></td>';
499 print
'<td class="liste_titre"><input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).
'"></td>';
500 print
'<td class="liste_titre"></td>';
501 print
'<td class="liste_titre"></td>';
502 print
'<td class="liste_titre"></td>';
503 if ($mode ==
'future') {
504 print
'<td class="liste_titre"></td>';
506 print
'<td class="liste_titre"></td>';
507 print
'<td class="liste_titre"></td>';
510 $parameters = array(
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
511 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
512 print $hookmanager->resPrint;
514 print
'<td class="liste_titre maxwidthsearch">';
515 $searchpicto = $form->showFilterAndCheckAddButtons(0);
520 $fieldtosortcurrentstock =
'stock';
521 if (!empty($search_fk_warehouse)) {
522 $fieldtosortcurrentstock =
'stock_reel';
526 print
'<tr class="liste_titre">';
530 if ($mode ==
'future') {
531 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock, $param,
'',
'', $sortfield, $sortorder,
'right ');
533 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ',
'VirtualStockAtDateDesc');
534 print_liste_field_titre(
'VirtualStock', $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
536 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ');
537 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
')';
538 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"estimatedvalue",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
539 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
')';
540 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
541 $tooltiptext = $langs->trans(
"MovementsSinceDate");
542 print_liste_field_titre(
'', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'',
'',
'',
'right ', $tooltiptext, 1);
543 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock, $param,
'',
'', $sortfield, $sortorder,
'right ');
547 $parameters = array(
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
548 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
549 print $hookmanager->resPrint;
556$totalbuyingprice = 0;
557$totalsellingprice = 0;
558$totalcurrentstock = 0;
559$totalvirtualstock = 0;
562while ($i < ($limit ? min($num, $limit) : $num)) {
563 $objp = $db->fetch_object($resql);
566 $prod->fetch($objp->rowid);
587 if (!empty($search_fk_warehouse)) {
589 foreach ($search_fk_warehouse as $val) {
590 if (!is_numeric($currentstock)) {
593 $currentstock += empty($stock_prod_warehouse[$objp->rowid][$val]) ? 0 : $stock_prod_warehouse[$objp->rowid][$val];
600 $currentstock = empty($stock_prod[$objp->rowid]) ? 0 : $stock_prod[$objp->rowid];
606 if ($mode ==
'future') {
607 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
608 $stock = $prod->stock_theorique;
609 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0);
610 $virtualstock = $prod->stock_theorique;
612 $stock = $currentstock;
614 if (!empty($search_fk_warehouse)) {
615 foreach ($search_fk_warehouse as $val) {
616 $stock -= empty($movements_prod_warehouse[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse[$objp->rowid][$val];
617 $nbofmovement += empty($movements_prod_warehouse_nb[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse_nb[$objp->rowid][$val];
620 $stock -= empty($movements_prod[$objp->rowid]) ? 0 : $movements_prod[$objp->rowid];
621 $nbofmovement += empty($movements_prod_nb[$objp->rowid]) ? 0 : $movements_prod_nb[$objp->rowid];
627 if ($mode ==
'future') {
628 print implode(
";", array(
630 '"'.$objp->label.
'"',
631 '"'.price2num($currentstock,
'MS').
'"',
632 '"'.price2num($stock,
'MS').
'"',
633 '"'.price2num($virtualstock,
'MS').
'"')).
"\r\n";
634 $totalvirtualstock += $virtualstock;
636 print implode(
";", array(
638 '"'.$objp->label.
'"',
640 price2num($stock * $objp->pmp,
'MT')?
'"'.price2num($stock * $objp->pmp,
'MT').
'"':
'',
641 !
getDolGlobalString(
'PRODUIT_MULTIPRICES')?
'"'.
price2num($stock * $objp->
price,
'MT').
'"':
'"'.$langs->trans(
"Variable").
'('.$langs->trans(
"OptionMULTIPRICESIsOn").
')"',
643 '"'.
price2num($currentstock,
'MS').
'"')).
"\r\n";
644 $totalbuyingprice += $stock * $objp->pmp;
645 $totalsellingprice += $stock * $objp->price;
647 $totalcurrentstock += $currentstock;
649 print
'<tr class="oddeven">';
652 print
'<td class="nowrap">'.$prod->getNomUrl(1,
'').
'</td>';
659 if ($mode ==
'future') {
661 print
'<td class="right">'.price(
price2num($currentstock,
'MS')).
'</td>';
664 print
'<td class="right"></td>';
667 print
'<td class="right">'.price(
price2num($stock,
'MS')).
'</td>';
670 print
'<td class="right">'.price(
price2num($virtualstock,
'MS')).
'</td>';
671 $totalvirtualstock += $virtualstock;
674 print
'<td class="right">'.($stock ?
price(
price2num($stock,
'MS')) : (
'<span class="opacitymedium">0</span>')).
'</td>';
677 $estimatedvalue = $stock * $objp->pmp;
678 print
'<td class="right" title="'.dolPrintHTMLForAttribute($langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->pmp,
'MU'), 1)).
'">';
680 print
'<span class="amount">'.price(
price2num($estimatedvalue,
'MT'), 1).
'</span>';
684 $totalbuyingprice += $estimatedvalue;
688 print
'<td class="right"';
690 print
' title="'.dolPrintHTMLForAttribute($langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->price,
'MU'), 1));
694 print
'<span class="amount">';
695 if ($stock || (
float) ($stock * $objp->price)) {
699 $totalsellingprice += $stock * $objp->price;
701 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
702 print $form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
707 print
'<td class="right">';
708 if ($nbofmovement > 0) {
709 $url = DOL_URL_ROOT.
'/product/stock/movement_list.php?idproduct='.$objp->rowid;
710 if (GETPOSTISSET(
'datemonth')) {
711 $url .=
'&search_date_startday='.GETPOSTINT(
'dateday');
712 $url .=
'&search_date_startmonth='.GETPOSTINT(
'datemonth');
713 $url .=
'&search_date_startyear='.GETPOSTINT(
'dateyear');
715 if (count($search_fk_warehouse) > 1) {
718 foreach ($search_fk_warehouse as $val) {
719 $url .= ($val > 0 ?
'&search_warehouse='.((int) $val) :
'');
723 print
'<a href="'.$url.
'">';
725 print $langs->trans(
"Movements");
726 print
'<span class="tabs paddingleft"><span class="badge">'.$nbofmovement.
'</span></span>';
734 print
'<td class="right">'.($currentstock ?
price(
price2num($currentstock,
'MS')) :
'<span class="opacitymedium">0</span>').
'</td>';
736 $totalcurrentstock += $currentstock;
739 $parameters = array(
'objp'=>$objp);
740 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
741 print $hookmanager->resPrint;
744 print
'<td class="right"></td>';
752$parameters = array(
'sql'=>$sql);
753$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
755 print $hookmanager->resPrint;
759if ($mode ==
'future') {
765 ($mode ==
'future')?array(
766 '"'.$langs->trans(
"Totalforthispage").
'"',
768 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
'',
772 '"'.$langs->trans(
"Totalforthispage").
'"',
775 '"'.
price2num($totalbuyingprice,
'MT').
'"',
778 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
''));
780 if (empty($date) || !$dateIsValid) {
781 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"EnterADateCriteria").
'</span></td></tr>';
783 print
'<tr class="liste_total">';
784 print
'<td>'.$langs->trans(
"Totalforthispage").
'</td>';
786 if ($mode ==
'future') {
787 print
'<td class="right">'.price(
price2num($totalcurrentstock,
'MS')).
'</td>';
790 print
'<td class="right">'.price(
price2num($totalvirtualstock,
'MS')).
'</td>';
793 print
'<td class="right">'.price(
price2num($totalbuyingprice,
'MT')).
'</td>';
795 print
'<td class="right">'.price(
price2num($totalsellingprice,
'MT')).
'</td>';
800 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()
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.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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.
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.