Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e2013e83

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID e2013e83d2ada0ba4ca439d972dbeaf56cbc16c0
  • Vorgänger eb0d6c3a
  • Nachfolger 37171c70

Chart-Model: Hilfsfunktion zum Auslesen des an einem Datum gültigen Steuerschlüssels

Unterschiede anzeigen:

SL/DB/Chart.pm
3 3
use strict;
4 4

  
5 5
use SL::DB::MetaSetup::Chart;
6
use SL::DB::TaxKey;
6 7

  
8
__PACKAGE__->meta->add_relationships(taxkeys => { type         => 'one to many',
9
                                                  class        => 'SL::DB::TaxKey',
10
                                                  column_map   => { id => 'chart_id' },
11
                                                },
12
                                    );
13

  
14
__PACKAGE__->meta->initialize;
7 15
__PACKAGE__->meta->make_manager_class;
8 16

  
17
sub get_active_taxkey {
18
  my ($self, $date) = @_;
19
  $date ||= DateTime->today_local;
20
  return SL::DB::Manager::TaxKey->get_all(where   => [ and => [ chart_id  => $self->id,
21
                                                                startdate => { le => $date } ] ],
22
                                          sort_by => "startdate DESC")->[0];
23
}
24

  
9 25
1;
26

  
27
__END__
28

  
29
=pod
30

  
31
=encoding utf8
32

  
33
=head1 NAME
34

  
35
SL::DB::Chart - Rose database model for the "chart" table
36

  
37
=head1 FUNCTIONS
38

  
39
=over 4
40

  
41
=item C<get_active_taxkey $date>
42

  
43
Returns the active tax key object for a given date. C<$date> defaults
44
to the current date if undefined.
45

  
46
=back
47

  
48
=head1 BUGS
49

  
50
Nothing here yet.
51

  
52
=head1 AUTHOR
53

  
54
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
55

  
56
=cut

Auch abrufbar als: Unified diff