1

我正在使用 C# 连接 QuickBooks desktop 2013。我需要根据账单记录付款,但无法弄清楚它为什么不起作用。我当前的代码不断抛出 3120 的错误,说它找不到账单,即使账单对象在我的控制中是打开的。我已将 intuit 提供的 IDN Unified OSR 用于 BillPaymentCheckAdd 对象结构,但它们传入的“数据”只是随机的,对我实际需要作为值传入的内容没有帮助。所以我可以使用一些帮助。这是我的支付账单方法的代码:

            IBillPaymentCheckAdd paymentAdd = requestMsgSet.AppendBillPaymentCheckAddRq();
            paymentAdd.PayeeEntityRef.ListID.SetValue(vendorId);
            paymentAdd.TxnDate.SetValue(DateTime.Now);
            paymentAdd.BankAccountRef.ListID.SetValue(bankAccount.ListID.GetValue());
            paymentAdd.ORCheckPrint.IsToBePrinted.SetValue(true);
            paymentAdd.Memo.SetValue(bankAccount.Name.GetValue());

            IAppliedToTxnAdd appliedToTxnAdd = paymentAdd.AppliedToTxnAddList.Append();
            appliedToTxnAdd.TxnID.SetValue(bill.TxnID.GetValue());
            appliedToTxnAdd.PaymentAmount.SetValue((double)amount);

            ISetCredit setCredit = appliedToTxnAdd.SetCreditList.Append();
            setCredit.CreditTxnID.SetValue(bill.TxnID.GetValue());
            setCredit.AppliedAmount.SetValue((double)amount);
            paymentAdd.IncludeRetElementList.Add(bankAccount.Name.GetValue());

            IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
            IResponse response = responseMsgSet.ResponseList.GetAt(0);
            IBillPaymentCheckRet paymentRet = (IBillPaymentCheckRet)response.Detail;
4

1 回答 1

0

我认为你得到的错误是指 setCredit 部分。信用用于将先前的供应商信用应用于账单。您将 Bi​​ll TxnID 作为信用传递,但它是帐单交易,而不是信用交易,因此 QuickBooks 说它无法找到信用交​​易,因为它实际上并不存在。

如果您删除 ISetCredit 的 4 行部分,您的付款应该会正确进行。

于 2014-03-07T20:51:29.220 回答