sumitg

Receipt Printer Code

Feb 22nd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public void printJobReceipt(final String id, final List<Printer> printer) {
  2.  
  3. new MyAsyncTask(new CallBackTask() {
  4. @Override
  5. public void setData(final Order order) {
  6. try {
  7. List<String> activeReceiptId = PreferenceUtils.readList(MainActivity.this, Preferences.ACTIVE_PRINTER_LISTRECEIPT, "");
  8. for (int i = 0; i < printer.size(); i++) {
  9. Log.v("Printer",printer.get(i).getUuid()+"");
  10. for (int j = 0; j < activeReceiptId.size(); j++) {
  11. if (printer.get(i).getUuid().equals(activeReceiptId.get(j))) {
  12. PrintJob pj = new StaticPaymentPrintJob.Builder().order(order).build();
  13. pj.print(MainActivity.this, account, printer.get(i));
  14. }
  15. }
  16. }
  17.  
  18. } catch (Exception e) {
  19. e.printStackTrace();
  20. // Toast.makeText(MainActivity.this, "Exception o payment " + e.getMessage(), Toast.LENGTH_SHORT).show();
  21. }
  22. MainActivity.this.finish();
  23. }
  24. }).execute(id);
  25.  
  26. }
Add Comment
Please, Sign In to add comment