X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fgl.pl;h=518e430527f3a325d2d37d1a52e66fd2259dbbdc;hb=ef92528c3f875dee2b456418adb214ccebb97361;hp=ae476bd17ee77a78bc52bb50664f8adc1087b4e2;hpb=12fb1a282a4777ecdaf7f297057732d2d473ad24;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index ae476bd17..518e43052 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -31,6 +31,9 @@ # #====================================================================== +use utf8; +use strict; + use POSIX qw(strftime); use List::Util qw(sum); @@ -44,10 +47,6 @@ require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; require "bin/mozilla/reportgenerator.pl"; -1; - -# end of main - # this is for our long dates # $locale->text('January') # $locale->text('February') @@ -77,11 +76,14 @@ require "bin/mozilla/reportgenerator.pl"; # $locale->text('Dec') sub add { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); - $auth->assert('general_ledger'); + my $form = $main::form; + my %myconfig = %main::myconfig; - return $lxdebug->leave_sub() if (load_draft_maybe()); + return $main::lxdebug->leave_sub() if (load_draft_maybe()); $form->{title} = "Add"; @@ -91,12 +93,6 @@ sub add { # yep. aber er holt hier auch schon ALL_CHARTS. Aufwand / Nutzen? jb GL->transaction(\%myconfig, \%$form); - map { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; - $form->{rowcount} = 2; $form->{debit} = 0; @@ -105,53 +101,50 @@ sub add { # 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} }); + } (@{ $form->{all_departments} || [] }); } $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details}; &display_form(1); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub prepare_transaction { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $auth->assert('general_ledger'); + $main::auth->assert('general_ledger'); - GL->transaction(\%myconfig, \%$form); + my $form = $main::form; + my %myconfig = %main::myconfig; - map { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; + GL->transaction(\%myconfig, \%$form); $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2); # 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} }); + } (@{ $form->{all_departments} || [] }); } my $i = 1; my $tax = 0; my $taxaccno = ""; - foreach $ref (@{ $form->{GL} }) { - $j = $i - 1; + foreach my $ref (@{ $form->{GL} }) { + my $j = $i - 1; if ($tax && ($ref->{accno} eq $taxaccno)) { $form->{"tax_$j"} = abs($ref->{amount}); $form->{"taxchart_$j"} = $ref->{id} . "--" . $ref->{taxrate}; @@ -192,13 +185,16 @@ sub prepare_transaction { ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub edit { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); - $auth->assert('general_ledger'); + my $form = $main::form; + my %myconfig = %main::myconfig; prepare_transaction(); @@ -210,34 +206,39 @@ sub edit { display_rows(); form_footer(); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub search { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $auth->assert('general_ledger'); + $main::auth->assert('general_ledger'); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + my $cgi = $main::cgi; $form->{title} = $locale->text('Journal'); $form->all_departments(\%myconfig); # departments - if (@{ $form->{all_departments} }) { + if (@{ $form->{all_departments} || [] }) { $form->{selectdepartment} = "\n"; map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" - } (@{ $form->{all_departments} }); + } (@{ $form->{all_departments} || [] }); } - $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - + my $department = qq| + + | . $locale->text('Department') . qq| + $form->{selectdepartment} + | if $form->{selectdepartment}; $form->get_lists("projects" => { "key" => "ALL_PROJECTS", @@ -257,7 +258,8 @@ sub search { # use JavaScript Calendar or not $form->{jsscript} = 1; - $jsscript = ""; + my $jsscript = ""; + my ($button1, $button2, $onload); if ($form->{jsscript}) { # with JavaScript Calendar @@ -304,83 +306,85 @@ sub search { - - | . $locale->text('Reference') . qq| - - | . $locale->text('Source') . qq| - - - $department - - | . $locale->text('Description') . qq| - - - - | . $locale->text('Notes') . qq| - - - - | . $locale->text('Project Number') . qq| - $projectnumber - - - | . $locale->text('From') . qq| + + | . $locale->text('Reference') . qq| + + | . $locale->text('Source') . qq| + + + $department + + | . $locale->text('Description') . qq| + + | . $locale->text('Account Number') . qq| + + + + | . $locale->text('Notes') . qq| + + + + | . $locale->text('Project Number') . qq| + $projectnumber + + + | . $locale->text('From') . qq| $button1 - | . $locale->text('To (time)') . qq| + | . $locale->text('To (time)') . qq| $button2 - - - | . $locale->text('Include in Report') . qq| - - - - - | + + + | . $locale->text('Include in Report') . qq| + + + + + | . $locale->text('All') . qq| - | + | . $locale->text('Asset') . qq| - | + | . $locale->text('Liability') . qq| - | + | . $locale->text('Revenue') . qq| - | + | . $locale->text('Expense') . qq| - - - - - - - | . $locale->text('ID') . qq| - - | . $locale->text('Date') . qq| - - | . $locale->text('Reference') . qq| - - | . $locale->text('Description') . qq| - - | . $locale->text('Notes') . qq| - - - - | . $locale->text('Debit') . qq| - - | . $locale->text('Credit') . qq| - - | . $locale->text('Source') . qq| - - | . $locale->text('Account') . qq| - - - - | . $locale->text('Subtotal') . qq| - - | . $locale->text('Project Number') . qq| - - - - - + + + + + + + | . $locale->text('ID') . qq| + + | . $locale->text('Date') . qq| + + | . $locale->text('Reference') . qq| + + | . $locale->text('Description') . qq| + + | . $locale->text('Notes') . qq| + + + + | . $locale->text('Debit') . qq| + + | . $locale->text('Credit') . qq| + + | . $locale->text('Source') . qq| + + | . $locale->text('Account') . qq| + + + + | . $locale->text('Subtotal') . qq| + + | . $locale->text('Project Number') . qq| + + + + + @@ -401,29 +405,36 @@ $jsscript