summaryrefslogtreecommitdiff
path: root/LedgerSMB/IC.pm
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB/IC.pm')
-rwxr-xr-xLedgerSMB/IC.pm18
1 files changed, 8 insertions, 10 deletions
diff --git a/LedgerSMB/IC.pm b/LedgerSMB/IC.pm
index feb7dd7a..6bcfdd80 100755
--- a/LedgerSMB/IC.pm
+++ b/LedgerSMB/IC.pm
@@ -611,24 +611,22 @@ sub update_assembly {
}
$sth->finish;
$qty = $dbh->quote($qty);
- $formlistprice = $dbh->quote($formlistprice );
- $listprice = $dbh->quote($listprice );
- $formsellprice = $dbh->quote($formsellprice );
- $formlastcost = $dbh->quote($form->{lastcost});
- $lastcost = $dbh->quote($lastcost);
- $weight = $dbh->quote($weight);
+ $formlistprice = $dbh->quote($formlistprice - $listprice);
+ $formsellprice = $dbh->quote($formsellprice - $sellprice);
+ $formlastcost = $dbh->quote($form->{lastcost} - $lastcost);
+ $weight = $dbh->quote($form->{weight} - $weight);
$id = $dbh->quote($id);
$query = qq|
UPDATE parts
SET listprice = listprice +
- $qty * ($formlistprice - $listprice),
+ $qty * cast($formlistprice AS numeric),
sellprice = sellprice +
- $qty * ($formsellprice - $sellprice),
+ $qty * cast($formsellprice AS numeric),
lastcost = lastcost +
- $qty * ($form->{lastcost} - $lastcost),
+ $qty * cast($formlastcost AS numeric),
weight = weight +
- $qty * ($form->{weight} - $weight)
+ $qty * cast($weight AS numeric)
WHERE id = $id|;
$dbh->do($query) || $form->dberror($query);