#======================================================================
use POSIX qw(strftime);
+use List::Util qw(sum);
+use SL::FU;
use SL::GL;
use SL::IS;
use SL::PE;
my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto category l_subtotal);
push @hidden_variables, map { "l_${_}" } @columns;
- my (@options, $date_option);
- if ($form->{accno}) {
- push @options, $locale->text('Account') . " : $form->{accno} $form->{account_description}";
- }
- if ($form->{source}) {
- push @options, $locale->text('Source') . " : $form->{source}";
- }
- if ($form->{reference}) {
- push @options, $locale->text('Reference') . " : $form->{reference}";
- }
+ my (@options, @date_options);
+ push @options, $locale->text('Account') . " : $form->{accno} $form->{account_description}" if ($form->{accno});
+ push @options, $locale->text('Source') . " : $form->{source}" if ($form->{source});
+ push @options, $locale->text('Reference') . " : $form->{reference}" if ($form->{reference});
+ push @options, $locale->text('Description') . " : $form->{description}" if ($form->{description});
+ push @options, $locale->text('Notes') . " : $form->{notes}" if ($form->{notes});
+
+ push @date_options, $locale->text('From'), $locale->date(\%myconfig, $form->{datefrom}, 1) if ($form->{datefrom});
+ push @date_options, $locale->text('Bis'), $locale->date(\%myconfig, $form->{dateto}, 1) if ($form->{dateto});
+ push @options, join(' ', @date_options) if (scalar @date_options);
+
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
}
- if ($form->{description}) {
- push @options, $locale->text('Description') . " : $form->{description}";
- }
- if ($form->{notes}) {
- push @options, $locale->text('Notes') . " : $form->{notes}";
- }
- if ($form->{datefrom}) {
- $date_option = $locale->text('From') . " " . $locale->date(\%myconfig, $form->{datefrom}, 1);
- }
- if ($form->{dateto}) {
- if ($form->{datefrom}) {
- $date_option .= " ";
- }
- $date_option .= $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{dateto}, 1);
- }
- push @options, $date_option if $date_option;
+
my $callback = build_std_url('action=generate_report', @hidden_variables);
print qq|
<body onLoad="fokus()">
+<script type="text/javascript" src="js/common.js"></script>
+<script type="text/javascript" src="js/follow_up.js"></script>
+
<form method=post name="gl" action=gl.pl>
|;
print qq|
<input type=hidden name=title value="$title">
+<input type="hidden" name="follow_up_trans_id_1" value="| . H($form->{id}) . qq|">
+<input type="hidden" name="follow_up_trans_type_1" value="gl_transaction">
+<input type="hidden" name="follow_up_trans_info_1" value="| . H($form->{id}) . qq|">
+<input type="hidden" name="follow_up_rowcount" value="1">
<table width=100%>
<tr>
$auth->assert('general_ledger');
+ my $follow_ups_block;
+ if ($form->{id}) {
+ my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
+
+ if (@{ $follow_ups} ) {
+ my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups };
+ $follow_ups_block = qq|<p>| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|</p>|;
+ }
+ }
+
($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
$dec = length $dec;
$decimalplaces = ($dec > 2) ? $dec : 2;
<input name=callback type=hidden value="$form->{callback}">
+$follow_ups_block
+
<br>
|;
<input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">|;
}
+ print qq|
+ <input type="button" class="submit" onclick="follow_up_window()" value="|
+ . $locale->text('Follow-Up')
+ . qq|"> |;
+
} else {
if ($transdate > $closedto) {
print qq|