QuickBooks - qbXML to add a bill with expense ( BillAddRq.xml )

Please see the related question. I got qbXML to add bill with item data. Now I am trying for expense data.

This is what I have now. In BillAddRs.xml in related question, this should be included. But showing error as it is invalid
<ExpenseLine> 
<AccountRef> 
	<FullName>430001-1197741385</FullName> 
</AccountRef> 
<Amount>901.45</Amount>
<Memo>1" cubed mice</Memo> 
</ExpenseLine> 

Open in new window


I got this information from this link
http://www.zed-systems.com/support/KB/a81/importing-bills-into-quickbooks.aspx

Tried 'ExpenseLineAdd' instead of 'ExpenseLine' - not working

Could you help me by providing right qbXML format to add expense with bill in QuickBooks ?
Raj
LVL 23
Rajkumar GsSoftware EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guveraCommented:
Hi raj ,

 Could you plz tell in which line shows the error that is invalid?

Thanks
Guvera
Rajkumar GsSoftware EngineerAuthor Commented:
Entire qbXML is invalid. Response comes back from QuickBook Web Connector without any error line.

Error is in the part of the qbXML I posted in question.

Do you have experience in QuickBooks with qbXML ?
Raj
Rajkumar GsSoftware EngineerAuthor Commented:
This is the working qbXML format (with expense part, it will work)

<?xml version="1.0"?>
<QBXML><QBXMLMsgsRq onError = "continueOnError">
<BillAddRq requestID = "1">
<BillAdd>
<VendorRef>
	<FullName>Green Taxi Company</FullName>
</VendorRef>
<TxnDate>2012-12-22</TxnDate>
<DueDate>2013-01-21</DueDate>
<RefNumber>499</RefNumber>
<TermsRef>
	<FullName>Net 30</FullName>
</TermsRef>
<Memo>via access</Memo>
<Address>
	<Addr1>1060 N Kings Hway Suite 220</Addr1>
	<City>Cherry Hill</City>
	<State>NJ</State>
	<PostalCode>08034</PostalCode>
	<Country></Country>
</Address>
<Phone>(856) 482-2424</Phone>
<Fax>(310) 927-8398</Fax>


<ItemLineAdd> 
<ItemRef> 
	<FullName>430001-1197741385</FullName> 
</ItemRef> 
<Desc>1" cubed mice</Desc> 
<Quantity>10</Quantity> 
<Cost>0.870</Cost> 
<Amount>901.45</Amount>
</ItemLineAdd> 
</BillAdd>
</BillAddRq>
</QBXMLMsgsRq>
</QBXML> 

Open in new window

Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Rajkumar GsSoftware EngineerAuthor Commented:
Sorry. without expense part, it will work. see the qbXMl in previous comment.
guveraCommented:
Rajkumar GsSoftware EngineerAuthor Commented:
Thanks Guvera,

But I couldn't find any useful information to fix my issue. - qbXML format to add Bill with Expense part.

Please explain in detail
Raj
Rajkumar GsSoftware EngineerAuthor Commented:
I got it as my own.

What went wrong is that the order of each tag in qbXML matters.

<ExpenseLineAdd> should come before <ItemLineAdd>

HERE IS THE SAMPLE WORKING qbXML FORMAT TO ADD A BILL WITH EXPENSE AND ITEM DATA INTO QUICKBOOKS

<?xml version="1.0"?>
<QBXML><QBXMLMsgsRq onError = "continueOnError">
<BillAddRq requestID = "1">
<BillAdd>
<VendorRef>
	<FullName>Green Taxi Company</FullName>
</VendorRef>
<TxnDate>2012-12-22</TxnDate>
<DueDate>2013-01-21</DueDate>
<RefNumber>499</RefNumber>
<TermsRef>
	<FullName>Net 30</FullName>
</TermsRef>
<Memo>via access</Memo>
<Address>
	<Addr1>1060 N Kings Hway Suite 220</Addr1>
	<City>Cherry Hill</City>
	<State>NJ</State>
	<PostalCode>08034</PostalCode>
	<Country></Country>
</Address>
<Phone>(856) 482-2424</Phone>
<Fax>(310) 927-8398</Fax>


<ExpenseLineAdd> 
<AccountRef> 
	<FullName>430001-1197741385</FullName> 
</AccountRef> 
<Amount>901.45</Amount>
<Memo>1" cubed mice</Memo> 
</ExpenseLineAdd> 


