Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prices including VAT support #6311

Closed
8 tasks
rdoursenaud opened this issue Jan 20, 2017 · 3 comments
Closed
8 tasks

Prices including VAT support #6311

rdoursenaud opened this issue Jan 20, 2017 · 3 comments
Assignees
Labels
Feature request This is a feature request

Comments

@rdoursenaud
Copy link
Contributor

rdoursenaud commented Jan 20, 2017

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
@rdoursenaud rdoursenaud added the Feature request This is a feature request label Jan 20, 2017
@rdoursenaud rdoursenaud self-assigned this Jan 20, 2017
@rdoursenaud rdoursenaud changed the title Document prices input with VAT Prices including VAT support Jan 20, 2017
@rdoursenaud
Copy link
Contributor Author

rdoursenaud commented Jan 20, 2017

I have a hard time finding a suitable place in Dolibarr UI for this rather global setting.
I'd prefer not to replicate the setting on each supported module.
I was thinking of "Setup > Display" for the input field setting but I don't think this is a good place for the printing setting.
Any ideas?

@github-actions
Copy link

github-actions bot commented Mar 4, 2020

This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.

@github-actions github-actions bot added the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Mar 4, 2020
@prietojc
Copy link
Contributor

prietojc commented Aug 12, 2020

Yes, it's old, but never too late. Thanks rdoursenaud by your explanation:

There seem to be early dirty work relying on an undocumented global constant $inputalsopricewithtax.

This issue seems to be usefull, by the way I did a small hook to add this feature:

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;
	}
    }
}

@github-actions github-actions bot removed the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request This is a feature request
Projects
None yet
Development

No branches or pull requests

2 participants