如何使用 php api 访问 Quickbooks 发票行项目 [英] How to access Quickbooks Invoice Line Items using php api
本文介绍了如何使用 php api 访问 Quickbooks 发票行项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 php api 访问 quickbooks 中发票的行项目,
am trying to access the line items of the invoice in quickbooks using php api,
这样我就可以对它进行一些操作.....
so that i could do some manipulations on it.....
当我这样做时,我能够获得发票数据...
am able to get the invoice data when i do this...
<?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如下
I can get invoice Id, customer Id respectivly as follows
<?php
pr($Invoice->getId());
pr($Invoice->getHeader()->getCustomerId());
?>
我的问题是如何获取订单项的数量并将其提取到普通数组中
我累了 pr($Invoice->getLine());
它没有给我整个数组,而只是该数组中的第一个项目...
I tired pr($Invoice->getLine());
it doesnt give me the whole array but just the 1st item in that array...
我发现很难做到这一点......
am finding it difficult to achieve this ....
推荐答案
$Invoice->getLine(0);
$Invoice->getLine(1);
$Invoice->getLine(2);
$Invoice->getLine(3);
etc.
或
$count = $Invoice->countLine();
for ($i = 0; $i < $count; $i++)
{
$Line = $Invoice->getLine($i);
}
这篇关于如何使用 php api 访问 Quickbooks 发票行项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文