Developer forum

Forum » Development » Flat tax provider - shipping fees

Flat tax provider - shipping fees

Nuno Aguiar
Reply

Hi,

 

We are trying to extent the Flat Tax Provider to include Shipping fees. We encountered the following issues:

  • The source code in the Downloads page is not up to date. Does not take quantities into consideration, however in 8.6.1 it does
  • We need to add a Tax orderline for shipping fees, but since it has no reference to a product, nor it is a product itself, we can't seem to add it. How could we do that?

 

Right now we can only think of splitting the Shipping tax amount per the amount of orderlines, but does not seem the right approach, plus gives us some troubles with roundings. Is there a better way to achieve this?

 

Best Regards,

Nuno Aguiar


Replies

 
Vladimir
Reply

Hi Nuno,

I hope that will be usefull:

                            OrderLine taxOrderLine = new OrderLine();
                            taxOrderLine.Date = DateTime.Now;
                            taxOrderLine.Modified = DateTime.Now;

                            taxOrderLine.ProductNumber = "ShippingTax";
                            taxOrderLine.ProductName = "ShippingTax";
                            taxOrderLine.ProductVariantText = "Your provider name";
                            taxOrderLine.Order = order;
                            taxOrderLine.OrderID = order.ID;
                            taxOrderLine.Quantity = 1;

                            //Set price - should be before setting Type
                            taxOrderLine.SetUnitPrice(Convert.ToDouble(taxAmount));
                            if (!order.Calculate)
                            {
                                // force price recalculation if order not calculate
                                taxOrderLine.SetUnitPrice(taxOrderLine.UnitPrice, true);
                            }
                            taxOrderLine.Type = Base.ChkString(Base.ChkInteger(OrderLine.OrderLineType.Tax));
                            order.OrderLines.Add(taxOrderLine);

Best regards,

Vladimir

 
Nuno Aguiar
Reply

Hi Vladimir,

 

Thanks for this. The comments where very useful.

 

Best Regards,

Nuno

 

You must be logged in to post in the forum