diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index bd254c404d4..f13853a2f72 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -707,7 +707,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '
';
print '| '.$langs->trans("Product").' | ';
print ''.$langs->trans("Qty").' | ';
- if ($permissiontoupdatecost) print ''.$langs->trans("PMPValue").' | ';
+ if ($permissiontoupdatecost) print ''.$langs->trans("UnitCost").' | ';
print ''.$langs->trans("QtyAlreadyConsumed").' | ';
print '';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse");
@@ -755,6 +755,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$tmpproduct = new Product($db);
$tmpproduct->fetch($line->fk_product);
+ $linecost = price2num($tmpproduct->pmp, 'MT');
if ($line->origin_type == 'free' && $object->qty > 0) {
// add free consume line cost to bomcost
@@ -767,6 +768,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
$bomcost += price2num(($line->qty * $linecost) / $object->qty, 'MT');
+ } elseif ($line->origin_id > 0 && $line->origin_type == 'bom' && $object->qty > 0) {
+ foreach ($bom->lines as $bomline) {
+ if ($bomline->id == $line->origin_id) {
+ $linecost = price2num(($line->qty * $bomline->unit_cost) / $object->qty, 'MT');
+ }
+ }
}
$arrayoflines = $object->fetchLinesLinked('consumed', $line->id);
@@ -791,7 +798,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' | ';
if ($permissiontoupdatecost) {
print '';
- print price($tmpproduct->pmp);
+ print $linecost;
print ' | ';
}
print '';
|