On 8/3/07, Chris Travers <[EMAIL PROTECTED]> wrote:
>
>
> Hi Charley;
>
> On second view, the problem is likely to be in your acc_trans table.  You
> are just searching AR and AP transaction summary records (which we should
> probably properly normalize in 1.4).  You want to be searching the account
> line items instead.



 Two more queries that might help you locate the discrepency:

SELECT id from ap join acc_trans ON (ap.id = acc_trans.trans_id)
WHERE chart_id = (select id from chart where accno = [ap account number])
GROUP BY ap.id, acc_trans.trans_id, ap.amount, ap.paid
HAVING sum(acc_trans.amount) <> (ap.amount - ap.paid);

This pulls up AP entries with wrong summary info.

SELECT trans_id FROM acc_trans
WHERE trans_id NOT IN (select id FROM ap)
AND chart_id = (select id from chart where accno = [ap account number])
GROUP BY trans_id;

This pulls up any transactions hitting the AP account which are not in the
AP table.

You can modify them to hit ar instead.

Best Wishes,
Chris Travers
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Ledger-smb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

Reply via email to