|
|
|
|
@@ -47,17 +47,17 @@ $langs->loadLangs(array('products', 'stocks', 'orders'));
|
|
|
|
|
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
|
|
|
|
|
|
|
|
|
// Security check
|
|
|
|
|
$result=restrictedArea($user,'stock');
|
|
|
|
|
$result=restrictedArea($user, 'stock');
|
|
|
|
|
|
|
|
|
|
$id=GETPOST('id','int');
|
|
|
|
|
$ref = GETPOST('ref','alpha');
|
|
|
|
|
$msid=GETPOST('msid','int');
|
|
|
|
|
$id=GETPOST('id', 'int');
|
|
|
|
|
$ref = GETPOST('ref', 'alpha');
|
|
|
|
|
$msid=GETPOST('msid', 'int');
|
|
|
|
|
$product_id=GETPOST("product_id");
|
|
|
|
|
$action=GETPOST('action','aZ09');
|
|
|
|
|
$cancel=GETPOST('cancel','alpha');
|
|
|
|
|
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist';
|
|
|
|
|
$action=GETPOST('action', 'aZ09');
|
|
|
|
|
$cancel=GETPOST('cancel', 'alpha');
|
|
|
|
|
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'movementlist';
|
|
|
|
|
|
|
|
|
|
$idproduct = GETPOST('idproduct','int');
|
|
|
|
|
$idproduct = GETPOST('idproduct', 'int');
|
|
|
|
|
$year = GETPOST("year");
|
|
|
|
|
$month = GETPOST("month");
|
|
|
|
|
$search_ref = GETPOST('search_ref', 'alpha');
|
|
|
|
|
@@ -69,18 +69,18 @@ $search_inventorycode = trim(GETPOST("search_inventorycode"));
|
|
|
|
|
$search_user = trim(GETPOST("search_user"));
|
|
|
|
|
$search_batch = trim(GETPOST("search_batch"));
|
|
|
|
|
$search_qty = trim(GETPOST("search_qty"));
|
|
|
|
|
$search_type_mouvement=GETPOST('search_type_mouvement','int');
|
|
|
|
|
$search_type_mouvement=GETPOST('search_type_mouvement', 'int');
|
|
|
|
|
|
|
|
|
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
|
|
|
|
$page = GETPOST("page",'int');
|
|
|
|
|
$sortfield = GETPOST("sortfield",'alpha');
|
|
|
|
|
$sortorder = GETPOST("sortorder",'alpha');
|
|
|
|
|
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
|
|
|
|
$page = GETPOST("page", 'int');
|
|
|
|
|
$sortfield = GETPOST("sortfield", 'alpha');
|
|
|
|
|
$sortorder = GETPOST("sortorder", 'alpha');
|
|
|
|
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
|
|
|
|
$offset = $limit * $page;
|
|
|
|
|
if (! $sortfield) $sortfield="m.datem";
|
|
|
|
|
if (! $sortorder) $sortorder="DESC";
|
|
|
|
|
|
|
|
|
|
$pdluoid=GETPOST('pdluoid','int');
|
|
|
|
|
$pdluoid=GETPOST('pdluoid', 'int');
|
|
|
|
|
|
|
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
|
|
|
$object = new MouvementStock($db);
|
|
|
|
|
@@ -90,7 +90,7 @@ $formfile = new FormFile($db);
|
|
|
|
|
|
|
|
|
|
// fetch optionals attributes and labels
|
|
|
|
|
$extralabels = $extrafields->fetch_name_optionals_label('movement');
|
|
|
|
|
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
|
|
|
|
|
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
|
|
|
|
|
|
|
|
|
$arrayfields=array(
|
|
|
|
|
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
|
|
|
|
@@ -122,17 +122,17 @@ $usercanread = (($user->rights->stock->mouvement->lire));
|
|
|
|
|
$usercancreate = (($user->rights->stock->mouvement->creer));
|
|
|
|
|
$usercandelete = (($user->rights->stock->mouvement->supprimer));
|
|
|
|
|
|
|
|
|
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
|
|
|
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
|
|
|
|
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
|
|
|
|
|
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
|
|
|
|
|
|
|
|
|
$parameters=array();
|
|
|
|
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
|
|
|
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
|
|
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
|
|
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
|
|
|
|
|
|
|
|
// Do we click on purge search criteria ?
|
|
|
|
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
|
|
|
|
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
|
|
|
|
{
|
|
|
|
|
$year='';
|
|
|
|
|
$month='';
|
|
|
|
|
@@ -195,11 +195,11 @@ if ($action == "correct_stock")
|
|
|
|
|
$result=$product->correct_stock_batch(
|
|
|
|
|
$user,
|
|
|
|
|
$id,
|
|
|
|
|
GETPOST("nbpiece",'int'),
|
|
|
|
|
GETPOST("nbpiece", 'int'),
|
|
|
|
|
GETPOST("mouvement"),
|
|
|
|
|
GETPOST("label",'san_alpha'),
|
|
|
|
|
GETPOST("label", 'san_alpha'),
|
|
|
|
|
GETPOST('unitprice'),
|
|
|
|
|
$eatby,$sellby,$batch,
|
|
|
|
|
$eatby, $sellby, $batch,
|
|
|
|
|
GETPOST('inventorycode'),
|
|
|
|
|
$origin_element,
|
|
|
|
|
$origin_id
|
|
|
|
|
@@ -210,9 +210,9 @@ if ($action == "correct_stock")
|
|
|
|
|
$result=$product->correct_stock(
|
|
|
|
|
$user,
|
|
|
|
|
$id,
|
|
|
|
|
GETPOST("nbpiece",'int'),
|
|
|
|
|
GETPOST("nbpiece", 'int'),
|
|
|
|
|
GETPOST("mouvement"),
|
|
|
|
|
GETPOST("label",'san_alpha'),
|
|
|
|
|
GETPOST("label", 'san_alpha'),
|
|
|
|
|
GETPOST('unitprice'),
|
|
|
|
|
GETPOST('inventorycode'),
|
|
|
|
|
$origin_element,
|
|
|
|
|
@@ -226,11 +226,11 @@ if ($action == "correct_stock")
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$error++;
|
|
|
|
|
setEventMessages($product->error, $product->errors, 'errors');
|
|
|
|
|
$action='correction';
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
$error++;
|
|
|
|
|
setEventMessages($product->error, $product->errors, 'errors');
|
|
|
|
|
$action='correction';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $error) $action='';
|
|
|
|
|
@@ -242,7 +242,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|
|
|
|
$product = new Product($db);
|
|
|
|
|
if (! empty($product_id)) $result=$product->fetch($product_id);
|
|
|
|
|
|
|
|
|
|
if (! (GETPOST("id_entrepot_destination",'int') > 0))
|
|
|
|
|
if (! (GETPOST("id_entrepot_destination", 'int') > 0))
|
|
|
|
|
{
|
|
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
|
|
|
|
|
$error++;
|
|
|
|
|
@@ -254,13 +254,13 @@ if ($action == "transfert_stock" && ! $cancel)
|
|
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
|
|
|
|
|
$action='transfert';
|
|
|
|
|
}
|
|
|
|
|
if (! GETPOST("nbpiece",'int'))
|
|
|
|
|
if (! GETPOST("nbpiece", 'int'))
|
|
|
|
|
{
|
|
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
|
|
|
|
|
$error++;
|
|
|
|
|
$action='transfert';
|
|
|
|
|
}
|
|
|
|
|
if ($id == GETPOST("id_entrepot_destination",'int'))
|
|
|
|
|
if ($id == GETPOST("id_entrepot_destination", 'int'))
|
|
|
|
|
{
|
|
|
|
|
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
|
|
|
|
|
$error++;
|
|
|
|
|
@@ -330,22 +330,22 @@ if ($action == "transfert_stock" && ! $cancel)
|
|
|
|
|
$result1=$product->correct_stock_batch(
|
|
|
|
|
$user,
|
|
|
|
|
$srcwarehouseid,
|
|
|
|
|
GETPOST("nbpiece",'int'),
|
|
|
|
|
GETPOST("nbpiece", 'int'),
|
|
|
|
|
1,
|
|
|
|
|
GETPOST("label",'san_alpha'),
|
|
|
|
|
GETPOST("label", 'san_alpha'),
|
|
|
|
|
$pricesrc,
|
|
|
|
|
$eatby,$sellby,$batch,
|
|
|
|
|
$eatby, $sellby, $batch,
|
|
|
|
|
GETPOST('inventorycode')
|
|
|
|
|
);
|
|
|
|
|
// Add stock
|
|
|
|
|
$result2=$product->correct_stock_batch(
|
|
|
|
|
$user,
|
|
|
|
|
GETPOST("id_entrepot_destination",'int'),
|
|
|
|
|
GETPOST("nbpiece",'int'),
|
|
|
|
|
GETPOST("id_entrepot_destination", 'int'),
|
|
|
|
|
GETPOST("nbpiece", 'int'),
|
|
|
|
|
0,
|
|
|
|
|
GETPOST("label",'san_alpha'),
|
|
|
|
|
GETPOST("label", 'san_alpha'),
|
|
|
|
|
$pricedest,
|
|
|
|
|
$eatby,$sellby,$batch,
|
|
|
|
|
$eatby, $sellby, $batch,
|
|
|
|
|
GETPOST('inventorycode')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@@ -447,7 +447,7 @@ $sql.= " u.login, u.photo, u.lastname, u.firstname";
|
|
|
|
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
|
|
|
|
// Add fields from hooks
|
|
|
|
|
$parameters=array();
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$sql.=$hookmanager->resPrint;
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
|
|
|
|
|
$sql.= " ".MAIN_DB_PREFIX."product as p,";
|
|
|
|
|
@@ -464,13 +464,13 @@ if ($id > 0) $sql.= " AND e.rowid ='".$id."'";
|
|
|
|
|
if ($month > 0)
|
|
|
|
|
{
|
|
|
|
|
if ($year > 0)
|
|
|
|
|
$sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
|
|
|
|
$sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'";
|
|
|
|
|
else
|
|
|
|
|
$sql.= " AND date_format(m.datem, '%m') = '$month'";
|
|
|
|
|
}
|
|
|
|
|
elseif ($year > 0)
|
|
|
|
|
{
|
|
|
|
|
$sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
|
|
|
|
$sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
|
|
|
|
|
}
|
|
|
|
|
if ($idproduct > 0) $sql.= " AND p.rowid = '".$idproduct."'";
|
|
|
|
|
if (! empty($search_ref)) $sql.= natural_search('m.rowid', $search_ref, 1);
|
|
|
|
|
@@ -487,9 +487,9 @@ if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natur
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
|
|
|
|
// Add where from hooks
|
|
|
|
|
$parameters=array();
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$sql.=$hookmanager->resPrint;
|
|
|
|
|
$sql.= $db->order($sortfield,$sortorder);
|
|
|
|
|
$sql.= $db->order($sortfield, $sortorder);
|
|
|
|
|
|
|
|
|
|
$nbtotalofrecords = '';
|
|
|
|
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
|
|
@@ -549,7 +549,7 @@ if ($resql)
|
|
|
|
|
$texte = $langs->trans("ListOfStockMovements");
|
|
|
|
|
if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')';
|
|
|
|
|
}
|
|
|
|
|
llxHeader("",$texte,$help_url);
|
|
|
|
|
llxHeader("", $texte, $help_url);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Show tab only if we ask a particular warehouse
|
|
|
|
|
@@ -568,7 +568,7 @@ if ($resql)
|
|
|
|
|
$morehtmlref.='</div>';
|
|
|
|
|
|
|
|
|
|
$shownav = 1;
|
|
|
|
|
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
|
|
|
|
if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
|
|
|
|
|
|
|
|
|
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
|
|
|
|
|
|
|
|
|
|
@@ -609,7 +609,7 @@ if ($resql)
|
|
|
|
|
|
|
|
|
|
// Value
|
|
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
|
|
|
|
|
print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency);
|
|
|
|
|
print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
|
|
|
|
|
print "</td></tr>";
|
|
|
|
|
|
|
|
|
|
// Last movement
|
|
|
|
|
@@ -630,7 +630,7 @@ if ($resql)
|
|
|
|
|
print '<tr><td>'.$langs->trans("LastMovement").'</td><td>';
|
|
|
|
|
if ($lastmovementdate)
|
|
|
|
|
{
|
|
|
|
|
print dol_print_date($lastmovementdate,'dayhour');
|
|
|
|
|
print dol_print_date($lastmovementdate, 'dayhour');
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -731,19 +731,19 @@ if ($resql)
|
|
|
|
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
|
|
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
|
|
|
|
|
|
|
|
|
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
|
|
|
|
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
|
|
|
|
|
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
|
|
|
|
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
|
|
|
|
|
|
|
|
|
|
if ($sall)
|
|
|
|
|
{
|
|
|
|
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
|
|
|
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
|
|
|
|
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$moreforfilter='';
|
|
|
|
|
|
|
|
|
|
$parameters=array();
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
|
|
|
|
else $moreforfilter = $hookmanager->resPrint;
|
|
|
|
|
|
|
|
|
|
@@ -883,7 +883,7 @@ if ($resql)
|
|
|
|
|
|
|
|
|
|
// Fields from hook
|
|
|
|
|
$parameters=array('arrayfields'=>$arrayfields);
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
print $hookmanager->resPrint;
|
|
|
|
|
// Date creation
|
|
|
|
|
if (! empty($arrayfields['m.datec']['checked']))
|
|
|
|
|
@@ -905,38 +905,38 @@ if ($resql)
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'],$_SERVER["PHP_SELF"], "e.ref","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible
|
|
|
|
|
if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'],$_SERVER["PHP_SELF"], "m.type_mouvement","",$param,'align="center"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, 'align="center"', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible
|
|
|
|
|
if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder);
|
|
|
|
|
|
|
|
|
|
// Extra fields
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
|
|
|
|
|
|
|
|
|
// Hook fields
|
|
|
|
|
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
|
|
print $hookmanager->resPrint;
|
|
|
|
|
if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
|
|
|
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
|
|
|
|
if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
|
|
|
|
if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
|
|
|
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$arrayofuniqueproduct=array();
|
|
|
|
|
|
|
|
|
|
while ($i < min($num,$limit))
|
|
|
|
|
while ($i < min($num, $limit))
|
|
|
|
|
{
|
|
|
|
|
$objp = $db->fetch_object($resql);
|
|
|
|
|
|
|
|
|
|
@@ -978,13 +978,13 @@ if ($resql)
|
|
|
|
|
if (! empty($arrayfields['m.datem']['checked']))
|
|
|
|
|
{
|
|
|
|
|
// Date
|
|
|
|
|
print '<td>'.dol_print_date($db->jdate($objp->datem),'dayhour').'</td>';
|
|
|
|
|
print '<td>'.dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
|
|
|
|
|
}
|
|
|
|
|
if (! empty($arrayfields['p.ref']['checked']))
|
|
|
|
|
{
|
|
|
|
|
// Product ref
|
|
|
|
|
print '<td class="nowraponall">';
|
|
|
|
|
print $productstatic->getNomUrl(1,'stock',16);
|
|
|
|
|
print $productstatic->getNomUrl(1, 'stock', 16);
|
|
|
|
|
print "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
if (! empty($arrayfields['p.label']['checked']))
|
|
|
|
|
@@ -1007,11 +1007,11 @@ if ($resql)
|
|
|
|
|
}
|
|
|
|
|
if (! empty($arrayfields['pl.eatby']['checked']))
|
|
|
|
|
{
|
|
|
|
|
print '<td align="center">'. dol_print_date($objp->eatby,'day') .'</td>';
|
|
|
|
|
print '<td align="center">'. dol_print_date($objp->eatby, 'day') .'</td>';
|
|
|
|
|
}
|
|
|
|
|
if (! empty($arrayfields['pl.sellby']['checked']))
|
|
|
|
|
{
|
|
|
|
|
print '<td align="center">'. dol_print_date($objp->sellby,'day') .'</td>';
|
|
|
|
|
print '<td align="center">'. dol_print_date($objp->sellby, 'day') .'</td>';
|
|
|
|
|
}
|
|
|
|
|
// Warehouse
|
|
|
|
|
if (! empty($arrayfields['e.ref']['checked']))
|
|
|
|
|
@@ -1048,7 +1048,7 @@ if ($resql)
|
|
|
|
|
if (! empty($arrayfields['m.type_mouvement']['checked']))
|
|
|
|
|
{
|
|
|
|
|
// Type of movement
|
|
|
|
|
switch($objp->type_mouvement){
|
|
|
|
|
switch($objp->type_mouvement) {
|
|
|
|
|
case "0":
|
|
|
|
|
print '<td align="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
|
|
|
|
|
break;
|
|
|
|
|
@@ -1114,20 +1114,20 @@ if ($resql)
|
|
|
|
|
$productidselected=$key;
|
|
|
|
|
$productlabelselected=$val;
|
|
|
|
|
}
|
|
|
|
|
$datebefore=dol_get_first_day($year?$year:strftime("%Y",time()), $month?$month:1, true);
|
|
|
|
|
$dateafter=dol_get_last_day($year?$year:strftime("%Y",time()), $month?$month:12, true);
|
|
|
|
|
$datebefore=dol_get_first_day($year?$year:strftime("%Y", time()), $month?$month:1, true);
|
|
|
|
|
$dateafter=dol_get_last_day($year?$year:strftime("%Y", time()), $month?$month:12, true);
|
|
|
|
|
$balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
|
|
|
|
|
$balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);
|
|
|
|
|
|
|
|
|
|
//print '<tr class="total"><td class="liste_total">';
|
|
|
|
|
print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore,'day','gmt'));
|
|
|
|
|
print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt'));
|
|
|
|
|
//print '</td>';
|
|
|
|
|
//print '<td class="liste_total" colspan="6" align="right">';
|
|
|
|
|
print ': '.$balancebefore;
|
|
|
|
|
print "<br>\n";
|
|
|
|
|
//print '</td></tr>';
|
|
|
|
|
//print '<tr class="total"><td class="liste_total">';
|
|
|
|
|
print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter,'day','gmt'));
|
|
|
|
|
print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter, 'day', 'gmt'));
|
|
|
|
|
//print '</td>';
|
|
|
|
|
//print '<td class="liste_total" colspan="6" align="right">';
|
|
|
|
|
print ': '.$balanceafter;
|
|
|
|
|
@@ -1169,7 +1169,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0)
|
|
|
|
|
$genallowed=$user->rights->stock->lire;
|
|
|
|
|
$delallowed=$user->rights->stock->creer;
|
|
|
|
|
|
|
|
|
|
print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
|
|
|
|
|
print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
|
|
|
|
$somethingshown=$formfile->numoffiles;
|
|
|
|
|
|
|
|
|
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
|
|
|
|
|