X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=3887720decf369e29f46474bf0618d1b0bfe3de6;hb=21e3b9697fa7e9481b79d0f16ef8cc5d0892f299;hp=e7d9654216870ada786f342fd09eed85073c7d96;hpb=e2e06cbb81c60cd462133b97024886766e4c167d;p=kivitendo-erp.git
diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl
index e7d965421..3887720de 100644
--- a/bin/mozilla/gl.pl
+++ b/bin/mozilla/gl.pl
@@ -31,12 +31,17 @@
#
#======================================================================
+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/reportgenerator.pl";
1;
@@ -73,11 +78,11 @@ require "bin/mozilla/common.pl";
sub add {
$lxdebug->enter_sub();
+ $auth->assert('general_ledger');
+
$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
GL->transaction(\%myconfig, \%$form);
@@ -115,6 +120,8 @@ sub add {
sub prepare_transaction {
$lxdebug->enter_sub();
+ $auth->assert('general_ledger');
+
GL->transaction(\%myconfig, \%$form);
map {
@@ -187,6 +194,8 @@ sub prepare_transaction {
sub edit {
$lxdebug->enter_sub();
+ $auth->assert('general_ledger');
+
prepare_transaction();
$form->{title} = "Edit";
@@ -204,7 +213,9 @@ sub edit {
sub search {
$lxdebug->enter_sub();
- $form->{title} = $locale->text('Buchungsjournal');
+ $auth->assert('general_ledger');
+
+ $form->{title} = $locale->text('Journal');
$form->all_departments(\%myconfig);
@@ -241,7 +252,7 @@ sub search {
'-labels' => \%project_labels));
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
@@ -249,7 +260,7 @@ sub search {
$button1 = qq|
text('button') . qq|> |
+ . $locale->text('button') . qq|>
|;
$button2 = qq|
@@ -277,7 +288,7 @@ sub search {
print qq|
-
-
-
-
-|;
- $lxdebug->leave_sub();
-
-}
-
-sub gl_subtotal {
- $lxdebug->enter_sub();
-
- $subtotaldebit =
- $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
- $subtotalcredit =
- $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
+ $raw_bottom_info_text .= $form->parse_html_template('gl/generate_report_bottom');
- map { $column_data{$_} = " | | " }
- qw(transdate id reference source description accno);
- $column_data{debit} = "$subtotaldebit";
- $column_data{credit} = " | $subtotalcredit";
+ $report->set_options('raw_bottom_info_text' => $raw_bottom_info_text);
- print " | ";
- map { print "$column_data{$_}\n" } @column_index;
- print "
";
+ $report->generate_with_headers();
- $subtotaldebit = 0;
- $subtotalcredit = 0;
-
- $sameitem = $ref->{ $form->{sort} };
$lxdebug->leave_sub();
-
}
sub update {
$lxdebug->enter_sub();
+ $auth->assert('general_ledger');
+
$form->{oldtransdate} = $form->{transdate};
my @a = ();
@@ -998,22 +701,20 @@ sub update {
$form->{"taxchart_$i"} = "0--0.00";
$form->{"tax_$i"} = 0;
}
- if (!$form->{"korrektur_$i"}) {
- ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
- if ($taxkey > 1) {
- if ($debitcredit) {
- $debittax = 1;
- } else {
- $credittax = 1;
- }
- if ($form->{taxincluded}) {
- $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
- } else {
- $form->{"tax_$i"} = $amount * $rate;
- }
+ ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
+ if ($taxkey > 1) {
+ if ($debitcredit) {
+ $debittax = 1;
+ } else {
+ $credittax = 1;
+ }
+ if ($form->{taxincluded}) {
+ $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
} else {
- $form->{"tax_$i"} = 0;
+ $form->{"tax_$i"} = $amount * $rate;
}
+ } else {
+ $form->{"tax_$i"} = 0;
}
for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
@@ -1041,6 +742,8 @@ sub display_form {
my ($init) = @_;
$lxdebug->enter_sub();
+ $auth->assert('general_ledger');
+
&form_header($init);
# for $i (1 .. $form->{rowcount}) {
@@ -1059,6 +762,8 @@ sub display_rows {
my ($init) = @_;
$lxdebug->enter_sub();
+ $auth->assert('general_ledger');
+
$form->{debit_1} = 0 if !$form->{"debit_1"};
$form->{totaldebit} = 0;
$form->{totalcredit} = 0;
@@ -1086,10 +791,10 @@ sub display_rows {
my %charts = ();
my $taxchart_init;
foreach my $item (@{ $form->{ALL_CHARTS} }) {
- my $key = Q($item->{accno}) . "--" . Q($item->{tax_id});
+ my $key = $item->{accno} . "--" . $item->{tax_id};
$taxchart_init = $item->{taxkey_id} unless (@chart_values);
push(@chart_values, $key);
- $chart_labels{$key} = H($item->{accno}) . "--" . H($item->{description});
+ $chart_labels{$key} = $item->{accno} . "--" . $item->{description};
$charts{$item->{accno}} = $item;
}
@@ -1097,20 +802,26 @@ sub display_rows {
my @taxchart_values = ();
my %taxcharts = ();
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
- my $key = Q($item->{id}) . "--" . Q($item->{rate});
+ my $key = $item->{id} . "--" . $item->{rate};
$taxchart_init = $key if ($taxchart_init eq $item->{taxkey});
push(@taxchart_values, $key);
- $taxchart_labels{$key} = H($item->{taxdescription}) . " " .
- H($item->{rate} * 100) . ' %';
+ $taxchart_labels{$key} = $item->{taxdescription} . " " . $item->{rate} * 100 . ' %';
$taxcharts{$item->{id}} = $item;
}
for $i (1 .. $form->{rowcount}) {
- $source = qq|
- | |;
- $memo = qq|
- | |;
+ if ($form->{show_details}) {
+ $source = qq|
+ | |;
+ $memo = qq|
+ | |;
+ } else {
+ $source_hidden = qq|
+ |;
+ $memo_hidden = qq|
+ |;
+ }
my $selected_accno_full;
my ($accno_row) = split(/--/, $form->{"accno_$i"});
@@ -1152,8 +863,6 @@ sub display_rows {
. qq||;
if ($init) {
- $korrektur =
- qq||;
if ($form->{transfer}) {
$fx_transaction = qq|
| |
@@ -1188,14 +897,9 @@ sub display_rows {
$x |
|;
}
- $checked = ($form->{"korrektur_$i"}) ? "checked" : "";
- $korrektur =
- qq| | |;
$form->hide_form("accno_$i");
} else {
- $korrektur =
- qq| | |;
if ($form->{transfer}) {
$fx_transaction = qq|
|
@@ -1226,8 +930,7 @@ sub display_rows {
$fx_transaction
|
|
- |
- $korrektur
+ $form->{"tax_$i"} |
$tax|;
if ($form->{show_details}) {
@@ -1238,6 +941,8 @@ sub display_rows {
|;
}
print qq|
+ $source_hidden
+ $memo_hidden
|;
}
@@ -1251,12 +956,18 @@ sub display_rows {
sub form_header {
my ($init) = @_;
$lxdebug->enter_sub();
+
+ $auth->assert('general_ledger');
+
$title = $form->{title};
$form->{title} = $locale->text("$title General Ledger Transaction");
$readonly = ($form->{id}) ? "readonly" : "";
$show_details_checked = "checked" if $form->{show_details};
+ $ob_transaction_checked = "checked" if $form->{ob_transaction};
+ $cb_transaction_checked = "checked" if $form->{cb_transaction};
+
# $locale->text('Add General Ledger Transaction')
# $locale->text('Edit General Ledger Transaction')
@@ -1330,7 +1041,7 @@ sub form_header {
$button1 = qq|
text('button') . qq|> |
+ . $locale->text('button') . qq|>
|;
#write Trigger
@@ -1349,9 +1060,11 @@ sub form_header {
$form->header;
print qq|
-
+
+
+
-