我正在尝试使用 php api 在快速手册中访问发票的行项目,
这样我就可以对其进行一些操作.....
当我这样做时,我能够获取发票数据......
<?php
$Invoice = $InvoiceService->findById($Context, $realmID, $InvoiceID);
pr($Invoice);
?>
结果如下
QuickBooks_IPP_Object_Invoice Object
(
[_data:protected] => Array
(
[Id] => Array
(
[0] => {QBO-52}
)
[SyncToken] => Array
(
[0] => 13
)
[MetaData] => Array
(
[0] => QuickBooks_IPP_Object_MetaData Object
(
[_data:protected] => Array
(
[CreateTime] => Array
(
[0] => 2013-04-02T02:55:30-07:00
)
[LastUpdatedTime] => Array
(
[0] => 2013-04-03T04:15:53-07:00
)
)
)
)
[Header] => Array
(
[0] => QuickBooks_IPP_Object_Header Object
(
[_data:protected] => Array
(
[TxnDate] => Array
(
[0] => 2013-03-31-07:00
)
[Msg] => Array
(
[0] => Customer Message update via QB++
)
[CustomerId] => Array
(
[0] => {QBO-35}
)
[SubTotalAmt] => Array
(
[0] => 15.00
)
[TotalAmt] => Array
(
[0] => 15.00
)
[ToBePrinted] => Array
(
[0] => false
)
[ToBeEmailed] => Array
(
[0] => false
)
[DueDate] => Array
(
[0] => 2013-04-29-07:00
)
[BillAddr] => Array
(
[0] => QuickBooks_IPP_Object_BillAddr Object
(
[_data:protected] => Array
(
[Line1] => Array
(
[0] => Jeffery
)
[Line2] => Array
(
[0] => Ads India
)
[Line3] => Array
(
[0] => Jeffery trading Co Ltd
)
[Line4] => Array
(
[0] => Cochin
)
[Line5] => Array
(
[0] => Kerala
India
)
[GeoCode] => Array
(
[0] => INVALID
)
)
)
)
[ShipAddr] => Array
(
[0] => QuickBooks_IPP_Object_ShipAddr Object
(
[_data:protected] => Array
(
[Line1] => Array
(
[0] => Jeffery
)
[Line2] => Array
(
[0] => Jeffery trading Co Ltd\\nJeffery traders\\nCochin\\nIndia
)
[Line3] => Array
(
[0] => Jeffery
)
[Line4] => Array
(
[0] => 0484232425
)
[PostalCode] => Array
(
[0] => 0
)
[GeoCode] => Array
(
[0] => INVALID
)
[Tag] => Array
(
[0] => CUSTOMER
)
)
)
)
[ShipMethodId] => Array
(
[0] => {QBO-}
)
[Balance] => Array
(
[0] => 15.00
)
[DiscountTaxable] => Array
(
[0] => true
)
)
)
)
[Line] => Array
(
[0] => QuickBooks_IPP_Object_Line Object
(
[_data:protected] => Array
(
[Desc] => Array
(
[0] => TES15++
)
[Amount] => Array
(
[0] => 15.00
)
[Taxable] => Array
(
[0] => false
)
[ItemId] => Array
(
[0] => {QBO-30}
)
)
)
[1] => QuickBooks_IPP_Object_Line Object
(
[_data:protected] => Array
(
[Amount] => Array
(
[0] => 0.00
)
[Taxable] => Array
(
[0] => false
)
[ItemId] => Array
(
[0] => {QBO-21}
)
)
)
)
)
)
我可以分别获取发票 ID,客户 ID,如下所示
<?php
pr($Invoice->getId());
pr($Invoice->getHeader()->getCustomerId());
?>
我的问题是如何获取行项目的数量并将其提取到普通数组中
我厌倦了pr($Invoice->getLine());
它并没有给我整个数组,而只是该数组中的第一项...
我发现很难做到这一点......