Dynamicweb 8 Documentation
Substract(IPriceInfo) Method
Example 

The price info.
Substracts the specified info.
Syntax
'Declaration
 
Public Overloads Overridable Function Substract( _ 
   ByVal info As IPriceInfo _ 
) As PriceInfo
public virtual PriceInfo Substract( 
   IPriceInfo info 
)

Parameters

info
The price info.
Example
class MyPage : System.Web.UI.Page
{
    private void RenderOrderLine(Dynamicweb.eCommerce.Orders.OrderLine orderLine, Dynamicweb.Rendering.Template template)
    {
        Dynamicweb.eCommerce.International.Currency temporaryContextCurrency = Dynamicweb.eCommerce.Common.Context.Currency;
        if (orderLine.Price.Currency != null)
        {
            Dynamicweb.eCommerce.Common.Context.Currency = orderLine.Price.Currency;
        }
        Dynamicweb.eCommerce.Prices.PriceInfo totalDiscountPriceInfo = orderLine.Product.Discounts.TotalDiscount.Multiply(orderLine.Quantity);
        totalDiscountPriceInfo.Currency = Dynamicweb.eCommerce.Common.Context.Currency;
        Dynamicweb.eCommerce.Prices.PriceInfo netPrice = orderLine.Price.Substract(totalDiscountPriceInfo);
        RenderPriceInfo(netPrice, template, "Ecom:Order:OrderLine.TotalPriceWithProductDiscounts");
        Dynamicweb.eCommerce.Common.Context.Currency = temporaryContextCurrency;
    }

    public static void RenderPriceInfo(Dynamicweb.eCommerce.Prices.IPriceInfo price, Dynamicweb.Rendering.Template template, string tagName)
    {
        if (template.HtmlHasPartialTag(tagName))
        {
            if (template.TagExists(tagName + ""))
            {
                template.SetTag(tagName + "", price.PriceFormatted);
            }
            if (template.TagExists(tagName + ".Price"))
            {
                template.SetTag(tagName + ".Price", price.PriceFormattedNoSymbol);
            }
            if (template.TagExists(tagName + ".PricePIP"))
            {
                template.SetTag(tagName + ".PricePIP", price.PricePIP);
            }
            if (template.TagExists(tagName + ".PriceFormatted"))
            {
                template.SetTag(tagName + ".PriceFormatted", price.PriceFormatted);
            }
            if (template.TagExists(tagName + ".PriceWithVAT"))
            {
                template.SetTag(tagName + ".PriceWithVAT", price.PriceWithVATFormattedNoSymbol);
            }
            if (template.TagExists(tagName + ".PriceWithVATFormatted"))
            {
                template.SetTag(tagName + ".PriceWithVATFormatted", price.PriceWithVATFormatted);
            }
            if (template.TagExists(tagName + ".PriceWithoutVAT"))
            {
                template.SetTag(tagName + ".PriceWithoutVAT", price.PriceWithoutVATFormattedNoSymbol);
            }
            if (template.TagExists(tagName + ".PriceWithoutVATFormatted"))
            {
                template.SetTag(tagName + ".PriceWithoutVATFormatted", price.PriceWithoutVATFormatted);
            }
            if (template.TagExists(tagName + ".VAT"))
            {
                template.SetTag(tagName + ".VAT", price.VATFormattedNoSymbol);
            }
            if (template.TagExists(tagName + ".VATFormatted"))
            {
                template.SetTag(tagName + ".VATFormatted", price.VATFormatted);
            }
            if (template.TagExists(tagName + ".VATPercent"))
            {
                template.SetTag(tagName + ".VATPercent", price.VATPercent);
            }
            if (template.TagExists(tagName + ".VATPercentFormatted"))
            {
                template.SetTag(tagName + ".VATPercentFormatted", price.VATPercentFormatted);
            }
            bool isZero = price.Price == 0;
            template.SetTag(string.Format("{0}.IsZero", tagName), Base.IIf(ref isZero, "true", ""));
        }
    }
}
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

PriceInfo Class
PriceInfo Members
Overload List

Send Feedback