+sub init_inventory_options {
+ [ { title => t8("perpetual"), value => "perpetual" },
+ { title => t8("periodic"), value => "periodic" }, ]
+}
+
+sub init_profit_options {
+ [ { title => t8("balance"), value => "balance" },
+ { title => t8("income"), value => "income" }, ]
+}
+
+sub init_balance_startdate_method_options {
+ [ { title => t8("After closed period"), value => "closed_to" },
+ { title => t8("Start of year"), value => "start_of_year" },
+ { title => t8("All transactions"), value => "all_transactions" },
+ { title => t8("Last opening balance or all transactions"), value => "last_ob_or_all_transactions" },
+ { title => t8("Last opening balance or start of year"), value => "last_ob_or_start_of_year" }, ]
+}
+
+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;
+ }
+ }
+
+ $accounts{fx_gain} = SL::DB::Manager::Chart->get_all(where => [ category => 'I', charttype => 'A' ], sort_by => 'accno ASC');
+ $accounts{fx_loss} = SL::DB::Manager::Chart->get_all(where => [ category => 'E', charttype => 'A' ], sort_by => 'accno ASC');
+ $accounts{ar_paid} = SL::DB::Manager::Chart->get_all(where => [ link => { like => '%AR_paid%' } ], sort_by => 'accno ASC');