29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.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.
'/product/stock/class/mouvementstock.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
41 if (!empty($conf->project->enabled)) {
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
47 $langs->loadLangs(array(
'products',
'stocks',
'orders'));
48 if (!empty($conf->productbatch->enabled)) {
49 $langs->load(
"productbatch");
55 $product_id =
GETPOST(
"product_id",
'int');
56 $action =
GETPOST(
'action',
'aZ09');
57 $massaction =
GETPOST(
'massaction',
'alpha');
58 $confirm =
GETPOST(
'confirm',
'alpha');
59 $cancel =
GETPOST(
'cancel',
'alpha');
60 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'movementlist';
61 $toselect =
GETPOST(
'toselect',
'array');
62 $backtopage =
GETPOST(
"backtopage",
"alpha");
64 $idproduct =
GETPOST(
'idproduct',
'int');
65 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
66 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
67 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
68 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
69 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
70 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
71 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
72 $search_date_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_startmonth',
'int'),
GETPOST(
'search_date_startday',
'int'),
GETPOST(
'search_date_startyear',
'int'),
'tzuserrel');
73 $search_date_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_endmonth',
'int'),
GETPOST(
'search_date_endday',
'int'),
GETPOST(
'search_date_endyear',
'int'),
'tzuserrel');
74 $search_ref =
GETPOST(
'search_ref',
'alpha');
75 $search_movement =
GETPOST(
"search_movement");
76 $search_product_ref = trim(
GETPOST(
"search_product_ref"));
77 $search_product = trim(
GETPOST(
"search_product"));
78 $search_warehouse = trim(
GETPOST(
"search_warehouse"));
79 $search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
80 $search_user = trim(
GETPOST(
"search_user"));
81 $search_batch = trim(
GETPOST(
"search_batch"));
82 $search_qty = trim(
GETPOST(
"search_qty"));
83 $search_type_mouvement =
GETPOST(
'search_type_mouvement',
'int');
84 $search_fk_projet=
GETPOST(
"search_fk_projet",
'int');
85 $optioncss =
GETPOST(
'optioncss',
'alpha');
89 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
90 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
91 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
93 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
97 $offset = $limit * $page;
98 $pageprev = $page - 1;
99 $pagenext = $page + 1;
102 $sortfield =
"m.datem";
108 $pdluoid =
GETPOST(
'pdluoid',
'int');
113 $diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
114 $hookmanager->initHooks(array(
'movementlist'));
119 $extrafields->fetch_name_optionals_label($object->table_element);
121 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
123 $arrayfields = array(
124 'm.rowid'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>1),
125 'm.datem'=>array(
'label'=>
"Date",
'checked'=>1,
'position'=>2),
126 'p.ref'=>array(
'label'=>
"ProductRef",
'checked'=>1,
'css'=>
'maxwidth100',
'position'=>3),
127 'p.label'=>array(
'label'=>
"ProductLabel",
'checked'=>0,
'position'=>5),
128 'm.batch'=>array(
'label'=>
"BatchNumberShort",
'checked'=>1,
'position'=>8,
'enabled'=>(!empty($conf->productbatch->enabled))),
129 'pl.eatby'=>array(
'label'=>
"EatByDate",
'checked'=>0,
'position'=>9,
'enabled'=>(!empty($conf->productbatch->enabled))),
130 'pl.sellby'=>array(
'label'=>
"SellByDate",
'checked'=>0,
'position'=>10,
'enabled'=>(!empty($conf->productbatch->enabled))),
131 'e.ref'=>array(
'label'=>
"Warehouse",
'checked'=>1,
'position'=>100,
'enabled'=>(!($id > 0))),
132 'm.fk_user_author'=>array(
'label'=>
"Author",
'checked'=>0,
'position'=>120),
133 'm.inventorycode'=>array(
'label'=>
"InventoryCodeShort",
'checked'=>1,
'position'=>130),
134 'm.label'=>array(
'label'=>
"MovementLabel",
'checked'=>1,
'position'=>140),
135 'm.type_mouvement'=>array(
'label'=>
"TypeMovement",
'checked'=>0,
'position'=>150),
136 'origin'=>array(
'label'=>
"Origin",
'checked'=>1,
'position'=>155),
137 'm.fk_projet'=>array(
'label'=>
'Project',
'checked'=>0,
'position'=>180),
138 'm.value'=>array(
'label'=>
"Qty",
'checked'=>1,
'position'=>200),
139 'm.price'=>array(
'label'=>
"UnitPurchaseValue",
'checked'=>0,
'position'=>210,
'enabled'=>empty($conf->global->STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE))
144 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
146 if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
147 unset($arrayfields[
'pl.sellby']);
149 if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) {
150 unset($arrayfields[
'pl.eatby']);
155 if ($id > 0 || !empty($ref)) {
156 $tmpwarehouse->fetch($id, $ref);
157 $id = $tmpwarehouse->id;
166 if (!$user->rights->stock->mouvement->lire) {
170 $uploaddir = $conf->stock->dir_output.
'/movements';
172 $permissiontoread = $user->rights->stock->mouvement->lire;
173 $permissiontoadd = $user->rights->stock->mouvement->creer;
174 $permissiontodelete = $user->rights->stock->mouvement->creer;
176 $usercanread = $user->rights->stock->mouvement->lire;
177 $usercancreate = $user->rights->stock->mouvement->creer;
178 $usercandelete = $user->rights->stock->mouvement->creer;
187 if (
GETPOST(
'cancel',
'alpha')) {
191 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
195 $parameters = array();
196 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
201 if (empty($reshook)) {
203 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
206 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
207 $search_date_startday =
'';
208 $search_date_startmonth =
'';
209 $search_date_startyear =
'';
210 $search_date_endday =
'';
211 $search_date_endmonth =
'';
212 $search_date_endyear =
'';
213 $search_date_start =
'';
214 $search_date_end =
'';
216 $search_movement =
"";
217 $search_type_mouvement =
"";
218 $search_inventorycode =
"";
219 $search_product_ref =
"";
220 $search_product =
"";
221 $search_warehouse =
"";
228 $search_array_options = array();
230 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
231 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
236 $objectclass =
'MouvementStock';
237 $objectlabel =
'MouvementStock';
239 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
240 if (empty($diroutputmassaction)) {
241 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
245 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
246 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
247 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
249 $objecttmp =
new $objectclass($db);
250 $listofobjectid = array();
251 foreach ($toselect as $toselectid) {
252 $objecttmp =
new $objectclass($db);
253 $result = $objecttmp->fetch($toselectid);
255 $listofobjectid[$toselectid] = $toselectid;
259 $arrayofinclusion = array();
260 foreach ($listofobjectref as $tmppdf) {
263 foreach ($listofobjectref as $tmppdf) {
264 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
266 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0,
true);
269 $outputlangs = $langs;
271 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
272 $newlang =
GETPOST(
'lang_id',
'aZ09');
277 if (!empty($newlang)) {
279 $outputlangs->setDefaultLang($newlang);
287 $filename = preg_replace(
'/\s/',
'_', $filename);
299 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
308 $langs->load(
"exports");
316 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
319 if ($action ==
'update_extras') {
320 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse);
323 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse,
GETPOST(
'attribute',
'restricthtml'));
328 $result = $tmpwarehouse->insertExtraFields();
335 $action =
'edit_extras';
340 if ($action ==
"correct_stock") {
342 if (!empty($product_id)) {
343 $result = $product->fetch($product_id);
348 if (empty($product_id)) {
350 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
351 $action =
'correction';
353 if (!is_numeric(
GETPOST(
"nbpiece"))) {
355 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
356 $action =
'correction';
360 $origin_element =
'';
363 if (
GETPOST(
'projectid',
'int')) {
364 $origin_element =
'project';
365 $origin_id =
GETPOST(
'projectid',
'int');
368 if ($product->hasbatch()) {
369 $batch =
GETPOST(
'batch_number',
'alphanohtml');
376 $result = $product->correct_stock_batch(
381 GETPOST(
"label",
'alphanohtml'),
386 GETPOST(
'inventorycode',
'alphanohtml'),
393 $result = $product->correct_stock(
398 GETPOST(
"label",
'alphanohtml'),
400 GETPOST(
'inventorycode',
'alphanohtml'),
409 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
414 $action =
'correction';
424 if ($action ==
"transfert_stock" && !$cancel) {
426 if (!empty($product_id)) {
427 $result = $product->fetch($product_id);
430 if (!(
GETPOST(
"id_entrepot_destination",
'int') > 0)) {
431 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
433 $action =
'transfert';
435 if (empty($product_id)) {
437 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
438 $action =
'transfert';
440 if (!
GETPOST(
"nbpiece",
'int')) {
441 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
443 $action =
'transfert';
445 if ($id ==
GETPOST(
"id_entrepot_destination",
'int')) {
446 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
448 $action =
'transfert';
451 if (!empty($conf->productbatch->enabled)) {
453 $result = $product->fetch($product_id);
455 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
456 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
458 $action =
'transfert';
465 $result = $object->fetch($id);
469 $product->load_stock(
'novirtual');
473 if (isset($product->pmp)) {
474 $pricesrc = $product->pmp;
476 $pricedest = $pricesrc;
478 if ($product->hasbatch()) {
482 $result = $pdluo->fetch($pdluoid);
484 $srcwarehouseid = $pdluo->warehouseid;
485 $batch = $pdluo->batch;
486 $eatby = $pdluo->eatby;
487 $sellby = $pdluo->sellby;
493 $srcwarehouseid = $id;
494 $batch =
GETPOST(
'batch_number',
'alphanohtml');
501 $result1 = $product->correct_stock_batch(
518 $result2 = $product->correct_stock_batch(
520 GETPOST(
"id_entrepot_destination",
'int'),
528 GETPOST(
'inventorycode',
'alphanohtml'),
537 $result1 = $product->correct_stock(
544 GETPOST(
'inventorycode',
'alphanohtml'),
552 $result2 = $product->correct_stock(
554 GETPOST(
"id_entrepot_destination"),
559 GETPOST(
'inventorycode',
'alphanohtml'),
566 if (!$error && $result1 >= 0 && $result2 >= 0) {
570 header(
"Location: ".$backtopage);
573 header(
"Location: movement_list.php?id=".$object->id);
579 $action =
'transfert';
590 $productlot =
new ProductLot($db);
591 $productstatic =
new Product($db);
592 $warehousestatic =
new Entrepot($db);
594 $userstatic =
new User($db);
597 if (!empty($conf->project->enabled)) {
603 $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,";
604 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
605 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
606 $sql .=
" m.batch, m.price,";
607 $sql .=
" m.type_mouvement,";
608 $sql .=
" m.fk_projet as fk_project,";
609 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
610 $sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
612 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
613 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
614 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
618 $parameters = array();
619 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
620 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
621 $sql = preg_replace(
'/,\s*$/',
'', $sql);
625 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
626 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
627 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
628 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
629 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
631 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
632 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
633 $sql .=
" WHERE m.fk_product = p.rowid";
635 $sql .=
" AND m.rowid = ".((int) $msid);
637 $sql .=
" AND m.fk_entrepot = e.rowid";
638 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
639 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
640 $sql .=
" AND p.fk_product_type = 0";
643 $sql .=
" AND e.rowid = ".((int) $id);
645 if (!empty($search_date_start)) {
646 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
648 if (!empty($search_date_end)) {
649 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
651 if ($idproduct > 0) {
652 $sql .=
" AND p.rowid = ".((int) $idproduct);
654 if (!empty($search_ref)) {
657 if (!empty($search_movement)) {
660 if (!empty($search_inventorycode)) {
663 if (!empty($search_product_ref)) {
666 if (!empty($search_product)) {
669 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
672 if (!empty($search_user)) {
673 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
675 if (!empty($search_batch)) {
678 if (!empty($product_id) && $product_id !=
'-1') {
681 if (!empty($search_fk_projet) && $search_fk_projet !=
'-1') {
684 if ($search_qty !=
'') {
687 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
688 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
691 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
693 $parameters = array();
694 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
695 $sql .= $hookmanager->resPrint;
723 $nbtotalofrecords =
'';
724 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
735 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
736 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
737 $resql = $db->query($sqlforcount);
741 $objforcount = $db->fetch_object(
$resql);
742 $nbtotalofrecords = $objforcount->nbtotalofrecords;
743 if (($page * $limit) > $nbtotalofrecords) {
752 $sql .= $db->order($sortfield, $sortorder);
754 $sql .= $db->plimit($limit + 1, $offset);
757 $resql = $db->query($sql);
766 if ($idproduct > 0) {
767 $product->fetch($idproduct);
769 if ($id > 0 || $ref) {
770 $result = $object->fetch($id, $ref);
776 $num = $db->num_rows(
$resql);
783 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
785 $title = $langs->trans(
'StockMovementForId', $msid);
787 $title = $langs->trans(
"ListOfStockMovements");
789 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
795 $arrayofselected = is_array($toselect) ? $toselect : array();
800 if ($object->id > 0) {
803 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
806 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
808 $morehtmlref =
'<div class="refidno">';
809 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$object->lieu;
812 if (!empty($conf->project->enabled)) {
813 $langs->load(
"projects");
814 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
815 if ($usercancreate && 1 == 2) {
816 if ($action !=
'classify') {
817 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
819 if ($action ==
'classify') {
820 $projectid = $object->fk_project;
821 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
822 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
823 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
824 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
825 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
826 $morehtmlref .=
'</form>';
828 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
831 if (!empty($object->fk_project)) {
833 $proj->fetch($object->fk_project);
834 $morehtmlref .=
' : '.$proj->getNomUrl(1);
836 $morehtmlref .=
' - '.$proj->title;
843 $morehtmlref .=
'</div>';
846 if ($user->socid && !in_array(
'stock', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
850 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
853 print
'<div class="fichecenter">';
854 print
'<div class="fichehalfleft">';
855 print
'<div class="underbanner clearboth"></div>';
857 print
'<table class="border centpercent tableforfield">';
862 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($object->description).
'</td></tr>';
864 $calcproductsunique = $object->nb_different_products();
865 $calcproducts = $object->nb_products();
868 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
869 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
873 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
874 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
875 print empty($valtoshow) ?
'0' : $valtoshow;
881 print
'<div class="fichehalfright">';
882 print
'<div class="underbanner clearboth"></div>';
884 print
'<table class="border centpercent tableforfield">';
887 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
888 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
892 $sql =
"SELECT MAX(m.datem) as datem";
893 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
894 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
895 $resqlbis = $db->query($sql);
897 $objbis = $db->fetch_object($resqlbis);
898 $lastmovementdate = $db->jdate($objbis->datem);
903 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
904 if ($lastmovementdate) {
907 print $langs->trans(
"None");
912 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
916 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
917 print
$form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
926 print
'<div class="clearboth"></div>';
933 if ($action ==
"correction") {
934 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
939 if ($action ==
"transfert") {
940 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
946 if ((empty($action) || $action ==
'list') && $id > 0) {
947 print
"<div class=\"tabsAction\">\n";
949 if ($user->rights->stock->mouvement->creer) {
950 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=correction">'.$langs->trans(
"CorrectStock").
'</a>';
953 if ($user->rights->stock->mouvement->creer) {
954 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=transfert">'.$langs->trans(
"TransferStock").
'</a>';
961 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
962 $param .=
'&contextpage='.urlencode($contextpage);
964 if ($limit > 0 && $limit != $conf->liste_limit) {
965 $param .=
'&limit='.urlencode($limit);
968 $param .=
'&id='.urlencode($id);
970 if ($search_date_startday) {
971 $param .=
'&search_date_startday='.urlencode($search_date_startday);
973 if ($search_date_startmonth) {
974 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
976 if ($search_date_startyear) {
977 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
979 if ($search_date_endday) {
980 $param .=
'&search_date_endday='.urlencode($search_date_endday);
982 if ($search_date_endmonth) {
983 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
985 if ($search_date_endyear) {
986 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
988 if ($search_movement) {
989 $param .=
'&search_movement='.urlencode($search_movement);
991 if ($search_inventorycode) {
992 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
994 if ($search_type_mouvement) {
995 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
997 if ($search_product_ref) {
998 $param .=
'&search_product_ref='.urlencode($search_product_ref);
1000 if ($search_product) {
1001 $param .=
'&search_product='.urlencode($search_product);
1003 if ($search_batch) {
1004 $param .=
'&search_batch='.urlencode($search_batch);
1006 if ($search_warehouse > 0) {
1007 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1010 $param .=
'&search_user='.urlencode($search_user);
1012 if ($idproduct > 0) {
1013 $param .=
'&idproduct='.urlencode($idproduct);
1016 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1019 $arrayofmassactions = array();
1021 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1024 if (!empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) {
1025 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1027 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1028 $arrayofmassactions = array();
1030 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1032 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1033 if ($optioncss !=
'') {
1034 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1036 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1037 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1038 print
'<input type="hidden" name="action" value="list">';
1039 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1040 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1041 print
'<input type="hidden" name="type" value="'.$type.
'">';
1042 print
'<input type="hidden" name="page" value="'.$page.
'">';
1043 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1045 print
'<input type="hidden" name="id" value="'.$id.
'">';
1049 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1051 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1055 $topicmail =
"SendStockMovement";
1056 $modelmail =
"movementstock";
1058 $trackid =
'mov'.$object->id;
1059 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1062 foreach ($fieldstosearchall as $key => $val) {
1063 $fieldstosearchall[$key] = $langs->trans($val);
1065 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1068 $moreforfilter =
'';
1070 $parameters = array(
'arrayfields'=>&$arrayfields);
1071 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
1072 if (empty($reshook)) {
1073 $moreforfilter .= $hookmanager->resPrint;
1075 $moreforfilter = $hookmanager->resPrint;
1078 if (!empty($moreforfilter)) {
1079 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1080 print $moreforfilter;
1084 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1085 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
1086 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1088 print
'<div class="div-table-responsive">';
1089 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1093 print
'<tr class="liste_titre">';
1094 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1096 print
'<td class="liste_titre left">';
1097 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1100 if (! empty($arrayfields[
'm.datem'][
'checked'])) {
1102 print
'<td class="liste_titre center">';
1103 print
'<div class="nowrap">';
1104 print
$form->selectDate($search_date_start?$search_date_start:-1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1106 print
'<div class="nowrap">';
1107 print
$form->selectDate($search_date_end?$search_date_end:-1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1111 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1113 print
'<td class="liste_titre left">';
1114 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1117 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1119 print
'<td class="liste_titre left">';
1120 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1124 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1125 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1127 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1128 print
'<td class="liste_titre left">';
1131 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1132 print
'<td class="liste_titre left">';
1136 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1137 print
'<td class="liste_titre maxwidthonsmartphone left">';
1139 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
1142 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1144 print
'<td class="liste_titre left">';
1145 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1148 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1150 print
'<td class="liste_titre left">';
1151 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1154 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1156 print
'<td class="liste_titre left">';
1157 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1160 if (!empty($arrayfields[
'origin'][
'checked'])) {
1162 print
'<td class="liste_titre left">';
1166 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1168 print
'<td class="liste_titre" align="left">';
1172 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1174 print
'<td class="liste_titre center">';
1176 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1177 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1178 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1179 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1180 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1181 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1188 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1190 print
'<td class="liste_titre right">';
1191 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1194 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1196 print
'<td class="liste_titre" align="left">';
1202 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1205 $parameters = array(
'arrayfields'=>$arrayfields);
1206 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
1207 print $hookmanager->resPrint;
1209 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1210 print
'<td class="liste_titre">';
1214 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1215 print
'<td class="liste_titre">';
1219 print
'<td class="liste_titre maxwidthsearch">';
1220 $searchpicto =
$form->showFilterButtons();
1228 print
'<tr class="liste_titre">';
1229 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1230 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1232 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1233 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1235 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1236 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1238 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1239 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1241 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1242 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1244 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1245 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1247 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1248 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1250 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1252 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1254 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1255 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1257 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1258 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1260 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1261 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1263 if (!empty($arrayfields[
'origin'][
'checked'])) {
1264 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1266 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1267 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1269 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1270 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1272 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1273 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1275 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1276 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1280 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1283 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1284 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1285 print $hookmanager->resPrint;
1286 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1287 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1289 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1290 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1293 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1297 $arrayofuniqueproduct = array();
1303 $totalarray = array();
1304 $totalarray[
'nbfield'] = 0;
1305 while ($i < ($limit ? min($num, $limit) : $num)) {
1306 $obj = $db->fetch_object(
$resql);
1311 $userstatic->id = $obj->fk_user_author;
1312 $userstatic->login = $obj->login;
1313 $userstatic->lastname = $obj->lastname;
1314 $userstatic->firstname = $obj->firstname;
1315 $userstatic->photo = $obj->photo;
1316 $userstatic->email = $obj->user_email;
1317 $userstatic->statut = $obj->user_status;
1320 if (!empty($conf->global->MAIN_MULTILANGS)) {
1322 $sql =
"SELECT label";
1323 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1324 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1325 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1328 $result = $db->query($sql);
1330 $objtp = $db->fetch_object($result);
1331 if (!empty($objtp->label)) {
1332 $obj->produit = $objtp->label;
1337 $productstatic->id = $obj->rowid;
1338 $productstatic->ref = $obj->product_ref;
1339 $productstatic->label = $obj->produit;
1340 $productstatic->type = $obj->type;
1341 $productstatic->entity = $obj->entity;
1342 $productstatic->status = $obj->tosell;
1343 $productstatic->status_buy = $obj->tobuy;
1344 $productstatic->status_batch = $obj->tobatch;
1346 $productlot->id = $obj->lotid;
1347 $productlot->batch = $obj->batch;
1348 $productlot->eatby = $obj->eatby;
1349 $productlot->sellby = $obj->sellby;
1351 $warehousestatic->id = $obj->entrepot_id;
1352 $warehousestatic->ref = $obj->warehouse_ref;
1353 $warehousestatic->label = $obj->warehouse_ref;
1354 $warehousestatic->lieu = $obj->lieu;
1355 $warehousestatic->fk_parent = $obj->fk_parent;
1356 $warehousestatic->statut = $obj->statut;
1358 $movement->type = $obj->type_mouvement;
1360 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1361 if (!empty($obj->fk_origin)) {
1362 $origin = $movement->get_origin($obj->fk_origin, $obj->origintype);
1367 print
'<tr class="oddeven">';
1369 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1371 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
1375 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1377 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1379 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1381 print
'<td class="nowraponall">';
1382 print $productstatic->getNomUrl(1,
'stock', 16);
1385 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1387 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1388 print $productstatic->label;
1391 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1392 print
'<td class="center nowraponall">';
1393 if ($productlot->id > 0) {
1394 print $productlot->getNomUrl(1);
1396 print $productlot->batch;
1400 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1401 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1403 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1404 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1407 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1408 print
'<td class="tdoverflowmax100">';
1409 print $warehousestatic->getNomUrl(1);
1413 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1414 print
'<td class="tdoverflowmax100">';
1415 print $userstatic->getNomUrl(-1);
1418 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1420 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'&search_type_mouvement='.urlencode($obj->type_mouvement).
'">'.$obj->inventorycode.
'</a></td>';
1422 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1424 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.$obj->label.
'</td>';
1426 if (!empty($arrayfields[
'origin'][
'checked'])) {
1428 print
'<td class="nowraponall">'.$origin.
'</td>';
1430 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1433 if ($obj->fk_project != 0) {
1434 print $movement->get_origin($obj->fk_project,
'project');
1438 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1440 print
'<td class="center">';
1441 print $movement->getTypeMovement();
1444 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1446 print
'<td class="right">';
1447 if ($obj->qty > 0) {
1448 print
'<span class="stockmovemententry">';
1453 print
'<span class="stockmovementexit">';
1459 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1461 print
'<td class="right">';
1462 if ($obj->price != 0) {
1463 print
price($obj->price);
1469 $object = $movement;
1470 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1472 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1473 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1474 print $hookmanager->resPrint;
1477 print
'<td class="nowrap center">';
1478 if ($massactionbutton || $massaction) {
1480 if (in_array($obj->mid, $arrayofselected)) {
1483 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1487 $totalarray[
'nbfield']++;
1502 if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) {
1505 $productidselected = 0;
1506 foreach ($arrayofuniqueproduct as $key => $val) {
1507 $productidselected = $key;
1508 $productlabelselected = $val;
1510 $datebefore =
dol_get_first_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 1,
true);
1511 $dateafter =
dol_get_last_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 12,
true);
1512 $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
1513 $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
1516 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1519 print
': '.$balancebefore;
1523 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1526 print
': '.$balanceafter;
1531 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1532 $hidegeneratedfilelistifempty = 1;
1533 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1534 $hidegeneratedfilelistifempty = 0;
1537 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1541 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1542 $urlsource .= str_replace(
'&',
'&', $param);
1544 $filedir = $diroutputmassaction;
1545 $genallowed = $permissiontoread;
1546 $delallowed = $permissiontoadd;
1548 print $formfile->showdocuments(
'massfilesarea_mymodule',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);