Customer Payment History |
Author |
Message |
|
Posted : 2008-03-25 04:33:13 |
What table do I read to find all payments. I have tried these but get a different total then if I add up all the Payment lines on a “Transaction List by Customer”
select sum(TotalAmount) from ReceivePayment
select sum(TotalAmount-UnusedPayment) from ReceivePayment
select sum(TotalAmount) from ReceivePaymentLine
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-03-26 12:18:19 |
Try starting here:
SELECT ReceivePaymentLine.TxnDate as "Date", Invoice.CustomerRefFullName as "Job",ReceivePaymentLine.AppliedToTxnRefNumber as "Inv No.", Invoice.SubTotal as "Orig. Amt.", ReceivePaymentLine.AppliedToTxnDiscountAmount as "Discount", ReceivePaymentLine.AppliedToTxnAmount as "Payment" FROM ReceivePaymentLine, Invoice where ReceivePaymentLine.AppliedToTxnTxnID= Invoice.TxnID and (ReceivePaymentLine.TxnDate >= {d '2007-06-01'} and ReceivePaymentLine.TxnDate < {d '2008-07-01'}) order by Invoice.CustomerRefFullName
|
|
|
|
|
Posted : 2008-03-26 12:47:13 |
Sorry, no. I tried this in three different companies of the same Quick Books and one is good and 2 don't agree with themselfs.
Here is an example from one of the companies
TxnListByCustomer: Payment = 14896134.46
SELECT sum(AppliedToTxnAmount) FROM qbReceivePaymentLine = 14824297.07
SELECT sum(TotalAmount) FROM qbReceivePayment = 14912145.76 |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-03-26 13:44:35 |
Of course they most likely will not match as some payments may not be applied, should be:
SELECT sum(TotalAmount) - sum(UnusedPayment) FROM ReceivePayment |
|
|
|
|
Posted : 2008-03-27 00:54:39 |
I still get the wrong answer. Please tell me the select statement behind the TxnListByCustomer |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-03-27 08:16:30 |
The SQL for the TnxListByCustomer report is:
sp_report TxnListByCustomer show RowData, TxnType, Date, RefNumber, Memo, Account, ClearedStatus, SplitAccount, Amount parameters DateMacro = 'All' where RowType = 'DataRow'
however this also shows Sales Order, General Journals and Credit Memos not seen in the ReceivePayment table. |
|
|
|
|
Posted : 2008-03-27 09:47:42 |
Yes, clearly I understand the sp_report TxnListByCustomer, I need to learn what tables this report reads so I can also read the same data and get the same answer. The sp_report is inadequate for my needs. I am asking what TABLES the sp_report SELECTS and what columns it gets the amounts from! |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-03-28 07:45:49 |
The QODBC tables are virtual, they don't exist in QuickBooks. sp_report directly calls the same QuickBooks reporting engine used in the QuickBooks User Interface via Intuit's qbXML SDK. There are no direct equivalents between many of reports and tables. Most reports comprise of data seen in multiple QODBC "virtual" tables and in some cases, only reports contain some data as Intuit have not provided full access to all data areas within QuickBooks.
The TnxListByCustomer report reads data from Sales Order, Invoice, General Journal, Credit Memo, ReceivePayment and their revalent LinkedTxn tables. |
|
|
|