我正在编写代码,使用 QODBC 驱动程序将自定义应用程序中创建的发票导入到 QuickBooks 中。我的事情几乎可以正常工作,但是我遇到了添加实际发票记录的 INSERT 问题。我的整体代码基于 http://support.flexquarters.com/esupport/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=10726&nav=0,58,64。
在这种特殊情况下,InvoiceLine 表中的插入操作正常,但发票中的插入操作失败并出现以下错误:
[QODBC] 错误:3140 - 发票行中存在对 QuickBooks 项目“”的无效引用。
以下是我在本例中发送的 INSERT 命令:
INSERT INTO Invoice (CustomerRefListID, ARAccountRefFullName, TxnDate, RefNumber, TermsRefFullName, TemplateRefFullName, SalesRepRefListID, ClassRefListID)
VALUES ('80000855-1326914216', 'Receivables', {d '2012-01-17'}, '12-1005', '30 days', 'Customized Invoice', '30000-1034349330', '8F70000-912629594')
CustomerRefListID、SalesRepListID 和 ClassRefListID 的值都是通过查找相应的表来确定的。我还确认“条款”表中出现“30 天”。
生成此命令的代码的早期版本几天前正在使用不同的数据。它使用 SalesRepRefFullName 和 ClassRefFullName。由于本例失败,我修改了它,认为也许我可用的字符串并不总是与全名完全匹配。
欢迎任何建议。
添马舰
I'm working on code to import invoices created in a custom application into QuickBooks using the QODBC driver. I have things nearly working, but I'm running into a problem with the INSERT that adds the actual invoice record. My overall code is based on the model laid out at http://support.flexquarters.com/esupport/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=10726&nav=0,58,64.
In this particular case, the INSERTs into the InvoiceLine table are working, but the INSERT into Invoice fails with this error:
[QODBC] Error: 3140 - There is an invalid reference to QuickBooks Item "" in the Invoice line.
Here's the INSERT command that I'm sending in this case:
INSERT INTO Invoice (CustomerRefListID, ARAccountRefFullName, TxnDate, RefNumber, TermsRefFullName, TemplateRefFullName, SalesRepRefListID, ClassRefListID)
VALUES ('80000855-1326914216', 'Receivables', {d '2012-01-17'}, '12-1005', '30 days', 'Customized Invoice', '30000-1034349330', '8F70000-912629594')
The values for CustomerRefListID, SalesRepListID, and ClassRefListID are all determined by doing look-ups into the respective tables. I've also confirmed that '30 days' occurs in the Terms table.
An earlier version of the code that generates this command was working a few days ago with different data. It used SalesRepRefFullName and ClassRefFullName. I modified it because of the failure of this case, thinking that perhaps the strings I had available didn't always exactly match the fullnames.
Any suggestions welcomed.
Tamar
发布评论
评论(2)
解决了。事实证明,引用的项目位于其中一个行项目中,而不是发票本身。我没有注意到其中一个订单项中的 RefID 为空。
绝对不是有用的错误消息。
Solved it. It turned out that the Item referenced was in one of the line items, not the invoice itself. I'd missed noticing that a RefID in one of the line items was empty.
Definitely not a useful error message.
Quickbooks 中不存在项目。首先在 Quickbooks 中创建它,然后您才能在发票中引用它。
Item does not exist in Quickbooks . first create it in Quickbooks and only then you can reference it in invoice .