Unit Price (inclusive of VAT) in invoice ODT

Hello All,
I would like to request for a help for how to include unit price (INCLUSIVE of VAT) in ODT template. We are using {line_up}. Any help would be really appreciated. We tried to creating substitution as well, but the value of globa variables are not accessible inside PHP functions.

function mymodule_completesubstitutionarray_lines(&$substitutionarray,$langs,$object,$line)
{
global $conf,$db;
$a = floatval(line_price_ttc_local) * 1.12;
$b = floatval(line_qty);

$myvalue = line_qty;
$substitutionarray[‘myowntag’]=$myvalue;
}

Thanks in advance for any help.

In your ODT file you can put {total_ttc} In the place that you want

Thanks for your reply, but there is no tag available as {total_ttc}.

The one tag which is similar to this is {object_total_ttc} but that provides us the total of invoice. What we need is unit price per item inclusive of 12% vat.

Pièces jointes :

Ok, then, play with this.
{object_total_ht}+{object_total_vat}

I hope this help you.

regards.

Sorry, try with this tags please.

{line_up}+{line_vatrate}

1 Like

Thanks but, it still does not solve the issue. The output is 178.57+12% instead of 199.99

The closest possible output could be {line_price_ttc_locale} / {line_qty} as it also includes the reduction, but in output odt it shows the value as it is without any calcluations :unhappy:

Ok, let me do some tests and I’ll tell you how it’s done, because if there are possibilities to do it. 2 years ago I did something similar, but I do not remember very well. I will make tests and tell you.

1 Like

Thank you, will wait for your findings. :happy:

Line totals including vat are the only available options. {object_total_vat} and {object_total_vat_locale}

The complete list of tags are located here.
https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template

You’ll probably want to read Other personalized tags and do something like custom_unit_object_total=object_total_vat_locale/line_qty

Thanks,

I tried the suggested approach and create a function.

function mymodule_completesubstitutionarray_lines(&$substitutionarray,$langs,$object,$line)
{
global $conf,$db;
$a = floatval(line_price_ttc_local) * 1.12;
$b = floatval(line_qty);

$myvalue =a/b;
$substitutionarray=$myvalue;
}

but the issue is in function I am not able to get the value of tags, (line_qty); (line_price_ttc_local). The value listed there is zero.

Thanks in advance for any help.

Hello,

anybody able to post a link for the template including the unit prices vat inc?

thanks so much
Albrecht