【发布时间】:2016-06-22 14:14:41
【问题描述】:
我有一个要求,我需要以编程方式/通过 c# 代码从 quickbooks 桌面(企业版)检索贷项通知单。
任何人都可以帮助我使用此代码/方法。
谢谢
【问题讨论】:
标签: c# quickbooks intuit-partner-platform intuit
我有一个要求,我需要以编程方式/通过 c# 代码从 quickbooks 桌面(企业版)检索贷项通知单。
任何人都可以帮助我使用此代码/方法。
谢谢
【问题讨论】:
标签: c# quickbooks intuit-partner-platform intuit
您需要使用 CreditMemoQuery。
请参阅屏幕参考指南 - http://developer-static.intuit.com/qbsdk-current/common/newosr/index.html 或查看其他请求的示例并进行修改。
https://developer.intuit.com/docs/0250_qb/0050_documentation/sample_code
【讨论】:
使用ICreditMemoQueryobject 从 QuickBooks 中检索贷项通知单列表。这是使用 QuickBooks SDK 13.0 检索贷项备忘录列表的示例 C# 代码:
using QBXMLRP2Lib;
using Interop.QBFC13;
public class SDKApp
{
private QBSessionManager sessionMgr;
public SDKApp()
{
// in the class constructor - sessionMgr is a member variable
sessionMgr = new QBSessionManager();
}
public void GetCreditMemoData()
{
// open connection and begin session before data fetch - intentionally skipped this code
IMsgSetRequest msgset = null;
ICreditMemoQuery creditMemoQuery = null;
try
{
// during data fetch
msgset = sessionMgr.CreateMsgSetRequest("US", 13, 0);
creditMemoQuery = msgset.AppendCreditMemoQueryRq();
creditMemoQuery.ORTxnQuery.TxnFilter.ORDateRangeFilter.ModifiedDateRangeFilter.FromModifiedDate.SetValue(new DateTime(2012, 3, 31), false); // you can apply filters too
IMsgSetResponse msgRes = sessionMgr.DoRequests(msgset);
IResponseList responseList = msgRes.ResponseList;
if (responseList.Count > 0)
{
IResponse response = responseList.GetAt(0);
ICreditMemoRetList creditMemoList = response.Detail as ICreditMemoRetList;
if (creditMemoList == null)
{
return;
}
for (int i = 0; i <= creditMemoList.Count - 1; i++)
{
ICreditMemoRet qbCreditMemo = creditMemoList.GetAt(i);
Console.WriteLine("Credit no.:" + qbCreditMemo.TxnNumber.GetValue() + " Customer:" + qbCreditMemo.CustomerRef.FullName.GetValue() + " Total:" + qbCreditMemo.TotalAmount.GetValue());
}
}
}
catch (Exception ex)
{
//handle exception here
}
finally
{
if (msgset != null)
{
Marshal.FinalReleaseComObject(msgset);
}
if (creditMemoQuery != null)
{
Marshal.FinalReleaseComObject(creditMemoQuery);
}
}
// end session and close connection after data fetch - intentionally skipped this code
}
}
希望这会有所帮助。
【讨论】: