31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43if (isModEnabled(
'project')) {
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49$langs->loadLangs(array(
'products',
'stocks',
'orders'));
50if (isModEnabled(
'productbatch')) {
51 $langs->load(
"productbatch");
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$cancel =
GETPOST(
'cancel',
'alpha');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
59$toselect =
GETPOST(
'toselect',
'array');
60$backtopage =
GETPOST(
"backtopage",
"alpha");
61$optioncss =
GETPOST(
'optioncss',
'aZ');
62$show_files =
GETPOST(
'show_files',
'aZ');
68$idproduct =
GETPOST(
'idproduct',
'intcomma');
69$product_id =
GETPOST(
"product_id",
'intcomma');
72$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
73$search_date_startday =
GETPOSTINT(
'search_date_startday');
74$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
75$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
76$search_date_endday =
GETPOSTINT(
'search_date_endday');
77$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
78$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
81$search_ref =
GETPOST(
'search_ref',
'alpha');
82$search_movement =
GETPOST(
"search_movement");
83$search_product_ref = trim(
GETPOST(
"search_product_ref"));
84$search_product = trim(
GETPOST(
"search_product"));
85$search_warehouse = trim(
GETPOST(
"search_warehouse"));
86$search_inventorycode = trim(
GETPOST(
"search_inventorycode"));
87$search_user = trim(
GETPOST(
"search_user"));
88$search_batch = trim(
GETPOST(
"search_batch"));
89$search_qty = trim(
GETPOST(
"search_qty"));
90$search_type_mouvement =
GETPOST(
'search_type_mouvement');
91$search_fk_project =
GETPOST(
"search_fk_project");
97$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
98$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
100if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
104$offset = $limit * $page;
105$pageprev = $page - 1;
106$pagenext = $page + 1;
109 $sortfield =
"m.datem";
120$diroutputmassaction = $conf->stock->dir_output.
'/temp/massgeneration/'.$user->id;
121$hookmanager->initHooks(array($contextpage));
126$extrafields->fetch_name_optionals_label(
$object->table_element);
128$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
131 'm.rowid' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 1),
132 'm.datem' => array(
'label' =>
"Date",
'checked' => 1,
'position' => 2),
133 'p.ref' => array(
'label' =>
"ProductRef",
'checked' => 1,
'css' =>
'maxwidth100',
'position' => 3),
134 'p.label' => array(
'label' =>
"ProductLabel",
'checked' => 0,
'position' => 5),
135 'm.batch' => array(
'label' =>
"BatchNumberShort",
'checked' => 1,
'position' => 8,
'enabled' => (isModEnabled(
'productbatch'))),
136 'pl.eatby' => array(
'label' =>
"EatByDate",
'checked' => 0,
'position' => 9,
'enabled' => (isModEnabled(
'productbatch'))),
137 'pl.sellby' => array(
'label' =>
"SellByDate",
'checked' => 0,
'position' => 10,
'enabled' => (isModEnabled(
'productbatch'))),
138 'e.ref' => array(
'label' =>
"Warehouse",
'checked' => 1,
'position' => 100,
'enabled' => (!($id > 0))),
139 'm.fk_user_author' => array(
'label' =>
"Author",
'checked' => 0,
'position' => 120),
140 'm.inventorycode' => array(
'label' =>
"InventoryCodeShort",
'checked' => 1,
'position' => 130),
141 'm.label' => array(
'label' =>
"MovementLabel",
'checked' => 1,
'position' => 140),
142 'm.type_mouvement' => array(
'label' =>
"TypeMovement",
'checked' => 0,
'position' => 150),
143 'origin' => array(
'label' =>
"Origin",
'checked' => 1,
'position' => 155),
144 'm.fk_projet' => array(
'label' =>
'Project',
'checked' => 0,
'position' => 180),
145 'm.value' => array(
'label' =>
"Qty",
'checked' => 1,
'position' => 200),
146 'm.price' => array(
'label' =>
"UnitPurchaseValue",
'checked' => 0,
'position' => 210,
'enabled' => (!
getDolGlobalInt(
'STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE')))
151include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
154 unset($arrayfields[
'pl.sellby']);
157 unset($arrayfields[
'pl.eatby']);
162if ($id > 0 || !empty($ref)) {
163 $tmpwarehouse->fetch($id, $ref);
164 $id = $tmpwarehouse->id;
173if (!$user->hasRight(
'stock',
'mouvement',
'lire')) {
177$uploaddir = $conf->stock->dir_output.
'/movements';
179$permissiontoread = $user->hasRight(
'stock',
'mouvement',
'lire');
180$permissiontoadd = $user->hasRight(
'stock',
'mouvement',
'creer');
181$permissiontodelete = $user->hasRight(
'stock',
'mouvement',
'creer');
183$usercanread = $user->hasRight(
'stock',
'mouvement',
'lire');
184$usercancreate = $user->hasRight(
'stock',
'mouvement',
'creer');
185$usercandelete = $user->hasRight(
'stock',
'mouvement',
'creer');
194if (
GETPOST(
'cancel',
'alpha')) {
198if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
202$parameters = array();
203$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
208if (empty($reshook)) {
210 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
213 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
214 $search_date_startday =
'';
215 $search_date_startmonth =
'';
216 $search_date_startyear =
'';
217 $search_date_endday =
'';
218 $search_date_endmonth =
'';
219 $search_date_endyear =
'';
220 $search_date_start =
'';
221 $search_date_end =
'';
223 $search_movement =
"";
224 $search_type_mouvement =
"";
225 $search_inventorycode =
"";
226 $search_product_ref =
"";
227 $search_product =
"";
228 $search_warehouse =
"";
232 $search_fk_project =
"";
235 $search_array_options = array();
237 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
238 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
243 $objectclass =
'MouvementStock';
244 $objectlabel =
'MouvementStock';
246 if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
247 if (empty($diroutputmassaction)) {
248 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
252 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
253 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
254 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
257 $listofobjectid = array();
258 foreach ($toselect as $toselectid) {
260 $result = $objecttmp->fetch($toselectid);
262 $listofobjectid[$toselectid] = $toselectid;
266 $arrayofinclusion = array();
267 foreach ($listofobjectref as $tmppdf) {
270 foreach ($listofobjectref as $tmppdf) {
271 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[a-zA-Z0-9-_]+\.pdf$';
273 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, implode(
'|', $arrayofinclusion),
'\.meta$|\.png',
'date', SORT_DESC, 0,
true);
276 $outputlangs = $langs;
279 $newlang =
GETPOST(
'lang_id',
'aZ09');
284 if (!empty($newlang)) {
286 $outputlangs->setDefaultLang($newlang);
294 $filename = preg_replace(
'/\s/',
'_', $filename);
306 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
315 $langs->load(
"exports");
324 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
327if ($action ==
'update_extras' && $permissiontoadd) {
328 $tmpwarehouse->oldcopy =
dol_clone($tmpwarehouse, 2);
331 $ret = $extrafields->setOptionalsFromPost(
null, $tmpwarehouse,
GETPOST(
'attribute',
'restricthtml'));
336 $result = $tmpwarehouse->insertExtraFields();
343 $action =
'edit_extras';
348if ($action ==
"correct_stock" && $permissiontoadd) {
350 if (!empty($product_id)) {
351 $result = $product->fetch($product_id);
356 if (empty($product_id)) {
358 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
359 $action =
'correction';
361 if (!is_numeric(
GETPOST(
"nbpiece"))) {
363 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
364 $action =
'correction';
368 $origin_element =
'';
372 $origin_element =
'project';
376 if ($product->hasbatch()) {
377 $batch =
GETPOST(
'batch_number',
'alphanohtml');
384 $result = $product->correct_stock_batch(
389 GETPOST(
"label",
'alphanohtml'),
394 GETPOST(
'inventorycode',
'alphanohtml'),
401 $result = $product->correct_stock(
406 GETPOST(
"label",
'alphanohtml'),
408 GETPOST(
'inventorycode',
'alphanohtml'),
417 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
422 $action =
'correction';
432if ($action ==
"transfert_stock" && $permissiontoadd && !$cancel) {
435 if (!empty($product_id)) {
436 $result = $product->fetch($product_id);
439 if (!(
GETPOSTINT(
"id_entrepot_destination") > 0)) {
440 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
442 $action =
'transfert';
444 if (empty($product_id)) {
446 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")),
null,
'errors');
447 $action =
'transfert';
450 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NumberOfUnit")),
null,
'errors');
452 $action =
'transfert';
454 if ($id ==
GETPOSTINT(
"id_entrepot_destination")) {
455 setEventMessages($langs->trans(
"ErrorSrcAndTargetWarehouseMustDiffers"),
null,
'errors');
457 $action =
'transfert';
460 if (isModEnabled(
'productbatch')) {
462 $result = $product->fetch($product_id);
464 if ($product->hasbatch() && !
GETPOST(
"batch_number")) {
465 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"batch_number")),
null,
'errors');
467 $action =
'transfert';
474 $result = $warehouse->fetch($id);
478 $product->load_stock(
'novirtual');
482 if (isset($product->pmp)) {
483 $pricesrc = $product->pmp;
485 $pricedest = $pricesrc;
487 if ($product->hasbatch()) {
491 $result = $pdluo->fetch($pdluoid);
493 $srcwarehouseid = $pdluo->warehouseid;
494 $batch = $pdluo->batch;
495 $eatby = $pdluo->eatby;
496 $sellby = $pdluo->sellby;
502 $srcwarehouseid = $id;
503 $batch =
GETPOST(
'batch_number',
'alphanohtml');
510 $result1 = $product->correct_stock_batch(
527 $result2 = $product->correct_stock_batch(
537 GETPOST(
'inventorycode',
'alphanohtml'),
546 $result1 = $product->correct_stock(
553 GETPOST(
'inventorycode',
'alphanohtml'),
561 $result2 = $product->correct_stock(
563 GETPOST(
"id_entrepot_destination"),
568 GETPOST(
'inventorycode',
'alphanohtml'),
575 if (!$error && $result1 >= 0 && $result2 >= 0) {
579 header(
"Location: ".$backtopage);
582 header(
"Location: movement_list.php?id=".$warehouse->id);
588 $action =
'transfert';
595if ($action ==
'confirm_reverse' && $confirm ==
"yes" && $permissiontoadd) {
596 $toselect = array_map(
'intval', $toselect);
598 $sql =
"SELECT rowid, label, inventorycode, datem";
599 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement";
600 $sql .=
" WHERE rowid IN (";
601 foreach ($toselect as $id) {
602 $sql .= ((int) $id).
",";
604 $sql = rtrim($sql,
',');
607 $resql = $db->query($sql);
609 $num = $db->num_rows($resql);
612 $obj = $db->fetch_object($resql);
614 $reverse =
$object->reverseMouvement();
623 setEventMessages($langs->trans(
"WarningAlreadyReverse", $langs->transnoentities($idAlreadyReverse)),
null,
'warnings');
628 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
637$form =
new Form($db);
639if (isModEnabled(
'project')) {
643$productstatic =
new Product($db);
644$warehousestatic =
new Entrepot($db);
646$userstatic =
new User($db);
652$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,";
653$sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
654$sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
655$sql .=
" m.batch, m.price,";
656$sql .=
" m.type_mouvement,";
657$sql .=
" m.fk_projet as fk_project,";
658$sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
659$sql .=
" u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
661if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
662 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
663 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
667$parameters = array();
668$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
669$sql .= $hookmanager->resPrint;
670$sql = preg_replace(
'/,\s*$/',
'', $sql);
674$sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
675$sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
676$sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
677if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
678 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
680$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
681$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
684$parameters = array();
685$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
686$sql .= $hookmanager->resPrint;
688$sql .=
" WHERE m.fk_product = p.rowid";
690 $sql .=
" AND m.rowid = ".((int) $msid);
692$sql .=
" AND m.fk_entrepot = e.rowid";
693$sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
695 $sql .=
" AND p.fk_product_type = 0";
698 $sql .=
" AND e.rowid = ".((int) $id);
700if (!empty($search_date_start)) {
701 $sql .=
" AND m.datem >= '" . $db->idate($search_date_start) .
"'";
703if (!empty($search_date_end)) {
704 $sql .=
" AND m.datem <= '" . $db->idate($search_date_end) .
"'";
707 $sql .=
" AND p.rowid = ".((int) $idproduct);
709if (!empty($search_ref)) {
712if (!empty($search_movement)) {
715if (!empty($search_inventorycode)) {
718if (!empty($search_product_ref)) {
721if (!empty($search_product)) {
724if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
727if (!empty($search_user)) {
728 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
730if (!empty($search_batch)) {
733if (!empty($product_id) && $product_id !=
'-1') {
736if (!empty($search_fk_project) && $search_fk_project !=
'-1') {
739if ($search_qty !=
'') {
742if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
743 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
746include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
748$parameters = array();
749$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
750$sql .= $hookmanager->resPrint;
753$nbtotalofrecords =
'';
756 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
757 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
758 $resql = $db->query($sqlforcount);
760 $objforcount = $db->fetch_object($resql);
761 $nbtotalofrecords = $objforcount->nbtotalofrecords;
766 if (($page * $limit) > $nbtotalofrecords) {
774$sql .= $db->order($sortfield, $sortorder);
776 $sql .= $db->plimit($limit + 1, $offset);
779$resql = $db->query($sql);
785$num = $db->num_rows($resql);
792 $product->fetch($idproduct);
794if ($id > 0 || $ref) {
795 $result = $warehouse->fetch($id, $ref);
806$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
808 $title = $langs->trans(
'StockMovementForId', $msid);
810 $title = $langs->trans(
"ListOfStockMovements");
812 if (!empty($warehouse->ref)) {
813 $title .=
' ('.$warehouse->ref.
')';
815 $title .=
' ('.$langs->trans(
"ForThisWarehouse").
')';
824llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-product page-stock_movement_list');
829if ($warehouse->id > 0) {
832 print
dol_get_fiche_head($head,
'movements', $langs->trans(
"Warehouse"), -1,
'stock');
835 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
837 $morehtmlref =
'<div class="refidno">';
838 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$warehouse->lieu;
841 if (isModEnabled(
'project')) {
842 $langs->load(
"projects");
843 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
844 if ($usercancreate && 1 == 2) {
845 if ($action !=
'classify') {
846 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$warehouse->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
848 if ($action ==
'classify') {
849 $projectid = $warehouse->fk_project;
850 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id.
'">';
851 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
852 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
853 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
854 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
855 $morehtmlref .=
'</form>';
857 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$warehouse->id, $warehouse->socid, $warehouse->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
860 if (!empty($warehouse->fk_project)) {
862 $proj->fetch($warehouse->fk_project);
863 $morehtmlref .=
' : '.$proj->getNomUrl(1);
865 $morehtmlref .=
' - '.$proj->title;
872 $morehtmlref .=
'</div>';
875 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
879 dol_banner_tab($warehouse,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
882 print
'<div class="fichecenter">';
883 print
'<div class="fichehalfleft">';
884 print
'<div class="underbanner clearboth"></div>';
886 print
'<table class="border centpercent tableforfield">';
891 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($warehouse->description).
'</td></tr>';
893 $calcproductsunique = $warehouse->nb_different_products();
894 $calcproducts = $warehouse->nb_products();
897 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
898 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
902 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
903 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
904 print empty($valtoshow) ?
'0' : $valtoshow;
910 print
'<div class="fichehalfright">';
911 print
'<div class="underbanner clearboth"></div>';
913 print
'<table class="border centpercent tableforfield">';
916 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
917 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
921 $sql =
"SELECT MAX(m.datem) as datem";
922 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
923 $sql .=
" WHERE m.fk_entrepot = ".((int) $warehouse->id);
924 $resqlbis = $db->query($sql);
926 $objbis = $db->fetch_object($resqlbis);
927 $lastmovementdate = $db->jdate($objbis->datem);
932 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
933 if ($lastmovementdate) {
936 print $langs->trans(
"None");
941 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
944 if (isModEnabled(
'category')) {
945 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
946 print $form->showCategories($warehouse->id, Categorie::TYPE_WAREHOUSE, 1);
955 print
'<div class="clearboth"></div>';
962if ($action ==
"correction") {
963 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stockcorrection.tpl.php';
968if ($action ==
"transfert") {
969 include DOL_DOCUMENT_ROOT.
'/product/stock/tpl/stocktransfer.tpl.php';
975if ((empty($action) || $action ==
'list') && $id > 0) {
976 print
"<div class=\"tabsAction\">\n";
978 $parameters = array();
979 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $warehouse, $action);
981 if (empty($reshook)) {
982 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
983 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=transfert&token='.
newToken().
'">'.$langs->trans(
"TransferStock").
'</a>';
986 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
987 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=correction&token='.
newToken().
'">'.$langs->trans(
"CorrectStock").
'</a>';
994$arrayofselected = is_array($toselect) ? $toselect : array();
998 $param .=
'&mode='.urlencode($mode);
1000if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1001 $param .=
'&contextpage='.urlencode($contextpage);
1003if ($limit > 0 && $limit != $conf->liste_limit) {
1004 $param .=
'&limit='.((int) $limit);
1007 $param .=
'&id='.urlencode((
string) ($id));
1010 $param .=
'&show_files='.urlencode((
string) ($show_files));
1012if ($search_date_startday) {
1013 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1015if ($search_date_startmonth) {
1016 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1018if ($search_date_startyear) {
1019 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1021if ($search_date_endday) {
1022 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1024if ($search_date_endmonth) {
1025 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1027if ($search_date_endyear) {
1028 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1030if ($search_movement) {
1031 $param .=
'&search_movement='.urlencode($search_movement);
1033if ($search_inventorycode) {
1034 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
1036if ($search_type_mouvement) {
1037 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
1039if ($search_product_ref) {
1040 $param .=
'&search_product_ref='.urlencode($search_product_ref);
1042if ($search_product) {
1043 $param .=
'&search_product='.urlencode($search_product);
1046 $param .=
'&search_batch='.urlencode($search_batch);
1048if ($search_warehouse > 0) {
1049 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1052 $param .=
'&search_user='.urlencode($search_user);
1054if ($idproduct > 0) {
1055 $param .=
'&idproduct='.urlencode((
string) ($idproduct));
1057if ($search_fk_project !=
'' && $search_fk_project !=
'-1') {
1058 $param .=
'&search_fk_project='.urlencode((
string) ($search_fk_project));
1061include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1063$parameters = array(
'param' => &$param);
1064$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $warehouse, $action);
1065$param .= $hookmanager->resPrint;
1068$arrayofmassactions = array();
1070 $arrayofmassactions[
'builddoc'] =
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"GeneratePDF");
1074 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1076if (!empty($permissiontoadd)) {
1077 $arrayofmassactions[
'prereverse'] =
img_picto(
'',
'add',
'class="pictofixedwidth"').$langs->trans(
"Reverse");
1079if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'prereverse'))) {
1080 $arrayofmassactions = array();
1083$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1085print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1086if ($optioncss !=
'') {
1087 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1089print
'<input type="hidden" name="token" value="'.newToken().
'">';
1090print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1091print
'<input type="hidden" name="action" value="list">';
1092print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1093print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1094print
'<input type="hidden" name="type" value="'.$type.
'">';
1095print
'<input type="hidden" name="page" value="'.$page.
'">';
1096print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1097print
'<input type="hidden" name="page_y" value="">';
1098print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1100 print
'<input type="hidden" name="id" value="'.$id.
'">';
1106print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'movement', 0,
'',
'', $limit, 0, 0, 1);
1109$topicmail =
"SendStockMovement";
1110$modelmail =
"movementstock";
1112$trackid =
'mov'.$warehouse->id;
1113include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1114if ($massaction ==
'prereverse') {
1115 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassReverse"), $langs->trans(
"ConfirmMassReverseQuestion", count($toselect)),
"confirm_reverse",
null,
'', 0, 200, 500, 1,
'Yes');
1121 if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
1123 $fieldstosearchall = array();
1125 foreach ($fieldstosearchall as $key => $val) {
1126 $fieldstosearchall[$key] = $langs->trans($val);
1127 $setupstring .= $key.
"=".$val.
";";
1129 print
'<!-- Search done like if STOCK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1130 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1135$parameters = array(
'arrayfields' => &$arrayfields);
1136$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $warehouse, $action);
1137if (empty($reshook)) {
1138 $moreforfilter .= $hookmanager->resPrint;
1140 $moreforfilter = $hookmanager->resPrint;
1143if (!empty($moreforfilter)) {
1144 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1145 print $moreforfilter;
1149$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1150$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1151$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1152$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1154print
'<div class="div-table-responsive">';
1155print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1159print
'<tr class="liste_titre_filter">';
1162 print
'<td class="liste_titre center maxwidthsearch">';
1163 $searchpicto = $form->showFilterButtons(
'left');
1167if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1169 print
'<td class="liste_titre left">';
1170 print
'<input class="flat maxwidth40" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1173if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1175 print
'<td class="liste_titre center">';
1176 print
'<div class="nowrapfordate">';
1177 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1179 print
'<div class="nowrapfordate">';
1180 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1184if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1186 print
'<td class="liste_titre left">';
1187 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
1190if (!empty($arrayfields[
'p.label'][
'checked'])) {
1192 print
'<td class="liste_titre left">';
1193 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
1197if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1198 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
1200if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1201 print
'<td class="liste_titre left">';
1204if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1205 print
'<td class="liste_titre left">';
1209if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1210 print
'<td class="liste_titre maxwidthonsmartphone left">';
1212 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
1215if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1217 print
'<td class="liste_titre left">';
1218 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
1221if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1223 print
'<td class="liste_titre left">';
1224 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
1227if (!empty($arrayfields[
'm.label'][
'checked'])) {
1229 print
'<td class="liste_titre left">';
1230 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
1233if (!empty($arrayfields[
'origin'][
'checked'])) {
1235 print
'<td class="liste_titre left">';
1239if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1241 print
'<td class="liste_titre" align="left">';
1242 print $warehouse->showInputField($warehouse->fields[
'fk_project'],
'fk_project', $search_fk_project,
'',
'',
'search_',
'maxwidth125', 1);
1245if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1247 print
'<td class="liste_titre center">';
1249 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
1250 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
1251 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
1252 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
1253 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
1254 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
1261if (!empty($arrayfields[
'm.value'][
'checked'])) {
1263 print
'<td class="liste_titre right">';
1264 print
'<input class="flat width50 right" type="text" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
1267if (!empty($arrayfields[
'm.price'][
'checked'])) {
1269 print
'<td class="liste_titre" align="left">';
1275include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1278$parameters = array(
'arrayfields' => $arrayfields);
1279$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $warehouse, $action);
1280print $hookmanager->resPrint;
1282if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1283 print
'<td class="liste_titre">';
1287if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1288 print
'<td class="liste_titre">';
1293 print
'<td class="liste_titre center maxwidthsearch">';
1294 $searchpicto = $form->showFilterButtons();
1300$totalarray = array();
1301$totalarray[
'nbfield'] = 0;
1305print
'<tr class="liste_titre">';
1308 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1309 $totalarray[
'nbfield']++;
1311if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1312 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
1314if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1315 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder,
'center ');
1317if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1318 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1320if (!empty($arrayfields[
'p.label'][
'checked'])) {
1321 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
1323if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1324 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
1326if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1327 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1329if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1330 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
1332if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1334 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
1336if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1337 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
1339if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1340 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
1342if (!empty($arrayfields[
'm.label'][
'checked'])) {
1343 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
1345if (!empty($arrayfields[
'origin'][
'checked'])) {
1346 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
1348if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1349 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
1351if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1352 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
1354if (!empty($arrayfields[
'm.value'][
'checked'])) {
1355 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
1357if (!empty($arrayfields[
'm.price'][
'checked'])) {
1358 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
1362include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1365$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1366$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $warehouse, $action);
1367print $hookmanager->resPrint;
1368if (!empty($arrayfields[
'm.datec'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
'm.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"m.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1371if (!empty($arrayfields[
'm.tms'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'm.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"m.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1376 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1377 $totalarray[
'nbfield']++;
1382$arrayofuniqueproduct = array();
1388$savnbfield = $totalarray[
'nbfield'];
1389$totalarray = array();
1390$totalarray[
'nbfield'] = 0;
1391$imaxinloop = ($limit ? min($num, $limit) : $num);
1392while ($i < $imaxinloop) {
1393 $obj = $db->fetch_object($resql);
1398 $userstatic->id = $obj->fk_user_author;
1399 $userstatic->login = $obj->login;
1400 $userstatic->lastname = $obj->lastname;
1401 $userstatic->firstname = $obj->firstname;
1402 $userstatic->photo = $obj->photo;
1403 $userstatic->email = $obj->user_email;
1404 $userstatic->status = $obj->user_status;
1409 $sql =
"SELECT label";
1410 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1411 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1412 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1415 $result = $db->query($sql);
1417 $objtp = $db->fetch_object($result);
1418 if (!empty($objtp->label)) {
1419 $obj->produit = $objtp->label;
1424 $productstatic->id = $obj->rowid;
1425 $productstatic->ref = $obj->product_ref;
1426 $productstatic->label = $obj->produit;
1427 $productstatic->type = $obj->type;
1428 $productstatic->entity = $obj->entity;
1429 $productstatic->status = $obj->tosell;
1430 $productstatic->status_buy = $obj->tobuy;
1431 $productstatic->status_batch = $obj->tobatch;
1433 $productlot->id = $obj->lotid;
1434 $productlot->batch = $obj->batch;
1435 $productlot->eatby = $obj->eatby;
1436 $productlot->sellby = $obj->sellby;
1438 $warehousestatic->id = $obj->entrepot_id;
1439 $warehousestatic->ref = $obj->warehouse_ref;
1440 $warehousestatic->label = $obj->warehouse_ref;
1441 $warehousestatic->lieu = $obj->lieu;
1442 $warehousestatic->fk_parent = $obj->fk_parent;
1443 $warehousestatic->statut = $obj->statut;
1449 $object->warehouse_id = $obj->entrepot_id;
1450 $object->type = $obj->type_mouvement;
1452 $arrayofuniqueproduct[$obj->rowid] = $obj->produit;
1453 if (!empty($obj->fk_origin)) {
1454 $origin =
$object->get_origin($obj->fk_origin, $obj->origintype);
1459 if ($mode ==
'kanban') {
1461 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1462 print
'<div class="box-flex-container kanban">';
1466 if ($massactionbutton || $massaction) {
1468 if (in_array($warehouse->id, $arrayofselected)) {
1472 print $warehouse->getKanbanView(
'', array(
'selected' => $selected));
1473 if ($i == ($imaxinloop - 1)) {
1480 print
'<tr data-rowid="'.$warehouse->id.
'" class="oddeven">';
1483 print
'<td class="nowrap center">';
1484 if ($massactionbutton || $massaction) {
1486 if (in_array($obj->mid, $arrayofselected)) {
1489 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1493 $totalarray[
'nbfield']++;
1497 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
1498 print
'<td class="nowraponall">';
1505 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
1506 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datem),
'dayhour',
'tzuserrel').
'</td>';
1509 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1510 print
'<td class="nowraponall">';
1511 print $productstatic->getNomUrl(1,
'stock', 16);
1515 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1516 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
1517 print $productstatic->label;
1521 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
1522 print
'<td class="center nowraponall">';
1523 if ($productlot->id > 0) {
1524 print $productlot->getNomUrl(1);
1526 print $productlot->batch;
1531 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
1532 print
'<td class="center">'.dol_print_date($obj->eatby,
'day').
'</td>';
1535 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
1536 print
'<td class="center">'.dol_print_date($obj->sellby,
'day').
'</td>';
1539 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1540 print
'<td class="tdoverflowmax100">';
1541 print $warehousestatic->getNomUrl(1);
1545 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
1546 print
'<td class="tdoverflowmax100">';
1547 print $userstatic->getNomUrl(-1);
1551 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
1552 print
'<td class="tdoverflowmax150" title="'.dolPrintHTML($obj->inventorycode).
'">';
1553 if ($obj->inventorycode) {
1554 print
img_picto(
'',
'movement',
'class="pictofixedwidth"');
1555 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?search_inventorycode='.urlencode(
'^'.$obj->inventorycode.
'$').
'">'.
dol_escape_htmltag($obj->inventorycode).
'</a>';
1560 if (!empty($arrayfields[
'm.label'][
'checked'])) {
1561 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
1564 if (!empty($arrayfields[
'origin'][
'checked'])) {
1565 print
'<td class="nowraponall">'.$origin.
'</td>';
1568 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1570 if ($obj->fk_project != 0) {
1571 print
$object->get_origin($obj->fk_project,
'project');
1576 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
1577 print
'<td class="center">';
1578 print
$object->getTypeMovement();
1582 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1583 print
'<td class="right">';
1584 if ($obj->qty > 0) {
1585 print
'<span class="stockmovemententry">';
1590 print
'<span class="stockmovementexit">';
1597 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1598 print
'<td class="right">';
1599 if ($obj->price != 0) {
1600 print
price($obj->price);
1606 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1608 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1609 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1610 print $hookmanager->resPrint;
1614 print
'<td class="nowrap center">';
1615 if ($massactionbutton || $massaction) {
1617 if (in_array($obj->mid, $arrayofselected)) {
1620 print
'<input id="cb'.$obj->mid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->mid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1624 $totalarray[
'nbfield']++;
1637 foreach ($arrayfields as $key => $val) {
1638 if (!empty($val[
'checked'])) {
1642 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1647$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1648$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1649print $hookmanager->resPrint;
1651print
'</table>'.
"\n";
1654print
'</form>'.
"\n";
1657if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) {
1660 $productidselected = 0;
1661 foreach ($arrayofuniqueproduct as $key => $val) {
1662 $productidselected = $key;
1663 $productlabelselected = $val;
1667 $balancebefore =
$object->calculateBalanceForProductBefore($productidselected, $datebefore);
1668 $balanceafter =
$object->calculateBalanceForProductBefore($productidselected, $dateafter);
1671 print $langs->trans(
"NbOfProductBeforePeriod", $productlabelselected,
dol_print_date($datebefore,
'day',
'gmt'));
1674 print
': '.$balancebefore;
1678 print $langs->trans(
"NbOfProductAfterPeriod", $productlabelselected,
dol_print_date($dateafter,
'day',
'gmt'));
1681 print
': '.$balanceafter;
1686if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1687 $hidegeneratedfilelistifempty = 1;
1688 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1689 $hidegeneratedfilelistifempty = 0;
1692 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1696 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1697 $urlsource .= str_replace(
'&',
'&', $param);
1699 $filedir = $diroutputmassaction;
1700 $genallowed = $permissiontoread;
1701 $delallowed = $permissiontoadd;
1703 print $formfile->showdocuments(
'massfilesarea_stock',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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($utf8_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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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 edit/modify 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.