Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
Callback
Support |
If you live in USA, UK, Canada, Australia or New
Zealand, you can leave us details on your question and request us to call you back and discuss
them with you personally (charges apply). |
Click Here
|
Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
|
Trying to recreate sp_Report OpenInvoices as SQL query |
Author |
Message |
|
Posted : 2009-01-20 01:45:17 |
Hi everyone,
I'm trying to recreate the Open Invoices report using SQL queries. Basically, I need the data in the report, but I need it "flattened" and not hierarchical. Furthermore, the debtor code is not included in the report. The following query gives me the list of open invoices, and it includes all fields that I need:
SELECT Invoice.CustomFieldDebiteurnummer, Invoice.RefNumber, Invoice.TxnDate, Invoice.DueDate, Invoice.Subtotal, Invoice.BalanceRemaining, Invoice.SalesTaxTotal FROM Invoice Invoice WHERE Invoice.IsPaid = 0 ORDER BY Invoice.CustomFieldDebiteurnummer, Invoice.RefNumber
However, this obviously does not include credit notes or deposits. I've tried the CreditMemo table, but haven't been able to figure out how to determine if a credit note has been settled or not. The same goes for the Deposit table.
I hope someone out there can help...
Regards,
Maurits |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2009-01-20 09:41:06 |
|
|
|
|
Posted : 2009-01-22 01:12:06 |
Hi Tom,
The Customer Balance Detail Report seems very promising, but as I said before, I need the data "flattened". The report output has, for each debtor, a first row denoting the debtor and subsequent rows denoting the invoices, but an invoice row does not actually reference the debtor. Simply calling the stored procedure is therefore not an option, so I tried to run the "underlying" query that is listed in the "How do I":
SELECT CustomerRefFullName as RowData, Type, TxnDate as Date, RefNumber as Num, ARAccountRefFullName as Account, Remaining as Amount FROM Sales NOSYNC where IsPaid = 0 or Type = 'CreditMemo' Order by CustomerRefFullName, TxnDate, RefNumber
Unfortunately, the Sales table does not seem to exist:
It is the UK version, by the way.
Can you point me in the right direction? TIA!
Rgds/M
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2009-01-22 08:39:16 |
The Sales table is avaliable in the UK versions of QuickBooks 2008 and 2009 onwards. |
|
|
|
|