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);
622 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
623 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
624 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
625 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
626 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
628 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
629 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
630 $sql .=
" WHERE m.fk_product = p.rowid";
632 $sql .=
" AND m.rowid = ".((int) $msid);
634 $sql .=
" AND m.fk_entrepot = e.rowid";
635 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
636 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
637 $sql .=
" AND p.fk_product_type = 0";
640 $sql .=
" AND e.rowid = ".((int) $id);
642 if (!empty($search_date_start)) {
643 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
645 if (!empty($search_date_end)) {
646 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
648 if ($idproduct > 0) {
649 $sql .=
" AND p.rowid = ".((int) $idproduct);
651 if (!empty($search_ref)) {
654 if (!empty($search_movement)) {
657 if (!empty($search_inventorycode)) {
660 if (!empty($search_product_ref)) {
663 if (!empty($search_product)) {
666 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
669 if (!empty($search_user)) {
670 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
672 if (!empty($search_batch)) {
675 if (!empty($product_id) && $product_id !=
'-1') {
678 if (!empty($search_fk_projet) && $search_fk_projet !=
'-1') {
681 if ($search_qty !=
'') {
684 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
685 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
688 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
690 $parameters = array();
691 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
692 $sql .= $hookmanager->resPrint;
720 $nbtotalofrecords =
'';
721 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
732 $sqlforcount = preg_replace(
'/^SELECT[a-z0-9\._\s\(\),]+FROM/i',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
733 $resql = $db->query($sqlforcount);
734 $objforcount = $db->fetch_object(
$resql);
735 $nbtotalofrecords = $objforcount->nbtotalofrecords;
736 if (($page * $limit) > $nbtotalofrecords) {
744 $sql .= $db->order($sortfield, $sortorder);
746 $sql .= $db->plimit($limit + 1, $offset);
749 $resql = $db->query($sql);
758 if ($idproduct > 0) {
759 $product->fetch($idproduct);
761 if ($id > 0 || $ref) {
762 $result = $object->fetch($id, $ref);
768 $num = $db->num_rows(
$resql);
775 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
777 $title = $langs->trans(
'StockMovementForId', $msid);
779 $title = $langs->trans(
"ListOfStockMovements");
781 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
787 $arrayofselected = is_array($toselect) ? $toselect : array();
792 if ($object->id > 0) {
795 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
798 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
800 $morehtmlref =
'<div class="refidno">';
801 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$object->lieu;
804 if (!empty($conf->project->enabled)) {
805 $langs->load(
"projects");
806 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
807 if ($usercancreate && 1 == 2) {
808 if ($action !=
'classify') {
809 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
811 if ($action ==
'classify') {
812 $projectid = $object->fk_project;
813 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
814 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
815 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
816 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
817 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
818 $morehtmlref .=
'</form>';
820 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
823 if (!empty($object->fk_project)) {
825 $proj->fetch($object->fk_project);
826 $morehtmlref .=
' : '.$proj->getNomUrl(1);
828 $morehtmlref .=
' - '.$proj->title;
835 $morehtmlref .=
'</div>';
838 if ($user->socid && !in_array(
'stock', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
842 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
845 print
'<div class="fichecenter">';
846 print
'<div class="fichehalfleft">';
847 print
'<div class="underbanner clearboth"></div>';
849 print
'<table class="border centpercent tableforfield">';
854 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($object->description).
'</td></tr>';
856 $calcproductsunique = $object->nb_different_products();
857 $calcproducts = $object->nb_products();
860 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
861 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
865 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
866 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
867 print empty($valtoshow) ?
'0' : $valtoshow;
873 print
'<div class="fichehalfright">';
874 print
'<div class="underbanner clearboth"></div>';
876 print
'<table class="border centpercent tableforfield">';
879 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
880 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
884 $sql =
"SELECT MAX(m.datem) as datem";
885 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
886 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
887 $resqlbis = $db->query($sql);
889 $objbis = $db->fetch_object($resqlbis);
890 $lastmovementdate = $db->jdate($objbis->datem);
895 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
896 if ($lastmovementdate) {
899 print $langs->trans(
"None");
904 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
908 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
909 print
$form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
918 print
'<div class="clearboth"></div>';
925 if ($action ==
"correction") {
926 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
931 if ($action ==
"transfert") {
932 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
938 if ((empty($action) || $action ==
'list') && $id > 0) {
939 print
"<div class=\"tabsAction\">\n";
941 if ($user->rights->stock->mouvement->creer) {
942 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=correction">'.$langs->trans(
"CorrectStock").
'</a>';
945 if ($user->rights->stock->mouvement->creer) {
946 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=transfert">'.$langs->trans(
"TransferStock").
'</a>';
953 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
954 $param .=
'&contextpage='.urlencode($contextpage);
956 if ($limit > 0 && $limit != $conf->liste_limit) {
957 $param .=
'&limit='.urlencode($limit);
960 $param .=
'&id='.urlencode($id);
962 if ($search_date_startday) {
963 $param .=
'&search_date_startday='.urlencode($search_date_startday);
965 if ($search_date_startmonth) {
966 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
968 if ($search_date_startyear) {
969 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
971 if ($search_date_endday) {
972 $param .=
'&search_date_endday='.urlencode($search_date_endday);
974 if ($search_date_endmonth) {
975 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
977 if ($search_date_endyear) {
978 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
980 if ($search_movement) {
981 $param .=
'&search_movement='.urlencode($search_movement);
983 if ($search_inventorycode) {
984 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
986 if ($search_type_mouvement) {
987 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
989 if ($search_product_ref) {
990 $param .=
'&search_product_ref='.urlencode($search_product_ref);
992 if ($search_product) {
993 $param .=
'&search_product='.urlencode($search_product);
996 $param .=
'&search_batch='.urlencode($search_batch);
998 if ($search_warehouse > 0) {
999 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1002 $param .=
'&search_user='.urlencode($search_user);
1004 if ($idproduct > 0) {
1005 $param .=
'&idproduct='.urlencode($idproduct);
1008 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1011 $arrayofmassactions = array();
1013 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1016 if (!empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) {
1017 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1019 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1020 $arrayofmassactions = array();
1022 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1024 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1025 if ($optioncss !=
'') {
1026 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1028 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1029 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1030 print
'<input type="hidden" name="action" value="list">';
1031 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1032 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1033 print
'<input type="hidden" name="type" value="'.$type.
'">';
1034 print
'<input type="hidden" name="page" value="'.$page.
'">';
1035 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1037 print
'<input type="hidden" name="id" value="'.$id.
'">';
1041 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1043 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1047 $topicmail =
"SendStockMovement";
1048 $modelmail =
"movementstock";
1050 $trackid =
'mov'.$object->id;
1051 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1054 foreach ($fieldstosearchall as $key => $val) {
1055 $fieldstosearchall[$key] = $langs->trans($val);
1057 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1060 $moreforfilter =
'';
1062 $parameters = array(
'arrayfields'=>&$arrayfields);
1063 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
1064 if (empty($reshook)) {
1065 $moreforfilter .= $hookmanager->resPrint;
1067 $moreforfilter = $hookmanager->resPrint;
1070 if (!empty($moreforfilter)) {
1071 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1072 print $moreforfilter;
1076 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1077 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
1078 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1080 print
'<div class="div-table-responsive">';
1081 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1085 print
'<tr class="liste_titre">';
1086 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1088 print
'<td class="liste_titre left">';
1089 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1092 if (! empty($arrayfields[
'm.datem'][
'checked'])) {
1094 print
'<td class="liste_titre center">';
1095 print
'<div class="nowrap">';
1096 print
$form->selectDate($search_date_start?$search_date_start:-1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1098 print
'<div class="nowrap">';
1099 print
$form->selectDate($search_date_end?$search_date_end:-1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1103 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1105 print
'<td class="liste_titre left">';
1106 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1109 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1111 print
'<td class="liste_titre left">';
1112 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1116 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1117 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1119 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1120 print
'<td class="liste_titre left">';
1123 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1124 print
'<td class="liste_titre left">';
1128 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1129 print
'<td class="liste_titre maxwidthonsmartphone left">';
1131 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, null,
'maxwidth200');
1134 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1136 print
'<td class="liste_titre left">';
1137 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1140 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1142 print
'<td class="liste_titre left">';
1143 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1146 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1148 print
'<td class="liste_titre left">';
1149 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1152 if (!empty($arrayfields[
'origin'][
'checked'])) {
1154 print
'<td class="liste_titre left">';
1158 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1160 print
'<td class="liste_titre" align="left">';
1164 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1166 print
'<td class="liste_titre center">';
1168 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1169 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1170 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1171 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1172 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1173 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1180 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1182 print
'<td class="liste_titre right">';
1183 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1186 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1188 print
'<td class="liste_titre" align="left">';
1194 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1197 $parameters = array(
'arrayfields'=>$arrayfields);
1198 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
1199 print $hookmanager->resPrint;
1201 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1202 print
'<td class="liste_titre">';
1206 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1207 print
'<td class="liste_titre">';
1211 print
'<td class="liste_titre maxwidthsearch">';
1212 $searchpicto =
$form->showFilterButtons();
1220 print
'<tr class="liste_titre">';
1221 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1222 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1224 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1225 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1227 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1228 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1230 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1231 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1233 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1234 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1236 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1237 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1239 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1240 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1242 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1244 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1246 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1247 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1249 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1250 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1252 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1253 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1255 if (!empty($arrayfields[
'origin'][
'checked'])) {
1256 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1258 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1259 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1261 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1262 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1264 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1265 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1267 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1268 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1272 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1275 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1276 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1277 print $hookmanager->resPrint;
1278 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1279 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1281 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1282 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1285 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1289 $arrayofuniqueproduct = array();
1295 $totalarray = array();
1296 $totalarray[
'nbfield'] = 0;
1297 while ($i < ($limit ? min($num, $limit) : $num)) {
1298 $obj = $db->fetch_object(
$resql);
1303 $userstatic->id = $obj->fk_user_author;
1304 $userstatic->login = $obj->login;
1305 $userstatic->lastname = $obj->lastname;
1306 $userstatic->firstname = $obj->firstname;
1307 $userstatic->photo = $obj->photo;
1308 $userstatic->email = $obj->user_email;
1309 $userstatic->statut = $obj->user_status;
1312 if (!empty($conf->global->MAIN_MULTILANGS)) {
1314 $sql =
"SELECT label";
1315 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1316 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1317 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1320 $result = $db->query($sql);
1322 $objtp = $db->fetch_object($result);
1323 if (!empty($objtp->label)) {
1324 $obj->produit = $objtp->label;
1329 $productstatic->id = $obj->rowid;
1330 $productstatic->ref = $obj->product_ref;
1331 $productstatic->label = $obj->produit;
1332 $productstatic->type = $obj->type;
1333 $productstatic->entity = $obj->entity;
1334 $productstatic->status = $obj->tosell;
1335 $productstatic->status_buy = $obj->tobuy;
1336 $productstatic->status_batch = $obj->tobatch;
1338 $productlot->id = $obj->lotid;
1339 $productlot->batch = $obj->batch;
1340 $productlot->eatby = $obj->eatby;
1341 $productlot->sellby = $obj->sellby;
1343 $warehousestatic->id = $obj->entrepot_id;
1344 $warehousestatic->ref = $obj->warehouse_ref;
1345 $warehousestatic->label = $obj->warehouse_ref;
1346 $warehousestatic->lieu = $obj->lieu;
1347 $warehousestatic->fk_parent = $obj->fk_parent;
1348 $warehousestatic->statut = $obj->statut;
1350 $movement->type = $obj->type_mouvement;
1352 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1353 if (!empty($obj->fk_origin)) {
1354 $origin = $movement->get_origin($obj->fk_origin, $obj->origintype);
1359 print
'<tr class="oddeven">';
1361 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1363 print
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="pictofixedwidth"');
1367 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1369 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1371 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1373 print
'<td class="nowraponall">';
1374 print $productstatic->getNomUrl(1,
'stock', 16);
1377 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1379 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1380 print $productstatic->label;
1383 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1384 print
'<td class="center nowraponall">';
1385 if ($productlot->id > 0) {
1386 print $productlot->getNomUrl(1);
1388 print $productlot->batch;
1392 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1393 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1395 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1396 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1399 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1400 print
'<td class="tdoverflowmax100">';
1401 print $warehousestatic->getNomUrl(1);
1405 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1406 print
'<td class="tdoverflowmax100">';
1407 print $userstatic->getNomUrl(-1);
1410 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1412 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'&search_type_mouvement='.urlencode($obj->type_mouvement).
'">'.$obj->inventorycode.
'</a></td>';
1414 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1416 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.$obj->label.
'</td>';
1418 if (!empty($arrayfields[
'origin'][
'checked'])) {
1420 print
'<td class="nowraponall">'.$origin.
'</td>';
1422 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1425 if ($obj->fk_project != 0) {
1426 print $movement->get_origin($obj->fk_project,
'project');
1430 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1432 print
'<td class="center">';
1433 print $movement->getTypeMovement();
1436 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1438 print
'<td class="right">';
1439 if ($obj->qty > 0) {
1440 print
'<span class="stockmovemententry">';
1445 print
'<span class="stockmovementexit">';
1451 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1453 print
'<td class="right">';
1454 if ($obj->price != 0) {
1455 print
price($obj->price);
1461 $object = $movement;
1462 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1464 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1465 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1466 print $hookmanager->resPrint;
1469 print
'<td class="nowrap center">';
1470 if ($massactionbutton || $massaction) {
1472 if (in_array($obj->mid, $arrayofselected)) {
1475 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1479 $totalarray[
'nbfield']++;
1494 if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) {
1497 $productidselected = 0;
1498 foreach ($arrayofuniqueproduct as $key => $val) {
1499 $productidselected = $key;
1500 $productlabelselected = $val;
1502 $datebefore =
dol_get_first_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 1,
true);
1503 $dateafter =
dol_get_last_day($year ? $year : strftime(
"%Y", time()), $month ? $month : 12,
true);
1504 $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
1505 $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
1508 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1511 print
': '.$balancebefore;
1515 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1518 print
': '.$balanceafter;
1523 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1524 $hidegeneratedfilelistifempty = 1;
1525 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1526 $hidegeneratedfilelistifempty = 0;
1529 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1533 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1534 $urlsource .= str_replace(
'&',
'&', $param);
1536 $filedir = $diroutputmassaction;
1537 $genallowed = $permissiontoread;
1538 $delallowed = $permissiontoadd;
1540 print $formfile->showdocuments(
'massfilesarea_mymodule',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage stock movements.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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_mkdir($dir, $dataroot= '', $newmask= '')
Creation of a directory (this can create recursive subdir)
Class to manage products or services.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
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...
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage projects.
stock_prepare_head($object)
Prepare array with list of tabs.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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...
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve', $idforemptyvalue= '-1')
Convert a html select field into an ajax combobox.
restrictedArea($user, $features, $objectid=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.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Manage record for batch number management.
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
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.
Class to manage warehouses.