Quickbooks PHP - qbXML 映射 TransactionRet(Invoice) 与 ItemServiceRet

Quickbooks PHP - qbXML mapping TransactionRet(Invoice) with ItemServiceRet

我正在开发一个例程,以根据 QuickBooks 发票将发票存储到本地数据库中。

使用此 qbXML 请求:

$xml ='<?xml version="1.0" encoding="utf-8"?>
        <?qbxml version="8.0"?>
        <QBXML>
          <QBXMLMsgsRq onError="stopOnError">
            <InvoiceQueryRq requestID="'.$requestID.'">
            </InvoiceQueryRq>
          </QBXMLMsgsRq>
        </QBXML>';
return $xml;

我得到了我想要的结果,示例数据:

<InvoiceRet>
<TxnID>11-1428375941</TxnID>
<TimeCreated>2015-04-06T23:05:41-05:00</TimeCreated>
<TimeModified>2015-04-06T23:05:41-05:00</TimeModified>
<EditSequence>1428375941</EditSequence>
<TxnNumber>5</TxnNumber>
<CustomerRef>
    <ListID>8000005A-1424374192</ListID>
    <FullName>Fake</FullName>
</CustomerRef>
<ARAccountRef>
    <ListID>80000010-1424374182</ListID>
    <FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TemplateRef>
    <ListID>8000000B-1424373504</ListID>
    <FullName>Time &amp; Expense Invoice</FullName>
</TemplateRef>
<TxnDate>2015-04-06</TxnDate>
<RefNumber>3</RefNumber>
<BillAddress>
    <Addr1>Fake </Addr1>
    <Addr2>Fake Address</Addr2>
    <City>Fake City</City>
    <State>ON</State>
    <PostalCode>123 ABC</PostalCode>
</BillAddress>
<BillAddressBlock>
    <Addr1>Fake Address</Addr1>
    <Addr2>Fake Address</Addr2>
    <Addr3>Fake Address</Addr3>
</BillAddressBlock>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<TermsRef>
    <ListID>80000006-1424373984</ListID>
    <FullName>Net 30</FullName>
</TermsRef>
<DueDate>2015-05-06</DueDate>
<ShipDate>2015-04-06</ShipDate>
<Subtotal>1299.00</Subtotal>
<SalesTaxPercentage>13.00</SalesTaxPercentage>
<SalesTaxTotal>168.87</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>1467.87</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<IsToBeEmailed>false</IsToBeEmailed>
<IsTaxIncluded>false</IsTaxIncluded>
<CustomerSalesTaxCodeRef>
    <ListID>80000006-1424373984</ListID>
    <FullName>H</FullName>
</CustomerSalesTaxCodeRef>

我想查看这张发票中有哪些项目。所以我 运行 xml 得到所有物品。 我得到的例子:

    <ItemServiceRet>
    <ListID>80000021-1424374186</ListID>
    <TimeCreated>2015-02-19T14:29:46-05:00</TimeCreated>
    <TimeModified>2015-02-19T14:29:46-05:00</TimeModified>
    <EditSequence>1424374186</EditSequence>
    <Name>Prep. of Electrical Drawing</Name>
    <FullName>Prep. of Electrical Drawing</FullName>
    <IsActive>true</IsActive>
    <Sublevel>0</Sublevel>
    <IsTaxIncluded>false</IsTaxIncluded>
    <SalesTaxCodeRef>
        <ListID>80000006-1424373984</ListID>
        <FullName>H</FullName>
    </SalesTaxCodeRef>
    <SalesOrPurchase>
        <Desc>For preparation of electrical drawings</Desc>
        <Price>0.00</Price>
        <AccountRef>
            <ListID>80000034-1424374183</ListID>
            <FullName>Engineering Revenue</FullName>
        </AccountRef>
    </SalesOrPurchase>
</ItemServiceRet>

我已经尝试了很长时间,但我找不到任何可用于 link 项目到正确发票的变量。

项目的哪个 xml 节点在该项目所属的发票上有 Id/information?

是否有更好的 qbXML?我已经尝试了从销售到 JournalEntry 的所有方法,如本网站所述:

http://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html

如果您参考 QuickBooks OSR:

您会看到这个选项:

<IncludeLineItems>true</IncludeLineItems>

有了这个描述:

This filter allows you to omit line items from a query response to get a smaller result. The default value is false, so line items are omitted by default. Set IncludeLineItems to true to include line items in the response if you dont mind getting a larger result.

因此,如果您需要订单项,请将您的请求更改为:

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