diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index b72904ad0f3..7d1ffa9e609 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -425,10 +425,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array(); if (isModEnabled('bom')) { $langs->load("mrp"); - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -453,10 +449,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array(); if (isModEnabled('bom')) { $langs->load("mrp"); - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -482,10 +474,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (isModEnabled('bom')) { $langs->load("mrp"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -580,9 +568,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - $object->calculateCosts(); - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; - print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; + + // Manufacturing cost + print ''.$form->textwithpicto($langs->trans("ManufacturingCost"), $langs->trans("BOMTotalCost")).''; + print price($object->total_cost); + print ''; + if ($object->total_cost != $object->unit_cost) { + print '    ('.$form->textwithpicto(price($object->unit_cost), $langs->trans("ManufacturingUnitCost"), 1, 'help', '').')'; + } + print ''; + + // Find sell price of generated product. We suppose we sell it to a company like ours (same country...). + $object->fetch_product(); + $manufacturedvalued = ''; + if (!empty($object->product)) { + $tmparray = $object->product->getSellPrice($mysoc, $mysoc); + $manufacturedvalued = $tmparray['pu_ht'] * $object->qty; + } + print ''.$langs->trans("ManufacturingGeneratedValue").''.price($manufacturedvalued).''; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -658,7 +661,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Services $filtertype = 1; - $res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines + $res = $object->fetchLinesbytypeproduct($filtertype); // Load all lines services into ->lines $object->calculateCosts(); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 9292c9b2621..b29e53743a3 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -188,8 +188,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; - print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; + // Manufacturing cost + print ''.$form->textwithpicto($langs->trans("ManufacturingCost"), $langs->trans("BOMTotalCost")).''; + print price($object->total_cost); + print ''; + if ($object->total_cost != $object->unit_cost) { + print '    ('.$form->textwithpicto(price($object->unit_cost), $langs->trans("ManufacturingUnitCost"), 1, 'help', '').')'; + } + print ''; + + // Find sell price of generated product. We suppose we sell it to a company like ours (same country...). + $object->fetch_product(); + $manufacturedvalued = ''; + if (!empty($object->product)) { + $tmparray = $object->product->getSellPrice($mysoc, $mysoc); + $manufacturedvalued = $tmparray['pu_ht'] * $object->qty; + } + print ''.$langs->trans("ManufacturingGeneratedValue").''.price($manufacturedvalued).''; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index fe3d40c3f32..59df1d5e60a 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1409,7 +1409,7 @@ class BOM extends CommonObject */ public function calculateCosts() { - global $conf, $hookmanager; + global $hookmanager; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $this->unit_cost = 0; diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 4ab671306ff..b96eaafb67b 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -161,7 +161,7 @@ foreach ($object->fields as $key => $val) { $value = $object->$key; $rightpart .= ' 0) $rightpart .= ' fieldrequired'; // No fieldrequired in the view output if ($val['type'] == 'text' || $val['type'] == 'html') { $rightpart .= ' tdtop'; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index fd303eff68b..61884ad2d54 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -95,6 +95,9 @@ ProductsToConsume=Products to consume ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost +ManufacturingCost=Manufacturing cost +ManufacturingUnitCost=Unit manufacturing cost +ManufacturingGeneratedValue=Manufacturing value generated BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) BOMTotalCostService=If the "Workstation" module is activated and a workstation is defined by default on the line, then the calculation is "quantity (converted into hours) x workstation ahr", otherwise "quantity x cost price of the service" GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it.