How can I get "Time/Costs" account IDs with QBXML? - quickbooks

I'm running this query:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="14.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq>
<IncludeLineItems>1</IncludeLineItems>
<IncludeLinkedTxns>1</IncludeLinkedTxns>
</InvoiceQueryRq>
</QBXMLMsgsRq>
</QBXML>
And I get this invoice line which is an expense created with the "Add Time/Costs" button in Quickbooks Desktop.
<InvoiceLineRet>
<TxnLineID>8E-1343336207</TxnLineID>
<Desc>License and Title</Desc>
<Rate>315</Rate>
<Amount>315.00</Amount>
<ServiceDate>2012-07-26</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000002-1343060273</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
With most invoice lines, there's an item associated with it and I can get the account(s) associated with the item. I want to get the account ListID that's associated with this invoice line, as with other invoice lines. I can get the account name with a GeneralDetailReportQuery, but not the ID, and that report is much harder to work with as I'm importing Quickbooks data into another system.
How can I find the accountID for lines like this?

Related

How to create an invoice for a sales order Quickbooks Desktop

I have a customer in Quickbook Desktop, so that I have generated a slaes order for the particular customer, now for the customer sales order I have to generate a invoice. . When I tried it I got the following error. How to link a quickbook desktop customer sales order to a invoice?
I tried using IDTYPE attribute. What is wrong here? Kindly help
0x80040400: QuickBooks found an error when parsing the provided XML text stream.
Parsing response.
Processing response.
Job 'create_invoice' received response: ''.
This is my sales order xml response.
{"xml_attributes"=>{},
"txn_id"=>"75-1640702627",
"time_created"=>"2021-12-28T14:43:47+00:00",
"time_modified"=>"2021-12-28T14:43:47+00:00",
"edit_sequence"=>"1640702627",
"txn_number"=>37,
"customer_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000001-1640593593", "full_name"=>"Test Customer"},
"template_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000008-1640593060", "full_name"=>"Custom Sales Order"},
"txn_date"=>"2021-12-28",
"ref_number"=>"18",
"bill_address"=>{"xml_attributes"=>{}, "addr1"=>"212 W. Chskskss St.", "addr2"=>"Ste.100", "addr3"=>"wqw, Parròquia d'Encamp www", "addr4"=>"Andorra"},
"bill_address_block"=>{"xml_attributes"=>{}, "addr1"=>"212 W. Chskskss St.", "addr2"=>"Ste.100", "addr3"=>"wqw, Parròquia d'Encamp www", "addr4"=>"Andorra"},
"due_date"=>"2021-12-28",
"ship_date"=>"2021-12-28",
"subtotal"=>1.0,
"sales_tax_percentage"=>0.0,
"sales_tax_total"=>0.0,
"total_amount"=>1.0,
"is_manually_closed"=>false,
"is_fully_invoiced"=>false,
"is_to_be_printed"=>true,
"is_to_be_emailed"=>false}
Trying to generate invoice for this particular sales order
Here is my invoice XML attributes that I am sending to Quickbook Desktop
xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq >
<InvoiceAdd>
<CustomerRef>
<FullName>Test Customer</FullName >
</CustomerRef>
<BillAddress>
<Addr1>212 W. Chskskss St.</Addr1>
<Addr2>Ste.100</Addr2>
<City>wqw</City>
<State>Parròquia d'Encamp www</State>
<PostalCode>06268</PostalCode>
<Country>Andorra</Country>
</BillAddress>
<InvoiceLineAdd>
<ItemRef>
<FullName >Inspection Request</FullName>
</ItemRef>
<Desc >plants</Desc>
<Quantity >1</Quantity>
<Amount >50.00</Amount>
</InvoiceLineAdd>
<LinkToTxnID>75-1640702627<LinkToTxnID>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>'
First thing coming to my mind is: "Where is your closing QBXML tag?"
</QBXML>
Beside that. The SDK includes an XML Validator tool which you can use to validate the XML structure. Try to use this to see where your structure probably does not meet the requirements.

Is there a way to delete a customer from Quickbooks offline using qbsdk and qbxml?

