|
@@ -28,6 +28,7 @@
|
|
|
|
|
|
require '../main.inc.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.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/stock/class/entrepot.class.php';
|
|
@@ -115,7 +116,7 @@ $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desire
|
|
|
$sql.= ' ps.fk_entrepot,';
|
|
|
$sql.= ' e.label as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,';
|
|
|
$sql.= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,';
|
|
|
-$sql.= ' pl.eatby, pl.sellby,';
|
|
|
+$sql.= ' pl.rowid as lotid, pl.eatby, pl.sellby,';
|
|
|
$sql.= ' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable';
|
|
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
|
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_product'; // Detail for each warehouse
|
|
@@ -157,7 +158,7 @@ $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.
|
|
|
$sql.= " ps.fk_entrepot,";
|
|
|
$sql.= " e.label, e.lieu, e.fk_parent,";
|
|
|
$sql.= " pb.batch, pb.eatby, pb.sellby,";
|
|
|
-$sql.= " pl.eatby, pl.sellby";
|
|
|
+$sql.= " pl.rowid, pl.eatby, pl.sellby";
|
|
|
if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
|
|
|
$sql.= $db->order($sortfield,$sortorder);
|
|
|
|
|
@@ -306,6 +307,7 @@ if ($resql)
|
|
|
print "</tr>\n";
|
|
|
|
|
|
$product_static=new Product($db);
|
|
|
+ $product_lot_static=new Productlot($db);
|
|
|
$warehousetmp=new Entrepot($db);
|
|
|
|
|
|
while ($i < min($num,$limit))
|
|
@@ -336,6 +338,13 @@ if ($resql)
|
|
|
$product_static->type=$objp->fk_product_type;
|
|
|
$product_static->entity=$objp->entity;
|
|
|
|
|
|
+ $product_lot_static->batch=$objp->batch;
|
|
|
+ $product_lot_static->product_id=$objp->rowid;
|
|
|
+ $product_lot_static->id=$objp->lotid;
|
|
|
+ $product_lot_static->eatby=$objp->eatby;
|
|
|
+ $product_lot_static->sellby=$objp->sellby;
|
|
|
+
|
|
|
+
|
|
|
$warehousetmp->id=$objp->fk_entrepot;
|
|
|
$warehousetmp->ref=$objp->warehouse_ref;
|
|
|
$warehousetmp->label=$objp->warehouse_ref;
|
|
@@ -372,7 +381,15 @@ if ($resql)
|
|
|
print $warehousetmp->getNomUrl(1);
|
|
|
}
|
|
|
print '</td>';
|
|
|
- print '<td align="center">'.$objp->batch.'</td>';
|
|
|
+
|
|
|
+ // Lot
|
|
|
+ print '<td align="center">';
|
|
|
+ if ($product_lot_static->batch)
|
|
|
+ {
|
|
|
+ print $product_lot_static->getNomUrl(1);
|
|
|
+ }
|
|
|
+ print '</td>';
|
|
|
+
|
|
|
print '<td align="center">'.dol_print_date($db->jdate($objp->eatby), 'day').'</td>';
|
|
|
print '<td align="center">'.dol_print_date($db->jdate($objp->sellby), 'day').'</td>';
|
|
|
print '<td align="right">';
|