Skip to content

Commit

Permalink
EK-Rechnung: Änderung EK-Preis Preisfaktor berücksichtigen auch bei k…
Browse files Browse the repository at this point in the history
…einem inventory_accno

Und Erzeugnisse/Sortimente auch updaten.
Und nur aktualisieren, wenn geändert.
Genau wie in dem if-Zweig, wo es ein inventroy_accno gibt.

commit 6b8e3b8
Author: Bernd Bleßmann <bernd@kivitendo-premium.de>
Date:   Fri Oct 13 15:06:27 2023 +0200

    EK-Rechnung:
  • Loading branch information
bblessmann committed Oct 23, 2023
1 parent 04a8603 commit 9d44ec0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions SL/IR.pm
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,14 @@ sub _post_invoice {

next if $payments_only;

# update lastcost
$query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
do_query($form, $dbh, $query, $form->{"sellprice_$i"} / $basefactor, conv_i($form->{"id_$i"}));
# change lastcost for part and all assemblies and assortments recursively
my $a = SL::DB::Part->load_cached(conv_i($form->{"id_$i"}));
my $part_price_factor = $a->price_factor_id ? $a->price_factor->factor : 1;
my $new_lastcost = abs($fxsellprice * $form->{exchangerate} / $basefactor / $price_factor * $part_price_factor);
if ( abs($a->lastcost - $new_lastcost) >= 0.009 ) {
$a->update_attributes(lastcost => $new_lastcost);
$a->set_lastcost_assemblies_and_assortiments;
}
}

next if $payments_only;
Expand Down

0 comments on commit 9d44ec0

Please sign in to comment.