不从快速簿的账单支付检查表中返回所有值


Not Returning all values from billpayment check table from Quickbooks?

我正在使用PHP Quickbooks开发工具包2.0。当我尝试从快速簿数据库中获取所有账单支付支票时,某些字段如BankAccountRefListID,BankAccountRefFullName等没有返回。

这是我的请求代码:-

function _quickbooks_billpaymentcheck_query_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
$xml = '<?xml version="1.0" encoding="utf-8"?>
    <?qbxml version="2.0"?>
    <QBXML>
        <QBXMLMsgsRq onError="stopOnError">
    <BillPaymentCheckQueryRq>
            </BillPaymentCheckQueryRq>  
        </QBXMLMsgsRq>
    </QBXML>';
return $xml;
} 

可能有什么问题?

您可以在http://stackoverflow.com/questions/28146720/fetching-all-bill-payment-check-from-quickbooks-database中查看我之前的问题

在这里,我描述了我的代码。

终于我找到了解决方案。问题是我从xml中得到了这样的共鸣:-

   <?xml version="1.0" ?>
   <QBXML>
<QBXMLMsgsRs>
<BillPaymentCheckQueryRs requestID="99" statusCode="0" statusSeverity="Info"  statusMessage="Status OK">
<BillPaymentCheckRet>
 <TxnID>49-1421654713</TxnID>
 <TimeCreated>2015-01-19T12:05:13+04:00</TimeCreated>
 <TimeModified>2015-01-19T12:05:13+04:00</TimeModified>
  <EditSequence>1421654713</EditSequence>
  <TxnNumber>18</TxnNumber>
  <PayeeEntityRef>
 <ListID>80000004-1421654642</ListID>
 <FullName>tobs</FullName>
  </PayeeEntityRef>
 <APAccountRef>
 <ListID>80000023-1418466302</ListID>
<FullName>Accounts Payable</FullName>
  </APAccountRef>
<TxnDate>2015-01-19</TxnDate>
<BankAccountRef>
<ListID>8000002D-1421653817</ListID>
<FullName>ENBD</FullName>
 </BankAccountRef>
 <Amount>2000.00</Amount>
 <RefNumber>123</RefNumber>
  <IsToBePrinted>false</IsToBePrinted>
  <AppliedToTxnRet>
 <TxnID>46-1421654678</TxnID>
  <TxnType>Bill</TxnType>
 <TxnDate>2015-01-19</TxnDate>
  <BalanceRemaining>0.00</BalanceRemaining>
  <Amount>2000.00</Amount>
  </AppliedToTxnRet>
   </BillPaymentCheckRet>
  </BillPaymentCheckQueryRs>
  </QBXMLMsgsRs>
  </QBXML>

所以在这个 xml 标签中是 . 的子级,所以我们必须像这样获取值:-

$BankAccountRefListID=$BillPaymentCheck->getChildDataAt('BillPaymentCheckRet BankAccountRef ListID');  

在这个函数中,我们必须像第一个主父级一样传递值,然后在空格子级之后传递值,最后传递属性。通过这样做,只有我们可以正确获取值。所以我的响应函数最终会像:-

    function _quickbooks_billpaymentcheck_query_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{   
       $Parser = new QuickBooks_XML_Parser($xml);
       $errnum = 0;
       $errmsg = '';
        if ($Doc = $Parser->parse($errnum, $errmsg))
        {
        $Root = $Doc->getRoot();
     $List = $Root->getChildAt('QBXML/QBXMLMsgsRs/BillPaymentCheckQueryRs');
    foreach ($List->children() as $BillPaymentCheck)
        {
$TxnDateMacro=$BillPaymentCheck->getChildDataAt('BillPaymentCheckRet TxnDateMacro');
 $BankAccountRefListID=$BillPaymentCheck->getChildDataAt('BillPaymentCheckRet BankAccountRef ListID');  
  $BankAccountRefFullName=$BillPaymentCheck->getChildDataAt('BillPaymentCheckRet BankAccountRef FullName');  
   }
     }
    return true;
 }