NEW show detail per warehouse into reassort
This commit is contained in:
parent
c73f4e5d7b
commit
7658a86bc9
@ -29,6 +29,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("stocks");
|
||||
@ -242,6 +243,12 @@ if ($resql)
|
||||
|
||||
$param="&tosell=$tosell&tobuy=$tobuy".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref";
|
||||
|
||||
$formProduct = new FormProduct($db);
|
||||
$formProduct->loadWarehouses();
|
||||
$warehouses_list = $formProduct->cache_warehouses;
|
||||
$nb_warehouse = count($warehouses_list);
|
||||
$colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse+1 : 1;
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
|
||||
// Lignes des titres
|
||||
@ -252,6 +259,19 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
|
||||
/*
|
||||
* Details per warehouse
|
||||
*/
|
||||
|
||||
if($nb_warehouse>1) {
|
||||
|
||||
foreach($warehouses_list as &$wh) {
|
||||
print_liste_field_titre($wh['label'], '', '','','','align="right"');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO Add info of running suppliers/customers orders
|
||||
//print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
@ -278,48 +298,29 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="'.$colspan_warehouse.'"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$product_static=new Product($db);
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid;
|
||||
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
$product_static->ref=$objp->ref;
|
||||
$product_static->id=$objp->rowid;
|
||||
$product_static->label = $objp->label;
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->entity=$objp->entity;
|
||||
print $product_static->getNomUrl(1,'',16);
|
||||
|
||||
$product=new Product($db);
|
||||
$product->fetch($objp->rowid);
|
||||
$product->load_stock();
|
||||
|
||||
print $product->getNomUrl(1,'',16);
|
||||
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
|
||||
print '</td>';
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
print '<td>'.$product->label.'</td>';
|
||||
|
||||
if (! empty($conf->service->enabled) && $type == 1)
|
||||
{
|
||||
@ -334,12 +335,31 @@ if ($resql)
|
||||
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||
print '<td align="right">'.$objp->desiredstock.'</td>';
|
||||
print '<td align="right">';
|
||||
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $objp->stock_physique;
|
||||
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $product->stock_reel;
|
||||
print '</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product_static->id.'">'.$langs->trans("Movements").'</a></td>';
|
||||
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->statut,5,0).'</td>';
|
||||
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
||||
|
||||
/*
|
||||
* Details per warehouse
|
||||
*/
|
||||
|
||||
if($nb_warehouse>1) {
|
||||
|
||||
foreach($warehouses_list as &$wh) {
|
||||
|
||||
print '<td align="right">';
|
||||
print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product->id.'">'.$langs->trans("Movements").'</a></td>';
|
||||
print '<td align="right" class="nowrap">'.$product->LibStatut($objp->statut,5,0).'</td>';
|
||||
print '<td align="right" class="nowrap">'.$product->LibStatut($objp->tobuy,5,1).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user