|.$locale->text('Include in Report').qq|
@@ -169,6 +252,7 @@ sub search {
|.$locale->text('All').qq|
|.$locale->text('Asset').qq|
+ |.$locale->text('Contra').qq|
|.$locale->text('Liability').qq|
|.$locale->text('Equity').qq|
|.$locale->text('Income').qq|
@@ -221,7 +305,7 @@ sub search {
{path}>
{login}>
- {password}>
+ {sessionid}>
@@ -235,11 +319,18 @@ sub search {
sub generate_report {
+ $form->{sort} = "transdate" unless $form->{sort};
+
GL->all_transactions(\%myconfig, \%$form);
- $callback = "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}";
-
+ $href = "$form->{script}?action=generate_report&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+
+ $form->sort_order();
+
+ $callback = "$form->{script}?action=generate_report&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+
%acctype = ( 'A' => $locale->text('Asset'),
+ 'C' => $locale->text('Contra'),
'L' => $locale->text('Liability'),
'Q' => $locale->text('Equity'),
'I' => $locale->text('Income'),
@@ -254,60 +345,98 @@ sub generate_report {
$form->{title} .= " : ".$locale->text($acctype{$form->{category}});
}
if ($form->{accno}) {
- $callback .= "&accno=$form->{accno}";
+ $href .= "&accno=".$form->escape($form->{accno});
+ $callback .= "&accno=".$form->escape($form->{accno},1);
$option = $locale->text('Account')." : $form->{accno} $form->{account_description}";
}
if ($form->{gifi_accno}) {
- $callback .= "&gifi_accno=$form->{gifi_accno}";
+ $href .= "&gifi_accno=".$form->escape($form->{gifi_accno});
+ $callback .= "&gifi_accno=".$form->escape($form->{gifi_accno},1);
$option .= "\n " if $option;
$option .= $locale->text('GIFI')." : $form->{gifi_accno} $form->{gifi_account_description}";
}
if ($form->{source}) {
- $callback .= "&source=".$form->escape($form->{source});
+ $href .= "&source=".$form->escape($form->{source});
+ $callback .= "&source=".$form->escape($form->{source},1);
$option .= "\n " if $option;
$option .= $locale->text('Source')." : $form->{source}";
}
if ($form->{reference}) {
- $callback .= "&reference=".$form->escape($form->{reference});
+ $href .= "&reference=".$form->escape($form->{reference});
+ $callback .= "&reference=".$form->escape($form->{reference},1);
$option .= "\n " if $option;
$option .= $locale->text('Reference')." : $form->{reference}";
}
+ if ($form->{department}) {
+ $href .= "&department=".$form->escape($form->{department});
+ $callback .= "&department=".$form->escape($form->{department},1);
+ ($department) = split /--/, $form->{department};
+ $option .= "\n " if $option;
+ $option .= $locale->text('Department')." : $department";
+ }
+
if ($form->{description}) {
- $callback .= "&description=".$form->escape($form->{description});
+ $href .= "&description=".$form->escape($form->{description});
+ $callback .= "&description=".$form->escape($form->{description},1);
$option .= "\n " if $option;
$option .= $locale->text('Description')." : $form->{description}";
}
if ($form->{notes}) {
- $callback .= "¬es=".$form->escape($form->{notes});
+ $href .= "¬es=".$form->escape($form->{notes});
+ $callback .= "¬es=".$form->escape($form->{notes},1);
$option .= "\n " if $option;
$option .= $locale->text('Notes')." : $form->{notes}";
}
if ($form->{datefrom}) {
+ $href .= "&datefrom=$form->{datefrom}";
$callback .= "&datefrom=$form->{datefrom}";
$option .= "\n " if $option;
$option .= $locale->text('From')." ".$locale->date(\%myconfig, $form->{datefrom}, 1);
}
if ($form->{dateto}) {
+ $href .= "&dateto=$form->{dateto}";
$callback .= "&dateto=$form->{dateto}";
if ($form->{datefrom}) {
$option .= " ";
} else {
$option .= "\n " if $option;
}
- $option .= $locale->text('to')." ".$locale->date(\%myconfig, $form->{dateto}, 1);
+ $option .= $locale->text('To')." ".$locale->date(\%myconfig, $form->{dateto}, 1);
+ }
+
+ if ($form->{amountfrom}) {
+ $href .= "&amountfrom=$form->{amountfrom}";
+ $callback .= "&amountfrom=$form->{amountfrom}";
+ $option .= "\n " if $option;
+ $option .= $locale->text('Amount')." >= ".$form->format_amount(\%myconfig, $form->{amountfrom}, 2);
+ }
+ if ($form->{amountto}) {
+ $href .= "&amountto=$form->{amountto}";
+ $callback .= "&amountto=$form->{amountto}";
+ if ($form->{amountfrom}) {
+ $option .= " <= ";
+ } else {
+ $option .= "\n " if $option;
+ $option .= $locale->text('Amount')." <= ";
+ }
+ $option .= $form->format_amount(\%myconfig, $form->{amountto}, 2);
}
@columns = $form->sort_columns(qw(transdate id reference description notes source debit credit accno gifi_accno));
+ if ($form->{link} =~ /_paid/) {
+ @columns = $form->sort_columns(qw(transdate id reference description notes source cleared debit credit accno gifi_accno));
+ $form->{l_cleared} = "Y";
+ }
+
if ($form->{accno} || $form->{gifi_accno}) {
@columns = grep !/(accno|gifi_accno)/, @columns;
push @columns, "balance";
$form->{l_balance} = "Y";
}
- $href = "$callback&sort=$form->{sort}"; # needed for accno
foreach $item (@columns) {
if ($form->{"l_$item"} eq "Y") {
@@ -327,17 +456,18 @@ sub generate_report {
$callback .= "&category=$form->{category}";
$href .= "&category=$form->{category}";
- $column_header{id} = " ".$locale->text('ID')." ";
- $column_header{transdate} = "".$locale->text('Date')." ";
- $column_header{reference} = "".$locale->text('Reference')." ";
- $column_header{source} = "".$locale->text('Source')." ";
- $column_header{description} = "".$locale->text('Description')." ";
+ $column_header{id} = "".$locale->text('ID')." ";
+ $column_header{transdate} = "".$locale->text('Date')." ";
+ $column_header{reference} = "".$locale->text('Reference')." ";
+ $column_header{source} = "".$locale->text('Source')." ";
+ $column_header{description} = "".$locale->text('Description')." ";
$column_header{notes} = "".$locale->text('Notes')." ";
$column_header{debit} = "".$locale->text('Debit')." ";
$column_header{credit} = "".$locale->text('Credit')." ";
- $column_header{accno} = "".$locale->text('Account')." ";
- $column_header{gifi_accno} = "".$locale->text('GIFI')." ";
- $column_header{balance} = "".$locale->text('Balance')." ";
+ $column_header{accno} = "".$locale->text('Account')." ";
+ $column_header{gifi_accno} = "".$locale->text('GIFI')." ";
+ $column_header{balance} = "".$locale->text('Balance')." ";
+ $column_header{cleared} = qq||.$locale->text('R').qq| |;
$form->header;
@@ -388,6 +518,11 @@ print "
|;
}
+
+ # reverse href
+ $direction = ($form->{direction} eq 'ASC') ? "ASC" : "DESC";
+ $form->sort_order();
+ $href =~ s/direction=$form->{direction}/direction=$direction/;
foreach $ref (@{ $form->{GL} }) {
@@ -411,7 +546,7 @@ print "
$column_data{id} = "