X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Frp.pl;h=d6c5532baf08b066998ef28cfc315f0bdad194a0;hb=d79dde5a461087ffc71da63bb3764745571a4a60;hp=8ec6c45037ca385450d7cfa32c7c8af5cce83931;hpb=b021f0f5808d9a3b02ddc7f13c206ebc88387ff1;p=kivitendo-erp.git
diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl
index 8ec6c4503..d6c5532ba 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;
@@ -100,15 +101,16 @@ use strict;
# $form->parse_html_template('rp/html_report_susa')
my $rp_access_map = {
- 'projects' => 'report',
- 'ar_aging' => 'general_ledger',
- 'ap_aging' => 'general_ledger',
- 'receipts' => 'cash',
- 'payments' => 'cash',
- 'trial_balance' => 'report',
- 'income_statement' => 'report',
- 'bwa' => 'report',
- 'balance_sheet' => 'report',
+ 'projects' => 'report',
+ 'ar_aging' => 'general_ledger',
+ 'ap_aging' => 'general_ledger',
+ 'receipts' => 'cash',
+ 'payments' => 'cash',
+ 'trial_balance' => 'report',
+ 'income_statement' => 'report',
+ 'erfolgsrechnung' => 'report',
+ 'bwa' => 'report',
+ 'balance_sheet' => 'report',
};
sub check_rp_access {
@@ -128,6 +130,7 @@ sub report {
my %title = (
balance_sheet => $::locale->text('Balance Sheet'),
income_statement => $::locale->text('Income Statement'),
+ erfolgsrechnung => $::locale->text('Erfolgsrechnung'),
trial_balance => $::locale->text('Trial Balance'),
ar_aging => $::locale->text('Search AR Aging'),
ap_aging => $::locale->text('Search AP Aging'),
@@ -140,6 +143,10 @@ sub report {
);
$::form->{title} = $title{$::form->{report}};
+ $::request->{layout}->add_javascripts('autocomplete_customer.js');
+ $::request->{layout}->add_javascripts('autocomplete_project.js');
+ $::form->{fromdate} = DateTime->today->truncate(to => 'year')->to_kivitendo;
+ $::form->{todate} = DateTime->today->truncate(to => 'year')->add(years => 1)->add(days => -1)->to_kivitendo;
# get departments
$::form->all_departments(\%::myconfig);
@@ -150,13 +157,14 @@ sub report {
$::form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 });
- my $is_projects = $::form->{report} eq "projects";
- my $is_income_statement = $::form->{report} eq "income_statement";
- my $is_bwa = $::form->{report} eq "bwa";
- my $is_balance_sheet = $::form->{report} eq "balance_sheet";
- my $is_trial_balance = $::form->{report} eq "trial_balance";
- my $is_aging = $::form->{report} =~ /^a[rp]_aging$/;
- my $is_payments = $::form->{report} =~ /(receipts|payments)$/;
+ my $is_projects = $::form->{report} eq "projects";
+ my $is_income_statement = $::form->{report} eq "income_statement";
+ my $is_erfolgsrechnung = $::form->{report} eq "erfolgsrechnung";
+ my $is_bwa = $::form->{report} eq "bwa";
+ my $is_balance_sheet = $::form->{report} eq "balance_sheet";
+ my $is_trial_balance = $::form->{report} eq "trial_balance";
+ my $is_aging = $::form->{report} =~ /^a[rp]_aging$/;
+ my $is_payments = $::form->{report} =~ /(receipts|payments)$/;
my ($label, $nextsub, $vc);
if ($is_aging) {
@@ -189,22 +197,21 @@ sub report {
$::form->header;
print $::form->parse_html_template('rp/report', {
- paymentaccounts => $paymentaccounts,
- selection => $selection,
- is_aging => $is_aging,
- vc => $vc,
- label => $label,
- year => DateTime->today->year,
- today => DateTime->today,
- nextsub => $nextsub,
- accrual => $::instance_conf->get_accounting_method ne 'cash',
- cash => $::instance_conf->get_accounting_method eq 'cash',
- is_payments => $is_payments,
- is_trial_balance => $is_trial_balance,
- is_balance_sheet => $is_balance_sheet,
- is_bwa => $is_bwa,
- is_income_statement => $is_income_statement,
- is_projects => $is_projects,
+ paymentaccounts => $paymentaccounts,
+ selection => $selection,
+ is_aging => $is_aging,
+ vc => $vc,
+ label => $label,
+ year => DateTime->today->year,
+ today => DateTime->today,
+ nextsub => $nextsub,
+ is_payments => $is_payments,
+ is_trial_balance => $is_trial_balance,
+ is_balance_sheet => $is_balance_sheet,
+ is_bwa => $is_bwa,
+ is_income_statement => $is_income_statement,
+ is_erfolgsrechnung => $is_erfolgsrechnung,
+ is_projects => $is_projects,
});
$::lxdebug->leave_sub;
@@ -221,10 +228,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} = "";
@@ -399,6 +402,25 @@ sub generate_income_statement {
$main::lxdebug->leave_sub();
}
+sub generate_erfolgsrechnung {
+ $::lxdebug->enter_sub;
+ $::auth->assert('report');
+
+ $::form->{decimalplaces} = $::form->{decimalplaces} * 1 || 2;
+ $::form->{padding} = " ";
+ $::form->{bold} = "";
+ $::form->{endbold} = "";
+ $::form->{br} = "
";
+
+ my $data = RP->erfolgsrechnung(\%::myconfig, $::form);
+
+ $::form->header();
+ print $::form->parse_html_template('rp/erfolgsrechnung', $data);
+
+ $::lxdebug->leave_sub;
+}
+
+
sub generate_balance_sheet {
$::lxdebug->enter_sub;
$::auth->assert('report');
@@ -634,6 +656,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);
@@ -984,7 +1011,7 @@ sub aging {
$report->set_columns(%column_defs);
$report->set_column_order(@columns);
- my @hidden_variables = qw(todate customer vendor arap title ct fordate reporttype);
+ my @hidden_variables = qw(todate customer vendor arap title ct fordate reporttype department);
$report->set_export_options('generate_' . ($form->{arap} eq 'ar' ? 'ar' : 'ap') . '_aging', @hidden_variables);
my @options;
@@ -1128,7 +1155,6 @@ sub e_mail {
$::form->header;
print $::form->parse_html_template('rp/e_mail', {
- show_bcc => $::auth->assert('email_bcc', 'may fail'),
print_options => print_options(inline => 1),
hidden_values => \@hidden_values,
});
@@ -1627,8 +1653,6 @@ sub print_options {
$::form->{SM}{ $::form->{sendmode} } = "selected";
my $output = $::form->parse_html_template('rp/print_options', {
- got_printer => $::myconfig{printer},
- show_latex => $::lx_office_conf{print_templates}->{latex},
is_email => $::form->{media} eq 'email',
});
@@ -1793,8 +1817,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);
@@ -1847,6 +1870,7 @@ sub generate_bwa {
$form->{title} = $locale->text('BWA');
+ $::request->layout->add_stylesheets('bwa.css');
$form->header;
print $form->parse_html_template('rp/bwa');