Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

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

Forum : SQL of stored procedure SalesbyItemDetailSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC Reporting Forum

 New Topic 
 
 Post Reply 
[1]  
 SQL of stored procedure SalesbyItemDetail 
 Author   Message 
  MikeD 
  
 Group: Members 
 Posts: 14 
 Joined: 2006-10-04 
 Profile
 Posted : 2007-01-13 03:00:23

Can you tell me what the SQL behind the sp_report SalesbyItemDetail is? I would need to pull custom fields in that format, but they are not supported by the stored procedure.

Thanks, Michael

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-01-13 12:31:29
The is no SQL behind sp_report, we are simply calling the QuickBooks reporting engine here. You can use the  stored procedure SP_REPORTS to list all the available sp_reports.

And see all the columns available in a given SP_REPORT by using sp_reportcolumns reportname



As well as SP_PARAMETERS to list all the parameters available for a given SP_REPORT. The VALUES column lists available values that can be used with the parameter.

But as far as sales are concerned, I can get a better view of items (stock parts) sold by using the QODBC tables themselves, for example:

SELECT "InvoiceLine"."TxnDate" as Date, "InvoiceLine"."RefNumber" as Num, "Customer"."FullName" as Name, 
"InvoiceLine"."InvoiceLineDesc" as Memo, "InvoiceLine"."InvoiceLineQuantity" as Qty,
"InvoiceLine"."InvoiceLineItemRefFullName" as Item,
"InvoiceLine"."InvoiceLineRate" as Rate, "ItemInventory"."PurchaseCost" as Cost,
"ItemInventory"."AverageCost" as "Average Cost",
("InvoiceLine"."InvoiceLineQuantity" * "ItemInventory"."AverageCost") as Amount
FROM   "Customer" "Customer","InvoiceLine" "InvoiceLine", "ItemInventory" "ItemInventory"
WHERE  ("InvoiceLine"."CustomerRefListID"="Customer"."ListID")
AND  ("InvoiceLine"."InvoiceLineItemRefListID" = "ItemInventory"."ListID")
ORDER BY "InvoiceLine"."TxnDate"

 

  Top 
  MikeD 
  
 Group: Members 
 Posts: 14 
 Joined: 2006-10-04 
 Profile
 Posted : 2007-01-16 07:20:21

Thank you Tom, but the example doesn't apply in my case. I am basically looking for adding a CustomField to the result of a 'SalesbyItemDetail' report. The current report syntax is:

SELECT * FROM OPENQUERY (Quickbooks, 'sp_report SalesByItemDetail show Account, TxnType, Date, RefNumber, Item, Memo, Name, Quantity, UnitPrice, Amount, OpenBalance, ModifiedTime parameters DateMacro = "ThisMonth"') where "Account" LIKE '%Maintenance%' ORDER BY Date

As reports don't support custom fields, how can I retrieve the same result set plus custom fields?

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-01-16 10:26:38
See: Sales By Item Detail Report and Custom Fields  

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to