cancel
Showing results for 
Search instead for 
Did you mean: 

How to get tax listing from invoice object

SOLVED

How to get tax listing from invoice object

Good Morning,

 

I am stuck here with the following problem:
For an invoice-object I need all tax-percentages, tax-amounts and
total without tax that were processed within this invoice

 

Eg:

20%, 5€, 25€

10%,5€,50€

0%,0€,100€

...

How can I achieve that? is there any documentation about the classes in Magento2?
For the moment it is just trial and error for me Smiley Sad

Tags (1)
4 REPLIES

Re: How to get tax listing from invoice object

Hello,

 

Hope you have invoice object

 

let's example your invoice object name is $invoice

 

echo $invoice->getTaxAmount();

above code for get Tax value from invoice

 

echo $invoice->getBaseGrandTotal();

above code get base total.

 

for percentage you will get from all invoice item.

 

Hope it will work for you.

 

If it will help you, then mark as solution

Re: How to get tax listing from invoice object

Hi, thanks.
So far so good, but my problem is, that we have different taxes for
different kinds of goods. So one invoice can contain different items with
different tax percentages.

Is there a way to get an array with tax percentages and totals for each tax
percentages?

Regards,
Gunther

Re: How to get tax listing from invoice object

Hello,

 

Let's example you have invoice item and object name for invoice item is $invoiceItem

 

echo $invoiceItem->getOrderItem()->getTaxPercent()

By above code you will get Percentage for specific item.

 

If it will work or help you then mark as solutionSmiley Happy

Re: How to get tax listing from invoice object

@kornblumenapo

 

is that work for you?