Merge von 701 aus unstable: Anpassung neue Menu 1024x768
[kivitendo-erp.git] / SL / RP.pm
index 7bd324b..f7afbb0 100644 (file)
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -2343,6 +2343,11 @@ sub bwa {
   foreach $key (@periods) {
     $form->{ "$key" . "gesamtleistung" } = 0;
     $form->{ "$key" . "gesamtkosten" }   = 0;
+    foreach $kosten (@gesamtkosten) {
+      $form->{$kosten}{$key} *= -1;
+    }
+    
+    $form->{4}{$key} *= -1;
 
     foreach $category (@categories) {
 
@@ -2350,13 +2355,14 @@ sub bwa {
         $form->{"$key$category"} =
           $form->format_amount($myconfig,
                                $form->round_amount($form->{$category}{$key}, 2
-                               ));
+                               ), $form->{decimalplaces}, '0');
       }
     }
     foreach $item (@gesamtleistung) {
       $form->{ "$key" . "gesamtleistung" } += $form->{$item}{$key};
     }
     foreach $item (@gesamtkosten) {
+      $form->{$item}{$key} *= -1;
       $form->{ "$key" . "gesamtkosten" } += $form->{$item}{$key};
     }
     $form->{ "$key" . "rohertrag" } =
@@ -2387,8 +2393,8 @@ sub bwa {
                                  ($form->{$category}{$key} /
                                     $form->{ "$key" . "gesamtleistung" } * 100
                                  ),
-                                 2
-                               ));
+                                 $form->{decimalplaces}
+                               ), $form->{decimalplaces}, '0');
         }
       }
       foreach $item (@ergebnisse) {
@@ -2398,8 +2404,8 @@ sub bwa {
                                  ( $form->{ "$key" . "$item" } /
                                      $form->{ "$key" . "gesamtleistung" } * 100
                                  ),
-                                 2
-                               ));
+                                 $form->{decimalplaces}
+                               ), $form->{decimalplaces}, '0');
       }
     }
 
@@ -2412,8 +2418,8 @@ sub bwa {
                                    ($form->{$category}{$key} /
                                       $form->{ "$key" . "gesamtkosten" } * 100
                                    ),
-                                   2
-                                 ));
+                                   $form->{decimalplaces}
+                                 ), $form->{decimalplaces}, '0');
         }
       }
       foreach $item (@ergebnisse) {
@@ -2423,8 +2429,8 @@ sub bwa {
                                    ($form->{ "$key" . "$item" } /
                                       $form->{ "$key" . "gesamtkosten" } * 100
                                    ),
-                                   2
-                               ));
+                                   $form->{decimalplaces}
+                               ), $form->{decimalplaces}, '0');
       }
     }
 
@@ -2435,8 +2441,9 @@ sub bwa {
             $form->format_amount(
                       $myconfig,
                       $form->round_amount(
-                        ($form->{$category}{$key} / $form->{10}{$key} * 100), 2
-                      ));
+                        ($form->{$category}{$key} / $form->{10}{$key} * 100), 
+                        $form->{decimalplaces}
+                      ), $form->{decimalplaces}, '0');
         }
       }
       foreach $item (@ergebnisse) {
@@ -2446,8 +2453,8 @@ sub bwa {
                                                 ($form->{ "$key" . "$item" } /
                                                    $form->{10}{$key} * 100
                                                 ),
-                                                2
-                               ));
+                                                $form->{decimalplaces}
+                               ), $form->{decimalplaces}, '0');
       }
     }
 
@@ -2458,8 +2465,9 @@ sub bwa {
             $form->format_amount(
                        $myconfig,
                        $form->round_amount(
-                         ($form->{$category}{$key} / $form->{4}{$key} * 100), 2
-                       ));
+                         ($form->{$category}{$key} / $form->{4}{$key} * 100), 
+                         $form->{decimalplaces}
+                       ), $form->{decimalplaces}, '0');
         }
       }
       foreach $item (@ergebnisse) {
@@ -2469,16 +2477,17 @@ sub bwa {
                                                 ($form->{ "$key" . "$item" } /
                                                    $form->{4}{$key} * 100
                                                 ),
-                                                2
-                               ));
+                                                $form->{decimalplaces}
+                               ), $form->{decimalplaces}, '0');
       }
     }
 
     foreach $item (@ergebnisse) {
       $form->{ "$key" . "$item" } =
         $form->format_amount($myconfig,
-                             $form->round_amount($form->{ "$key" . "$item" }, 2
-                             ));
+                             $form->round_amount($form->{ "$key" . "$item" }, 
+                             $form->{decimalplaces}
+                             ), $form->{decimalplaces}, '0');
     }
 
   }
@@ -2552,12 +2561,12 @@ sub ustva {
 
   foreach $item (@categories_cent) {
     $form->{$item} =
-      $form->format_amount($myconfig, $form->round_amount($form->{$item}, 2));
+      $form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), 2, '0');
   }
 
   foreach $item (@categories_euro) {
     $form->{$item} =
-      $form->format_amount($myconfig, $form->round_amount($form->{$item}, 0));
+      $form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), 0, '0');
   }
 
   $dbh->disconnect;