X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=5c6cec6581cb45fd56cff6e7e54591e124e100f3;hb=06af498f71c9424b2d373d12b4dd90cdac58e070;hp=3c10dd38ee7a6b987d313d7467e7c91d125fe9f9;hpb=af59820cb06ba396ba10ecd88f43a92c331a6066;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index 3c10dd38e..5c6cec658 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -201,10 +201,13 @@ sub transactions_for_todo_list { $query = qq|SELECT oe.id, oe.transdate, oe.reqdate, oe.quonumber, oe.transaction_description, oe.amount, + CASE WHEN (COALESCE(0, oe.customer_id) = 0) THEN 'vendor' ELSE 'customer' END AS vc, c.name AS customer, + v.name AS vendor, e.name AS employee FROM oe LEFT JOIN customer c ON (oe.customer_id = c.id) + LEFT JOIN vendor v ON (oe.vendor_id = v.id) LEFT JOIN employee e ON (oe.employee_id = e.id) WHERE (COALESCE(quotation, FALSE) = TRUE) AND (COALESCE(closed, FALSE) = FALSE) @@ -1007,8 +1010,9 @@ sub order_details { my ($dec) = ($sellprice =~ /\.(\d+)/); my $decimalplaces = max 2, length($dec); - my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100 / $price_factor->{factor}, $decimalplaces); - my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100 / $price_factor->{factor}, 2); + my $parsed_discount = $form->parse_amount($myconfig, $form->{"discount_$i"}); + my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor}, $decimalplaces); + my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}, 2); my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2); $form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); @@ -1016,7 +1020,7 @@ sub order_details { $linetotal = ($linetotal != 0) ? $linetotal : ''; - push @{ $form->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, $decimalplaces) : ''; + push @{ $form->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, 2) : ''; push @{ $form->{p_discount} }, $form->{"discount_$i"}; $form->{ordtotal} += $linetotal;