X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=02023f532089bf39fc32626ad609a867c7519357;hb=24e7a52fe57b6bd9d1158595d2465613aec0a52b;hp=da60add0dc32ec1c8400a1a7d150635e08e1499b;hpb=56911d6832f011555add955dc905e6e72ac2db65;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index da60add0d..02023f532 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -39,6 +39,7 @@ use POSIX qw(strftime); use SL::DB::Default; use SL::DB::Project; +use SL::DB::Customer; use SL::PE; use SL::RP; use SL::Iconv; @@ -140,6 +141,7 @@ sub report { ); $::form->{title} = $title{$::form->{report}}; + $::request->{layout}->add_javascripts('autocomplete_customer.js'); # get departments $::form->all_departments(\%::myconfig); @@ -221,10 +223,6 @@ sub generate_income_statement { my %myconfig = %main::myconfig; my $locale = $main::locale; - my $defaults = SL::DB::Default->get; - $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; - $form->{templates} = $defaults->templates; - $form->{padding} = "  "; $form->{bold} = ""; $form->{endbold} = ""; @@ -375,9 +373,26 @@ sub generate_income_statement { . qq| $longcomparetodate|; } - $form->{IN} = "income_statement.html"; + if ( $::instance_conf->get_profit_determination eq 'balance' ) { + $form->{title} = $locale->text('Income Statement'); + } elsif ( $::instance_conf->get_profit_determination eq 'income' ) { + $form->{title} = $locale->text('Net Income Statement'); + } else { + $form->{title} = ""; + }; - $form->parse_template; + if ( $form->{method} eq 'cash' ) { + $form->{accounting_method} = $locale->text('Cash accounting'); + } elsif ( $form->{method} eq 'accrual' ) { + $form->{accounting_method} = $locale->text('Accrual accounting'); + } else { + $form->{accounting_method} = ""; + }; + + $form->{report_date} = $locale->text('Report date') . ": " . $form->current_date; + + $form->header; + print $form->parse_html_template('rp/income_statement'); $main::lxdebug->leave_sub(); } @@ -386,9 +401,6 @@ sub generate_balance_sheet { $::lxdebug->enter_sub; $::auth->assert('report'); - my $defaults = SL::DB::Default->get; - $::form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; - $::form->{templates} = $defaults->templates; $::form->{decimalplaces} = $::form->{decimalplaces} * 1 || 2; $::form->{padding} = "  "; $::form->{bold} = ""; @@ -397,8 +409,9 @@ sub generate_balance_sheet { my $data = RP->balance_sheet(\%::myconfig, $::form); - $::form->{asofdate} ||= $::form->current_date; - $::form->{period} = $::locale->date(\%::myconfig, $::form->current_date, 1); + $::form->{asofdate} ||= $::form->current_date; + $::form->{report_title} = $::locale->text('Balance Sheet'); + $::form->{report_date} ||= $::form->current_date; ($::form->{department}) = split /--/, $::form->{department}; @@ -409,6 +422,8 @@ sub generate_balance_sheet { $::form->{this_period} = $::locale->date(\%::myconfig, $::form->{asofdate}, 0); $::form->{last_period} = $::locale->date(\%::myconfig, $::form->{compareasofdate}, 0); +# balance sheet isn't read from print templates anymore, +# instead use template in rp # $::form->{IN} = "balance_sheet.html"; $::form->header; @@ -617,6 +632,11 @@ sub generate_trial_balance { $form->{company} = $locale->text('Company') . " " . $defaults->company; push (@options, $form->{company}); + if ($::form->{customer_id}) { + my $customer = SL::DB::Manager::Customer->find_by(id => $::form->{customer_id}); + push @options, $::locale->text('Customer') . ' ' . $customer->displayable_name; + } + $form->{template_to} = $locale->date(\%myconfig, $form->{todate}, 0); @@ -1631,10 +1651,6 @@ sub generate_bwa { my %myconfig = %main::myconfig; my $locale = $main::locale; - my $defaults = SL::DB::Default->get; - $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; - $form->{templates} = $defaults->templates; - $form->{padding} = "  "; $form->{bold} = ""; $form->{endbold} = ""; @@ -1780,8 +1796,7 @@ sub generate_bwa { # if (defined ($form->{fromdate|todate}=='..')) # immer wahr if ($form->{fromdate}){ - my ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate}); - my $datetime = $locale->parse_date_to_object(\%myconfig, $form->{fromdate}); + my $datetime = $locale->parse_date_to_object($form->{fromdate}); $datetime->set( month => 1, day => 1); $form->{comparefromdate} = $locale->format_date(\%::myconfig, $datetime); @@ -1822,9 +1837,21 @@ sub generate_bwa { . qq| $longtodate|; } - $form->{IN} = "bwa.html"; + $form->{report_date} = $locale->text('Report date') . ": " . $form->current_date; + + if ( $form->{method} eq 'cash' ) { + $form->{accounting_method} = $locale->text('Cash accounting'); + } elsif ( $form->{method} eq 'accrual' ) { + $form->{accounting_method} = $locale->text('Accrual accounting'); + } else { + $form->{accounting_method} = ""; + }; + + $form->{title} = $locale->text('BWA'); - $form->parse_template; + $::request->layout->add_stylesheets('bwa.css'); + $form->header; + print $form->parse_html_template('rp/bwa'); $main::lxdebug->leave_sub(); }