<ItemLineAdd> 
<ItemRef> 
	<FullName>430001-1197741385</FullName> 
</ItemRef> 
<Desc>1" cubed mice</Desc> 
<Quantity>10</Quantity> 
<Cost>0.870</Cost> 
<Amount>901.45</Amount>
</ItemLineAdd> 

</BillAdd>
</BillAddRq>
</QBXMLMsgsRq>
</QBXML> 

Open in new window


In QuickBooks, click Add Bill and verify. Expense tab is the first and Item tab is the second. So in qbXML also we need to keep the same order.

Raj

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rajkumar GsSoftware EngineerAuthor Commented:
1. qbXML to add a NEW VENDOR in QuickBooks - VendorAddRq.xml

<?xml version="1.0" ?> 
  <?qbxml version="4.0"?> 
 <QBXML>
 <QBXMLMsgsRq onError="stopOnError">
 <VendorAddRq requestID="1">
 <VendorAdd>
  <Name>DELL Computer Ltd</Name> 
  <IsActive>1</IsActive> 
  <CompanyName /> 
  <Salutation /> 
  <FirstName /> 
  <LastName /> 
 <VendorAddress>
  <Addr1>1234 KingsHway</Addr1> 
  <Addr2 /> 
  <City>Cherry Hill</City> 
  <State>NJ</State> 
  <PostalCode>08034</PostalCode> 
  <Country /> 
  </VendorAddress>
  <Phone>(856) 482-2424</Phone> 
  <AltPhone>650-214-6549</AltPhone> 
  <Fax>(301) 927-8398</Fax> 
  <Email /> 
  <Contact>Shaun</Contact> 
  <NameOnCheck /> 
  <AccountNumber /> 
 <VendorTypeRef>
  <FullName>Materials</FullName> 
  </VendorTypeRef>
 <TermsRef>
  <FullName>1% 10 Net 30</FullName> 
  </TermsRef>
  <CreditLimit /> 
  </VendorAdd>
  </VendorAddRq>
  </QBXMLMsgsRq>
  </QBXML>

Open in new window


2. SUCCESS RESPONSE to Add Vendor Request

 
<?xml version="1.0" ?> 
 <QBXML>
 <QBXMLMsgsRs>
 <VendorAddRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
 <VendorRet>
  <ListID>8000004D-1293529277</ListID> 
  <TimeCreated>2010-12-28T04:41:17-05:00</TimeCreated> 
  <TimeModified>2010-12-28T04:41:17-05:00</TimeModified> 
  <EditSequence>1293529277</EditSequence> 
  <Name>DELL Computer Ltd</Name> 
  <IsActive>true</IsActive> 
 <VendorAddress>
  <Addr1>1234 KingsHway</Addr1> 
  <City>Cherry Hill</City> 
  <State>NJ</State> 
  <PostalCode>08034</PostalCode> 
  </VendorAddress>
  <Phone>(856) 482-2424</Phone> 
  <AltPhone>650-214-6549</AltPhone> 
  <Fax>(301) 927-8398</Fax> 
  <Contact>Shaun</Contact> 
 <VendorTypeRef>
  <ListID>80000006-1292947257</ListID> 
  <FullName>Materials</FullName> 
  </VendorTypeRef>
 <TermsRef>
  <ListID>80000001-1292873933</ListID> 
  <FullName>1% 10 Net 30</FullName> 
  </TermsRef>
  <IsVendorEligibleFor1099>false</IsVendorEligibleFor1099> 
  <Balance>0.00</Balance> 
  </VendorRet>
  </VendorAddRs>
  </QBXMLMsgsRs>
  </QBXML>

Open in new window


3. qbXML to ADD BILL with Expense & Item data in QuickBooks - BillAddRq.xml

