fixes #35 Performance issue on Payment Print/Export

http://bitbucket.org/idempiere/idempiere/issue/35
This commit is contained in:
Carlos Ruiz 2011-06-07 01:34:20 -05:00
parent 9a9bfc36ee
commit 0cc73a03fd
3 changed files with 127 additions and 92 deletions

View File

@ -24,6 +24,9 @@ import java.awt.GridBagLayout;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
@ -33,7 +36,10 @@ import javax.swing.JFileChooser;
import org.compiere.apps.ADialog; import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.ConfirmPanel; import org.compiere.apps.ConfirmPanel;
import org.compiere.grid.ed.VLookup;
import org.compiere.grid.ed.VNumber; import org.compiere.grid.ed.VNumber;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MPaymentBatch; import org.compiere.model.MPaymentBatch;
import org.compiere.plaf.CompiereColor; import org.compiere.plaf.CompiereColor;
@ -46,7 +52,6 @@ import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Ini; import org.compiere.util.Ini;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.PaymentExport; import org.compiere.util.PaymentExport;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
@ -60,7 +65,7 @@ import org.compiere.util.ValueNamePair;
* Contributors: * Contributors:
* Carlos Ruiz - GlobalQSS - FR 3132033 - Make payment export class configurable per bank * Carlos Ruiz - GlobalQSS - FR 3132033 - Make payment export class configurable per bank
*/ */
public class VPayPrint extends PayPrint implements FormPanel, ActionListener public class VPayPrint extends PayPrint implements FormPanel, ActionListener, VetoableChangeListener
{ {
private CPanel panel = new CPanel(); private CPanel panel = new CPanel();
@ -76,8 +81,8 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
m_frame = frame; m_frame = frame;
try try
{ {
jbInit();
dynInit(); dynInit();
jbInit();
frame.getContentPane().add(centerPanel, BorderLayout.CENTER); frame.getContentPane().add(centerPanel, BorderLayout.CENTER);
frame.getContentPane().add(southPanel, BorderLayout.SOUTH); frame.getContentPane().add(southPanel, BorderLayout.SOUTH);
} }
@ -101,7 +106,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
private JButton bCancel = ConfirmPanel.createCancelButton(true); private JButton bCancel = ConfirmPanel.createCancelButton(true);
private JButton bProcess = ConfirmPanel.createProcessButton(Msg.getMsg(Env.getCtx(), "VPayPrintProcess")); private JButton bProcess = ConfirmPanel.createProcessButton(Msg.getMsg(Env.getCtx(), "VPayPrintProcess"));
private CLabel lPaySelect = new CLabel(); private CLabel lPaySelect = new CLabel();
private CComboBox fPaySelect = new CComboBox(); private VLookup paySelectSearch = null;
private CLabel lBank = new CLabel(); private CLabel lBank = new CLabel();
private CLabel fBank = new CLabel(); private CLabel fBank = new CLabel();
private CLabel lPaymentRule = new CLabel(); private CLabel lPaymentRule = new CLabel();
@ -136,7 +141,6 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
bProcess.addActionListener(this); bProcess.addActionListener(this);
// //
lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID")); lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID"));
fPaySelect.addActionListener(this);
// //
lBank.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID")); lBank.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
// //
@ -159,7 +163,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
// //
centerPanel.add(lPaySelect, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 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)); ,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 centerPanel.add(paySelectSearch, new GridBagConstraints(1, 0, 3, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 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 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)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
@ -192,17 +196,13 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
*/ */
private void dynInit() private void dynInit()
{ {
ArrayList<KeyNamePair> data = getPaySelectionData();
for(KeyNamePair pp : data)
fPaySelect.addItem(pp);
if (fPaySelect.getItemCount() == 0) // C_PaySelection_ID
ADialog.info(m_WindowNo, panel, "VPayPrintNoRecords"); int AD_Column_ID = 7670; // C_PaySelectionCheck.C_PaySelection_ID
else MLookup lookupPS = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.Search);
{ paySelectSearch = new VLookup("C_PaySelection_ID", true, false, true, lookupPS);
fPaySelect.setSelectedIndex(0); paySelectSearch.addVetoableChangeListener(this);
loadPaySelectInfo();
}
} // dynInit } // dynInit
/** /**
@ -223,18 +223,11 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
{ {
if (C_PaySelection_ID == 0) if (C_PaySelection_ID == 0)
return; return;
//
for (int i = 0; i < fPaySelect.getItemCount(); i++)
{
KeyNamePair pp = (KeyNamePair)fPaySelect.getItemAt(i);
if (pp.getKey() == C_PaySelection_ID)
{
fPaySelect.setSelectedIndex(i);
return;
}
}
} // setsetPaySelection
m_C_PaySelection_ID = C_PaySelection_ID;
paySelectSearch.setValue(new Integer(m_C_PaySelection_ID));
loadPaySelectInfo();
} // setsetPaySelection
/************************************************************************** /**************************************************************************
* Action Listener * Action Listener
@ -242,14 +235,13 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
*/ */
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
// log.config( "VPayPrint.actionPerformed" + e.toString()); // log.config( "VPayPrint.actionPerformed" + e.toString());
if (e.getSource() == fPaySelect) if (e.getSource() == bCancel)
loadPaySelectInfo(); dispose();
else if (m_C_PaySelection_ID <= 0)
return;
else if (e.getSource() == fPaymentRule) else if (e.getSource() == fPaymentRule)
loadPaymentRuleInfo(); loadPaymentRuleInfo();
//
else if (e.getSource() == bCancel)
dispose();
else if (e.getSource() == bExport) else if (e.getSource() == bExport)
cmd_export(); cmd_export();
else if (e.getSource() == bProcess) else if (e.getSource() == bProcess)
@ -264,16 +256,17 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
private void loadPaySelectInfo() private void loadPaySelectInfo()
{ {
log.info( "VPayPrint.loadPaySelectInfo"); log.info( "VPayPrint.loadPaySelectInfo");
if (fPaySelect.getSelectedIndex() == -1) if (m_C_PaySelection_ID <= 0)
return; return;
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey(); loadPaySelectInfo(m_C_PaySelection_ID);
loadPaySelectInfo(C_PaySelection_ID);
fBank.setText(bank); fBank.setText(bank);
fCurrency.setText(currency); fCurrency.setText(currency);
fBalance.setValue(balance); fBalance.setValue(balance);
m_frame.pack();
loadPaymentRule(); loadPaymentRule();
} // loadPaySelectInfo } // loadPaySelectInfo
@ -288,8 +281,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
fPaymentRule.removeAllItems(); fPaymentRule.removeAllItems();
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey(); ArrayList<ValueNamePair> data = loadPaymentRule(m_C_PaySelection_ID);
ArrayList<ValueNamePair> data = loadPaymentRule(C_PaySelection_ID);
for(ValueNamePair pp : data) for(ValueNamePair pp : data)
fPaymentRule.addItem(pp); fPaymentRule.addItem(pp);
@ -313,8 +305,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
log.info("PaymentRule=" + PaymentRule); log.info("PaymentRule=" + PaymentRule);
fNoPayments.setText(" "); fNoPayments.setText(" ");
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey(); String msg = loadPaymentRuleInfo(m_C_PaySelection_ID, PaymentRule);
String msg = loadPaymentRuleInfo(C_PaySelection_ID, PaymentRule);
if(noPayments != null) if(noPayments != null)
fNoPayments.setText(noPayments); fNoPayments.setText(noPayments);
@ -334,7 +325,10 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
*/ */
private void cmd_export() private void cmd_export()
{ {
String PaymentRule = ((ValueNamePair)fPaymentRule.getSelectedItem()).getValue(); ValueNamePair pp = (ValueNamePair)fPaymentRule.getSelectedItem();
if (pp == null)
return;
String PaymentRule = pp.getValue();
log.info(PaymentRule); log.info(PaymentRule);
if (!getChecks(PaymentRule)) if (!getChecks(PaymentRule))
return; return;
@ -396,7 +390,10 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
*/ */
private void cmd_EFT() private void cmd_EFT()
{ {
String PaymentRule = ((ValueNamePair)fPaymentRule.getSelectedItem()).getValue(); ValueNamePair pp = (ValueNamePair)fPaymentRule.getSelectedItem();
if (pp == null)
return;
String PaymentRule = pp.getValue();
log.info(PaymentRule); log.info(PaymentRule);
if (!getChecks(PaymentRule)) if (!getChecks(PaymentRule))
return; return;
@ -408,7 +405,10 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
*/ */
private void cmd_print() private void cmd_print()
{ {
String PaymentRule = ((ValueNamePair)fPaymentRule.getSelectedItem()).getValue(); ValueNamePair pp = (ValueNamePair)fPaymentRule.getSelectedItem();
if (pp == null)
return;
String PaymentRule = pp.getValue();
log.info(PaymentRule); log.info(PaymentRule);
if (!getChecks(PaymentRule)) if (!getChecks(PaymentRule))
return; return;
@ -463,7 +463,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
private boolean getChecks(String PaymentRule) private boolean getChecks(String PaymentRule)
{ {
// do we have values // do we have values
if (fPaySelect.getSelectedIndex() == -1 || m_C_BankAccount_ID == -1 if (m_C_PaySelection_ID <= 0 || m_C_BankAccount_ID == -1
|| fPaymentRule.getSelectedIndex() == -1 || fDocumentNo.getValue() == null) || fPaymentRule.getSelectedIndex() == -1 || fDocumentNo.getValue() == null)
{ {
ADialog.error(m_WindowNo, panel, "VPayPrintNoRecords", ADialog.error(m_WindowNo, panel, "VPayPrintNoRecords",
@ -472,15 +472,14 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
} }
// get data // get data
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
int startDocumentNo = ((Number)fDocumentNo.getValue()).intValue(); int startDocumentNo = ((Number)fDocumentNo.getValue()).intValue();
log.config("C_PaySelection_ID=" + C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo); log.config("C_PaySelection_ID=" + m_C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo);
// //
panel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); panel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// get Slecetions // get Selections
m_checks = MPaySelectionCheck.get(C_PaySelection_ID, PaymentRule, startDocumentNo, null); m_checks = MPaySelectionCheck.get(m_C_PaySelection_ID, PaymentRule, startDocumentNo, null);
panel.setCursor(Cursor.getDefaultCursor()); panel.setCursor(Cursor.getDefaultCursor());
// //
@ -490,8 +489,32 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
"(" + Msg.translate(Env.getCtx(), "C_PaySelectionLine_ID") + " #0"); "(" + Msg.translate(Env.getCtx(), "C_PaySelectionLine_ID") + " #0");
return false; return false;
} }
m_batch = MPaymentBatch.getForPaySelection (Env.getCtx(), C_PaySelection_ID, null); m_batch = MPaymentBatch.getForPaySelection (Env.getCtx(), m_C_PaySelection_ID, null);
return true; return true;
} // getChecks } // getChecks
/**
* Vetoable Change Listener.
* - Payment Selection
* @param evt event
*/
@Override
public void vetoableChange(PropertyChangeEvent e)
throws PropertyVetoException {
String name = e.getPropertyName();
Object value = e.getNewValue();
log.config(name + "=" + value);
if (value == null)
return;
// Payment Selection
if (name.equals("C_PaySelection_ID"))
{
paySelectSearch.setValue(value);
m_C_PaySelection_ID = ((Integer)value).intValue();
loadPaySelectInfo();
}
}
} // PayPrint } // PayPrint

View File

@ -35,6 +35,9 @@ import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WNumberEditor; import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.CustomForm; import org.adempiere.webui.panel.CustomForm;
import org.adempiere.webui.panel.IFormController; import org.adempiere.webui.panel.IFormController;
@ -42,12 +45,14 @@ import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.adempiere.webui.window.SimplePDFViewer; import org.adempiere.webui.window.SimplePDFViewer;
import org.compiere.apps.form.PayPrint; import org.compiere.apps.form.PayPrint;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MPaymentBatch; import org.compiere.model.MPaymentBatch;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.PaymentExport; import org.compiere.util.PaymentExport;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
@ -67,7 +72,7 @@ import org.zkoss.zul.Filedownload;
* Contributors: * Contributors:
* Carlos Ruiz - GlobalQSS - FR 3132033 - Make payment export class configurable per bank * Carlos Ruiz - GlobalQSS - FR 3132033 - Make payment export class configurable per bank
*/ */
public class WPayPrint extends PayPrint implements IFormController, EventListener public class WPayPrint extends PayPrint implements IFormController, EventListener, ValueChangeListener
{ {
private CustomForm form = new CustomForm(); private CustomForm form = new CustomForm();
@ -78,8 +83,8 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
{ {
try try
{ {
zkInit();
dynInit(); dynInit();
zkInit();
Borderlayout contentLayout = new Borderlayout(); Borderlayout contentLayout = new Borderlayout();
contentLayout.setWidth("100%"); contentLayout.setWidth("100%");
contentLayout.setHeight("100%"); contentLayout.setHeight("100%");
@ -107,7 +112,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
private Button bCancel = southPanel.getButton(ConfirmPanel.A_CANCEL); private Button bCancel = southPanel.getButton(ConfirmPanel.A_CANCEL);
private Button bProcess = southPanel.createButton(ConfirmPanel.A_PROCESS); private Button bProcess = southPanel.createButton(ConfirmPanel.A_PROCESS);
private Label lPaySelect = new Label(); private Label lPaySelect = new Label();
private Listbox fPaySelect = ListboxFactory.newDropdownListbox(); private WSearchEditor paySelectSearch = null;
private Label lBank = new Label(); private Label lBank = new Label();
private Label fBank = new Label(); private Label fBank = new Label();
private Label lPaymentRule = new Label(); private Label lPaymentRule = new Label();
@ -138,7 +143,6 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
bProcess.addActionListener(this); bProcess.addActionListener(this);
// //
lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID")); lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID"));
fPaySelect.addActionListener(this);
// //
lBank.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID")); lBank.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
// //
@ -161,7 +165,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
Rows rows = centerLayout.newRows(); Rows rows = centerLayout.newRows();
Row row = rows.newRow(); Row row = rows.newRow();
row.appendChild(lPaySelect.rightAlign()); row.appendChild(lPaySelect.rightAlign());
row.appendChild(fPaySelect); row.appendChild(paySelectSearch.getComponent());
row = rows.newRow(); row = rows.newRow();
row.appendChild(lBank.rightAlign()); row.appendChild(lBank.rightAlign());
@ -189,17 +193,12 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
*/ */
private void dynInit() private void dynInit()
{ {
ArrayList<KeyNamePair> data = getPaySelectionData(); // C_PaySelection_ID
for(KeyNamePair pp : data) int AD_Column_ID = 7670; // C_PaySelectionCheck.C_PaySelection_ID
fPaySelect.addItem(pp); MLookup lookupPS = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.Search);
paySelectSearch = new WSearchEditor("C_PaySelection_ID", true, false, true, lookupPS);
paySelectSearch.addValueChangeListener(this);
if (fPaySelect.getItemCount() == 0)
FDialog.info(m_WindowNo, form, "VPayPrintNoRecords");
else
{
fPaySelect.setSelectedIndex(0);
loadPaySelectInfo();
}
} // dynInit } // dynInit
/** /**
@ -219,16 +218,9 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
if (C_PaySelection_ID == 0) if (C_PaySelection_ID == 0)
return; return;
// //
for (int i = 0; i < fPaySelect.getItemCount(); i++) m_C_PaySelection_ID = C_PaySelection_ID;
{ paySelectSearch.setValue(new Integer(m_C_PaySelection_ID));
KeyNamePair pp = fPaySelect.getItemAtIndex(i).toKeyNamePair(); loadPaySelectInfo();
if (pp.getKey() == C_PaySelection_ID)
{
fPaySelect.setSelectedIndex(i);
loadPaySelectInfo();
return;
}
}
} // setsetPaySelection } // setsetPaySelection
@ -238,14 +230,14 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
*/ */
public void onEvent(Event e) public void onEvent(Event e)
{ {
// log.config( "VPayPrint.actionPerformed" + e.toString()); // log.config( "VPayPrint.actionPerformed" + e.toString());
if (e.getTarget() == fPaySelect) if (e.getTarget() == bCancel)
loadPaySelectInfo(); dispose();
else if (m_C_PaySelection_ID <= 0)
return;
else if (e.getTarget() == fPaymentRule) else if (e.getTarget() == fPaymentRule)
loadPaymentRuleInfo(); loadPaymentRuleInfo();
// //
else if (e.getTarget() == bCancel)
dispose();
else if (e.getTarget() == bExport) else if (e.getTarget() == bExport)
cmd_export(); cmd_export();
else if (e.getTarget() == bProcess) else if (e.getTarget() == bProcess)
@ -260,12 +252,11 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
private void loadPaySelectInfo() private void loadPaySelectInfo()
{ {
log.info( "VPayPrint.loadPaySelectInfo"); log.info( "VPayPrint.loadPaySelectInfo");
if (fPaySelect.getSelectedIndex() == -1) if (m_C_PaySelection_ID <= 0)
return; return;
// load Banks from PaySelectLine // load Banks from PaySelectLine
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey(); loadPaySelectInfo(m_C_PaySelection_ID);
loadPaySelectInfo(C_PaySelection_ID);
fBank.setText(bank); fBank.setText(bank);
fCurrency.setText(currency); fCurrency.setText(currency);
@ -286,8 +277,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
fPaymentRule.removeAllItems(); fPaymentRule.removeAllItems();
// load PaymentRule for Bank // load PaymentRule for Bank
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey(); ArrayList<ValueNamePair> data = loadPaymentRule(m_C_PaySelection_ID);
ArrayList<ValueNamePair> data = loadPaymentRule(C_PaySelection_ID);
for(ValueNamePair pp : data) for(ValueNamePair pp : data)
fPaymentRule.addItem(pp); fPaymentRule.addItem(pp);
@ -313,8 +303,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
log.info("PaymentRule=" + PaymentRule); log.info("PaymentRule=" + PaymentRule);
fNoPayments.setText(" "); fNoPayments.setText(" ");
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey(); String msg = loadPaymentRuleInfo(m_C_PaySelection_ID, PaymentRule);
String msg = loadPaymentRuleInfo(C_PaySelection_ID, PaymentRule);
if(noPayments != null) if(noPayments != null)
fNoPayments.setText(noPayments); fNoPayments.setText(noPayments);
@ -514,7 +503,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
private boolean getChecks(String PaymentRule) private boolean getChecks(String PaymentRule)
{ {
// do we have values // do we have values
if (fPaySelect.getSelectedIndex() == -1 || m_C_BankAccount_ID == -1 if (m_C_PaySelection_ID <= 0 || m_C_BankAccount_ID == -1
|| fPaymentRule.getSelectedIndex() == -1 || fDocumentNo.getValue() == null) || fPaymentRule.getSelectedIndex() == -1 || fDocumentNo.getValue() == null)
{ {
FDialog.error(m_WindowNo, form, "VPayPrintNoRecords", FDialog.error(m_WindowNo, form, "VPayPrintNoRecords",
@ -523,13 +512,12 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
} }
// get data // get data
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey();
int startDocumentNo = ((Number)fDocumentNo.getValue()).intValue(); int startDocumentNo = ((Number)fDocumentNo.getValue()).intValue();
log.config("C_PaySelection_ID=" + C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo); log.config("C_PaySelection_ID=" + m_C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo);
// //
// get Slecetions // get Slecetions
m_checks = MPaySelectionCheck.get(C_PaySelection_ID, PaymentRule, startDocumentNo, null); m_checks = MPaySelectionCheck.get(m_C_PaySelection_ID, PaymentRule, startDocumentNo, null);
// //
if (m_checks == null || m_checks.length == 0) if (m_checks == null || m_checks.length == 0)
@ -538,7 +526,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
"(" + Msg.translate(Env.getCtx(), "C_PaySelectionLine_ID") + " #0"); "(" + Msg.translate(Env.getCtx(), "C_PaySelectionLine_ID") + " #0");
return false; return false;
} }
m_batch = MPaymentBatch.getForPaySelection (Env.getCtx(), C_PaySelection_ID, null); m_batch = MPaymentBatch.getForPaySelection (Env.getCtx(), m_C_PaySelection_ID, null);
return true; return true;
} // getChecks } // getChecks
@ -546,4 +534,26 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
return form; return form;
} }
/**
* Vetoable Change Listener.
* - Payment Selection
* @param e event
*/
@Override
public void valueChange(ValueChangeEvent e) {
String name = e.getPropertyName();
Object value = e.getNewValue();
log.config(name + "=" + value);
if (value == null)
return;
// Payment Selection
if (name.equals("C_PaySelection_ID"))
{
paySelectSearch.setValue(value);
m_C_PaySelection_ID = ((Integer)value).intValue();
loadPaySelectInfo();
}
}
} // PayPrint } // PayPrint

View File

@ -43,6 +43,8 @@ public class PayPrint {
public int m_C_BankAccount_ID = -1; public int m_C_BankAccount_ID = -1;
/** Export Class for Bank Account */ /** Export Class for Bank Account */
public String m_PaymentExportClass = null; public String m_PaymentExportClass = null;
/** Payment Selection */
public int m_C_PaySelection_ID = 0;
/** Payment Information */ /** Payment Information */
public MPaySelectionCheck[] m_checks = null; public MPaySelectionCheck[] m_checks = null;