I want to delete a particular customer from quickbooks using the ListId of that customer . What would be my qbxml request in that case ?
You can use the ListDelRq to delete list-type things (Customers, Items, Vendors, etc.) from QuickBooks.
Refer to the OSR for full syntax:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Your request will look something like this:
?xml version="1.0" encoding="utf-8"?>
<?qbxml version="9.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ListDelRq>
<!-- ListDelType may have one of the following values: Account, BillingRate, Class, Currency, Customer, CustomerMsg, CustomerType, DateDrivenTerms, Employee, InventorySite, ItemDiscount, ItemFixedAsset, ItemGroup, ItemInventory, ItemInventoryAssembly, ItemNonInventory, ItemOtherCharge, ItemPayment, ItemSalesTax, ItemSalesTaxGroup, ItemService, ItemSubtotal, JobType, OtherName, PaymentMethod, PayrollItemNonWage, PayrollItemWage, PriceLevel, SalesRep, SalesTaxCode, ShipMethod, StandardTerms, ToDo, UnitOfMeasureSet, Vehicle, Vendor, VendorType, WorkersCompCode -->
<ListDelType>ENUMTYPE</ListDelType>
<ListID>IDTYPE</ListID>
</ListDelRq>
</QBXMLMsgsRq>
</QBXML>

Is there a way to identify tax row which is added on QuickBooks Canada QBResponse, QB SDK

We have QuickBooks Canada version. When we fetch records for Purchase Order it does returns all the records and along with that returns Tax row which is being added by QuickBooks CA.
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<PurchaseOrderQueryRq requestID="1">
<TxnID>2304-1229340744</TxnID>
<IncludeLineItems>1</IncludeLineItems>
<IncludeLinkedTxns>0</IncludeLinkedTxns>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>EditSequence</IncludeRetElement>
<IncludeRetElement>PurchaseOrderLineGroupRet</IncludeRetElement>
<IncludeRetElement>PurchaseOrderLineRet</IncludeRetElement>
<OwnerID>0</OwnerID>
</PurchaseOrderQueryRq>
</QBXMLMsgsRq>
</QBXML>
The extra row response has is
<PurchaseOrderLineRet>
<TxnLineID>2311-1229340744</TxnLineID>
<ItemRef>
<ListID>490000-1195038595</ListID>
<FullName>Summary GST for purchases</FullName>
</ItemRef>
<Desc>Total GST</Desc>
<Rate>5.0%</Rate>
<ClassRef>
<ListID>40001-1199213409</ListID>
<FullName>Pro Shop:Special orders</FullName>
</ClassRef>
<Amount>798.00</Amount>
<CustomerRef>
<ListID>10000-1193777303</ListID>
<FullName>Receiver General</FullName>
</CustomerRef>
<ReceivedQuantity>0</ReceivedQuantity>
<IsBilled>false</IsBilled>
<IsManuallyClosed>false</IsManuallyClosed>
</PurchaseOrderLineRet>
Is there a way to identify this row.
Issue is, if we want to update this order we need to send all the Order line.
And if we send the last line which is of Tax (generated by QB) , QuickBooks SDK throws error.
MLMsgsRs>
<PurchaseOrderModRs requestID="1" statusCode="3120" statusSeverity="Error" statusMessage="Object "2311-1229340744" specified in the request cannot be found. " />
So we need to exclude this line on the PurchaseOrderModRq
Note : Not all Purchase Order's Last line has this tax row.
Export the tax items and compare the Item Refs in the exported PO data against the list of tax items.

QuickBooks. Filtering items by LinkedTxn

I would like to get the ItemReceipt items that have LinkedTxn  with the PurchaseOrder type.
Now I use the following query:
<?xml version="1.0" encoding="utf-8"?><?qbxml version="12.0"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<ItemReceiptQueryRq requestID="1">
<IncludeLineItems>true</IncludeLineItems>
<IncludeLinkedTxns>true</IncludeLinkedTxns>
<OwnerID>0</OwnerID>
</ItemReceiptQueryRq>
</QBXMLMsgsRq>
</QBXML>
The query returned all ItemReceipt items, and I filtred them on the client. 
Could you tell me if there is a way to create a filter that returns only items that have LinkedTxn with the PurchaseOrder type?
The QuickBooks SDK does not support a way to create a filter that returns only items that have a LinkedTxn with a certain type.
You'll have to pull all of the transactions, and then filter them within your app.

Getting DataExtRet from QuickBooks SDK

I am performing an invoice query using the QuickBooks SDK and I'd like to pull back custom fields at the item level as well. The request I am sending is:
<?xml version="1.0" ?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq>
<RefNumber>8</RefNumber>
<IncludeLineItems>true</IncludeLineItems>
<OwnerID>0</OwnerID>
</InvoiceQueryRq>
</QBXMLMsgsRq>
</QBXML>
I get a successful response, however, there are no <DataExtRet> elements with my custom field information. I can get this data if I do an item query with the <OwnerID> element however, according to IDN, I should be able to get these custom fields in an invoice query as well. I am testing my queries using SDK Tester Plus 3. Any suggestions?
The template being used did not contain the "Serial Number" UDF I was looking for. Adding this to the invoice template and then calling InvoicequeryRq pulled back the information I was looking for.

Resources