Fieldpine Logo Documentation Home   DESIGN NOTES

This information is a technical design note. Use extreme caution if relying on this information, it may be outdated or incomplete

Design Note: Discount Select


Source Code: SelectDiscount.cpp

Setup

  1. Fetchs current active sale and saleline and writes this into the screen for the user
  2. Reads the discounts table and loads those that are valid. It obeys the optional field discounts.includelist

    If present, contains a list of PID values to which this discount can be applied. This allows discounts to be created that only apply to certain products. The actual purpose of this field is not to enforce blocking of using this discount on the current product, but rather to remove the item from the discount(select) list of options, so that user lists more precise. (Note, in a future version, includelist functionality MAY be extended to block in all circumstances).

    If this field is empty, the discount is visible to all products.
    If this field contains a 0 (zero), then the discount is visible to no products.
    If the field contains values of the form A,B,C,E, then the discount is visible to products with pid values A B C and E only.

  3. If the setting SaleDiscNoItem is set, the radio box to select item discounts is disabled
  4. If the setting SaleDiscNoSale is set, the radio box to select sale discounts is disabled
  5. If the setting SaleDiscAmountReadOnly is set: When displaying the discount selector screen, force the amount or rate entry field to be read only. This essentially disables the ability to enter random amounts and forces selection from predefined discounts only.
  6. If the selection sale/line has not be already set; if the setting SaleDiscountDefaultItem is set, then pre-select item discounts.

Execution

  1. As the user selects different discount types, the discounts.amount field is written into the Amount field on screen. The database search is done using disc_name field.

Exit

  1. The screen builds the equivalent of a discount(type,where,param) PosCommand for the caller to execute. This screen does not apply the discount itself it only returns the command to the caller
  2. Most callers of this screen will also fetch the "name" value after exit so they can decode discount type (uniform, percent, etc)