25 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.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';
39 $langs->loadLangs(array(
"mrp",
"stocks",
"other"));
44 $action =
GETPOST(
'action',
'aZ09');
45 $confirm =
GETPOST(
'confirm',
'alpha');
46 $cancel =
GETPOST(
'cancel',
'aZ09');
47 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mostockmovement';
48 $backtopage =
GETPOST(
'backtopage',
'alpha');
53 $month =
GETPOST(
"month",
'int');
54 $search_ref =
GETPOST(
'search_ref',
'alpha');
55 $search_movement =
GETPOST(
"search_movement",
'alpha');
56 $search_product_ref = trim(
GETPOST(
"search_product_ref",
'alpha'));
57 $search_product = trim(
GETPOST(
"search_product",
'alpha'));
58 $search_warehouse = trim(
GETPOST(
"search_warehouse",
'alpha'));
59 $search_inventorycode = trim(
GETPOST(
"search_inventorycode",
'alpha'));
60 $search_user = trim(
GETPOST(
"search_user",
'alpha'));
61 $search_batch = trim(
GETPOST(
"search_batch",
'alpha'));
62 $search_qty = trim(
GETPOST(
"search_qty",
'alpha'));
63 $search_type_mouvement =
GETPOST(
'search_type_mouvement',
'int');
65 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
67 $sortfield =
GETPOST(
"sortfield",
'alpha');
68 $sortorder =
GETPOST(
"sortorder",
'alpha');
69 if (empty($page) || $page == -1) { $page = 0; }
70 $offset = $limit * $page;
71 if (!$sortfield) $sortfield =
"m.datem";
72 if (!$sortorder) $sortorder =
"DESC";
75 $object =
new Mo($db);
77 $diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
78 $hookmanager->initHooks(array(
'mocard',
'globalcard'));
81 $extrafields->fetch_name_optionals_label($object->table_element);
83 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
86 $search_all = trim(
GETPOST(
"search_all",
'alpha'));
88 foreach ($object->fields as $key => $val)
90 if (
GETPOST(
'search_'.$key,
'alpha')) $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
93 if (empty($action) && empty($id) && empty($ref)) $action =
'view';
96 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
101 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
102 $result =
restrictedArea($user,
'mrp', $object->id,
'mrp_mo',
'',
'fk_soc',
'rowid', $isdraft);
107 $arrayfields = array(
108 'm.rowid'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1,
'position'=>1),
109 'm.datem'=>array(
'label'=>$langs->trans(
"Date"),
'checked'=>1,
'position'=>2),
110 'p.ref'=>array(
'label'=>$langs->trans(
"ProductRef"),
'checked'=>1,
'css'=>
'maxwidth100',
'position'=>10),
111 'p.label'=>array(
'label'=>$langs->trans(
"ProductLabel"),
'checked'=>1,
'position'=>15),
112 'm.batch'=>array(
'label'=>$langs->trans(
"BatchNumberShort"),
'checked'=>1,
'enabled'=>(!empty($conf->productbatch->enabled)),
'position'=>20),
113 'pl.eatby'=>array(
'label'=>$langs->trans(
"EatByDate"),
'checked'=>0,
'position'=>10,
'enabled'=>(!empty($conf->productbatch->enabled)),
'position'=>21),
114 'pl.sellby'=>array(
'label'=>$langs->trans(
"SellByDate"),
'checked'=>0,
'position'=>10,
'enabled'=>(!empty($conf->productbatch->enabled)),
'position'=>22),
115 'e.ref'=>array(
'label'=>$langs->trans(
"Warehouse"),
'checked'=>1,
'position'=>30),
116 'm.fk_user_author'=>array(
'label'=>$langs->trans(
"Author"),
'checked'=>0,
'position'=>40),
117 'm.inventorycode'=>array(
'label'=>$langs->trans(
"InventoryCodeShort"),
'checked'=>1,
'position'=>42),
118 'm.label'=>array(
'label'=>$langs->trans(
"MovementLabel"),
'checked'=>1,
'position'=>45),
119 'm.type_mouvement'=>array(
'label'=>$langs->trans(
"TypeMovement"),
'checked'=>1,
'position'=>48),
120 'origin'=>array(
'label'=>$langs->trans(
"Origin"),
'enabled'=>0,
'checked'=>0,
'position'=>50),
121 'm.value'=>array(
'label'=>$langs->trans(
"Qty"),
'checked'=>1,
'position'=>60),
122 'm.price'=>array(
'label'=>$langs->trans(
"UnitPurchaseValue"),
'enabled'=>0,
'checked'=>0,
'position'=>62),
126 if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) {
127 unset($arrayfields[
'pl.eatby']);
129 if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
130 unset($arrayfields[
'pl.sellby']);
132 $objectlist->fields =
dol_sort_array($objectlist->fields,
'position');
135 $permissionnote = $user->rights->mrp->write;
136 $permissiondellink = $user->rights->mrp->write;
137 $permissiontoadd = $user->rights->mrp->write;
138 $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
139 $upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
141 $permissiontoproduce = $permissiontoadd;
148 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
149 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') { $massaction =
''; }
151 $parameters = array();
152 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
153 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
155 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
158 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
163 $search_movement =
"";
164 $search_type_mouvement =
"";
165 $search_inventorycode =
"";
166 $search_product_ref =
"";
167 $search_product =
"";
168 $search_warehouse =
"";
174 $search_array_options = array();
183 if (empty($backtopage) || ($cancel && empty($id))) {
185 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) $backtopage = $backurlforlist;
186 else $backtopage = DOL_URL_ROOT.
'/mrp/mo_production.php?id='.($id > 0 ? $id :
'__ID__');
188 $triggermodname =
'MRP_MO_MODIFY';
191 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
194 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
197 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
200 $triggersendname =
'MO_SENTBYMAIL';
201 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
202 $trackid =
'mo'.$object->id;
203 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
208 if ($action ==
'set_thirdparty' && $permissiontoadd)
210 $object->setValueFrom(
'fk_soc',
GETPOST(
'fk_soc',
'int'),
'',
'',
'date',
'', $user,
'MO_MODIFY');
212 if ($action ==
'classin' && $permissiontoadd)
214 $object->setProject(
GETPOST(
'projectid',
'int'));
217 if ($action ==
'confirm_reopen') {
218 $result = $object->setStatut($object::STATUS_INPROGRESS, 0,
'',
'MRP_REOPEN');
228 $form =
new Form($db);
231 $productstatic =
new Product($db);
232 $productlot =
new ProductLot($db);
233 $warehousestatic =
new Entrepot($db);
234 $userstatic =
new User($db);
239 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create')))
241 $res = $object->fetch_thirdparty();
242 $res = $object->fetch_optionals();
251 if ($action ==
'delete')
253 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete',
'', 0, 1);
256 if ($action ==
'deleteline')
258 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
261 if ($action ==
'clone') {
263 $formquestion = array();
264 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
268 if ($action ==
'xxx')
270 $formquestion = array();
281 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
285 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
286 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
287 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
288 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
296 $linkback = '<a href="'.
dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
298 $morehtmlref = '<div class="refidno">';
304 $morehtmlref .= $langs->trans('ThirdParty').' : '.(is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
306 if (!empty($conf->projet->enabled))
308 $langs->load(
"projects");
309 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
310 if ($permissiontoadd)
312 if ($action !=
'classify')
313 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
314 if ($action ==
'classify') {
316 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
317 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
318 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
319 $morehtmlref .= $formproject->select_projects($object->fk_soc, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
320 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
321 $morehtmlref .=
'</form>';
323 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_soc, $object->fk_project,
'none', 0, 0, 0, 1);
326 if (!empty($object->fk_project)) {
328 $proj->fetch($object->fk_project);
329 $morehtmlref .= $proj->getNomUrl();
335 $morehtmlref .=
'</div>';
338 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
341 print '<div class="fichecenter">';
342 print '<div class="fichehalfleft">';
343 print '<div class="underbanner clearboth"></div>';
344 print '<table class="border centpercent tableforfield">'.
"\n";
347 $keyforbreak =
'fk_warehouse';
348 unset($object->fields[
'fk_project']);
349 unset($object->fields[
'fk_soc']);
350 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
353 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
359 print '<div class="clearboth"></div>';
397 $sql =
"SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
398 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu,";
399 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
400 $sql .=
" m.batch, m.price,";
401 $sql .=
" m.type_mouvement,";
402 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
403 $sql .=
" u.login, u.photo, u.lastname, u.firstname";
405 if (!empty($extrafields->attributes[$objectlist->table_element][
'label'])) {
406 foreach ($extrafields->attributes[$objectlist->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$objectlist->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
409 $parameters = array();
410 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
411 $sql .= $hookmanager->resPrint;
412 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
413 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
414 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
415 if (is_array($extrafields->attributes[$objectlist->table_element][
'label']) && count($extrafields->attributes[$objectlist->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$objectlist->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
416 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
417 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
418 $sql .=
" WHERE m.fk_product = p.rowid";
419 $sql .=
" AND m.origintype = 'mo' AND m.fk_origin = ".(int) $object->id;
420 if ($msid > 0) $sql .=
" AND m.rowid = ".$msid;
421 $sql .=
" AND m.fk_entrepot = e.rowid";
422 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
423 if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .=
" AND p.fk_product_type = 0";
425 if (!empty($search_ref)) $sql .=
natural_search(
'm.rowid', $search_ref, 1);
426 if (!empty($search_movement)) $sql .=
natural_search(
'm.label', $search_movement);
427 if (!empty($search_inventorycode)) $sql .=
natural_search(
'm.inventorycode', $search_inventorycode);
428 if (!empty($search_product_ref)) $sql .=
natural_search(
'p.ref', $search_product_ref);
429 if (!empty($search_product)) $sql .=
natural_search(
'p.label', $search_product);
430 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') $sql .=
natural_search(
'e.rowid', $search_warehouse, 2);
431 if (!empty($search_user)) $sql .=
natural_search(
'u.login', $search_user);
432 if (!empty($search_batch)) $sql .=
natural_search(
'm.batch', $search_batch);
433 if ($search_qty !=
'') $sql .=
natural_search(
'm.value', $search_qty, 1);
434 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
436 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
438 $parameters = array();
439 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
440 $sql .= $hookmanager->resPrint;
441 $sql .= $db->order($sortfield, $sortorder);
443 $nbtotalofrecords =
'';
444 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
446 $result = $db->query($sql);
447 $nbtotalofrecords = $db->num_rows($result);
448 if (($page * $limit) > $nbtotalofrecords)
454 $sql .= $db->plimit($limit + 1, $offset);
457 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
458 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
459 if ($id > 0) $param .=
'&id='.urlencode($id);
460 if ($search_movement) $param .=
'&search_movement='.urlencode($search_movement);
461 if ($search_inventorycode) $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
462 if ($search_type_mouvement) $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
463 if ($search_product_ref) $param .=
'&search_product_ref='.urlencode($search_product_ref);
464 if ($search_product) $param .=
'&search_product='.urlencode($search_product);
465 if ($search_batch) $param .=
'&search_batch='.urlencode($search_batch);
466 if ($search_warehouse > 0) $param .=
'&search_warehouse='.urlencode($search_warehouse);
467 if ($search_user) $param .=
'&search_user='.urlencode($search_user);
470 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
473 $arrayofmassactions = array(
478 if (in_array($massaction, array(
'presend',
'predelete'))) $arrayofmassactions = array();
479 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
481 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
482 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
483 print '<input type="hidden" name="token" value="'.newToken().
'">';
484 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
485 print '<input type="hidden" name="action" value="list">';
486 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
487 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
488 print '<input type="hidden" name="page" value="'.$page.
'">';
489 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
490 if ($id > 0)
print '<input type="hidden" name="id" value="'.$id.
'">';
492 if ($id > 0)
print_barre_liste($texte, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
493 else print_barre_liste($texte, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
497 $parameters = array();
498 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
499 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
500 else $moreforfilter = $hookmanager->resPrint;
502 if (!empty($moreforfilter))
504 print '<div class="liste_titre liste_titre_bydiv centpercent">';
505 print $moreforfilter;
509 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
510 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
512 print '<div class="div-table-responsive">';
513 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
516 print '<tr class="liste_titre_filter">';
517 if (!empty($arrayfields[
'm.rowid'][
'checked']))
520 print
'<td class="liste_titre left">';
521 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
524 if (!empty($arrayfields[
'm.datem'][
'checked']))
526 print
'<td class="liste_titre nowraponall">';
527 print
'<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans(
"Month")).
'" name="month" value="'.$month.
'">';
528 if (empty($conf->productbatch->enabled)) print
' ';
530 $syear = $year ? $year : -1;
531 print
'<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans(
"Year")).
'" name="year" value="'.($syear > 0 ? $syear :
'').
'">';
535 if (!empty($arrayfields[
'p.ref'][
'checked']))
538 print
'<td class="liste_titre left">';
539 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct ? $product->ref : $search_product_ref).
'">';
542 if (!empty($arrayfields[
'p.label'][
'checked']))
545 print
'<td class="liste_titre left">';
546 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($idproduct ? $product->label : $search_product).
'">';
550 if (!empty($arrayfields[
'm.batch'][
'checked']))
552 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
554 if (!empty($arrayfields[
'pl.eatby'][
'checked']))
556 print
'<td class="liste_titre left">';
559 if (!empty($arrayfields[
'pl.sellby'][
'checked']))
561 print
'<td class="liste_titre left">';
565 if (!empty($arrayfields[
'e.ref'][
'checked']))
567 print
'<td class="liste_titre maxwidthonsmartphone left">';
569 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, null,
'maxwidth200');
572 if (!empty($arrayfields[
'm.fk_user_author'][
'checked']))
575 print
'<td class="liste_titre left">';
576 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
579 if (!empty($arrayfields[
'm.inventorycode'][
'checked']))
582 print
'<td class="liste_titre left">';
583 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
586 if (!empty($arrayfields[
'm.label'][
'checked']))
589 print
'<td class="liste_titre left">';
590 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
593 if (!empty($arrayfields[
'm.type_mouvement'][
'checked']))
596 print
'<td class="liste_titre center">';
598 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
599 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
600 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
601 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
602 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
603 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
610 if (!empty($arrayfields[
'origin'][
'checked']))
613 print
'<td class="liste_titre left">';
617 if (!empty($arrayfields[
'm.value'][
'checked']))
620 print
'<td class="liste_titre right">';
621 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
624 if (!empty($arrayfields[
'm.price'][
'checked']))
627 print
'<td class="liste_titre left">';
634 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
637 $parameters = array(
'arrayfields'=>$arrayfields);
638 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
639 print $hookmanager->resPrint;
641 if (!empty($arrayfields[
'm.datec'][
'checked']))
643 print
'<td class="liste_titre">';
647 if (!empty($arrayfields[
'm.tms'][
'checked']))
649 print
'<td class="liste_titre">';
653 print
'<td class="liste_titre maxwidthsearch">';
654 $searchpicto = $form->showFilterAndCheckAddButtons(0);
659 print
'<tr class="liste_titre">';
660 if (!empty($arrayfields[
'm.rowid'][
'checked']))
662 if (!empty($arrayfields[
'm.datem'][
'checked']))
664 if (!empty($arrayfields[
'p.ref'][
'checked']))
666 if (!empty($arrayfields[
'p.label'][
'checked']))
668 if (!empty($arrayfields[
'm.batch'][
'checked']))
670 if (!empty($arrayfields[
'pl.eatby'][
'checked']))
672 if (!empty($arrayfields[
'pl.sellby'][
'checked']))
674 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
678 if (!empty($arrayfields[
'm.fk_user_author'][
'checked']))
680 if (!empty($arrayfields[
'm.inventorycode'][
'checked']))
682 if (!empty($arrayfields[
'm.label'][
'checked']))
684 if (!empty($arrayfields[
'm.type_mouvement'][
'checked']))
685 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'],
$_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
686 if (!empty($arrayfields[
'origin'][
'checked']))
688 if (!empty($arrayfields[
'm.value'][
'checked']))
690 if (!empty($arrayfields[
'm.price'][
'checked']))
694 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
697 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
698 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
699 print $hookmanager->resPrint;
700 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
703 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
709 $resql = $db->query($sql);
713 $num = $db->num_rows(
$resql);
716 while ($i < ($limit ? min($num, $limit) : $num)) {
717 $objp = $db->fetch_object(
$resql);
719 $userstatic->id = $objp->fk_user_author;
720 $userstatic->login = $objp->login;
721 $userstatic->lastname = $objp->lastname;
722 $userstatic->firstname = $objp->firstname;
723 $userstatic->photo = $objp->photo;
725 $productstatic->id = $objp->rowid;
726 $productstatic->ref = $objp->product_ref;
727 $productstatic->label = $objp->produit;
728 $productstatic->type = $objp->type;
729 $productstatic->entity = $objp->entity;
730 $productstatic->status_batch = $objp->tobatch;
732 $productlot->id = $objp->lotid;
733 $productlot->batch = $objp->batch;
734 $productlot->eatby = $objp->eatby;
735 $productlot->sellby = $objp->sellby;
737 $warehousestatic->id = $objp->entrepot_id;
738 $warehousestatic->libelle = $objp->warehouse_ref;
739 $warehousestatic->label = $objp->warehouse_ref;
740 $warehousestatic->lieu = $objp->lieu;
742 if (!empty($objp->fk_origin)) {
743 $origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
748 print
'<tr class="oddeven">';
750 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
752 print
'<td>'.$objp->mid.
'</td>';
754 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
756 print
'<td>'.dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
758 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
760 print
'<td class="nowraponall">';
761 print $productstatic->getNomUrl(1,
'stock', 16);
764 if (!empty($arrayfields[
'p.label'][
'checked'])) {
773 print $productstatic->label;
776 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
777 print
'<td class="center nowraponall">';
778 if ($productlot->id > 0)
779 print $productlot->getNomUrl(1);
780 else print $productlot->batch;
783 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
784 print
'<td class="center">'.dol_print_date($objp->eatby,
'day').
'</td>';
786 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
787 print
'<td class="center">'.dol_print_date($objp->sellby,
'day').
'</td>';
790 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
792 print $warehousestatic->getNomUrl(1);
796 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
797 print
'<td class="tdoverflowmax100">';
798 print $userstatic->getNomUrl(-1);
801 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
805 print $objp->inventorycode;
809 if (!empty($arrayfields[
'm.label'][
'checked'])) {
811 print
'<td class="tdoverflowmax100aaa">'.$objp->label.
'</td>';
813 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
815 switch ($objp->type_mouvement) {
817 print
'<td class="center">'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</td>';
820 print
'<td class="center">'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</td>';
823 print
'<td class="center">'.$langs->trans(
'StockDecrease').
'</td>';
826 print
'<td class="center">'.$langs->trans(
'StockIncrease').
'</td>';
830 if (!empty($arrayfields[
'origin'][
'checked'])) {
832 print
'<td class="nowraponall">'.$origin.
'</td>';
834 if (!empty($arrayfields[
'm.value'][
'checked'])) {
836 print
'<td class="right">';
842 if (!empty($arrayfields[
'm.price'][
'checked'])) {
844 print
'<td class="right">';
845 if ($objp->price != 0)
846 print
price($objp->price);
850 print
'<td class="nowrap center">';
851 if ($massactionbutton || $massaction)
854 if (in_array($obj->rowid, $arrayofselected))
856 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
860 $totalarray[
'nbfield']++;
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
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.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
Class to manage products or services.
Class to manage Dolibarr users.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
moPrepareHead($object)
Prepare array of tabs for Mo.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
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.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an 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...
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
Class to manage warehouses.