Fix calculation from a BOM > 1
This commit is contained in:
parent
8754fc1d1e
commit
a5def19cff
@ -60,7 +60,7 @@ ConsumeOrProduce=Consume or Produce
|
||||
ConsumeAndProduceAll=Consume and Produce All
|
||||
Manufactured=Manufactured
|
||||
TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce.
|
||||
ForAQuantityOf1=For a quantity to produce of 1
|
||||
ForAQuantityOf=For a quantity to produce of %s
|
||||
ConfirmValidateMo=Are you sure you want to validate this Manufacturing Order?
|
||||
ConfirmProductionDesc=By clicking on '%s', you will validate the consumption and/or production for the quantities set. This will also update the stock and record stock movements.
|
||||
ProductionForRef=Production of %s
|
||||
|
||||
@ -1268,7 +1268,7 @@ class Mo extends CommonObject
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td class="right">'.$langs->trans('Qty').' <span class="opacitymedium">('.$langs->trans("ForAQuantityOf1").')</span></td>';
|
||||
print '<td class="right">'.$langs->trans('Qty').' <span class="opacitymedium">('.$langs->trans("ForAQuantityOf", $this->bom->qty).')</span></td>';
|
||||
print '<td class="center">'.$langs->trans('QtyFrozen').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DisableStockChange').'</td>';
|
||||
//print '<td class="right">'.$langs->trans('Efficiency').'</td>';
|
||||
@ -1334,6 +1334,11 @@ class Mo extends CommonObject
|
||||
// TODO
|
||||
}
|
||||
|
||||
$this->tpl['qty_bom'] = 1;
|
||||
if (is_object($this->bom) && $this->bom->qty > 1) {
|
||||
$this->tpl['qty_bom'] = $this->bom->qty;
|
||||
}
|
||||
|
||||
$this->tpl['qty'] = $line->qty;
|
||||
$this->tpl['qty_frozen'] = $line->qty_frozen;
|
||||
$this->tpl['disable_stock_change'] = $line->disable_stock_change;
|
||||
|
||||
@ -293,6 +293,7 @@ if ($action == 'create')
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$object->lines = $objectbom->lines;
|
||||
$object->bom = $objectbom;
|
||||
|
||||
$object->printOriginLinesList('', array());
|
||||
|
||||
|
||||
@ -691,7 +691,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" name="addconsumelinebutton" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button buttongen" name="addconsumelinebutton" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
if ($conf->productbatch->enabled) {
|
||||
print '<td></td>';
|
||||
|
||||
@ -24,13 +24,20 @@ if (empty($conf) || !is_object($conf))
|
||||
}
|
||||
|
||||
if (!is_object($form)) $form = new Form($db);
|
||||
|
||||
$qtytoconsumeforline = $this->tpl['qty'] / $this->tpl['efficiency'];
|
||||
/*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) {
|
||||
$qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom'];
|
||||
}*/
|
||||
$qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS');
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
||||
<?php
|
||||
print '<tr class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
|
||||
print '<td>'.$this->tpl['label'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.round($this->tpl['qty'] / $this->tpl['efficiency'], 2) : '').'</td>';
|
||||
print '<td class="right">'.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').'</td>';
|
||||
print '<td class="center">'.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').'</td>';
|
||||
print '<td class="center">'.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').'</td>';
|
||||
//print '<td class="right">'.$this->tpl['efficiency'].'</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user