QuickBooks-V3-DotNET-SDK icon indicating copy to clipboard operation
QuickBooks-V3-DotNET-SDK copied to clipboard

Should SalesItemLineDetail have a UnitPrice property?

Open chrpai opened this issue 2 years ago • 3 comments

According to the JSON documentation at https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/SalesReceipt, the SalesItemLineDetail should have a UnitPrice property. I see the one for Qty but not UnitPrice. Should the model in this SDK have it or is the JSON sample incorrect?

chrpai avatar Feb 14 '23 00:02 chrpai

A Sales Receipt SHOULD not have a UnitPrice, but it COULD have one. Try the following. Create a sales receipt for a sandbox company, and on the line only specify the Product/Service + Amount. Leave Qty and Unit Price blank. If you query that in the API explorer, you will see the following.

"Line": [ { "Id": "1", "LineNum": 1, "Amount": 220, "DetailType": "SalesItemLineDetail", "SalesItemLineDetail": { "ItemRef": { "value": "21", "name": "Boxes of Yellow Lemon bars" }, "ItemAccountRef": { "value": "121", "name": "Services" }, "TaxCodeRef": { "value": "NON" } } }, { "Amount": 220, "DetailType": "SubTotalLineDetail", "SubTotalLineDetail": {} } ],

So, Qty and UnitPrice are optional. You might see them in the JSON or not. Likewise, when you create items for invoices and sales receipts, you can decide whether to include those properties or not. Having said that, it appears to have been omitted from the Sales Receipt documentation.

ServicePal avatar Feb 14 '23 01:02 ServicePal

If it's an optional property, shouldn't the class in the .net SDK define that property? I don't see it in intellisense or the debugger. I see Qty defined in ItemLineDetail which SalesItemLineDetail inherits from. But I don't see UnitPrice (or UnitPriceSpecified) in either. I'm looking at FMS.cs

https://github.com/intuit/QuickBooks-V3-DotNET-SDK/blob/master/IPPDotNetDevKitCSV3/Tools/XsdExtension/Intuit.Ipp.Data/CDMEntities/Fms.cs

chrpai avatar Feb 14 '23 01:02 chrpai

In searching these issues we found that it seems to be to set the AnyIntuitObject property and then set another property saying that it's a UnitPrice. Not very intuitive but it works. You still have to provide the total amount and the API will throw an error if Total Amount != Qty * UnitPrice.

chrpai avatar Feb 19 '23 19:02 chrpai