X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=f618c5b69226570dab2c760f5fdc6bcc74271205;hb=8f29628f54e8b6669cdefa6e43e2f54220760c3c;hp=a66a629daf5c4857659053d4fd8ef18c0db7fff3;hpb=828ffa4213e262e14caf879b560d45926bdaeb03;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index a66a629da..f618c5b69 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -14,8 +14,8 @@ # # Contributors: Antonio Gallardo # Benjamin Lee -# Philip Reetz -# Udo Spallek +# Philip Reetz +# Udo Spallek # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,14 +35,22 @@ # #====================================================================== -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; +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') @@ -85,10 +93,44 @@ 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(); + $main::lxdebug->enter_sub(); - %title = ('balance_sheet' => 'Balance Sheet', + 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', @@ -101,133 +143,124 @@ 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} }) { + if (@{ $form->{all_departments} || [] }) { $form->{selectdepartment} = "