private IItemInventoryRet GetInventoryItem(string fullName) { IItemInventoryRetList itemInventoryRetList = null; IItemInventoryRet InventoryItem = null; try { QBItemInventory _QBItemInventory = new QBItemInventory(); IResponseList responseList = _QBItemInventory.GetItemInventor(fullName, sessionManager); //if we sent only one request, there is only one response. for (int i = 0; i < responseList.Count; i++) { IResponse response = responseList.GetAt(i); //check the status code of the response, 0=ok, >0 is warning if (response.StatusCode >= 0) { //the request-specific response is in the details, make sure we have some if (response.Detail != null) { //make sure the response is the type we're expecting ENResponseType responseType = (ENResponseType)response.Type.GetValue(); if (responseType == ENResponseType.rtItemInventoryQueryRs) { //upcast to more specific type here, this is safe because we checked with response.Type check above itemInventoryRetList = (IItemInventoryRetList)response.Detail; if (itemInventoryRetList != null && itemInventoryRetList.Count > 0) { for (int j = 0; j < itemInventoryRetList.Count; j++) { InventoryItem = itemInventoryRetList.GetAt(j); } } } } } else { int statusCode = response.StatusCode; string statusMessage = response.StatusMessage; string statusSeverity = response.StatusSeverity; } } } catch (Exception e) { } return(InventoryItem); }
private InventoryItem ExtractInventoryItem(IItemInventoryRet item) { InventoryItem inventoryItem = new InventoryItem(); if (item.ManufacturerPartNumber != null) { inventoryItem.Code = item.ManufacturerPartNumber.GetValue(); } if (item.QuantityOnHand != null) { inventoryItem.Quantity = (int)item.QuantityOnHand.GetValue(); } if (item.SalesPrice != null) { inventoryItem.BasePrice = item.SalesPrice.GetValue(); } return(inventoryItem); }
public static string[,] extractItemQueryResponses(String response, Session sess) { string[,] items; QBSessionManager sessionManager = new QBSessionManager(); IMsgSetResponse responseSet = sessionManager.ToMsgSetResponse(response, sess.getCountry(), sess.getMajorVers(), sess.getMinorVers()); IItemInventoryRetList itemRetList = responseSet.ResponseList.GetAt(0).Detail as IItemInventoryRetList; int length = itemRetList.Count; items = new string[length, 3]; if (length > 0) { for (int ndx = 0; ndx < length; ndx++) { IItemInventoryRet itemRet = itemRetList.GetAt(ndx); items[ndx, 0] = itemRet.FullName.GetValue(); items[ndx, 1] = itemRet.SalesPrice.GetValue().ToString(); items[ndx, 2] = itemRet.QuantityOnHand.GetValue().ToString(); } } return(items); }
Items WalkInventoryItem(IItemInventoryRet ItemRet) { if (ItemRet == null) { return(null); } Items item = new Items(); item.ItemType = ItemRet.Type.GetAsString(); item.Name = ItemRet.FullName.GetValue(); item.EditSequence = ItemRet.EditSequence.GetValue(); item.TxnID = ItemRet.ListID.GetValue(); if (ItemRet.SalesPrice != null) { item.Rate = ItemRet.SalesPrice.GetValue(); } if (ItemRet.SalesDesc != null) { item.Description = ItemRet.SalesDesc.GetValue(); } if (ItemRet.IsActive != null) { if (ItemRet.IsActive.GetValue()) { return(item); } else { return(null); } } else { return(null); } }
private void InputItem_Load(object sender, System.EventArgs e) { // IY: Create the session manager object using QBFC QBSessionManager sessionManager = new QBSessionManager(); // IY: We want to know if we begun a session so we can end it if an // error happens bool booSessionBegun = false; try { // IY: Get the RequestMsgSet based on the correct QB Version IMsgSetRequest requestSet = getLatestMsgSetRequest(sessionManager); // IY: Initialize the message set request object requestSet.Attributes.OnError = ENRqOnError.roeStop; // IY: Add the request to the message set request object IItemQuery ItemQ = requestSet.AppendItemQueryRq(); // IY: Optionally, you can put filter on it. // ItemQ.ORListQuery.ListFilter.MaxReturned.SetValue(30); // IY: Open the connection and begin a session to QuickBooks sessionManager.OpenConnection("", "IDN InvoiceAdd C# sample"); sessionManager.BeginSession("", ENOpenMode.omDontCare); booSessionBegun = true; // IY: Do the request and get the response message set object IMsgSetResponse responseSet = sessionManager.DoRequests(requestSet); // Uncomment the following to view and save the request and response XML //string requestXML = requestSet.ToXMLString(); //MessageBox.Show(requestXML); // SaveXML(requestXML); //string responseXML = responseSet.ToXMLString(); //MessageBox.Show(responseXML); // SaveXML(responseXML); IResponse response = responseSet.ResponseList.GetAt(0); //int statusCode = response.StatusCode; //string statusMessage = response.StatusMessage; //string statusSeverity = response.StatusSeverity; //MessageBox.Show("Status:\nCode = " + statusCode + "\nMessage = " + statusMessage + "\nSeverity = " + statusSeverity); IORItemRetList orItemRetList = response.Detail as IORItemRetList; if (!(orItemRetList.Count == 0)) { for (int ndx = 0; ndx <= (orItemRetList.Count - 1); ndx++) { IORItemRet orItemRet = orItemRetList.GetAt(ndx); // IY: The ortype property returns an enum // of the elements that can be contained in the OR object switch (orItemRet.ortype) { case ENORItemRet.orirItemServiceRet: { // orir prefix comes from OR + Item + Ret IItemServiceRet ItemServiceRet = orItemRet.ItemServiceRet; isTaxable = ItemServiceRet?.SalesTaxCodeRef?.FullName?.GetValue(); SetTaxableDefaultIfEmpty(ref isTaxable); cmboBx2_Item.Items.Add(ItemServiceRet?.FullName?.GetValue() + ":" + isTaxable); } break; case ENORItemRet.orirItemInventoryRet: { IItemInventoryRet ItemInventoryRet = orItemRet.ItemInventoryRet; isTaxable = ItemInventoryRet?.SalesTaxCodeRef?.FullName?.GetValue(); SetTaxableDefaultIfEmpty(ref isTaxable); cmboBx2_Item.Items.Add(ItemInventoryRet?.FullName?.GetValue() + ":" + isTaxable); } break; case ENORItemRet.orirItemNonInventoryRet: { IItemNonInventoryRet ItemNonInventoryRet = orItemRet.ItemNonInventoryRet; isTaxable = ItemNonInventoryRet?.SalesTaxCodeRef?.FullName?.GetValue(); SetTaxableDefaultIfEmpty(ref isTaxable); cmboBx2_Item.Items.Add(ItemNonInventoryRet?.FullName?.GetValue() + ":" + isTaxable); } break; } } // for loop } // if // IY: Close the session and connection with QuickBooks sessionManager.EndSession(); booSessionBegun = false; sessionManager.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString() + "\nStack Trace: \n" + ex.StackTrace + "\nExiting the application"); if (booSessionBegun) { sessionManager.EndSession(); sessionManager.CloseConnection(); } } }
private ESRI.ArcLogistics.DomainObjects.Order MakeOrderFromInvoice(IInvoiceRet invoiceRet, QBSessionManager session) { ESRI.ArcLogistics.DomainObjects.Order resultOrder = null; ICustomerRet customerRet = QueryCustomer(session, invoiceRet.CustomerRef.FullName.GetValue()); CapacitiesInfo capInfo = m_application.Project.CapacitiesInfo; OrderCustomPropertiesInfo propInfo = m_application.Project.OrderCustomPropertiesInfo; resultOrder = new ESRI.ArcLogistics.DomainObjects.Order(capInfo, propInfo); resultOrder.PlannedDate = m_application.CurrentDate; if (customerRet.ParentRef != null) { resultOrder.Name = customerRet.ParentRef.FullName.GetValue(); } else { resultOrder.Name = customerRet.FullName.GetValue(); } IAddress useAddress = null; if (customerRet.ShipAddress != null) { useAddress = customerRet.ShipAddress; } else if (customerRet.BillAddress != null) { useAddress = customerRet.BillAddress; } else { m_application.Messenger.AddWarning("No address for: " + resultOrder.Name); } if (useAddress != null) { if (useAddress.Addr2 != null) { resultOrder.Address.AddressLine = useAddress.Addr2.GetValue(); } else { resultOrder.Address.AddressLine = useAddress.Addr1.GetValue(); } resultOrder.Address.Locality3 = useAddress.City.GetValue(); resultOrder.Address.StateProvince = useAddress.State.GetValue(); resultOrder.Address.PostalCode1 = useAddress.PostalCode.GetValue(); AddressCandidate candidate = m_application.Geocoder.Geocode(resultOrder.Address); resultOrder.GeoLocation = candidate.GeoLocation; } // Look in the order custom properties for matching invoice detail items (by item description). // Look in the order capacities for matching item type custom fields. OrderCustomPropertiesInfo orderPropertiesInfo = resultOrder.CustomPropertiesInfo; OrderCustomProperties orderProperties = resultOrder.CustomProperties; CapacitiesInfo orderCapacitiesInfo = resultOrder.CapacitiesInfo; Capacities orderCapacities = resultOrder.Capacities; // Retrieve invoice line list // Each line can be either InvoiceLineRet OR InvoiceLineGroupRet IORInvoiceLineRetList orInvoiceLineRetList = invoiceRet.ORInvoiceLineRetList; if (orInvoiceLineRetList != null && (orderProperties.Count > 0 || orderCapacities.Count > 0)) { int lineCount = orInvoiceLineRetList.Count; for (int i = 0; i < lineCount; i++) { IORInvoiceLineRet orInvoiceLineRet = orInvoiceLineRetList.GetAt(i); // Check what to retrieve from the orInvoiceLineRet object // based on the "ortype" property. Skip summary lines. if (orInvoiceLineRet.ortype != ENORInvoiceLineRet.orilrInvoiceLineRet) { continue; } if (orInvoiceLineRet.InvoiceLineRet.ItemRef.FullName != null) { string itemName = orInvoiceLineRet.InvoiceLineRet.ItemRef.FullName.GetValue(); double itemQuantity = 0; if (orInvoiceLineRet.InvoiceLineRet.ItemRef != null) { itemQuantity = System.Convert.ToDouble(orInvoiceLineRet.InvoiceLineRet.Quantity.GetValue()); } // look for matching custom order property OrderCustomProperty orderPropertyInfoItem = null; for (int j = 0; j < orderPropertiesInfo.Count; j++) { orderPropertyInfoItem = orderPropertiesInfo.ElementAt(j) as OrderCustomProperty; if (orderPropertyInfoItem.Name == itemName) { if (orderPropertyInfoItem.Type == OrderCustomPropertyType.Numeric) { orderProperties[j] = itemQuantity; } else { orderProperties[j] = itemQuantity.ToString(); } break; } } // look for matching capacity // need to lookup item record so we get the extra field(s) // TODO: It might be a good idea to cache these locally to avoid // excess QB queries. IORItemRet orItemRet = QueryItem(session, itemName); IDataExtRetList custItemFieldsRetList = null; switch (orItemRet.ortype) { case ENORItemRet.orirItemServiceRet: { // orir prefix comes from OR + Item + Ret IItemServiceRet ItemServiceRet = orItemRet.ItemServiceRet; custItemFieldsRetList = ItemServiceRet.DataExtRetList; } break; case ENORItemRet.orirItemInventoryRet: { IItemInventoryRet ItemInventoryRet = orItemRet.ItemInventoryRet; custItemFieldsRetList = ItemInventoryRet.DataExtRetList; } break; case ENORItemRet.orirItemNonInventoryRet: { IItemNonInventoryRet ItemNonInventoryRet = orItemRet.ItemNonInventoryRet; custItemFieldsRetList = ItemNonInventoryRet.DataExtRetList; } break; } int custItemFieldCount = 0; if (custItemFieldsRetList != null) { custItemFieldCount = custItemFieldsRetList.Count; } for (int j = 0; j < custItemFieldCount; j++) { IDataExtRet custItemField = custItemFieldsRetList.GetAt(j); string custItemFieldName = custItemField.DataExtName.GetValue(); CapacityInfo orderCapacityInfoItem = null; for (int k = 0; k < orderCapacitiesInfo.Count; k++) { orderCapacityInfoItem = orderCapacitiesInfo.ElementAt(k); if (orderCapacityInfoItem.Name == custItemFieldName) { orderCapacities[k] += System.Convert.ToDouble(custItemField.DataExtValue.GetValue()) * itemQuantity; break; } } } } } } resultOrder.CustomProperties = orderProperties; resultOrder.Capacities = orderCapacities; return(resultOrder); }
public static void DoQbXml() { bool sessionBegun = false; bool connectionOpen = false; QBSessionManager sessionManager = null; sessionManager = new QBSessionManager(); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("", "GenerateInvoicePDFs"); connectionOpen = true; sessionManager.BeginSession("", ENOpenMode.omDontCare); sessionBegun = true; //Create the message set request object to hold our request IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 13, 0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; 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(), InvoiceNumber = invoiceRet.RefNumber?.GetValue(), Memo = invoiceRet.Memo?.GetValue(), JobNumber = invoiceRet.Other?.GetValue() }; Console.WriteLine($"INv:{invoice.InvoiceNumber}, EditSequence: {invoice.JobNumber}"); requestMsgSet.ClearRequests(); ICustomerQuery customerQueryRq = requestMsgSet.AppendCustomerQueryRq(); customerQueryRq.ORCustomerListQuery.ListIDList.Add(invoiceRet.CustomerRef.ListID.GetValue()); //Send the request and get the response from QuickBooks responseMsgSet = sessionManager.DoRequests(requestMsgSet); response = responseMsgSet.ResponseList.GetAt(0); ICustomerRetList customerRetList = (ICustomerRetList)response.Detail; ICustomerRet customerRet = customerRetList.GetAt(0); if (i > 200) { return; } invoice.Customer = new Customer { Name = customerRet.Name.GetValue(), QuickBooksID = customerRet.ListID.GetValue(), EditSequence = customerRet.EditSequence.GetValue() }; if (invoiceRet.ORInvoiceLineRetList != null) { for (int j = 0; j < invoiceRet.ORInvoiceLineRetList.Count; j++) { IORInvoiceLineRet ORInvoiceLineRet = invoiceRet.ORInvoiceLineRetList.GetAt(j); try { var invoiceItem = new InvoiceItem { Amount = ORInvoiceLineRet.InvoiceLineRet.Amount.GetValue(), QuickBooksID = ORInvoiceLineRet.InvoiceLineRet.TxnLineID.GetValue() }; requestMsgSet.ClearRequests(); IItemQuery itemQueryRq = requestMsgSet.AppendItemQueryRq(); itemQueryRq.ORListQuery.ListIDList.Add(ORInvoiceLineRet.InvoiceLineRet.ItemRef.ListID.GetValue()); //Send the request and get the response from QuickBooks responseMsgSet = sessionManager.DoRequests(requestMsgSet); response = responseMsgSet.ResponseList.GetAt(0); IORItemRetList itemRetList = (IORItemRetList)response.Detail; IORItemRet itemRet = itemRetList.GetAt(0); if (itemRet.ItemInventoryRet != null) { IItemInventoryRet itemInventoryRet = itemRet.ItemInventoryRet; var item = new Item { Name = itemInventoryRet.Name.GetValue(), Description = itemInventoryRet.SalesDesc.GetValue(), Rate = itemInventoryRet.SalesPrice.GetValue(), //ItemType = ItemType.Inventory, QuickBooksID = itemInventoryRet.ListID.GetValue(), EditSequence = itemInventoryRet.EditSequence.GetValue() }; invoiceItem.Item = item; } else if (itemRet.ItemServiceRet != null) { IItemServiceRet itemServiceRet = itemRet.ItemServiceRet; var item = new Item { Name = itemServiceRet.Name.GetValue(), Description = itemServiceRet.ORSalesPurchase.SalesOrPurchase.Desc.GetValue(), Rate = itemServiceRet.ORSalesPurchase.SalesOrPurchase.ORPrice.Price.GetValue(), //ItemType = ItemType.Service, QuickBooksID = itemServiceRet.ListID.GetValue(), EditSequence = itemServiceRet.EditSequence.GetValue() }; invoiceItem.Item = item; } invoice.InvoiceItems.Add(invoiceItem); } catch (Exception ex) { Console.WriteLine(invoice.Customer.Name); throw; } } } invoices.Add(invoice); } } }
POSAI_mvvm.QuickBooks.TrackableCollection <ItemInventoryRet> WalkItemInventoryRet(IItemInventoryRetList ItemInventoryRetList) { TrackableCollection <ItemInventoryRet> itmList = new TrackableCollection <QuickBooks.ItemInventoryRet>(null); for (int i = 0; i < ItemInventoryRetList.Count; i++) { IItemInventoryRet positm = ItemInventoryRetList.GetAt(i); ItemInventoryRet itm = new ItemInventoryRet(); if (positm == null) { continue; } //Go through all the elements of IpositmList //Get value of ListID if (positm.ListID != null) { itm.ListID = (string)positm.ListID.GetValue(); } //Get value of ALU if (positm.ALU != null) { itm.ALU = (string)positm.ALU.GetValue(); } //Get value of Attribute if (positm.Attribute != null) { itm.Attribute = (string)positm.Attribute.GetValue(); } //Get value of DepartmentCode if (positm.DepartmentCode != null) { itm.DepartmentCode = (string)positm.DepartmentCode.GetValue(); } //Get value of Desc1 if (positm.Desc1 != null) { itm.Desc1 = (string)positm.Desc1.GetValue(); } //Get value of Desc2 if (positm.Desc2 != null) { itm.Desc2 = (string)positm.Desc2.GetValue(); } //Get value of ItemNumber if (positm.ItemNumber != null) { itm.ItemNumber = (int)positm.ItemNumber.GetValue(); } //Get value of ItemType if (positm.ItemType != null) { itm.ItemType = ((ENItemType)positm.ItemType.GetValue()).ToString(); } //Get value of Size if (positm.Size != null) { itm.Size = (string)positm.Size.GetValue(); } #region "More Properties" // //Get value of TimeCreated //if (ItemInventoryRet.TimeCreated != null) //{ //DateTime TimeCreated78 = (DateTime)ItemInventoryRet.TimeCreated.GetValue(); //} ////Get value of TimeModified //if (ItemInventoryRet.TimeModified != null) //{ //DateTime TimeModified79 = (DateTime)ItemInventoryRet.TimeModified.GetValue(); //} ////Get value of COGSAccount //if (ItemInventoryRet.COGSAccount != null) //{ //string COGSAccount82 = (string)ItemInventoryRet.COGSAccount.GetValue(); //} ////Get value of Cost //if (ItemInventoryRet.Cost != null) //{ //double Cost83 = (double)ItemInventoryRet.Cost.GetValue(); //} ////Get value of DepartmentListID //if (ItemInventoryRet.DepartmentListID != null) //{ //string DepartmentListID85 = (string)ItemInventoryRet.DepartmentListID.GetValue(); //} ////Get value of IncomeAccount //if (ItemInventoryRet.IncomeAccount != null) //{ //string IncomeAccount88 = (string)ItemInventoryRet.IncomeAccount.GetValue(); //} ////Get value of IsBelowReorder //if (ItemInventoryRet.IsBelowReorder != null) //{ //bool IsBelowReorder89 = (bool)ItemInventoryRet.IsBelowReorder.GetValue(); //} ////Get value of IsEligibleForCommission //if (ItemInventoryRet.IsEligibleForCommission != null) //{ //bool IsEligibleForCommission90 = (bool)ItemInventoryRet.IsEligibleForCommission.GetValue(); //} ////Get value of IsPrintingTags //if (ItemInventoryRet.IsPrintingTags != null) //{ //bool IsPrintingTags91 = (bool)ItemInventoryRet.IsPrintingTags.GetValue(); //} ////Get value of IsUnorderable //if (ItemInventoryRet.IsUnorderable != null) //{ //bool IsUnorderable92 = (bool)ItemInventoryRet.IsUnorderable.GetValue(); //} ////Get value of HasPictures //if (ItemInventoryRet.HasPictures != null) //{ //bool HasPictures93 = (bool)ItemInventoryRet.HasPictures.GetValue(); //} ////Get value of IsEligibleForRewards //if (ItemInventoryRet.IsEligibleForRewards != null) //{ //bool IsEligibleForRewards94 = (bool)ItemInventoryRet.IsEligibleForRewards.GetValue(); //} ////Get value of IsWebItem //if (ItemInventoryRet.IsWebItem != null) //{ //bool IsWebItem95 = (bool)ItemInventoryRet.IsWebItem.GetValue(); //} ////Get value of LastReceived //if (ItemInventoryRet.LastReceived != null) //{ //DateTime LastReceived98 = (DateTime)ItemInventoryRet.LastReceived.GetValue(); //} ////Get value of MarginPercent //if (ItemInventoryRet.MarginPercent != null) //{ //int MarginPercent99 = (int)ItemInventoryRet.MarginPercent.GetValue(); //} ////Get value of MarkupPercent //if (ItemInventoryRet.MarkupPercent != null) //{ //int MarkupPercent100 = (int)ItemInventoryRet.MarkupPercent.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.MSRP != null) //{ //double MSRP101 = (double)ItemInventoryRet.MSRP.GetValue(); //} ////Get value of OnHandStore01 //if (ItemInventoryRet.OnHandStore01 != null) //{ //int OnHandStore01102 = (int)ItemInventoryRet.OnHandStore01.GetValue(); //} ////Get value of OnHandStore02 //if (ItemInventoryRet.OnHandStore02 != null) //{ //int OnHandStore02103 = (int)ItemInventoryRet.OnHandStore02.GetValue(); //} ////Get value of OnHandStore03 //if (ItemInventoryRet.OnHandStore03 != null) //{ //int OnHandStore03104 = (int)ItemInventoryRet.OnHandStore03.GetValue(); //} ////Get value of OnHandStore04 //if (ItemInventoryRet.OnHandStore04 != null) //{ //int OnHandStore04105 = (int)ItemInventoryRet.OnHandStore04.GetValue(); //} ////Get value of OnHandStore05 //if (ItemInventoryRet.OnHandStore05 != null) //{ //int OnHandStore05106 = (int)ItemInventoryRet.OnHandStore05.GetValue(); //} ////Get value of OnHandStore06 //if (ItemInventoryRet.OnHandStore06 != null) //{ //int OnHandStore06107 = (int)ItemInventoryRet.OnHandStore06.GetValue(); //} ////Get value of OnHandStore07 //if (ItemInventoryRet.OnHandStore07 != null) //{ //int OnHandStore07108 = (int)ItemInventoryRet.OnHandStore07.GetValue(); //} ////Get value of OnHandStore08 //if (ItemInventoryRet.OnHandStore08 != null) //{ //int OnHandStore08109 = (int)ItemInventoryRet.OnHandStore08.GetValue(); //} ////Get value of OnHandStore09 //if (ItemInventoryRet.OnHandStore09 != null) //{ //int OnHandStore09110 = (int)ItemInventoryRet.OnHandStore09.GetValue(); //} ////Get value of OnHandStore10 //if (ItemInventoryRet.OnHandStore10 != null) //{ //int OnHandStore10111 = (int)ItemInventoryRet.OnHandStore10.GetValue(); //} ////Get value of OnHandStore11 //if (ItemInventoryRet.OnHandStore11 != null) //{ //int OnHandStore11112 = (int)ItemInventoryRet.OnHandStore11.GetValue(); //} ////Get value of OnHandStore12 //if (ItemInventoryRet.OnHandStore12 != null) //{ //int OnHandStore12113 = (int)ItemInventoryRet.OnHandStore12.GetValue(); //} ////Get value of OnHandStore13 //if (ItemInventoryRet.OnHandStore13 != null) //{ //int OnHandStore13114 = (int)ItemInventoryRet.OnHandStore13.GetValue(); //} ////Get value of OnHandStore14 //if (ItemInventoryRet.OnHandStore14 != null) //{ //int OnHandStore14115 = (int)ItemInventoryRet.OnHandStore14.GetValue(); //} ////Get value of OnHandStore15 //if (ItemInventoryRet.OnHandStore15 != null) //{ //int OnHandStore15116 = (int)ItemInventoryRet.OnHandStore15.GetValue(); //} ////Get value of OnHandStore16 //if (ItemInventoryRet.OnHandStore16 != null) //{ //int OnHandStore16117 = (int)ItemInventoryRet.OnHandStore16.GetValue(); //} ////Get value of OnHandStore17 //if (ItemInventoryRet.OnHandStore17 != null) //{ //int OnHandStore17118 = (int)ItemInventoryRet.OnHandStore17.GetValue(); //} ////Get value of OnHandStore18 //if (ItemInventoryRet.OnHandStore18 != null) //{ //int OnHandStore18119 = (int)ItemInventoryRet.OnHandStore18.GetValue(); //} ////Get value of OnHandStore19 //if (ItemInventoryRet.OnHandStore19 != null) //{ //int OnHandStore19120 = (int)ItemInventoryRet.OnHandStore19.GetValue(); //} ////Get value of OnHandStore20 //if (ItemInventoryRet.OnHandStore20 != null) //{ //int OnHandStore20121 = (int)ItemInventoryRet.OnHandStore20.GetValue(); //} ////Get value of ReorderPointStore01 //if (ItemInventoryRet.ReorderPointStore01 != null) //{ //int ReorderPointStore01122 = (int)ItemInventoryRet.ReorderPointStore01.GetValue(); //} ////Get value of ReorderPointStore02 //if (ItemInventoryRet.ReorderPointStore02 != null) //{ //int ReorderPointStore02123 = (int)ItemInventoryRet.ReorderPointStore02.GetValue(); //} ////Get value of ReorderPointStore03 //if (ItemInventoryRet.ReorderPointStore03 != null) //{ //int ReorderPointStore03124 = (int)ItemInventoryRet.ReorderPointStore03.GetValue(); //} ////Get value of ReorderPointStore04 //if (ItemInventoryRet.ReorderPointStore04 != null) //{ //int ReorderPointStore04125 = (int)ItemInventoryRet.ReorderPointStore04.GetValue(); //} ////Get value of ReorderPointStore05 //if (ItemInventoryRet.ReorderPointStore05 != null) //{ //int ReorderPointStore05126 = (int)ItemInventoryRet.ReorderPointStore05.GetValue(); //} ////Get value of ReorderPointStore06 //if (ItemInventoryRet.ReorderPointStore06 != null) //{ //int ReorderPointStore06127 = (int)ItemInventoryRet.ReorderPointStore06.GetValue(); //} ////Get value of ReorderPointStore07 //if (ItemInventoryRet.ReorderPointStore07 != null) //{ //int ReorderPointStore07128 = (int)ItemInventoryRet.ReorderPointStore07.GetValue(); //} ////Get value of ReorderPointStore08 //if (ItemInventoryRet.ReorderPointStore08 != null) //{ //int ReorderPointStore08129 = (int)ItemInventoryRet.ReorderPointStore08.GetValue(); //} ////Get value of ReorderPointStore09 //if (ItemInventoryRet.ReorderPointStore09 != null) //{ //int ReorderPointStore09130 = (int)ItemInventoryRet.ReorderPointStore09.GetValue(); //} ////Get value of ReorderPointStore10 //if (ItemInventoryRet.ReorderPointStore10 != null) //{ //int ReorderPointStore10131 = (int)ItemInventoryRet.ReorderPointStore10.GetValue(); //} ////Get value of ReorderPointStore11 //if (ItemInventoryRet.ReorderPointStore11 != null) //{ //int ReorderPointStore11132 = (int)ItemInventoryRet.ReorderPointStore11.GetValue(); //} ////Get value of ReorderPointStore12 //if (ItemInventoryRet.ReorderPointStore12 != null) //{ //int ReorderPointStore12133 = (int)ItemInventoryRet.ReorderPointStore12.GetValue(); //} ////Get value of ReorderPointStore13 //if (ItemInventoryRet.ReorderPointStore13 != null) //{ //int ReorderPointStore13134 = (int)ItemInventoryRet.ReorderPointStore13.GetValue(); //} ////Get value of ReorderPointStore14 //if (ItemInventoryRet.ReorderPointStore14 != null) //{ //int ReorderPointStore14135 = (int)ItemInventoryRet.ReorderPointStore14.GetValue(); //} ////Get value of ReorderPointStore15 //if (ItemInventoryRet.ReorderPointStore15 != null) //{ //int ReorderPointStore15136 = (int)ItemInventoryRet.ReorderPointStore15.GetValue(); //} ////Get value of ReorderPointStore16 //if (ItemInventoryRet.ReorderPointStore16 != null) //{ //int ReorderPointStore16137 = (int)ItemInventoryRet.ReorderPointStore16.GetValue(); //} ////Get value of ReorderPointStore17 //if (ItemInventoryRet.ReorderPointStore17 != null) //{ //int ReorderPointStore17138 = (int)ItemInventoryRet.ReorderPointStore17.GetValue(); //} ////Get value of ReorderPointStore18 //if (ItemInventoryRet.ReorderPointStore18 != null) //{ //int ReorderPointStore18139 = (int)ItemInventoryRet.ReorderPointStore18.GetValue(); //} ////Get value of ReorderPointStore19 //if (ItemInventoryRet.ReorderPointStore19 != null) //{ //int ReorderPointStore19140 = (int)ItemInventoryRet.ReorderPointStore19.GetValue(); //} ////Get value of ReorderPointStore20 //if (ItemInventoryRet.ReorderPointStore20 != null) //{ //int ReorderPointStore20141 = (int)ItemInventoryRet.ReorderPointStore20.GetValue(); //} ////Get value of OrderByUnit //if (ItemInventoryRet.OrderByUnit != null) //{ //string OrderByUnit142 = (string)ItemInventoryRet.OrderByUnit.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.OrderCost != null) //{ //double OrderCost143 = (double)ItemInventoryRet.OrderCost.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.Price1 != null) //{ //double Price1144 = (double)ItemInventoryRet.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.Price2 != null) //{ //double Price2145 = (double)ItemInventoryRet.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.Price3 != null) //{ //double Price3146 = (double)ItemInventoryRet.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.Price4 != null) //{ //double Price4147 = (double)ItemInventoryRet.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.Price5 != null) //{ //double Price5148 = (double)ItemInventoryRet.Price5.GetValue(); //} ////Get value of QuantityOnCustomerOrder //if (ItemInventoryRet.QuantityOnCustomerOrder != null) //{ //int QuantityOnCustomerOrder149 = (int)ItemInventoryRet.QuantityOnCustomerOrder.GetValue(); //} ////Get value of QuantityOnHand //if (ItemInventoryRet.QuantityOnHand != null) //{ //int QuantityOnHand150 = (int)ItemInventoryRet.QuantityOnHand.GetValue(); //} ////Get value of QuantityOnOrder //if (ItemInventoryRet.QuantityOnOrder != null) //{ //int QuantityOnOrder151 = (int)ItemInventoryRet.QuantityOnOrder.GetValue(); //} ////Get value of QuantityOnPendingOrder //if (ItemInventoryRet.QuantityOnPendingOrder != null) //{ //int QuantityOnPendingOrder152 = (int)ItemInventoryRet.QuantityOnPendingOrder.GetValue(); //} //if (ItemInventoryRet.AvailableQtyList != null) //{ //for (int i153 = 0; i153 < ItemInventoryRet.AvailableQtyList.Count; i153++) //{ //IAvailableQty AvailableQty = ItemInventoryRet.AvailableQtyList.GetAt(i153); ////Get value of StoreNumber //if (AvailableQty.StoreNumber != null) //{ //int StoreNumber154 = (int)AvailableQty.StoreNumber.GetValue(); //} ////Get value of QuantityOnOrder //if (AvailableQty.QuantityOnOrder != null) //{ //int QuantityOnOrder155 = (int)AvailableQty.QuantityOnOrder.GetValue(); //} ////Get value of QuantityOnCustomerOrder //if (AvailableQty.QuantityOnCustomerOrder != null) //{ //int QuantityOnCustomerOrder156 = (int)AvailableQty.QuantityOnCustomerOrder.GetValue(); //} ////Get value of QuantityOnPendingOrder //if (AvailableQty.QuantityOnPendingOrder != null) //{ //int QuantityOnPendingOrder157 = (int)AvailableQty.QuantityOnPendingOrder.GetValue(); //} //} //} ////Get value of ReorderPoint //if (ItemInventoryRet.ReorderPoint != null) //{ //int ReorderPoint158 = (int)ItemInventoryRet.ReorderPoint.GetValue(); //} ////Get value of SellByUnit //if (ItemInventoryRet.SellByUnit != null) //{ //string SellByUnit159 = (string)ItemInventoryRet.SellByUnit.GetValue(); //} ////Get value of SerialFlag //if (ItemInventoryRet.SerialFlag != null) //{ //ENSerialFlag SerialFlag160 = (ENSerialFlag)ItemInventoryRet.SerialFlag.GetValue(); //} ////Get value of StoreExchangeStatus //if (ItemInventoryRet.StoreExchangeStatus != null) //{ //ENStoreExchangeStatus StoreExchangeStatus162 = (ENStoreExchangeStatus)ItemInventoryRet.StoreExchangeStatus.GetValue(); //} ////Get value of TaxCode //if (ItemInventoryRet.TaxCode != null) //{ //string TaxCode163 = (string)ItemInventoryRet.TaxCode.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure != null) //{ //string UnitOfMeasure164 = (string)ItemInventoryRet.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UPC != null) //{ //string UPC165 = (string)ItemInventoryRet.UPC.GetValue(); //} ////Get value of VendorCode //if (ItemInventoryRet.VendorCode != null) //{ //string VendorCode166 = (string)ItemInventoryRet.VendorCode.GetValue(); //} ////Get value of VendorListID //if (ItemInventoryRet.VendorListID != null) //{ //string VendorListID167 = (string)ItemInventoryRet.VendorListID.GetValue(); //} ////Get value of WebDesc //if (ItemInventoryRet.WebDesc != null) //{ //string WebDesc168 = (string)ItemInventoryRet.WebDesc.GetValue(); //} ////Get value of WebPrice //if (ItemInventoryRet.WebPrice != null) //{ //double WebPrice169 = (double)ItemInventoryRet.WebPrice.GetValue(); //} ////Get value of Manufacturer //if (ItemInventoryRet.Manufacturer != null) //{ //string Manufacturer170 = (string)ItemInventoryRet.Manufacturer.GetValue(); //} ////Get value of Weight //if (ItemInventoryRet.Weight != null) //{ //IQBFloatType Weight171 = (IQBFloatType)ItemInventoryRet.Weight.GetValue(); //} ////Get value of WebSKU //if (ItemInventoryRet.WebSKU != null) //{ //string WebSKU172 = (string)ItemInventoryRet.WebSKU.GetValue(); //} ////Get value of Keywords //if (ItemInventoryRet.Keywords != null) //{ //string Keywords173 = (string)ItemInventoryRet.Keywords.GetValue(); //} ////Get value of WebCategories //if (ItemInventoryRet.WebCategories != null) //{ //string WebCategories174 = (string)ItemInventoryRet.WebCategories.GetValue(); //} //if (ItemInventoryRet.UnitOfMeasure1 != null) //{ ////Get value of ALU //if (ItemInventoryRet.UnitOfMeasure1.ALU != null) //{ //string ALU175 = (string)ItemInventoryRet.UnitOfMeasure1.ALU.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.UnitOfMeasure1.MSRP != null) //{ //double MSRP176 = (double)ItemInventoryRet.UnitOfMeasure1.MSRP.GetValue(); //} ////Get value of NumberOfBaseUnits //if (ItemInventoryRet.UnitOfMeasure1.NumberOfBaseUnits != null) //{ //int NumberOfBaseUnits177 = (int)ItemInventoryRet.UnitOfMeasure1.NumberOfBaseUnits.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.UnitOfMeasure1.Price1 != null) //{ //double Price1178 = (double)ItemInventoryRet.UnitOfMeasure1.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.UnitOfMeasure1.Price2 != null) //{ //double Price2179 = (double)ItemInventoryRet.UnitOfMeasure1.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.UnitOfMeasure1.Price3 != null) //{ //double Price3180 = (double)ItemInventoryRet.UnitOfMeasure1.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.UnitOfMeasure1.Price4 != null) //{ //double Price4181 = (double)ItemInventoryRet.UnitOfMeasure1.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.UnitOfMeasure1.Price5 != null) //{ //double Price5182 = (double)ItemInventoryRet.UnitOfMeasure1.Price5.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure1.UnitOfMeasure != null) //{ //string UnitOfMeasure183 = (string)ItemInventoryRet.UnitOfMeasure1.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UnitOfMeasure1.UPC != null) //{ //string UPC184 = (string)ItemInventoryRet.UnitOfMeasure1.UPC.GetValue(); //} //} //if (ItemInventoryRet.UnitOfMeasure2 != null) //{ ////Get value of ALU //if (ItemInventoryRet.UnitOfMeasure2.ALU != null) //{ //string ALU185 = (string)ItemInventoryRet.UnitOfMeasure2.ALU.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.UnitOfMeasure2.MSRP != null) //{ //double MSRP186 = (double)ItemInventoryRet.UnitOfMeasure2.MSRP.GetValue(); //} ////Get value of NumberOfBaseUnits //if (ItemInventoryRet.UnitOfMeasure2.NumberOfBaseUnits != null) //{ //int NumberOfBaseUnits187 = (int)ItemInventoryRet.UnitOfMeasure2.NumberOfBaseUnits.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.UnitOfMeasure2.Price1 != null) //{ //double Price1188 = (double)ItemInventoryRet.UnitOfMeasure2.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.UnitOfMeasure2.Price2 != null) //{ //double Price2189 = (double)ItemInventoryRet.UnitOfMeasure2.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.UnitOfMeasure2.Price3 != null) //{ //double Price3190 = (double)ItemInventoryRet.UnitOfMeasure2.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.UnitOfMeasure2.Price4 != null) //{ //double Price4191 = (double)ItemInventoryRet.UnitOfMeasure2.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.UnitOfMeasure2.Price5 != null) //{ //double Price5192 = (double)ItemInventoryRet.UnitOfMeasure2.Price5.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure2.UnitOfMeasure != null) //{ //string UnitOfMeasure193 = (string)ItemInventoryRet.UnitOfMeasure2.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UnitOfMeasure2.UPC != null) //{ //string UPC194 = (string)ItemInventoryRet.UnitOfMeasure2.UPC.GetValue(); //} //} //if (ItemInventoryRet.UnitOfMeasure3 != null) //{ ////Get value of ALU //if (ItemInventoryRet.UnitOfMeasure3.ALU != null) //{ //string ALU195 = (string)ItemInventoryRet.UnitOfMeasure3.ALU.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.UnitOfMeasure3.MSRP != null) //{ //double MSRP196 = (double)ItemInventoryRet.UnitOfMeasure3.MSRP.GetValue(); //} ////Get value of NumberOfBaseUnits //if (ItemInventoryRet.UnitOfMeasure3.NumberOfBaseUnits != null) //{ //int NumberOfBaseUnits197 = (int)ItemInventoryRet.UnitOfMeasure3.NumberOfBaseUnits.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.UnitOfMeasure3.Price1 != null) //{ //double Price1198 = (double)ItemInventoryRet.UnitOfMeasure3.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.UnitOfMeasure3.Price2 != null) //{ //double Price2199 = (double)ItemInventoryRet.UnitOfMeasure3.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.UnitOfMeasure3.Price3 != null) //{ //double Price3200 = (double)ItemInventoryRet.UnitOfMeasure3.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.UnitOfMeasure3.Price4 != null) //{ //double Price4201 = (double)ItemInventoryRet.UnitOfMeasure3.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.UnitOfMeasure3.Price5 != null) //{ //double Price5202 = (double)ItemInventoryRet.UnitOfMeasure3.Price5.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure3.UnitOfMeasure != null) //{ //string UnitOfMeasure203 = (string)ItemInventoryRet.UnitOfMeasure3.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UnitOfMeasure3.UPC != null) //{ //string UPC204 = (string)ItemInventoryRet.UnitOfMeasure3.UPC.GetValue(); //} //} //if (ItemInventoryRet.VendorInfo2 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo2.ALU != null) //{ //string ALU205 = (string)ItemInventoryRet.VendorInfo2.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo2.OrderCost != null) //{ //double OrderCost206 = (double)ItemInventoryRet.VendorInfo2.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo2.UPC != null) //{ //string UPC207 = (string)ItemInventoryRet.VendorInfo2.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID208 = (string)ItemInventoryRet.VendorInfo2.VendorListID.GetValue(); //} //if (ItemInventoryRet.VendorInfo3 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo3.ALU != null) //{ //string ALU209 = (string)ItemInventoryRet.VendorInfo3.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo3.OrderCost != null) //{ //double OrderCost210 = (double)ItemInventoryRet.VendorInfo3.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo3.UPC != null) //{ //string UPC211 = (string)ItemInventoryRet.VendorInfo3.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID212 = (string)ItemInventoryRet.VendorInfo3.VendorListID.GetValue(); //} //if (ItemInventoryRet.VendorInfo4 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo4.ALU != null) //{ //string ALU213 = (string)ItemInventoryRet.VendorInfo4.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo4.OrderCost != null) //{ //double OrderCost214 = (double)ItemInventoryRet.VendorInfo4.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo4.UPC != null) //{ //string UPC215 = (string)ItemInventoryRet.VendorInfo4.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID216 = (string)ItemInventoryRet.VendorInfo4.VendorListID.GetValue(); //} //if (ItemInventoryRet.VendorInfo5 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo5.ALU != null) //{ //string ALU217 = (string)ItemInventoryRet.VendorInfo5.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo5.OrderCost != null) //{ //double OrderCost218 = (double)ItemInventoryRet.VendorInfo5.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo5.UPC != null) //{ //string UPC219 = (string)ItemInventoryRet.VendorInfo5.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID220 = (string)ItemInventoryRet.VendorInfo5.VendorListID.GetValue(); //} //if (ItemInventoryRet.DataExtRetList != null) //{ //for (int i221 = 0; i221 < ItemInventoryRet.DataExtRetList.Count; i221++) //{ //IDataExtRet DataExtRet = ItemInventoryRet.DataExtRetList.GetAt(i221); ////Get value of OwnerID //string OwnerID222 = (string)DataExtRet.OwnerID.GetValue(); ////Get value of DataExtName //string DataExtName223 = (string)DataExtRet.DataExtName.GetValue(); ////Get value of DataExtType //ENDataExtType DataExtType224 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); ////Get value of DataExtValue //string DataExtValue225 = (string)DataExtRet.DataExtValue.GetValue(); //} //} #endregion itmList.Add(itm); } return(itmList); }
public IList <Invoice> GetInvoiceDetail() { bool sessionBegun = false; QBSessionManager sessionManager = null; var invoices = new List <Invoice>(); sessionManager = new QBSessionManager(); IMsgSetRequest requestMsgSet = null; var fromDate = new DateTime(2018, 1, 5); var toDate = new DateTime(2018, 1, 5); try { //Connect to QuickBooks and begin a session sessionManager.OpenConnection("", "GenerateInvoicePDFs"); //connectionOpen = true; sessionManager.BeginSession("", ENOpenMode.omDontCare); sessionBegun = true; //Create the message set request object to hold our request requestMsgSet = sessionManager.CreateMsgSetRequest("US", 13, 0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; IInvoiceQuery invoiceQueryRq = requestMsgSet.AppendInvoiceQueryRq(); // all invoices modified in the month of August 2016 // get all invoices for the month of august 2016 invoiceQueryRq.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.FromTxnDate.SetValue(fromDate); invoiceQueryRq.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.ToTxnDate.SetValue(toDate); // invoiceQueryRq.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.ModifiedDateRangeFilter.FromModifiedDate.SetValue(new DateTime(2017, 12, 1), true); // invoiceQueryRq.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.ModifiedDateRangeFilter.ToModifiedDate.SetValue(new DateTime(2017, 12, 31), true); 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; Console.WriteLine($"Invoices found: {invoiceRetList.Count}"); 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(), InvoiceNumber = invoiceRet.RefNumber?.GetValue(), Memo = invoiceRet.Memo?.GetValue(), JobNumber = invoiceRet.Other?.GetValue(), CustomerName = invoiceRet.CustomerRef.FullName?.GetValue() }; var customerListId = invoiceRet.CustomerRef?.ListID?.GetValue(); if (customerListId != null) { // Console.WriteLine($"{i}\tInv:{invoice.InvoiceNumber}, Job: {invoice.JobNumber}, Name:{invoice.CustomerName}"); requestMsgSet.ClearRequests(); ICustomerQuery customerQueryRq = requestMsgSet.AppendCustomerQueryRq(); customerQueryRq.ORCustomerListQuery.ListIDList.Add(customerListId); //Send the request and get the response from QuickBooks responseMsgSet = sessionManager.DoRequests(requestMsgSet); response = responseMsgSet.ResponseList.GetAt(0); ICustomerRetList customerRetList = (ICustomerRetList)response.Detail; ICustomerRet customerRet = customerRetList.GetAt(0); invoice.Customer = new Customer { Name = customerRet.Name?.GetValue(), QuickBooksID = customerRet.ListID?.GetValue(), EditSequence = customerRet.EditSequence?.GetValue(), FullName = customerRet.FullName?.GetValue(), CompanyName = customerRet.CompanyName?.GetValue() }; // Console.WriteLine($"{i}\t{invoice.Customer.Name}\t{invoice.Customer.FullName}\t{invoice.Customer.CompanyName}"); // Console.WriteLine($"{i}\t\tInvoice detail starts"); if (invoiceRet.ORInvoiceLineRetList != null) { Console.WriteLine($"InvoiceList Count: {invoiceRet.ORInvoiceLineRetList.Count}"); for (int j = 0; j < invoiceRet.ORInvoiceLineRetList.Count; j++) { IORInvoiceLineRet orInvoiceLineRet = invoiceRet.ORInvoiceLineRetList.GetAt(j); if (orInvoiceLineRet != null && orInvoiceLineRet.InvoiceLineRet != null) { var invoiceItem = new InvoiceItem { Amount = orInvoiceLineRet.InvoiceLineRet.Amount?.GetValue(), QuickBooksID = orInvoiceLineRet.InvoiceLineRet.TxnLineID?.GetValue(), Description = orInvoiceLineRet.InvoiceLineRet.Desc?.GetValue() }; Console.WriteLine($"j: {j}\tDescription: {invoiceItem.Description}"); requestMsgSet.ClearRequests(); IItemQuery itemQueryRq = requestMsgSet.AppendItemQueryRq(); itemQueryRq.ORListQuery.ListIDList.Add(orInvoiceLineRet.InvoiceLineRet.ItemRef?.ListID?.GetValue()); //Send the request and get the response from QuickBooks responseMsgSet = sessionManager.DoRequests(requestMsgSet); response = responseMsgSet.ResponseList.GetAt(0); IORItemRetList itemRetList = (IORItemRetList)response.Detail; // Console.WriteLine($"ItemRetList.Count: {itemRetList.Count}"); IORItemRet itemRet = itemRetList.GetAt(0); WalkItemServiceRet(itemRet.ItemServiceRet); var ortype = itemRet.ortype; if (itemRet.ItemInventoryRet != null) { IItemInventoryRet itemInventoryRet = itemRet.ItemInventoryRet; var item = new Item { Name = itemInventoryRet.Name?.GetValue(), Description = itemInventoryRet.SalesDesc?.GetValue(), Rate = itemInventoryRet.SalesPrice?.GetValue(), ItemType = ortype.ToString(), QuickBooksID = itemInventoryRet.ListID?.GetValue(), EditSequence = itemInventoryRet.EditSequence?.GetValue() }; if (string.IsNullOrEmpty(item.Name)) { item.Name = itemInventoryRet.FullName?.GetValue(); } invoiceItem.Item = item; } else if (itemRet.ItemServiceRet != null) { IItemServiceRet itemServiceRet = itemRet.ItemServiceRet; var item = new Item { Name = itemServiceRet.Name.GetValue(), Description = itemServiceRet.ORSalesPurchase.SalesOrPurchase.Desc?.GetValue(), Rate = itemServiceRet.ORSalesPurchase.SalesOrPurchase.ORPrice.Price?.GetValue(), //ItemType = ItemType.Service, ItemType = ortype.ToString(), QuickBooksID = itemServiceRet.ListID?.GetValue(), EditSequence = itemServiceRet.EditSequence?.GetValue(), // FullName = itemServiceRet.ToString() }; if (string.IsNullOrEmpty(item.Name)) { item.Name = itemServiceRet.FullName?.GetValue(); } invoiceItem.Item = item; } else if (itemRet.ItemOtherChargeRet != null) { IItemOtherChargeRet itemOtherChargeRet = itemRet.ItemOtherChargeRet; var item = new Item { Name = itemOtherChargeRet.Name?.GetValue(), Description = itemOtherChargeRet.ORSalesPurchase.SalesOrPurchase.Desc?.GetValue(), Rate = itemOtherChargeRet.ORSalesPurchase.SalesOrPurchase.ORPrice.Price?.GetValue(), ItemType = ortype.ToString() }; if (string.IsNullOrEmpty(item.Name)) { item.Name = itemOtherChargeRet.FullName?.GetValue(); } invoiceItem.Item = item; } else if (itemRet.ItemNonInventoryRet != null) { IItemNonInventoryRet itemNonInventoryRet = itemRet.ItemNonInventoryRet; var item = new Item { Name = itemNonInventoryRet.Name?.GetValue(), Description = itemNonInventoryRet.ORSalesPurchase.SalesOrPurchase.Desc?.GetValue(), ItemType = ortype.ToString() }; if (string.IsNullOrEmpty(item.Name)) { item.Name = itemNonInventoryRet.FullName?.GetValue(); } invoiceItem.Item = item; } Console.WriteLine($"{invoiceItem.Item.FullName}\t{invoice.InvoiceNumber}\t{invoiceItem.Amount}\t{invoiceItem.Item.Description}"); invoice.InvoiceItems.Add(invoiceItem); } } } } invoices.Add(invoice); } } if (requestMsgSet != null) { Marshal.FinalReleaseComObject(requestMsgSet); } sessionManager.EndSession(); sessionBegun = false; sessionManager.CloseConnection(); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString() + "\nStack Trace: \n" + ex.StackTrace + "\nExiting the application"); if (requestMsgSet != null) { Marshal.FinalReleaseComObject(requestMsgSet); } if (sessionBegun) { sessionManager.EndSession(); sessionManager.CloseConnection(); } } return(invoices); }
public List <InventoryItem> getAllItems() { try { //Item Request IMsgSetRequest itemRequestset = _MySessionManager.CreateMsgSetRequest("US", 13, 0); IItemQuery itemQuery = itemRequestset.AppendItemQueryRq(); itemQuery.OwnerIDList.Add("0"); ////Get item codes from sales order and add to item request //for (int i = 0; i < SalesOrderItems.Count; ++i) //{ // IORSalesOrderLineRet SalesOrderItem = SalesOrderItems.GetAt(i); // itemQuery.ORListQuery.FullNameList.Add(SalesOrderItem.SalesOrderLineRet.ItemRef.FullName.GetValue()); //} //itemQuery.ORListQuery.FullNameList.Add("17531"); //itemQuery.ORListQuery.FullNameList.Add("17534"); //itemQuery.ORListQuery.FullNameList.Add("17535"); //itemQuery.ORListQuery.FullNameList.Add("17536"); //itemQuery.ORListQuery.FullNameList.Add("17537"); //itemQuery.ORListQuery.FullNameList.Add("17538"); //itemQuery.ORListQuery.FullNameList.Add("62231"); //itemQuery.ORListQuery.FullNameList.Add("12061"); IMsgSetResponse responseItemRq = _MySessionManager.DoRequests(itemRequestset); IResponseList itemResponseList = responseItemRq.ResponseList; IResponse itemResponse = itemResponseList.GetAt(0); ENResponseType responseType = (ENResponseType)itemResponse.Type.GetValue(); IORItemRetList QBItemList = (IORItemRetList)itemResponse.Detail; for (int i = 0; i <= QBItemList.Count - 1; i++) { InventoryItem item = new InventoryItem(); IDataExtRetList customFieldsList; if (QBItemList.GetAt(i).ItemNonInventoryRet != null) { IItemNonInventoryRet inventoryItem = QBItemList.GetAt(i).ItemNonInventoryRet; customFieldsList = QBItemList.GetAt(i).ItemNonInventoryRet.DataExtRetList; item.ListID = inventoryItem.ListID != null?inventoryItem.ListID.GetValue() : ""; item.ItemCode = inventoryItem.Name != null?inventoryItem.Name.GetValue() : ""; item.Description = inventoryItem.FullName.GetValue() != null?inventoryItem.FullName.GetValue() : ""; item.MPN = inventoryItem.ManufacturerPartNumber != null?inventoryItem.ManufacturerPartNumber.GetValue() : ""; } else if (QBItemList.GetAt(i).ItemInventoryRet != null) { IItemInventoryRet inventoryItem = QBItemList.GetAt(i).ItemInventoryRet; customFieldsList = QBItemList.GetAt(i).ItemInventoryRet.DataExtRetList; item.ListID = inventoryItem.ListID != null?inventoryItem.ListID.GetValue() : ""; item.ItemCode = inventoryItem.Name != null?inventoryItem.Name.GetValue() : ""; item.Description = inventoryItem.SalesDesc != null?inventoryItem.SalesDesc.GetValue() : ""; item.MPN = inventoryItem.ManufacturerPartNumber != null?inventoryItem.ManufacturerPartNumber.GetValue() : ""; item.Price = inventoryItem.SalesPrice.GetValue(); } else if (QBItemList.GetAt(i).ItemInventoryAssemblyRet != null) { IItemInventoryAssemblyRet inventoryItem = QBItemList.GetAt(i).ItemInventoryAssemblyRet; customFieldsList = QBItemList.GetAt(i).ItemInventoryAssemblyRet.DataExtRetList; item.ListID = inventoryItem.ListID != null?inventoryItem.ListID.GetValue() : ""; item.ItemCode = inventoryItem.Name != null?inventoryItem.Name.GetValue() : ""; item.Description = inventoryItem.SalesDesc.GetValue() != null?inventoryItem.SalesDesc.GetValue() : ""; item.MPN = inventoryItem.ManufacturerPartNumber != null?inventoryItem.ManufacturerPartNumber.GetValue() : ""; } else { customFieldsList = null; } //get item external data (custom fields) if (customFieldsList != null) { for (int iCustomField = 0; iCustomField <= customFieldsList.Count - 1; iCustomField++) { string fieldName = customFieldsList.GetAt(iCustomField).DataExtName.GetValue(); string fieldValue = customFieldsList.GetAt(iCustomField).DataExtValue.GetValue(); if (fieldName == "Inner") { item.Inner = fieldValue; } if (fieldName == "Case") { item.Case = fieldValue; } if (fieldName == "Price2") { item.Price2 = Convert.ToDouble(fieldValue); } if (fieldName == "Volume") { item.Volume = fieldValue; } if (fieldName == "Price3") { item.Price3 = Convert.ToDouble(fieldValue); } } } if (item.ItemCode != null) { _inventoryItems.Add(item); } } return(_inventoryItems); } catch (Exception) { throw new Exception("Failed to read Items from QuickBooks."); } }
public List <InventoryItem> UpdateItemUPCAndListID(List <InventoryItem> inventoryItems) { //Item Request IMsgSetRequest itemRequestset = _MySessionManager.CreateMsgSetRequest("US", 13, 0); IItemQuery itemQuery = itemRequestset.AppendItemQueryRq(); itemQuery.OwnerIDList.Add("0"); //Get item codes from sales order and add to item request foreach (InventoryItem item in inventoryItems) { itemQuery.ORListQuery.FullNameList.Add(item.ItemCode); } IMsgSetResponse responseItemRq = _MySessionManager.DoRequests(itemRequestset); IResponseList itemResponseList = responseItemRq.ResponseList; IResponse itemResponse = itemResponseList.GetAt(0); ENResponseType responseType = (ENResponseType)itemResponse.Type.GetValue(); IORItemRetList QBItemList = (IORItemRetList)itemResponse.Detail; for (int i = 0; i <= QBItemList.Count - 1; i++) { if (QBItemList.GetAt(i).ItemNonInventoryRet != null) { if (QBItemList.GetAt(i).ItemNonInventoryRet.Name != null) { string itemCode = QBItemList.GetAt(i).ItemNonInventoryRet.Name.GetValue(); if (QBItemList.GetAt(i).ItemNonInventoryRet.ManufacturerPartNumber != null) { inventoryItems.First(a => a.ItemCode == itemCode).MPN = QBItemList.GetAt(i).ItemNonInventoryRet.ManufacturerPartNumber.GetValue(); } if (QBItemList.GetAt(i).ItemNonInventoryRet.ListID != null) { inventoryItems.First(a => a.ItemCode == itemCode).ListID = QBItemList.GetAt(i).ItemNonInventoryRet.ListID.GetValue(); } } } if (QBItemList.GetAt(i).ItemInventoryRet != null) { IItemInventoryRet iInventory = QBItemList.GetAt(i).ItemInventoryRet; //get item external data (custom fields) //IDataExtRetList dataExtRetList = OR.GetAt(i).ItemInventoryRet.DataExtRetList; //if (dataExtRetList != null) //{ // Console.WriteLine(dataExtRetList.Count); // IDataExtRet dataExtRet = dataExtRetList.GetAt(0); // Console.WriteLine(dataExtRet.DataExtName.GetValue() + " === " + dataExtRet.DataExtValue.GetValue()); //} if (QBItemList.GetAt(i).ItemInventoryRet.Name != null) { string itemCode = QBItemList.GetAt(i).ItemInventoryRet.Name.GetValue(); if (QBItemList.GetAt(i).ItemInventoryRet.ManufacturerPartNumber != null) { inventoryItems.First(a => a.ItemCode == itemCode).MPN = QBItemList.GetAt(i).ItemInventoryRet.ManufacturerPartNumber.GetValue(); } if (QBItemList.GetAt(i).ItemInventoryRet.ListID != null) { inventoryItems.First(a => a.ItemCode == itemCode).ListID = QBItemList.GetAt(i).ItemInventoryRet.ListID.GetValue(); } } } if (QBItemList.GetAt(i).ItemInventoryAssemblyRet != null) { if (QBItemList.GetAt(i).ItemInventoryAssemblyRet.Name != null) { string itemCode = QBItemList.GetAt(i).ItemInventoryAssemblyRet.Name.GetValue(); if (QBItemList.GetAt(i).ItemInventoryAssemblyRet.ManufacturerPartNumber != null) { inventoryItems.First(a => a.ItemCode == itemCode).MPN = QBItemList.GetAt(i).ItemInventoryAssemblyRet.ManufacturerPartNumber.GetValue(); } if (QBItemList.GetAt(i).ItemInventoryAssemblyRet.ListID != null) { inventoryItems.First(a => a.ItemCode == itemCode).ListID = QBItemList.GetAt(i).ItemInventoryAssemblyRet.ListID.GetValue(); } } } //if (item.ItemCode != null) // _inventoryItems.Add(item); } return(inventoryItems); }
private void BuildItemInventoryAddRq(IMsgSetRequest requestMsgSet, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem) { //IItemInventoryAdd[] AdditemList = new IItemInventoryAdd[2]; IItemInventoryAdd ItemInventoryAddRq = requestMsgSet.AppendItemInventoryAddRq(); //Set field value for Name ItemInventoryAddRq.Name.SetValue(inventoryItem.Name.GetValue()); //"venky01" //Set field value for BarCodeValue //ItemInventoryAddRq.BarCode.BarCodeValue.SetValue("ab"); //Set field value for AssignEvenIfUsed //ItemInventoryAddRq.BarCode.AssignEvenIfUsed.SetValue(true); //Set field value for AllowOverride //ItemInventoryAddRq.BarCode.AllowOverride.SetValue(true); //Set field value for IsActive ItemInventoryAddRq.IsActive.SetValue(true); if (inventoryItem.ClassRef != null) { ////Set field value for ListID //ItemInventoryAddRq.ClassRef.ListID.SetValue("200000-1011023419"); ////Set field value for FullName //ItemInventoryAddRq.ClassRef.FullName.SetValue("ab"); } if (inventoryItem.ParentRef != null) { ////Set field value for ListID //ItemInventoryAddRq.ParentRef.ListID.SetValue("200000-1011023419"); ////Set field value for FullName //ItemInventoryAddRq.ParentRef.FullName.SetValue("ab"); } //Set field value for ManufacturerPartNumber ItemInventoryAddRq.ManufacturerPartNumber.SetValue(inventoryItem.ManufacturerPartNumber.GetValue()); if (inventoryItem.UnitOfMeasureSetRef != null) { //Set field value for ListID // ItemInventoryAddRq.UnitOfMeasureSetRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName //ItemInventoryAddRq.UnitOfMeasureSetRef.FullName.SetValue("ab"); } //Set field value for IsTaxIncluded //ItemInventoryAddRq.IsTaxIncluded.SetValue(true); if (inventoryItem.SalesTaxCodeRef != null) { //Set field value for ListID //ItemInventoryAddRq.SalesTaxCodeRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName // ItemInventoryAddRq.SalesTaxCodeRef.FullName.SetValue("ab"); } //Set field value for SalesDesc ItemInventoryAddRq.SalesDesc.SetValue(inventoryItem.SalesDesc.GetValue()); //Set field value for SalesPrice ItemInventoryAddRq.SalesPrice.SetValue(inventoryItem.SalesPrice.GetValue()); if (inventoryItem.IncomeAccountRef != null) { //Set field value for ListID ItemInventoryAddRq.IncomeAccountRef.ListID.SetValue(inventoryItem.IncomeAccountRef.ListID.GetValue()); //"80000008-1552559357" //Set field value for FullName ItemInventoryAddRq.IncomeAccountRef.FullName.SetValue(inventoryItem.IncomeAccountRef.FullName.GetValue()); } //Set field value for PurchaseDesc ItemInventoryAddRq.PurchaseDesc.SetValue(inventoryItem.PurchaseDesc.GetValue()); //Set field value for PurchaseCost ItemInventoryAddRq.PurchaseCost.SetValue(inventoryItem.PurchaseCost.GetValue()); //Set field value for ListID // ItemInventoryAddRq.PurchaseTaxCodeRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName // ItemInventoryAddRq.PurchaseTaxCodeRef.FullName.SetValue("ab"); if (inventoryItem.COGSAccountRef != null) { //Set field value for ListID ItemInventoryAddRq.COGSAccountRef.ListID.SetValue(inventoryItem.COGSAccountRef.ListID.GetValue()); //Set field value for FullName ItemInventoryAddRq.COGSAccountRef.FullName.SetValue(inventoryItem.COGSAccountRef.FullName.GetValue()); } if (inventoryItem.PrefVendorRef != null) { //Set field value for ListID ItemInventoryAddRq.PrefVendorRef.ListID.SetValue(inventoryItem.PrefVendorRef.ListID.GetValue()); //Set field value for FullName ItemInventoryAddRq.PrefVendorRef.FullName.SetValue(inventoryItem.PrefVendorRef.FullName.GetValue()); } if (inventoryItem.AssetAccountRef != null) { //Set field value for ListID ItemInventoryAddRq.AssetAccountRef.ListID.SetValue(inventoryItem.AssetAccountRef.ListID.GetValue()); //Set field value for FullName ItemInventoryAddRq.AssetAccountRef.FullName.SetValue(inventoryItem.AssetAccountRef.FullName.GetValue()); } //Set field value for ReorderPoint // ItemInventoryAddRq.ReorderPoint.SetValue(2); //Set field value for Max // ItemInventoryAddRq.Max.SetValue(2); //Set field value for QuantityOnHand ItemInventoryAddRq.QuantityOnHand.SetValue(inventoryItem.QuantityOnHand.GetValue()); //Set field value for TotalValue //ItemInventoryAddRq.TotalValue.SetValue(1500); //Set field value for InventoryDate //ItemInventoryAddRq.InventoryDate.SetValue(DateTime.Now); //ItemInventoryAddRq.InventoryDate.SetValue(DateTime.Parse("19-03-2019")); //Set field value for ExternalGUID //ItemInventoryAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); //Set field value for IncludeRetElementList //May create more than one of these if needed //ItemInventoryAddRq.IncludeRetElementList.Add("ab"); }
private void BuildInventoryAdjustmentAddRq(IMsgSetRequest requestMsgSet, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem) { IInventoryAdjustmentAdd InventoryAdjustmentAddRq = requestMsgSet.AppendInventoryAdjustmentAddRq(); //Set attributes //Set field value for defMacro InventoryAdjustmentAddRq.defMacro.SetValue("IQBStringType"); //Set field value for ListID InventoryAdjustmentAddRq.AccountRef.ListID.SetValue(inventoryItem.AssetAccountRef.ListID.GetValue());; //"80000022-1552565294" //Set field value for FullName InventoryAdjustmentAddRq.AccountRef.FullName.SetValue(inventoryItem.AssetAccountRef.FullName.GetValue()); //"Inventory Asset" //Set field value for TxnDate InventoryAdjustmentAddRq.TxnDate.SetValue(DateTime.Now); //"20-03-2019" //Set field value for RefNumber //InventoryAdjustmentAddRq.RefNumber.SetValue("ab"); //Set field value for ListID //InventoryAdjustmentAddRq.InventorySiteRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName //InventoryAdjustmentAddRq.InventorySiteRef.FullName.SetValue("ab"); //Set field value for ListID //InventoryAdjustmentAddRq.CustomerRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName //InventoryAdjustmentAddRq.CustomerRef.FullName.SetValue("ab"); //Set field value for ListID // InventoryAdjustmentAddRq.ClassRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName //InventoryAdjustmentAddRq.ClassRef.FullName.SetValue("ab"); //Set field value for Memo // InventoryAdjustmentAddRq.Memo.SetValue("ab"); //Set field value for ExternalGUID //InventoryAdjustmentAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); IInventoryAdjustmentLineAdd InventoryAdjustmentLineAdd10753 = InventoryAdjustmentAddRq.InventoryAdjustmentLineAddList.Append(); //Set field value for ListID InventoryAdjustmentLineAdd10753.ItemRef.ListID.SetValue(inventoryItem.ListID.GetValue()); //"8000000B-1553066645" Item List Id //Set field value for FullName InventoryAdjustmentLineAdd10753.ItemRef.FullName.SetValue(inventoryItem.FullName.GetValue()); //"venky04" Item Name string ORTypeAdjustmentElementType10754 = "QuantityAdjustment"; if (ORTypeAdjustmentElementType10754 == "QuantityAdjustment") { string ORQuantityAdjustmentElementType10755 = "NewQuantity"; if (ORQuantityAdjustmentElementType10755 == "NewQuantity") { //Set field value for NewQuantity InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORQuantityAdjustment.NewQuantity.SetValue(inventoryItem.QuantityOnHand.GetValue()); } //if (ORQuantityAdjustmentElementType10755 == "QuantityDifference") //{ // //Set field value for QuantityDifference // InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORQuantityAdjustment.QuantityDifference.SetValue(10); //} //string ORSerialLotNumberElementType10756 = "SerialNumber"; //if (ORSerialLotNumberElementType10756 == "SerialNumber") //{ // //Set field value for SerialNumber // InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORSerialLotNumber.SerialNumber.SetValue("12345"); //} //if (ORSerialLotNumberElementType10756 == "LotNumber") //{ // //Set field value for LotNumber // InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORSerialLotNumber.LotNumber.SetValue("ab"); //} ////Set field value for ListID //InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.InventorySiteLocationRef.ListID.SetValue("200000-1011023419"); ////Set field value for FullName //InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.InventorySiteLocationRef.FullName.SetValue("ab"); } if (ORTypeAdjustmentElementType10754 == "ValueAdjustment") { string ORQuantityAdjustmentElementType10757 = "NewQuantity"; if (ORQuantityAdjustmentElementType10757 == "NewQuantity") { //Set field value for NewQuantity InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORQuantityAdjustment.NewQuantity.SetValue(2); } if (ORQuantityAdjustmentElementType10757 == "QuantityDifference") { //Set field value for QuantityDifference InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORQuantityAdjustment.QuantityDifference.SetValue(2); } string ORValueAdjustmentElementType10758 = "NewValue"; if (ORValueAdjustmentElementType10758 == "NewValue") { //Set field value for NewValue InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORValueAdjustment.NewValue.SetValue(10.01); } if (ORValueAdjustmentElementType10758 == "ValueDifference") { //Set field value for ValueDifference InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORValueAdjustment.ValueDifference.SetValue(10.01); } } if (ORTypeAdjustmentElementType10754 == "SerialNumberAdjustment") { string ORSerialNumberAdjustmentElementType10759 = "AddSerialNumber"; if (ORSerialNumberAdjustmentElementType10759 == "AddSerialNumber") { //Set field value for AddSerialNumber InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.ORSerialNumberAdjustment.AddSerialNumber.SetValue("ab"); } if (ORSerialNumberAdjustmentElementType10759 == "RemoveSerialNumber") { //Set field value for RemoveSerialNumber InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.ORSerialNumberAdjustment.RemoveSerialNumber.SetValue("ab"); } //Set field value for ListID InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.InventorySiteLocationRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.InventorySiteLocationRef.FullName.SetValue("ab"); } if (ORTypeAdjustmentElementType10754 == "LotNumberAdjustment") { //Set field value for LotNumber InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.LotNumber.SetValue("ab"); //Set field value for CountAdjustment InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.CountAdjustment.SetValue(6); //Set field value for ListID InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.InventorySiteLocationRef.ListID.SetValue("200000-1011023419"); //Set field value for FullName InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.InventorySiteLocationRef.FullName.SetValue("ab"); } if (ORTypeAdjustmentElementType10754 == "") { } //Set field value for IncludeRetElementList //May create more than one of these if needed // InventoryAdjustmentAddRq.IncludeRetElementList.Add("ab"); }
public void CreatInventoryItem(QBSessionManager sessionManager, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem) { IMsgSetRequest requestMsgSet = null; QBSession QBMgr = null; try { QBMgr = new QBSession(); if (sessionManager == null) { QBMgr.CreateQBSession(out sessionManager); } if (sessionManager != null) { // Get the RequestMsgSet based on the correct QB Version IMsgSetRequest requestSet = QBMgr.getLatestMsgSetRequest(sessionManager); if (requestSet != null) { // Initialize the message set request object requestSet.Attributes.OnError = ENRqOnError.roeStop; BuildItemInventoryAddRq(requestSet, accountInfo, PreferencesRet, inventoryItem); // Do the request and get the response message set object IMsgSetResponse responseSet = sessionManager.DoRequests(requestSet); //WalkItemInventoryAddRs(responseSet); } } } catch (Exception ex) { } }
public QBResponceItem Inventoryadjustment(QBSessionManager sessionManager, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem) { QBResponceList qbResponceData = null; QBSession QBMgr = null; QBResponceItem _qbResponceItem = null; try { QBMgr = new QBSession(); if (sessionManager == null) { QBMgr.CreateQBSession(out sessionManager); } if (sessionManager != null && inventoryItem != null && accountInfo != null) { // Get the RequestMsgSet based on the correct QB Version IMsgSetRequest requestSet = QBMgr.getLatestMsgSetRequest(sessionManager); if (requestSet != null) { // Initialize the message set request object requestSet.Attributes.OnError = ENRqOnError.roeStop; BuildInventoryAdjustmentAddRq(requestSet, accountInfo, PreferencesRet, inventoryItem); // Uncomment the following to view and save the request and response XML //string requestXML = requestSet.ToXMLString(); //MessageBox.Show(requestXML); // Do the request and get the response message set object IMsgSetResponse responseSet = sessionManager.DoRequests(requestSet); //string responseXML = responseSet.ToXMLString(); //MessageBox.Show(responseXML); _qbResponceItem = WalkInventoryAdjustmentAddRs(responseSet); //Close the session and connection with QuickBooks //QBMgr.CloseQBConnection(sessionManager); } } } catch (Exception ex) { } return(_qbResponceItem); }