문제

I am using C# to connect with QuickBooks desktop 2013. I need to record payments against a bill, but cannot figure out why it is not working. My current code keeps throwing an error of 3120 saying it can't find the bill, even though the bill object is open in my control. I've used the IDN Unified OSR provided by intuit for the BillPaymentCheckAdd object structure, but the "data" they pass in is just random and not helpful for what I actually need to pass in as values. So I could use some help. Here is my code for the pay bill method:

            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;
도움이 되었습니까?

해결책

I think the error that you are getting is referring to the setCredit section. The credits are used to apply a previous vendor credit to a bill. You are passing in the Bill TxnID as the credit, but it's a bill transaction, not a credit transaction so QuickBooks is saying it can't find the credit transaction as it doesn't really exist.

If you remove the 4 line section for the ISetCredit, your payment should go through correctly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top