[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2434] trunk
- Subject: SF.net SVN: ledger-smb:[2434] trunk
- From: ..hidden..
- Date: Thu, 25 Dec 2008 23:17:28 +0000
Revision: 2434
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2434&view=rev
Author: einhverfr
Date: 2008-12-25 23:17:28 +0000 (Thu, 25 Dec 2008)
Log Message:
-----------
Adding AP Outstanding Summary Report.
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/bin/aa.pl
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2008-12-22 17:37:05 UTC (rev 2433)
+++ trunk/LedgerSMB/AA.pm 2008-12-25 23:17:28 UTC (rev 2434)
@@ -774,10 +774,9 @@
AND ac.transdate <= ?|;
# push @paidargs, $form->{transdateto};
}
- $form->{summary} = 1;
}
- if ( !$form->{summary} ) {
+ if ( !$form->{summary} and !$form->{outstanding} ) {
$acc_trans_flds = qq|
, c.accno, ac.source,
pr.projectnumber, ac.memo AS description,
@@ -796,7 +795,37 @@
if ($form->{transdateto} eq ''){
delete $form->{transdateto};
}
- $query = qq|
+ if ($form->{summary}){
+ $query = qq|
+ SELECT count(a.id) as invnumber, min(a.transdate) as transdate,
+ min(a.duedate) as duedate,
+ sum(a.netamount) as netamount,
+ sum(a.amount) as amount,
+ sum(a.amount) - sum(acs.amount) AS paid,
+ vce.name, vc.meta_number,
+ a.entity_id,
+ d.description AS department,
+ a.ponumber
+ FROM $table a
+ JOIN entity_credit_account vc ON (a.entity_credit_account = vc.id)
+ JOIN acc_trans acs ON (acs.trans_id = a.id)
+ JOIN entity vce ON (vc.entity_id = vce.id)
+ JOIN chart c ON (acs.chart_id = c.id)
+ LEFT JOIN exchangerate ex ON (ex.curr = a.curr
+ AND ex.transdate = a.transdate)
+ LEFT JOIN department d ON (a.department_id = d.id)
+ $acc_trans_join
+ WHERE c.link = '$form->{ARAP}' AND
+ (|.$dbh->quote($form->{transdateto}) . qq| IS NULL OR
+ |.$dbh->quote($form->{transdateto}) . qq| >= acs.transdate)
+ AND a.approved IS TRUE AND acs.approved IS TRUE
+ AND a.force_closed IS NOT TRUE
+ GROUP BY
+ vc.meta_number, a.entity_id, vce.name, d.description,
+ a.ponumber, a.invoice, a.datepaid
+ HAVING abs(sum(a.amount) - (sum(a.amount) - sum(acs.amount))) > 0.005 |;
+ } else {
+ $query = qq|
SELECT a.id, a.invnumber, a.ordnumber, a.transdate,
a.duedate, a.netamount, a.amount, a.amount - sum(acs.amount) AS paid,
a.invoice, a.datepaid, a.terms, a.notes,
@@ -822,10 +851,10 @@
AND a.force_closed IS NOT TRUE
GROUP BY a.id, a.invnumber, a.ordnumber, a.transdate, a.duedate, a.netamount,
a.amount, a.terms, a.notes, a.shipvia, a.shippingpoint, vce.name,
- vc.meta_number, a.entity_id, a.till, ex.$buysell, d.description,
+ vc.meta_number, a.entity_id, a.till, ex.$buysell, d.description, vce.name,
a.ponumber, a.invoice, a.datepaid $acc_trans_fields
HAVING abs(a.amount - (a.amount - sum(acs.amount))) > 0.005 |;
-
+ }
} else {
$query = qq|
SELECT a.id, a.invnumber, a.ordnumber, a.transdate,
@@ -1015,6 +1044,9 @@
if ($where ne ""){
$query =~ s/GROUP BY / $where \n GROUP BY /;
}
+ if ($form->{summary}){
+ $sortorder = "vc.meta_number";
+ }
$query .= "\n ORDER BY $sortorder";
} else {
$query .= "WHERE ($approved OR a.approved) AND $where
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2008-12-22 17:37:05 UTC (rev 2433)
+++ trunk/bin/aa.pl 2008-12-25 23:17:28 UTC (rev 2434)
@@ -1342,6 +1342,15 @@
</tr>
|;
+ if ( $form->{outstanding} ) {
+ $form->{title} =
+ ( $form->{ARAP} eq 'AR' )
+ ? $locale->text('AR Outstanding')
+ : $locale->text('AP Outstanding');
+ $invnumber = "";
+ $openclosed = "";
+ $summary = "";
+ }
$summary = qq|
<tr>
<td><input name=summary type=radio class=radio value=1 checked> |
@@ -1353,15 +1362,6 @@
</tr>
|;
- if ( $form->{outstanding} ) {
- $form->{title} =
- ( $form->{ARAP} eq 'AR' )
- ? $locale->text('AR Outstanding')
- : $locale->text('AP Outstanding');
- $invnumber = "";
- $openclosed = "";
- $summary = "";
- }
if ( @{ $form->{all_years} } ) {
@@ -1742,7 +1742,7 @@
$href .= "&l_$item=Y";
}
}
- if ( !$form->{summary} ) {
+ if ( !$form->{summary} and !$form->{outstanding}) {
foreach $item (qw(source debit credit accno description projectnumber))
{
push @column_index, $item;
@@ -1983,10 +1983,12 @@
? ( $form->{ARAP} eq 'AR' ) ? "is.pl" : "ir.pl"
: $form->{script};
$module = ( $ref->{till} ) ? "ps.pl" : $module;
-
- $column_data{invnumber} =
+ if ($form->{outstanding} and $form->{summary}){
+ $column_data{invnumber} = "<td>$ref->{invnumber}</td>";
+ } else {
+ $column_data{invnumber} =
"<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{invnumber} </a></td>";
-
+ }
for (qw(notes description)) { $ref->{$_} =~ s/\r?\n/<br>/g }
for (
qw(transdate datepaid duedate department ordnumber ponumber notes shippingpoint shipvia employee manager till source description projectnumber)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.