5 use SL::DB::MetaSetup::Chart;
 
   6 use SL::DB::Manager::Chart;
 
   9 __PACKAGE__->meta->add_relationships(taxkeys => { type         => 'one to many',
 
  10                                                   class        => 'SL::DB::TaxKey',
 
  11                                                   column_map   => { id => 'chart_id' },
 
  15 __PACKAGE__->meta->initialize;
 
  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];
 
  35 SL::DB::Chart - Rose database model for the "chart" table
 
  41 =item C<get_active_taxkey $date>
 
  43 Returns the active tax key object for a given date. C<$date> defaults
 
  44 to the current date if undefined.
 
  54 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>