Subtotal Tax Value - Need Computed Field Formula/Code?

I have created Complementary attributes (lines) for the Invoice Module, I’m trying to get a column with each line item’s subtotal tax value. I have tried the following formula but I’m getting the wrong values.

I just need a column with Tax Value = Total (inc. tax) - Total (excl.)

But when I use the following code, I’m not getting the right results

round($object->total_ttc - $object->total_ht, 2)

Here is the result of the PDF being created using this code.

I tried using print_r($objectoffield) and got the objectoffield output. but I still am not able to get the forumla right.

I think it needs to be captured by total_localtax1 and total_localtax2

Found the solution, it was very simple.

Create Complementary attributes (lines) with following values and formula code:

$objectoffield->total_tva+$objectoffield->total_localtax1+$objectoffield->total_localtax2

This is how it would look like on the PDF

1 Like

how are getting the amount in words in Indian format?

and also i am seeing ur doing roundoff is it also calculated automatically if so how is that

Hello,

Most probably on Setup → Limits and accuracy

2 Likes

Yes I’m using Number Word Module for my PDF template.

But I’m not using any Roundoff logic. The line that you see is a discount line item used to have a round off behavior.

Even I am trying to find the right method for automatic round off for my invoice. Limits and Accuracy didn’t work for me the way I need it or maybe I couldn’t configure it right… But I’m open hear the right way to achieve this.

1 Like

I have updated my formula to include total_tva, considering if you are using all 3 layers of taxes which is applicable for India region (IGST, CGST, SGST)