Dynamicweb 8 Documentation
GetCountryVAT Method
Example 

Gets the country VAT.
Syntax
'Declaration
 
Public Function GetCountryVAT() As Double
public double GetCountryVAT()
Example
class MyPage : System.Web.UI.Page
{
    private Dynamicweb.eCommerce.Products.Product product;

    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        product = (Dynamicweb.eCommerce.Products.Product)Session["Ecom.Backend.Product"];
    }

    public OrderLine SetUnitPrice(OrderLine orderLine, double amount)
    {
        string originalPriceInDBSetting = Base.GetGs("/Globalsettings/Ecom/Price/PricesInDbIncludesVAT");
        bool isPricesWithVat = Base.ChkBoolean(originalPriceInDBSetting);

        double systemVat = 0.0;
        double discountPrice = 0.0;

        if (isPricesWithVat)
        {
            discountPrice = product.Price.PriceWithVAT / 100 * amount;
        }
        else
        {
            discountPrice = product.Price.PriceWithoutVAT / 100 * amount;
        }

        if (double.TryParse(Base.GetGs("/Globalsettings/Ecom/Price/PricesInDbVAT"), out systemVat))
        {
            discountPrice *= 1 + (systemVat / 100.0);
        }

        //Remove country VAT
        discountPrice /= 1 + (new Dynamicweb.eCommerce.Prices.PriceCalculated().GetCountryVAT() / 100.0);
        //Set unit price
        orderLine.SetUnitPrice(discountPrice);
        return orderLine;
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PriceCalculated Class
PriceCalculated Members

Send Feedback