No announcement yet.

Calcualted Values in Quotes

  • Filter
  • Time
  • Show
Clear All
new posts

  • Calcualted Values in Quotes

    I'm trying to update my quotes to include a number of weeks for subscription to a service as well as a number of items. eg 10 items per week for 15 weeks at $15ea = $2250

    By default the "Amount" (line total) appears to be calculated as Quantity x Unit Price (although this is not listed in the formula for Quote item)

    In Administration, Entity, QuoteItem I added a custom formula.

    I've set up a Forumula on QuoteItem as :
    ifThenElse( subscriptionWeeks > 1, amount = unitPrice * subscriptionWeeks * quantity, amount = unitPrice * quantity ); This appears to work OK but ONLY once I click update in the quote. The line total (Amount) updates live on the screen as (Quantity x Unit Price) as I alter Unit Price and Quantity but it only takes account of the value in Subscription Weeks when I click Update which is confusing because if I have a line 10 items per week for 15 weeks at $15ea = $2250 and I update the items from 10 to 20 the calculated Amount value becomes (20items x $15ea) = $300 and only when I save changes by clicking update does it update to (20items x 15 weeks x $15ea) = $4500 I'll also have to add formulae for the Pre discount amount, Discount, tax amount to take account of the additional Subscription Weeks value. Is there a better way of achieving this result? Can I make it update the line total (Amount) live?

  • #2
    > This appears to work OK but ONLY once I click update in the quote.
    It is because Formula uses a beforeSave script which means that formula affects result after you fire a save button only. If you want to see how values are changing live you have to create your logic in the javascript files. Please investigate this file /client/modules/sales/src/quote-calculation-handler.js