30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.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.
'/product/stock/class/mouvementstock.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
42if (isModEnabled(
'project')) {
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48$langs->loadLangs(array(
'products',
'stocks',
'orders'));
49if (isModEnabled(
'productbatch')) {
50 $langs->load(
"productbatch");
53$action =
GETPOST(
'action',
'aZ09');
54$massaction =
GETPOST(
'massaction',
'alpha');
55$confirm =
GETPOST(
'confirm',
'alpha');
56$cancel =
GETPOST(
'cancel',
'alpha');
57$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
58$toselect =
GETPOST(
'toselect',
'array');
59$backtopage =
GETPOST(
"backtopage",
"alpha");
60$optioncss =
GETPOST(
'optioncss',
'aZ');
66$idproduct =
GETPOST(
'idproduct',
'int');
67$product_id =
GETPOST(
"product_id",
'int');
69$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
70$search_date_startday =
GETPOST(
'search_date_startday',
'int');
71$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
72$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
73$search_date_endday =
GETPOST(
'search_date_endday',
'int');
74$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
75$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
76$search_date_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_startmonth',
'int'),
GETPOST(
'search_date_startday',
'int'),
GETPOST(
'search_date_startyear',
'int'),
'tzuserrel');
77$search_date_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_endmonth',
'int'),
GETPOST(
'search_date_endday',
'int'),
GETPOST(
'search_date_endyear',
'int'),
'tzuserrel');
78$search_ref =
GETPOST(
'search_ref',
'alpha');
79$search_movement =
GETPOST(
"search_movement");
80$search_product_ref = trim(
GETPOST(
"search_product_ref"));
81$search_product = trim(
GETPOST(
"search_product"));
82$search_warehouse = trim(
GETPOST(
"search_warehouse"));
83$search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
84$search_user = trim(
GETPOST(
"search_user"));
85$search_batch = trim(
GETPOST(
"search_batch"));
86$search_qty = trim(
GETPOST(
"search_qty"));
87$search_type_mouvement =
GETPOST(
'search_type_mouvement',
'int');
88$search_fk_projet=
GETPOST(
"search_fk_projet",
'int');
93$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
94$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
95$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
96$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
97if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
101$offset = $limit * $page;
102$pageprev = $page - 1;
103$pagenext = $page + 1;
106 $sortfield =
"m.datem";
112$pdluoid =
GETPOST(
'pdluoid',
'int');
117$diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
118$hookmanager->initHooks(array($contextpage));
123$extrafields->fetch_name_optionals_label($object->table_element);
125$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
128 'm.rowid'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>1),
129 'm.datem'=>array(
'label'=>
"Date",
'checked'=>1,
'position'=>2),
130 'p.ref'=>array(
'label'=>
"ProductRef",
'checked'=>1,
'css'=>
'maxwidth100',
'position'=>3),
131 'p.label'=>array(
'label'=>
"ProductLabel",
'checked'=>0,
'position'=>5),
132 'm.batch'=>array(
'label'=>
"BatchNumberShort",
'checked'=>1,
'position'=>8,
'enabled'=>(isModEnabled(
'productbatch'))),
133 'pl.eatby'=>array(
'label'=>
"EatByDate",
'checked'=>0,
'position'=>9,
'enabled'=>(isModEnabled(
'productbatch'))),
134 'pl.sellby'=>array(
'label'=>
"SellByDate",
'checked'=>0,
'position'=>10,
'enabled'=>(isModEnabled(
'productbatch'))),
135 'e.ref'=>array(
'label'=>
"Warehouse",
'checked'=>1,
'position'=>100,
'enabled'=>(!($id > 0))),
136 'm.fk_user_author'=>array(
'label'=>
"Author",
'checked'=>0,
'position'=>120),
137 'm.inventorycode'=>array(
'label'=>
"InventoryCodeShort",
'checked'=>1,
'position'=>130),
138 'm.label'=>array(
'label'=>
"MovementLabel",
'checked'=>1,
'position'=>140),
139 'm.type_mouvement'=>array(
'label'=>
"TypeMovement",
'checked'=>0,
'position'=>150),
140 'origin'=>array(
'label'=>
"Origin",
'checked'=>1,
'position'=>155),
141 'm.fk_projet'=>array(
'label'=>
'Project',
'checked'=>0,
'position'=>180),
142 'm.value'=>array(
'label'=>
"Qty",
'checked'=>1,
'position'=>200),
143 'm.price'=>array(
'label'=>
"UnitPurchaseValue",
'checked'=>0,
'position'=>210,
'enabled'=>(!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
148include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
150if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
151 unset($arrayfields[
'pl.sellby']);
153if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) {
154 unset($arrayfields[
'pl.eatby']);
159if ($id > 0 || !empty($ref)) {
160 $tmpwarehouse->fetch($id, $ref);
161 $id = $tmpwarehouse->id;
170if (!$user->rights->stock->mouvement->lire) {
174$uploaddir = $conf->stock->dir_output.
'/movements';
176$permissiontoread = $user->rights->stock->mouvement->lire;
177$permissiontoadd = $user->rights->stock->mouvement->creer;
178$permissiontodelete = $user->rights->stock->mouvement->creer;
180$usercanread = $user->rights->stock->mouvement->lire;
181$usercancreate = $user->rights->stock->mouvement->creer;
182$usercandelete = $user->rights->stock->mouvement->creer;
191if (
GETPOST(
'cancel',
'alpha')) {
195if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
199$parameters = array();
200$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
205if (empty($reshook)) {
207 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
211 $search_date_startday =
'';
212 $search_date_startmonth =
'';
213 $search_date_startyear =
'';
214 $search_date_endday =
'';
215 $search_date_endmonth =
'';
216 $search_date_endyear =
'';
217 $search_date_start =
'';
218 $search_date_end =
'';
220 $search_movement =
"";
221 $search_type_mouvement =
"";
222 $search_inventorycode =
"";
223 $search_product_ref =
"";
224 $search_product =
"";
225 $search_warehouse =
"";
232 $search_array_options = array();
234 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
235 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
240 $objectclass =
'MouvementStock';
241 $objectlabel =
'MouvementStock';
243 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
244 if (empty($diroutputmassaction)) {
245 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
249 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
250 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
251 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
253 $objecttmp =
new $objectclass($db);
254 $listofobjectid = array();
255 foreach ($toselect as $toselectid) {
256 $objecttmp =
new $objectclass($db);
257 $result = $objecttmp->fetch($toselectid);
259 $listofobjectid[$toselectid] = $toselectid;
263 $arrayofinclusion = array();
264 foreach ($listofobjectref as $tmppdf) {
267 foreach ($listofobjectref as $tmppdf) {
268 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
270 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0,
true);
273 $outputlangs = $langs;
276 $newlang =
GETPOST(
'lang_id',
'aZ09');
281 if (!empty($newlang)) {
283 $outputlangs->setDefaultLang($newlang);
291 $filename = preg_replace(
'/\s/',
'_', $filename);
303 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
312 $langs->load(
"exports");
320 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
323if ($action ==
'update_extras') {
324 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse);
327 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse,
GETPOST(
'attribute',
'restricthtml'));
332 $result = $tmpwarehouse->insertExtraFields();
339 $action =
'edit_extras';
344if ($action ==
"correct_stock") {
346 if (!empty($product_id)) {
347 $result = $product->fetch($product_id);
352 if (empty($product_id)) {
354 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
355 $action =
'correction';
357 if (!is_numeric(
GETPOST(
"nbpiece"))) {
359 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
360 $action =
'correction';
364 $origin_element =
'';
367 if (
GETPOST(
'projectid',
'int')) {
368 $origin_element =
'project';
369 $origin_id =
GETPOST(
'projectid',
'int');
372 if ($product->hasbatch()) {
373 $batch =
GETPOST(
'batch_number',
'alphanohtml');
380 $result = $product->correct_stock_batch(
385 GETPOST(
"label",
'alphanohtml'),
390 GETPOST(
'inventorycode',
'alphanohtml'),
397 $result = $product->correct_stock(
402 GETPOST(
"label",
'alphanohtml'),
404 GETPOST(
'inventorycode',
'alphanohtml'),
413 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
418 $action =
'correction';
428if ($action ==
"transfert_stock" && !$cancel) {
430 if (!empty($product_id)) {
431 $result = $product->fetch($product_id);
434 if (!(
GETPOST(
"id_entrepot_destination",
'int') > 0)) {
435 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
437 $action =
'transfert';
439 if (empty($product_id)) {
441 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
442 $action =
'transfert';
444 if (!
GETPOST(
"nbpiece",
'int')) {
445 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
447 $action =
'transfert';
449 if ($id ==
GETPOST(
"id_entrepot_destination",
'int')) {
450 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
452 $action =
'transfert';
455 if (isModEnabled(
'productbatch')) {
457 $result = $product->fetch($product_id);
459 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
460 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
462 $action =
'transfert';
469 $result = $object->fetch($id);
473 $product->load_stock(
'novirtual');
477 if (isset($product->pmp)) {
478 $pricesrc = $product->pmp;
480 $pricedest = $pricesrc;
482 if ($product->hasbatch()) {
486 $result = $pdluo->fetch($pdluoid);
488 $srcwarehouseid = $pdluo->warehouseid;
489 $batch = $pdluo->batch;
490 $eatby = $pdluo->eatby;
491 $sellby = $pdluo->sellby;
497 $srcwarehouseid = $id;
498 $batch =
GETPOST(
'batch_number',
'alphanohtml');
505 $result1 = $product->correct_stock_batch(
522 $result2 = $product->correct_stock_batch(
524 GETPOST(
"id_entrepot_destination",
'int'),
532 GETPOST(
'inventorycode',
'alphanohtml'),
541 $result1 = $product->correct_stock(
548 GETPOST(
'inventorycode',
'alphanohtml'),
556 $result2 = $product->correct_stock(
558 GETPOST(
"id_entrepot_destination"),
563 GETPOST(
'inventorycode',
'alphanohtml'),
570 if (!$error && $result1 >= 0 && $result2 >= 0) {
574 header(
"Location: ".$backtopage);
577 header(
"Location: movement_list.php?id=".$object->id);
583 $action =
'transfert';
594$form =
new Form($db);
596if (isModEnabled(
'project')) {
600$productstatic =
new Product($db);
601$warehousestatic =
new Entrepot($db);
603$userstatic =
new User($db);
609$sql =
"SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tosell, p.tobuy, p.tobatch, p.fk_product_type as type, p.entity,";
610$sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
611$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
612$sql .=
" m.batch, m.price,";
613$sql .=
" m.type_mouvement,";
614$sql .=
" m.fk_projet as fk_project,";
615$sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
616$sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
618if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
619 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
620 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
624$parameters = array();
625$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
626$sql .= $hookmanager->resPrint;
627$sql = preg_replace(
'/,\s*$/',
'', $sql);
631$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
632$sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
633$sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
634if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
635 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
637$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
638$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
641$parameters = array();
642$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
643$sql .= $hookmanager->resPrint;
645$sql .=
" WHERE m.fk_product = p.rowid";
647 $sql .=
" AND m.rowid = ".((int) $msid);
649$sql .=
" AND m.fk_entrepot = e.rowid";
650$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
651if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
652 $sql .=
" AND p.fk_product_type = 0";
655 $sql .=
" AND e.rowid = ".((int) $id);
657if (!empty($search_date_start)) {
658 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
660if (!empty($search_date_end)) {
661 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
664 $sql .=
" AND p.rowid = ".((int) $idproduct);
666if (!empty($search_ref)) {
669if (!empty($search_movement)) {
672if (!empty($search_inventorycode)) {
675if (!empty($search_product_ref)) {
678if (!empty($search_product)) {
681if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
684if (!empty($search_user)) {
685 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
687if (!empty($search_batch)) {
690if (!empty($product_id) && $product_id !=
'-1') {
693if (!empty($search_fk_projet) && $search_fk_projet !=
'-1') {
696if ($search_qty !=
'') {
699if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
700 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
703include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
705$parameters = array();
706$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
707$sql .= $hookmanager->resPrint;
710$nbtotalofrecords =
'';
713 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
714 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
715 $resql = $db->query($sqlforcount);
717 $objforcount = $db->fetch_object($resql);
718 $nbtotalofrecords = $objforcount->nbtotalofrecords;
723 if (($page * $limit) > $nbtotalofrecords) {
731$sql .= $db->order($sortfield, $sortorder);
733 $sql .= $db->plimit($limit + 1, $offset);
736$resql = $db->query($sql);
742$num = $db->num_rows($resql);
749 $product->fetch($idproduct);
751if ($id > 0 || $ref) {
752 $result = $object->fetch($id, $ref);
763$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
765 $title = $langs->trans(
'StockMovementForId', $msid);
767 $title = $langs->trans(
"ListOfStockMovements");
769 if (!empty($object->ref)) {
770 $title .=
' ('.$object->ref.
')';
772 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
786if ($object->id > 0) {
789 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
792 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
794 $morehtmlref =
'<div class="refidno">';
795 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$object->lieu;
798 if (isModEnabled(
'project')) {
799 $langs->load(
"projects");
800 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
801 if ($usercancreate && 1 == 2) {
802 if ($action !=
'classify') {
803 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
805 if ($action ==
'classify') {
806 $projectid = $object->fk_project;
807 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
808 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
809 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
810 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
811 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
812 $morehtmlref .=
'</form>';
814 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
817 if (!empty($object->fk_project)) {
819 $proj->fetch($object->fk_project);
820 $morehtmlref .=
' : '.$proj->getNomUrl(1);
822 $morehtmlref .=
' - '.$proj->title;
829 $morehtmlref .=
'</div>';
832 if ($user->socid && !in_array(
'stock', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
836 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
839 print
'<div class="fichecenter">';
840 print
'<div class="fichehalfleft">';
841 print
'<div class="underbanner clearboth"></div>';
843 print
'<table class="border centpercent tableforfield">';
848 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($object->description).
'</td></tr>';
850 $calcproductsunique = $object->nb_different_products();
851 $calcproducts = $object->nb_products();
854 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
855 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
859 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
860 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
861 print empty($valtoshow) ?
'0' : $valtoshow;
867 print
'<div class="fichehalfright">';
868 print
'<div class="underbanner clearboth"></div>';
870 print
'<table class="border centpercent tableforfield">';
873 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
874 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
878 $sql =
"SELECT MAX(m.datem) as datem";
879 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
880 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
881 $resqlbis = $db->query($sql);
883 $objbis = $db->fetch_object($resqlbis);
884 $lastmovementdate = $db->jdate($objbis->datem);
889 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
890 if ($lastmovementdate) {
893 print $langs->trans(
"None");
898 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
901 if (isModEnabled(
'categorie')) {
902 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
903 print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
912 print
'<div class="clearboth"></div>';
919if ($action ==
"correction") {
920 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
925if ($action ==
"transfert") {
926 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
932if ((empty($action) || $action ==
'list') && $id > 0) {
933 print
"<div class=\"tabsAction\">\n";
935 $parameters = array();
936 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
938 if (empty($reshook)) {
939 if ($user->rights->stock->mouvement->creer) {
940 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=correction">'.$langs->trans(
"CorrectStock").
'</a>';
943 if ($user->rights->stock->mouvement->creer) {
944 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=transfert">'.$langs->trans(
"TransferStock").
'</a>';
951$arrayofselected = is_array($toselect) ? $toselect : array();
955 $param .=
'&mode='.urlencode($mode);
957if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
958 $param .=
'&contextpage='.urlencode($contextpage);
960if ($limit > 0 && $limit != $conf->liste_limit) {
961 $param .=
'&limit='.((int) $limit);
964 $param .=
'&id='.urlencode($id);
966if ($search_date_startday) {
967 $param .=
'&search_date_startday='.urlencode($search_date_startday);
969if ($search_date_startmonth) {
970 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
972if ($search_date_startyear) {
973 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
975if ($search_date_endday) {
976 $param .=
'&search_date_endday='.urlencode($search_date_endday);
978if ($search_date_endmonth) {
979 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
981if ($search_date_endyear) {
982 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
984if ($search_movement) {
985 $param .=
'&search_movement='.urlencode($search_movement);
987if ($search_inventorycode) {
988 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
990if ($search_type_mouvement) {
991 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
993if ($search_product_ref) {
994 $param .=
'&search_product_ref='.urlencode($search_product_ref);
996if ($search_product) {
997 $param .=
'&search_product='.urlencode($search_product);
1000 $param .=
'&search_batch='.urlencode($search_batch);
1002if ($search_warehouse > 0) {
1003 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1006 $param .=
'&search_user='.urlencode($search_user);
1008if ($idproduct > 0) {
1009 $param .=
'&idproduct='.urlencode($idproduct);
1012include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1014$parameters = array();
1015$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1016$param .= $hookmanager->resPrint;
1019$arrayofmassactions = array();
1021 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1024if (!empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) {
1025 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1027if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1028 $arrayofmassactions = array();
1030$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1032print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1033if ($optioncss !=
'') {
1034 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1036print
'<input type="hidden" name="token" value="'.newToken().
'">';
1037print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1038print
'<input type="hidden" name="action" value="list">';
1039print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1040print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1041print
'<input type="hidden" name="type" value="'.$type.
'">';
1042print
'<input type="hidden" name="page" value="'.$page.
'">';
1043print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1044print
'<input type="hidden" name="page_y" value="">';
1045print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1047 print
'<input type="hidden" name="id" value="'.$id.
'">';
1054 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1056 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1060$topicmail =
"SendStockMovement";
1061$modelmail =
"movementstock";
1063$trackid =
'mov'.$object->id;
1064include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1068 foreach ($fieldstosearchall as $key => $val) {
1069 $fieldstosearchall[$key] = $langs->trans($val);
1070 $setupstring .= $key.
"=".$val.
";";
1072 print
'<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1073 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
1078$parameters = array(
'arrayfields'=>&$arrayfields);
1079$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1080if (empty($reshook)) {
1081 $moreforfilter .= $hookmanager->resPrint;
1083 $moreforfilter = $hookmanager->resPrint;
1086if (!empty($moreforfilter)) {
1087 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1088 print $moreforfilter;
1092$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1093$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1094$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1096print
'<div class="div-table-responsive">';
1097print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1101print
'<tr class="liste_titre">';
1104 print
'<td class="liste_titre center maxwidthsearch">';
1105 $searchpicto = $form->showFilterButtons(
'left');
1109if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1111 print
'<td class="liste_titre left">';
1112 print
'<input class="flat maxwidth40" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1115if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1117 print
'<td class="liste_titre center">';
1118 print
'<div class="nowrap">';
1119 print $form->selectDate($search_date_start?$search_date_start:-1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1121 print
'<div class="nowrap">';
1122 print $form->selectDate($search_date_end?$search_date_end:-1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1126if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1128 print
'<td class="liste_titre left">';
1129 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1132if (!empty($arrayfields[
'p.label'][
'checked'])) {
1134 print
'<td class="liste_titre left">';
1135 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1139if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1140 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1142if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1143 print
'<td class="liste_titre left">';
1146if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1147 print
'<td class="liste_titre left">';
1151if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1152 print
'<td class="liste_titre maxwidthonsmartphone left">';
1154 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
1157if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1159 print
'<td class="liste_titre left">';
1160 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1163if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1165 print
'<td class="liste_titre left">';
1166 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1169if (!empty($arrayfields[
'm.label'][
'checked'])) {
1171 print
'<td class="liste_titre left">';
1172 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1175if (!empty($arrayfields[
'origin'][
'checked'])) {
1177 print
'<td class="liste_titre left">';
1181if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1183 print
'<td class="liste_titre" align="left">';
1187if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1189 print
'<td class="liste_titre center">';
1191 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1192 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1193 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1194 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1195 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1196 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1203if (!empty($arrayfields[
'm.value'][
'checked'])) {
1205 print
'<td class="liste_titre right">';
1206 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1209if (!empty($arrayfields[
'm.price'][
'checked'])) {
1211 print
'<td class="liste_titre" align="left">';
1217include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1220$parameters = array(
'arrayfields'=>$arrayfields);
1221$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1222print $hookmanager->resPrint;
1224if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1225 print
'<td class="liste_titre">';
1229if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1230 print
'<td class="liste_titre">';
1235 print
'<td class="liste_titre center maxwidthsearch">';
1236 $searchpicto = $form->showFilterButtons();
1242$totalarray = array();
1243$totalarray[
'nbfield'] = 0;
1247print
'<tr class="liste_titre">';
1250 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1251 $totalarray[
'nbfield']++;
1253if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1254 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1256if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1257 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1259if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1260 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1262if (!empty($arrayfields[
'p.label'][
'checked'])) {
1263 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1265if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1266 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1268if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1269 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1271if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1272 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1274if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1276 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1278if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1279 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1281if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1282 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1284if (!empty($arrayfields[
'm.label'][
'checked'])) {
1285 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1287if (!empty($arrayfields[
'origin'][
'checked'])) {
1288 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1290if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1291 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1293if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1294 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1296if (!empty($arrayfields[
'm.value'][
'checked'])) {
1297 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1299if (!empty($arrayfields[
'm.price'][
'checked'])) {
1300 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1304include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1307$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1308$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1309print $hookmanager->resPrint;
1310if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1311 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1313if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1314 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1318 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1319 $totalarray[
'nbfield']++;
1324$arrayofuniqueproduct = array();
1330$savnbfield = $totalarray[
'nbfield'];
1331$totalarray = array();
1332$totalarray[
'nbfield'] = 0;
1333$imaxinloop = ($limit ? min($num, $limit) : $num);
1334while ($i < $imaxinloop) {
1335 $obj = $db->fetch_object($resql);
1340 $userstatic->id = $obj->fk_user_author;
1341 $userstatic->login = $obj->login;
1342 $userstatic->lastname = $obj->lastname;
1343 $userstatic->firstname = $obj->firstname;
1344 $userstatic->photo = $obj->photo;
1345 $userstatic->email = $obj->user_email;
1346 $userstatic->statut = $obj->user_status;
1351 $sql =
"SELECT label";
1352 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1353 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1354 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1357 $result = $db->query($sql);
1359 $objtp = $db->fetch_object($result);
1360 if (!empty($objtp->label)) {
1361 $obj->produit = $objtp->label;
1366 $productstatic->id = $obj->rowid;
1367 $productstatic->ref = $obj->product_ref;
1368 $productstatic->label = $obj->produit;
1369 $productstatic->type = $obj->type;
1370 $productstatic->entity = $obj->entity;
1371 $productstatic->status = $obj->tosell;
1372 $productstatic->status_buy = $obj->tobuy;
1373 $productstatic->status_batch = $obj->tobatch;
1375 $productlot->id = $obj->lotid;
1376 $productlot->batch = $obj->batch;
1377 $productlot->eatby = $obj->eatby;
1378 $productlot->sellby = $obj->sellby;
1380 $warehousestatic->id = $obj->entrepot_id;
1381 $warehousestatic->ref = $obj->warehouse_ref;
1382 $warehousestatic->label = $obj->warehouse_ref;
1383 $warehousestatic->lieu = $obj->lieu;
1384 $warehousestatic->fk_parent = $obj->fk_parent;
1385 $warehousestatic->statut = $obj->statut;
1387 $movement->type = $obj->type_mouvement;
1389 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1390 if (!empty($obj->fk_origin)) {
1391 $origin = $movement->get_origin($obj->fk_origin, $obj->origintype);
1396 if ($mode ==
'kanban') {
1398 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1399 print
'<div class="box-flex-container kanban">';
1402 if ($massactionbutton || $massaction) {
1404 if (in_array($object->id, $arrayofselected)) {
1408 print $object->getKanbanView(
'', array(
'selected' => in_array($warehousestatic->id, $arrayofselected)));
1409 if ($i == ($imaxinloop - 1)) {
1416 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1419 print
'<td class="nowrap center">';
1420 if ($massactionbutton || $massaction) {
1422 if (in_array($obj->mid, $arrayofselected)) {
1425 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1429 $totalarray[
'nbfield']++;
1433 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1434 print
'<td class="nowraponall">';
1435 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
1439 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1441 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1443 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1445 print
'<td class="nowraponall">';
1446 print $productstatic->getNomUrl(1,
'stock', 16);
1449 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1451 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1452 print $productstatic->label;
1455 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1456 print
'<td class="center nowraponall">';
1457 if ($productlot->id > 0) {
1458 print $productlot->getNomUrl(1);
1460 print $productlot->batch;
1464 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1465 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1467 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1468 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1471 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1472 print
'<td class="tdoverflowmax100">';
1473 print $warehousestatic->getNomUrl(1);
1477 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1478 print
'<td class="tdoverflowmax100">';
1479 print $userstatic->getNomUrl(-1);
1482 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1484 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'">'.
dol_escape_htmltag($obj->inventorycode).
'</a></td>';
1486 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1488 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
1490 if (!empty($arrayfields[
'origin'][
'checked'])) {
1492 print
'<td class="nowraponall">'.$origin.
'</td>';
1494 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1497 if ($obj->fk_project != 0) {
1498 print $movement->get_origin($obj->fk_project,
'project');
1502 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1504 print
'<td class="center">';
1505 print $movement->getTypeMovement();
1508 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1510 print
'<td class="right">';
1511 if ($obj->qty > 0) {
1512 print
'<span class="stockmovemententry">';
1517 print
'<span class="stockmovementexit">';
1523 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1525 print
'<td class="right">';
1526 if ($obj->price != 0) {
1527 print
price($obj->price);
1533 $object = $movement;
1534 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1536 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1537 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1538 print $hookmanager->resPrint;
1542 print
'<td class="nowrap center">';
1543 if ($massactionbutton || $massaction) {
1545 if (in_array($obj->mid, $arrayofselected)) {
1548 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1552 $totalarray[
'nbfield']++;
1565 foreach ($arrayfields as $key => $val) {
1566 if (!empty($val[
'checked'])) {
1570 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1575$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1576$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1577print $hookmanager->resPrint;
1579print
'</table>'.
"\n";
1582print
'</form>'.
"\n";
1585if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) {
1588 $productidselected = 0;
1589 foreach ($arrayofuniqueproduct as $key => $val) {
1590 $productidselected = $key;
1591 $productlabelselected = $val;
1593 $datebefore =
dol_get_first_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 1, true);
1594 $dateafter =
dol_get_last_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 12, true);
1595 $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
1596 $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
1599 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1602 print
': '.$balancebefore;
1606 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1609 print
': '.$balanceafter;
1614if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1615 $hidegeneratedfilelistifempty = 1;
1616 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1617 $hidegeneratedfilelistifempty = 0;
1620 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1624 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1625 $urlsource .= str_replace(
'&',
'&', $param);
1627 $filedir = $diroutputmassaction;
1628 $genallowed = $permissiontoread;
1629 $delallowed = $permissiontoadd;
1631 print $formfile->showdocuments(
'massfilesarea_'.$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage warehouses.
Class to manage stock movements.
Class to manage products or services.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage translations.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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...
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
stock_prepare_head($object)
Prepare array with list of tabs.