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.

  • Phil Crowe 192 posts 256 karma points
    Jul 11, 2013 @ 10:52
    Phil Crowe
    0

    Tax issue with ucommerce 2.6.1

    Say a product should cost £2.99 with vat. without vat at 20% it should be 2.49. When this is put into the unit price field in ucommerce it saves it as 2.4900 (with 4 decimals). This shows the price correctly on the front end as £2.99. But if you do a bulk order:

    Should be:
    2.99 * 30 = 89.7
    Ucommerce:
    2.49 0.50 89.64
    Has anyone found this problem before? Is there an easy fix for this?
  • Phil Crowe 192 posts 256 karma points
    Jul 11, 2013 @ 14:09
    Phil Crowe
    100

    solution was to create a replacement for the CalculateOrderLineTaxTask pipeline which rounds the taxvalue:

    namespace uCommerceOverrides
    {
        public class calculateTaxPipelineTask : IPipelineTask<PurchaseOrder>
        {
            public PipelineExecutionResult Execute(PurchaseOrder subject)
            {
                CollectionExtensions.ForEach<OrderLine>((IEnumerable<OrderLine>)subject.OrderLines, (Action<OrderLine>)(x =>
                {
                    OrderLine orderLine = x;
                    Decimal vatRate = x.VATRate;
                    Decimal price = x.Price;
                    Decimal? unitDiscount = x.UnitDiscount;
                    Decimal unitPrice = (unitDiscount.HasValue ? new Decimal?(price - unitDiscount.GetValueOrDefault()) : new Decimal?()) ?? new Decimal(0);
                    Decimal priceAfterVat = Math.Round(vatRate* unitPrice, 2, MidpointRounding.AwayFromZero);
                    orderLine.VAT = priceAfterVat;
                }));
                return PipelineExecutionResult.Success;
            }
        }
    }
    then in the basket.config replace the method with:
    <!-- Recalculate tax for order lines based on reduced unit prices -->
    <!--<value>${Basket.CalculateOrderLineTax}</value>-->
    <value>${uCommerceOverrides.calculateTaxPipelineTask}</value>
    also need to register the method further down the config file:
        <component id="uCommerceOverrides.calculateTaxPipelineTask"
                       service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities2.PurchaseOrder, UCommerce]], UCommerce"
                       type="uCommerceOverrides.calculateTaxPipelineTask, uCommerceOverrides"
                       lifestyle="Thread" />
  • Søren Spelling Lund 1797 posts 2786 karma points
    Jul 29, 2013 @ 14:40
    Søren Spelling Lund
    0

    This is fixed in uCommerce 3.

Please Sign in or register to post replies

Write your reply to:

Draft