I receive the following error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=BaptistTrumpetInvoicingV2
StackTrace:
at EOL.BaptistTumpetInvoicing.GenerateSubscriptionInvoices.AddQBInvoice(Customer objCustomer) in E:\web\dnndev.me\Website\DesktopModules\BaptistTrumpetInvoicingV2\GenerateInvoices.cs:line 724
(line 724 is: objInvoice.InvoiceLineItems.Add(objLineItem);)
When running the AddQBInvoice method:
public string AddQBInvoice (Customer objCustomer)
{
string strReturn = "";
Invoice objInvoice = new Invoice();
objInvoice.CustomerRefId = objCustomer.Id;
objInvoice.CustomerRefName = objCustomer.DisplayName;
objInvoice.Id = "300";
bTQBContext.Invoices.Add(objInvoice);
/* Try adding Invoice w/o adding the InvoiceLineItem*/
InvoiceLineItem objLineItem = new InvoiceLineItem();
objLineItem.Id = "300-1";
objLineItem.Amount = 0;
objLineItem.LineNum = 1.0m;
objLineItem.Description = "Donations";
objLineItem.DetailType = "SalesItemLineDetail";
objLineItem.SalesItemLineDetailItemRefId = "21";
objLineItem.SalesItemLineDetailItemRefName = "Donations";
objLineItem.SalesItemLineDetailUnitPrice = 0.0m;
objLineItem.SalesItemLineDetailQty = 0.0m;
objLineItem.SalesItemLineDetailTaxCodeRefId = "TAX";
objInvoice.InvoiceLineItems.Add(objLineItem);
//bTQBContext.Invoices.
strReturn = objInvoice.Id;
return strReturn;
}