// Set SendStatus and print removals
line = ticket.getLine(index);
String a = line.getProperty("sendstatus");
String b = "Yes";
String c = "No";
String d = "N/A";
Integer myCount = 0;
//get count of auxiliar after the main product
for (i = index+1; i < ticket.getLinesCount(); i++) {
if (ticket.getLine(i).isProductCom()){
myCount = myCount + 1;
}else{
break;
}
}
//Set SendStatus of sent items to Cancel
if (a.equals(b) && !line.isProductCom()) {
for (i = index + myCount; i>= index ; i--) {
if (ticket.getLine(i).isProductCom() && ticket.getLine(i).getProperty("sendstatus").equals("Yes")){
ticket.getLine(i).setProperty("sendstatus", "Cancel");
}else if (ticket.getLine(i).isProductCom() && ticket.getLine(i).getProperty("sendstatus").equals("No")){
ticket.removeLine(i);
}else{
break;
}
}
line.setProperty("sendstatus", "Cancel");
}
//Removelines of NOT sent items
if ((a.equals(c) || a.equals(d))&& !line.isProductCom()) {
for (i = index + myCount; i>= index ; i--) {
if (ticket.getLine(i).isProductCom()){
ticket.removeLine(i);
}else{
break;
}
}
ticket.removeLine(index);
}else if (a.equals(c) && line.isProductCom()) {
ticket.removeLine(index);
}
//Cancel event
removeLine.cancel=true;
Leave a Reply