CORE POS - IS4C
The CORE POS front end
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
DiscountModule Class Reference
Inheritance diagram for DiscountModule:
NeedDiscountModule

Public Member Functions

 __construct ($percent, $name='custdata')
 
 calculate ($discountable_total=0)
 
 percentage ()
 

Static Public Member Functions

static updateDiscount (DiscountModule $mod, $do_subtotal=true)
 
static transReset ()
 
static lineItems ()
 

Public Attributes

 $name = 'custdata'
 

Protected Attributes

 $my_discount = 0
 

Detailed Description

Calculate a per-transaction discount

This module is called in Database::getsubtotals() and the value it calculates will be stored in session as 'transDiscount'. The default version simply returns the value calculated by the translog.subtotals view.

Member Function Documentation

DiscountModule::calculate (   $discountable_total = 0)

Calculate the discount based on current transaction state

Returns
double discount amount

Note return value should be positive unless you're doing something odd

static DiscountModule::lineItems ( )
static

Add a log record w/ upc DISCLINEITEM for Each discount in stacking mode The applicable discount in non-stacking mode

DiscountModule::percentage ( )

Decide what percent discount to apply to this transaction.

Returns
int percentage (i.e., 5 == 5%)
static DiscountModule::transReset ( )
static

Reset all discounts

static DiscountModule::updateDiscount ( DiscountModule  $mod,
  $do_subtotal = true 
)
static

Add or update a discount module in the current transaction. Automatically subtotals if the discount changes.

Examine current discounts to see if this one has already applied

Add object to the list of active discounts Then loop through to see whether it changes the effective discount with stacking settings taken into account

When discount changes:

  1. Update the session value
  2. Update the localtemptrans.percentDiscount value
  3. Subtotal the transaction

The documentation for this class was generated from the following file: