X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Frp.pl;h=db1473ed58b20a614f40e641a0804a540392848d;hb=2dacd2790bb5e0990ec5fe89a9d59370b018c25c;hp=391a9009446d8f2c02eed12162ca8a82d02fadcc;hpb=a0f6a00c1db8152633841777a95f5420b56b42ee;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 391a90094..db1473ed5 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -35,16 +35,22 @@ # #====================================================================== -require "$form->{path}/arap.pl"; -require "bin/mozilla/common.pl"; +use POSIX qw(strftime); use SL::PE; use SL::RP; -use SL::USTVA; +use SL::Iconv; +use SL::ReportGenerator; +use Data::Dumper; -1; +require "bin/mozilla/arap.pl"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/reportgenerator.pl"; -# 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') @@ -87,10 +93,44 @@ use SL::USTVA; # $locale->text('Non-taxable Sales') # $locale->text('Non-taxable Purchases') +# $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', +}; + +# 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'; + + $main::auth->assert($right); +} + sub report { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + check_rp_access(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; - %title = ('balance_sheet' => 'Balance Sheet', + my %title = ( + 'balance_sheet' => 'Balance Sheet', 'income_statement' => 'Income Statement', 'trial_balance' => 'Trial Balance', 'ar_aging' => 'AR Aging', @@ -103,29 +143,23 @@ sub report { 'payments' => 'Payments', 'projects' => 'Project Transactions', 'bwa' => 'Betriebswirtschaftliche Auswertung', - 'ustva' => 'Umsatzsteuervoranmeldung',); + ); $form->{title} = $locale->text($title{ $form->{report} }); - $accrual = ($eur) ? "" : "checked"; - $cash = ($eur) ? "checked" : ""; + my $accrual = ($main::eur) ? "" : "checked"; + my $cash = ($main::eur) ? "checked" : ""; - ($null, $null, $null, $null, $null, $year, $null, $null, $null) = - localtime(); - $year += 1900; + my $year = (localtime)[5] + 1900; # get departments $form->all_departments(\%myconfig); 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} @@ -143,105 +177,86 @@ 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} = $jscalendar; - $jsscript = ""; - if ($form->{report} eq "ustva") { - $department = ""; + $form->{jsscript} = 1; + 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"; + $value_1 = "$form->{asofdate}"; + $trigger_1 = "trigger1"; + $name_2 = "compareasofdate"; + $id_2 = "compareasofdate"; + $value_2 = "$form->{compareasofdate}"; + $trigger_2 = "trigger2"; + } elsif ($form->{report} =~ /(receipts|payments)$/) { + $name_1 = "fromdate"; + $id_1 = "fromdate"; + $value_1 = "$form->{fromdate}"; + $trigger_1 = "trigger1"; + $name_2 = "todate"; + $id_2 = "todate"; + $value_2 = ""; + $trigger_2 = "trigger2"; + } elsif (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { + $name_1 = "fromdate"; + $id_1 = "fromdate"; + $value_1 = "$form->{fromdate}"; + $trigger_1 = "trigger1"; + $name_2 = "todate"; + $id_2 = "todate"; + $value_2 = ""; + $trigger_2 = "trigger2"; + } else { - if ($form->{report} eq "balance_sheet") { - $name_1 = "asofdate"; - $id_1 = "asofdate"; - $value_1 = "$form->{asofdate}"; - $trigger_1 = "trigger1"; - $name_2 = "compareasofdate"; - $id_2 = "compareasofdate"; - $value_2 = "$form->{compareasofdate}"; - $trigger_2 = "trigger2"; - } elsif ($form->{report} =~ /(receipts|payments)$/) { - $name_1 = "fromdate"; - $id_1 = "fromdate"; - $value_1 = "$form->{fromdate}"; - $trigger_1 = "trigger1"; - $name_2 = "todate"; - $id_2 = "todate"; - $value_2 = ""; - $trigger_2 = "trigger2"; - } else { - if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { - $name_1 = ""; - $id_1 = ""; - $value_1 = ""; - $trigger_1 = ""; - $name_2 = "todate"; - $id_2 = "todate"; - $value_2 = ""; - $trigger_2 = "trigger2"; - - } else { - $name_1 = "fromdate"; - $id_1 = "fromdate"; - $value_1 = "$form->{fromdate}"; - $trigger_1 = "trigger1"; - $name_2 = "todate"; - $id_2 = "todate"; - $value_2 = ""; - $trigger_2 = "trigger2"; - } - } + $name_1 = "fromdate"; + $id_1 = "fromdate"; + $value_1 = "$form->{fromdate}"; + $trigger_1 = "trigger1"; + $name_2 = "todate"; + $id_2 = "todate"; + $value_2 = ""; + $trigger_2 = "trigger2"; } + my ($button1, $button1_2, $button2, $button2_2); + my $checked; + # with JavaScript Calendar if ($form->{jsscript}) { if ($name_1 eq "") { - - $button1 = qq| - |; - $button1_2 = qq| - text('button') . qq|>|; + $button1 = qq| |; + $button1_2 = qq| text('button') . qq|>|; #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2"); + $jsscript = Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2"); } else { - $button1 = qq| - |; - $button1_2 = qq| - text('button') . qq|>|; - $button2 = qq| - |; - $button2_2 = qq| - text('button') . qq|> - |; + $button1 = qq| |; + $button1_2 = qq| text('button') . qq|>|; + $button2 = qq| |; + $button2_2 = qq| text('button') . qq|> |; #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1", - "$name_2", "BL", "$trigger_2"); + $jsscript = Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1", "$name_2", "BL", "$trigger_2"); } } else { # without JavaScript Calendar if ($name_1 eq "") { - $button1 = - qq||; + $button1 = qq||; } else { - $button1 = - qq||; - $button2 = - qq||; + $button1 = qq||; + $button2 = qq||; } } $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| @@ -285,10 +300,8 @@ sub report { | . $locale->text('Include in Report') . qq| - | - . $locale->text('Heading') . qq| - | - . $locale->text('Subtotal') . qq| + | . $locale->text('Heading') . qq| + | . $locale->text('Subtotal') . qq| $jsscript @@ -305,83 +318,62 @@ $jsscript - | - . $locale->text('Customized Report') . qq| + | . $locale->text('Customized Report') . qq| | . $locale->text('Year') . qq| - + |; print qq| - - | . $locale->text('Yearly') . qq| + | . $locale->text('Yearly') . qq| | . $locale->text('Quarterly') . qq| | . $locale->text('Monthly') . qq| - - 1. | - . $locale->text('Quarter') . qq| + + 1. | . $locale->text('Quarter') . qq| |; $checked = ""; print qq| - | - . $locale->text('January') . qq| + | . $locale->text('January') . qq| |; $checked = ""; print qq| - | - . $locale->text('May') . qq| - | - . $locale->text('September') . qq| + | . $locale->text('May') . qq| + | . $locale->text('September') . qq| - 2. | - . $locale->text('Quarter') . qq| - | - . $locale->text('February') . qq| - | - . $locale->text('June') . qq| - | - . $locale->text('October') . qq| + 2. | . $locale->text('Quarter') . qq| + | . $locale->text('February') . qq| + | . $locale->text('June') . qq| + | . $locale->text('October') . qq| - 3. | - . $locale->text('Quarter') . qq| - | - . $locale->text('March') . qq| - | - . $locale->text('July') . qq| - | - . $locale->text('November') . qq| + 3. | . $locale->text('Quarter') . qq| + | . $locale->text('March') . qq| + | . $locale->text('July') . qq| + | . $locale->text('November') . qq| - 4. | - . $locale->text('Quarter') . qq| - | - . $locale->text('April') . qq| - | - . $locale->text('August') . qq| - | - . $locale->text('December') . qq| + 4. | . $locale->text('Quarter') . qq| + | . $locale->text('April') . qq| + | . $locale->text('August') . qq| + | . $locale->text('December') . qq| - | - . $locale->text('Free report period') . qq| + | . $locale->text('Free report period') . qq| | . $locale->text('From') . qq| $button1 $button1_2 @@ -395,10 +387,8 @@ $jsscript | . $locale->text('Method') . qq| - | - . $locale->text('Accrual') . qq| - | - . $locale->text('EUR') . qq| + | . $locale->text('Accrual') . qq| + | . $locale->text('EUR') . qq| $jsscript @@ -415,83 +405,63 @@ $jsscript - | - . $locale->text('Customized Report') . qq| + | . $locale->text('Customized Report') . qq| | . $locale->text('Year') . qq| - + |; print qq| - - | . $locale->text('Yearly') . qq| + | . $locale->text('Yearly') . qq| | . $locale->text('Quarterly') . qq| | . $locale->text('Monthly') . qq| - 1. | - . $locale->text('Quarter') . qq| + 1. | . $locale->text('Quarter') . qq| |; $checked = "checked"; print qq| - | - . $locale->text('January') . qq| + | . $locale->text('January') . qq| |; $checked = ""; print qq| - | - . $locale->text('May') . qq| - | - . $locale->text('September') . qq| + | . $locale->text('May') . qq| + | . $locale->text('September') . qq| - 2. | - . $locale->text('Quarter') . qq| - | - . $locale->text('February') . qq| - | - . $locale->text('June') . qq| - | - . $locale->text('October') . qq| + 2. | . $locale->text('Quarter') . qq| + | . $locale->text('February') . qq| + | . $locale->text('June') . qq| + | . $locale->text('October') . qq| - 3. | - . $locale->text('Quarter') . qq| - | - . $locale->text('March') . qq| - | - . $locale->text('July') . qq| - | - . $locale->text('November') . qq| + 3. | . $locale->text('Quarter') . qq| + | . $locale->text('March') . qq| + | . $locale->text('July') . qq| + | . $locale->text('November') . qq| - 4. | - . $locale->text('Quarter') . qq| - | - . $locale->text('April') . qq| - | - . $locale->text('August') . qq| - | - . $locale->text('December') . qq| + 4. | . $locale->text('Quarter') . qq| + | . $locale->text('April') . qq| + | . $locale->text('August') . qq| + | . $locale->text('December') . qq| - | - . $locale->text('Free report period') . qq| + | . $locale->text('Free report period') . qq| | . $locale->text('From') . qq| $button1 $button1_2 @@ -505,201 +475,150 @@ $checked> | . $locale->text('Method') . qq| - | - . $locale->text('Accrual') . qq| - | - . $locale->text('EUR') . qq| + | . $locale->text('Accrual') . qq| + | . $locale->text('EUR') . qq| - | - . $locale->text('Decimalplaces') - . qq| + | . $locale->text('Decimalplaces') . qq| - + $jsscript |; } - if ($form->{report} eq "ustva") { - + if ($form->{report} eq "balance_sheet") { print qq| + + + | . $locale->text('as at') . qq| + + $button1 + $button1_2 + + | . $locale->text('Compare to') . qq| + + $button2 + $button2_2 + + + + | . $locale->text('Decimalplaces') . qq| + + + + + + + + + + | . $locale->text('Method') . qq| + | . $locale->text('Accrual') . qq| + | . $locale->text('EUR') . qq| + + + + | . $locale->text('Include in Report') . qq| + | . $locale->text('Heading') . qq| + | . $locale->text('Subtotal') . qq| + | . $locale->text('Account Number') . qq| + + +$jsscript +|; + } - - + if ($form->{report} eq "trial_balance") { + print qq| + + | . $locale->text('Project') . qq| + $projectnumber + + - | - . $locale->text('Zeitraum') . qq| + | . $locale->text('Customized Report') . qq| | . $locale->text('Year') . qq| - + |; print qq| - - | . $locale->text('Yearly') . qq| + | . $locale->text('Yearly') . qq| | . $locale->text('Quarterly') . qq| | . $locale->text('Monthly') . qq| - - 1. | - . $locale->text('Quarter') . qq| + + 1. | . $locale->text('Quarter') . qq| |; $checked = "checked"; print qq| - | - . $locale->text('January') . qq| + | . $locale->text('January') . qq| |; $checked = ""; print qq| - | - . $locale->text('May') . qq| - | - . $locale->text('September') . qq| + | . $locale->text('May') . qq| + | . $locale->text('September') . qq| - 2. | - . $locale->text('Quarter') . qq| - | - . $locale->text('February') . qq| - | - . $locale->text('June') . qq| - | - . $locale->text('October') . qq| + 2. | . $locale->text('Quarter') . qq| + | . $locale->text('February') . qq| + | . $locale->text('June') . qq| + | . $locale->text('October') . qq| - 3. | - . $locale->text('Quarter') . qq| - | - . $locale->text('March') . qq| - | - . $locale->text('July') . qq| - | - . $locale->text('November') . qq| + 3. | . $locale->text('Quarter') . qq| + | . $locale->text('March') . qq| + | . $locale->text('July') . qq| + | . $locale->text('November') . qq| - 4. | - . $locale->text('Quarter') . qq| - | - . $locale->text('April') . qq| - | - . $locale->text('August') . qq| - | - . $locale->text('December') . qq| + 4. | . $locale->text('Quarter') . qq| + | . $locale->text('April') . qq| + | . $locale->text('August') . qq| + | . $locale->text('December') . qq| - | . $locale->text('Method') . qq| - | - . $locale->text('Accrual') . qq| - | - . $locale->text('EUR') . qq| - - - |; -########## - - &print_options(); - print qq| - - -|; - } - - if ($form->{report} eq "balance_sheet") { - print qq| - - - | . $locale->text('as at') . qq| - - $button1 - $button1_2 - - | . $locale->text('Compare to') . qq| - - $button2 - $button2_2 + | . $locale->text('Free report period') . qq| + | . $locale->text('From') . qq| + $button1 + $button1_2 + | . $locale->text('Bis') . qq| + $button2 + $button2_2 - - - | . $locale->text('Decimalplaces') . qq| - - - - - - - - + - | . $locale->text('Method') . qq| - | - . $locale->text('Accrual') . qq| - | - . $locale->text('EUR') . qq| + - - | . $locale->text('Include in Report') . qq| - | - . $locale->text('Heading') . qq| - | - . $locale->text('Subtotal') . qq| - | - . $locale->text('Account Number') . qq| + | . $locale->text('Method') . qq| + | . $locale->text('Accrual') . qq| + | . $locale->text('EUR') . qq| - -$jsscript -|; - } - - if ($form->{report} eq "trial_balance") { - print qq| - - - | . $locale->text('From') . qq| - - $button1 - $button1_2 - - | . $locale->text('Bis') . qq| - - $button2 - $button2_2 - - - - - - - - - - | . $locale->text('Include in Report') . qq| - | - . $locale->text('Heading') . qq| - | - . $locale->text('Subtotal') . qq| - | - . $locale->text('All Accounts') . qq| - + | . $locale->text('All Accounts') . qq| + + + + | . $locale->text('Decimalplaces') . qq| + + $jsscript |; @@ -724,7 +643,7 @@ $jsscript |; $checked = "checked"; - foreach $ref (@{ $form->{taxaccounts} }) { + foreach my $ref (@{ $form->{taxaccounts} }) { print qq|{accno} $checked> $ref->{description} @@ -744,10 +663,8 @@ $jsscript | . $locale->text('Method') . qq| - | - . $locale->text('Accrual') . qq| - | - . $locale->text('EUR') . qq| + | . $locale->text('Accrual') . qq| + | . $locale->text('EUR') . qq| @@ -860,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'); @@ -889,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 @@ -908,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"; } @@ -955,8 +876,7 @@ $jsscript - | - . $locale->text('Include Exchangerate Difference') . qq| + | . $locale->text('Include Exchangerate Difference') . qq| $jsscript @@ -978,46 +898,28 @@ $jsscript -{path}> -{login}> -{password}> - - -|; + - # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten - USTVA->get_config($userspath, 'finanzamt.ini'); - - $disabled = qq|disabled="disabled"|; - $disabled = '' if ($form->{elster} eq '1'); - if ($form->{report} eq 'ustva') { - print qq| - - - |; - print qq| - - |; - } - - print qq|