Revision 2172794d
Von Jan Büren vor etwa 1 Jahr hinzugefügt
SL/IR.pm | ||
---|---|---|
243 | 243 |
|
244 | 244 |
next if $payments_only; |
245 | 245 |
|
246 |
# update parts table by setting lastcost to current price, don't allow negative values by using abs |
|
247 |
# maybe allow only 2 decimal places -> rounding error with fx can be too huge for datev checks |
|
248 |
# @values = ($form->round_amount(abs($fxsellprice * $form->{exchangerate} / $basefactor), 2), conv_i($form->{"id_$i"})); |
|
249 |
#$query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|; |
|
250 |
#@values = (abs($fxsellprice * $form->{exchangerate} / $basefactor), conv_i($form->{"id_$i"})); |
|
251 |
#do_query($form, $dbh, $query, @values); |
|
252 | 246 |
# after_save hook changes lastcost for all assemblies and assortments recursively |
253 |
$::form->{lastcost_modified} = 1; |
|
254 | 247 |
my $a = SL::DB::Part->load_cached(conv_i($form->{"id_$i"})); |
255 | 248 |
$a->update_attributes(lastcost => abs($fxsellprice * $form->{exchangerate} / $basefactor)); |
256 |
|
|
249 |
$a->set_lastcost_assemblies_and_assortiments; |
|
257 | 250 |
|
258 | 251 |
# check if we sold the item already and |
259 | 252 |
# make an entry for the expense and inventory |
Auch abrufbar als: Unified diff
Einkaufspreis von Erzeugnissen/Sortimententen ohne after_save hook