Remove duplicate item entry in sales screen

This code update quantity of an existing item, when the same item is entered again.

Simply update quantity if the barcode repeats. It doesn’t update if the item is auxiliary or open item.

Maintenance > Resources
Add below script in event.addline:

if(!line.isProductCom())
{
int numlines = ticket.getLinesCount();
for (int i = 0 ; i < numlines ; i++) {
  current_ticketline = ticket.getLine(i);
 if(line.printCode()!=null && current_ticketline.printCode()!=null && current_ticketline.printCode().equals(line.printCode()))
    { 
    current_ticketline.setMultiply(current_ticketline.getMultiply()+line.getMultiply());
        return "Cancel";
 }
 }
}

Save & restart

0 Comments

Leave a Reply

Arrow-up