summaryrefslogtreecommitdiff
path: root/bin/ca.pl
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-12 20:46:20 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-12 20:46:20 +0000
commitdf073d6e09c0f87fb2e88cc215ace843a5851d4a (patch)
tree1c15ce909d3e0353b21bbd909e6720fd485a3a53 /bin/ca.pl
parent65458125b8f3814fd6ef4d07b55ab69f62f5a528 (diff)
Formatting with Perltidy
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1068 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin/ca.pl')
-rwxr-xr-xbin/ca.pl638
1 files changed, 369 insertions, 269 deletions
diff --git a/bin/ca.pl b/bin/ca.pl
index 9554914d..ae2768e8 100755
--- a/bin/ca.pl
+++ b/bin/ca.pl
@@ -8,9 +8,9 @@
# with permission.
#
# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
# maintainers, and copyright holders, see the CONTRIBUTORS file.
#
# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
@@ -43,12 +43,13 @@
#
# module for Chart of Accounts, Income Statement and Balance Sheet
# search and edit transactions posted by the GL, AR and AP
-#
+#
#======================================================================
use LedgerSMB::CA;
1;
+
# end of main
# this is for our long dates
@@ -79,27 +80,30 @@ use LedgerSMB::CA;
# $locale->text('Nov')
# $locale->text('Dec')
-
sub chart_of_accounts {
- CA->all_accounts(\%myconfig, \%$form);
+ CA->all_accounts( \%myconfig, \%$form );
- @column_index = qw(accno gifi_accno description debit credit);
+ @column_index = qw(accno gifi_accno description debit credit);
- $column_header{accno} = qq|<th class=listtop>|.$locale->text('Account').qq|</th>\n|;
- $column_header{gifi_accno} = qq|<th class=listtop>|.$locale->text('GIFI').qq|</th>\n|;
- $column_header{description} = qq|<th class=listtop>|.$locale->text('Description').qq|</th>\n|;
- $column_header{debit} = qq|<th class=listtop>|.$locale->text('Debit').qq|</th>\n|;
- $column_header{credit} = qq|<th class=listtop>|.$locale->text('Credit').qq|</th>\n|;
-
+ $column_header{accno} =
+ qq|<th class=listtop>| . $locale->text('Account') . qq|</th>\n|;
+ $column_header{gifi_accno} =
+ qq|<th class=listtop>| . $locale->text('GIFI') . qq|</th>\n|;
+ $column_header{description} =
+ qq|<th class=listtop>| . $locale->text('Description') . qq|</th>\n|;
+ $column_header{debit} =
+ qq|<th class=listtop>| . $locale->text('Debit') . qq|</th>\n|;
+ $column_header{credit} =
+ qq|<th class=listtop>| . $locale->text('Credit') . qq|</th>\n|;
- $form->{title} = $locale->text('Chart of Accounts');
+ $form->{title} = $locale->text('Chart of Accounts');
- $colspan = $#column_index + 1;
-
- $form->header;
+ $colspan = $#column_index + 1;
+
+ $form->header;
- print qq|
+ print qq|
<body>
<table border=0 width=100%>
@@ -107,55 +111,73 @@ sub chart_of_accounts {
<tr height="5"></tr>
<tr class=listheading>|;
- for (@column_index) { print $column_header{$_} }
+ for (@column_index) { print $column_header{$_} }
- print qq|
+ print qq|
</tr>
|;
-
- foreach $ca (@{ $form->{CA} }) {
-
- $description = $form->escape($ca->{description});
- $gifi_description = $form->escape($ca->{gifi_description});
-
- $href = qq|$form->{script}?path=$form->{path}&action=list&accno=$ca->{accno}&login=$form->{login}&sessionid=$form->{sessionid}&description=$description&gifi_accno=$ca->{gifi_accno}&gifi_description=$gifi_description|;
-
- if ($ca->{charttype} eq "H") {
- print qq|<tr class=listheading>|;
- for (qw(accno description)) { $column_data{$_} = "<th class=listheading>$ca->{$_}</th>" }
- $column_data{gifi_accno} = "<th class=listheading>$ca->{gifi_accno}&nbsp;</th>";
- } else {
- $i++; $i %= 2;
- print qq|<tr class=listrow$i>|;
- $column_data{accno} = "<td><a href=$href>$ca->{accno}</a></td>";
- $column_data{gifi_accno} = "<td><a href=$href&accounttype=gifi>$ca->{gifi_accno}</a>&nbsp;</td>";
- $column_data{description} = "<td>$ca->{description}</td>";
- }
-
- $column_data{debit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{debit}, 2, "&nbsp;")."</td>\n";
- $column_data{credit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{credit}, 2, "&nbsp;")."</td>\n";
-
- $totaldebit += $ca->{debit};
- $totalcredit += $ca->{credit};
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
+ foreach $ca ( @{ $form->{CA} } ) {
+
+ $description = $form->escape( $ca->{description} );
+ $gifi_description = $form->escape( $ca->{gifi_description} );
+
+ $href =
+qq|$form->{script}?path=$form->{path}&action=list&accno=$ca->{accno}&login=$form->{login}&sessionid=$form->{sessionid}&description=$description&gifi_accno=$ca->{gifi_accno}&gifi_description=$gifi_description|;
+
+ if ( $ca->{charttype} eq "H" ) {
+ print qq|<tr class=listheading>|;
+ for (qw(accno description)) {
+ $column_data{$_} = "<th class=listheading>$ca->{$_}</th>";
+ }
+ $column_data{gifi_accno} =
+ "<th class=listheading>$ca->{gifi_accno}&nbsp;</th>";
+ }
+ else {
+ $i++;
+ $i %= 2;
+ print qq|<tr class=listrow$i>|;
+ $column_data{accno} = "<td><a href=$href>$ca->{accno}</a></td>";
+ $column_data{gifi_accno} =
+"<td><a href=$href&accounttype=gifi>$ca->{gifi_accno}</a>&nbsp;</td>";
+ $column_data{description} = "<td>$ca->{description}</td>";
+ }
+
+ $column_data{debit} =
+ "<td align=right>"
+ . $form->format_amount( \%myconfig, $ca->{debit}, 2, "&nbsp;" )
+ . "</td>\n";
+ $column_data{credit} =
+ "<td align=right>"
+ . $form->format_amount( \%myconfig, $ca->{credit}, 2, "&nbsp;" )
+ . "</td>\n";
+
+ $totaldebit += $ca->{debit};
+ $totalcredit += $ca->{credit};
+
+ for (@column_index) { print "$column_data{$_}\n" }
+
+ print qq|
</tr>
|;
- }
+ }
+
+ for (qw(accno gifi_accno description)) {
+ $column_data{$_} = "<td>&nbsp;</td>";
+ }
- for (qw(accno gifi_accno description)) { $column_data{$_} = "<td>&nbsp;</td>" }
+ $column_data{debit} =
+ "<th align=right class=listtotal>"
+ . $form->format_amount( \%myconfig, $totaldebit, 2, 0 ) . "</th>";
+ $column_data{credit} =
+ "<th align=right class=listtotal>"
+ . $form->format_amount( \%myconfig, $totalcredit, 2, 0 ) . "</th>";
- $column_data{debit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totaldebit, 2, 0)."</th>";
- $column_data{credit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totalcredit, 2, 0)."</th>";
-
- print "<tr class=listtotal>";
+ print "<tr class=listtotal>";
- for (@column_index) { print "$column_data{$_}\n" }
+ for (@column_index) { print "$column_data{$_}\n" }
- print qq|
+ print qq|
</tr>
<tr>
<td colspan=$colspan><hr size=3 noshade></td>
@@ -168,57 +190,74 @@ sub chart_of_accounts {
}
-
sub list {
- $form->{title} = $locale->text('List Transactions');
- if ($form->{accounttype} eq 'gifi') {
- $form->{title} .= " - ".$locale->text('GIFI')." $form->{gifi_accno} - $form->{gifi_description}";
- } else {
- $form->{title} .= " - ".$locale->text('Account')." $form->{accno} - $form->{description}";
- }
+ $form->{title} = $locale->text('List Transactions');
+ if ( $form->{accounttype} eq 'gifi' ) {
+ $form->{title} .= " - "
+ . $locale->text('GIFI')
+ . " $form->{gifi_accno} - $form->{gifi_description}";
+ }
+ else {
+ $form->{title} .= " - "
+ . $locale->text('Account')
+ . " $form->{accno} - $form->{description}";
+ }
- # get departments
- $form->all_departments(\%myconfig);
- if (@{ $form->{all_department} }) {
- $form->{selectdepartment} = "<option>\n";
+ # get departments
+ $form->all_departments( \%myconfig );
+ if ( @{ $form->{all_department} } ) {
+ $form->{selectdepartment} = "<option>\n";
- for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
- }
+ for ( @{ $form->{all_department} } ) {
+ $form->{selectdepartment} .=
+qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
+ }
+ }
- $department = qq|
+ $department = qq|
<tr>
- <th align=right nowrap>|.$locale->text('Department').qq|</th>
+ <th align=right nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
</tr>
| if $form->{selectdepartment};
- if (@{ $form->{all_years} }) {
- # accounting years
- $form->{selectaccountingyear} = "<option>\n";
- for (@{ $form->{all_years} }) { $form->{selectaccountingyear} .= qq|<option>$_\n| }
- $form->{selectaccountingmonth} = "<option>\n";
- for (sort keys %{ $form->{all_month} }) { $form->{selectaccountingmonth} .= qq|<option value=$_>|.$locale->text($form->{all_month}{$_}).qq|\n| }
-
- $selectfrom = qq|
+ if ( @{ $form->{all_years} } ) {
+
+ # accounting years
+ $form->{selectaccountingyear} = "<option>\n";
+ for ( @{ $form->{all_years} } ) {
+ $form->{selectaccountingyear} .= qq|<option>$_\n|;
+ }
+ $form->{selectaccountingmonth} = "<option>\n";
+ for ( sort keys %{ $form->{all_month} } ) {
+ $form->{selectaccountingmonth} .=
+ qq|<option value=$_>|
+ . $locale->text( $form->{all_month}{$_} ) . qq|\n|;
+ }
+
+ $selectfrom = qq|
<tr>
- <th align=right>|.$locale->text('Period').qq|</th>
+ <th align=right>| . $locale->text('Period') . qq|</th>
<td colspan=3>
<select name=month>$form->{selectaccountingmonth}</select>
<select name=year>$form->{selectaccountingyear}</select>
- <input name=interval class=radio type=radio value=0 checked>&nbsp;|.$locale->text('Current').qq|
- <input name=interval class=radio type=radio value=1>&nbsp;|.$locale->text('Month').qq|
- <input name=interval class=radio type=radio value=3>&nbsp;|.$locale->text('Quarter').qq|
- <input name=interval class=radio type=radio value=12>&nbsp;|.$locale->text('Year').qq|
+ <input name=interval class=radio type=radio value=0 checked>&nbsp;|
+ . $locale->text('Current') . qq|
+ <input name=interval class=radio type=radio value=1>&nbsp;|
+ . $locale->text('Month') . qq|
+ <input name=interval class=radio type=radio value=3>&nbsp;|
+ . $locale->text('Quarter') . qq|
+ <input name=interval class=radio type=radio value=12>&nbsp;|
+ . $locale->text('Year') . qq|
</td>
</tr>
|;
- }
+ }
+ $form->header;
- $form->header;
-
- print qq|
+ print qq|
<body>
<form method=post action=$form->{script}>
@@ -241,17 +280,19 @@ sub list {
<table>
$department
<tr>
- <th align=right>|.$locale->text('From').qq|</th>
+ <th align=right>| . $locale->text('From') . qq|</th>
<td><input name=fromdate size=11 title="$myconfig{dateformat}"></td>
- <th align=right>|.$locale->text('To').qq|</th>
+ <th align=right>| . $locale->text('To') . qq|</th>
<td><input name=todate size=11 title="$myconfig{dateformat}"></td>
</tr>
$selectfrom
<tr>
- <th align=right>|.$locale->text('Include in Report').qq|</th>
+ <th align=right>| . $locale->text('Include in Report') . qq|</th>
<td colspan=3>
- <input name=l_accno class=checkbox type=checkbox value=Y>&nbsp;|.$locale->text('AR/AP').qq|
- <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|.$locale->text('Subtotal').qq|
+ <input name=l_accno class=checkbox type=checkbox value=Y>&nbsp;|
+ . $locale->text('AR/AP') . qq|
+ <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
+ . $locale->text('Subtotal') . qq|
</td>
</tr>
</table>
@@ -264,7 +305,9 @@ sub list {
<input type="hidden" name="path" value="$form->{path}">
<input type="hidden" name="sessionid" value="$form->{sessionid}">
-<br><button class="submit" type="submit" name="action" value="list_transactions">|.$locale->text('List Transactions').qq|</button>
+<br><button class="submit" type="submit" name="action" value="list_transactions">|
+ . $locale->text('List Transactions')
+ . qq|</button>
</form>
</body>
@@ -273,104 +316,133 @@ sub list {
}
-
sub list_transactions {
- CA->all_transactions(\%myconfig, \%$form);
-
- $department = $form->escape($form->{department});
- $projectnumber = $form->escape($form->{projectnumber});
- $title = $form->escape($form->{title});
+ CA->all_transactions( \%myconfig, \%$form );
- # construct href
- $href = "$form->{script}?action=list_transactions&department=$department&projectnumber=$projectnumber&title=$title";
- for (qw(path oldsort accno login sessionid fromdate todate accounttype gifi_accno l_heading l_subtotal l_accno)) { $href .= "&$_=$form->{$_}" }
+ $department = $form->escape( $form->{department} );
+ $projectnumber = $form->escape( $form->{projectnumber} );
+ $title = $form->escape( $form->{title} );
- $drilldown = $href;
- $drilldown .= "&sort=$form->{sort}";
+ # construct href
+ $href =
+"$form->{script}?action=list_transactions&department=$department&projectnumber=$projectnumber&title=$title";
+ for (
+ qw(path oldsort accno login sessionid fromdate todate accounttype gifi_accno l_heading l_subtotal l_accno)
+ )
+ {
+ $href .= "&$_=$form->{$_}";
+ }
- $href .= "&direction=$form->{direction}";
-
- $form->sort_order();
-
- $drilldown .= "&direction=$form->{direction}";
-
- $form->{prevreport} = $href unless $form->{prevreport};
- $href .= "&prevreport=".$form->escape($form->{prevreport});
- $drilldown .= "&prevreport=".$form->escape($form->{prevreport});
-
- # figure out which column comes first
- $column_header{transdate} = qq|<th><a class=listheading href=$href&sort=transdate>|.$locale->text('Date').qq|</a></th>|;
- $column_header{reference} = qq|<th><a class=listheading href=$href&sort=reference>|.$locale->text('Reference').qq|</a></th>|;
- $column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
- $column_header{cleared} = qq|<th class=listheading>|.$locale->text('R').qq|</th>|;
- $column_header{source} = qq|<th class=listheading>|.$locale->text('Source').qq|</th>|;
- $column_header{debit} = qq|<th class=listheading>|.$locale->text('Debit').qq|</th>|;
- $column_header{credit} = qq|<th class=listheading>|.$locale->text('Credit').qq|</th>|;
- $column_header{balance} = qq|<th class=listheading>|.$locale->text('Balance').qq|</th>|;
- $column_header{accno} = qq|<th class=listheading>|.$locale->text('AR/AP').qq|</th>|;
-
- @columns = qw(transdate reference description debit credit);
- if ($form->{link} =~ /_paid/) {
- @columns = qw(transdate reference description source cleared debit credit);
- }
- push @columns, "accno" if $form->{l_accno};
- @column_index = $form->sort_columns(@columns);
-
-
- if ($form->{accounttype} eq 'gifi') {
- for (qw(accno description)) { $form->{$_} = $form->{"gifi_$_"} }
- }
- if ($form->{accno}) {
- push @column_index, "balance";
- }
-
- $form->{title} = ($form->{accounttype} eq 'gifi') ? $locale->text('GIFI') : $locale->text('Account');
-
- $form->{title} .= " $form->{accno} - $form->{description}";
+ $drilldown = $href;
+ $drilldown .= "&sort=$form->{sort}";
+
+ $href .= "&direction=$form->{direction}";
+
+ $form->sort_order();
+
+ $drilldown .= "&direction=$form->{direction}";
+
+ $form->{prevreport} = $href unless $form->{prevreport};
+ $href .= "&prevreport=" . $form->escape( $form->{prevreport} );
+ $drilldown .= "&prevreport=" . $form->escape( $form->{prevreport} );
+
+ # figure out which column comes first
+ $column_header{transdate} =
+ qq|<th><a class=listheading href=$href&sort=transdate>|
+ . $locale->text('Date')
+ . qq|</a></th>|;
+ $column_header{reference} =
+ qq|<th><a class=listheading href=$href&sort=reference>|
+ . $locale->text('Reference')
+ . qq|</a></th>|;
+ $column_header{description} =
+ qq|<th><a class=listheading href=$href&sort=description>|
+ . $locale->text('Description')
+ . qq|</a></th>|;
+ $column_header{cleared} =
+ qq|<th class=listheading>| . $locale->text('R') . qq|</th>|;
+ $column_header{source} =
+ qq|<th class=listheading>| . $locale->text('Source') . qq|</th>|;
+ $column_header{debit} =
+ qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
+ $column_header{credit} =
+ qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
+ $column_header{balance} =
+ qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
+ $column_header{accno} =
+ qq|<th class=listheading>| . $locale->text('AR/AP') . qq|</th>|;
+
+ @columns = qw(transdate reference description debit credit);
+ if ( $form->{link} =~ /_paid/ ) {
+ @columns =
+ qw(transdate reference description source cleared debit credit);
+ }
+ push @columns, "accno" if $form->{l_accno};
+ @column_index = $form->sort_columns(@columns);
- if ($form->{department}) {
- ($department) = split /--/, $form->{department};
- $options = $locale->text('Department')." : $department<br>";
- }
- if ($form->{projectnumber}) {
- ($projectnumber) = split /--/, $form->{projectnumber};
- $options .= $locale->text('Project Number')." : $projectnumber<br>";
- }
+ if ( $form->{accounttype} eq 'gifi' ) {
+ for (qw(accno description)) { $form->{$_} = $form->{"gifi_$_"} }
+ }
+ if ( $form->{accno} ) {
+ push @column_index, "balance";
+ }
+ $form->{title} =
+ ( $form->{accounttype} eq 'gifi' )
+ ? $locale->text('GIFI')
+ : $locale->text('Account');
- if ($form->{fromdate} || $form->{todate}) {
+ $form->{title} .= " $form->{accno} - $form->{description}";
- if ($form->{fromdate}) {
- $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
+ if ( $form->{department} ) {
+ ($department) = split /--/, $form->{department};
+ $options = $locale->text('Department') . " : $department<br>";
}
- if ($form->{todate}) {
- $todate = $locale->date(\%myconfig, $form->{todate}, 1);
+ if ( $form->{projectnumber} ) {
+ ($projectnumber) = split /--/, $form->{projectnumber};
+ $options .= $locale->text('Project Number') . " : $projectnumber<br>";
}
-
- $form->{period} = "$fromdate - $todate";
- } else {
- $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
- }
- $form->{period} = "<a href=$form->{prevreport}>$form->{period}</a>" if $form->{prevreport};
-
- $options .= $form->{period};
-
-
- # construct callback
- $department = $form->escape($form->{department},1);
- $projectnumber = $form->escape($form->{projectnumber},1);
- $title = $form->escape($form->{title},1);
- $form->{prevreport} = $form->escape($form->{prevreport},1);
-
- $form->{callback} = "$form->{script}?action=list_transactions&department=$department&projectnumber=$projectnumber&title=$title";
- for (qw(path direction oldsort accno login sessionid fromdate todate accounttype gifi_accno l_heading l_subtotal l_accno prevreport)) { $form->{callback} .= "&$_=$form->{$_}" }
-
-
- $form->header;
+ if ( $form->{fromdate} || $form->{todate} ) {
+
+ if ( $form->{fromdate} ) {
+ $fromdate = $locale->date( \%myconfig, $form->{fromdate}, 1 );
+ }
+ if ( $form->{todate} ) {
+ $todate = $locale->date( \%myconfig, $form->{todate}, 1 );
+ }
+
+ $form->{period} = "$fromdate - $todate";
+ }
+ else {
+ $form->{period} =
+ $locale->date( \%myconfig, $form->current_date( \%myconfig ), 1 );
+ }
- print qq|
+ $form->{period} = "<a href=$form->{prevreport}>$form->{period}</a>"
+ if $form->{prevreport};
+
+ $options .= $form->{period};
+
+ # construct callback
+ $department = $form->escape( $form->{department}, 1 );
+ $projectnumber = $form->escape( $form->{projectnumber}, 1 );
+ $title = $form->escape( $form->{title}, 1 );
+ $form->{prevreport} = $form->escape( $form->{prevreport}, 1 );
+
+ $form->{callback} =
+"$form->{script}?action=list_transactions&department=$department&projectnumber=$projectnumber&title=$title";
+ for (
+ qw(path direction oldsort accno login sessionid fromdate todate accounttype gifi_accno l_heading l_subtotal l_accno prevreport)
+ )
+ {
+ $form->{callback} .= "&$_=$form->{$_}";
+ }
+
+ $form->header;
+
+ print qq|
<body>
<table width=100%>
@@ -387,111 +459,134 @@ sub list_transactions {
<tr class=listheading>
|;
- for (@column_index) { print "$column_header{$_}\n" }
+ for (@column_index) { print "$column_header{$_}\n" }
- print qq|
+ print qq|
</tr>
|;
- # add sort to callback
- $form->{callback} = $form->escape($form->{callback} . "&sort=$form->{sort}");
+ # add sort to callback
+ $form->{callback} =
+ $form->escape( $form->{callback} . "&sort=$form->{sort}" );
- if (@{ $form->{CA} }) {
- $sameitem = $form->{CA}->[0]->{$form->{sort}};
- }
+ if ( @{ $form->{CA} } ) {
+ $sameitem = $form->{CA}->[0]->{ $form->{sort} };
+ }
- $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
- $ml *= -1 if $form->{contra};
+ $ml = ( $form->{category} =~ /(A|E)/ ) ? -1 : 1;
+ $ml *= -1 if $form->{contra};
- if ($form->{accno} && $form->{balance}) {
-
- for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
+ if ( $form->{accno} && $form->{balance} ) {
- $column_data{balance} = "<td align=right>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</td>";
+ for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
- $i++; $i %= 2;
-
- print qq|
+ $column_data{balance} =
+ "<td align=right>"
+ . $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 )
+ . "</td>";
+
+ $i++;
+ $i %= 2;
+
+ print qq|
<tr class=listrow$i>
|;
- for (@column_index) { print "$column_data{$_}\n" }
- print qq|
+ for (@column_index) { print "$column_data{$_}\n" }
+ print qq|
</tr>
|;
- }
-
- foreach $ca (@{ $form->{CA} }) {
-
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $ca->{$form->{sort}}) {
- &ca_subtotal;
- }
}
-
- # construct link to source
- $href = "<a href=$ca->{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$form->{callback}>$ca->{reference}</a>";
-
-
- $column_data{debit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{debit}, 2, "&nbsp;")."</td>";
- $column_data{credit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{credit}, 2, "&nbsp;")."</td>";
-
- $form->{balance} += $ca->{amount};
- $column_data{balance} = "<td align=right>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</td>";
-
- $subtotaldebit += $ca->{debit};
- $subtotalcredit += $ca->{credit};
-
- $totaldebit += $ca->{debit};
- $totalcredit += $ca->{credit};
-
- $column_data{transdate} = qq|<td>$ca->{transdate}</td>|;
- $column_data{reference} = qq|<td>$href</td>|;
- $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
-
- $column_data{cleared} = ($ca->{cleared}) ? qq|<td>*</td>| : qq|<td>&nbsp;</td>|;
- $column_data{source} = qq|<td>$ca->{source}&nbsp;</td>|;
-
- $column_data{accno} = qq|<td>|;
- for (@{ $ca->{accno} }) { $column_data{accno} .= "<a href=$drilldown&accno=$_>$_</a> " }
- $column_data{accno} .= qq|&nbsp;</td>|;
-
- if ($ca->{id} != $sameid) {
- $i++; $i %= 2;
- }
- $sameid = $ca->{id};
- print qq|
+ foreach $ca ( @{ $form->{CA} } ) {
+
+ if ( $form->{l_subtotal} eq 'Y' ) {
+ if ( $sameitem ne $ca->{ $form->{sort} } ) {
+ &ca_subtotal;
+ }
+ }
+
+ # construct link to source
+ $href =
+"<a href=$ca->{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$form->{callback}>$ca->{reference}</a>";
+
+ $column_data{debit} =
+ "<td align=right>"
+ . $form->format_amount( \%myconfig, $ca->{debit}, 2, "&nbsp;" )
+ . "</td>";
+ $column_data{credit} =
+ "<td align=right>"
+ . $form->format_amount( \%myconfig, $ca->{credit}, 2, "&nbsp;" )
+ . "</td>";
+
+ $form->{balance} += $ca->{amount};
+ $column_data{balance} =
+ "<td align=right>"
+ . $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 )
+ . "</td>";
+
+ $subtotaldebit += $ca->{debit};
+ $subtotalcredit += $ca->{credit};
+
+ $totaldebit += $ca->{debit};
+ $totalcredit += $ca->{credit};
+
+ $column_data{transdate} = qq|<td>$ca->{transdate}</td>|;
+ $column_data{reference} = qq|<td>$href</td>|;
+ $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
+
+ $column_data{cleared} =
+ ( $ca->{cleared} ) ? qq|<td>*</td>| : qq|<td>&nbsp;</td>|;
+ $column_data{source} = qq|<td>$ca->{source}&nbsp;</td>|;
+
+ $column_data{accno} = qq|<td>|;
+ for ( @{ $ca->{accno} } ) {
+ $column_data{accno} .= "<a href=$drilldown&accno=$_>$_</a> ";
+ }
+ $column_data{accno} .= qq|&nbsp;</td>|;
+
+ if ( $ca->{id} != $sameid ) {
+ $i++;
+ $i %= 2;
+ }
+ $sameid = $ca->{id};
+
+ print qq|
<tr class=listrow$i>
|;
- for (@column_index) { print "$column_data{$_}\n" }
+ for (@column_index) { print "$column_data{$_}\n" }
- print qq|
+ print qq|
</tr>
|;
- }
-
+ }
- if ($form->{l_subtotal} eq 'Y') {
- &ca_subtotal;
- }
-
+ if ( $form->{l_subtotal} eq 'Y' ) {
+ &ca_subtotal;
+ }
- for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
- $column_data{debit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totaldebit, 2, "&nbsp;")."</th>";
- $column_data{credit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totalcredit, 2, "&nbsp;")."</th>";
- $column_data{balance} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</th>";
+ for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
+
+ $column_data{debit} =
+ "<th align=right class=listtotal>"
+ . $form->format_amount( \%myconfig, $totaldebit, 2, "&nbsp;" ) . "</th>";
+ $column_data{credit} =
+ "<th align=right class=listtotal>"
+ . $form->format_amount( \%myconfig, $totalcredit, 2, "&nbsp;" ) . "</th>";
+ $column_data{balance} =
+ "<th align=right class=listtotal>"
+ . $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 )
+ . "</th>";
- print qq|
+ print qq|
<tr class=listtotal>
|;
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
+ for (@column_index) { print "$column_data{$_}\n" }
+
+ print qq|
</tr>
</table>
</td>
@@ -504,29 +599,34 @@ sub list_transactions {
</body>
</html>
|;
-
-}
+}
sub ca_subtotal {
- for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
- $column_data{debit} = "<th align=right class=listsubtotal>".$form->format_amount(\%myconfig, $subtotaldebit, 2, "&nbsp;") . "</th>";
- $column_data{credit} = "<th align=right class=listsubtotal>".$form->format_amount(\%myconfig, $subtotalcredit, 2, "&nbsp;") . "</th>";
-
- $subtotaldebit = 0;
- $subtotalcredit = 0;
+ for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
- $sameitem = $ca->{$form->{sort}};
+ $column_data{debit} =
+ "<th align=right class=listsubtotal>"
+ . $form->format_amount( \%myconfig, $subtotaldebit, 2, "&nbsp;" )
+ . "</th>";
+ $column_data{credit} =
+ "<th align=right class=listsubtotal>"
+ . $form->format_amount( \%myconfig, $subtotalcredit, 2, "&nbsp;" )
+ . "</th>";
- print qq|
+ $subtotaldebit = 0;
+ $subtotalcredit = 0;
+
+ $sameitem = $ca->{ $form->{sort} };
+
+ print qq|
<tr class=listsubtotal>
|;
- for (@column_index) { print "$column_data{$_}\n" }
+ for (@column_index) { print "$column_data{$_}\n" }
- print qq|
+ print qq|
</tr>
|;