【问题标题】:Retrive credit memo from quickbooks desktop through c# code通过 c# 代码从 quickbooks 桌面检索贷项通知单
【发布时间】:2016-06-22 14:14:41
【问题描述】:

我有一个要求,我需要以编程方式/通过 c# 代码从 quickbooks 桌面(企业版)检索贷项通知单。

任何人都可以帮助我使用此代码/方法。

谢谢

【问题讨论】:

    标签: c# quickbooks intuit-partner-platform intuit


    【解决方案1】:

    您需要使用 CreditMemoQuery。

    请参阅屏幕参考指南 - http://developer-static.intuit.com/qbsdk-current/common/newosr/index.html 或查看其他请求的示例并进行修改。

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

    【讨论】:

    • 我使用了上面提到的方式,但我只想从 Quickbooks 中检索所有贷项通知单。由于我是 quickbooks 集成的新手,我很难理解 CreditMemoQuery()。如果您帮助我提供相关代码以仅从 QB 检索贷项通知单,那就太好了。
    【解决方案2】:

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

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多