2016-06-14 53 views

回答

0

您將需要使用CreditMemoQuery。

請參閱屏幕參考指南 - http://developer-static.intuit.com/qbsdk-current/common/newosr/index.html或查看其他請求的樣本並對其進行修改。

https://developer.intuit.com/docs/0250_qb/0050_documentation/sample_code

+0

我用上面提到的方式,但我只想從Quickbooks中檢索所有的貸項通知單。因爲我是quickbooks集成的新手,所以我很難理解CreditMemoQuery()。如果您使用相關代碼幫助我僅從QB中檢索貸項憑證,那將非常棒。 – Shyam

0

使用ICreditMemoQuery對象檢索從QuickBooks信用記錄表。下面是一個示例C#代碼來獲取信用記錄表使用QuickBooks的SDK 13.0:

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 
    } 
} 

希望這有助於。