X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Frp.pl;h=5099c899551d9d1171fd3fad1b3dfba6f841674b;hb=7886b2fe17ddc184789bda2aca7f92998c6fc6cb;hp=a6308c69308d7f25e07db0d969fc7f45a81e71e8;hpb=0cd403228559232bfcdd3090398a65dab0b8338b;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index a6308c693..5099c8995 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -41,14 +41,16 @@ use SL::PE; use SL::RP; use SL::Iconv; use SL::ReportGenerator; +use Data::Dumper; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; -1; - -# end of main +# note: this file was particularly hard to strictify. +# alot of the vars are passed carelessly between invocations +# should there be any missing vars, declare them globally +use strict; # this is for our long dates # $locale->text('January') @@ -105,19 +107,30 @@ my $rp_access_map = { 'balance_sheet' => 'report', }; +# subs use these pretty freely, so declare them here +our (%column_data, @column_index); +our ($subtotalnetamount, $subtotaltax, $subtotal); + sub check_rp_access { + my $form = $main::form; + my $right = $rp_access_map->{$form->{report}}; $right ||= 'DOES_NOT_EXIST'; - $auth->assert($right); + $main::auth->assert($right); } sub report { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); check_rp_access(); - %title = ('balance_sheet' => 'Balance Sheet', + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my %title = ( + 'balance_sheet' => 'Balance Sheet', 'income_statement' => 'Income Statement', 'trial_balance' => 'Trial Balance', 'ar_aging' => 'AR Aging', @@ -129,23 +142,24 @@ sub report { 'receipts' => 'Receipts', 'payments' => 'Payments', 'projects' => 'Project Transactions', - 'bwa' => 'Betriebswirtschaftliche Auswertung',); + 'bwa' => 'Betriebswirtschaftliche Auswertung', + ); $form->{title} = $locale->text($title{ $form->{report} }); - $accrual = ($eur) ? "" : "checked"; - $cash = ($eur) ? "checked" : ""; + my $accrual = ($main::eur) ? "" : "checked"; + my $cash = ($main::eur) ? "checked" : ""; - $year = (localtime)[5] + 1900; + my $year = (localtime)[5] + 1900; # get departments $form->all_departments(\%myconfig); - if (@{ $form->{all_departments} }) { + if (@{ $form->{all_departments} || [] }) { $form->{selectdepartment} = "\n"; - map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" } @{ $form->{all_departments} }; + map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" } @{ $form->{all_departments} || [] }; } - $department = qq| + my $department = qq| | . $locale->text('Department') . qq| $form->{selectdepartment} @@ -163,13 +177,14 @@ sub report { } my $projectnumber = - NTI($cgi->popup_menu('-name' => "project_id", - '-values' => \@project_values, - '-labels' => \%project_labels)); + NTI($main::cgi->popup_menu('-name' => "project_id", + '-values' => \@project_values, + '-labels' => \%project_labels)); # use JavaScript Calendar or not $form->{jsscript} = 1; - $jsscript = ""; + my $jsscript = ""; + my ( $name_1, $id_1, $value_1, $trigger_1, $name_2, $id_2, $value_2, $trigger_2, ); if ($form->{report} eq "balance_sheet") { $name_1 = "asofdate"; $id_1 = "asofdate"; @@ -189,10 +204,10 @@ sub report { $value_2 = ""; $trigger_2 = "trigger2"; } elsif (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { - $name_1 = ""; - $id_1 = ""; - $value_1 = ""; - $trigger_1 = ""; + $name_1 = "fromdate"; + $id_1 = "fromdate"; + $value_1 = "$form->{fromdate}"; + $trigger_1 = "trigger1"; $name_2 = "todate"; $id_2 = "todate"; $value_2 = ""; @@ -209,6 +224,9 @@ sub report { $trigger_2 = "trigger2"; } + my ($button1, $button1_2, $button2, $button2_2); + my $checked; + # with JavaScript Calendar if ($form->{jsscript}) { if ($name_1 eq "") { @@ -238,7 +256,7 @@ sub report { } $form->{javascript} .= qq||; $form->header; - $onload = qq|focus()|; + my $onload = qq|focus()|; $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| @@ -464,7 +482,7 @@ $checked> | . $locale->text('Decimalplaces') . qq| - + $jsscript |; } @@ -601,7 +619,7 @@ $jsscript | . $locale->text('Decimalplaces') . qq| - + $jsscript |; } @@ -625,7 +643,7 @@ $jsscript |; $checked = "checked"; - foreach $ref (@{ $form->{taxaccounts} }) { + foreach my $ref (@{ $form->{taxaccounts} }) { print qq|{accno} $checked> $ref->{description} @@ -759,6 +777,7 @@ $jsscript } + my ($label, $nextsub, $vc); if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { if ($form->{report} eq 'ar_aging') { $label = $locale->text('Customer'); @@ -788,10 +807,12 @@ $jsscript $vc - | . $locale->text('Bis') . qq| - - $button1 - $button1_2 + | . $locale->text('From') . qq| + $button1 + $button1_2 + | . $locale->text('Bis') . qq| + $button2 + $button2_2 @@ -807,13 +828,14 @@ $jsscript # above action can be removed if there is more than one input field + my ($selection, $paymentaccounts); if ($form->{report} =~ /(receipts|payments)$/) { $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar"; RP->paymentaccounts(\%myconfig, \%$form); $selection = "\n"; - foreach $ref (@{ $form->{PR} }) { + foreach my $ref (@{ $form->{PR} }) { $paymentaccounts .= "$ref->{accno} "; $selection .= "$ref->{accno}--$ref->{description}\n"; } @@ -884,15 +906,19 @@ $jsscript