[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [2035] trunk
- Subject: SF.net SVN: ledger-smb: [2035] trunk
- From: ..hidden..
- Date: Thu, 10 Jan 2008 14:01:44 -0800
Revision: 2035
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2035&view=rev
Author: einhverfr
Date: 2008-01-10 14:01:43 -0800 (Thu, 10 Jan 2008)
Log Message:
-----------
Fixing trial balance to filter all areas of unapproved transactions
Modified Paths:
--------------
trunk/LedgerSMB/CA.pm
trunk/LedgerSMB/RP.pm
trunk/UI/payments/payments_detail.html
Modified: trunk/LedgerSMB/CA.pm
===================================================================
--- trunk/LedgerSMB/CA.pm 2008-01-10 00:23:12 UTC (rev 2034)
+++ trunk/LedgerSMB/CA.pm 2008-01-10 22:01:43 UTC (rev 2035)
@@ -43,10 +43,22 @@
# connect to database
my $dbh = $form->{dbh};
+ my $approved = ($form->{approved})? 'TRUE' : 'FALSE';
+
my $query = qq|
SELECT accno, SUM(acc_trans.amount) AS amount
- FROM chart, acc_trans
- WHERE chart.id = acc_trans.chart_id
+ FROM chart
+ JOIN acc_trans ON (chart.id = acc_trans.chart_id)
+ JOIN transactions ON (acc_trans.trans_id = transactions.id)
+ JOIN (SELECT id, approved, 'ap' AS tablename FROM ap
+ UNION
+ SELECT id, approved, 'ar' as tablename FROM ar
+ UNION
+ SELECT id, approved, 'gl' as tablename FROM gl
+ ) g ON (g.id = acc_trans.trans_id
+ AND transactions.table_name = g.tablename)
+ WHERE ($approved OR acc_trans.approved)
+ AND (g.approved OR $approved)
GROUP BY accno|;
my $sth = $dbh->prepare($query);
@@ -108,6 +120,7 @@
# connect to database
my $dbh = $form->{dbh};
+ my $approved = ($form->{approved})? 'TRUE' : 'FALSE';
# get chart_id
my $query = qq|
@@ -246,6 +259,9 @@
AND
a.department_id
= ?
+ AND ($approved OR
+ (a.approved
+ AND ac.approved))
$project |;
push @queryargs, $form->{gifi_accno}, $form->{fromdate},
@@ -272,6 +288,9 @@
AND
a.department_id
= ?
+ AND ($approved OR
+ (a.approved
+ AND ac.approved))
$project |;
push @queryargs, $form->{accno}, $form->{fromdate},
$department_id;
@@ -292,8 +311,27 @@
FROM acc_trans ac
JOIN chart c ON
(ac.chart_id = c.id)
+ JOIN transactions t ON
+ (t.id = ac.trans_id)
+ JOIN (SELECT id, approved
+ 'ar' AS tablename
+ FROM ar
+ UNION
+ SELECT id, approved,
+ 'ap' AS tablename
+ FROM ap
+ UNION
+ SELECT id, approved,
+ 'gl' AS tablename
+ FROM gl
+ ) a ON
+ (a.tablename = t.table_name
+ AND a.id = t.id)
WHERE c.gifi_accno = ?
AND ac.transdate < ?
+ AND ($approved OR
+ (a.approved
+ AND ac.approved))
$project |;
@queryargs = ( $form->{gifi_accno}, $form->{fromdate} );
if ($p_id) {
@@ -306,8 +344,27 @@
FROM acc_trans ac
JOIN chart c
ON (ac.chart_id = c.id)
+ JOIN transactions t ON
+ (t.id = ac.trans_id)
+ JOIN (SELECT id, approved,
+ 'ar' AS tablename
+ FROM ar
+ UNION
+ SELECT id, approved,
+ 'ap' AS tablename
+ FROM ap
+ UNION
+ SELECT id, approved,
+ 'gl' AS tablename
+ FROM gl
+ ) a ON
+ (a.tablename = t.table_name
+ AND a.id = t.id)
WHERE c.accno = ?
AND ac.transdate < ?
+ AND ($approved OR
+ (a.approved
+ AND ac.approved))
$project |;
@queryargs = ( $form->{accno}, $form->{fromdate} );
if ($p_id) {
@@ -344,6 +401,7 @@
$fromdate_where
$todate_where
$dpt_where
+ AND ($approved OR (a.approved AND ac.approved))
$project|;
if ($d_id) {
push @queryargs, $d_id;
@@ -373,6 +431,7 @@
JOIN entity e ON (a.entity_id = e.id)
$dpt_join
WHERE ac.chart_id = ?
+ AND ($approved OR (a.approved AND ac.approved))
$fromdate_where
$todate_where
$dpt_where
@@ -406,6 +465,7 @@
JOIN entity e ON (a.entity_id = e.id)
$dpt_join
WHERE ac.chart_id = ?
+ AND ($approved OR (a.approved AND ac.approved))
$fromdate_where
$todate_where
$dpt_where
@@ -440,6 +500,7 @@
JOIN acc_trans ac ON (ac.chart_id = c.id)
WHERE ac.amount >= 0
AND (c.link = 'AR' OR c.link = 'AP')
+ AND ac.approved OR $approved
AND ac.trans_id = ?|;
my $dr = $dbh->prepare($query) || $form->dberror($query);
@@ -449,6 +510,7 @@
JOIN acc_trans ac ON (ac.chart_id = c.id)
WHERE ac.amount < 0
AND (c.link = 'AR' OR c.link = 'AP')
+ AND ac.approved OR $approved
AND ac.trans_id = ?|;
my $cr = $dbh->prepare($query) || $form->dberror($query);
Modified: trunk/LedgerSMB/RP.pm
===================================================================
--- trunk/LedgerSMB/RP.pm 2008-01-10 00:23:12 UTC (rev 2034)
+++ trunk/LedgerSMB/RP.pm 2008-01-10 22:01:43 UTC (rev 2035)
@@ -1213,10 +1213,19 @@
SELECT c.accno, sum(ac.amount) AS amount,
c.description, c.category
FROM acc_trans ac
+ JOIN (SELECT id, approved FROM ar
+ UNION
+ SELECT id, approved FROM ap
+ UNION
+ SELECT id, approved FROM gl
+ ) g ON (ac.trans_id = g.id)
JOIN chart c ON (c.id = ac.chart_id)
$dpt_join
WHERE $where $ywhere $dpt_where $category
$project
+ AND ($approved IS NULL OR
+ $approved =
+ (ac.approved AND g.approved))
GROUP BY c.accno, c.description, c.category|;
if ($excludeyearend) {
@@ -1304,6 +1313,7 @@
my ( $self, $myconfig, $form ) = @_;
my $dbh = $form->{dbh};
+ my $approved = ($form->{approved})? 'TRUE' : 'FALSE';
my ( $query, $sth, $ref );
my %balance = ();
@@ -1353,6 +1363,7 @@
$dpt_join
WHERE ac.transdate < '$form->{fromdate}'
$dpt_where $project
+ AND ($approved OR ac.approved)
GROUP BY g.accno, c.category, g.description,
c.contra|;
@@ -1368,6 +1379,7 @@
$dpt_join
WHERE ac.transdate < '$form->{fromdate}'
$dpt_where $project
+ AND ($approved OR ac.approved)
GROUP BY c.accno, c.category, c.description,
c.contra|;
@@ -1447,6 +1459,7 @@
JOIN gifi g ON (c.gifi_accno = g.accno)
$dpt_join
WHERE $where $dpt_where $project
+ AND ($approved OR ac.approved)
GROUP BY g.accno, g.description, c.category, c.contra
ORDER BY accno|;
@@ -1460,6 +1473,7 @@
JOIN chart c ON (c.id = ac.chart_id)
$dpt_join
WHERE $where $dpt_where $project
+ AND $approved OR (ac.approved)
GROUP BY c.accno, c.description, c.category, c.contra
ORDER BY accno|;
@@ -1474,11 +1488,13 @@
JOIN chart c ON (c.id = ac.chart_id)
$dpt_join
WHERE $where $dpt_where $project AND ac.amount < 0
+ AND ($approved OR ac.approved)
AND c.accno = ?) AS debit,
(SELECT SUM(ac.amount) FROM acc_trans ac
JOIN chart c ON (c.id = ac.chart_id)
$dpt_join
WHERE $where $dpt_where $project AND ac.amount > 0
+ AND ($approved OR ac.approved)
AND c.accno = ?) AS credit |;
if ( $form->{accounttype} eq 'gifi' ) {
@@ -1489,6 +1505,7 @@
JOIN chart c ON (c.id = ac.chart_id)
$dpt_join
WHERE $where $dpt_where $project AND ac.amount < 0
+ AND ($approved OR ac.approved)
AND c.gifi_accno = ?) AS debit,
(SELECT SUM(ac.amount)
@@ -1496,6 +1513,7 @@
JOIN chart c ON (c.id = ac.chart_id)
$dpt_join
WHERE $where $dpt_where $project AND ac.amount > 0
+ AND ($approved OR ac.approved)
AND c.gifi_accno = ?) AS credit|;
}
Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html 2008-01-10 00:23:12 UTC (rev 2034)
+++ trunk/UI/payments/payments_detail.html 2008-01-10 22:01:43 UTC (rev 2035)
@@ -285,6 +285,12 @@
class = "submit"
name = 'action'
} ?>
+ <?lsmb INCLUDE button element_data = {
+ text = text('Add Payment Fees') # '
+ value = 'paycom_add_fees'
+ class = 'submit'
+ name = 'action'
+ } ?>
</form>
</body>
</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.