[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1592] trunk
- Subject: SF.net SVN: ledger-smb: [1592] trunk
- From: ..hidden..
- Date: Thu, 13 Sep 2007 17:32:13 -0700
Revision: 1592
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1592&view=rev
Author: tetragon
Date: 2007-09-13 17:32:13 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
Getting rid of the last print HTML from bin/ca.pl
Modified Paths:
--------------
trunk/UI/am-list-accounts.html
trunk/bin/ca.pl
Added Paths:
-----------
trunk/UI/ca-list-selector.html
trunk/UI/ca-list-transactions.csv
trunk/UI/ca-list-transactions.html
Modified: trunk/UI/am-list-accounts.html
===================================================================
--- trunk/UI/am-list-accounts.html 2007-09-13 23:50:02 UTC (rev 1591)
+++ trunk/UI/am-list-accounts.html 2007-09-14 00:32:13 UTC (rev 1592)
@@ -12,7 +12,6 @@
<meta name="robots" content="noindex,nofollow" />
</head>
-
<?lsmb PROCESS elements.html ?>
<body>
@@ -54,10 +53,8 @@
<br />
<form method="post" action="<?lsmb form.script ?>">
-<?lsmb FOREACH pair IN form.callback.split('&') ?><?lsmb hidden = pair.split('=') ?>
-<?lsmb IF NOT loop.first ?>
-<?lsmb PROCESS input element_data={type => 'hidden', name => hidden.0, value => hidden.1} ?>
-<?lsmb END ?><?lsmb END ?>
+<?lsmb FOREACH pair IN form.callback.split('&') ?><?lsmb hidden = pair.split('=') ?><?lsmb IF NOT loop.first ?>
+<?lsmb PROCESS input element_data={type => 'hidden', name => hidden.0, value => hidden.1} ?><?lsmb END ?><?lsmb END ?>
<?lsmb PROCESS input element_data={type => 'hidden', name => 'callback', value => form.callback} ?>
<?lsmb FOREACH button IN buttons ?><?lsmb PROCESS button element_data=button ?><?lsmb END ?>
Added: trunk/UI/ca-list-selector.html
===================================================================
--- trunk/UI/ca-list-selector.html (rev 0)
+++ trunk/UI/ca-list-selector.html 2007-09-14 00:32:13 UTC (rev 1592)
@@ -0,0 +1,79 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title><?lsmb form.titlebar ?></title>
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Expires" content="-1" />
+ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+ <link rel="stylesheet" href="css/<?lsmb form.stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+
+ <meta name="robots" content="noindex,nofollow" />
+
+</head>
+<?lsmb PROCESS elements.html ?>
+<body>
+
+<form method="post" action="ca.pl">
+
+<?lsmb FOREACH hidden IN ['accno', 'description', 'sort', 'oldsort', 'accounttype', 'gifi_accno', 'gifi_description'];
+ PROCESS input element_data={type => 'hidden', name => hidden, value => form.$hidden}; END ?>
+
+<table border="0" width="100%">
+ <tr><th class="listtop"><?lsmb form.title ?></th></tr>
+ <tr height="5"></tr>
+ <tr valign="top">
+ <td>
+ <table>
+
+ <tr>
+ <th align="right"><?lsmb text('From') ?></th>
+ <td><?lsmb PROCESS input element_data={class => 'date', name => 'fromdate' size => '11', title="yyyy-mm-dd"} ?></td>
+ <th align="right"><?lsmb text('To') ?></th>
+ <td><?lsmb PROCESS input element_data={class => 'date', name => 'todate' size => '11', title="yyyy-mm-dd"} ?></td>
+ </tr>
+
+<?lsmb IF form.all_department ?>
+ <tr>
+ <th align="right"><?lsmb text('Department') ?></th>
+ <td colspan="3">
+ <?lsmb PROCESS select element_data=selectdepartment ?></td>
+ </tr>
+<?lsmb END ?>
+<?lsmb IF form.all_years ?>
+ <tr>
+ <th align="right"><?lsmb text('Period') ?></th>
+ <td colspan="3">
+ <?lsmb PROCESS select element_data=selectmonth ?>
+ <?lsmb PROCESS select element_data=selectyear ?>
+ <?lsmb FOREACH button IN intervals ?>
+ <?lsmb PROCESS input element_data=button; button.text ?>
+ <?lsmb END ?>
+ </td>
+ </tr>
+<?lsmb END ?>
+
+ <tr>
+ <th align="right"><?lsmb text('Include in Report') ?></th>
+ <td colspan="3">
+ <?lsmb FOREACH check IN includes;
+ PROCESS input element_data=check; check.text; END ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr><td><hr size=3 noshade></td></tr>
+</table>
+
+<?lsmb FOREACH hidden IN ['login', 'path', 'sessionid'];
+ PROCESS input element_data={type => 'hidden', name => hidden, value => form.$hidden}; END ?>
+
+<br />
+<?lsmb PROCESS button element_data={class => "submit", name => "action", value => "list_transactions", text => text('List Transactions')} ?>
+</form>
+
+</body>
+</html>
Added: trunk/UI/ca-list-transactions.csv
===================================================================
--- trunk/UI/ca-list-transactions.csv (rev 0)
+++ trunk/UI/ca-list-transactions.csv 2007-09-14 00:32:13 UTC (rev 1592)
@@ -0,0 +1,3 @@
+<?lsmb FOREACH column IN columns ?><?lsmb IF heading.$column.text; heading.$column.text; ELSE; heading.$column; END ?><?lsmb IF NOT loop.last ?>,<?lsmb END ?><?lsmb END ?>
+<?lsmb FOREACH row IN rows ?><?lsmb FOREACH column IN columns ?><?lsmb IF row.$column.text; row.$column.text; ELSIF column == 'accno'; accs = []; FOREACH account IN row.accno; accs.push(account.text); END; accs.join(':'); ELSE; row.$column; END ?><?lsmb IF NOT loop.last ?>,<?lsmb END ?><?lsmb END ?>
+<?lsmb END ?><?lsmb FOREACH column IN columns ?><?lsmb totals.$column ?><?lsmb IF NOT loop.last ?>,<?lsmb END ?><?lsmb END ?>
Added: trunk/UI/ca-list-transactions.html
===================================================================
--- trunk/UI/ca-list-transactions.html (rev 0)
+++ trunk/UI/ca-list-transactions.html 2007-09-14 00:32:13 UTC (rev 1592)
@@ -0,0 +1,94 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title><?lsmb form.titlebar ?></title>
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Expires" content="-1" />
+ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+ <link rel="stylesheet" href="css/<?lsmb form.stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="robots" content="noindex,nofollow" />
+
+</head>
+<?lsmb PROCESS elements.html ?>
+<body>
+
+<table width="100%">
+ <tr>
+ <th class="listtop"><?lsmb form.title ?></th>
+ </tr>
+ <tr><td colspan="<?lsmb columns.size ?>"> </td></tr>
+ <tr>
+ <td><?lsmb FOREACH option IN options; IF option.text ?><a href="<?lsmb option.href ?>"><?lsmb option.text ?></a><?lsmb ELSE; option ?><br /><?lsmb END; END ?></td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%">
+ <tr class="listheading">
+<?lsmb FOREACH column IN columns ?><?lsmb IF heading.$column.href ?>
+<th class="listheading"><a class="listheading" href="<?lsmb heading.$column.href ?>"><?lsmb heading.$column.text ?></a></th>
+<?lsmb ELSE ?>
+<th class="listheading"><?lsmb heading.$column ?></th>
+<?lsmb END ?>
+<?lsmb END ?>
+ </tr>
+
+<?lsmb FOREACH row IN rows ?>
+<?lsmb IF row.is_subtotal ?>
+ <tr class="listsubtotal">
+ <?lsmb FOREACH column IN columns ?>
+ <th align="right" class="listsubtotal"><?lsmb row.$column ?></th>
+ <?lsmb END ?>
+ </tr>
+<?lsmb ELSE ?>
+ <tr class="listrow<?lsmb row.i ?>">
+ <?lsmb FOREACH column IN columns ?>
+ <?lsmb IF column == 'balance' ?>
+ <td align="right">
+ <?lsmb ELSIF column == 'debit' ?>
+ <td align="right">
+ <?lsmb ELSIF column == 'credit' ?>
+ <td align="right">
+ <?lsmb ELSE ?>
+ <td>
+ <?lsmb END ?>
+ <?lsmb IF column == 'accno'; FOREACH link IN row.accno ?>
+ <a href="<?lsmb link.href ?>"><?lsmb link.text ?></a>
+ <?lsmb END; ELSIF row.$column.href ?>
+ <a href="<?lsmb row.$column.href?>"><?lsmb row.$column.text ?></a>
+ <?lsmb ELSE ?>
+ <?lsmb row.$column ?>
+ <?lsmb END ?>
+ </td>
+ <?lsmb END ?>
+ </tr>
+<?lsmb END ?>
+<?lsmb END ?>
+ <tr class="listtotal">
+<?lsmb FOREACH column IN columns ?>
+<th align="right" class="listtotal"><?lsmb totals.$column ?></th>
+<?lsmb END ?>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size="3" noshade="noshade" /></td>
+ </tr>
+</table>
+
+<br />
+
+<form method="post" action="ca.pl">
+<?lsmb FOREACH pair IN form.callback.split('&') ?><?lsmb hidden = pair.split('=') ?>
+<?lsmb IF NOT loop.first ?>
+<?lsmb PROCESS input element_data={type => 'hidden', name => hidden.0, value => hidden.1} ?>
+<?lsmb END ?><?lsmb END ?>
+<?lsmb PROCESS input element_data={type => 'hidden', name => 'callback', value => form.callback} ?>
+
+<?lsmb FOREACH button IN buttons ?><?lsmb PROCESS button element_data=button ?><?lsmb END ?>
+</form>
+
+</body>
+</html>
Modified: trunk/bin/ca.pl
===================================================================
--- trunk/bin/ca.pl 2007-09-13 23:50:02 UTC (rev 1591)
+++ trunk/bin/ca.pl 2007-09-14 00:32:13 UTC (rev 1592)
@@ -190,114 +190,69 @@
# get departments
$form->all_departments( \%myconfig );
+ my $selectdepartment;
if ( @{ $form->{all_department} } ) {
- $form->{selectdepartment} = "<option>\n";
-
+ $selectdepartment = {name => 'department', options => []};
for ( @{ $form->{all_department} } ) {
- $form->{selectdepartment} .=
-qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
+ push @{$selectdepartment->{options}}, {
+ value => "$_->{description}--$_->{id}",
+ text => $_->{description}};
}
}
- $department = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
- </tr>
-| if $form->{selectdepartment};
-
+ my $selectmonth;
+ my $selectyear;
+ my $interval;
if ( @{ $form->{all_years} } ) {
# accounting years
- $form->{selectaccountingyear} = "<option>\n";
+ $selectyear = {name => 'year', options => []};
for ( @{ $form->{all_years} } ) {
- $form->{selectaccountingyear} .= qq|<option>$_\n|;
+ push @{$selectyear->{options}}, {value => $_, text => $_};
}
- $form->{selectaccountingmonth} = "<option>\n";
+
+ $selectmonth = {name => 'month', options => []};
for ( sort keys %{ $form->{all_month} } ) {
- $form->{selectaccountingmonth} .=
- qq|<option value=$_>|
- . $locale->text( $form->{all_month}{$_} ) . qq|\n|;
+ push @{$selectmonth->{options}}, {value => $_,
+ text => $locale->text($form->{all_month}{$_})};
}
-
- $selectfrom = qq|
- <tr>
- <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> |
- . $locale->text('Current') . qq|
- <input name=interval class=radio type=radio value=1> |
- . $locale->text('Month') . qq|
- <input name=interval class=radio type=radio value=3> |
- . $locale->text('Quarter') . qq|
- <input name=interval class=radio type=radio value=12> |
- . $locale->text('Year') . qq|
- </td>
- </tr>
-|;
+ $intervals = [
+ {type => 'radio', name => 'interval', value => '0',
+ checked => 'checked', text => $locale->text('Current')},
+ {type => 'radio', name => 'interval', value => '1',
+ text => $locale->text('Month')},
+ {type => 'radio', name => 'interval', value => '3',
+ text => $locale->text('Quarter')},
+ {type => 'radio', name => 'interval', value => '12',
+ text => $locale->text('Year')}];
}
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=accno value=$form->{accno}>
-<input type=hidden name=description value="$form->{description}">
-
-<input type=hidden name=sort value=transdate>
-<input type=hidden name=oldsort value=transdate>
-
-<input type=hidden name=accounttype value=$form->{accounttype}>
-<input type=hidden name=gifi_accno value=$form->{gifi_accno}>
-<input type=hidden name=gifi_description value="$form->{gifi_description}">
-
-<table border=0 width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- $department
- <tr>
- <th align=right>| . $locale->text('From') . qq|</th>
- <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}"></td>
- <th align=right>| . $locale->text('To') . qq|</th>
- <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td>
- </tr>
- $selectfrom
- <tr>
- <th align=right>| . $locale->text('Include in Report') . qq|</th>
- <td colspan=3>
- <input name=l_accno class=checkbox type=checkbox value=Y> |
- . $locale->text('AR/AP') . qq|
- <input name=l_subtotal class=checkbox type=checkbox value=Y> |
- . $locale->text('Subtotal') . qq|
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr><td><hr size=3 noshade></td></tr>
-</table>
-
-<input type="hidden" name="login" value="$form->{login}">
-<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>
-</form>
-
-</body>
-</html>
-|;
-
+ my @includes = ({
+ type => 'checkbox',
+ name => 'l_accno',
+ value => 'Y',
+ text => $locale->text('AR/AP'),
+ },{
+ type => 'checkbox',
+ name => 'l_subtotal',
+ value => 'Y',
+ text => $locale->text('Subtotal'),
+ });
+ $form->{sort} ||= ''; #SC: blah. Find out why this breaks when undef
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig,
+ locale => $locale,
+ path => 'UI',
+ template => 'ca-list-selector',
+ format => 'HTML');
+ $template->render({
+ form => $form,
+ includes => ..hidden..,
+ selectmonth => $selectmonth,
+ selectyear => $selectyear,
+ selectdepartment => $selectdepartment,
+ intervals => $intervals,
+ });
}
sub list_transactions {
@@ -332,30 +287,21 @@
$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>|;
+ $column_header{transdate} = {
+ text => $locale->text('Date'),
+ href => "$href&sort=transdate"};
+ $column_header{reference} = {
+ text => $locale->text('Reference'),
+ href => "$href&sort=reference"};
+ $column_header{description} = {
+ text => $locale->text('Description'),
+ href => "$href&sort=description"};
+ $column_header{cleared} = $locale->text('R');
+ $column_header{source} = $locale->text('Source');
+ $column_header{debit} = $locale->text('Debit');
+ $column_header{credit} = $locale->text('Credit');
+ $column_header{balance} = $locale->text('Balance');
+ $column_header{accno} = $locale->text('AR/AP');
@columns = qw(transdate reference description debit credit);
if ( $form->{link} =~ /_paid/ ) {
@@ -379,13 +325,14 @@
$form->{title} .= " $form->{accno} - $form->{description}";
+ my @options;
if ( $form->{department} ) {
($department) = split /--/, $form->{department};
- $options = $locale->text('Department') . " : $department<br>";
+ push @options, $locale->text('Department') . " : $department";
}
if ( $form->{projectnumber} ) {
($projectnumber) = split /--/, $form->{projectnumber};
- $options .= $locale->text('Project Number') . " : $projectnumber<br>";
+ push @options, $locale->text('Project Number') . " : $projectnumber";
}
if ( $form->{fromdate} || $form->{todate} ) {
@@ -404,10 +351,11 @@
$locale->date( \%myconfig, $form->current_date( \%myconfig ), 1 );
}
- $form->{period} = "<a href=$form->{prevreport}>$form->{period}</a>"
- if $form->{prevreport};
+ if ($form->{prevreport}) {
+ push @options, {text => $form->{period}, href=> $form->{prevreport}};
+ $form->{period} = "<a href=$form->{prevreport}>$form->{period}</a>";
+ }
- $options .= $form->{period};
# construct callback
$department = $form->escape( $form->{department}, 1 );
@@ -424,35 +372,11 @@
$form->{callback} .= "&$_=$form->{$_}";
}
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$options</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
# add sort to callback
$form->{callback} =
$form->escape( $form->{callback} . "&sort=$form->{sort}" );
+ my @rows;
if ( @{ $form->{CA} } ) {
$sameitem = $form->{CA}->[0]->{ $form->{sort} };
}
@@ -461,53 +385,38 @@
$ml *= -1 if $form->{contra};
if ( $form->{accno} && $form->{balance} ) {
+ my %column_data;
- for (@column_index) { $column_data{$_} = "<td> </td>" }
+ for (@column_index) { $column_data{$_} = " " }
$column_data{balance} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 )
- . "</td>";
+ $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 );
$i++;
$i %= 2;
- print qq|
- <tr class=listrow$i>
-|;
- for (@column_index) { print "$column_data{$_}\n" }
- print qq|
- </tr>
-|;
+ $column_data{i} = $i;
+ push @rows, \%column_data;
}
- foreach $ca ( @{ $form->{CA} } ) {
+ foreach my $ca ( @{ $form->{CA} } ) {
+ my %column_data;
if ( $form->{l_subtotal} eq 'Y' ) {
if ( $sameitem ne $ca->{ $form->{sort} } ) {
- &ca_subtotal;
+ push @rows, &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, " " )
- . "</td>";
+ $form->format_amount( \%myconfig, $ca->{debit}, 2, " " );
$column_data{credit} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $ca->{credit}, 2, " " )
- . "</td>";
+ $form->format_amount( \%myconfig, $ca->{credit}, 2, " " );
$form->{balance} += $ca->{amount};
$column_data{balance} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 )
- . "</td>";
+ $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 );
$subtotaldebit += $ca->{debit};
$subtotalcredit += $ca->{credit};
@@ -515,19 +424,21 @@
$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} </td>|;
+ $column_data{transdate} = $ca->{transdate};
+ $column_data{reference} = {
+ text => $ca->{reference},
+ href => "$ca->{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$form->{callback}"};
+ $column_data{description} = $ca->{description};
+
$column_data{cleared} =
- ( $ca->{cleared} ) ? qq|<td>*</td>| : qq|<td> </td>|;
- $column_data{source} = qq|<td>$ca->{source} </td>|;
+ ( $ca->{cleared} ) ? "*" : " ";
+ $column_data{source} = $ca->{source};
- $column_data{accno} = qq|<td>|;
+ $column_data{accno} = [];
for ( @{ $ca->{accno} } ) {
- $column_data{accno} .= "<a href=$drilldown&accno=$_>$_</a> ";
+ push @{$column_data{accno}}, {text => $_, href=> "$drilldown&accno=$_>"};
}
- $column_data{accno} .= qq| </td>|;
if ( $ca->{id} != $sameid ) {
$i++;
@@ -535,84 +446,69 @@
}
$sameid = $ca->{id};
- print qq|
- <tr class=listrow$i>
-|;
+ $column_data{i} = $i;
+ push @rows, \%column_data;
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
-
}
if ( $form->{l_subtotal} eq 'Y' ) {
- &ca_subtotal;
+ push @rows, &ca_subtotal;
}
- for (@column_index) { $column_data{$_} = "<td> </td>" }
+ for (@column_index) { $column_data{$_} = " " }
$column_data{debit} =
- "<th align=right class=listtotal>"
- . $form->format_amount( \%myconfig, $totaldebit, 2, " " ) . "</th>";
+ $form->format_amount( \%myconfig, $totaldebit, 2, " " );
$column_data{credit} =
- "<th align=right class=listtotal>"
- . $form->format_amount( \%myconfig, $totalcredit, 2, " " ) . "</th>";
+ $form->format_amount( \%myconfig, $totalcredit, 2, " " );
$column_data{balance} =
- "<th align=right class=listtotal>"
- . $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 )
- . "</th>";
+ $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 );
- print qq|
- <tr class=listtotal>
-|;
+ my @buttons;
+ push @buttons, {
+ name => 'action',
+ value => 'csv_list_transactions',
+ text => $locale->text('CSV Report'),
+ type => 'submit',
+ class => 'submit',
+ };
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-</body>
-</html>
-|;
-
+ $form->{callback} = $form->unescape($form->{callback});
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig,
+ locale => $locale,
+ path => 'UI',
+ template => 'ca-list-transactions',
+ format => ($form->{action} =~ /^csv/)? 'CSV': 'HTML');
+ $template->render({
+ form => \%$form,
+ options => ..hidden..,
+ buttons => ..hidden..,
+ columns => ..hidden..,
+ heading => \%column_header,
+ totals => \%column_data,
+ rows => ..hidden..,
+ });
}
+sub csv_list_transactions { &list_transactions }
+
sub ca_subtotal {
- for (@column_index) { $column_data{$_} = "<td> </td>" }
+ my %column_data;
+ for (@column_index) { $column_data{$_} = " " }
$column_data{debit} =
- "<th align=right class=listsubtotal>"
- . $form->format_amount( \%myconfig, $subtotaldebit, 2, " " )
- . "</th>";
+ $form->format_amount( \%myconfig, $subtotaldebit, 2, " " );
$column_data{credit} =
- "<th align=right class=listsubtotal>"
- . $form->format_amount( \%myconfig, $subtotalcredit, 2, " " )
- . "</th>";
+ $form->format_amount( \%myconfig, $subtotalcredit, 2, " " );
$subtotaldebit = 0;
$subtotalcredit = 0;
$sameitem = $ca->{ $form->{sort} };
+ $column_data{is_subtotal} = 1;
- print qq|
- <tr class=listsubtotal>
-|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
-
+ return \%column_data;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.