X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=093e77033cdf070e258bc6ea8adf4b460743aa55;hb=b3721e4e65d62ea30b68b00ac77b4495b1f17337;hp=dc29ffaa184c4860ad8353d50f4689bb8abb057a;hpb=4c996a3d4df205f272f6c6cb86c1cdfec1ade49d;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index dc29ffaa1..093e77033 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -633,6 +633,10 @@ sub retrieve { ($form->{currency}) = split /:/, $form->{currencies}; + # set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure + # we come from invoices, feel free. + $form->{reqdate} = $form->{deliverydate} if ($form->{deliverydate} and $form->{callback} =~ /action=ar_transactions/); + if ($form->{id} or @ids) { # retrieve order for single id @@ -892,14 +896,14 @@ sub order_details { $dec = length $dec; my $decimalplaces = ($dec > 2) ? $dec : 2; - my $discount = - $form->round_amount( - $sellprice * $form->parse_amount($myconfig, - $form->{"discount_$i"}) / 100, - $decimalplaces); + my $i_discount = $form->round_amount($sellprice * + $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100, $decimalplaces); + + my $discount = $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); # keep a netprice as well, (sellprice - discount) - $form->{"netprice_$i"} = $sellprice - $discount; + #$form->{"netprice_$i"} = $sellprice - $discount; + $form->{"netprice_$i"} = $sellprice - $i_discount; my $linetotal = $form->round_amount($form->{"qty_$i"} * $form->{"netprice_$i"}, 2); @@ -919,6 +923,7 @@ sub order_details { $linetotal = ($linetotal != 0) ? $linetotal : " "; push(@{ $form->{discount} }, $discount); + push(@{ $form->{p_discount} }, $form->{"discount_$i"}); $form->{ordtotal} += $linetotal;