如何使用QBFC按日期或SO编号搜索销售订单

时间:2015-05-07 10:17:41

标签: c# quickbooks qbfc

这是我的代码:

ISalesOrderQuery salesOrdersQueryRq = requestMsgSet.AppendSalesOrderQueryRq();

salesOrdersQueryRq.IncludeLineItems.SetValue(true);

IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

IResponse response = responseMsgSet.ResponseList.GetAt(0);

ISalesOrderRetList salesOrderRetList = (ISalesOrderRetList)response.Detail;

上面的代码获得所有销售订单,但我只需要从“日期”到“日期”获得销售订单,或者销售订单有SO编号=“SOnumber”,是否有任何建议?

1 个答案:

答案 0 :(得分:1)

您可以在执行查询时设置TxnFilter以限制响应。每种交易类型都有不同的过滤器可以设置,尽管很多都使用类似的过滤器。 OSR显示了每种交易类型可用的过滤器:https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html

ISalesOrderQuery salesOrdersQueryRq = reqeustMsgSet.AppendSalesOrderQueryRq();
salesOrderQueryRq.IncludeLineItems.SetValue(true);

// Use these lines for date range filter
salesOrdersQueryRq.ORTxnNoAccountQuery.TxnFilterNoAccount.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.FromTxnDate.SetValue(fromDate);
salesOrdersQueryRq.ORTxnNoAccountQuery.TxnFilterNoAccount.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.ToTxnDate.SetValue(toDate);

// Use these lines for reference number query
salesOrdersQueryRq.ORTxnNoAccountQuery.RefNumberList.Add(soNumber);

IMsgSetResponse responseMsgSet = SessionManager.DoRequests(requestMsgSet);