use POSIX qw(strftime);
+use SL::DB::Project;
use SL::PE;
use SL::RP;
use SL::Iconv;
use SL::ReportGenerator;
use Data::Dumper;
+use List::MoreUtils qw(any);
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
# $locale->text('Receipts')
# $locale->text('Payments')
# $locale->text('Project Transactions')
-# $locale->text('Non-taxable Sales')
-# $locale->text('Non-taxable Purchases')
# $locale->text('Business evaluation')
# $form->parse_html_template('rp/html_report_susa')
ap_aging => $::locale->text('Search AP Aging'),
tax_collected => $::locale->text('Tax collected'),
tax_paid => $::locale->text('Tax paid'),
- nontaxable_sales => $::locale->text('Non-taxable Sales'),
- nontaxable_purchases => $::locale->text('Non-taxable Purchases'),
receipts => $::locale->text('Receipts'),
payments => $::locale->text('Payments'),
projects => $::locale->text('Project Transactions'),
$::form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 });
- my $onload = qq|focus()|;
-
my $is_projects = $::form->{report} eq "projects";
my $is_income_statement = $::form->{report} eq "income_statement";
my $is_bwa = $::form->{report} eq "bwa";
vc => $vc,
label => $label,
year => DateTime->today->year,
- onload => $onload,
+ today => DateTime->today,
nextsub => $nextsub,
accrual => $::instance_conf->get_accounting_method ne 'cash',
cash => $::instance_conf->get_accounting_method eq 'cash',
sub continue { call_sub($main::form->{"nextsub"}); }
-sub get_project {
- $main::lxdebug->enter_sub();
-
- $main::auth->assert('report');
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- my $nextsub = shift;
-
- $form->{project_id} = $form->{project_id_1};
- if ($form->{projectnumber} && !$form->{project_id}) {
- $form->{rowcount} = 1;
-
- # call this instead of update
- $form->{update} = $nextsub;
- $form->{projectnumber_1} = $form->{projectnumber};
-
- delete $form->{sort};
- check_project('generate_projects');
-
- # if there is one only, assign id
- $form->{project_id} = $form->{project_id_1};
- }
-
- $main::lxdebug->leave_sub();
-}
-
sub generate_income_statement {
$main::lxdebug->enter_sub();
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- &get_project("generate_projects");
- $form->{projectnumber} = $form->{projectnumber_1};
+ my $project = $form->{project_id} ? SL::DB::Project->new(id => $form->{project_id})->load : undef;
+ $form->{projectnumber} = $project ? $project->projectnumber : '';
$form->{nextsub} = "generate_projects";
$form->{title} = $locale->text('Project Transactions');