使用vb.net和QuickBooks 2015在QuickBooks中添加简单发票

时间:2015-03-27 05:07:32

标签: vb.net quickbooks

当我尝试将发票添加到QuickBooks中时,我得到了响应。#34;状态正常"但是我无法在QuickBooks中看到这些值。

Dim customerRet As ICustomerRet = customerRetList.GetAt(i)
                CustomerName = customerRet.Name.GetValue()
                QuickBooksID = customerRet.ListID.GetValue()
                requestMsgSet = sessionManager.CreateMsgSetRequest("US", 13, 0)
                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue
                Dim invoiceAddRq As IInvoiceAdd = requestMsgSet.AppendInvoiceAddRq()
                invoiceAddRq.CustomerRef.ListID.SetValue(customerRet.ListID.GetValue())
               invoiceAddRq.CustomerRef.FullName.SetValue(customerRet.FullName.GetValue())
                invoiceAddRq.RefNumber.SetValue(15)
                ' Add these lines to your request
                Dim invoiceLineAdd As IORInvoiceLineAdd = invoiceAddRq.ORInvoiceLineAddList.Append()

                invoiceLineAdd.InvoiceLineAdd.ItemRef.FullName.SetValue("Sales")
                ' invoiceLineAdd.InvoiceLineAdd.Amount.SetValue(1000)
                invoiceLineAdd.InvoiceLineAdd.Desc.SetValue("Test")
                invoiceLineAdd.InvoiceLineAdd.Quantity.SetValue(Convert.ToDouble(1))
                invoiceLineAdd.InvoiceLineAdd.ORRatePriceLevel.Rate.SetValue(Convert.ToDouble(10))
              invoiceLineAdd.InvoiceLineAdd.Amount.SetValue(Convert.ToDouble(1005))
                invoiceLineAdd.InvoiceLineAdd.ServiceDate.SetValue(DateTime.Now)
                Dim invoiceResponseMsgSet As IMsgSetResponse = sessionManager.DoRequests(requestMsgSet)
                Dim invoiceResponse As IResponse = invoiceResponseMsgSet.ResponseList.GetAt(0)
                Dim invoiceRet As IInvoiceRet = DirectCast(invoiceResponse.Detail, IInvoiceRet)

                Dim StatusMessage As String = response.StatusMessage
                Dim statusCode As Integer = response.StatusCode 

1 个答案:

答案 0 :(得分:0)

当您说您无法在QuickBooks中找到它时,您是如何搜索它的?有几条线显得多余或奇怪。

invoiceLineAdd.InvoiceLineAdd.Quantity.SetValue(Convert.ToDouble(1))
invoiceLineAdd.InvoiceLineAdd.ORRatePriceLevel.Rate.SetValue(Convert.ToDouble(10))
invoiceLineAdd.InvoiceLineAdd.Amount.SetValue(Convert.ToDouble(1005))

如果您输入数量和费率,QuickBooks将计算金额,或者如果您输入数量和金额,将计算费率。我不确定您的发票是什么样的,因为您的数量为1,费率为10(总计10.00美元),金额为1005美元(这将是1005美元的费率)。 / p>

您未设置发票的交易日期。 QuickBooks中的设置是使用今天的日期作为默认日期,或者使用上次使用的交易日期,因此可能是发票的日期与预期不同。

您的RefNum值似乎也是一个数字,但应该是一个字符串。我不知道VB会自动为你改变它。

如果您收到Status OK响应,请检查返回的值以查看它们是否与您发送的内容相匹配。我还建议做一个搜索