public class ModifierFunctions extends Object
Constructor and Description |
---|
ModifierFunctions(TicketLine oTicketline,
ModifierTimers oTimers,
HashMap<Integer,Tax> mTaxes)
Creates an instance of ModifierFunctions to make the current ticketline
available to all functions.
|
Modifier and Type | Method and Description |
---|---|
TicketLine |
activateVoucher()
Calls activateVoucher(false)
|
TicketLine |
activateVoucher(boolean afterPayment)
Show a dialog to request scanning of a voucher and activate the voucher.
|
TicketLine |
addComProducts(String codes)
Set the transient ticketline property comProducts to the string 'codes'.
|
TicketLine |
buyNgetOneFree(int n)
Count the number of products on the current ticket and modify the price
of the current item to fit the condition "Buy n Get One For Free".
|
TicketLine |
buyNgetOneFree(int n,
String descmod)
Count the number of products on the current ticket and modify the price
of the current item to fit the condition "Buy n Get One For Free".
|
TicketLine |
buyNmodifyNext(int n,
String mod)
Count the number of products on the current ticket and modify the current
line with the given modifier function.
|
TicketLine |
buyNmodifyNext(int n,
String mod,
String descmod)
Count the number of products on the current ticket and modify the current
line with the given modifier function.
|
TicketLine |
checkRestrictedProduct()
Assign this function to an active product modifier to restrict users
having the permission Perm.RestrictedProduct to add this product line. .
|
TicketLine |
checkRestrictedProduct(String permKey)
Assign this function to an active product modifier to restrict users
having the permission permKey to add this product line. .
|
TicketLine |
createSlotReservation(int slot_type)
Creates a Reservation record for lines having a product assigned which
has a slot_length entry like slot_30 in unitType and a value for the
number of slots in units
|
TicketLine |
customerDiscount()
Looks for an entry in the customer discount table and applies the found
discount rate if any.
|
TicketLine |
discount(double discountRate)
Applies the given discount rate based on the products priceSell.
|
TicketLine |
discount(double discountRate,
int cent)
This method is identical to discountFromLineTotal(double discountRate,
int cent)
|
TicketLine |
discountFromItem(double discountRate,
int cent)
Applies the given discount rate based on the products priceSell.
|
TicketLine |
discountFromLineTotal(double discountRate,
int cent)
Applies the given discount rate based on the products priceSell.
|
TicketLine |
discountX(double discountRate)
Deprecated.
Use discount(double discountRate) instead.
|
TicketLine |
discountX(double discountRate,
int cent)
Deprecated.
Obolete, use discountFromLineTotal(double discountRate, int
cent) instead.
|
TicketLine |
priceAndTaxShift(int price_index,
int tax_index)
The price is calculated from the indexed price so that the the gross
price matches the gross price with the given tax
|
TicketLine |
priceShift(int index)
Changes the products sell price from priceSell to the sell price
indicated by index (0|1|2).
|
TicketLine |
protectLine()
Set status to PROTECTED to prevent unauthorized users from deleting or
editing the ticketline.
|
void |
resetTicketline()
Resets all modified values to original product values.
|
TicketLine |
revertAmount()
Multiplies the number of items (amount) by -1.
|
TicketLine |
sellUnit(double factor)
Set the transient ticketline property addComProduct to the string 'codes'
which is taken from the products unitType column.
|
TicketLine |
setNegativeAmount()
Set the number of items (amount) to -abs(amount).
|
TicketLine |
showMessage(String message)
Show a message dialog.
|
TicketLine |
showMessage(String message,
String title)
Show a message dialog.
|
TicketLine |
specialPrice(int mod)
The function looks for a SpecialPrice assigned to the product and, if
any, checks the cron-expression and date_from and date_to given in the
SpecialPrice entry.
|
TicketLine |
taxShift(int taxId)
Applies the given taxId based on the products priceSell
|
TicketLine |
taxShiftFromTo_1(int... taxes_from_to)
Applies a tax shift from the from value, if found, to the to-value of the
parameter list
|
void |
taxShiftFromTo(int from1,
int to1,
int from2,
int to2)
This hack is necessary because the multiple int arguments version as in
taxShiftFromTo_1 cannot be found when called by the beanshell.
|
void |
taxShiftFromTo(int from1,
int to1,
int from2,
int to2,
int from3,
int to3) |
void |
taxShiftFromTo(int from1,
int to1,
int from2,
int to2,
int from3,
int to3,
int from4,
int to4) |
TicketLine |
taxShiftKeepPrice(int taxId)
Applies the given taxId based on the products priceSell. priceSell is
recalculated to keep the customer price stable.
|
TicketLine |
taxShiftKeepPriceFromTo_1(int... taxes_from_to)
Applies a tax shift from the from value, if found, to the to-value of the
parameter list.
|
void |
taxShiftKeepPriceFromTo(int from1,
int to1,
int from2,
int to2) |
void |
taxShiftKeepPriceFromTo(int from1,
int to1,
int from2,
int to2,
int from3,
int to3) |
void |
taxShiftKeepPriceFromTo(int from1,
int to1,
int from2,
int to2,
int from3,
int to3,
int from4,
int to4) |
TicketLine |
toggleAccountingLevels(int mask)
NOT YET IMPLEMENTED
|
TicketLine |
variableDiscount()
The discount rate is retrieved from the current value in the ticket
views price input field.
|
TicketLine |
warnLockedProduct()
This modifier checks if the referenced product is locked.
|
public ModifierFunctions(TicketLine oTicketline, ModifierTimers oTimers, HashMap<Integer,Tax> mTaxes)
oTicketline
- current ticketlineoTimers
- mTaxes
- public void resetTicketline()
public TicketLine discount(double discountRate)
discountRate
- discount rate to be applied, e.g. 10 for 10%public TicketLine variableDiscount()
public TicketLine discountFromItem(double discountRate, int cent)
discountRate
- discount rate to be applied, e.g. 10 for 10%cent
- cent value to round topublic TicketLine discountFromLineTotal(double discountRate, int cent)
discountRate
- discount rate to be applied, e.g. 10 for 10%cent
- cent value to round topublic TicketLine discount(double discountRate, int cent)
discountRate
- cent
- #discountTotal(double, int)
public TicketLine revertAmount()
public TicketLine setNegativeAmount()
public TicketLine discountX(double discountRate, int cent)
discountRate
- discount rate to be applied, e.g. 10 for 10%cent
- public TicketLine discountX(double discountRate)
discountRate
- discount rate to be applied, e.g. 10 for 10%public TicketLine priceShift(int index)
index
- public TicketLine taxShift(int taxId)
taxId
- tax id (=visibleId) to be appliedpublic TicketLine taxShiftFromTo_1(int... taxes_from_to)
taxes_from_to
- a comma separated list of from,to pairs of tax
visible ids to be shifted. If an odd number of values is given, the
modifier does nothing.public TicketLine taxShiftKeepPriceFromTo_1(int... taxes_from_to)
taxes_from_to
- a comma separated list of from,to pairs of tax
visible ids to be shifted. If an odd number of values is given, the
modifier does nothing.public void taxShiftFromTo(int from1, int to1, int from2, int to2)
from1
- tax visibleId to be changedto1
- new tax visibleIdfrom2
- tax visibleId to be changedto2
- ew tax visibleIdpublic void taxShiftFromTo(int from1, int to1, int from2, int to2, int from3, int to3)
public void taxShiftFromTo(int from1, int to1, int from2, int to2, int from3, int to3, int from4, int to4)
public void taxShiftKeepPriceFromTo(int from1, int to1, int from2, int to2)
public void taxShiftKeepPriceFromTo(int from1, int to1, int from2, int to2, int from3, int to3)
public void taxShiftKeepPriceFromTo(int from1, int to1, int from2, int to2, int from3, int to3, int from4, int to4)
public TicketLine priceAndTaxShift(int price_index, int tax_index)
tax_index
- price_index
- public TicketLine taxShiftKeepPrice(int taxId)
taxId
- tax id to be appliedpublic TicketLine customerDiscount()
public TicketLine specialPrice(int mod)
mod
- The modifier used to trigger this functionpublic TicketLine addComProducts(String codes)
codes
- public TicketLine sellUnit(double factor)
factor
- public TicketLine buyNgetOneFree(int n, String descmod)
n
- Number of items to be paiddescmod
- A string prepended to the descriptionpublic TicketLine buyNmodifyNext(int n, String mod, String descmod)
n
- Number of items to be paidmod
- descmod
- A string prepended to the descriptionpublic TicketLine buyNgetOneFree(int n)
n
- Number of items to be paidpublic TicketLine buyNmodifyNext(int n, String mod)
n
- Number of items to be paidmod
- public TicketLine toggleAccountingLevels(int mask)
mask
- public TicketLine warnLockedProduct()
public TicketLine protectLine()
public TicketLine activateVoucher(boolean afterPayment)
afterPayment
- when true, the activation dialog will be called per
line when payment has been processed. Default is false.public TicketLine activateVoucher()
public TicketLine createSlotReservation(int slot_type)
slot_type
- set 1 for jump_slotpublic TicketLine checkRestrictedProduct(String permKey)
permKey
- public TicketLine checkRestrictedProduct()
public TicketLine showMessage(String message, String title)
message
- title
- public TicketLine showMessage(String message)
message
- Copyright © 2021. All rights reserved.