private void doShowOrderInfo() { try { List<Ticket> selectedTickets = openTicketList.getSelectedTickets(); if (selectedTickets.size() == 0) { POSMessageDialog.showMessage(POSConstants.SELECT_ONE_TICKET_TO_PRINT); return; } List<Ticket> ticketsToShow = new ArrayList<Ticket>(); for (int i = 0; i < selectedTickets.size(); i++) { Ticket ticket = selectedTickets.get(i); ticketsToShow.add(TicketDAO.getInstance().loadFullTicket(ticket.getId())); } OrderInfoView view = new OrderInfoView(ticketsToShow); OrderInfoDialog dialog = new OrderInfoDialog(view); dialog.setSize(400, 600); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setLocationRelativeTo(Application.getPosWindow()); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } // Ticket ticket = selectedTickets.get(0); // try { // ticket = TicketDAO.getInstance().initializeTicket(ticket); // ticket.calculateDefaultGratutity(); // // PosPrintService.printTicket(ticket, 0); // // // PRINT ACTION // String actionMessage = "CHK#" + ":" + ticket.getId(); // ActionHistoryDAO.getInstance().saveHistory(Application.getCurrentUser(), // ActionHistory.PRINT_CHECK, actionMessage); // } catch (Exception e) { // POSMessageDialog.showError(this, e.getMessage(), e); // } }
protected void doAssignDriver() { try { Ticket ticket = getFirstSelectedTicket(); // if(ticket == null) { // return; // } if (!Ticket.HOME_DELIVERY.equals(ticket.getTicketType())) { POSMessageDialog.showError("Driver can be assigned only for Home Delivery"); return; } User assignedDriver = ticket.getAssignedDriver(); if (assignedDriver != null) { int option = JOptionPane.showOptionDialog( Application.getPosWindow(), "Driver already assigned. Do you want to reassign?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (option != JOptionPane.YES_OPTION) { return; } } orderServiceExtension.assignDriver(ticket.getId()); } catch (Exception e) { e.printStackTrace(); POSMessageDialog.showError(e.getMessage()); LogFactory.getLog(SwitchboardView.class).error(e); } }