30 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
37 require_once
'./lib/replenishment.lib.php';
40 $langs->loadLangs(array(
'products',
'stocks',
'orders'));
43 $hookmanager->initHooks(array(
'stockatdate'));
47 $socid = $user->socid;
53 $action =
GETPOST(
'action',
'aZ09');
55 $mode =
GETPOST(
'mode',
'alpha');
66 $search_ref =
GETPOST(
'search_ref',
'alphanohtml');
67 $search_nom =
GETPOST(
'search_nom',
'alphanohtml');
73 $search_fk_warehouse =
GETPOST(
'search_fk_warehouse',
'array:int');
75 $search_fk_warehouse = array(
GETPOSTINT(
'search_fk_warehouse'));
79 $search_fk_warehouse = array(
GETPOSTINT(
'fk_warehouse'));
82 foreach ($search_fk_warehouse as $key => $val) {
83 if ($val == -1 || empty($val)) {
84 unset($search_fk_warehouse[$key]);
88 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
89 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
91 if (empty($page) || $page == -1) {
95 $offset = $limit * $page;
103 $parameters = array();
104 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
110 if ($mode ==
'future') {
111 if ($date && $date < $now) {
113 $dateIsValid =
false;
116 if ($date && $date > $now) {
117 setEventMessages($langs->trans(
"ErrorDateMustBeBeforeToday"),
null,
'errors');
118 $dateIsValid =
false;
127 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
130 $search_fk_warehouse = array();
135 $warehouseStatus = array();
143 $stock_prod_warehouse = array();
144 $stock_prod = array();
145 if ($date && $dateIsValid) {
146 $sql =
"SELECT ps.fk_product, ps.fk_entrepot as fk_warehouse,";
147 $sql .=
" SUM(ps.reel) AS stock";
148 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps";
149 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
150 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
151 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
152 $sql .=
" AND w.rowid = ps.fk_entrepot AND p.rowid = ps.fk_product";
154 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
156 if ($productid > 0) {
157 $sql .=
" AND ps.fk_product = ".((int) $productid);
159 if (! empty($search_fk_warehouse)) {
160 $sql .=
" AND ps.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
168 $sql .=
" GROUP BY fk_product, fk_entrepot";
171 $resql = $db->query(
$sql);
173 $num = $db->num_rows($resql);
177 $obj = $db->fetch_object($resql);
179 $tmp_fk_product = $obj->fk_product;
180 $tmp_fk_warehouse = $obj->fk_warehouse;
181 $stock = $obj->stock;
183 $stock_prod_warehouse[$tmp_fk_product][$tmp_fk_warehouse] = $stock;
184 $stock_prod[$tmp_fk_product] = (isset($stock_prod[$tmp_fk_product]) ? $stock_prod[$tmp_fk_product] : 0) + $stock;
194 } elseif ($action ==
'filter') {
195 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
199 $movements_prod_warehouse = array();
200 $movements_prod = array();
201 $movements_prod_warehouse_nb = array();
202 $movements_prod_nb = array();
203 if ($date && $dateIsValid) {
204 $sql =
"SELECT sm.fk_product, sm.fk_entrepot, SUM(sm.value) AS stock, COUNT(sm.rowid) AS nbofmovement";
205 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as sm";
206 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
207 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
208 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
209 $sql .=
" AND w.rowid = sm.fk_entrepot AND p.rowid = sm.fk_product ";
211 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
213 if ($mode ==
'future') {
214 $sql .=
" AND sm.datem <= '".$db->idate($dateendofday).
"'";
216 $sql .=
" AND sm.datem >= '".$db->idate($dateendofday).
"'";
218 if ($productid > 0) {
219 $sql .=
" AND sm.fk_product = ".((int) $productid);
221 if (!empty($search_fk_warehouse)) {
222 $sql .=
" AND sm.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
225 $sql .=
" AND p.ref LIKE '%".$db->escape($search_ref).
"%' ";
228 $sql .=
" AND p.label LIKE '%".$db->escape($search_nom).
"%' ";
230 $sql .=
" GROUP BY sm.fk_product, sm.fk_entrepot";
232 $resql = $db->query(
$sql);
235 $num = $db->num_rows($resql);
239 $obj = $db->fetch_object($resql);
240 $fk_product = $obj->fk_product;
241 $fk_entrepot = $obj->fk_entrepot;
242 $stock = $obj->stock;
243 $nbofmovement = $obj->nbofmovement;
246 $movements_prod_warehouse[$fk_product][$fk_entrepot] = $stock;
247 $movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement;
250 $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod)?$movements_prod[$fk_product]:0);
251 $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb)?$movements_prod_nb[$fk_product]:0);
269 $form =
new Form($db);
275 $title = $langs->trans(
'StockAtDate');
277 $sql =
'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,';
278 $sql .=
' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
279 $sql .=
' p.tms as datem, p.duration, p.tobuy, p.stock, ';
280 if (!empty($search_fk_warehouse)) {
281 $sql .=
" SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue";
282 $sql .=
', SUM(ps.reel) as stock_reel';
284 $sql .=
" SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue";
287 $parameters = array();
288 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
289 $sql .= $hookmanager->resPrint;
291 $sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
292 if (!empty($search_fk_warehouse)) {
293 $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)).
")";
296 $parameters = array();
297 $reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters);
298 $sql .= $hookmanager->resPrint;
299 $sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
300 if ($productid > 0) {
301 $sql .=
" AND p.rowid = ".((int) $productid);
304 $sql .=
" AND p.fk_product_type = 0";
306 if (!empty($canvas)) {
307 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
315 $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,';
316 $sql .=
' p.tms, p.duration, p.tobuy, p.stock';
318 $parameters = array();
319 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
320 $sql .= $hookmanager->resPrint;
322 if ($sortfield ==
'stock_reel' && empty($search_fk_warehouse)) {
323 $sortfield =
'stock';
325 if ($sortfield ==
'stock' && !empty($search_fk_warehouse)) {
326 $sortfield =
'stock_reel';
328 $sql .= $db->order($sortfield, $sortorder);
330 $nbtotalofrecords =
'';
331 if ($date && $dateIsValid) {
333 $result = $db->query(
$sql);
334 $nbtotalofrecords = $db->num_rows($result);
335 if (($page * $limit) > $nbtotalofrecords || $ext ==
'csv') {
343 $sql .= $db->plimit($limit + 1, $offset);
344 $resql = $db->query(
$sql);
354 $num = $db->num_rows($resql);
359 $helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|';
360 $helpurl .=
'ES:Módulo_Stocks';
362 $stocklabel = $langs->trans(
'StockAtDate');
363 if ($mode ==
'future') {
364 $stocklabel = $langs->trans(
"VirtualStockAtDate");
371 header(
"Content-Disposition: attachment; filename=stock".($date?
'-'.date(
"Y-m-d", $date):
'').
".csv");
374 print implode(
";", ($mode ==
'future') ?
375 array(
'"Product Reference"',
'"Label"',
'"Current Stock"',
'"'.$stocklabel.
'"',
'"Virtual Stock"'):
376 array(
'"Product Reference"',
'"Label"',
'"'.$stocklabel.
'"',
'"Estimated Stock Value"',
'"Estimate Sell Value"',
'"Movements"',
'"Current Stock"')).
"\r\n";
382 $head[0][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php';
383 $head[0][1] = $langs->trans(
"StockAtDateInPast");
384 $head[0][2] =
'stockatdatepast';
386 $head[1][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php?mode=future';
387 $head[1][1] = $langs->trans(
"StockAtDateInFuture");
388 $head[1][2] =
'stockatdatefuture';
393 print
dol_get_fiche_head($head, ($mode ==
'future' ?
'stockatdatefuture' :
'stockatdatepast'),
'', -1,
'');
395 $desc = $langs->trans(
"StockAtDatePastDesc");
396 if ($mode ==
'future') {
397 $desc = $langs->trans(
"StockAtDateFutureDesc");
399 print
'<span class="opacitymedium">'.$desc.
'</span><br>'.
"\n";
402 print
'<form name="formFilterWarehouse" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
403 print
'<input type="hidden" name="token" value="'.newToken().
'">';
404 print
'<input type="hidden" name="action" value="filter">';
405 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
407 print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
408 print
'<span class="fieldrequired">'.$langs->trans(
'Date').
'</span> '.$form->selectDate(($date ? $date : -1),
'date');
410 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
411 print
img_picto(
'',
'product',
'class="pictofiwedwidth"').
' ';
413 print $form->select_produits($productid,
'productid',
'', 0, 0, -1, 2,
'', 0, array(), 0, $langs->trans(
'Product'), 0,
'maxwidth300', 0,
'',
null, 1);
415 if ($mode !=
'future') {
417 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
418 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$langs->trans(
"Warehouse").
' :';
420 $selected = ((
GETPOSTISSET(
'search_fk_warehouse') ||
GETPOSTISSET(
'fk_warehouse')) ? $search_fk_warehouse :
'ifonenodefault');
421 print $formproduct->selectWarehouses($selected,
'search_fk_warehouse',
'', 1, 0, 0, $langs->trans(
'Warehouse'), 0, 0,
null,
'minwidth200',
null, 1,
false,
'e.ref', 1);
426 $parameters = array();
427 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
428 if (empty($reshook)) {
429 print $hookmanager->resPrint;
432 print
'<div class="inline-block valignmiddle">';
433 print
'<input type="submit" class="button" name="valid" value="'.$langs->trans(
'Refresh').
'">';
439 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
440 $param .=
'&contextpage='.urlencode($contextpage);
442 if ($limit > 0 && $limit != $conf->liste_limit) {
443 $param .=
'&limit='.((int) $limit);
445 $param .=
'&mode='.$mode;
446 $param_warehouse =
'';
447 if (!empty($search_fk_warehouse)) {
448 foreach ($search_fk_warehouse as $val) {
449 $param_warehouse .=
'&search_fk_warehouse[]='.$val;
451 $param .= $param_warehouse;
453 if ($productid > 0) {
454 $param .=
'&productid='.(int) $productid;
457 $param .=
'&dateday='.GETPOSTINT(
'dateday');
460 $param .=
'&datemonth='.GETPOSTINT(
'datemonth');
463 $param .=
'&dateyear='.GETPOSTINT(
'dateyear');
467 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'stock', 0,
'',
'', $limit, 0, 0, 1);
469 print
'<div class="div-table-responsive">';
472 print
'<a href="stockatdate.php?output=csv&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder).
'&type='.((int) $type).
'&mode='.urlencode($mode).
473 (($productid > 0)?
"&productid=".urlencode($productid):
'').
475 "&search_ref=".dol_escape_htmltag($search_ref).
476 "&search_nom=".dol_escape_htmltag($search_nom).
477 (
GETPOSTISSET(
'dateday')?
"&dateday=".GETPOSTINT(
'dateday'):
'').
478 (
GETPOSTISSET(
'datemonth')?
"&datemonth=".GETPOSTINT(
'datemonth'):
'').
479 (
GETPOSTISSET(
'dateyear')?
"&dateyear=".GETPOSTINT(
'dateyear'):
'').
480 '" title="Download CSV" />';
481 print
img_picto(
'',
'download',
'class="pictofixedwidth"');
482 print
'Download CSV';
486 print
'<table class="liste centpercent">';
488 print
'<input type="hidden" name="token" value="'.newToken().
'">';
489 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
490 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
491 print
'<input type="hidden" name="type" value="'.$type.
'">';
492 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
495 print
'<tr class="liste_titre_filter">';
496 print
'<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'"></td>';
497 print
'<td class="liste_titre"><input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).
'"></td>';
498 print
'<td class="liste_titre"></td>';
499 print
'<td class="liste_titre"></td>';
500 print
'<td class="liste_titre"></td>';
501 if ($mode ==
'future') {
502 print
'<td class="liste_titre"></td>';
504 print
'<td class="liste_titre"></td>';
505 print
'<td class="liste_titre"></td>';
508 $parameters = array(
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
509 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
510 print $hookmanager->resPrint;
512 print
'<td class="liste_titre maxwidthsearch">';
513 $searchpicto = $form->showFilterAndCheckAddButtons(0);
518 $fieldtosortcurrentstock =
'stock';
519 if (!empty($search_fk_warehouse)) {
520 $fieldtosortcurrentstock =
'stock_reel';
524 print
'<tr class="liste_titre">';
528 if ($mode ==
'future') {
529 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock, $param,
'',
'', $sortfield, $sortorder,
'right ');
531 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ',
'VirtualStockAtDateDesc');
532 print_liste_field_titre(
'VirtualStock', $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
534 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'', $param,
'',
'', $sortfield, $sortorder,
'right ');
535 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
')';
536 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"estimatedvalue",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
537 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
')';
538 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
539 $tooltiptext = $langs->trans(
"MovementsSinceDate");
540 print_liste_field_titre(
'', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'',
'',
'',
'right ', $tooltiptext, 1);
541 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock, $param,
'',
'', $sortfield, $sortorder,
'right ');
545 $parameters = array(
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
546 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
547 print $hookmanager->resPrint;
554 $totalbuyingprice = 0;
555 $totalsellingprice = 0;
556 $totalcurrentstock = 0;
557 $totalvirtualstock = 0;
560 while ($i < ($limit ? min($num, $limit) : $num)) {
561 $objp = $db->fetch_object($resql);
564 $prod->fetch($objp->rowid);
585 if (!empty($search_fk_warehouse)) {
587 foreach ($search_fk_warehouse as $val) {
588 if (!is_numeric($currentstock)) {
591 $currentstock += empty($stock_prod_warehouse[$objp->rowid][$val]) ? 0 : $stock_prod_warehouse[$objp->rowid][$val];
598 $currentstock = empty($stock_prod[$objp->rowid]) ? 0 : $stock_prod[$objp->rowid];
604 if ($mode ==
'future') {
605 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
606 $stock = $prod->stock_theorique;
607 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0);
608 $virtualstock = $prod->stock_theorique;
610 $stock = $currentstock;
612 if (!empty($search_fk_warehouse)) {
613 foreach ($search_fk_warehouse as $val) {
614 $stock -= empty($movements_prod_warehouse[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse[$objp->rowid][$val];
615 $nbofmovement += empty($movements_prod_warehouse_nb[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse_nb[$objp->rowid][$val];
618 $stock -= empty($movements_prod[$objp->rowid]) ? 0 : $movements_prod[$objp->rowid];
619 $nbofmovement += empty($movements_prod_nb[$objp->rowid]) ? 0 : $movements_prod_nb[$objp->rowid];
625 if ($mode ==
'future') {
626 print implode(
";", array(
628 '"'.$objp->label.
'"',
629 '"'.price2num($currentstock,
'MS').
'"',
630 '"'.price2num($stock,
'MS').
'"',
631 '"'.price2num($virtualstock,
'MS').
'"')).
"\r\n";
632 $totalvirtualstock += $virtualstock;
634 print implode(
";", array(
636 '"'.$objp->label.
'"',
638 price2num($stock * $objp->pmp,
'MT')?
'"'.price2num($stock * $objp->pmp,
'MT').
'"':
'',
639 !
getDolGlobalString(
'PRODUIT_MULTIPRICES')?
'"'.
price2num($stock * $objp->price,
'MT').
'"':
'"'.$langs->trans(
"Variable").
'('.$langs->trans(
"OptionMULTIPRICESIsOn").
')"',
641 '"'.price2num($currentstock,
'MS').
'"')).
"\r\n";
642 $totalbuyingprice += $stock * $objp->pmp;
643 $totalsellingprice += $stock * $objp->price;
645 $totalcurrentstock += $currentstock;
647 print
'<tr class="oddeven">';
650 print
'<td class="nowrap">'.$prod->getNomUrl(1,
'').
'</td>';
657 if ($mode ==
'future') {
659 print
'<td class="right">'.price(
price2num($currentstock,
'MS')).
'</td>';
662 print
'<td class="right"></td>';
665 print
'<td class="right">'.price(
price2num($stock,
'MS')).
'</td>';
668 print
'<td class="right">'.price(
price2num($virtualstock,
'MS')).
'</td>';
669 $totalvirtualstock += $virtualstock;
672 print
'<td class="right">'.($stock ?
price(
price2num($stock,
'MS')) : (
'<span class="opacitymedium">0</span>')).
'</td>';
675 $estimatedvalue = $stock * $objp->pmp;
676 print
'<td class="right" title="'.dolPrintHTMLForAttribute($langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->pmp,
'MU'), 1)).
'">';
678 print
'<span class="amount">'.price(
price2num($estimatedvalue,
'MT'), 1).
'</span>';
682 $totalbuyingprice += $estimatedvalue;
686 print
'<td class="right"';
688 print
' title="'.dolPrintHTMLForAttribute($langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->price,
'MU'), 1));
692 print
'<span class="amount">';
693 if ($stock || (
float) ($stock * $objp->price)) {
697 $totalsellingprice += $stock * $objp->price;
699 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
700 print $form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
705 print
'<td class="right">';
706 if ($nbofmovement > 0) {
707 $url = DOL_URL_ROOT.
'/product/stock/movement_list.php?idproduct='.$objp->rowid;
709 $url .=
'&search_date_startday='.GETPOSTINT(
'dateday');
710 $url .=
'&search_date_startmonth='.GETPOSTINT(
'datemonth');
711 $url .=
'&search_date_startyear='.GETPOSTINT(
'dateyear');
713 if (count($search_fk_warehouse) > 1) {
716 foreach ($search_fk_warehouse as $val) {
717 $url .= ($val > 0 ?
'&search_warehouse='.((int) $val) :
'');
721 print
'<a href="'.$url.
'">';
723 print $langs->trans(
"Movements");
724 print
'<span class="tabs paddingleft"><span class="badge">'.$nbofmovement.
'</span></span>';
732 print
'<td class="right">'.($currentstock ?
price(
price2num($currentstock,
'MS')) :
'<span class="opacitymedium">0</span>').
'</td>';
734 $totalcurrentstock += $currentstock;
737 $parameters = array(
'objp'=>$objp);
738 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
739 print $hookmanager->resPrint;
742 print
'<td class="right"></td>';
750 $parameters = array(
'sql'=>
$sql);
751 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
753 print $hookmanager->resPrint;
757 if ($mode ==
'future') {
763 ($mode ==
'future')?array(
764 '"'.$langs->trans(
"Totalforthispage").
'"',
766 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
'',
770 '"'.$langs->trans(
"Totalforthispage").
'"',
773 '"'.price2num($totalbuyingprice,
'MT').
'"',
776 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
''));
778 if (empty($date) || !$dateIsValid) {
779 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"EnterADateCriteria").
'</span></td></tr>';
781 print
'<tr class="liste_total">';
782 print
'<td>'.$langs->trans(
"Totalforthispage").
'</td>';
784 if ($mode ==
'future') {
785 print
'<td class="right">'.price(
price2num($totalcurrentstock,
'MS')).
'</td>';
788 print
'<td class="right">'.price(
price2num($totalvirtualstock,
'MS')).
'</td>';
791 print
'<td class="right">'.price(
price2num($totalbuyingprice,
'MT')).
'</td>';
793 print
'<td class="right">'.price(
price2num($totalsellingprice,
'MT')).
'</td>';
798 print
'<td class="right">'.($productid > 0 ?
price(
price2num($totalcurrentstock,
'MS')) :
'').
'</td>';
814 if (!empty($resql)) {
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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.