X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fgl.pl;h=5417918fd88ab2b6bb77f411fb3695a0c6fe0dcf;hb=95ecb4289e58990f441f0273182c55f45f26bfb6;hp=731f525767357c38d45bc2bfd75dec6041c71dd6;hpb=57bf9c89a037036fcf433de39643778854defe51;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 731f52576..5417918fd 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,8 +47,6 @@ require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; require "bin/mozilla/reportgenerator.pl"; -use strict; - # this is for our long dates # $locale->text('January') # $locale->text('February') @@ -74,10 +75,6 @@ use strict; # $locale->text('Nov') # $locale->text('Dec') -my $tax; -my $debitlock = 0; -my $creditlock = 0; - sub add { $main::lxdebug->enter_sub(); @@ -96,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; @@ -110,13 +101,13 @@ 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}; @@ -136,23 +127,17 @@ sub prepare_transaction { GL->transaction(\%myconfig, \%$form); - map { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; - $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; @@ -240,20 +225,20 @@ sub search { $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} || [] }); } my $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - + + | . $locale->text('Department') . qq| + $form->{selectdepartment} + | if $form->{selectdepartment}; $form->get_lists("projects" => { "key" => "ALL_PROJECTS", @@ -321,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| + + + + + @@ -555,6 +542,7 @@ sub generate_report { 'attachment_basename' => $locale->text('general_ledger_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort to callback $form->{callback} = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir}); @@ -715,19 +703,19 @@ sub update { $form->{"credit_$i"} = 0; $form->{"tax_$i"} = 0; $creditcount--; - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount >= 2) && ($debitcount == 2)) { $form->{"debit_$i"} = 0; $form->{"tax_$i"} = 0; $debitcount--; - $debitlock = 1; + $form->{debitlock} = 1; } if (($creditcount == 1) && ($debitcount == 2)) { - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount == 2) && ($debitcount == 1)) { - $debitlock = 1; + $form->{debitlock} = 1; } if ($debitcredit && $credittax) { $form->{"taxchart_$i"} = "0--0.00"; @@ -830,8 +818,8 @@ sub display_rows { my %charts = (); my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { - if ($item->{charttype} eq 'H'){ #falls überschrift - next; #überspringen (Bug 1150) + if ($item->{charttype} eq 'H'){ #falls überschrift + next; #überspringen (Bug 1150) } my $key = $item->{accno} . "--" . $item->{tax_id}; $taxchart_init = $item->{tax_id} unless (@chart_values); @@ -895,7 +883,7 @@ sub display_rows { . $cgi->hidden('-name' => "previous_accno_$i", '-default' => $selected_accno_full) . qq||; - $tax = qq|| . + my $tax_ddbox = qq|| . NTI($cgi->popup_menu('-name' => "taxchart_$i", '-id' => "taxchart_$i", '-style' => 'width:200px', @@ -953,9 +941,9 @@ sub display_rows { my $debitreadonly = ""; my $creditreadonly = ""; if ($i == $form->{rowcount}) { - if ($debitlock) { + if ($form->{debitlock}) { $debitreadonly = "readonly"; - } elsif ($creditlock) { + } elsif ($form->{creditlock}) { $creditreadonly = "readonly"; } } @@ -965,6 +953,8 @@ sub display_rows { '-values' => \@project_values, '-labels' => \%project_labels, '-default' => $form->{"project_id_$i"} )); + my $projectnumber_hidden = qq| + |; my $copy2credit = 'onkeyup="copy_debit_to_credit()"' if $i == 1; @@ -975,7 +965,7 @@ sub display_rows { $form->{"tax_$i"} - $tax|; + $tax_ddbox|; if ($form->{show_details}) { print qq| @@ -983,10 +973,14 @@ sub display_rows { $memo $projectnumber |; - } + } else { print qq| $source_hidden $memo_hidden + $projectnumber_hidden + |; + } + print qq| |; } @@ -1085,11 +1079,11 @@ sub form_header { my $department; $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - - + + | . $locale->text('Department') . qq| + $form->{selectdepartment} + + | if $form->{selectdepartment}; if ($init) { $form->{fokus} = "gl.reference"; @@ -1148,7 +1142,14 @@ sub form_header { $form->{title} - + | . + + ($form->{saved_message} ? qq| + + $form->{saved_message} + | : '') . + +qq| @@ -1161,71 +1162,71 @@ sub form_header { . " $form->{previous_gldate}" . qq| - - | . $locale->text('Reference') . qq| - - - - - | . $locale->text('Date') . qq| + + | . $locale->text('Reference') . qq| + + + + + | . $locale->text('Date') . qq| $button1 - - - - |; + + + + |; if ($form->{id}) { print qq| - - | . $locale->text('Belegnummer') . qq| - - - - - | . $locale->text('Buchungsdatum') . qq| - {gldate} $readonly onBlur=\"check_right_date_format(this)\"> - - - - |; + + | . $locale->text('Belegnummer') . qq| + + + + + | . $locale->text('Buchungsdatum') . qq| + {gldate} $readonly onBlur=\"check_right_date_format(this)\"> + + + + |; } print qq| - $department|; + $department|; if ($form->{id}) { print qq| - - | . $locale->text('Description') . qq| - $description + + | . $locale->text('Description') . qq| + $description - - - | . $locale->text('MwSt. inkl.') . qq| - - - - - - - - | . $locale->text('Mitarbeiter') . qq| - - - - - |; + + + | . $locale->text('MwSt. inkl.') . qq| + + + + + + + + | . $locale->text('Mitarbeiter') . qq| + + + + + |; } else { print qq| - - | . $locale->text('Description') . qq| - $description - - - - | . $locale->text('MwSt. inkl.') . qq| - - - - - |; + + | . $locale->text('Description') . qq| + $description + + + + | . $locale->text('MwSt. inkl.') . qq| + + + + + |; } print qq| @@ -1247,13 +1248,13 @@ sub form_header { - - | + + | . $locale->text('Account') . qq| - | . $locale->text('Chart balance') . qq| - | + | . $locale->text('Chart balance') . qq| + | . $locale->text('Debit') . qq| - | + | . $locale->text('Credit') . qq| | . $locale->text('Tax') . qq| @@ -1262,14 +1263,14 @@ sub form_header { if ($form->{show_details}) { print qq| - | . $locale->text('Source') . qq| - | . $locale->text('Memo') . qq| - | . $locale->text('Project Number') . qq| + | . $locale->text('Source') . qq| + | . $locale->text('Memo') . qq| + | . $locale->text('Project Number') . qq| |; } print qq| - + $jsscript |; @@ -1333,7 +1334,7 @@ $follow_ups_block print qq||; } - # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich + # Löschen und Ãndern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich if (!$form->{locked} && $radieren) { print qq| @@ -1422,8 +1423,8 @@ sub yes { # saving the history if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; - $form->{addition} = "DELETED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "DELETED"; + $form->save_history; } # /saving the history $form->redirect($locale->text('Transaction deleted!')) @@ -1478,19 +1479,19 @@ sub post_transaction { $form->{"credit_$i"} = 0; $form->{"tax_$i"} = 0; $creditcount--; - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount >= 2) && ($debitcount == 2)) { $form->{"debit_$i"} = 0; $form->{"tax_$i"} = 0; $debitcount--; - $debitlock = 1; + $form->{debitlock} = 1; } if (($creditcount == 1) && ($debitcount == 2)) { - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount == 2) && ($debitcount == 1)) { - $debitlock = 1; + $form->{debitlock} = 1; } if ($debitcredit && $credittax) { $form->{"taxchart_$i"} = "0--0.00"; @@ -1544,7 +1545,7 @@ sub post_transaction { for my $i (1 .. $form->{rowcount}) { my $dr = $form->{"debit_$i"}; my $cr = $form->{"credit_$i"}; - $tax = $form->{"tax_$i"}; + my $tax = $form->{"tax_$i"}; if ($dr && $cr) { $form->error($locale->text('Cannot post transaction with a debit and credit entry for the same account!')); } @@ -1581,7 +1582,7 @@ sub post_transaction { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; $form->{addition} = "SAVED"; $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history @@ -1596,6 +1597,12 @@ sub post { my $form = $main::form; my $locale = $main::locale; + if ($::myconfig{mandatory_departments} && !$form->{department}) { + $form->{saved_message} = $::locale->text('You have to specify a department.'); + update(); + exit; + } + $form->{title} = $locale->text("$form->{title} General Ledger Transaction"); $form->{storno} = 0; @@ -1643,7 +1650,7 @@ sub storno { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = "ordnumber_$form->{ordnumber}"; $form->{addition} = "STORNO"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history