-sub init_accounts {
- my %accounts;
-
- foreach my $chart (@{ SL::DB::Manager::Chart->get_all(where => [ link => { like => '%IC%' } ], sort_by => 'accno ASC') }) {
- my %added;
-
- foreach my $link (split m/:/, $chart->link) {
- my $key = lc($link =~ /cogs/ ? 'IC_expense' : $link =~ /sale/ ? 'IC_income' : $link);
- next if $added{$key};
-
- $added{$key} = 1;
- $accounts{$key} ||= [];
- push @{ $accounts{$key} }, $chart;
- }
- }