如何使用QuickBooks QBFC从发票中获取自定义模板字段
我想使用QuickBooks QBFC获取自定义S.O.发票模板字段。以下是如何从销售订单中读取自定义字段:如何使用QuickBooks QBFC从发票中获取自定义模板字段,quickbooks,qbfc,Quickbooks,Qbfc,我想使用QuickBooks QBFC获取自定义S.O.发票模板字段。以下是如何从销售订单中读取自定义字段: 将“0”添加到SalesOrderQuery的OwnerIDList 从附加到查询返回的SalesOrderRet对象的DataExtreList中读取自定义标题字段 从saleorderlineret和saleorderlinegrouptret对象中的DataExtRetList中读取自定义行项目字段,这些对象包含在每个saleorderret中(如果您正在读取行项目) 如果您已经在
SalesOrderQuery
的OwnerIDList
SalesOrderRet
对象的DataExtreList
中读取自定义标题字段saleorderlineret
和saleorderlinegrouptret
对象中的DataExtRetList
中读取自定义行项目字段,这些对象包含在每个saleorderret
中(如果您正在读取行项目)includeTelementList
,则必须将DataExtRet
添加到列表中;如果没有,则不要开始使用includeTelementList
,直到自定义字段工作。与任何事务查询一样,除非在请求中设置IncludeLineItems
标志,否则不会看到任何行项目数据
自定义字段在中有很好的文档记录。我建议您查看QBSDK程序员指南中的DataExt:使用自定义字段和私有数据部分。要详细说明Paul Keister的答案,您必须在查询中添加“0”的原因是,这是您试图检索的自定义字段的所有者ID。0可能是该值,但如果所有者ID不同,则必须在此处使用不同的值 一些示例C#代码:
//设置您试图取回的自定义字段的所有者id
IInvoiceQuery invoiceQuery=requestMsgSet.AppendInvoiceQueryRq();
invoiceQuery.OwnerIDList.Add(“0”);
//设置查询参数并实际调用您的查询。。。
//为每个发票调用此方法以获取其自定义字段(如果存在)
静态作废GetInvoiceCustomFields(IInvoiceRet发票)
{
if(invoice.DataExtRetList==null)
{
返回;
}
对于(int i=0;i
//set the owner id of the custom field you are trying to get back
IInvoiceQuery invoiceQuery = requestMsgSet.AppendInvoiceQueryRq();
invoiceQuery.OwnerIDList.Add("0");
//set up query parameters and actually call your query...
//call this method for each invoice to get its custom fields (if they exist)
static void GetInvoiceCustomFields(IInvoiceRet invoice)
{
if (invoice.DataExtRetList == null)
{
return;
}
for (int i = 0; i < invoice.DataExtRetList.Count; i++)
{
IDataExtRet extData = invoice.DataExtRetList.GetAt(i);
Console.WriteLine("external data name: " + extData.DataExtName.GetValue());
Console.WriteLine("external data value: " + extData.DataExtValue.GetValue());
}
}