📄 vpayprint.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.apps.form;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
import java.text.*;
import java.math.*;
import org.compiere.util.*;
import org.compiere.apps.*;
import org.compiere.grid.ed.*;
import org.compiere.model.*;
import org.compiere.print.*;
import org.compiere.plaf.*;
import org.compiere.swing.*;
/**
* Payment Print & Export
*
* @author Jorg Janke
* @version $Id: VPayPrint.java,v 1.22 2003/04/30 06:24:49 jjanke Exp $
*/
public class VPayPrint extends CPanel
implements FormPanel, ActionListener
{
/** @todo ability to enter underpayments */
/**
* Constructor
*/
public VPayPrint()
{
} // VPayPrint
/**
* Initialize Panel
* @param WindowNo window
* @param frame frame
*/
public void init (int WindowNo, FormFrame frame)
{
Log.trace(Log.l1_User, "VPayPrint.init");
m_WindowNo = WindowNo;
m_frame = frame;
try
{
jbInit();
dynInit();
frame.getContentPane().add(centerPanel, BorderLayout.CENTER);
frame.getContentPane().add(southPanel, BorderLayout.SOUTH);
}
catch(Exception e)
{
Log.error("VPayPrint.init", e);
}
} // init
/** Window No */
private int m_WindowNo = 0;
/** FormFrame */
private FormFrame m_frame;
/** Used Bank Account */
private int m_C_BankAccount_ID = -1;
/** Payment Information */
private MPaySelectionCheck[] m_checks = null;
// Static Variables
private CPanel centerPanel = new CPanel();
private CPanel southPanel = new CPanel();
private FlowLayout southLayout = new FlowLayout();
private GridBagLayout centerLayout = new GridBagLayout();
private JButton bPrint = ConfirmPanel.createPrintButton(true);
private JButton bExport = ConfirmPanel.createExportButton(true);
private JButton bCancel = ConfirmPanel.createCancelButton(true);
private JButton bProcess = ConfirmPanel.createProcessButton(Msg.getMsg(Env.getCtx(), "VPayPrintProcess"));
private CLabel lPaySelect = new CLabel();
private CComboBox fPaySelect = new CComboBox();
private CLabel lBank = new CLabel();
private CLabel fBank = new CLabel();
private CLabel lPaymentRule = new CLabel();
private CComboBox fPaymentRule = new CComboBox();
private CLabel lDocumentNo = new CLabel();
private VNumber fDocumentNo = new VNumber();
private CLabel lNoPayments = new CLabel();
private CLabel fNoPayments = new CLabel();
private CLabel lBalance = new CLabel();
private VNumber fBalance = new VNumber();
private CLabel lCurrency = new CLabel();
private CLabel fCurrency = new CLabel();
/**
* Static Init
* @throws Exception
*/
private void jbInit() throws Exception
{
CompiereColor.setBackground(this);
//
southPanel.setLayout(southLayout);
southLayout.setAlignment(FlowLayout.RIGHT);
centerPanel.setLayout(centerLayout);
//
bPrint.addActionListener(this);
bExport.addActionListener(this);
bCancel.addActionListener(this);
//
bProcess.setText(Msg.getMsg(Env.getCtx(), "EFT"));
bProcess.setEnabled(false);
bProcess.addActionListener(this);
//
lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID"));
fPaySelect.addActionListener(this);
//
lBank.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
//
lPaymentRule.setText(Msg.translate(Env.getCtx(), "PaymentRule"));
fPaymentRule.addActionListener(this);
//
lDocumentNo.setText(Msg.translate(Env.getCtx(), "DocumentNo"));
fDocumentNo.setDisplayType(DisplayType.Integer);
lNoPayments.setText(Msg.getMsg(Env.getCtx(), "NoOfPayments"));
fNoPayments.setText("0");
lBalance.setText(Msg.translate(Env.getCtx(), "CurrentBalance"));
fBalance.setReadWrite(false);
fBalance.setDisplayType(DisplayType.Amount);
lCurrency.setText(Msg.translate(Env.getCtx(), "C_Currency_ID"));
//
southPanel.add(bCancel, null);
southPanel.add(bExport, null);
southPanel.add(bPrint, null);
southPanel.add(bProcess, null);
//
centerPanel.add(lPaySelect, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
centerPanel.add(fPaySelect, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0));
centerPanel.add(lBank, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(fBank, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
centerPanel.add(lPaymentRule, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(fPaymentRule, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
centerPanel.add(lDocumentNo, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(fDocumentNo, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
centerPanel.add(lNoPayments, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(fNoPayments, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
centerPanel.add(lBalance, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(fBalance, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
centerPanel.add(lCurrency, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 12, 5), 0, 0));
centerPanel.add(fCurrency, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 12), 0, 0));
} // VPayPrint
/**
* Dynamic Init
*/
private void dynInit()
{
Log.trace(Log.l3_Util, "VPayPrint.dynInit");
int AD_Client_ID = Integer.parseInt(Env.getContext(Env.getCtx(), "#AD_Client_ID"));
// Load PaySelect
String sql = "SELECT C_PaySelection_ID, Name || ' - ' || TotalAmt FROM C_PaySelection "
+ "WHERE AD_Client_ID=? AND Processed='Y' AND IsActive='Y'"
+ "ORDER BY PayDate DESC";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql);
pstmt.setInt(1, AD_Client_ID);
ResultSet rs = pstmt.executeQuery();
//
while (rs.next())
{
KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
fPaySelect.addItem(pp);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
Log.error("VPayPrint.dynInit", e);
}
if (fPaySelect.getItemCount() == 0)
ADialog.info(m_WindowNo, this, "VPayPrintNoRecords");
} // dynInit
/**
* Dispose
*/
public void dispose()
{
m_frame.dispose();
} // dispose
/*************************************************************************/
/**
* Action Listener
* @param e event
*/
public void actionPerformed(ActionEvent e)
{
// Log.trace(Log.l3_Util, "VPayPrint.actionPerformed" + e.toString());
if (e.getSource() == fPaySelect)
loadPaySelectInfo();
else if (e.getSource() == fPaymentRule)
loadPaymentRuleInfo();
//
else if (e.getSource() == bCancel)
dispose();
else if (e.getSource() == bExport)
cmd_export();
else if (e.getSource() == bProcess)
cmd_EFT();
else if (e.getSource() == bPrint)
cmd_print();
} // actionPerformed
/**
* PaySelect changed - load Bank
*/
private void loadPaySelectInfo()
{
Log.trace(Log.l1_User, "VPayPrint.loadPaySelectInfo");
if (fPaySelect.getSelectedIndex() == -1)
return;
// load Banks from PaySelectLine
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
m_C_BankAccount_ID = -1;
String sql = "SELECT ps.C_BankAccount_ID, b.Name || ' ' || ba.AccountNo," // 1..2
+ " c.ISO_Code, CurrentBalance " // 3..4
+ "FROM C_PaySelection ps"
+ " INNER JOIN C_BankAccount ba ON (ps.C_BankAccount_ID=ba.C_BankAccount_ID)"
+ " INNER JOIN C_Bank b ON (ba.C_Bank_ID=b.C_Bank_ID)"
+ " INNER JOIN C_Currency c ON (ba.C_Currency_ID=c.C_Currency_ID) "
+ "WHERE ps.C_PaySelection_ID=? AND ps.Processed='Y'";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql);
pstmt.setInt(1, C_PaySelection_ID);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -