VPayment.java

Index Score
org.compiere.grid
Compiere

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
EXEC_COMMENTSComments in executable code
JAVA0034JAVA0034 Missing braces in if statement
OPERANDSNumber of operands
LINE_COMMENTNumber of line comments
PROGRAM_LENGTHHalstead program length
OPERATORSNumber of operators
LOGICAL_LINESNumber of statements
COMPARISONSNumber of comparison operators
SIZESize of the file in bytes
ELOCEffective lines of code
LOCLines of code
EXITSProcedure exits
CYCLOMATICCyclomatic complexity
LINESNumber of lines in the source file
UNIQUE_OPERANDSNumber of unique operands
PROGRAM_VOCABHalstead program vocabulary
JAVA0145JAVA0145 Tab character used in source file
DECL_COMMENTSComments in declarations
BLOCKSNumber of blocks
JAVA0076JAVA0076 Use of magic number
COMMENTSComment lines
DOC_COMMENTNumber of javadoc comment lines
LOOPSNumber of loops
JAVA0160JAVA0160 Method does not throw specified exception
JAVA0049JAVA0049 Nested block at depth N (maximum: M)
JAVA0270JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0071JAVA0071 Strings compared with ==
JAVA0117JAVA0117 Missing javadoc: method 'method'
UNIQUE_OPERATORSNumber of unique operators
NEST_DEPTHMaximum nesting depth
PROGRAM_VOLUMEHalstead program volume
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
INTERFACE_COMPLEXITYInterface complexity
PARAMSNumber of formal parameter declarations
JAVA0130JAVA0130 Non-static method does not use instance fields
JAVA0003JAVA0003 Minimize use of on-demand (.*) imports
FUNCTIONSNumber of function declarations
/****************************************************************************** * Product: Compiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ package org.compiere.grid; import java.awt.*; import java.awt.event.*; import java.math.*; import java.sql.*; import java.text.*; import java.util.*; import java.util.logging.*; import javax.swing.*; import org.compiere.apps.*; import org.compiere.common.constants.*; import org.compiere.grid.ed.*; import org.compiere.model.*; import org.compiere.plaf.*; import org.compiere.process.*; import org.compiere.swing.*; import org.compiere.util.*; /** * Display (and process) Payment Options. * <pre> * Payment Rule * -B- Cash (Date) -> Cash Entry * -P- Payment Term (Term) * -S- Check (Routing, ..) -> Payment Entry * -K- CreditCard (No) -> Payment Entry * -U- ACH Transfer (Routing) -> Payment Entry * * When processing: * - If an invoice is a S/K/U, but has no Payment Entry, it is changed to P * - If an invoive is B and has no Cash Entry, it is created * - An invoice is "Open" if it is "P" and no Payment * * Entry: * - If not processed, an invoice has no Cash or Payment entry * - The entry is created, during "Online" and when Saving * * Changes/Reversals: * - existing Cash Entries are reversed and newly created * - existing Payment Entries are not changed and then "hang there" and need to be allocated * </pre> * * @author Jorg Janke * @version $Id: VPayment.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $ */ public class VPayment extends CDialog implements ActionListener { /** * */ private static final long serialVersionUID = 1L; /** * Constructor * * @param WindowNo owning window * @param mTab owning tab * @param button button with access information */ public VPayment (int WindowNo, GridTab mTab, VButton button) { super(Env.getWindow(WindowNo), Msg.getMsg(Env.getCtx(), "Payment"), true); m_WindowNo = WindowNo; m_isSOTrx = Env.getCtx().isSOTrx(WindowNo); m_mTab = mTab; try { bDateField = new VDate("DateAcct", false, false, true, DisplayType.Date, "DateAcct"); jbInit(); m_initOK = dynInit(button); // Null Pointer if order/invoice not saved yet } catch(Exception ex) { log.log(Level.SEVERE, "VPayment", ex); m_initOK = false; } // AEnv.positionCenterWindow(Env.getWindow(WindowNo), this); } // VPayment /** Window */ private int m_WindowNo = 0; /** Tab */ private GridTab m_mTab; // Data from Order/Invoice private String m_DocStatus = null; /** Start Payment Rule */ private String m_PaymentRule = ""; /** Start Payment Term */ private int m_C_PaymentTerm_ID = 0; /** Start Acct Date */ private Timestamp m_DateAcct = null; /** Start Payment */ private int m_C_Payment_ID = 0; private MPayment m_mPayment = null; private MPayment m_mPaymentOriginal = null; /** Start CashBook Line */ private int m_C_CashLine_ID = 0; private MCashLine m_cashLine = null; /** Start CreditCard */ private String m_CCType = ""; /** Own Bank Account */ private int m_C_BankAccount_ID = 0; /** Start CashBook */ private int m_C_CashBook_ID = 0; /** Is SOTrx */ private boolean m_isSOTrx = true; /** BP Bank Account */ private MBPBankAccount m_bpba = null; /** Invoice Currency */ private int m_C_Currency_ID = 0; private int m_AD_Client_ID = 0; private int m_AD_Org_ID = 0; private int m_C_BPartner_ID = 0; private BigDecimal m_Amount = Env.ZERO; // Payment Amount // private boolean m_initOK = false; /** Only allow changing Rule */ private boolean m_onlyRule = false; private DecimalFormat m_Format = DisplayType.getNumberFormat(DisplayTypeConstants.Amount); private static Hashtable<Integer,KeyNamePair> s_Currencies = null; // EMU Currencies private boolean m_needSave = false; /** Logger */ private static CLogger log = CLogger.getCLogger(VPayment.class); // private CPanel mainPanel = new CPanel(); private BorderLayout mainLayout = new BorderLayout(); private CPanel northPanel = new CPanel(); private CPanel centerPanel = new CPanel(); private FlowLayout northLayout = new FlowLayout(); private CComboBox paymentCombo = new CComboBox(); private CLabel paymentLabel = new CLabel(); private CardLayout centerLayout = new CardLayout(); private CPanel bPanel = new CPanel(); private CPanel kPanel = new CPanel(); private GridBagLayout kLayout = new GridBagLayout(); private CLabel kTypeLabel = new CLabel(); private CComboBox kTypeCombo = new CComboBox(); private CLabel kNumnerLabel = new CLabel(); private CTextField kNumberField = new CTextField(); private CLabel kExpLabel = new CLabel(); private CTextField kExpField = new CTextField(); private CLabel kApprovalLabel = new CLabel(); private CTextField kApprovalField = new CTextField(); private CPanel tPanel = new CPanel(); private CLabel tAccountLabel = new CLabel(); private CComboBox tAccountCombo = new CComboBox(); private CLabel tBankNameLabel = new CLabel(); private CTextField tBankNameField = new CTextField(20); private CLabel tBankCityLabel = new CLabel(); private CTextField tBankCityField = new CTextField(20); private CLabel tRoutingNoLabel = new CLabel(); private CTextField tRoutingNoField = new CTextField(20); private CLabel tAccountNoLabel = new CLabel(); private CTextField tAccountNoField = new CTextField(20); private CLabel tIBANLabel = new CLabel(); private CTextField tIBANField = new CTextField(20); // private CPanel sPanel = new CPanel(); private GridBagLayout sPanelLayout = new GridBagLayout(); private CLabel sNumberLabel = new CLabel(); private CTextField sNumberField = new CTextField(); private CLabel sRoutingLabel = new CLabel(); private CTextField sRoutingField = new CTextField(); private CLabel sCurrencyLabel = new CLabel(); private CComboBox sCurrencyCombo = new CComboBox(); // private CLabel bCurrencyLabel = new CLabel(); private CComboBox bCurrencyCombo = new CComboBox(); private CPanel pPanel = new CPanel(); private CLabel pTermLabel = new CLabel(); private CComboBox pTermCombo = new CComboBox(); private GridBagLayout bPanelLayout = new GridBagLayout(); private CLabel bAmountLabel = new CLabel(); private CLabel bAmountField = new CLabel(); private CLabel sAmountLabel = new CLabel(); private CLabel sAmountField = new CLabel(); private VDate bDateField; private CLabel bDateLabel = new CLabel(); private ConfirmPanel confirmPanel = new ConfirmPanel(true); private CTextField sCheckField = new CTextField(); private CLabel sCheckLabel = new CLabel(); private CButton kOnline = new CButton(); private CButton sOnline = new CButton(); private CComboBox sBankAccountCombo = new CComboBox(); private CLabel sBankAccountLabel = new CLabel(); private GridBagLayout pPanelLayout = new GridBagLayout(); private CLabel bCashBookLabel = new CLabel(); private CComboBox bCashBookCombo = new CComboBox(); private GridBagLayout tPanelLayout = new GridBagLayout(); private CLabel kStatus = new CLabel(); private CLabel tStatus = new CLabel(); private CLabel sStatus = new CLabel(); /** * Static Init * @throws Exception */ private void jbInit() throws Exception { centerPanel.setBorder(BorderFactory.createRaisedBevelBorder()); getContentPane().add(mainPanel); mainPanel.setLayout(mainLayout); mainPanel.add(centerPanel, BorderLayout.CENTER); // northPanel.setLayout(northLayout); paymentLabel.setText(Msg.translate(Env.getCtx(), "PaymentRule")); mainPanel.add(northPanel, BorderLayout.NORTH); northPanel.add(paymentLabel, null); northPanel.add(paymentCombo, null); // centerPanel.setLayout(centerLayout); // CreditCard kPanel.setLayout(kLayout); kNumberField.setPreferredSize(new Dimension(120, 21)); kExpField.setPreferredSize(new Dimension(40, 21)); kApprovalField.setPreferredSize(new Dimension(120, 21)); kTypeLabel.setText(Msg.translate(Env.getCtx(), "CreditCardType")); kNumnerLabel.setText(Msg.translate(Env.getCtx(), "CreditCardNumber")); kExpLabel.setText(Msg.getMsg(Env.getCtx(), "Expires")); kApprovalLabel.setText(Msg.translate(Env.getCtx(), "VoiceAuthCode")); kOnline.setText(Msg.getMsg(Env.getCtx(), "Online")); kOnline.addActionListener(this); kStatus.setText(" "); centerPanel.add(kPanel, "kPanel"); centerLayout.addLayoutComponent(kPanel, "kPanel"); kPanel.add(kTypeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); kPanel.add(kTypeCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); kPanel.add(kNumnerLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); kPanel.add(kNumberField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 5, 2, 5), 0, 0)); kPanel.add(kExpLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); kPanel.add(kExpField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); kPanel.add(kApprovalLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0)); kPanel.add(kApprovalField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); kPanel.add(kStatus, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); kPanel.add(kOnline, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // DircetDebit/Credit tPanel.setLayout(tPanelLayout); tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID")); tBankNameLabel.setText(Msg.translate(Env.getCtx(), "A_Name")); tBankCityLabel.setText(Msg.translate(Env.getCtx(), "A_City")); tAccountNoLabel.setText(Msg.translate(Env.getCtx(), "AccountNo")); tRoutingNoLabel.setText(Msg.translate(Env.getCtx(), "RoutingNo")); tIBANLabel.setText(Msg.translate(Env.getCtx(), "IBAN")); tStatus.setText(" "); centerPanel.add(tPanel, "tPanel"); centerLayout.addLayoutComponent(tPanel, "tPanel"); tPanel.add(tAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0)); tPanel.add(tAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); tPanel.add(tBankNameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0)); tPanel.add(tBankNameField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); tPanel.add(tBankCityLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); tPanel.add(tBankCityField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); tPanel.add(tAccountNoLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0)); tPanel.add(tAccountNoField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); tPanel.add(tRoutingNoLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); tPanel.add(tRoutingNoField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); tPanel.add(tIBANLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); tPanel.add(tIBANField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); tPanel.add(tStatus, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // sPanel.setLayout(sPanelLayout); sBankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID")); sAmountLabel.setText(Msg.getMsg(Env.getCtx(), "Amount")); sAmountField.setText(""); sRoutingLabel.setText(Msg.translate(Env.getCtx(), "RoutingNo")); sNumberLabel.setText(Msg.translate(Env.getCtx(), "AccountNo")); sCheckLabel.setText(Msg.translate(Env.getCtx(), "CheckNo")); sCheckField.setColumns(8); sCurrencyLabel.setText(Msg.translate(Env.getCtx(), "C_Currency_ID")); sNumberField.setPreferredSize(new Dimension(100, 21)); sRoutingField.setPreferredSize(new Dimension(70, 21)); sStatus.setText(" "); sOnline.setText(Msg.getMsg(Env.getCtx(), "Online")); centerPanel.add(sPanel, "sPanel"); centerLayout.addLayoutComponent(sPanel, "sPanel"); sPanel.add(sCurrencyLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); sPanel.add(sCurrencyCombo, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); sPanel.add(sRoutingField, new GridBagConstraints(1, 4, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 2, 0), 0, 0)); sPanel.add(sNumberField, new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 2, 0), 0, 0)); sPanel.add(sCheckField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 0), 0, 0)); sPanel.add(sRoutingLabel, new GridBagConstraints(0, 3, 1, 2, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 2, 0), 0, 0)); sPanel.add(sNumberLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); sPanel.add(sCheckLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); sPanel.add(sBankAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0)); sPanel.add(sBankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 2, 0), 0, 0)); sPanel.add(sStatus, new GridBagConstraints(0, 7, 3, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); sPanel.add(sOnline, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); sPanel.add(sAmountField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0)); sPanel.add(sAmountLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0)); // pPanel.setLayout(pPanelLayout); pTermLabel.setText(Msg.translate(Env.getCtx(), "C_PaymentTerm_ID")); centerPanel.add(pPanel, "pPanel"); centerLayout.addLayoutComponent(pPanel, "pPanel"); pPanel.add(pTermLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 0), 0, 0)); pPanel.add(pTermCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); // bCashBookLabel.setText(Msg.translate(Env.getCtx(), "C_CashBook_ID")); bCurrencyLabel.setText(Msg.translate(Env.getCtx(), "C_Currency_ID")); bPanel.setLayout(bPanelLayout); bAmountLabel.setText(Msg.getMsg(Env.getCtx(), "Amount")); bAmountField.setText(""); bDateLabel.setText(Msg.translate(Env.getCtx(), "DateAcct")); centerLayout.addLayoutComponent(bPanel, "bPanel"); centerPanel.add(bPanel, "bPanel"); bPanel.add(bCurrencyLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); bPanel.add(bCurrencyCombo, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); bPanel.add(bDateField, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0)); bPanel.add(bDateLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 2, 0), 0, 0)); bPanel.add(bCashBookLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); bPanel.add(bCashBookCombo, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); bPanel.add(bAmountLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 2, 0), 0, 0)); bPanel.add(bAmountField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0)); // mainPanel.add(confirmPanel, BorderLayout.SOUTH); confirmPanel.addActionListener(this); } // jbInit /************************************************************************** * Dynamic Init. * B (Cash) (Currency) * K (CreditCard) Type, Number, Exp, Approval * L (DirectDebit) BPartner_Bank * P (PaymentTerm) PaymentTerm * S (Check) (Currency) CheckNo, Routing * * Currencies are shown, if member of EMU * @param button payment type button * @return true if init OK * @throws Exception */ private boolean dynInit (VButton button) throws Exception { m_DocStatus = (String)m_mTab.getValue("DocStatus"); log.config(m_DocStatus); if (m_mTab.getValue("C_BPartner_ID") == null) { ADialog.error(0, this, "SaveErrorRowNotFound"); return false; } // Is the Trx posted? // String Posted = (String)m_mTab.getValue("Posted"); // if (Posted != null && Posted.equals("Y")) // return false; // DocStatus m_DocStatus = (String)m_mTab.getValue("DocStatus"); if (m_DocStatus == null) m_DocStatus = ""; // Is the Trx closed? Reversed / Voided if (m_DocStatus.equals("RE") || m_DocStatus.equals("VO")) return false; // Document is not complete - allow to change the Payment Rule only if (m_DocStatus.equals("CO") || m_DocStatus.equals("WP") || m_DocStatus.equals("CL")) m_onlyRule = false; else m_onlyRule = true; // PO only Rule if (!m_onlyRule // Only order has Warehouse && !m_isSOTrx && m_mTab.getValue("M_Warehouse_ID") != null) m_onlyRule = true; centerPanel.setVisible(!m_onlyRule); // Amount m_Amount = (BigDecimal)m_mTab.getValue("GrandTotal"); if (!m_onlyRule && m_Amount.compareTo(Env.ZERO) == 0) { ADialog.error(m_WindowNo, this, "PaymentZero"); return false; } bAmountField.setText(m_Format.format(m_Amount)); sAmountField.setText(m_Format.format(m_Amount)); /** * Get Data from Grid */ m_AD_Client_ID = ((Integer)m_mTab.getValue("AD_Client_ID")).intValue(); m_AD_Org_ID = ((Integer)m_mTab.getValue("AD_Org_ID")).intValue(); if( m_mTab.getValue("Bill_BPartner_ID") != null ) m_C_BPartner_ID = ((Integer)m_mTab.getValue("Bill_BPartner_ID")).intValue(); if( m_C_BPartner_ID == 0 ) m_C_BPartner_ID = ((Integer)m_mTab.getValue("C_BPartner_ID")).intValue(); m_PaymentRule = (String)m_mTab.getValue("PaymentRule"); m_C_Currency_ID = ((Integer)m_mTab.getValue("C_Currency_ID")).intValue(); m_DateAcct = (Timestamp)m_mTab.getValue("DateAcct"); if (m_mTab.getValue("C_PaymentTerm_ID") != null) m_C_PaymentTerm_ID = ((Integer)m_mTab.getValue("C_PaymentTerm_ID")).intValue(); // Existing Payment if (m_mTab.getValue("C_Payment_ID") != null) { m_C_Payment_ID = ((Integer)m_mTab.getValue("C_Payment_ID")).intValue(); if (m_C_Payment_ID != 0) { m_mPayment = new MPayment(Env.getCtx(), m_C_Payment_ID, null); m_mPaymentOriginal = new MPayment(Env.getCtx(), m_C_Payment_ID, null); // full copy // CreditCard m_CCType = m_mPayment.getCreditCardType(); kNumberField.setText(m_mPayment.getCreditCardNumber()); kExpField.setText(m_mPayment.getCreditCardExp(null)); kApprovalField.setText(m_mPayment.getVoiceAuthCode()); kStatus.setText(m_mPayment.getR_PnRef()); boolean canChange = !m_mPayment.isApproved() || !(m_PaymentRule==MOrder.PAYMENTRULE_CreditCard); // if approved/paid, don't let it change kTypeCombo.setReadWrite(canChange); kNumberField.setReadWrite(canChange); kExpField.setReadWrite(canChange); kApprovalField.setReadWrite(canChange); kOnline.setReadWrite(canChange); // Check m_C_BankAccount_ID = m_mPayment.getC_BankAccount_ID(); sRoutingField.setText(m_mPayment.getRoutingNo()); sNumberField.setText(m_mPayment.getAccountNo()); sCheckField.setText(m_mPayment.getCheckNo()); sStatus.setText(m_mPayment.getR_PnRef()); // Transfer tStatus.setText(m_mPayment.getR_PnRef()); } } if (m_mPayment == null) { m_mPayment = new MPayment (Env.getCtx (), 0, null); m_mPayment.setAD_Org_ID(m_AD_Org_ID); m_mPayment.setIsReceipt(m_isSOTrx); m_mPayment.setAmount (m_C_Currency_ID, m_Amount); } // Existing Cash book entry m_cashLine = null; m_C_CashLine_ID = 0; m_C_CashBook_ID = 0; if (m_mTab.getValue("C_CashLine_ID") != null) { m_C_CashLine_ID = ((Integer)m_mTab.getValue("C_CashLine_ID")).intValue(); if (m_C_CashLine_ID == 0) m_cashLine = null; else { m_cashLine = new MCashLine (Env.getCtx(), m_C_CashLine_ID, null); m_DateAcct = m_cashLine.getStatementDate(); m_C_CashBook_ID = m_cashLine.getC_CashBook_ID(); } } // Accounting Date bDateField.setValue(m_DateAcct); if (s_Currencies == null) loadCurrencies(); // Is the currency an EMU currency? Integer C_Currency_ID = new Integer(m_C_Currency_ID); if (s_Currencies.containsKey(C_Currency_ID)) { Enumeration<Integer> en = s_Currencies.keys(); while (en.hasMoreElements()) { Object key = en.nextElement(); bCurrencyCombo.addItem(s_Currencies.get(key)); sCurrencyCombo.addItem(s_Currencies.get(key)); } sCurrencyCombo.addActionListener(this); sCurrencyCombo.setSelectedItem(s_Currencies.get(C_Currency_ID)); bCurrencyCombo.addActionListener(this); bCurrencyCombo.setSelectedItem(s_Currencies.get(C_Currency_ID)); } else // No EMU Currency { bCurrencyLabel.setVisible(false); // Cash bCurrencyCombo.setVisible(false); sCurrencyLabel.setVisible(false); // Check sCurrencyCombo.setVisible(false); } /** * Payment Combo */ if (m_PaymentRule == null) m_PaymentRule = ""; ValueNamePair vp = null; HashMap<String, String> values = button.getValues(); Object[] a = values.keySet().toArray(); for (int i = 0; i < a.length; i++) { String PaymentRule = (String)a[i]; // used for Panel selection if (X_C_Order.PAYMENTRULE_DirectDebit.equals(PaymentRule) // SO && !m_isSOTrx) continue; else if (X_C_Order.PAYMENTRULE_DirectDeposit.equals(PaymentRule) // PO && m_isSOTrx) continue; ValueNamePair pp = new ValueNamePair(PaymentRule, (String)values.get(a[i])); paymentCombo.addItem(pp); if (PaymentRule.toString().equals(m_PaymentRule)) // to select vp = pp; } // Set PaymentRule paymentCombo.addActionListener(this); if (vp != null) paymentCombo.setSelectedItem(vp); /** * Load Payment Terms */ String SQL = MRole.getDefault().addAccessSQL( "SELECT C_PaymentTerm_ID, Name FROM C_PaymentTerm WHERE IsActive='Y' ORDER BY Name", "C_PaymentTerm", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); KeyNamePair kp = null; try { PreparedStatement pstmt = DB.prepareStatement(SQL, null); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { int key = rs.getInt(1); String name = rs.getString(2); KeyNamePair pp = new KeyNamePair(key, name); pTermCombo.addItem(pp); if (key == m_C_PaymentTerm_ID) kp = pp; } rs.close(); pstmt.close(); } catch (SQLException ept) { log.log(Level.SEVERE, SQL, ept); } // Set Selection if (kp != null) pTermCombo.setSelectedItem(kp); /** * Load BP Bank Accounts */ SQL = "SELECT a.C_BP_BankAccount_ID, NVL(b.Name, ' ')||a.AccountNo AS Acct " + "FROM C_BP_BankAccount a" + " LEFT OUTER JOIN C_Bank b ON (a.C_Bank_ID=b.C_Bank_ID) " + "WHERE C_BPartner_ID=?" + "AND a.IsActive='Y' AND a.IsACH='Y'"; kp = null; tAccountCombo.addItem(new KeyNamePair(0,"")); try { PreparedStatement pstmt = DB.prepareStatement(SQL, null); pstmt.setInt(1, m_C_BPartner_ID); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { int key = rs.getInt(1); String name = rs.getString(2); KeyNamePair pp = new KeyNamePair(key, name); tAccountCombo.addItem(pp); if (kp == null) kp = pp; } rs.close(); pstmt.close(); } catch (SQLException eac) { log.log(Level.SEVERE, SQL, eac); } // Set Selection tAccountCombo.addActionListener(this); if (kp != null) tAccountCombo.setSelectedItem(kp); /** * Load Credit Cards */ ValueNamePair[] ccs = m_mPayment.getCreditCards(); vp = null; for (int i = 0; i < ccs.length; i++) { kTypeCombo.addItem(ccs[i]); if (ccs[i].getValue().equals(m_CCType)) vp = ccs[i]; } // Set Selection if (vp != null) kTypeCombo.setSelectedItem(vp); /** * Load Bank Accounts */ SQL = MRole.getDefault().addAccessSQL( "SELECT C_BankAccount_ID, Name || ' ' || AccountNo, IsDefault " + "FROM C_BankAccount ba" + " INNER JOIN C_Bank b ON (ba.C_Bank_ID=b.C_Bank_ID) " + "WHERE b.IsActive='Y'", "ba", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); kp = null; try { PreparedStatement pstmt = DB.prepareStatement(SQL, null); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { int key = rs.getInt(1); String name = rs.getString(2); KeyNamePair pp = new KeyNamePair(key, name); sBankAccountCombo.addItem(pp); if (key == m_C_BankAccount_ID) kp = pp; if (kp == null && rs.getString(3).equals("Y")) // Default kp = pp; } rs.close(); pstmt.close(); } catch (SQLException ept) { log.log(Level.SEVERE, SQL, ept); } // Set Selection if (kp != null) sBankAccountCombo.setSelectedItem(kp); /** * Load Cash Books */ SQL = MRole.getDefault().addAccessSQL( "SELECT C_CashBook_ID, Name, AD_Org_ID FROM C_CashBook WHERE IsActive='Y'", "C_CashBook", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); kp = null; try { PreparedStatement pstmt = DB.prepareStatement(SQL, null); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { int key = rs.getInt(1); String name = rs.getString(2); KeyNamePair pp = new KeyNamePair(key, name); bCashBookCombo.addItem(pp); if (key == m_C_CashBook_ID) kp = pp; if (kp == null && rs.getInt(3) == m_AD_Org_ID) // Default Org kp = pp; } rs.close(); pstmt.close(); } catch (SQLException epc) { log.log(Level.SEVERE, SQL, epc); } // Set Selection if (kp != null) { bCashBookCombo.setSelectedItem(kp); if (m_C_CashBook_ID == 0) m_C_CashBook_ID = kp.getKey(); // set to default to avoid 'cashbook changed' message } // return true; } // dynInit /** * Init OK to be able to make changes? * @return true if init OK */ public boolean isInitOK() { return m_initOK; } // isInitOK /** * Fill s_Currencies with EMU currencies */ private void loadCurrencies() { s_Currencies = new Hashtable<Integer,KeyNamePair>(12); // Currently only 10+1 String SQL = "SELECT C_Currency_ID, ISO_Code FROM C_Currency " + "WHERE (IsEMUMember='Y' AND EMUEntryDate<SysDate) OR IsEuro='Y' " + "ORDER BY 2"; try { PreparedStatement pstmt = DB.prepareStatement(SQL, null); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { int id = rs.getInt(1); String name = rs.getString(2); s_Currencies.put(new Integer(id), new KeyNamePair(id, name)); } rs.close(); pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, SQL, e); } } // loadCurrencies /************************************************************************** * Action Listener * @param e event */ public void actionPerformed(ActionEvent e) { // log.fine( "VPayment.actionPerformed - " + e.getActionCommand()); // Finish if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { if (checkMandatory()) { saveChanges (); // cannot recover dispose (); } } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) dispose(); // Payment Method Change else if (e.getSource() == paymentCombo) { // get selection ValueNamePair pp = (ValueNamePair)paymentCombo.getSelectedItem(); if (pp != null) { String s = pp.getValue().toLowerCase(); if (X_C_Order.PAYMENTRULE_DirectDebit.equalsIgnoreCase(s)) s = X_C_Order.PAYMENTRULE_DirectDeposit.toLowerCase(); s += "Panel"; centerLayout.show(centerPanel, s); // switch to panel } } // Check Currency change else if (e.getSource() == sCurrencyCombo) { KeyNamePair pp = (KeyNamePair)sCurrencyCombo.getSelectedItem(); BigDecimal amt = MConversionRate.convert(Env.getCtx(), m_Amount, m_C_Currency_ID, pp.getKey(), m_AD_Client_ID, m_AD_Org_ID); sAmountField.setText(m_Format.format(amt)); } // Cash Currency change else if (e.getSource() == bCurrencyCombo) { KeyNamePair pp = (KeyNamePair)bCurrencyCombo.getSelectedItem(); BigDecimal amt = MConversionRate.convert(Env.getCtx(), m_Amount, m_C_Currency_ID, pp.getKey(), m_AD_Client_ID, m_AD_Org_ID); bAmountField.setText(m_Format.format(amt)); } // Bank Account else if (e.getSource() == tAccountCombo) { KeyNamePair pp = (KeyNamePair)tAccountCombo.getSelectedItem(); m_bpba = null; if (pp != null && pp.getKey() > 0) m_bpba = MBPBankAccount.get(Env.getCtx(), pp.getKey()); if (m_bpba != null) { tBankNameField.setText(m_bpba.getA_Name(true)); tBankCityField.setText(m_bpba.getA_City(true)); tAccountNoField.setText(m_bpba.getAccountNo()); tRoutingNoField.setText(m_bpba.getRoutingNo()); tIBANField.setText(m_bpba.getIBAN()); } else { tBankNameField.setText(null); tBankCityField.setText(null); tAccountNoField.setText(null); tRoutingNoField.setText(null); tIBANField.setText(null); } } // Online else if (e.getSource() == kOnline || e.getSource() == sOnline) processOnline(); } // actionPerformed /************************************************************************** * Save Changes * @return true, if eindow can exit */ private boolean saveChanges() { ValueNamePair vp = (ValueNamePair)paymentCombo.getSelectedItem(); String newPaymentRule = vp.getValue(); log.info("New Rule: " + newPaymentRule); // only Payment Rule if (m_onlyRule) { if (!newPaymentRule.equals(m_PaymentRule)) m_mTab.setValue("PaymentRule", newPaymentRule); return true; } // New Values Timestamp newDateAcct = m_DateAcct; int newC_PaymentTerm_ID = m_C_PaymentTerm_ID; int newC_CashLine_ID = m_C_CashLine_ID; int newC_CashBook_ID = m_C_CashBook_ID; String newCCType = m_CCType; int newC_BankAccount_ID = 0; // B (Cash) (Currency) if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash)) { KeyNamePair kp = (KeyNamePair)bCashBookCombo.getSelectedItem(); if (kp != null) newC_CashBook_ID = kp.getKey(); newDateAcct = (Timestamp)bDateField.getValue(); } // K (CreditCard) Type, Number, Exp, Approval else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_CreditCard)) { vp = (ValueNamePair)kTypeCombo.getSelectedItem(); if (vp != null) newCCType = vp.getValue(); } // T (Transfer) BPartner_Bank else if (newPaymentRule.equals(MOrder.PAYMENTRULE_DirectDeposit) || newPaymentRule.equals(MOrder.PAYMENTRULE_DirectDebit) ) { // KeyNamePair kp = (KeyNamePair)tAccountCombo.getSelectedItem(); String tAccountNo = tAccountNoField.getText(); String tRoutingNo = tRoutingNoField.getText(); String tIBAN = tIBANField.getText(); if (m_bpba == null) { m_bpba = new MBPBankAccount(Env.getCtx(), m_C_BPartner_ID, tAccountNo, tRoutingNo, tIBAN, null); m_bpba.setA_Name(tBankNameField.getText()); m_bpba.setA_City(tBankCityField.getText()); m_bpba.save(); } else { m_bpba.setA_Name(tBankNameField.getText()); m_bpba.setA_City(tBankCityField.getText()); if (m_bpba.updateInfo(tAccountNo, tRoutingNo, tIBAN)) m_bpba.save(); } // only save if Transfer m_mTab.setValue("C_BP_BankAccount_ID", new Integer(m_bpba.getC_BP_BankAccount_ID())); } // P (PaymentTerm) PaymentTerm else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit)) { KeyNamePair kp = (KeyNamePair)pTermCombo.getSelectedItem(); if (kp != null) newC_PaymentTerm_ID = kp.getKey(); } // S (Check) (Currency) CheckNo, Routing else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Check)) { // sCurrencyCombo.getSelectedItem(); KeyNamePair kp = (KeyNamePair)sBankAccountCombo.getSelectedItem(); if (kp != null) newC_BankAccount_ID = kp.getKey(); } else return false; // find Bank Account if not qualified yet if ("KTSD".indexOf(newPaymentRule) != -1 && newC_BankAccount_ID == 0) { if (newPaymentRule.equals(MOrder.PAYMENTRULE_DirectDeposit)) { } else if (newPaymentRule.equals(MOrder.PAYMENTRULE_DirectDebit)) { } else if (newPaymentRule.equals(MOrder.PAYMENTRULE_Check)) { } } /*********************** * Changed PaymentRule */ if (!newPaymentRule.equals(m_PaymentRule)) { log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + newPaymentRule); // We had a CashBook Entry if (m_PaymentRule.equals(X_C_Order.PAYMENTRULE_Cash)) { log.fine("Old Cash - " + m_cashLine); if (m_cashLine != null) { MCashLine cl = m_cashLine.createReversal(); if (cl.save()) log.config( "CashCancelled"); else ADialog.error(m_WindowNo, this, "PaymentError", "CashNotCancelled"); } newC_CashLine_ID = 0; // reset } // We had a change in Payment type (e.g. Check to CC) else if ("KTSD".indexOf(m_PaymentRule) != -1 && "KTSD".indexOf(newPaymentRule) != -1 && m_mPaymentOriginal != null) { log.fine("Old Payment(1) - " + m_mPaymentOriginal); m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct); boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct); m_mPaymentOriginal.save(); if (ok) log.info( "Payment Canecelled - " + m_mPaymentOriginal); else ADialog.error(m_WindowNo, this, "PaymentError", "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo()); m_mPayment.resetNew(); } // We had a Payment and something else (e.g. Check to Cash) else if ("KTSD".indexOf(m_PaymentRule) != -1 && "KTSD".indexOf(newPaymentRule) == -1) { log.fine("Old Payment(2) - " + m_mPaymentOriginal); if (m_mPaymentOriginal != null) { m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct); boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct); m_mPaymentOriginal.save(); if (ok) // Cancel Payment { log.fine("PaymentCancelled " + m_mPayment.getDocumentNo ()); m_mTab.getTableModel().dataSave(true); m_mPayment.resetNew(); m_mPayment.setAmount(m_C_Currency_ID, m_Amount); } else ADialog.error(m_WindowNo, this, "PaymentError", "PaymentNotCancelled " + m_mPayment.getDocumentNo()); } } } // Get Order and optionally Invoice int C_Order_ID = Env.getCtx().getContextAsInt( m_WindowNo, "C_Order_ID"); int C_Invoice_ID = Env.getCtx().getContextAsInt( m_WindowNo, "C_Invoice_ID"); if (C_Invoice_ID == 0 && m_DocStatus.equals("CO")) C_Invoice_ID = getInvoiceID (C_Order_ID); // Amount sign negative, if ARC (Credit Memo) or API (AP Invoice) boolean negateAmt = false; MInvoice invoice = null; if (C_Invoice_ID != 0) { invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null); negateAmt = invoice.isCreditMemo(); } MOrder order = null; if (invoice == null && C_Order_ID != 0) order = new MOrder (Env.getCtx(), C_Order_ID, null); BigDecimal payAmount = m_Amount; if (negateAmt) payAmount = m_Amount.negate(); // Info log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID + ", NegateAmt=" + negateAmt); /*********************** * CashBook */ if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash)) { log.fine("Cash"); if (C_Invoice_ID == 0 && order == null) { log.config("No Invoice!"); ADialog.error(m_WindowNo, this, "PaymentError", "CashNotCreated"); } else { // Changed Amount if (m_cashLine != null && payAmount.compareTo(m_cashLine.getAmount()) != 0) { log.config("Changed CashBook Amount"); m_cashLine.setAmount(payAmount); if (m_cashLine.save()) log.config("CashAmt Changed"); } // Different Date/CashBook if (m_cashLine != null && (newC_CashBook_ID != m_C_CashBook_ID || !TimeUtil.isSameDay(m_cashLine.getStatementDate(), newDateAcct))) { log.config("Changed CashBook/Date: " + m_C_CashBook_ID + "->" + newC_CashBook_ID); MCashLine reverse = m_cashLine.createReversal(); if (!reverse.save()) ADialog.error(m_WindowNo, this, "PaymentError", "CashNotCancelled"); m_cashLine = null; } // Create new if (m_cashLine == null) { log.config("New CashBook"); int C_Currency_ID = 0; if (invoice != null) C_Currency_ID = invoice.getC_Currency_ID(); if (C_Currency_ID == 0 && order != null) C_Currency_ID = order.getC_Currency_ID(); MCash cash = null; if (newC_CashBook_ID != 0) cash = MCash.get (Env.getCtx(), newC_CashBook_ID, newDateAcct, null); else // Default cash = MCash.get (Env.getCtx(), m_AD_Org_ID, newDateAcct, C_Currency_ID, null); if (cash == null || cash.get_ID() == 0) ADialog.error(m_WindowNo, this, "PaymentError", "CashNotCreated"); else { MCashLine cl = new MCashLine (cash); if (invoice != null) cl.setInvoice(invoice); if (order != null) { cl.setOrder(order, null); m_needSave = true; } if (cl.save()) { newC_CashLine_ID = cl.getC_CashLine_ID(); log.config("CashCreated"); } else ADialog.error(m_WindowNo, this, "PaymentError", "CashNotCreated"); } } } // have invoice } /*********************** * Payments */ if ("KS".indexOf(newPaymentRule) != -1) { log.fine("Payment - " + newPaymentRule); // Set Amount m_mPayment.setAmount(m_C_Currency_ID, payAmount); if (newPaymentRule.equals(MOrder.PAYMENTRULE_CreditCard)) { m_mPayment.setCreditCard(MPayment.TRXTYPE_Sales, newCCType, kNumberField.getText(), "", kExpField.getText()); m_mPayment.setPaymentProcessor(); } else if (newPaymentRule.equals(MOrder.PAYMENTRULE_Check)) { m_mPayment.setBankCheck(newC_BankAccount_ID, m_isSOTrx, sRoutingField.getText(), sNumberField.getText(), sCheckField.getText()); } m_mPayment.setC_BPartner_ID(m_C_BPartner_ID); m_mPayment.setC_Invoice_ID(C_Invoice_ID); if (order != null) { m_mPayment.setC_Order_ID(C_Order_ID); m_needSave = true; } m_mPayment.setDateTrx(m_DateAcct); m_mPayment.setDateAcct(m_DateAcct); m_mPayment.save(); // Save/Post if (MPayment.DOCSTATUS_Drafted.equals(m_mPayment.getDocStatus())) { boolean ok = m_mPayment.processIt(DocAction.ACTION_Complete); m_mPayment.save(); if (ok) ADialog.info(m_WindowNo, this, "PaymentCreated", m_mPayment.getDocumentNo()); else ADialog.error(m_WindowNo, this, "PaymentError", "PaymentNotCreated"); } else log.fine("NotDraft " + m_mPayment); } /********************** * Save Values to mTab */ log.config("Saving changes"); // if (!newPaymentRule.equals(m_PaymentRule)) m_mTab.setValue("PaymentRule", newPaymentRule); // if (!newDateAcct.equals(m_DateAcct)) m_mTab.setValue("DateAcct", newDateAcct); // if (newC_PaymentTerm_ID != m_C_PaymentTerm_ID) m_mTab.setValue("C_PaymentTerm_ID", new Integer(newC_PaymentTerm_ID)); // Set Payment if (m_mPayment.getC_Payment_ID() != m_C_Payment_ID) { if (m_mPayment.getC_Payment_ID() == 0) m_mTab.setValue("C_Payment_ID", null); else m_mTab.setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID())); } // Set Cash if (newC_CashLine_ID != m_C_CashLine_ID) { if (newC_CashLine_ID == 0) m_mTab.setValue("C_CashLine_ID", null); else m_mTab.setValue("C_CashLine_ID", new Integer(newC_CashLine_ID)); } return true; } // saveChanges /** * Check Mandatory * @return true if all mandatory items are OK */ private boolean checkMandatory() { // log.config( "VPayment.checkMandatory"); ValueNamePair vp = (ValueNamePair)paymentCombo.getSelectedItem(); String PaymentRule = vp.getValue(); // only Payment Rule if (m_onlyRule) return true; String CCType = m_CCType; // int C_BankAccount_ID = 0; /*********************** * Mandatory Data Check */ boolean dataOK = true; // B (Cash) (Currency) if (PaymentRule.equals(MOrder.PAYMENTRULE_Cash)) { KeyNamePair kp = (KeyNamePair)bCashBookCombo.getSelectedItem(); if (kp != null) kp.getKey(); } // K (CreditCard) Type, Number, Exp, Approval else if (PaymentRule.equals(MOrder.PAYMENTRULE_CreditCard)) { vp = (ValueNamePair)kTypeCombo.getSelectedItem(); if (vp != null) CCType = vp.getValue(); // String error = MPaymentValidate.validateCreditCardNumber(kNumberField.getText(), CCType); if (error.length() != 0) { kNumberField.setBackground(CompierePLAF.getFieldBackground_Error()); if (error.indexOf("?") == -1) { ADialog.error(m_WindowNo, this, error); dataOK = false; } else // warning { if (!ADialog.ask(m_WindowNo, this, error)) dataOK = false; } } error = MPaymentValidate.validateCreditCardExp(kExpField.getText()); if(error.length() != 0) { kExpField.setBackground(CompierePLAF.getFieldBackground_Error()); ADialog.error(m_WindowNo, this, error); dataOK = false; } } // T (Transfer) BPartner_Bank else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDeposit) || PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit)) { KeyNamePair bpba = (KeyNamePair)tAccountCombo.getSelectedItem(); if (bpba == null) { tAccountCombo.setBackground(CompierePLAF.getFieldBackground_Error()); ADialog.error(m_WindowNo, this, "PaymentBPBankNotFound"); dataOK = false; } } // Direct // P (PaymentTerm) PaymentTerm else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit)) { KeyNamePair kp = (KeyNamePair)pTermCombo.getSelectedItem(); if (kp != null) kp.getKey(); } // S (Check) (Currency) CheckNo, Routing else if (PaymentRule.equals(MOrder.PAYMENTRULE_Check)) { // sCurrencyCombo.getSelectedItem(); KeyNamePair kp = (KeyNamePair)sBankAccountCombo.getSelectedItem(); if (kp != null) C_BankAccount_ID = kp.getKey(); String error = MPaymentValidate.validateRoutingNo(sRoutingField.getText()); if (error.length() != 0) { sRoutingField.setBackground(CompierePLAF.getFieldBackground_Error()); ADialog.error(m_WindowNo, this, error); dataOK = false; } error = MPaymentValidate.validateAccountNo(sNumberField.getText()); if (error.length() != 0) { sNumberField.setBackground(CompierePLAF.getFieldBackground_Error()); ADialog.error(m_WindowNo, this, error); dataOK = false; } error = MPaymentValidate.validateCheckNo(sCheckField.getText()); if (error.length() != 0) { sCheckField.setBackground(CompierePLAF.getFieldBackground_Error()); ADialog.error(m_WindowNo, this, error); dataOK = false; } } else { log.log(Level.SEVERE, "Unknown PaymentRule " + PaymentRule); return false; } // find Bank Account if not qualified yet if ("KTSD".indexOf(PaymentRule) != -1 && C_BankAccount_ID == 0) { if (PaymentRule.equals(MOrder.PAYMENTRULE_DirectDeposit)) { } else if (PaymentRule.equals(MOrder.PAYMENTRULE_DirectDebit)) { } else if (PaymentRule.equals(MOrder.PAYMENTRULE_Check)) { } // Check must have a bank account if (C_BankAccount_ID == 0 && "S".equals(PaymentRule)) { ADialog.error(m_WindowNo, this, "PaymentNoProcessor"); dataOK = false; } } // log.config("OK=" + dataOK); return dataOK; } // checkMandatory /** * Get Invoice ID for Order * @param C_Order_ID order * @return C_Invoice_ID or 0 if not found */ private static int getInvoiceID (int C_Order_ID) { int retValue = 0; String sql = "SELECT C_Invoice_ID FROM C_Invoice WHERE C_Order_ID=? " + "ORDER BY C_Invoice_ID DESC"; // last invoice try { PreparedStatement pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, C_Order_ID); ResultSet rs = pstmt.executeQuery(); if (rs.next()) retValue = rs.getInt(1); rs.close(); pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, sql, e); } return retValue; } // getInvoiceID /************************************************************************** * Process Online (sales only) - if approved - exit */ private void processOnline() { log.config(""); if (!checkMandatory()) return; boolean approved = false; String info = ""; // ValueNamePair vp = (ValueNamePair)paymentCombo.getSelectedItem(); String PaymentRule = vp.getValue(); // -- CreditCard if (PaymentRule.equals(X_C_Order.PAYMENTRULE_CreditCard)) { vp = (ValueNamePair)kTypeCombo.getSelectedItem(); String CCType = vp.getValue(); m_mPayment.setCreditCard(MPayment.TRXTYPE_Sales, CCType, kNumberField.getText(), "", kExpField.getText()); m_mPayment.setAmount(m_C_Currency_ID, m_Amount); m_mPayment.setPaymentProcessor(); m_mPayment.setC_BPartner_ID(m_C_BPartner_ID); // int C_Invoice_ID = Env.getCtx().getContextAsInt( m_WindowNo, "C_Invoice_ID"); if (C_Invoice_ID == 0 && m_DocStatus.equals("CO")) { int C_Order_ID = Env.getCtx().getContextAsInt( m_WindowNo, "C_Order_ID"); C_Invoice_ID = getInvoiceID (C_Order_ID); } m_mPayment.setC_Invoice_ID(C_Invoice_ID); m_mPayment.setDateTrx(m_DateAcct); // Set Amount m_mPayment.setAmount(m_C_Currency_ID, m_Amount); approved = m_mPayment.processOnline(); info = m_mPayment.getR_RespMsg() + " (" + m_mPayment.getR_AuthCode() + ") ID=" + m_mPayment.getR_PnRef(); m_mPayment.save(); if (approved) { boolean ok = m_mPayment.processIt(DocAction.ACTION_Complete); m_mPayment.save(); if (ok) ADialog.info(m_WindowNo, this, "PaymentProcessed", info + "\n" + m_mPayment.getDocumentNo()); else ADialog.error(m_WindowNo, this, "PaymentError", "PaymentNotCreated"); saveChanges(); dispose(); } else { ADialog.error(m_WindowNo, this, "PaymentNotProcessed", info); } } else ADialog.error(m_WindowNo, this, "PaymentNoProcessor"); } // online /** * Need Save record (payment with waiting order) * @return true if payment with waiting order */ public boolean needSave() { return m_needSave; } // needSave } // VPayment

The table below shows all metrics for VPayment.java.

MetricValueDescription
BLOCKS111.00Number of blocks
BLOCK_COMMENT 0.00Number of block comment lines
COMMENTS242.00Comment lines
COMMENT_DENSITY 0.27Comment density
COMPARISONS165.00Number of comparison operators
CYCLOMATIC186.00Cyclomatic complexity
DECL_COMMENTS34.00Comments in declarations
DOC_COMMENT152.00Number of javadoc comment lines
ELOC899.00Effective lines of code
EXEC_COMMENTS94.00Comments in executable code
EXITS157.00Procedure exits
FUNCTIONS11.00Number of function declarations
HALSTEAD_DIFFICULTY147.67Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY25.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 1.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 0.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA003476.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 2.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 1.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 1.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA007616.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 1.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 1.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 0.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 0.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 0.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 0.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 1.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 0.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA01453614.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 2.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 1.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 0.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 0.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 2.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES1430.00Number of lines in the source file
LINE_COMMENT90.00Number of line comments
LOC1104.00Lines of code
LOGICAL_LINES622.00Number of statements
LOOPS 8.00Number of loops
NEST_DEPTH 6.00Maximum nesting depth
OPERANDS3544.00Number of operands
OPERATORS5936.00Number of operators
PARAMS 6.00Number of formal parameter declarations
PROGRAM_LENGTH9480.00Halstead program length
PROGRAM_VOCAB650.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS19.00Number of return points from functions
SIZE51355.00Size of the file in bytes
UNIQUE_OPERANDS600.00Number of unique operands
UNIQUE_OPERATORS50.00Number of unique operators
WHITESPACE84.00Number of whitespace lines