Fehlerbehebung fuer Bug 736 - Der beim Lieferanten hinterlegte Rabatt wird in dem...
[kivitendo-erp.git] / bin / mozilla / oe.pl
index c490895..c86de37 100644 (file)
@@ -41,6 +41,7 @@ use SL::IS;
 use SL::PE;
 use SL::ReportGenerator;
 use List::Util qw(max reduce sum);
+use Data::Dumper;
 
 require "bin/mozilla/io.pl";
 require "bin/mozilla/arap.pl";
@@ -465,6 +466,8 @@ sub update {
 
   check_oe_access();
 
+#  $main::lxdebug->message(0, Dumper($form));
+
   set_headings($form->{"id"} ? "edit" : "add");
 
   map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate) unless $recursive_call;
@@ -491,8 +494,8 @@ sub update {
       && ($form->{"partsgroup_$i"}  eq "")) {
 
     $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
-    &check_form;
 
+    &check_form;
   } else {
 
     if ($form->{type} =~ /^sales/) {
@@ -503,7 +506,11 @@ sub update {
 
     my $rows = scalar @{ $form->{item_list} };
 
-    $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{discount} * 100);
+    # hier ist das problem fuer bug 817 $form->{discount} wird nicht durchgeschliffen
+    # ferner fallunterscheidung fuer verkauf oder einkauf s.a. bug 736 jb 04.05.2009 
+    # select discount as vendor_discount from vendor || 
+    # select discount as customer_discount from customer
+    $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"$form->{vc}_discount"} * 100);
 
     if ($rows) {
       $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
@@ -972,7 +979,7 @@ sub orders {
 
   $report->set_columns(%column_defs);
   $report->set_column_order(@columns);
-  $report->set_export_options('orders', @hidden_variables);
+  $report->set_export_options('orders', @hidden_variables, qw(sort sortdir));
   $report->set_sort_indicator($form->{sort}, $form->{sortdir});
 
   my @options;