【问题标题】:How to add vendor bill payment in QB Desktop?如何在 QB Desktop 中添加供应商账单支付?
【发布时间】:2023-03-13 11:30:01
【问题描述】:

我是 QuickBooks 应用程序的新手,我正在将其集成到我的 C# 控制台应用程序中。 我需要使用 QBFC 库添加供应商账单支付,任何帮助或示例代码将不胜感激。

谢谢

【问题讨论】:

    标签: quickbooks vendor qbfc


    【解决方案1】:

    您可以对支票使用 BillPaymentCheckAdd 过程,对信用卡付款使用 BillPaymentCreditCardAdd 过程。您需要发送您想要将付款应用到的账单交易 ID 列表。下面是一种方法,假设您已经拥有收款人的 ListID(此处为 Vendor.ListID)、AP 账户、银行账户以及账单交易 ID。

        public class BillPayDetails
        {
            public string TxnId { get; set; }
            public double Amount { get; set; }
        }
    
        public IBillPaymentCheckRet InsertBillPayment(string PayeeListId, string APAccountListId, string BankAccountListId, DateTime TxnDate, List<BillPayDetails> BillsTxnIds)
        {
            var qbSsnMgr = new QBSessionManager(); 
             qbSsnMgr.OpenConnection("", "Your App Name");
             qbSsnMgr.BeginSession("Your_QB_File_Name", ENOpenMode.omDontCare);
            IMsgSetRequest rqMsgSet = qbSsnMgr.CreateMsgSetRequest("US", 13, 0);
            rqMsgSet.Attributes.OnError = ENRqOnError.roeStop;
            rqMsgSet.ClearRequests();
    
            IBillPaymentCheckAdd billPaymentCheckAdd = rqMsgSet.AppendBillPaymentCheckAddRq();
            billPaymentCheckAdd.PayeeEntityRef.ListID.SetValue(PayeeListId);
            billPaymentCheckAdd.APAccountRef.ListID.SetValue(APAccountListId);
            billPaymentCheckAdd.BankAccountRef.ListID.SetValue(BankAccountListId);
            billPaymentCheckAdd.TxnDate.SetValue(TxnDate); 
            foreach(var txn in BillsTxnIds)
            {
                var applyTo = billPaymentCheckAdd.AppliedToTxnAddList.Append();
                applyTo.TxnID.SetValue(txn.TxnId);
                applyTo.PaymentAmount.SetValue(txn.Amount); 
            }
    
            IMsgSetResponse rsMsgSet = qbSsnMgr.DoRequests(rqMsgSet);
            qbSsnMgr.EndSession();
            qbSsnMgr.CloseConnection();
            IResponse res = rsMsgSet.ResponseList.GetAt(0);
            if (res.StatusCode != 0 && res.StatusCode != 1)
                throw (new ApplicationException($"{res.StatusCode}-{res.StatusMessage}"));
            return res.Detail as IBillPaymentCheckRet;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-30
      • 1970-01-01
      • 2015-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-13
      相关资源
      最近更新 更多