X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fgl.pl;h=521bb07d24f90f5ad2470d33d836855f0694e490;hb=d05b351d2f468dfcf111178cc482a99a9d734a10;hp=3433b47f05b26287d4e292b851bdda04c285cf3c;hpb=c1c68d325862924ce923738ba525f550b0ac824d;p=kivitendo-erp.git
diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl
index 3433b47f0..521bb07d2 100644
--- a/bin/mozilla/gl.pl
+++ b/bin/mozilla/gl.pl
@@ -160,6 +160,13 @@ sub edit {
if ($tax && ($ref->{accno} eq $taxaccno)) {
$form->{"tax_$j"} = abs($ref->{amount});
$form->{"taxchart_$j"} = $ref->{taxkey} . "--" . $ref->{taxrate};
+ if ($form->{taxincluded}) {
+ if ($ref->{amount} < 0) {
+ $form->{"debit_$j"} += $form->{"tax_$j"};
+ } else {
+ $form->{"credit_$j"} += $form->{"tax_$j"};
+ }
+ }
} else {
$form->{"accno_$i"} = "$ref->{accno}--$ref->{accnotaxkey}";
for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} }
@@ -170,6 +177,7 @@ sub edit {
$form->{totalcredit} += $ref->{amount};
$form->{"credit_$i"} = $ref->{amount};
}
+ $form->{"taxchart_$i"} = "0--";
$i++;
}
if ($ref->{taxaccno} && !$tax) {
@@ -297,12 +305,8 @@ sub search {
. $locale->text('All') . qq|
|
. $locale->text('Asset') . qq|
- |
- . $locale->text('Contra') . qq|
|
. $locale->text('Liability') . qq|
- |
- . $locale->text('Equity') . qq|
|
. $locale->text('Revenue') . qq|
|
@@ -391,7 +395,7 @@ sub generate_report {
$form->{title} = $locale->text('General Ledger');
- $ml = ($form->{ml} =~ /(A|E)/) ? -1 : 1;
+ $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
unless ($form->{category} eq 'X') {
$form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
@@ -616,8 +620,9 @@ sub generate_report {
|;
}
-
+ $form->{balance} *= $ml;
foreach $ref (@{ $form->{GL} }) {
+ $form->{balance} *= $ml;
# if item ne sort print subtotal
if ($form->{l_subtotal} eq 'Y') {
@@ -625,9 +630,10 @@ sub generate_report {
&gl_subtotal;
}
}
- foreach $key (sort keys(%{ $ref->{amount} })) {
- $form->{balance} += $ref->{amount}{$key};
- }
+
+ #foreach $key (sort keys(%{ $ref->{amount} })) {
+ # $form->{balance} += $ref->{amount}{$key};
+ #}
$debit = "";
foreach $key (sort keys(%{ $ref->{debit} })) {
@@ -639,6 +645,7 @@ sub generate_report {
$debit .=
"
" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
}
$credit = "";
@@ -651,6 +658,7 @@ sub generate_report {
$credit .= "
"
. $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{credit}{$key});
}
$debittax = "";
@@ -664,6 +672,7 @@ sub generate_report {
$debittax .= "
"
. $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
}
$credittax = "";
@@ -677,6 +686,7 @@ sub generate_report {
$credittax .= "
"
. $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
}
$debitaccno = "";
@@ -685,14 +695,15 @@ sub generate_report {
foreach $key (sort keys(%{ $ref->{debit_accno} })) {
if ($key == 0) {
$debitaccno =
- "{accno}&callback=$callback>$ref->{debit_accno}{$key}";
+ "{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}";
} else {
$debitaccno .=
- "
{accno}&callback=$callback>$ref->{debit_accno}{$key}";
- }
- if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
- $ref->{debit_tax_accno}{$key} = $taxaccno;
+ "
{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}";
}
+
+ # if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
+ # $ref->{debit_tax_accno}{$key} = $taxaccno;
+ # }
$taxaccno = $ref->{debit_tax_accno}{$key};
$debittaxkey = $ref->{debit_taxkey}{$key};
}
@@ -703,14 +714,15 @@ sub generate_report {
foreach $key (sort keys(%{ $ref->{credit_accno} })) {
if ($key == 0) {
$creditaccno =
- "{accno}&callback=$callback>$ref->{credit_accno}{$key}";
+ "{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}";
} else {
$creditaccno .=
- "
{accno}&callback=$callback>$ref->{credit_accno}{$key}";
- }
- if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
- $ref->{credit_tax_accno}{$key} = $taxaccno;
+ "
{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}";
}
+
+ # if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
+ # $ref->{credit_tax_accno}{$key} = $taxaccno;
+ # }
$taxaccno = $ref->{credit_tax_accno}{$key};
$credittaxkey = $ref->{credit_taxkey}{$key};
}
@@ -719,10 +731,10 @@ sub generate_report {
foreach $key (sort keys(%{ $ref->{debit_tax_accno} })) {
if ($key == 0) {
$debittaxaccno =
- "{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}";
+ "{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}";
} else {
$debittaxaccno .=
- "
{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}";
+ "
{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}";
}
}
@@ -730,10 +742,10 @@ sub generate_report {
foreach $key (sort keys(%{ $ref->{credit_tax_accno} })) {
if ($key == 0) {
$credittaxaccno =
- "{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}";
+ "{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}";
} else {
$credittaxaccno .=
- "
{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}";
+ "
{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}";
}
}
@@ -768,9 +780,8 @@ sub generate_report {
$column_data{gifi_accno} =
"
{gifi_accno}&callback=$callback>$ref->{gifi_accno} | ";
$column_data{balance} =
- ""
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
- . " | ";
+ ""
+ . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . " | ";
$i++;
$i %= 2;
@@ -899,11 +910,16 @@ sub update {
$form->{oldtransdate} = $form->{transdate};
}
- my @a = ();
- my $count = 0;
- my $debittax = 0;
- my $credittax = 0;
- my @flds =
+ my @a = ();
+ my $count = 0;
+ my $debittax = 0;
+ my $credittax = 0;
+ my $debitcount = 0;
+ my $creditcount = 0;
+ $debitlock = 0;
+ $creditlock = 0;
+
+ my @flds =
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
for my $i (1 .. $form->{rowcount}) {
@@ -916,6 +932,36 @@ sub update {
push @a, {};
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
+ if ($debitcredit) {
+ $debitcount++;
+ } else {
+ $creditcount++;
+ }
+
+ if (($debitcount >= 2) && ($creditcount == 2)) {
+ $form->{"credit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $creditcount--;
+ $creditlock = 1;
+ }
+ if (($creditcount >= 2) && ($debitcount == 2)) {
+ $form->{"debit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $debitcount--;
+ $debitlock = 1;
+ }
+ if (($creditcount == 1) && ($debitcount == 2)) {
+ $creditlock = 1;
+ }
+ if (($creditcount == 2) && ($debitcount == 1)) {
+ $debitlock = 1;
+ }
+ if ($debitcredit && $credittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
+ if (!$debitcredit && $debittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
$amount =
($form->{"debit_$i"} == 0)
? $form->{"credit_$i"}
@@ -998,24 +1044,25 @@ sub display_rows {
for $i (1 .. $form->{rowcount}) {
$source = qq|
- | |;
$memo = qq|
- | |;
if ($init) {
$accno = qq|
- | |;
$tax =
- qq|$form->{taxchart} | |;
- if ($form->{selectprojectnumber}) {
- $project = qq|
- $form->{selectprojectnumber} | |;
- }
+
+ # if ($form->{selectprojectnumber}) {
+ # $project = qq|
+ # $form->{selectprojectnumber} | |;
+ # }
$korrektur =
qq|{totaldebit} += $form->{"debit_$i"};
- $form->{totalcredit} += $form->{"credit_$i"};
+ if ($form->{"debit_$i"} != 0) {
+ $form->{totaldebit} += $form->{"debit_$i"};
+ if (!$form->{taxincluded}) {
+ $form->{totaldebit} += $form->{"tax_$i"};
+ }
+ } else {
+ $form->{totalcredit} += $form->{"credit_$i"};
+ if (!$form->{taxincluded}) {
+ $form->{totalcredit} += $form->{"tax_$i"};
+ }
+ }
for (qw(debit credit tax)) {
$form->{"${_}_$i"} =
@@ -1045,7 +1100,7 @@ sub display_rows {
$accno =~
s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/;
$accno =
- qq| | $accno | |;
$tax = $taxchart;
@@ -1056,14 +1111,14 @@ sub display_rows {
. ($i + 10 + (($i - 1) * 8))
. qq|>$tax|;
- if ($form->{selectprojectnumber}) {
- $form->{"projectnumber_$i"} = ""
- if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
-
- $project = $form->{"projectnumber_$i"};
- $project =~ s/--.*//;
- $project = qq|$project | |;
- }
+ # if ($form->{selectprojectnumber}) {
+ # $form->{"projectnumber_$i"} = ""
+ # if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
+ #
+ # $project = $form->{"projectnumber_$i"};
+ # $project =~ s/--.*//;
+ # $project = qq|$project | |;
+ # }
if ($form->{transfer}) {
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
@@ -1077,7 +1132,7 @@ sub display_rows {
qq| | |;
- $form->hide_form("accno_$i", "projectnumber_$i");
+ $form->hide_form("accno_$i");
} else {
@@ -1087,10 +1142,11 @@ sub display_rows {
$tax = qq|
$taxchart | |;
- if ($form->{selectprojectnumber}) {
- $project = qq|
- $form->{selectprojectnumber} | |;
- }
+
+ # if ($form->{selectprojectnumber}) {
+ # $project = qq|
+ # $form->{selectprojectnumber} | |;
+ # }
$korrektur =
qq|{rowcount}) {
+ if ($debitlock) {
+ $debitreadonly = "readonly";
+ } elsif ($creditlock) {
+ $creditreadonly = "readonly";
+ }
+ }
print qq| |
$accno
$fx_transaction
- |
- |
- |
+ |
+ |
$korrektur
$tax
$source
$memo
- $project
|;
}
$form->hide_form(qw(rowcount selectaccno));
- print qq|
-|;
+
+ # print qq|
+ # |;
$lxdebug->leave_sub();
}
@@ -1200,20 +1265,19 @@ sub form_header {
# with JavaScript Calendar
$button1 = qq|
- {transdate} tabindex="2" $readonly>
+ |
text('button') . qq|> |
|;
#write Trigger
$jsscript =
- Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1", "",
- "", "");
+ Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1");
} else {
# without JavaScript Calendar
$button1 =
- qq|{transdate} tabindex="2" $readonly> | |;
+ qq| | |;
}
$form->header;
@@ -1241,10 +1305,10 @@ sub form_header {
- | . $locale->text('Reference') . qq| |
+ | . $locale->text('Reference') . qq| |
|
-
+
| . $locale->text('Date') . qq| |
$button1
@@ -1258,7 +1322,7 @@ sub form_header {
| . $locale->text('Belegnummer') . qq| |
|
-
+
| . $locale->text('Buchungsdatum') . qq| |
{gldate} $readonly> |
@@ -1272,8 +1336,8 @@ sub form_header {
if ($form->{id}) {
print qq|
- | . $locale->text('Description') . qq| |
- $description |
+ | . $locale->text('Description') . qq| |
+ $description |
@@ -1294,8 +1358,8 @@ sub form_header {
} else {
print qq|
- | . $locale->text('Description') . qq| |
- $description |
+ | . $locale->text('Description') . qq| |
+ $description |
@@ -1308,6 +1372,7 @@ sub form_header {
}
print qq|
+
|
@@ -1343,11 +1408,19 @@ sub form_footer {
map {
$form->{$_} =
- $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces, " ")
+ $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
} qw(totaldebit totalcredit);
print qq|
+ |
+ |
+ $form->{totaldebit} |
+ $form->{totalcredit} |
+ |
+
+ |
+
{path}>
@@ -1416,12 +1489,12 @@ sub delete {
| | | | |