32require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
46require_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');
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';
110 $socid = $user->socid;
116$usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'read');
119if ($mode ==
'future') {
120 if ($date && $date < $now) {
122 $dateIsValid =
false;
125 if ($date && $date > $now) {
126 setEventMessages($langs->trans(
"ErrorDateMustBeBeforeToday"),
null,
'errors');
127 $dateIsValid =
false;
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
142if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
145 $search_fk_warehouse = array();
150$warehouseStatus = array();
158$stock_prod_warehouse = array();
159$stock_prod = array();
160if ($date && $dateIsValid) {
161 $sql =
"SELECT ps.fk_product, ps.fk_entrepot as fk_warehouse,";
162 $sql .=
" SUM(ps.reel) AS stock";
163 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps";
164 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
165 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
166 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
167 $sql .=
" AND w.rowid = ps.fk_entrepot AND p.rowid = ps.fk_product";
169 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
171 if ($productid > 0) {
172 $sql .=
" AND ps.fk_product = ".((int) $productid);
174 if (! empty($search_fk_warehouse)) {
175 $sql .=
" AND ps.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
183 $sql .=
" GROUP BY fk_product, fk_entrepot";
186 $resql =
$db->query($sql);
188 $num =
$db->num_rows($resql);
192 $obj =
$db->fetch_object($resql);
194 $tmp_fk_product = $obj->fk_product;
195 $tmp_fk_warehouse = $obj->fk_warehouse;
196 $stock = $obj->stock;
198 $stock_prod_warehouse[$tmp_fk_product][$tmp_fk_warehouse] = $stock;
199 $stock_prod[$tmp_fk_product] = (isset($stock_prod[$tmp_fk_product]) ? $stock_prod[$tmp_fk_product] : 0) + $stock;
209} elseif ($action ==
'filter') {
210 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
214$movements_prod_warehouse = array();
215$movements_prod = array();
216$movements_prod_warehouse_nb = array();
217$movements_prod_nb = array();
218if ($date && $dateIsValid) {
219 $sql =
"SELECT sm.fk_product, sm.fk_entrepot, SUM(sm.value) AS stock, COUNT(sm.rowid) AS nbofmovement";
220 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as sm";
221 $sql .=
", ".MAIN_DB_PREFIX.
"entrepot as w";
222 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
223 $sql .=
" WHERE w.entity IN (".getEntity(
'stock').
")";
224 $sql .=
" AND w.rowid = sm.fk_entrepot AND p.rowid = sm.fk_product ";
226 $sql .=
" AND w.statut IN (".$db->sanitize(implode(
',', $warehouseStatus)).
")";
228 if ($mode ==
'future') {
229 $sql .=
" AND sm.datem <= '".$db->idate($dateendofday).
"'";
231 $sql .=
" AND sm.datem >= '".$db->idate($dateendofday).
"'";
233 if ($productid > 0) {
234 $sql .=
" AND sm.fk_product = ".((int) $productid);
236 if (!empty($search_fk_warehouse)) {
237 $sql .=
" AND sm.fk_entrepot IN (".$db->sanitize(implode(
",", $search_fk_warehouse)).
")";
240 $sql .=
" AND p.ref LIKE '%".$db->escape($search_ref).
"%' ";
243 $sql .=
" AND p.label LIKE '%".$db->escape($search_nom).
"%' ";
245 $sql .=
" GROUP BY sm.fk_product, sm.fk_entrepot";
247 $resql =
$db->query($sql);
250 $num =
$db->num_rows($resql);
254 $obj =
$db->fetch_object($resql);
255 $fk_product = $obj->fk_product;
256 $fk_entrepot = $obj->fk_entrepot;
257 $stock = $obj->stock;
258 $nbofmovement = $obj->nbofmovement;
261 $movements_prod_warehouse[$fk_product][$fk_entrepot] = $stock;
262 $movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement;
265 $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod) ? $movements_prod[$fk_product] : 0);
266 $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb) ? $movements_prod_nb[$fk_product] : 0);
290$title = $langs->trans(
'StockAtDate');
292$sql =
'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,';
293$sql .=
' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
294$sql .=
' p.tms as datem, p.duration, p.tobuy, p.stock, ';
295if (!empty($search_fk_warehouse)) {
296 $sql .=
" SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue";
297 $sql .=
', SUM(ps.reel) as stock_reel';
299 $sql .=
" SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue";
302$parameters = array();
303$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
304$sql .= $hookmanager->resPrint;
308$sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
309if (!empty($search_fk_warehouse)) {
310 $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)).
")";
313$parameters = array();
314$reshook = $hookmanager->executeHooks(
'printFieldListJoin', $parameters, $object, $action);
315$sql .= $hookmanager->resPrint;
316$sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
318 $sql .=
" AND p.rowid = ".((int) $productid);
321 $sql .=
" AND p.fk_product_type = 0";
330$sqlGroupBy =
' 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,';
331$sqlGroupBy .=
' p.tms, p.duration, p.tobuy, p.stock';
333$parameters = array(
'sqlGroupBy' => $sqlGroupBy);
334$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
338 $sql .= $hookmanager->resPrint;
340 if (!empty($hookmanager->resArray[
'sqlGroupBy'])) {
341 $sqlGroupBy = $hookmanager->resArray[
'sqlGroupBy'];
348$parameters = array();
349$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
350$sql .= $hookmanager->resPrint;
352if ($sortfield ==
'stock_reel' && empty($search_fk_warehouse)) {
353 $sortfield =
'stock';
355if ($sortfield ==
'stock' && !empty($search_fk_warehouse)) {
356 $sortfield =
'stock_reel';
358$sql .=
$db->order($sortfield, $sortorder);
361$nbtotalofrecords =
'';
362if ($date && $dateIsValid) {
365 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
366 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
368 $resql =
$db->query($sqlforcount);
370 $objforcount =
$db->fetch_object($resql);
371 $nbtotalofrecords = $objforcount->nbtotalofrecords;
376 if (($page * $limit) > (
int) $nbtotalofrecords || $ext ==
'csv') {
385 $sql .=
$db->plimit($limit + 1, $offset);
389 $resql =
$db->query($sql);
395 $num =
$db->num_rows($resql);
400$helpurl =
'EN:Module_Stocks_En|FR:Module_Stock|';
401$helpurl .=
'ES:Módulo_Stocks';
403$stocklabel = $langs->trans(
'StockAtDate');
404if ($mode ==
'future') {
405 $stocklabel = $langs->trans(
"VirtualStockAtDate");
412 header(
"Content-Disposition: attachment; filename=stock".($date ?
'-'.
date(
"Y-m-d", $date) :
'').
".csv");
415 print implode(
";", ($mode ==
'future') ?
416 array(
'"Product Reference"',
'"Label"',
'"Current Stock"',
'"'.$stocklabel.
'"',
'"Virtual Stock"') :
417 array(
'"Product Reference"',
'"Label"',
'"'.$stocklabel.
'"', ($usercancreadsupplierprice ?
'"Estimated Stock Value"' :
'""'),
'"Estimate Sell Value"',
'"Movements"',
'"Current Stock"')).
"\r\n";
419 llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_stockatdate');
423 $head[0][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php';
424 $head[0][1] = $langs->trans(
"StockAtDateInPast");
425 $head[0][2] =
'stockatdatepast';
427 $head[1][0] = DOL_URL_ROOT.
'/product/stock/stockatdate.php?mode=future';
428 $head[1][1] = $langs->trans(
"StockAtDateInFuture");
429 $head[1][2] =
'stockatdatefuture';
434 print
dol_get_fiche_head($head, ($mode ==
'future' ?
'stockatdatefuture' :
'stockatdatepast'),
'', -1,
'');
436 $desc = $langs->trans(
"StockAtDatePastDesc");
437 if ($mode ==
'future') {
438 $desc = $langs->trans(
"StockAtDateFutureDesc");
440 print
'<span class="opacitymedium">'.$desc.
'</span><br>'.
"\n";
443 print
'<form name="formFilterWarehouse" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
444 print
'<input type="hidden" name="token" value="'.newToken().
'">';
445 print
'<input type="hidden" name="action" value="filter">';
446 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
448 print
'<div class="inline-block valignmiddle" style="padding-right: 20px;">';
449 print
'<span class="fieldrequired">'.$langs->trans(
'Date').
'</span> '.$form->selectDate(($date ? $date : -1),
'date');
451 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
452 print
img_picto(
'',
'product',
'class="pictofixedwidth"').
' ';
454 print $form->select_produits($productid,
'productid',
'', 0, 0, -1, 2,
'', 0, array(), 0, $langs->trans(
'Product'), 0,
'maxwidth300', 0,
'',
null, 1);
456 if ($mode !=
'future') {
458 print
' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
459 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$langs->trans(
"Warehouse").
' :';
461 $selected = ((
GETPOSTISSET(
'search_fk_warehouse') ||
GETPOSTISSET(
'fk_warehouse')) ? $search_fk_warehouse :
'ifonenodefault');
462 print $formproduct->selectWarehouses($selected,
'search_fk_warehouse',
'', 1, 0, 0, $langs->trans(
'Warehouse'), 0, 0, array(),
'minwidth200', array(), 1,
false,
'e.ref', 1);
467 $parameters = array();
468 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
469 if (empty($reshook)) {
470 print $hookmanager->resPrint;
473 print
'<div class="inline-block valignmiddle">';
474 print
'<input type="submit" class="button" name="valid" value="'.$langs->trans(
'Refresh').
'">';
480 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
481 $param .=
'&contextpage='.urlencode($contextpage);
483 if ($limit > 0 && $limit !=
$conf->liste_limit) {
484 $param .=
'&limit='.((int) $limit);
486 $param .=
'&mode='.$mode;
487 $param_warehouse =
'';
488 if (!empty($search_fk_warehouse)) {
489 foreach ($search_fk_warehouse as $val) {
490 $param_warehouse .=
'&search_fk_warehouse[]='.$val;
492 $param .= $param_warehouse;
494 if ($productid > 0) {
495 $param .=
'&productid='.(int) $productid;
498 $param .=
'&dateday='.GETPOSTINT(
'dateday');
501 $param .=
'&datemonth='.GETPOSTINT(
'datemonth');
504 $param .=
'&dateyear='.GETPOSTINT(
'dateyear');
508 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'stock', 0,
'',
'', $limit, 0, 0, 1);
510 print
'<div class="div-table-responsive">';
513 print
'<a href="stockatdate.php?output=csv&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder).
'&type='.((int) $type).
'&mode='.urlencode($mode).
514 (($productid > 0) ?
"&productid=".((
int) $productid) :
'').
521 '" title="Download CSV" />';
522 print
img_picto(
'',
'download',
'class="pictofixedwidth"');
523 print
'Download CSV';
527 print
'<table class="liste centpercent">';
529 print
'<input type="hidden" name="token" value="'.newToken().
'">';
530 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
531 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
532 print
'<input type="hidden" name="type" value="'.$type.
'">';
533 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
536 print
'<tr class="liste_titre_filter">';
537 if (
$conf->main_checkbox_left_column) {
538 print
'<td class="liste_titre center maxwidthsearch">';
539 $searchpicto = $form->showFilterButtons(
'left');
543 print
'<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'"></td>';
544 print
'<td class="liste_titre"><input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).
'"></td>';
545 print
'<td class="liste_titre"></td>';
546 print
'<td class="liste_titre"></td>';
547 print
'<td class="liste_titre"></td>';
548 if ($mode ==
'future') {
549 print
'<td class="liste_titre"></td>';
551 print
'<td class="liste_titre"></td>';
552 print
'<td class="liste_titre"></td>';
555 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
556 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
557 print $hookmanager->resPrint;
560 if (!
$conf->main_checkbox_left_column) {
561 print
'<td class="liste_titre center maxwidthsearch">';
562 $searchpicto = $form->showFilterButtons();
568 $fieldtosortcurrentstock =
'stock';
569 if (!empty($search_fk_warehouse)) {
570 $fieldtosortcurrentstock =
'stock_reel';
574 print
'<tr class="liste_titre">';
576 if (
$conf->main_checkbox_left_column) {
582 if ($mode ==
'future') {
583 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock,
'', $param,
'', $sortfield, $sortorder,
'right ');
585 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ',
'VirtualStockAtDateDesc');
586 print_liste_field_titre(
'VirtualStock', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
588 print_liste_field_titre($stocklabel, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
589 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
')';
590 if ($usercancreadsupplierprice) {
591 print_liste_field_titre(
"EstimatedStockValue", $_SERVER[
"PHP_SELF"],
"currentvalue",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
593 $tooltiptext = $langs->trans(
"QtyAtDate").
' x '.$langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
')';
594 print_liste_field_titre(
"EstimatedStockValueSell", $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'right ', $tooltiptext, 1);
595 $tooltiptext = $langs->trans(
"MovementsSinceDate");
596 print_liste_field_titre(
'since', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'',
'',
'',
'right ', $tooltiptext, 1);
597 print_liste_field_titre(
'CurrentStock', $_SERVER[
"PHP_SELF"], $fieldtosortcurrentstock,
'', $param,
'', $sortfield, $sortorder,
'right ');
601 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
602 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
603 print $hookmanager->resPrint;
606 if (!
$conf->main_checkbox_left_column) {
613$totalbuyingprice = 0;
614$totalsellingprice = 0;
615$totalcurrentstock = 0;
616$totalvirtualstock = 0;
619while ($i < ($limit ? min($num, $limit) : $num)) {
624 $objp =
$db->fetch_object($resql);
627 $prod->fetch($objp->rowid);
648 if (!empty($search_fk_warehouse)) {
650 foreach ($search_fk_warehouse as $val) {
651 if (!is_numeric($currentstock)) {
654 $currentstock += empty($stock_prod_warehouse[$objp->rowid][$val]) ? 0 : $stock_prod_warehouse[$objp->rowid][$val];
661 $currentstock = empty($stock_prod[$objp->rowid]) ? 0 : $stock_prod[$objp->rowid];
669 if ($mode ==
'future') {
670 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
671 $stock =
$prod->stock_theorique;
672 $prod->load_stock(
'warehouseopen,warehouseinternal,nobatch', 0);
673 $virtualstock =
$prod->stock_theorique;
675 $stock = $currentstock;
676 if (!empty($search_fk_warehouse)) {
677 foreach ($search_fk_warehouse as $val) {
678 $stock -= empty($movements_prod_warehouse[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse[$objp->rowid][$val];
679 $nbofmovement += empty($movements_prod_warehouse_nb[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse_nb[$objp->rowid][$val];
682 $stock -= empty($movements_prod[$objp->rowid]) ? 0 : $movements_prod[$objp->rowid];
683 $nbofmovement += empty($movements_prod_nb[$objp->rowid]) ? 0 : $movements_prod_nb[$objp->rowid];
689 if ($mode ==
'future') {
690 print implode(
";", array(
692 '"'.$objp->label.
'"',
693 '"'.price2num($currentstock,
'MS').
'"',
694 '"'.price2num($stock,
'MS').
'"',
695 '"'.price2num($virtualstock,
'MS').
'"')).
"\r\n";
696 $totalvirtualstock += $virtualstock;
698 print implode(
";", array(
700 '"'.$objp->label.
'"',
702 ($usercancreadsupplierprice ? (
price2num($stock * $objp->pmp,
'MT') ?
'"'.price2num($stock * $objp->pmp,
'MT').
'"' :
'') :
''),
705 '"'.
price2num($currentstock,
'MS').
'"')).
"\r\n";
706 if ($usercancreadsupplierprice) {
707 $totalbuyingprice += $stock * $objp->pmp;
709 $totalsellingprice += $stock * $objp->price;
711 $totalcurrentstock += $currentstock;
713 print
'<tr class="oddeven">';
716 if (
$conf->main_checkbox_left_column) {
717 print
'<td class="left"></td>';
721 print
'<td class="nowrap">'.$prod->getNomUrl(1,
'').
'</td>';
728 if ($mode ==
'future') {
730 print
'<td class="right">'.price(
price2num($currentstock,
'MS')).
'</td>';
733 print
'<td class="right"></td>';
736 print
'<td class="right">'.price(
price2num($stock,
'MS')).
'</td>';
739 print
'<td class="right">'.price(
price2num($virtualstock,
'MS')).
'</td>';
740 $totalvirtualstock += $virtualstock;
743 print
'<td class="right">'.($stock ?
price(
price2num($stock,
'MS')) : (
'<span class="opacitymedium">0</span>')).
'</td>';
746 $estimatedvalue = $stock * $objp->pmp;
747 if ($usercancreadsupplierprice) {
748 print
'<td class="right" title="'.dolPrintHTMLForAttribute($langs->trans(
"AverageUnitPricePMPShort").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->pmp,
'MU'), 1)).
'">';
750 print
'<span class="amount">'.price(
price2num($estimatedvalue,
'MT'), 1).
'</span>';
754 $totalbuyingprice += $estimatedvalue;
759 print
'<td class="right"';
761 print
' title="'.dolPrintHTMLForAttribute($langs->trans(
"SellingPrice").
' ('.$langs->trans(
"Currently").
'): '.
price(
price2num($objp->price,
'MU'), 1));
765 print
'<span class="amount">';
766 if ($stock || (
float) ($stock * $objp->price)) {
770 $totalsellingprice += $stock * $objp->price;
772 $htmltext = $langs->trans(
"OptionMULTIPRICESIsOn");
773 print $form->textwithtooltip(
'<span class="opacitymedium">'.$langs->trans(
"Variable").
'</span>', $htmltext);
778 print
'<td class="right">';
779 if ($nbofmovement > 0) {
780 $url = DOL_URL_ROOT.
'/product/stock/movement_list.php?idproduct='.$objp->rowid;
782 $url .=
'&search_date_startday='.GETPOSTINT(
'dateday');
783 $url .=
'&search_date_startmonth='.GETPOSTINT(
'datemonth');
784 $url .=
'&search_date_startyear='.GETPOSTINT(
'dateyear');
786 if (count($search_fk_warehouse) > 1) {
789 foreach ($search_fk_warehouse as $val) {
790 $url .= ($val > 0 ?
'&search_warehouse='.((int) $val) :
'');
794 print
'<a href="'.$url.
'">';
796 print $langs->trans(
"Movements");
797 print
'<span class="tabs paddingleft"><span class="badge">'.$nbofmovement.
'</span></span>';
805 print
'<td class="right">'.($currentstock ?
price(
price2num($currentstock,
'MS')) :
'<span class="opacitymedium">0</span>').
'</td>';
807 $totalcurrentstock += $currentstock;
810 $parameters = array(
'objp' => $objp);
811 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
812 print $hookmanager->resPrint;
815 if (!
$conf->main_checkbox_left_column) {
816 print
'<td class="right"></td>';
825$parameters = array(
'sql' => $sql);
826$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
828 print $hookmanager->resPrint;
832if ($mode ==
'future') {
839 ($mode ==
'future') ? array(
840 '"'.$langs->trans(
"Totalforthispage").
'"',
842 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
'',
846 '"'.$langs->trans(
"Totalforthispage").
'"',
849 '"'.($usercancreadsupplierprice ?
price2num($totalbuyingprice,
'MT') :
'').
'"',
852 $productid > 0 ?
price2num($totalcurrentstock,
'MS') :
'')
855 if (empty($date) || !$dateIsValid) {
856 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"EnterADateCriteria").
'</span></td></tr>';
858 print
'<tr class="liste_total">';
859 print
'<td>'.$langs->trans(
"Totalforthispage").
'</td>';
861 if ($mode ==
'future') {
862 print
'<td class="right">'.price(
price2num($totalcurrentstock,
'MS')).
'</td>';
865 print
'<td class="right">'.price(
price2num($totalvirtualstock,
'MS')).
'</td>';
868 if ($usercancreadsupplierprice) {
869 print
'<td class="right">'.price(
price2num($totalbuyingprice,
'MT')).
'</td>';
872 print
'<td class="right">'.price(
price2num($totalsellingprice,
'MT')).
'</td>';
877 print
'<td class="right">'.($productid > 0 ?
price(
price2num($totalcurrentstock,
'MS')) :
'').
'</td>';
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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_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_now($mode='gmt')
Return date for now.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $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, $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, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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 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.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
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.