Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Chris Knowles 141 posts 222 karma points
    Dec 16, 2011 @ 14:47
    Chris Knowles
    0

    VAT price in usercontrol

    Hi,

    I have a usercontrol and i can't seem to figure out how to get the vat inclusive price of an item. I have:

    product.GetPrice(PriceGroup.All().FirstOrDefault()).Price .Value.ToString("F2")

    Can someone tell me what i should be using please?

    Thanks

    Chris

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jan 09, 2012 @ 11:43
    Søren Spelling Lund
    0

    GetPrice will use the raw values of the price group, which means that VAT will not be included.

    var pricingService = ObjectFactory.Instance.Resolve<IPricingService>();
    // get unit price without VAT
    PriceGroupPrice unitPrice = pricingService.GetProductPrice(product, pricegroup);

    // get tax if applicaple
    var taxService = ObjectFactory.Instance.Resolve<ITaxService>();
    Money unitTax = taxService.CalculateTax(product, priceGroup, unitPrice);

    decimal unitPriceIncludingTax = unitPrice.Price.Value + unitTax.Value;
  • Chris Knowles 141 posts 222 karma points
    Jan 11, 2012 @ 14:11
    Chris Knowles
    0

    Thanks Soren,

    What references do i need in my ascx as it doesn't seem to recognise ObjectFactory or Money?

    Chris

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jan 16, 2012 @ 10:41
    Søren Spelling Lund
    0

    UCommerce.Infrastructure.ObjectFactory is in the UCommerce.Infrastructure.dll and UCommerce.Money is in the UCommerce.dll

  • Chris Knowles 141 posts 222 karma points
    Jan 16, 2012 @ 10:48
    Chris Knowles
    0

    Thanks again Soren!

    What about <IPricingService> and <ITaxService>, it can't seem to find them?

    Thanks

    Chris

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jan 16, 2012 @ 10:52
    Søren Spelling Lund
    100

    ITaxService Interface

    IPricingService Interface

    You can use the reference docs to find the location of the interfaces (there's handy serach function at the top). There's always a correlation between the root namespace and the DLL, e.g. the UCommerce.Infrastructure namespace is inthe UCommerce.Infrastructure.dll. 

  • Chris Knowles 141 posts 222 karma points
    Jan 16, 2012 @ 10:54
    Chris Knowles
    0

    Thanks Soren, i didn't know about them but i'll refer to them in future.

    Thanks again

    Chris

  • Tom Madden 252 posts 454 karma points MVP 4x c-trib
    Jun 06, 2012 @ 15:50
    Tom Madden
    0

    Soren,

    this seems to work well, but if you use basket.PurchaseOrder.OrderTotal it doesn't use the new TaxService, so includes VAT reagrdless, and neither does SiteContext.Current.OrderContext.GetBasket().PurchaseOrder.OrderLines.Sum(x => x.Total)

    I assume I just can't use these and need to handle this myselff. Is this correct?

    Also, are there any plans to handle vatable and non vatable products in a cleaner manner?

    Thanks
    Tom

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 07, 2012 @ 10:42
    Søren Spelling Lund
    0

    Hi Tom,

    The reason for this behavior is that the basket pipeline needs to recalculate VAT based on any applied disocunts.

    For your scenario the simplest is to set the VATRate field on the order lines in question to zero, which means you can leave the basket pipeline as is.

    Alternatively you can replace the calculate order lines VAT task with your own.

Please Sign in or register to post replies

Write your reply to:

Draft