In section, various fields used to hold information and do calculations are described, along with the default formulaes used.
Pricing fields of a order can be catagorised as
- Information fields: fields that are mere information, such as price and vat percentage.
- Calculated fields: Fields that are calculated using the information fields. These fields are calculated in pricing rules plugin. Since they are calculated, any value placed manually will be overriten.
Order Row
Order row is to record a single type of item purchased, and the quantity purchased. Order may have one or more order rows. There can be different order rows with similar items, but a single order row will have only one type of item, and can use only one time of order row level campaign.
Information fields
UnitCampaignPrice: Special campaign price of an article, this special price is calculated by a Order Row Level Campaign. This price is for a single unit of item, such as "one mobile phone", or "one litre of oil".
UnitListPrice: Price of an article.This price is for a single unit of item, such as "one mobile phone", or "one litre of oil".
DiscountPercentage: Percentage of discount applicable for the order row.
VATPercentage: Percentage of VAT applicable for this article.
Calculated fields
TotalDiscountAmount = UnitListPrice x Quantity x DiscountPercentage IF NO order row level campaign
TotalDiscountAmount = UnitCampaignPrice x Quantity x DiscountPercentage IF order level campaign is applied.
TotalPrice = UnitListPrice x Quantity - OrderRow TotalDiscountAmount IF NO order row level campaign,
TotalPrice = UnitCampaignPrice x Quantity - OrderRow TotalDiscountAmount, IF order row level campaign is applied.
TotalVATAmount = TotalPrice x VATPercentage
TotalPriceWithVAT = TotalPrice + TotalVATAmount
Notes
1) TotalVATAmount is based on TotalPrice and TotalPrice is based on UnitCampaignPrice and TotalDiscountAmount where applicable. What this means is, VAT is automatically reduced to any discounts or special prices given. You should take note of this when developing campaigns, the campaign special price should be without taking VAT into account.
2) TotalDiscountAmount is applied on top of UnitCampaignPrice if campaigns are applied. This means, you will be giving a cumulative discount if a discount percentage is specified to the order row, if at the same time if the order row becomes eligible for a campaign.
3) TotalPrice Does not include VAT, its the TotalPriceWithVAT that contains the price with vat.
Deliveries
Records information about deliveries. There can be multiple deliveries for a order.
Information fields
- DeliveryCost: Cost to deliver goods. This can be the amount paid to delivering company, postage or frieght charges. Value should be without VAT.
- CampaignDiscountAmount: Campaign discount if applicable to this delivery. The value should be without VAT.
Calculated fields
- VATPercentage = Weight avarage VAT percentage based on VAT amounts in the order rows.
- TotalDeliveryCost = DeliveryCost - CampaignDiscountAmount
- TotalVATAmount = TotalDeliveryCost x VATPercentage
- TotalDeliveryCostWithVat = TotalDeliveryCost + TotalVATAmount
You can set the TotalDeliveryCostWithVat and then set KeepDeliveryCostWithVatConstant property to true, in which case TotalDeliveryCostWithVat will be the information field, and VAT calculator will calculate the correct DeliveryCost which will be the calculated field.
Fees
Fees applicable for processing the order, such as special order handling fees, administration fees, etc. There can be multiple fee rows.
Information fields
- Amount: Fee amount. Value should be without VAT.
- CampaignDiscountAmount: Campaign discount if applicable to this fee. The value should be without VAT.
Calculated fields
- TotalAmount = Amount - CampaignDiscountAmount
- VATPercentage = Weight avarage VAT percentage based on VAT amounts in the order rows.
- TotalVATAmount = TotalFee x VATPercentage
- TotalAmountWithVAT = TotalFee x TotalVATAmount
You can set the TotalFeeWithVat and then set KeepAmountWithVATConstant property to true, in which case TotalAmountWithVAT will be the information field, and VAT calculator will calculate the correct TotalAmount which will be the calculated field.
Order Discount
Represents a discount applicable for the whole order. This discount should include reduction of VAT that will happen because of the descount. That means, for example, if a discount of say 100 SEK is given to a end customer, some amount out of this 100 SEK will actually be VAT. Please see Calculating Order Grand Total and Calculating VAT topics for more details
Information fields
- DiscountAmountWithVAT: Amount of discount, including VAT reduction.
- DiscountPercentage: Percentage of discount. Note: this field is not used in default calculations implementation.
Calculated fields
- VATPercentage = Weight avarage VAT percentage based on VAT amounts in the order rows.
- DiscountAmount = DiscountAmountWithVAT / (1+ VATPercentage)
- VATAmount = DiscountAmount x VATPercentage
Order
When it come to pricing, Order has only calculated fields. All the information for these calculated fields are present in field of the component parts of the order: Order Rows, Deliveries, Fees, Order Discounts, Order Campaign Discounts.
Calculated fields
- Total = Sum of TotalPrice in Order Rows. (VAT not included)
- TotalOrderRowVAT = Sum of TotalVATAmount in Order rows.
- TotalWithVAT = Total + TotalOrderRowVAT.
- TotalDeliveryCost = Sum of TotalDeliveryCost in deliveries. (VAT not included)
- TotalDeliveryCostVAT = Sum of TotalVATAmount in deliveries.
- TotalDeliveryCostWithVAT = TotalDeliveryCost + TotalDeliveryCostVAT.
- TotalFee = Sum of TotalFee in fees. (VAT not included)
- TotalFeeVAT = Sum of TotalVATAmount in Fees.
- TotalFeeWithVAT = TotalFee + TotalFeeVAT.
- TotalDiscount = Sum of DiscountAmount in Order Discounts. (VAT not included)
- TotalDiscountVAT = Sum of VATAmount in Order Discounts.
- TotalDiscountWithVAT = TotalDiscount + TotalDiscountVAT.
- TotalVat = TotalOrderRowVAT + TotalDeliveryCostVAT + TotalFeeVAT - TotalDiscountVAT
- GrandTotal = Total + TotalDeliveryCost + TotalFee + TotalVAT - TotalDiscount
Payment Info
Payment info is used to represent a payment made for the order. Payment Info is used by the payment providers to find out how much amount should be charged from the end customer.
Information Fields
- Amount: Amount to be charged from customer. This information is set to Order GrandTotal. Therefore, this includes VAT.
- VATAmount: Amount of VAT. This information is set to Order TotalVat.
- TotalAmountWithVAT: Amount with VAT. This is not a calculated field, but set by the IPaymentInfoCalculator.CalculateFromCarrier method.
Calculated Fields
- VATPercentage: VATAmount / (Amount - VATAmount)