2014-05-21 72 views
0

在QuickBooks PHP API V3當前,我得到JournalEntries。但我無法獲取線路和線路詳細信息 - 我該如何做?閱讀JournalEntry行和詳細信息

$journalEntrys = $JournalEntryService->query($Context, $realm, "select * from JournalEntry WHERE TxnDate >= '" .$startDate ."' AND TxnDate <= '" .$endDate ."'"); 

//print_r($customers); 

foreach ($journalEntrys as $JournalEntry) 
{ 
    //NEED TO GET EACH LIKE AND EACH LINE DETAIL...HOW? 
    $line = new QuickBooks_IPP_Object_Line(); 
    $line = $JournalEntry->getLine(); 
    array_push($returnArray, array("id"=>str_replace("}", "", str_replace("{-", "", $JournalEntry->getId())),"txnDate"=>$JournalEntry->getTxnDate(),"lines"=>$line->getId(),"TotalAmt"=>$JournalEntry->getTotalAmt())); 
} 

回答

0

使用 「for」 循環通過線條看上去......

$num_lines = $JournalEntry->countLine(); // How many lines are there? 

for ($i = 0; $i < $num_lines; $i++) 
{ 
    $Line = $JournalEntry->getLine($i); // Get a line 
    print_r($Line); // Print out the line object 

    $details = $Line->getJournalEntryLineDetail(); // Get the details 
    print_r($details); // Print out the details 
}