<?xml version="1.0" ?> 
  <?qbxml version="4.0"?> 
 <QBXML>
 <QBXMLMsgsRq onError="continueOnError">
 <BillAddRq requestID="1">
 <BillAdd>
 <VendorRef>
  <FullName>DELL Computer Ltd</FullName> 
  </VendorRef>
  <TxnDate>2010-10-17</TxnDate> 
  <DueDate /> 
  <RefNumber /> 
 <TermsRef>
  <FullName>N/A</FullName> 
  </TermsRef>
  <Memo /> 
 <ExpenseLineAdd>
 <AccountRef>
  <FullName>Automobile Expense</FullName> 
  </AccountRef>
  <Amount>1000.00</Amount> 
  <Memo>Test Comments</Memo> 
  </ExpenseLineAdd>
 <ExpenseLineAdd>
 <AccountRef>
  <FullName>Computer and Internet Expenses</FullName> 
  </AccountRef>
  <Amount>555.15</Amount> 
  <Memo>Test Comments</Memo> 
  </ExpenseLineAdd>
 <ItemLineAdd>
 <ItemRef>
  <FullName>Digital Camera</FullName> 
  </ItemRef>
  <Desc>Digital Camera</Desc> 
  <Quantity>2</Quantity> 
  <Cost>6500.00</Cost> 
  <Amount>13000.00</Amount> 
  </ItemLineAdd>
 <ItemLineAdd>
 <ItemRef>
  <FullName>Laser Printer</FullName> 
  </ItemRef>
  <Desc>Laser Printer</Desc> 
  <Quantity>1</Quantity> 
  <Cost>5000.00</Cost> 
  <Amount>5000.00</Amount> 
  </ItemLineAdd>
  </BillAdd>
  </BillAddRq>
  </QBXMLMsgsRq>
  </QBXML>

Open in new window


4. SUCCESS RESPONSE to add a new bill from QuickBooks

<?xml version="1.0" ?> 
 <QBXML>
 <QBXMLMsgsRs>
 <BillAddRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
 <BillRet>
  <TxnID>182-1293529466</TxnID> 
  <TimeCreated>2010-12-28T04:44:26-05:00</TimeCreated> 
  <TimeModified>2010-12-28T04:44:26-05:00</TimeModified> 
  <EditSequence>1293529466</EditSequence> 
  <TxnNumber>113</TxnNumber> 
 <VendorRef>
  <ListID>8000004D-1293529277</ListID> 
  <FullName>DELL Computer Ltd</FullName> 
  </VendorRef>
 <APAccountRef>
  <ListID>8000002A-1292874349</ListID> 
  <FullName>Accounts Payable</FullName> 
  </APAccountRef>
  <TxnDate>2010-10-17</TxnDate> 
  <DueDate>2010-10-17</DueDate> 
  <AmountDue>19555.15</AmountDue> 
 <TermsRef>
  <ListID>80000008-1293434720</ListID> 
  <FullName>N/A</FullName> 
  </TermsRef>
  <IsPaid>false</IsPaid> 
 <ExpenseLineRet>
  <TxnLineID>184-1293529466</TxnLineID> 
 <AccountRef>
  <ListID>80000018-1292873933</ListID> 
  <FullName>Automobile Expense</FullName> 
  </AccountRef>
  <Amount>1000.00</Amount> 
  <Memo>Test Comments</Memo> 
  </ExpenseLineRet>
 <ExpenseLineRet>
  <TxnLineID>185-1293529466</TxnLineID> 
 <AccountRef>
  <ListID>8000001A-1292873933</ListID> 
  <FullName>Computer and Internet Expenses</FullName> 
  </AccountRef>
  <Amount>555.15</Amount> 
  <Memo>Test Comments</Memo> 
  </ExpenseLineRet>
 <ItemLineRet>
  <TxnLineID>186-1293529466</TxnLineID> 
 <ItemRef>
  <ListID>80000006-1293435012</ListID> 
  <FullName>Digital Camera</FullName> 
  </ItemRef>
  <Desc>Digital Camera</Desc> 
  <Quantity>2</Quantity> 
  <Cost>6500</Cost> 
  <Amount>13000.00</Amount> 
  </ItemLineRet>
 <ItemLineRet>
  <TxnLineID>187-1293529466</TxnLineID> 
 <ItemRef>
  <ListID>80000007-1293435039</ListID> 
  <FullName>Laser Printer</FullName> 
  </ItemRef>
  <Desc>Laser Printer</Desc> 
  <Quantity>1</Quantity> 
  <Cost>5000</Cost> 
  <Amount>5000.00</Amount> 
  </ItemLineRet>
  </BillRet>
  </BillAddRs>
  </QBXMLMsgsRs>
  </QBXML>

Open in new window

Rajkumar GsSoftware EngineerAuthor Commented:
I got the solution as my own.

Thanks Guvera for your attempt to help me
Raj
Member_2_7967223Commented:
Thank you very much.. This code really helped me in getting suppliers and bills from a database and putting the data into quickbooks.
I really appreciate your good work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
QuickBooks

From novice to tech pro — start learning today.