X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=db1473ed58b20a614f40e641a0804a540392848d;hb=2e7983737542b36d9962073a7d04f2edcf6b8bb0;hp=0106afdaaaebe15eababc796b86c48a04ff97075;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 0106afdaa..db1473ed5 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -32,16 +32,25 @@ #====================================================================== # # module for preparing Income Statement and Balance Sheet -# +# #====================================================================== -require "$form->{path}/arap.pl"; +use POSIX qw(strftime); use SL::PE; use SL::RP; +use SL::Iconv; +use SL::ReportGenerator; +use Data::Dumper; -1; -# end of main +require "bin/mozilla/arap.pl"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/reportgenerator.pl"; + +# 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') @@ -84,150 +93,174 @@ use SL::RP; # $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(); - - %title = ( 'balance_sheet' => 'Balance Sheet', - 'income_statement' => 'Income Statement', - 'trial_balance' => 'Trial Balance', - 'ar_aging' => 'AR Aging', - 'ap_aging' => 'Offene Verbindlichkeiten', - 'tax_collected' => 'Tax collected', - 'tax_paid' => 'Tax paid', - 'nontaxable_sales' => 'Non-taxable Sales', - 'nontaxable_purchases' => 'Non-taxable Purchases', - 'receipts' => 'Receipts', - 'payments' => 'Payments', - 'projects' => 'Project Transactions', - 'bwa' => 'Betriebswirtschaftliche Auswertung', - 'ustva' => 'Umsatzsteuervoranmeldung', - ); - - $form->{title} = $locale->text($title{$form->{report}}); - - $accrual = ($eur) ? "" : "checked"; - $cash = ($eur) ? "checked" : ""; - - ($null,$null,$null,$null,$null,$year,$null,$null,$null) = localtime(); - $year += 1900; - + $main::lxdebug->enter_sub(); + + check_rp_access(); + + 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', + 'ap_aging' => 'Offene Verbindlichkeiten', + 'tax_collected' => 'Tax collected', + 'tax_paid' => 'Tax paid', + 'nontaxable_sales' => 'Non-taxable Sales', + 'nontaxable_purchases' => 'Non-taxable Purchases', + 'receipts' => 'Receipts', + 'payments' => 'Payments', + 'projects' => 'Project Transactions', + 'bwa' => 'Betriebswirtschaftliche Auswertung', + ); + + $form->{title} = $locale->text($title{ $form->{report} }); + + my $accrual = ($main::eur) ? "" : "checked"; + my $cash = ($main::eur) ? "checked" : ""; + + my $year = (localtime)[5] + 1900; + # get departments $form->all_departments(\%myconfig); if (@{ $form->{all_departments} }) { $form->{selectdepartment} = "