From: Philip Reetz Date: Thu, 18 Jan 2007 11:24:40 +0000 (+0000) Subject: Skontobetraege wurden faelschlicherweise vom Nettobetrag berechnet X-Git-Tag: release-2.4.1~1^2~25 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=566608b739ced48d1ca22dfa85a4ab4590e67c75;p=kivitendo-erp.git Skontobetraege wurden faelschlicherweise vom Nettobetrag berechnet --- diff --git a/SL/Form.pm b/SL/Form.pm index 4bea5f094..a575ea6f1 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1136,6 +1136,14 @@ sub set_payment_options { ($self->{terms_netto}, $self->{terms_skonto}, $self->{percent_skonto}, $self->{payment_terms}) = $sth->fetchrow_array; + if ($transdate eq "") { + if ($self->{invdate}) { + $transdate = $self->{invdate}; + } else { + $transdate = $self->{transdate}; + } + } + $sth->finish; my $query = qq|SELECT date '$transdate' + $self->{terms_netto} AS netto_date,date '$transdate' + $self->{terms_skonto} AS skonto_date FROM payment_terms LIMIT 1|; @@ -1144,7 +1152,9 @@ sub set_payment_options { ($self->{netto_date}, $self->{skonto_date}) = $sth->fetchrow_array; $sth->finish; - $self->{skonto_amount} = $self->format_amount($myconfig, ($self->parse_amount($myconfig, $self->{subtotal}) * $self->{percent_skonto}), 2); + my $total = ($self->{invtotal}) ? $self->{invtotal} : $self->{ordtotal}; + + $self->{skonto_amount} = $self->format_amount($myconfig, ($self->parse_amount($myconfig, $total) * $self->{percent_skonto}), 2); $self->{payment_terms} =~ s/<%netto_date%>/$self->{netto_date}/g; $self->{payment_terms} =~ s/<%skonto_date%>/$self->{skonto_date}/g;