Quickbooks PHP - qbXML mapping TransactionRet(Invoice) with



我正在开发一种基于QuickBooks发票的将发票存储到本地数据库中的rountine。

使用此 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>

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

物料上的哪个 xml 节点具有物料所属发票的 ID/信息?

有没有更好的qbXML?我已经尝试了从销售到日记条目的所有内容,如本网站所述:

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

如果您参考 QuickBooks OSR:

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

您将看到此选项:

<IncludeLineItems>true</IncludeLineItems>

有了这样的描述:

此筛选器允许您从查询响应中省略行项以获取 较小的结果。默认值为 false,因此订单项为 默认情况下省略。将"包括行项"设置为 true 以包含行项 在响应中,如果您不介意获得更大的结果。

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

$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;

最新更新