我正在使用PHP Quickbooks dev kit 2.0。当我尝试从quickbooks db中获取所有账单支付支票时,不会返回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
我在这里描述了我的代码。
答案 0 :(得分:0)
最后我得到了解决方案。问题是我得到了像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;
}