X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=5834a485f0daf7f814df08f7f0903e72f42bf7e7;hb=dbd0ae115bd9a6ba0ede24f9655a29df6bf7dc3b;hp=a086f57843473943286e442ae6202099e1dd6884;hpb=0b8580e2a6e53102b619eb36a059a6d5be9e28c9;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index a086f5784..5834a485f 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -31,16 +31,20 @@ # #====================================================================== +use POSIX qw(strftime); +use List::Util qw(sum); + +use SL::FU; use SL::GL; use SL::IS; use SL::PE; +use SL::ReportGenerator; -require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; +require "bin/mozilla/drafts.pl"; +require "bin/mozilla/reportgenerator.pl"; -1; - -# end of main +use strict; # this is for our long dates # $locale->text('January') @@ -70,16 +74,26 @@ require "bin/mozilla/common.pl"; # $locale->text('Nov') # $locale->text('Dec') +my $tax; +my $debitlock = 0; +my $creditlock = 0; + sub add { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); + + my $form = $main::form; + my %myconfig = %main::myconfig; + + return $main::lxdebug->leave_sub() if (load_draft_maybe()); $form->{title} = "Add"; - $form->{callback} = - "$form->{script}?action=add&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; + $form->{callback} = "gl.pl?action=add" unless $form->{callback}; # we use this only to set a default date + # yep. aber er holt hier auch schon ALL_CHARTS. Aufwand / Nutzen? jb GL->transaction(\%myconfig, \%$form); map { @@ -96,24 +110,29 @@ 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(); + + $main::auth->assert('general_ledger'); + + my $form = $main::form; + my %myconfig = %main::myconfig; GL->transaction(\%myconfig, \%$form); @@ -127,20 +146,20 @@ sub prepare_transaction { # 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}; @@ -181,11 +200,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'); + + my $form = $main::form; + my %myconfig = %main::myconfig; prepare_transaction(); @@ -197,32 +221,39 @@ sub edit { display_rows(); form_footer(); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub search { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $form->{title} = $locale->text('Buchungsjournal'); + $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", @@ -242,14 +273,15 @@ sub search { # use JavaScript Calendar or not $form->{jsscript} = 1; - $jsscript = ""; + my $jsscript = ""; + my ($button1, $button2, $onload); if ($form->{jsscript}) { # with JavaScript Calendar $button1 = qq| text('button') . qq|> + . $locale->text('button') . qq|> |; $button2 = qq| @@ -277,7 +309,7 @@ sub search { print qq| -{script}> + @@ -289,83 +321,83 @@ 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('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| + + + + + @@ -378,9 +410,6 @@ $jsscript -{login}> -{password}> - @@ -389,551 +418,269 @@ $jsscript