question

gregoryforte avatar image
gregoryforte asked chanel Deactivated edited

Customer wants kitchen Reprint to only print the item and not whole order

Customer wants kitchen Reprint to only print the item and not whole order. She doesn’t want it to print the whole order with the (R) next to the reprint. She wants this item on its own order ticket.
Print
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

chanel avatar image
chanel Deactivated answered chanel Deactivated edited
Hi @GregoryForte,

You can do that by looping through the order and checking to see that item has been printed or not. Below is an example (Note: this code does not take into account items put onto a display; it only works for items that have been physically printed).

ArrayList<String> unprinted = new ArrayList<>();
List<LineItem> items = order.getLineItems();
for(LineItem item : items) {
  if (!item.getPrinted()){
    unprinted.add(item.getId());
  }
}
if(unprinted.isEmpty()){
  Toast.makeText(MainActivity.this, "No new line items", Toast.LENGTH_SHORT).show();
} else {
  new StaticOrderPrintJob.Builder().itemIds(unprinted).markPrinted(true).order(order).build().print(MainActivity.this, account);
}
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community