use SL::CA;
use SL::ReportGenerator;
-require "bin/mozilla/report_generator.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
sub chart_of_accounts {
$lxdebug->enter_sub();
+ $auth->assert('report');
+
$form->{title} = $locale->text('Chart of Accounts');
CA->all_accounts(\%myconfig, \%$form);
sub list {
$lxdebug->enter_sub();
+ $auth->assert('report');
+
$form->{title} = $locale->text('List Transactions');
$form->{title} .= " - " . $locale->text('Account') . " $form->{accno}";
<tr><td><hr size=3 noshade></td></tr>
</table>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
<br><input class=submit type=submit name=action value="|
. $locale->text('List Transactions') . qq|">
</form>
sub list_transactions {
$lxdebug->enter_sub();
+ $auth->assert('report');
+
$form->{title} = $locale->text('Account') . " $form->{accno} - $form->{description}";
CA->all_transactions(\%myconfig, \%$form);
my $idx = 0;
my %totals = ( 'debit' => 0, 'credit' => 0 );
my %subtotals = ( 'debit' => 0, 'credit' => 0 );
+ my ($previous_index, $row_set);
foreach my $ca (@{ $form->{CA} }) {
$form->{balance} += $ca->{amount};
};
}
- $row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback');
+ if ($ca->{index} ne $previous_index) {
+ $report->add_data($row_set) if ($row_set);
- $report->add_data($row);
+ $row_set = [ ];
+ $previous_index = $ca->{index};
+
+ $row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback');
+
+ } else {
+ map { $row->{$_}->{data} = '' } qw(reference description);
+ $row->{transdate}->{data} = '' if ($form->{sort} eq 'transdate');
+ }
+
+ push @{ $row_set }, $row;
if (($form->{l_subtotal} eq 'Y')
&& (($idx == scalar @{ $form->{CA} } - 1)