X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Frp.pl;h=96a425d8ca1136aadf7f2628effc42cd33295f7c;hb=6768ddad54d2a675939e1167536f4943628de2bb;hp=ae2669fe35e046fe31384899138b3178f83a5ae4;hpb=a648b673fcb23982d6fecb0c0f97a40c0636a601;p=kivitendo-erp.git
diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl
index ae2669fe3..96a425d8c 100644
--- a/bin/mozilla/rp.pl
+++ b/bin/mozilla/rp.pl
@@ -101,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 {
@@ -129,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'),
@@ -142,6 +144,9 @@ 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);
@@ -152,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) {
@@ -191,20 +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,
- 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;
@@ -395,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');
@@ -442,6 +468,18 @@ sub generate_projects {
my $project = $form->{project_id} ? SL::DB::Project->new(id => $form->{project_id})->load : undef;
$form->{projectnumber} = $project ? $project->projectnumber : '';
+ # make sure todate and fromdate always have a value, even if the date fields
+ # were left empty or the inputs weren't valid dates/couldn't be parsed
+
+ $project = SL::DB::Project->new() unless $project; # dummy object for dbh
+ unless ($::locale->parse_date_to_object($::form->{fromdate})) {
+ ($form->{fromdate}) = $project->db->dbh->selectrow_array('select min(transdate) from acc_trans');
+ };
+
+ unless ($::locale->parse_date_to_object($::form->{todate})) {
+ ($form->{todate}) = $project->db->dbh->selectrow_array('select max(transdate) from acc_trans');
+ };
+
$form->{nextsub} = "generate_projects";
$form->{title} = $locale->text('Project Transactions');
RP->trial_balance(\%myconfig, \%$form);
@@ -985,7 +1023,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;