require "bin/mozilla/common.pl";
+use strict;
+
1;
# end of main
sub reconciliation {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('cash');
+ $main::auth->assert('cash');
RC->paymentaccounts(\%myconfig, \%$form);
- $selection = "";
+ my $selection = "";
map { $selection .= "<option>$_->{accno}--$_->{description}\n" }
@{ $form->{PR} };
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->{"jsscript"} = 1;
$form->header;
- $onload = qq|focus()|;
+ my $onload = qq|focus()|;
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
print qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
sub get_payments {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('cash');
+ $main::auth->assert('cash');
($form->{accno}, $form->{account}) = split /--/, $form->{accno};
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('cash');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- @column_index = qw(cleared transdate source name credit debit balance);
+ $main::auth->assert('cash');
+ my @column_index = qw(cleared transdate source name credit debit balance);
+ my %column_header;
$column_header{cleared} = "<th> </th>";
$column_header{source} =
"<th class=listheading>" . $locale->text('Source') . "</a></th>";
$column_header{balance} =
"<th class=listheading>" . $locale->text('Balance') . "</a></th>";
+ my $option;
if ($form->{fromdate}) {
$option .= "\n<br>" if ($option);
$option .=
</tr>
|;
- $ml = ($form->{category} eq 'A') ? -1 : 1;
+ my $ml = ($form->{category} eq 'A') ? -1 : 1;
$form->{beginningbalance} *= $ml;
- $clearedbalance = $balance = $form->{beginningbalance};
- $i = 0;
- $id = 0;
+ my $balance = $form->{beginningbalance};
+ my $clearedbalance = $balance;
+ my $i = 0;
+ my $id = 0;
+ my %column_data;
map { $column_data{$_} = "<td> </td>" }
qw(cleared transdate source name debit credit);
$column_data{balance} =
"<td align=right>"
. $form->format_amount(\%myconfig, $balance, 2, 0) . "</td>";
- $j = 0;
+ my $j = 0;
print qq|
<tr class=listrow$j>
|;
</tr>
|;
- foreach $ref (@{ $form->{PR} }) {
+ my $cleared;
+ my $totaldebits;
+ my $totalcredits;
+ my $fx_transaction;
+ my $fx;
+ foreach my $ref (@{ $form->{PR} }) {
$balance += $ref->{amount} * $ml;
$cleared += $ref->{amount} * $ml if $ref->{cleared};
$form->{statementbalance} =
$form->parse_amount(\%myconfig, $form->{statementbalance});
- $difference =
+ my $difference =
$form->format_amount(\%myconfig,
$form->{statementbalance} - $clearedbalance - $cleared,
2, 0);
$clearedbalance = $form->format_amount(\%myconfig, $clearedbalance, 2, 0);
+ my $exchdiff;
if ($fx) {
$fx = $form->format_amount(\%myconfig, $fx, 2, 0);
$exchdiff = qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('cash');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('cash');
RC->payment_transactions(\%myconfig, \%$form);
- foreach $ref (@{ $form->{PR} }) {
+ my $i;
+ foreach my $ref (@{ $form->{PR} }) {
if (!$ref->{fx_transaction}) {
$i++;
$ref->{cleared} = ($form->{"cleared_$i"}) ? "checked" : "";
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_all {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('cash');
+ $main::auth->assert('cash');
RC->payment_transactions(\%myconfig, \%$form);
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub done {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('cash');
+ $main::auth->assert('cash');
$form->{callback} = "$form->{script}?action=reconciliation";
RC->reconcile(\%myconfig, \%$form);
$form->redirect;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}