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

Wrong calculation of net price from TTC #9

Open
texnixe opened this issue Sep 24, 2017 · 1 comment
Open

Wrong calculation of net price from TTC #9

texnixe opened this issue Sep 24, 2017 · 1 comment

Comments

@texnixe
Copy link

texnixe commented Sep 24, 2017

Maybe I'm getting this all wrong, but there seems to be something wrong with the ht, tax etc. calculations:

Calculation of net price from ttc should be:

function cart_ht($ttc, $vat) {
	$ht = $ttc / (1   $vat/100);
	return $ht;
}

Calculation of vat value to be added to a net price (this is probably what you need in your plugin if tax is set to true, but then the product prices should be net prices, because this value is added when I click the Paypal submit button; even though the text says "TVA incluse"):

function cart_vat($net, $vat) {
	$tax = $net * $vat/100;
	return $tax;
}

Calculate amount of tax included in a given TTC price:

function cart_vat_incl ($ttc, $vat) {
  $ht = $ttc / (1   $vat/100);
  $tax_incl = $ttc - $ht;
  return $tax_incl;
}
@starckio
Copy link
Owner

Thank @texnixe,
Question for this:

function cart_vat($net, $vat) {
	$tax = $net * $vat/100;
	return $tax;
}

A net price is necessarily TTC no?
So why add a tax on a net price?

@starckio starckio assigned starckio and unassigned starckio Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants