This script is used to apply a discount or tariff on a bill based the customer category
Maintenance > Resources
Enable event.customerchanged in Ticket.Buttons and call the below script.
/* DISCOUNT/TARIFF ON CUSTOMER CATEGORY */ /* Call this script from event.customerchanged */ import com.posics.format.Formats; import com.posics.pos.ticket.TicketLineInfo; import com.posics.pos.ticket.TicketProductInfo; customer = ticket.getCustomer(); if (customer != null && customer.getTaxCustCategoryID() != null) { tcc = customer.getTaxCustCategoryID(); if (tcc.equals("485c8198-ad17-4f36-8b63-af97cc4a2319")) { discountrate = 0.05; int numlines = ticket.getLinesCount(); //start for loop for (int i = 0 ; i<numlines ; i++) { l = ticket.getLine(i); l.setSalePrice(l.getPrice() - l.getPrice() * discountrate); } }else { sales.setTariff("Credit", 0); } } Save & restart