X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=d455d5aae5f9ca221095dcdc146d016f61e75fb6;hb=937e37ad007405c6a3a389ee18006379ffecc073;hp=e15ac78f4668a36ee943c44c1d14f9b3658eb011;hpb=886784c7110d11a8163a1c517f07cd82d790f4be;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index e15ac78f4..d455d5aae 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -37,11 +37,13 @@ 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"; @@ -92,8 +94,6 @@ use strict; # $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') @@ -132,8 +132,6 @@ sub report { 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'), @@ -151,27 +149,14 @@ sub report { $::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"; my $is_balance_sheet = $::form->{report} eq "balance_sheet"; my $is_trial_balance = $::form->{report} eq "trial_balance"; - my $is_taxreport = $::form->{report} =~ /^tax_/; - my $is_nontaxable = $::form->{report} =~ /^nontaxable_/; my $is_aging = $::form->{report} =~ /^a[rp]_aging$/; my $is_payments = $::form->{report} =~ /(receipts|payments)$/; -# if (is_taxreport) { -# $::form->{db} = ($::form->{report} =~ /_collected/) ? "ar" : "ap"; -# RP->get_taxaccounts(\%::myconfig, $::form); -# } -# -# if ($is_nontaxable) { -# $::form->{db} = ($::form->{report} =~ /_sales/) ? "ar" : "ap"; -# } - my ($label, $nextsub, $vc); if ($is_aging) { my $is_sales = $::form->{report} eq 'ar_aging'; @@ -209,7 +194,7 @@ sub report { 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', @@ -226,35 +211,6 @@ sub report { 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(); @@ -473,8 +429,8 @@ sub generate_projects { 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'); @@ -655,7 +611,7 @@ sub generate_trial_balance { my @options; - $form->{template_fromto} = $locale->date(\%myconfig, $form->{fromdate}, 0) . "  -  " . $locale->date(\%myconfig, $form->{todate}, 0); + $form->{template_fromto} = $locale->date(\%myconfig, $form->{fromdate}, 0) . " - " . $locale->date(\%myconfig, $form->{todate}, 0); $form->{print_date} = $locale->text('Create Date') . " " . $locale->date(\%myconfig, $form->current_date(\%myconfig), 0); push (@options, $form->{print_date}); @@ -666,6 +622,28 @@ sub generate_trial_balance { $form->{template_to} = $locale->date(\%myconfig, $form->{todate}, 0); + my @custom_headers = ([ + { text => $::locale->text('Account'), rowspan => 2, }, + { text => $::locale->text('Description'), rowspan => 2, }, + { text => $::locale->text('Last Transaction'), rowspan => 2, }, + { text => $::locale->text('Starting Balance'), colspan => 2, }, + { text => $::locale->text('Sum for') . " $form->{template_fromto}", colspan => 2, }, + { text => $::locale->text('Sum per') . " $form->{template_to}", colspan => 2, }, + { text => $::locale->text('Saldo per') . " $form->{template_to}", colspan => 2, }, + ], [ + { text => '', }, + { text => '', }, + { text => '', }, + { text => $::locale->text('Assets'), }, + { text => $::locale->text('Equity'), }, + { text => $::locale->text('Debit'), }, + { text => $::locale->text('Credit'), }, + { text => $::locale->text('Debit'), }, + { text => $::locale->text('Credit'), }, + { text => $::locale->text('Debit'), }, + { text => $::locale->text('Credit'), }, + ]); + $report->set_options('output_format' => 'HTML', 'top_info_text' => join("\n", @options), 'title' => $form->{title}, @@ -673,6 +651,7 @@ sub generate_trial_balance { 'html_template' => 'rp/html_report_susa', 'pdf_template' => 'rp/html_report_susa', ); + $report->set_custom_headers(@custom_headers); $report->set_options_from_form(); $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; @@ -990,7 +969,7 @@ sub aging { $report->set_columns(%column_defs); $report->set_column_order(@columns); - my @hidden_variables = qw(todate customer vendor arap title ct); + my @hidden_variables = qw(todate customer vendor arap title ct fordate reporttype); $report->set_export_options('generate_' . ($form->{arap} eq 'ar' ? 'ar' : 'ap') . '_aging', @hidden_variables); my @options; @@ -1386,8 +1365,8 @@ sub generate_tax_report { # if there are any dates if ($::form->{fromdate} || $::form->{todate}) { - my $fromdate = $::locale->date(\%::myconfig, $::form->{fromdate}, 1) if $::form->{fromdate}; - my $todate = $::locale->date(\%::myconfig, $::form->{todate}, 1) if $::form->{todate}; + my $fromdate = $::form->{fromdate} ? $::locale->date(\%::myconfig, $::form->{fromdate}, 1) : ''; + my $todate = $::form->{todate} ? $::locale->date(\%::myconfig, $::form->{todate}, 1) : ''; push @options, "$fromdate - $todate"; } else { push @options, $::locale->date(\%::myconfig, $::form->current_date, 1);