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); } }
public MenuItemExplorer() { tableModel = new BeanTableModel<MenuItem>(MenuItem.class); tableModel.addColumn(POSConstants.ID.toUpperCase(), "id"); // $NON-NLS-1$ tableModel.addColumn(POSConstants.NAME.toUpperCase(), "name"); // $NON-NLS-1$ tableModel.addColumn( POSConstants.TRANSLATED_NAME.toUpperCase(), "translatedName"); // $NON-NLS-1$ tableModel.addColumn( POSConstants.PRICE.toUpperCase() + " (" + Application.getCurrencySymbol() + ")", "price"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ tableModel.addColumn(POSConstants.VISIBLE.toUpperCase(), "visible"); // $NON-NLS-1$ tableModel.addColumn( POSConstants.DISCOUNT.toUpperCase() + "(%)", "discountRate"); // $NON-NLS-1$ //$NON-NLS-2$ tableModel.addColumn(POSConstants.FOOD_GROUP.toUpperCase(), "parent"); // $NON-NLS-1$ tableModel.addColumn(POSConstants.TAX.toUpperCase(), "tax"); // $NON-NLS-1$ tableModel.addColumn(POSConstants.SORT_ORDER.toUpperCase(), "sortOrder"); // $NON-NLS-1$ tableModel.addColumn(POSConstants.BUTTON_COLOR.toUpperCase(), "buttonColor"); // $NON-NLS-1$ tableModel.addColumn(POSConstants.TEXT_COLOR.toUpperCase(), "textColor"); // $NON-NLS-1$ tableModel.addColumn(POSConstants.IMAGE.toUpperCase(), "imageData"); // $NON-NLS-1$ tableModel.addRows(MenuItemDAO.getInstance().findAll()); table = new JXTable(tableModel); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setRowHeight(30); table.setDefaultRenderer(Object.class, new CustomCellRenderer()); table .getColumnModel() .getColumn(10) .setCellRenderer( new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof Color) { JLabel lblColor = new JLabel("TEXT COLOR", JLabel.CENTER); lblColor.setForeground((Color) value); return lblColor; } return super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); } }); setLayout(new BorderLayout(5, 5)); add(new JScrollPane(table)); add(createButtonPanel(), BorderLayout.SOUTH); add(buildSearchForm(), BorderLayout.NORTH); }
public CartPaymentReportModel() { super(); currencySymbol = Application.getCurrencySymbol(); }
public SalesReportModel() { super(); currencySymbol = Application.getCurrencySymbol(); }