Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f9c38bb5

Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt

  • ID f9c38bb500ccca3411ea42cce9f040be60791f9d
  • Vorgänger 958c1727
  • Nachfolger a96b6e95

Zeiterfassung: Summe der Dauern mit Kontroll-Zeile anzeigen

Unterschiede anzeigen:

SL/Controller/TimeRecording.pm
5 5

  
6 6
use DateTime;
7 7
use English qw(-no_match_vars);
8
use List::Util qw(sum0);
8 9
use POSIX qw(strftime);
9 10

  
10 11
use SL::Controller::Helper::GetModels;
11 12
use SL::Controller::Helper::ReportGenerator;
13
use SL::Controller::Helper::ReportGenerator::ControlRow qw(make_control_row);
12 14
use SL::DB::Customer;
13 15
use SL::DB::Employee;
14 16
use SL::DB::Order;
......
17 19
use SL::DB::TimeRecording;
18 20
use SL::DB::TimeRecordingArticle;
19 21
use SL::Helper::Flash qw(flash);
20
use SL::Helper::Number qw(_round_number _parse_number);
22
use SL::Helper::Number qw(_round_number _parse_number _round_total);
21 23
use SL::Helper::UserPreferences::TimeRecording;
22 24
use SL::Locale::String qw(t8);
23 25
use SL::ReportGenerator;
......
63 65
  $self->make_filter_summary;
64 66
  $self->prepare_report;
65 67

  
66
  $self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get);
68
  my $objects = $self->models->get;
69

  
70
  my $total   = sum0 map { _round_total($_->duration_in_hours) } @$objects;
71
  my $total_h = int($total);
72
  my $total_m = int($total * 60.0 + 0.5) % 60;
73
  my $total_s = sprintf('%d:%02d', $total_h, $total_m);
74

  
75
  push @$objects, make_control_row("separator");
76
  push @$objects, make_control_row("data",
77
                                   row => {
78
                                     map( { $_ => {class => 'listtotal'} } keys %{$self->{report}->{columns}} ),
79
                                     description => {data => t8('Total'), class => 'listtotal'},
80
                                     duration    => {data => $total_s,    class => 'listtotal'}
81
                                   });
82

  
83
  $self->report_generator_list_objects(report => $self->{report}, objects => $objects);
67 84
}
68 85

  
69 86
sub action_edit {

Auch abrufbar als: Unified diff