I am trying to get a list with all the invoices from QuickBooks that has been paid on an specific date.
I found in a blog the way to get all the invoices from QuickBooks.
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
//Create the session Manager object
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection("", "IDN InvoiceAdd C# sample");
connectionOpen = true;
sessionManager.BeginSession(@"C:\Users\Public\Documents\Intuit\QuickBooks\Company Files\MyCia.qbw", ENOpenMode.omDontCare);
sessionBegun = true;
IInvoiceQuery invoiceQueryRq = requestMsgSet.AppendInvoiceQueryRq();
invoiceQueryRq.IncludeLineItems.SetValue(true);
//Send the request and get the response from QuickBooks
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
IResponse response = responseMsgSet.ResponseList.GetAt(0);
IInvoiceRetList invoiceRetList = (IInvoiceRetList)response.Detail;
var invoices = new List<Invoice>();
if (invoiceRetList != null)
{
for (int i = 0; i < invoiceRetList.Count; i++)
{
IInvoiceRet invoiceRet = invoiceRetList.GetAt(i);
var invoice = new Invoice
{
QuickBooksID = invoiceRet.TxnID.GetValue(),
EditSequence = invoiceRet.EditSequence.GetValue()
};
}
}
}
And after that I can check the "IsPaid" parameter.
But I'm thinking that when I'll have a really big amount of invoices this will not longer be a efficient Solution.
So how can I filter my query to just get the invoices that has been paid on that specific date?
Note: I'm using C# with the QBFC13Lib Library.