?? vpayment.java
字號:
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Business Solution
* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
* created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.grid;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import javax.swing.*;
import java.util.*;
import java.sql.*;
import java.math.*;
import org.compiere.apps.*;
import org.compiere.grid.ed.*;
import org.compiere.util.*;
import org.compiere.model.*;
import org.compiere.plaf.*;
import org.compiere.swing.*;
/**
* 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.19 2003/04/18 05:57:13 jjanke Exp $
*/
public class VPayment extends JDialog implements ActionListener
{
/**
* Constructor
*
* @param WindowNo owning window
* @param mTab owning tab
* @param button button with access information
*/
public VPayment (int WindowNo, MTab mTab, VButton button)
{
super((JFrame)Env.getWindow(WindowNo), Msg.getMsg(Env.getCtx(), "Payment"), true);
m_WindowNo = WindowNo;
m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx"));
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.error("VPayment", ex);
m_initOK = false;
}
//
AEnv.positionCenterWindow(Env.getWindow(WindowNo), this);
} // VPayment
/** Window */
private int m_WindowNo = 0;
/** Tab */
private MTab 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;
/** Start CashBook Line */
private int m_C_CashLine_ID = 0;
private MCashBook m_mCashBook = null;
/** Start CreditCard */
private String m_CCType = "";
/** Start 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;
/** 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(DisplayType.Amount);
private static Hashtable s_Currencies = null; // EMU Currencies
private int m_OnlinePayment_ID = 0;
public static final String PAYMENTRULE_CASH = "B";
public static final String PAYMENTRULE_CREDITCARD = "K";
public static final String PAYMENTRULE_ONCREDIT = "P";
public static final String PAYMENTRULE_CHECK = "S";
public static final String PAYMENTRULE_TRANSFER = "T";
public static final String PAYMENTRULE_PAYMENTTERM = "P";
//
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 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 JButton kOnline = new JButton();
private JButton sOnline = new JButton();
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 JButton tOnline = new JButton();
private CLabel kStatus = new CLabel();
private CTextField tRoutingField = new CTextField();
private CTextField tNumberField = new CTextField();
private CLabel tStatus = new CLabel();
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
private CLabel sStatus = new CLabel();
/**
* Static Init
* @throws Exception
*/
private void jbInit() throws Exception
{
CompiereColor.setBackground(this);
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);
//
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));
//
tPanel.setLayout(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setColumns(8);
tNumberField.setColumns(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
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(tRoutingField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
tPanel.add(tNumberField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
tPanel.add(tStatus, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
tPanel.add(tRoutingText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
tPanel.add(tNumberText, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
tPanel.add(tOnline, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, 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");
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -