Good,

I have an XML of an invoice, in which there are several lines of invoice. Each line shows the tax that applies (type, source and percentage).

What I need is that in the table of total invoice, showing the sum of all lines in which the tax has been applied. Any ideas?

Thank you very much

XML Example

PHP Code:
...
<
line>
...
<
creditAmount>250.23</creditAmount>
<
tax>
<
taxType>IVA<taxType>
<
taxCode>NOR<taxCode>
<
taxPercentage>21<taxPercentage>
</
tax>
...
</
line>
<
line>
...
<
creditAmount>30.13</creditAmount>
<
tax>
<
taxType>IVA<taxType>
<
taxCode>NOR<taxCode>
<
taxPercentage>21<taxPercentage>
</
tax>
...
</
line>
<
line>
...
<
creditAmount>12.23</creditAmount>
<
tax>
<
taxType>IVA<taxType>
<
taxCode>HIG<taxCode>
<
taxPercentage>22<taxPercentage>
</
tax>
...
</
line>
... 
then the result of the total invoice table would be:

NOR VAT 21% -> 52.5483 + 6.3273 = 58.8756
HIG VAT 22% -> 2.6906