Add bill to QuickBooks with QBFC - c#

I am using QBFC to add invoices and bills to QB from my C# app. I have it successfully creating invoices, but I am having trouble creating bills.
I have updated this question to remove most of the code. I have been removing pieces of the message to determine the issue and it turns out I am getting the error from the VendorAddress attribute. The attribute comes up in intellisense, but generates the error when sent to QuickBooks. Is there no way to override the vendor address?
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError = "continueOnError">
<BillAddRq requestID = "0">
<BillAdd>
<VendorRef>
<FullName>SENECA</FullName>
</VendorRef>
<VendorAddress>
<Addr1>SENECA SAWMILL CO.</Addr1>
<Addr2>UNIT 136</Addr2>
<Addr3>PO BOX 5037</Addr3>
<Addr4/>
<City>PORTLAND</City>
<State>OR</State>
<PostalCode>97208-5037</PostalCode>
<Country>US</Country>
</VendorAddress>
<TxnDate>2018-07-12</TxnDate>
<DueDate>2018-07-22</DueDate>
<RefNumber>12345</RefNumber>
<TermsRef>
<FullName>1.0% 20 DAYS</FullName>
</TermsRef>
<ItemLineAdd>
<ItemRef>
<FullName>1248SK</FullName>
</ItemRef>
<Desc>94080 BF # $410 per MBF
STUD GRADE FIR S4S ALS KD GM 2x4x8</Desc>
<Quantity>17640</Quantity>
<Cost>2.1867</Cost>
<Amount>38572.86</Amount>
</ItemLineAdd>
<ItemLineAdd>
<ItemRef>
<FullName>124PCSK</FullName>
</ItemRef>
<Desc>18816 BF # $400 per MBF
STUD GRADE FIR S4S ALS KD GM 2x4x7&apos; 8 5/8</Desc>
<Quantity>3528</Quantity>
<Cost>2.1333</Cost>
<Amount>7526.39</Amount>
</ItemLineAdd>
</BillAdd>
</BillAddRq>
</QBXMLMsgsRq>
</QBXML>

The QuickBooks desktop API is versioned, and the versioning is controlled by this line in your example:
<?qbxml version="6.0"?>
You're using version 6.0 of qbXML, and if you refer to the QuickBooks OSR:
https://static.developer.intuit.com/qbSDK-current/common/newosr/index.html
You'll see that the VendorAddress component isn't supported until 13.0:
You need to either not include this tag, or change the qbXML version you're using (or potentially do both, if you want to cater to QuickBooks versions that support this qbXML version AND QuickBooks versions that do not support this qbXML version).

try changing the version number and try again. Let's see if your Quickbook APP desktop version is compatible to it or not.
Example :
<?qbxml version="13.0"?>

If you're using QBFC, then you can specify the version when creating the message set request
IMsgSetRequest rqMsgSet = qbSsnMgr.CreateMsgSetRequest("US", 13, 0);

Related

