X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdo.pl;h=8299a1abf8c499bd0e308691c18417b96d96492b;hb=e3b8d5321e86ba3ea9dbe3997e21202935f3d140;hp=120606acdb0844ceb470ee4d905f4b2a09dddf47;hpb=40c4eff395b9a1524d06e25ac7548113f9c1dc71;p=kivitendo-erp.git diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 120606acd..8299a1abf 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -179,9 +179,9 @@ sub order_links { # get customer / vendor if ($form->{vc} eq 'vendor') { IR->get_vendor(\%myconfig, \%$form); + $form->{discount} = $form->{vendor_discount}; } else { IS->get_customer(\%myconfig, \%$form); - # OFFEN tritt bug 1284 auch bei vendor auf? $form->{discount} = $form->{customer_discount}; } @@ -733,9 +733,9 @@ sub invoice { for my $i (1 .. $form->{rowcount}) { # für bug 1284 - if ($form->{discount}){ # Falls wir einen Kundenrabatt haben + if ($form->{discount}){ # Falls wir einen Lieferanten-/Kundenrabatt haben # und keinen anderen discount wert an $i ... - $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir den kundenrabatt + $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir diesen Rabatt } map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor); } @@ -846,15 +846,35 @@ sub invoice_multi { map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued); + # get vendor or customer discount + my $vc_discount; + my $saved_form = save_form(); + if ($form->{vc} eq 'vendor') { + IR->get_vendor(\%myconfig, \%$form); + $vc_discount = $form->{vendor_discount}; + } else { + IS->get_customer(\%myconfig, \%$form); + $vc_discount = $form->parse_amount(\%myconfig, $form->{customer_discount}); + } + restore_form($saved_form); + $form->{rowcount} = 0; foreach my $ref (@{ $form->{form_details} }) { $form->{rowcount}++; $ref->{reqdate} ||= $ref->{dord_transdate}; # copy transdates into each invoice row map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref }; - map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice discount lastcost); + map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice lastcost); + + if ($vc_discount){ # falls wir einen Lieferanten/Kundenrabatt haben + # und keinen anderen discount wert an $i ... + $form->{"discount_$form->{rowcount}"} ||= $vc_discount; # ... nehmen wir diesen Rabatt + } + $form->{"discount_$form->{rowcount}"} = $form->{"discount_$form->{rowcount}"} * 100; #s.a. Bug 1151 # Anm.: Eine Änderung des discounts in der SL/DO.pm->retrieve (select (doi.discount * 100) as discount) ergibt in psql einen # Wert von 10.0000001490116. Ferner ist der Rabatt in der Rechnung dann bei 1.0 (?). Deswegen lasse ich das hier. jb 10.10.09 + + $form->{"discount_$form->{rowcount}"} = $form->format_amount(\%myconfig, $form->{"discount_$form->{rowcount}"}); } delete $form->{form_details};