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->displayable_name;
29 foreach my $taxzonechart (@{ $all_taxzonecharts }) {
30 $list{ $taxzonechart->taxzone_id }{taxzone_chart_id} = $taxzonechart->id;
31 $list{ $taxzonechart->taxzone_id }{income_accno} = $taxzonechart->income_accno->accno;
32 $list{ $taxzonechart->taxzone_id }{expense_accno} = $taxzonechart->expense_accno->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->income_accno->displayable_name;
36 $list{ $taxzonechart->taxzone_id }{expense_accno_description} = $taxzonechart->expense_accno->displayable_name;
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->income_accno->accno;
51 $list{ $tzchart->buchungsgruppen_id }{expense_accno} = $tzchart->expense_accno->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->income_accno->displayable_name;
55 $list{ $tzchart->buchungsgruppen_id }{expense_accno_description} = $tzchart->expense_accno->displayable_name;