private void payOrder() { // Check if order is completed, if so, print and open drawer, create an empty order and set // cashGiven to zero if (p_posPanel.m_order != null) { if (!p_posPanel.m_order.isProcessed() && !p_posPanel.m_order.processOrder()) { ADialog.warn(0, p_posPanel, "PosOrderProcessFailed"); return; } if (PosPayment.pay(p_posPanel)) { printTicket(); p_posPanel.setOrder(0); } } }
/** * ActionListener * * @param e ActionEvent */ public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { if (fAddress1.isMandatory() && ((((String) fAddress1.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else if (fAddress2.isMandatory() && ((((String) fAddress2.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else if (fAddress3.isMandatory() && ((((String) fAddress3.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else if (fPostal.isMandatory() && ((((String) fPostal.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else { action_OK(); m_change = true; dispose(); } } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) { m_change = false; dispose(); } else if (e.getSource() == fCountry) { // Country Changed - display in new Format // Modifier for Mouse selection is 16 - for any key selection 0 MCountry c = (MCountry) fCountry.getSelectedItem(); m_location.setCountry(c); // refrseh mainPanel.removeAll(); initLocation(); fCountry.requestFocus(); // allows to use Keybord selection } // Kenos else if (e.getSource() == fRegion) { // Modifier for Mouse selection is 16 - for any key selection 0 MRegion r = (MRegion) fRegion.getSelectedItem(); m_location.setRegion(r); // refrseh mainPanel.removeAll(); initLocation(); fRegion.requestFocus(); // allows to use Keybord selection } // Kenos else if (e.getSource() == toLink) { String urlString = GOOGLE_MAPS_URL_PREFIX + getGoogleMapsLocation(m_location); String message = null; try { new URL(urlString); Env.startBrowser(urlString); } catch (Exception ex) { message = ex.getMessage(); ADialog.warn(0, this, "URLnotValid", message); } } else if (e.getSource() == toRoute) { int AD_Org_ID = Env.getAD_Org_ID(Env.getCtx()); if (AD_Org_ID != 0) { MOrgInfo orgInfo = MOrgInfo.get(Env.getCtx(), AD_Org_ID, null); MLocation orgLocation = new MLocation(Env.getCtx(), orgInfo.getC_Location_ID(), null); String urlString = GOOGLE_MAPS_ROUTE_PREFIX + GOOGLE_SOURCE_ADDRESS + getGoogleMapsLocation(orgLocation) + // org GOOGLE_DESTINATION_ADDRESS + getGoogleMapsLocation(m_location); // partner String message = null; try { new URL(urlString); Env.startBrowser(urlString); } catch (Exception ex) { message = ex.getMessage(); ADialog.warn(0, this, "URLnotValid", message); } } } else if (e.getSource() == getAddress) { if (fPostal != null && !fPostal.getText().equals("")) { if (!fAddress1.getText().equals("") || !fAddress2.getText().equals("") || !fAddress3.getText().equals("") || !fAddress4.getText().equals("") || fCity.getSelectedIndex() > 0) { String warningMsg = "O endereço atual será substituido. Deseja continuar?"; String warningTitle = "Aviso"; int response = JOptionPane.showConfirmDialog( null, warningMsg, warningTitle, JOptionPane.YES_NO_OPTION); if (response == JOptionPane.NO_OPTION) return; } WebServiceCep cep = WebServiceCep.searchCep(fPostal.getText()); if (cep.wasSuccessful()) { MRegion[] regions = MRegion.getRegions(Env.getCtx(), 139); for (MRegion r : regions) if (r.getName() != null && r.getName().equals(cep.getUf())) { fRegion.setSelectedItem(r); break; } fCity.setSelectedItem(cep.getCidade()); fAddress1.setText(cep.getLogradouroType() + " " + cep.getLogradouro()); fAddress3.setText(cep.getBairro()); if (cep.getCep().length() == 8) fPostal.setText(cep.getCep().substring(0, 5) + "-" + cep.getCep().substring(5)); else fPostal.setText(cep.getCep()); } else if (cep.getResulCode() == 0) JOptionPane.showMessageDialog(null, "CEP não encontrado na base de dados."); else if (cep.getResulCode() == 14) JOptionPane.showMessageDialog( null, "Não foi possível fazer a busca. (Possível problema com a Internet)."); else JOptionPane.showMessageDialog(null, "Erro ao fazer a busca."); } else JOptionPane.showMessageDialog(null, "Preencha o CEP."); } } // actionPerformed
/** Shows the searched order condition */ private void showCreditNotificationCondition() { ADialog.warn( m_WindowNo, this.mainPanel, Msg.translate(Env.getCtx(), "XX_NoNotificationsForFilter")); }