1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
4 package SL::DB::TaxzoneChart;
8 use SL::DB::MetaSetup::TaxzoneChart;
9 use SL::DB::Manager::TaxzoneChart;
10 use SL::DB::MetaSetup::Buchungsgruppe;
12 __PACKAGE__->meta->initialize;
14 # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
15 #__PACKAGE__->meta->make_manager_class;
17 sub get_all_accounts_by_buchungsgruppen_id {
18 my ($self, $buchungsgruppen_id) = @_;
20 my $all_taxzonecharts = SL::DB::Manager::TaxzoneChart->get_all(where => [ buchungsgruppen_id => $buchungsgruppen_id ],
21 sort_by => 'taxzone_id');
25 # inventory_accno and description of the Buchungsgruppe:
26 $list{inventory_accno} = SL::DB::Manager::Buchungsgruppe->find_by(id => $buchungsgruppen_id)->inventory_account->accno;
27 $list{inventory_accno_description} = SL::DB::Manager::Buchungsgruppe->find_by(id => $buchungsgruppen_id)->inventory_account->description;
29 foreach my $taxzonechart (@{ $all_taxzonecharts }) {
30 $list{ $taxzonechart->taxzone_id }{taxzone_chart_id} = $taxzonechart->id;
31 $list{ $taxzonechart->taxzone_id }{income_accno} = $taxzonechart->get_income_accno;
32 $list{ $taxzonechart->taxzone_id }{expense_accno} = $taxzonechart->get_expense_accno;
33 $list{ $taxzonechart->taxzone_id }{income_accno_id} = $taxzonechart->income_accno_id;
34 $list{ $taxzonechart->taxzone_id }{expense_accno_id} = $taxzonechart->expense_accno_id;
35 $list{ $taxzonechart->taxzone_id }{income_accno_description} = $taxzonechart->get_income_accno_description;
36 $list{ $taxzonechart->taxzone_id }{expense_accno_description} = $taxzonechart->get_expense_accno_description;
41 sub get_all_accounts_by_taxzone_id {
42 my ($self, $taxzone_id) = @_;
44 my $all_taxzonecharts = SL::DB::Manager::TaxzoneChart->get_all(where => [ taxzone_id => $taxzone_id ]);
48 foreach my $tzchart (@{ $all_taxzonecharts }) {
49 $list{ $tzchart->buchungsgruppen_id }{taxzone_chart_id} = $tzchart->id;
50 $list{ $tzchart->buchungsgruppen_id }{income_accno} = $tzchart->get_income_accno;
51 $list{ $tzchart->buchungsgruppen_id }{expense_accno} = $tzchart->get_expense_accno;
52 $list{ $tzchart->buchungsgruppen_id }{income_accno_id} = $tzchart->income_accno_id;
53 $list{ $tzchart->buchungsgruppen_id }{expense_accno_id} = $tzchart->expense_accno_id;
54 $list{ $tzchart->buchungsgruppen_id }{income_accno_description} = $tzchart->get_income_accno_description;
55 $list{ $tzchart->buchungsgruppen_id }{expense_accno_description} = $tzchart->get_expense_accno_description;
61 sub get_income_accno {
63 require SL::DB::Manager::Chart;
64 return SL::DB::Manager::Chart->find_by(id => $self->income_accno_id)->accno();
67 sub get_expense_accno {
69 require SL::DB::Manager::Chart;
70 return SL::DB::Manager::Chart->find_by(id => $self->expense_accno_id)->accno();
73 sub get_income_accno_description {
75 require SL::DB::Manager::Chart;
76 return SL::DB::Manager::Chart->find_by(id => $self->income_accno_id)->description();
79 sub get_expense_accno_description {
81 require SL::DB::Manager::Chart;
82 return SL::DB::Manager::Chart->find_by(id => $self->expense_accno_id)->description();