private void doTakeout(String titcketType) { Application application = Application.getInstance(); Ticket ticket = new Ticket(); // ticket.setPriceIncludesTax(application.isPriceIncludesTax()); ticket.setTableNumber(-1); ticket.setTicketType(titcketType); ticket.setTerminal(application.getTerminal()); ticket.setOwner(Application.getCurrentUser()); ticket.setShift(application.getCurrentShift()); Calendar currentTime = Calendar.getInstance(); ticket.setCreateDate(currentTime.getTime()); ticket.setCreationHour(currentTime.get(Calendar.HOUR_OF_DAY)); OrderView.getInstance().setCurrentTicket(ticket); RootView.getInstance().showView(OrderView.VIEW_NAME); }
private void doClockOut() { int option = JOptionPane.showOptionDialog( this, POSConstants.CONFIRM_CLOCK_OUT, POSConstants.CONFIRM, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (option != JOptionPane.YES_OPTION) { return; } User user = Application.getCurrentUser(); AttendenceHistoryDAO attendenceHistoryDAO = new AttendenceHistoryDAO(); AttendenceHistory attendenceHistory = attendenceHistoryDAO.findHistoryByClockedInTime(user); if (attendenceHistory == null) { attendenceHistory = new AttendenceHistory(); Date lastClockInTime = user.getLastClockInTime(); Calendar c = Calendar.getInstance(); c.setTime(lastClockInTime); attendenceHistory.setClockInTime(lastClockInTime); attendenceHistory.setClockInHour((short) c.get(Calendar.HOUR)); attendenceHistory.setUser(user); attendenceHistory.setTerminal(Application.getInstance().getTerminal()); attendenceHistory.setShift(user.getCurrentShift()); } Shift shift = user.getCurrentShift(); Calendar calendar = Calendar.getInstance(); user.doClockOut(attendenceHistory, shift, calendar); Application.getInstance().logout(); }