I can't post the whole procedure here because it would be to confusing. What I am trying to do is calculating VAT. To do that I need to multiply Share
with 0,25.
select.....
(SALES_PRICE * 0.8) as Revenue,
(SALES_PRICE * 0.8 * 1-u.discount) as Share,
(SALES_PRICE * 0.8 * 1-u.discount) * 0.25 as VAT,
(SALES_PRICE * 0.8 * 1-u.discount) + (isa.SALES_PRICE * 0.8 * (1-u.discount) * (0.25)) as Total
Edit: Got some great help and ended up with correct calculations and formatting. Here is the result:
CONVERT(DECIMAL(30, 2), ( sales_price * 0.8 ))
AS Revenue,
CONVERT(DECIMAL(30, 2), ( sales_price * 0.8 * 1 - u.discount ))
AS Share,
CONVERT(DECIMAL(30, 2), ( sales_price * 0.8 * 1 - u.discount ) * 0.25)
AS VAT,
CONVERT(DECIMAL(30, 2), ( sales_price * 0.8 * 1 - u.discount ) * 1.25)
AS Total
You need to use .
as decimal separator for 0.25
:
(SALES_PRICE * 0.8 * (1-u.discount) * 0.25) as VAT
To get only 2 decimal places, you can do CONVERT(DECIMAL(30,2), yourvalue)
.
To get the total, just multiply by 1.25 (SALES_PRICE * 0.8 * (1-u.discount) * 1.25)