Professional Documents
Culture Documents
Script - Linediscount Openbravo
Script - Linediscount Openbravo
import com.openbravo.format.Formats;
import com.openbravo.pos.ticket.TicketLineInfo;
import com.openbravo.pos.ticket.TicketProductInfo;
sdiscount = Formats.PERCENT.formatValue((1-discountrate));
index = sales.getSelectedIndex();
if (index >= 0) {
line = ticket.getLine(index);
if (line.getPrice() > 0.0 && sales.getInputValue() > 0.0) {
int reply = JOptionPane.showConfirmDialog(null, "Aplicar descuento a
esta línea?\n" + line.getProductName() + " -" + sdiscount, "Aprobar descuento",
JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
ticket.setLine(index,
new TicketLineInfo(
line.getProductID(),
line.getProductName() + " -" + sdiscount,
line.getProductTaxCategoryID(),
line.getMultiply(),
line.getPrice () * discountrate,
line.getTaxInfo()));
} else if (reply == JOptionPane.NO_OPTION) {
}
} else {
java.awt.Toolkit.getDefaultToolkit().beep();
}
} else {
java.awt.Toolkit.getDefaultToolkit().beep();
}