diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-05-12 18:43:21 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-05-12 18:43:21 +0000 |
commit | 8001c32ae1623286aaf3081d30685c75cc8a9c77 (patch) | |
tree | 681bc97e7bbd798d70764aa0b690fb5f60e5d330 /sql | |
parent | 58cffa089d925e8cd6323aa1c02d7f60b7296af4 (diff) |
Adding fix for amount blank on AR/AP transaction report
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2134 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql')
-rw-r--r-- | sql/fixes/amount_blank_ap_transactions.sql | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/fixes/amount_blank_ap_transactions.sql b/sql/fixes/amount_blank_ap_transactions.sql new file mode 100644 index 00000000..924e0116 --- /dev/null +++ b/sql/fixes/amount_blank_ap_transactions.sql @@ -0,0 +1,29 @@ +BEGIN; + +UPDATE ap +SET netamount = + (select sum(amount) from acc_trans + where trans_id = ap.id + AND ((chart_id IN (select id from chart where link = 'AP') + AND amount > 0) + OR (chart_id IN + (select id from chart where link like '%tax%') + ) + ) + ) +WHERE netamount IS NULL; + +UPDATE ar +SET netamount = -1 * + (select sum(amount) from acc_trans + where trans_id = ap.id + AND ((chart_id IN (select id from chart where link = 'AP') + AND amount < 0) + OR (chart_id IN + (select id from chart where link like '%tax%') + ) + ) + ) +WHERE netamount IS NULL; + +commit; |