如何使用quickbooks QBXML InvoiceQueryRq查询多张发票?

时间:2017-10-21 20:18:23

标签: php quickbooks qbxml

我使用PHP生成QBXML来查询quickbooks以查找发票记录。这很有效。但是,现在我想查询两个不同的发票RefNumbers。

这是我查询一张发票的当前代码:

$qbxml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
         <InvoiceQueryRq requestID="' . $requestID . '">
          <RefNumber>' . $ID . '</RefNumber>
          <IncludeLineItems>true</IncludeLineItems>
        </InvoiceQueryRq>
    </QBXMLMsgsRq>
</QBXML>';  

如何格式化以搜索RefNumber = $ ID或RefNumber = $ ID2?

1 个答案:

答案 0 :(得分:1)

如果您参考QuickBooks OSR文档:

https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html

您可以看到RefNumber被记录为:

<RefNumber >STRTYPE</RefNumber> <!-- optional, may repeat -->

关键词:

may repeat

所以:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="11.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
         <InvoiceQueryRq requestID="abc1234">
          <RefNumber>1</RefNumber>
          <RefNumber>2</RefNumber>
          <RefNumber>3</RefNumber>
          <IncludeLineItems>true</IncludeLineItems>
        </InvoiceQueryRq>
    </QBXMLMsgsRq>
</QBXML>

旁注,qbXML版本2.0来自QuickBooks 2003(例如14岁以上),因此您可能希望将其提升到更新的位置:

<?qbxml version="2.0"?>