private void doReopenTicket() { try { int ticketId = NumberSelectionDialog2.takeIntInput(POSConstants.ENTER_TICKET_ID); if (ticketId == -1) { return; } Ticket ticket = TicketService.getTicket(ticketId); if (ticket == null) { throw new PosException( POSConstants.NO_TICKET_WITH_ID + " " + ticketId + " " + POSConstants.FOUND); } if (!ticket.isClosed()) { throw new PosException(POSConstants.TICKET_IS_NOT_CLOSED); } String ticketTotalAmount = Application.getCurrencySymbol() + " " + NumberUtil.formatToCurrency(ticket.getTotalAmount()); String amountMessage = "<span style='color: red; font-weight: bold;'>" + ticketTotalAmount + "</span>"; String message = "<html><body>Ticket amount is " + ticketTotalAmount + ". To reopen ticket, you need to refund that amount to system.<br/>Please press <b>OK</b> after you refund amount " + amountMessage + "</body></html>"; int option = JOptionPane.showOptionDialog( this, message, "Alert!", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null); if (option != JOptionPane.OK_OPTION) { return; } TicketService.refundTicket(ticket); editTicket(ticket); } catch (PosException e) { POSMessageDialog.showError(this, e.getLocalizedMessage()); } catch (Exception e) { POSMessageDialog.showError(this, POSConstants.ERROR_MESSAGE, e); } }
private void doOk(java.awt.event.ActionEvent evt) { // GEN-FIRST:event_doOk try { TicketDiscount selectedCoupon = getSelectedCoupon(); if (selectedCoupon == null) { POSMessageDialog.showError( this, Messages.getString("CouponAndDiscountDialog.29")); // $NON-NLS-1$ return; } setCanceled(false); dispose(); } catch (PosException e) { POSMessageDialog.showError(this, e.getMessage()); } } // GEN-LAST:event_doOk
public void actionPerformed(ActionEvent e) { if (OK.equalsIgnoreCase(e.getActionCommand())) { try { for (ConfigurationView view : views) { if (view.isInitialized()) view.save(); } setCanceled(false); dispose(); } catch (PosException x) { POSMessageDialog.showError(this, x.getMessage()); } catch (Exception x) { POSMessageDialog.showError(this, POSConstants.ERROR_MESSAGE, x); } } else if (CANCEL.equalsIgnoreCase(e.getActionCommand())) { setCanceled(true); dispose(); } }