[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1798] trunk
- Subject: SF.net SVN: ledger-smb: [1798] trunk
- From: ..hidden..
- Date: Fri, 19 Oct 2007 16:28:26 -0700
Revision: 1798
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1798&view=rev
Author: tetragon
Date: 2007-10-19 16:28:25 -0700 (Fri, 19 Oct 2007)
Log Message:
-----------
Some fixes to the aging report templating
Modified Paths:
--------------
trunk/LedgerSMB/RP.pm
trunk/UI/rp-aging.html
trunk/bin/rp.pl
Modified: trunk/LedgerSMB/RP.pm
===================================================================
--- trunk/LedgerSMB/RP.pm 2007-10-19 21:26:14 UTC (rev 1797)
+++ trunk/LedgerSMB/RP.pm 2007-10-19 23:28:25 UTC (rev 1798)
@@ -1637,49 +1637,50 @@
my $union = "";
$query .= qq|
- SELECT c.entity_id AS ctid,
- c.meta_number as $form->{ct}number, '' as name,
- '' as address1, '' as address2, '' as city,
- '' as state,
- '' as zipcode,
- '' as country, '' as contact, '' as email,
- '' as $form->{ct}phone,
- '' as $form->{ct}fax,
- '' as $form->{ct}taxnumber,
- a.invnumber, a.transdate, a.till, a.ordnumber,
- a.ponumber, a.notes, c.language_code,
- CASE WHEN
- EXTRACT(days FROM age(a.transdate)/30)
- = 0
- THEN (a.amount - a.paid) ELSE 0 END
- as c0,
- CASE WHEN EXTRACT(days FROM age(a.transdate)/30)
- = 1
- THEN (a.amount - a.paid) ELSE 0 END
- as c30,
- CASE WHEN EXTRACT(days FROM age(a.transdate)/30)
- = 2
- THEN (a.amount - a.paid) ELSE 0 END
- as c60,
- CASE WHEN EXTRACT(days FROM age(a.transdate)/30)
- > 2
- THEN (a.amount - a.paid) ELSE 0 END
- as c90,
- a.duedate, a.invoice, a.id, a.curr,
- (SELECT $buysell FROM exchangerate e
- WHERE a.curr = e.curr
- AND e.transdate = a.transdate)
- AS exchangerate
- FROM $form->{arap} a
- JOIN entity_credit_account c USING (entity_id)
- WHERE $where|;
+ SELECT c.entity_id AS ctid,
+ c.meta_number as $form->{ct}number, e.legal_name as name,
+ '' as address1, '' as address2, '' as city,
+ '' as state,
+ '' as zipcode,
+ '' as country, '' as contact, '' as email,
+ '' as $form->{ct}phone,
+ '' as $form->{ct}fax,
+ '' as $form->{ct}taxnumber,
+ a.invnumber, a.transdate, a.till, a.ordnumber,
+ a.ponumber, a.notes, c.language_code,
+ CASE WHEN
+ EXTRACT(days FROM age(a.transdate)/30)
+ = 0
+ THEN (a.amount - a.paid) ELSE 0 END
+ as c0,
+ CASE WHEN EXTRACT(days FROM age(a.transdate)/30)
+ = 1
+ THEN (a.amount - a.paid) ELSE 0 END
+ as c30,
+ CASE WHEN EXTRACT(days FROM age(a.transdate)/30)
+ = 2
+ THEN (a.amount - a.paid) ELSE 0 END
+ as c60,
+ CASE WHEN EXTRACT(days FROM age(a.transdate)/30)
+ > 2
+ THEN (a.amount - a.paid) ELSE 0 END
+ as c90,
+ a.duedate, a.invoice, a.id, a.curr,
+ (SELECT $buysell FROM exchangerate e
+ WHERE a.curr = e.curr
+ AND e.transdate = a.transdate)
+ AS exchangerate
+ FROM $form->{arap} a
+ JOIN entity_credit_account c USING (entity_id)
+ JOIN company e USING (entity_id)
+ WHERE $where|;
$query .= qq| ORDER BY ctid, curr, $transdate, invnumber|;
$sth = $dbh->prepare($query) || $form->dberror($query);
$sth->execute();
- while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
$form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{module} =
( $ref->{invoice} )
@@ -1694,18 +1695,17 @@
$sth->finish;
# get language
- my $query = qq|SELECT * FROM language ORDER BY 2|;
+ my $query = qq|SELECT code, description FROM language ORDER BY 2|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
$form->db_parse_numeric(sth=>$sth, hashref=>$ref);
push @{ $form->{all_language} }, $ref;
}
$sth->finish;
$dbh->commit;
-
}
sub get_customer {
Modified: trunk/UI/rp-aging.html
===================================================================
--- trunk/UI/rp-aging.html 2007-10-19 21:26:14 UTC (rev 1797)
+++ trunk/UI/rp-aging.html 2007-10-19 23:28:25 UTC (rev 1798)
@@ -15,19 +15,19 @@
<?lsmb PROCESS elements.html ?>
<body>
-
+<form method="post" action="<?lsmb form.script ?>">
<table width="100%">
<tr>
<th class="listtop" colspan="<?lsmb columns.size ?>"><?lsmb form.title ?></th>
</tr>
<tr>
<?lsmb IF options.defined ?>
- <td><?lsmb FOREACH option IN options; option ?><br /><?lsmb END ?></td>
+ <td colspan="<?lsmb columns.size ?>"><?lsmb FOREACH option IN options; option ?><br /><?lsmb END ?></td>
<?lsmb ELSE ?>
<td colspan="<?lsmb columns.size ?>"></td></tr>
<?lsmb END ?>
</tr>
- <?lsmb FOREACH currency IN rows ?>
+ <?lsmb FOREACH currency IN currencies ?>
<tr><td colspan="<?lsmb columns.size ?>"><?lsmb currency.curr ?></td></tr>
<tr class="listheading">
<?lsmb FOREACH column IN columns ?>
@@ -52,8 +52,9 @@
<a href="<?lsmb row.$column.href?>"><?lsmb row.$column.text ?></a>
<?lsmb ELSIF row.$column.delimiter;
FOREACH l IN row.$column.text.split(row.$column.delimiter); l ?><br /><?lsmb END;
- ELSIF row.$column.options; PROCESS option element_data=row.$column;
- ELSIF column == 'statement'; PROCESS input element_data=row.$column;
+ ELSIF row.$column.options; PROCESS select element_data=row.$column;
+ ELSIF column == 'statement' AND row.$column.type.defined;
+ PROCESS input element_data=row.$column;
ELSE; row.$column; END ?>
</<?lsmb s ?>>
<?lsmb END ?>
@@ -72,7 +73,6 @@
<br />
-<form method="post" action="<?lsmb form.script ?>">
<?lsmb IF form.arap == 'ar';
PROCESS select element_data=form.print.template;
PROCESS select element_data=form.print.format;
Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl 2007-10-19 21:26:14 UTC (rev 1797)
+++ trunk/bin/rp.pl 2007-10-19 23:28:25 UTC (rev 1798)
@@ -1516,7 +1516,7 @@
if ( @{ $form->{all_language} } && $form->{arap} eq 'ar' ) {
push @column_index, "language";
- $form->{language_options} = [];
+ $form->{language_options} = [{text => ' ', value => ''}];
for ( @{ $form->{all_language} } ) {
push @{$form->{language_options}},
@@ -1611,7 +1611,7 @@
}
- push @currencies, {};
+ unshift @currencies, {};
$curr = $ref->{curr};
$currencies[0]{curr} = $curr;
}
@@ -1619,18 +1619,17 @@
$k++;
my %column_data;
- if ( $ctid != $ref->{ctid} ) {
-
+ if ( $ctid != $ref->{ctid} or $form->{summary}) {
$i++;
$column_data{ct} = $ref->{name};
-
+
$column_data{language} = {
name => "language_code_$i",
options => $form->{language_options},
default_value => $ref->{language_code},
} if $form->{language_options};
-
+
$column_data{statement} = {
name => "statement_$i",
type => 'checkbox',
@@ -1639,9 +1638,9 @@
$column_data{statement}{checked} = 'checked' if $ref->{checked};
$hiddens{"$form->{ct}_id_$i"} = $ref->{ctid};
$hiddens{"curr_$i"} = $ref->{curr};
-
}
+
$ctid = $ref->{ctid};
for (qw(c0 c30 c60 c90)) {
@@ -1689,13 +1688,16 @@
$j++;
$j %= 2;
$column_data{i} = $j;
+ my $rowref = {};
+ $rowref->{$_} = $column_data{$_} for keys %column_data;
- push @{$currencies[0]{rows}}, \%column_data;
+ push @{$currencies[0]{rows}}, $rowref;
for (qw(ct statement language)) {
$column_data{$_} = ' ';
}
}
+ $column_data{ct} = $ref->{name};
# prepare subtotal
$nextid = ( $k <= $l ) ? $form->{AG}->[$k]->{ctid} : 0;
@@ -1994,6 +1996,7 @@
}
my @batch_data = ();
+ my $selected;
for $i ( 1 .. $form->{rowcount} ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.