View source | View content page | Page history | Printable version   

Projects:Best Deal Case

Functional Requirements

Currently Discounts and Promotions are applied to a ticket based on two factors:

Best Deal Case is an alternative mechanism to the described one. When working on "Best Deal Case" mode:

It is not required to calculate best deal case while products are added to the ticket, this can be calculated instead when the ticket is about to be paid.

First iteration of this project will implement Best Deal Case in POS but not in backend.

Technical Specs

Algorithm

 
 
  
  splitLines()
  promotionCandidates = getPromotionCandidates()
 
  do {
    if (!alreadyCalculated()) {
      removeAllDiscounts()
  
      for (line:lines) {
        line.addCurrentCandidate()
      }
  
      for (line:lines) {
        line.calculateDiscount()
      }
  
      if (currentDiscount > biggestDiscount) {
        biggestDiscount = currentDiscount
      }
    }
    couldMovePointer = movePointer()
  } while (!couldMovePointer)
 
  apply(biggestDiscount)
 
  function getPromotionCandidates() {
    for (line:lines) {
      candidates.push(getCandidatesForLine(line))
    }
    return candidates
  }
 
  function splitLines() {
    // splits each line with more than 1 unit in several, having each of them 1 unit
    // it only applies to those lines that are candidates for at least one discount
  }
 
  function alreadyCalculated () {
    // checks if current combianation is already calculated
    // Example:
    //  A disc1, A disc2 === A disc2, A disc1
  }

Retrieved from "http://wiki.openbravo.com/wiki/Projects:Best_Deal_Case"

This page has been accessed 347 times. This page was last modified on 5 November 2013, at 10:23. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.