if (discountrate == null) {
return;
}
TicketTaxInfo[] taxes;
TicketTaxInfo taxline;
if (discountrate > 0 && discountrate <= 100) {
discountrate/=100;
double total = m_oTicket.getTotal();
if (total > 0.0 && discountrate > 0.0) {
String sdiscount = Formats.PERCENT.formatValue(discountrate);
taxes = m_oTicket.getTaxLines();
for (int i = 0; i < taxes.length; i++) {
taxline = taxes[i];
m_oTicket.insertLine(m_oTicket.getLinesCount(),
new TicketLineInfo(
"Remise totale " + sdiscount,
taxline.getTaxInfo().getTaxCategoryID(),
1.0,
-taxline.getSubTotal() * discountrate,
taxline.getTaxInfo()));
}
refreshTicket();
setSelectedIndex(m_oTicket.getLinesCount() - 1);
} else {
java.awt.Toolkit.getDefaultToolkit().beep();