Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In our database all products sold have a price, cost, units and VAT amount.
The VAT amount is the total VAT amount for all units sold for that certain product.
Now I wanna add the right portion of VAT in the load script. Is it possible to add this in a load statement?
I wanna calculate the VAT percentage and the add that to both price and cost.
I want to do something like this (written in c# as an example):
If (VatAmount > 0) {
var vatPercentage = ((VatAmount / Units) / Price) + 1; //Get VAT percentage
Price = Price * vatPercentage;
Cost = Cost * vatPercentage;
}
Product:
LOAD
Code,
Description,
VatAmount,
Units,
Price,
Cost;
May be this
Product:
LOAD *,
Price * vatPercentage as New_Price,
Cost * vatPercentage as New_Cost;
LOAD *,
((VatAmount / Units) / Price) + 1 as vatPercentage;
LOAD
Code,
Description,
VatAmount,
Units,
Price,
Cost;
Hi,
Product:
LOAD
Code,
Description,
VatAmount,
if(VatAmount>0, ((VatAmount / Units) / Price) + 1,1) as vatPercentage,
Price * vatPercentage as Final_VAT_amount,
Cost * vatPercentage as Final_VAT_cost,
Units,
Price,
Cost
FROM TABLE...;
I just put 1 on the ELSE to have a minimum of 1% for the VAT %
Try this, just check your calcualations Rules..
Hope it helps
YB
May be this
Product:
LOAD *,
Price * vatPercentage as New_Price,
Cost * vatPercentage as New_Cost;
LOAD *,
((VatAmount / Units) / Price) + 1 as vatPercentage;
LOAD
Code,
Description,
VatAmount,
Units,
Price,
Cost;
Thanks Sunny, works great!