1 package SL::DB::Buchungsgruppe;
5 use SL::DB::MetaSetup::Buchungsgruppe;
6 use SL::DB::Manager::Buchungsgruppe;
8 __PACKAGE__->meta->add_relationship(
10 type => 'many to one',
11 class => 'SL::DB::Chart',
12 column_map => { inventory_accno_id => 'id' },
16 __PACKAGE__->meta->initialize;
20 my ($self, $taxzone) = @_;
21 my $taxzone_id = ref $taxzone && $taxzone->isa('SL::DB::TaxZone') ? $taxzone->id : $taxzone;
22 my $taxzone_chart = SL::DB::Manager::TaxzoneChart->find_by(taxzone_id => $taxzone_id, buchungsgruppen_id => $self->id);
23 return $taxzone_chart->income_accno_id if $taxzone_chart;
26 sub expense_accno_id {
27 my ($self, $taxzone) = @_;
28 my $taxzone_id = ref $taxzone && $taxzone->isa('SL::DB::TaxZone') ? $taxzone->id : $taxzone;
29 my $taxzone_chart = SL::DB::Manager::TaxzoneChart->find_by(taxzone_id => $taxzone_id, buchungsgruppen_id => $self->id);
30 return $taxzone_chart->expense_accno_id if $taxzone_chart;
34 my ($self, $taxzone) = @_;
35 my $taxzone_id = ref $taxzone && $taxzone->isa('SL::DB::TaxZone') ? $taxzone->id : $taxzone;
36 my $taxzone_chart = SL::DB::Manager::TaxzoneChart->find_by(taxzone_id => $taxzone_id, buchungsgruppen_id => $self->id);
37 return $taxzone_chart->income_accno if $taxzone_chart;
41 my ($self, $taxzone) = @_;
42 my $taxzone_id = ref $taxzone && $taxzone->isa('SL::DB::TaxZone') ? $taxzone->id : $taxzone;
43 my $taxzone_chart = SL::DB::Manager::TaxzoneChart->find_by(taxzone_id => $taxzone_id, buchungsgruppen_id => $self->id);
44 return $taxzone_chart->expense_accno if $taxzone_chart;
56 SL::DB::Buchungsgruppe - RDBO wrapper for the C<buchungsgruppen> table
62 =item C<expense_accno_id $taxzone>
64 Return the chart ID for the expense account for the given taxzone
65 (either an integer between 0 and 3 inclusively or an instance of
68 =item C<expense_account>
70 Return the chart (an instance of L<SL::DB::Chart>) for the expense
71 account for the given taxzone (either an integer between 0 and 3
72 inclusively or an instance of L<SL::DB::TaxZone>).
74 =item C<income_accno_id>
76 Return the chart ID for the income account for the given taxzone
77 (either an integer between 0 and 3 inclusively or an instance of
80 =item C<income_account>
82 Return the chart (an instance of L<SL::DB::Chart>) for the income
83 account for the given taxzone (either an integer between 0 and 3
84 inclusively or an instance of L<SL::DB::TaxZone>).
94 Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>,
95 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>