How to delete Quickbook Employee through my windows application (C# or VB.Net) using QuickBooks SDK 13.0

Please help:
I did add and edit functionality in QuickBooks through QuickBooks SDK using my windows application (C#).
Now, I want to know, how to do delete operation in QuickBooks using QuickBooks SDK?
This is my XML Request:
<?xml version="1.0"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<EmployeeModRq requestID="1">
<EmployeeMod>
<ListID>800002A0-1477976825</ListID>
<EditSequence>1477977063</EditSequence>
<IsActive>False</IsActive>
<FirstName>Bobby</FirstName>
<MiddleName></MiddleName>
<LastName>Westbrooks(111-11-1111)</LastName>
<EmployeeAddress>
<Addr1>4205 Coleman</Addr1>
<City>Memphis</City>
<PostalCode>38128</PostalCode>
</EmployeeAddress>
<SSN>111-11-1111</SSN>
<Email>bgwestbrooks#brmch.com</Email>
<EmergencyContacts>
<PrimaryContact>
<ContactName>Rhonda Westbrooks</ContactName>
<ContactValue>0</ContactValue>
</PrimaryContact>
</EmergencyContacts>
<HiredDate>2015-11-11</HiredDate>
<ReleasedDate>2015-11-11</ReleasedDate>
<BirthDate>2015-11-11</BirthDate>
</EmployeeMod>
</EmployeeModRq>
</QBXMLMsgsRq>
</QBXML>
</xml>
You can use the ListDel request to delete employees (and other List type objects like customers, vendors, etc).
From the OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
ListDel - Delete a list object
ou can only delete a list item from a QuickBooks company file if the
file is open in single-user mode. If the file is open in multiuser
mode, your application will receive an error. (This restriction does
not apply to deleting or voiding transaction objects.)
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.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> <!-- required -->
<ListID >IDTYPE</ListID> <!-- required -->
</ListDelRq>
</QBXMLMsgsRq>
</QBXML>

Get line number which tag contains text in XML file

Can you please tell me how to get line number using XDocument or XmlDocument?
In XDocument,
Input:
1. <title-group>
2. <article-title>Education Finance: How It Differs from the and the
Analytic and Data Collection Changes It Implies</article-title>
4. </title-group>
5. <contrib-group>
6. <contrib contrib-type="author"><name><surname>Guthrie</surname><given-names>James W.</given-names></name><aff>Department of Leadership, Policy and Organization, Peabody College of Vanderbil University, 230 Appleton Place, # Nashville, TN 37203-5721, E-mail: <email xlink="jwgxiii#sbcglobal.net">jwgxiii#sbcglobal.net</email></aff>
7. testest</contrib>
8. </contrib-group>
My output will look like:
2. <article-title>Education Finance: How It Differs from the and the Analytic and Data Collection Changes It Implies</article-title>
6. <contrib contrib-type="author"><name><surname>Guthrie</surname><given-names>James W.</given-names></name><aff>Department of Leadership, Policy and Organization, Peabody College of Vanderbil University, 230 Appleton Place, # Nashville, TN 37203-5721, E-mail: <email xlink="jwgxiii#sbcglobal.net">jwgxiii#sbcglobal.net</email></aff>
7. testest</contrib>
You will need to check using the HasLineInfo method if the XDocument supports line information.
If it does you can use it via the IXmlLineInfo Interface for functions like the LineNumber property.

How to modify an invoice in quickbooks using qbxml and qbsdk13?

This is my QBXML request
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceModRq requestID="1">
<InvoiceMod>
<TxnID>85-1442639879</TxnID>
<EditSequence>1442639879</EditSequence>
<CustomerRef>
<ListID>80000005-1442639850</ListID>
<FullName>Bruce Banner</FullName>
</CustomerRef>
<TxnDate>2015-09-19</TxnDate>
<RefNumber>5462</RefNumber>
<InvoiceLineMod>
<ItemRef>
<ListID>8000000A-1442469770</ListID>
<FullName>Item 1</FullName>
</ItemRef>
<Quantity>1</Quantity>
<Rate>1100.00</Rate>
</InvoiceLineMod>
</InvoiceMod>
</InvoiceModRq>
</QBXMLMsgsRq>
</QBXML>
I am getting an error
QuickBooks found an error when parsing the provided XML text stream.
please help
If you refer to the QuickBooks OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
You'll notice that within the <InvoiceLineMod> element, this node is required:
<TxnLineID>
The OSR gives you a bit more information too:
TxnLineID
Identification number of the transaction line. (TxnLineID
is supported as of v2.0 of the SDK. With qbXML v1.0 and v1.1,
TxnLineID is always returned as zero.)
If you need to add a new transaction line in a transaction Mod
request, you can do so by setting the TxnLineID to -1.
So, you'll need to add in a <TxnLineID> node. If it's a new line item, put -1 for the content within the node. If it's an existing line you're trying to update, put the TxnLineID value of the existing line in there.
Example:
...
<InvoiceLineMod>
<TxnLineID>-1</TxnLineID>
<ItemRef>
<ListID>8000000A-1442469770</ListID>
<FullName>Item 1</FullName>
</ItemRef>
<Quantity>1</Quantity>
<Rate>1100.00</Rate>
</InvoiceLineMod>
...

Error adding the invoice in QuickBooks. Invalid reference to QB customer

There is an invalid reference to QuickBooks Customer "ABS, JLMN" in the Invoice. QuickBooks error message: Invalid argument. The specified record does not exist in the list.
<InvoiceAddRq requestID = "***">
<InvoiceAdd>
<CustomerRef>
<FullName>ABS, JLMN</FullName>
</CustomerRef>
<TxnDate>2014-10-31</TxnDate>
<TermsRef>
<FullName>*Proper existing term*</FullName>
</TermsRef>
<DueDate>2014-11-30</DueDate>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*String Value*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*Strings of text*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*Strings of text*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*Strings of text*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
</InvoiceAdd>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>CustomerRef</IncludeRetElement>
<IncludeRetElement>ItemRef</IncludeRetElement>
</InvoiceAddRq>
Please note that the values mentioned in "*"s are only place holders.
The customer ABS, JLMN is present in Quick books but still I get this error. This is not the only request while generating the request XML, there are other customers also with same properties. I am not getting any error for those customers. Can any one please let me know what can be the problem here?
Is there any chance that my company file is corrupted? I am doing many InvoiceADD and CustomerADD requests with the company file as a part of my requirements. So could that be a reason for the problem here?
Please let me know if you need any more information.
Thanks.
There is an invalid reference to **QuickBooks** Customer "ABS, JLMN" in the Invoice.
This error Occurs when Customer "ABS, JLMN" does not exists in the Quickbooks and you try to add invoice against that customer.
If customer already exists in Quickbooks then parse the name of customer in your requestXML. Special characters also create errors.

Programmatically create iTunes Podcast RSS Feed

I am trying to create an program that automatically creates iTunes Podcast RSS feeds. The problem I am running into is I dont know how to create the require XML elements. I tried to create two tags here in two different ways. First I used "itunes:" for subtitle and it doesnt work it throws an exception that I cant use the colon in my name. The second one (image) outputs this
<image xmlns="http://www.itunes.com/dtds/podcast-1.0.dtd" href="http://someurkl.com/myimgp.png"/>
Is there any way to get this to work with ASP.net? Or can you point me the right direction of documentation or a tutorial that can show me how to create a feed for a iTunes podcast.
My Code:
XNamespace itunesNS = "http://www.itunes.com/dtds/podcast-1.0.dtd";
SyndicationFeed feed = new SyndicationFeed(title, description, new Uri(link));
feed.ElementExtensions.Add(new XElement("itunes:" + "subtitle", subTitle).CreateReader());
feed.ElementExtensions.Add(new XElement(itunesNS + "image", new XAttribute("href", imageUrl)).CreateReader());
Format Required By iTunes:
<itunes:subtitle>My Subtitle Here</itunes:subtitle>
Example Feed from Apple:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>All About Everything</title>
<link>http://www.example.com/podcasts/everything/index.html</link>
<language>en-us</language>
<copyright>℗ & © 2005 John Doe & Family</copyright>
<itunes:subtitle>A show about everything</itunes:subtitle>
<itunes:author>John Doe</itunes:author>
<itunes:summary>All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Store</itunes:summary>
<description>All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Store</description>
<itunes:owner>
<itunes:name>John Doe</itunes:name>
<itunes:email>john.doe#example.com</itunes:email>
</itunes:owner>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything.jpg" />
<itunes:category text="Technology">
<itunes:category text="Gadgets"/>
</itunes:category>
<itunes:category text="TV & Film"/>
<item>
<title>Shake Shake Shake Your Spices</title>
<itunes:author>John Doe</itunes:author>
<itunes:subtitle>A short primer on table spices</itunes:subtitle>
<itunes:summary>This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!</itunes:summary>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode1.jpg" />
<enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a" length="8727310" type="audio/x-m4a" />
<guid>http://example.com/podcasts/archive/aae20050615.m4a</guid>
<pubDate>Wed, 15 Jun 2005 19:00:00 GMT</pubDate>
<itunes:duration>7:04</itunes:duration>
</item>
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:subtitle>Comparing socket wrenches is fun!</itunes:subtitle>
<itunes:summary>This week we talk about metric vs. old english socket wrenches. Which one is better? Do you really need both? Get all of your answers here.</itunes:summary>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode2.jpg" />
<enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode2.mp3" length="5650889" type="audio/mpeg" />
<guid>http://example.com/podcasts/archive/aae20050608.mp3</guid>
<pubDate>Wed, 8 Jun 2005 19:00:00 GMT</pubDate>
<itunes:duration>4:34</itunes:duration>
</item>
<item>
<title>Red, Whine, & Blue</title>
<itunes:author>Various</itunes:author>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<itunes:summary>This week we talk about surviving in a Red state if you are a Blue person. Or vice versa.</itunes:summary>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode3.jpg" />
<enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode1.mp3" length="4989537" type="audio/mpeg" />
<guid>http://example.com/podcasts/archive/aae20050601.mp3</guid>
<pubDate>Wed, 1 Jun 2005 19:00:00 GMT</pubDate>
<itunes:duration>3:59</itunes:duration>
</item>
</channel>
</rss>
TL;DR
Looks like you need to define a custom namespace for the itunes: tag in the area of your code that generates your rss.
Here is some info originally written by Lukasz Karolak, that might help you.
Let’s assume we would like to have a RSS feed, which in fact would serve as a podcast, e.g. for iTunes. The software from Apple uses some information from their custom-defined RSS-tags, with an itunes prefix, for example:
<itunes:author>Anonymous One</itunes:author>
Without this prefix it’s very easy. Our SyndicationItem class provides us a functionality to extend the standard item’s elements:
SyndicationItem item = new SyndicationItem();
item.ElementExtensions.Add(customTagString.Empty, "My test");
The second attribute is the namespace which comes into play in the next step. In order to add the tag prefix as mentioned before, one has start with adding the namespace to the feed instance:
SyndicationFeed feed = new SyndicationFeed();
XmlQualifiedName n=new XmlQualifiedName("itunes","http://www.w3.org/2000/xmlns/");
String itunesNs = "http://www.itunes.com/dtds/podcast-1.0.dtd";
feed.AttributeExtensions.Add(n, itunesNs);
Now that we have added the new namespace to the feed, we can start adding custom item elements within that namespace.
SyndicationItem item = new SyndicationItem();
item.ElementExtensions.Add(new SyndicationElementExtension("author",
itunesNs, "Famous author"));
That should solve the issue with custom tags with custom prefixes.

Categories

Resources