X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=518e430527f3a325d2d37d1a52e66fd2259dbbdc;hb=1e0d413084100ccd892e8c5be95703be5d965de7;hp=e3a7a471e53725836030e1d60d082ba8be6061fd;hpb=8cef58b276ce4005c0e2ada350fecd5d7a103e89;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index e3a7a471e..518e43052 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -31,15 +31,21 @@ # #====================================================================== +use utf8; +use strict; + +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 "$form->{path}/arap.pl"; require "bin/mozilla/common.pl"; - -1; - -# end of main +require "bin/mozilla/drafts.pl"; +require "bin/mozilla/reportgenerator.pl"; # this is for our long dates # $locale->text('January') @@ -70,23 +76,23 @@ require "bin/mozilla/common.pl"; # $locale->text('Dec') 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&path=$form->{path}&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 { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; - $form->{rowcount} = 2; $form->{debit} = 0; @@ -95,49 +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 edit { - $lxdebug->enter_sub(); +sub prepare_transaction { + $main::lxdebug->enter_sub(); - GL->transaction(\%myconfig, \%$form); + $main::auth->assert('general_ledger'); - map { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; + my $form = $main::form; + my %myconfig = %main::myconfig; + + 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}; @@ -178,37 +185,60 @@ sub edit { ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)); + $main::lxdebug->leave_sub(); +} + +sub edit { + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); + + my $form = $main::form; + my %myconfig = %main::myconfig; + + prepare_transaction(); + $form->{title} = "Edit"; - &form_header; - &display_rows; - &form_footer; - $lxdebug->leave_sub(); + $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details}; + + form_header(); + display_rows(); + form_footer(); + $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", @@ -227,15 +257,16 @@ sub search { '-labels' => \%project_labels)); # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; - $jsscript = ""; + $form->{jsscript} = 1; + my $jsscript = ""; + my ($button1, $button2, $onload); if ($form->{jsscript}) { # with JavaScript Calendar $button1 = qq| text('button') . qq|> + . $locale->text('button') . qq|> |; $button2 = qq| @@ -263,7 +294,7 @@ sub search { print qq| -{script}> + @@ -275,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| + + + + + @@ -364,10 +397,6 @@ $jsscript -{path}> -{login}> -{password}> - @@ -376,552 +405,270 @@ $jsscript