Part Controller - callbacks für Artikel speichern und löschen
[kivitendo-erp.git] / SL / RP.pm
index 452f116..79f0403 100644 (file)
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -1646,6 +1646,15 @@ sub bwa {
     &get_accounts_g($dbh, $last_period, $kummfromdate, $kummtodate, $form, "pos_bwa");
   }
 
+  my %charts_by_category =
+    partition_by { $_->{pos_bwa} }
+    sort_by      { $_->{accno}   }
+    map          { $form->{charts}->{$_} }
+    keys %{ $form->{charts} };
+  $form->{"charts_by_category"} = \%charts_by_category;
+
+  $form->{category_names} = AM->get_bwa_categories($myconfig, $form);
+
   my @periods        = qw(jetzt kumm);
   my @gesamtleistung = qw(1 3);
   my @gesamtkosten   = qw (10 11 12 13 14 15 16 17 18 20);
@@ -1905,13 +1914,13 @@ sub erfolgsrechnung {
     foreach my $account (@{$category{accounts}}) {
       $account->{total} += get_total_ch($account->{id}, $fromdate, $todate);
       $category{total} += $account->{total};
-      $account->{total} = $form->format_amount($myconfig, $form->parse_amount($myconfig, $account->{total}), 2);
+      $account->{total} = $form->format_amount($myconfig, $form->round_amount($account->{total}, 2), 2);
     }
     $form->{total} += $category{total};
-    $category{total} = $form->format_amount($myconfig, $form->parse_amount($myconfig, $category{total}), 2);
+    $category{total} = $form->format_amount($myconfig, $form->round_amount($category{total}, 2), 2);
     push(@{$form->{categories}}, \%category);
   }
-  $form->{total} = $form->format_amount($myconfig, $form->parse_amount($myconfig, $form->{total}), 2);
+  $form->{total} = $form->format_amount($myconfig, $form->round_amount($form->{total}, 2), 2);
 
   $main::lxdebug->leave_sub();
   return {};