# Display prices with VAT during invoice (proposal, order) creation

**URL:** <https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265>\
**Category:** Financial modules\
**Created:** [September 29, 2021, 8:51am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265 "2021-09-29T08:51:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpb](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/c/db5fbb/32.png) [@cpb](https://www.dolibarr.org/forum/u/cpb)\
**Post date:** [September 29, 2021, 8:51am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/1 "2021-09-29T08:51:38Z")

</div>

Dear all,

could you pinpoint me in a direction where I potentially could see the following information in the invoice (proposal, order) module (prices WITH VAT). I would be very happy to modify the ledger on my own - but I just do not know where to start?

Background is, that I work with final customers in a store and they ask me - what does the article XYZ cost (and they want to know what to pay WITH VAT). I have either to enter the article and then open the PDF or I have to use a calculator (which is also annoying).

 ![price inc. VAT](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/6/68a9bb47626ab1b1d477b8396aaef8b5dcd90455.png)

Especially stressful is the procedure, while having a customer on the phone negotiating prices. I would say - the final price is e.g. 15.00 (instead of 16.85) and then I have to calculate while the customer jumps to next position.

I highly appreciate your help.  
Best regards, Chris

---

<div class="post-metadata">

**Author:** ![cpb](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/c/db5fbb/32.png) [@cpb](https://www.dolibarr.org/forum/u/cpb)\
**Post date:** [September 29, 2021, 8:58am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/2 "2021-09-29T08:58:56Z")

</div>

I found the following code snippet:

> <https://github.com/Dolibarr/dolibarr/issues/6311>
>
> \# Feature Request
> Fully implement entering unit prices with or without VAT for …each and every document type Dolibarr supports.
> 
> \## Use case
> Many businesses "think" their prices including VAT. Especially in the B2C realm. Allowing them to enter, review and display (print) prices including VAT saves the hassle of converting back and forth for both the user and the customer.
> 
> \## Suggested implementation
> There seem to be early dirty work relying on an undocumented global constant \`\`\`$inputalsopricewithtax\`\`\`.
> Scrap it completely in favor of a better design relying on runtime configurable flags.
> Make sure values are computed correctly in the unused field. The value excluding VAT remains the reliable one we use for further computations so there should not be any unforeseen side-effects.
> 
> \## Suggested steps
> \- \[\] Find a suitable place for adding a global setting to optionally add:
> - \[\] Input unit prices including VAT
> - \[\] Print unit prices including VAT
> \- \[\] Implement such settings
> \- \[\] Dynamically compute and display the other field's unit price (JavaScript).
> \- \[\] Implement printing unit prices including VAT on:
> - \[\] PDF documents
> - \[\] ODF documents

Where would I add this code (hook)?

```auto
function doActions($parameters, $object, $action) 
{ 
    global $conf,$langs, $db, $user;
		
    if($parameters['currentcontext']=='propalcard' || $parameters['currentcontext']=='ordercard' || $parameters['currentcontext']=='invoicecard')
    {
	global $inputalsopricewithtax;
	$inputalsopricewithtax=1;
	$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
	if(($action=='addline' || $action=='updateline') && $pu_ttc!=0)
        {
	        $tva_tx = GETPOST('tva_tx');
		$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
		$_POST["price_ht"]=$pu_ht;
	}
    }
}

```

---

<div class="post-metadata">

**Author:** ![pcbleu](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/pcbleu/32/3120_2.png) [@pcbleu](https://www.dolibarr.org/forum/u/pcbleu)\
**Post date:** [September 29, 2021, 9:56am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/3 "2021-09-29T09:56:37Z")

</div>

Hey

you can try this plugin : [Input tax line](https://www.dolistore.com/en/modules/1416-Input-tax-line.html)  
with this link : [Login @ 13.0.0](https://zsaelle.ovh/demo/)

Good continuation

---

<div class="post-metadata">

**Author:** ![altatof](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/altatof/32/2426_2.png) [@altatof](https://www.dolibarr.org/forum/u/altatof)\
**Post date:** [October 13, 2021, 4:38pm UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/4 "2021-10-13T16:38:17Z")

</div>

the dolitools module also propose this feature : [Dolitools](https://www.dolistore.com/en/modules/1199-Dolitools.html)

---

<div class="post-metadata">

**Author:** ![madriano](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@madriano](https://www.dolibarr.org/forum/u/madriano)\
**Post date:** [September 28, 2022, 7:47am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/5 "2022-09-28T07:47:32Z")

</div>

Hi. Good day. I hope you’ve received my message. I would like to know if the Dolitools will going to generate/ change all the reports on Dolibarr where all prices are VAT inccluded.

---

<div class="post-metadata">

**Author:** ![vincentb](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/v/3be4f8/32.png) [@vincentb](https://www.dolibarr.org/forum/u/vincentb)\
**Post date:** [April 20, 2024, 7:49am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/6 "2024-04-20T07:49:58Z")

</div>

Good question !  
Am noob but a hook is a function

Yes you can buy a module/plugin or you can learn (and be free)  
Tuto/Wiki ;

- Système de Hooks - Dolibarr ERP CRM Wiki  
[Système de Hooks - Dolibarr ERP CRM Wiki](https://wiki.dolibarr.org/index.php?title=Syst%C3%A8me_de_Hooks)
- Hooks system - Dolibarr ERP CRM Wiki  
[Hooks system - Dolibarr ERP CRM Wiki](https://wiki.dolibarr.org/index.php?title=Hooks_system)  
. . .

for me, I just want to see VAT in pdf so I do…  
in `core/lib/pdf.lib.php` you can find `pdf_getlineupwithtax()`  
so, in `core/modules/facture/doc/pdf_crabe.modules.php` I insert sometihing like this (after `posxqty`)

```php
$pu_ht = pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails);|
$pdf->SetXY($this->postax, $curY);
$pdf->MultiCell($this->posxqty - $this->postax - 0.8, 3, $pu_ht, 0, 'R', 0);|

```

(+plus doing the positioning manualy… littel bit complexe)

I know a hook doing it during invoice creation, adding it to database and interfaces… So maybe you can purchase [Input tax line](https://www.dolistore.com/en/modules/1677-Input-tax-line.html) I dont test it, maybe it’s a winning time…

---

<div class="post-metadata">

**Author:** ![sonikf](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@sonikf](https://www.dolibarr.org/forum/u/sonikf)\
**Post date:** [April 21, 2024, 5:01pm UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/7 "2024-04-21T17:01:02Z")

</div>

Hi @vincentb  
Nice work there but you should change pu\_ht with pu\_ttc in this case because in Dolibarr codebase pu\_ht is unit price without taxes and pu\_ttc is unit price with taxes

---

<div class="post-metadata">

**Author:** ![vincentb](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/v/3be4f8/32.png) [@vincentb](https://www.dolibarr.org/forum/u/vincentb)\
**Post date:** [July 26, 2024, 10:39am UTC](https://www.dolibarr.org/forum/t/display-prices-with-vat-during-invoice-proposal-order-creation/21265/8 "2024-07-26T10:39:04Z")

</div>

Thanks  
You see the bug/problem before I find it this days  
I will fix it !
