fixes #35 Performance issue on Payment Print/Export
http://bitbucket.org/idempiere/idempiere/issue/35
This commit is contained in:
parent
9a9bfc36ee
commit
0cc73a03fd
|
@ -24,6 +24,9 @@ import java.awt.GridBagLayout;
|
|||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -33,7 +36,10 @@ import javax.swing.JFileChooser;
|
|||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.ConfirmPanel;
|
||||
import org.compiere.grid.ed.VLookup;
|
||||
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.MPaymentBatch;
|
||||
import org.compiere.plaf.CompiereColor;
|
||||
|
@ -46,7 +52,6 @@ import org.compiere.util.DB;
|
|||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.PaymentExport;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
@ -60,7 +65,7 @@ import org.compiere.util.ValueNamePair;
|
|||
* Contributors:
|
||||
* 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();
|
||||
|
||||
|
@ -76,8 +81,8 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
m_frame = frame;
|
||||
try
|
||||
{
|
||||
jbInit();
|
||||
dynInit();
|
||||
jbInit();
|
||||
frame.getContentPane().add(centerPanel, BorderLayout.CENTER);
|
||||
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 bProcess = ConfirmPanel.createProcessButton(Msg.getMsg(Env.getCtx(), "VPayPrintProcess"));
|
||||
private CLabel lPaySelect = new CLabel();
|
||||
private CComboBox fPaySelect = new CComboBox();
|
||||
private VLookup paySelectSearch = null;
|
||||
private CLabel lBank = new CLabel();
|
||||
private CLabel fBank = new CLabel();
|
||||
private CLabel lPaymentRule = new CLabel();
|
||||
|
@ -136,7 +141,6 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
bProcess.addActionListener(this);
|
||||
//
|
||||
lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID"));
|
||||
fPaySelect.addActionListener(this);
|
||||
//
|
||||
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
|
||||
,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));
|
||||
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));
|
||||
|
@ -192,17 +196,13 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
*/
|
||||
private void dynInit()
|
||||
{
|
||||
ArrayList<KeyNamePair> data = getPaySelectionData();
|
||||
for(KeyNamePair pp : data)
|
||||
fPaySelect.addItem(pp);
|
||||
|
||||
if (fPaySelect.getItemCount() == 0)
|
||||
ADialog.info(m_WindowNo, panel, "VPayPrintNoRecords");
|
||||
else
|
||||
{
|
||||
fPaySelect.setSelectedIndex(0);
|
||||
loadPaySelectInfo();
|
||||
}
|
||||
// C_PaySelection_ID
|
||||
int AD_Column_ID = 7670; // C_PaySelectionCheck.C_PaySelection_ID
|
||||
MLookup lookupPS = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.Search);
|
||||
paySelectSearch = new VLookup("C_PaySelection_ID", true, false, true, lookupPS);
|
||||
paySelectSearch.addVetoableChangeListener(this);
|
||||
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
|
@ -223,33 +223,25 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
{
|
||||
if (C_PaySelection_ID == 0)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
m_C_PaySelection_ID = C_PaySelection_ID;
|
||||
paySelectSearch.setValue(new Integer(m_C_PaySelection_ID));
|
||||
loadPaySelectInfo();
|
||||
} // setsetPaySelection
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
// log.config( "VPayPrint.actionPerformed" + e.toString());
|
||||
if (e.getSource() == fPaySelect)
|
||||
loadPaySelectInfo();
|
||||
// log.config( "VPayPrint.actionPerformed" + e.toString());
|
||||
if (e.getSource() == bCancel)
|
||||
dispose();
|
||||
else if (m_C_PaySelection_ID <= 0)
|
||||
return;
|
||||
else if (e.getSource() == fPaymentRule)
|
||||
loadPaymentRuleInfo();
|
||||
//
|
||||
else if (e.getSource() == bCancel)
|
||||
dispose();
|
||||
else if (e.getSource() == bExport)
|
||||
cmd_export();
|
||||
else if (e.getSource() == bProcess)
|
||||
|
@ -264,16 +256,17 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
private void loadPaySelectInfo()
|
||||
{
|
||||
log.info( "VPayPrint.loadPaySelectInfo");
|
||||
if (fPaySelect.getSelectedIndex() == -1)
|
||||
if (m_C_PaySelection_ID <= 0)
|
||||
return;
|
||||
|
||||
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
|
||||
loadPaySelectInfo(C_PaySelection_ID);
|
||||
loadPaySelectInfo(m_C_PaySelection_ID);
|
||||
|
||||
fBank.setText(bank);
|
||||
fCurrency.setText(currency);
|
||||
fBalance.setValue(balance);
|
||||
|
||||
m_frame.pack();
|
||||
|
||||
loadPaymentRule();
|
||||
} // loadPaySelectInfo
|
||||
|
||||
|
@ -288,8 +281,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
|
||||
fPaymentRule.removeAllItems();
|
||||
|
||||
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
|
||||
ArrayList<ValueNamePair> data = loadPaymentRule(C_PaySelection_ID);
|
||||
ArrayList<ValueNamePair> data = loadPaymentRule(m_C_PaySelection_ID);
|
||||
for(ValueNamePair pp : data)
|
||||
fPaymentRule.addItem(pp);
|
||||
|
||||
|
@ -313,8 +305,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
log.info("PaymentRule=" + PaymentRule);
|
||||
fNoPayments.setText(" ");
|
||||
|
||||
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
|
||||
String msg = loadPaymentRuleInfo(C_PaySelection_ID, PaymentRule);
|
||||
String msg = loadPaymentRuleInfo(m_C_PaySelection_ID, PaymentRule);
|
||||
|
||||
if(noPayments != null)
|
||||
fNoPayments.setText(noPayments);
|
||||
|
@ -334,7 +325,10 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
*/
|
||||
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);
|
||||
if (!getChecks(PaymentRule))
|
||||
return;
|
||||
|
@ -396,7 +390,10 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
*/
|
||||
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);
|
||||
if (!getChecks(PaymentRule))
|
||||
return;
|
||||
|
@ -408,7 +405,10 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
*/
|
||||
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);
|
||||
if (!getChecks(PaymentRule))
|
||||
return;
|
||||
|
@ -463,7 +463,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
private boolean getChecks(String PaymentRule)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
ADialog.error(m_WindowNo, panel, "VPayPrintNoRecords",
|
||||
|
@ -472,15 +472,14 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
}
|
||||
|
||||
// get data
|
||||
int C_PaySelection_ID = ((KeyNamePair)fPaySelect.getSelectedItem()).getKey();
|
||||
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));
|
||||
|
||||
// get Slecetions
|
||||
m_checks = MPaySelectionCheck.get(C_PaySelection_ID, PaymentRule, startDocumentNo, null);
|
||||
// get Selections
|
||||
m_checks = MPaySelectionCheck.get(m_C_PaySelection_ID, PaymentRule, startDocumentNo, null);
|
||||
|
||||
panel.setCursor(Cursor.getDefaultCursor());
|
||||
//
|
||||
|
@ -490,8 +489,32 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener
|
|||
"(" + Msg.translate(Env.getCtx(), "C_PaySelectionLine_ID") + " #0");
|
||||
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;
|
||||
} // 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
|
||||
|
|
|
@ -35,6 +35,9 @@ import org.adempiere.webui.component.Row;
|
|||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Window;
|
||||
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.CustomForm;
|
||||
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.SimplePDFViewer;
|
||||
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.MPaymentBatch;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.PaymentExport;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
@ -67,7 +72,7 @@ import org.zkoss.zul.Filedownload;
|
|||
* Contributors:
|
||||
* 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();
|
||||
|
||||
|
@ -78,8 +83,8 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
{
|
||||
try
|
||||
{
|
||||
zkInit();
|
||||
dynInit();
|
||||
zkInit();
|
||||
Borderlayout contentLayout = new Borderlayout();
|
||||
contentLayout.setWidth("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 bProcess = southPanel.createButton(ConfirmPanel.A_PROCESS);
|
||||
private Label lPaySelect = new Label();
|
||||
private Listbox fPaySelect = ListboxFactory.newDropdownListbox();
|
||||
private WSearchEditor paySelectSearch = null;
|
||||
private Label lBank = new Label();
|
||||
private Label fBank = new Label();
|
||||
private Label lPaymentRule = new Label();
|
||||
|
@ -138,7 +143,6 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
bProcess.addActionListener(this);
|
||||
//
|
||||
lPaySelect.setText(Msg.translate(Env.getCtx(), "C_PaySelection_ID"));
|
||||
fPaySelect.addActionListener(this);
|
||||
//
|
||||
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();
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(lPaySelect.rightAlign());
|
||||
row.appendChild(fPaySelect);
|
||||
row.appendChild(paySelectSearch.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(lBank.rightAlign());
|
||||
|
@ -189,17 +193,12 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
*/
|
||||
private void dynInit()
|
||||
{
|
||||
ArrayList<KeyNamePair> data = getPaySelectionData();
|
||||
for(KeyNamePair pp : data)
|
||||
fPaySelect.addItem(pp);
|
||||
// C_PaySelection_ID
|
||||
int AD_Column_ID = 7670; // C_PaySelectionCheck.C_PaySelection_ID
|
||||
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
|
||||
|
||||
/**
|
||||
|
@ -219,16 +218,9 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
if (C_PaySelection_ID == 0)
|
||||
return;
|
||||
//
|
||||
for (int i = 0; i < fPaySelect.getItemCount(); i++)
|
||||
{
|
||||
KeyNamePair pp = fPaySelect.getItemAtIndex(i).toKeyNamePair();
|
||||
if (pp.getKey() == C_PaySelection_ID)
|
||||
{
|
||||
fPaySelect.setSelectedIndex(i);
|
||||
loadPaySelectInfo();
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_C_PaySelection_ID = C_PaySelection_ID;
|
||||
paySelectSearch.setValue(new Integer(m_C_PaySelection_ID));
|
||||
loadPaySelectInfo();
|
||||
} // setsetPaySelection
|
||||
|
||||
|
||||
|
@ -238,14 +230,14 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
*/
|
||||
public void onEvent(Event e)
|
||||
{
|
||||
// log.config( "VPayPrint.actionPerformed" + e.toString());
|
||||
if (e.getTarget() == fPaySelect)
|
||||
loadPaySelectInfo();
|
||||
// log.config( "VPayPrint.actionPerformed" + e.toString());
|
||||
if (e.getTarget() == bCancel)
|
||||
dispose();
|
||||
else if (m_C_PaySelection_ID <= 0)
|
||||
return;
|
||||
else if (e.getTarget() == fPaymentRule)
|
||||
loadPaymentRuleInfo();
|
||||
//
|
||||
else if (e.getTarget() == bCancel)
|
||||
dispose();
|
||||
else if (e.getTarget() == bExport)
|
||||
cmd_export();
|
||||
else if (e.getTarget() == bProcess)
|
||||
|
@ -260,12 +252,11 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
private void loadPaySelectInfo()
|
||||
{
|
||||
log.info( "VPayPrint.loadPaySelectInfo");
|
||||
if (fPaySelect.getSelectedIndex() == -1)
|
||||
if (m_C_PaySelection_ID <= 0)
|
||||
return;
|
||||
|
||||
// load Banks from PaySelectLine
|
||||
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey();
|
||||
loadPaySelectInfo(C_PaySelection_ID);
|
||||
loadPaySelectInfo(m_C_PaySelection_ID);
|
||||
|
||||
fBank.setText(bank);
|
||||
fCurrency.setText(currency);
|
||||
|
@ -286,8 +277,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
fPaymentRule.removeAllItems();
|
||||
|
||||
// load PaymentRule for Bank
|
||||
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey();
|
||||
ArrayList<ValueNamePair> data = loadPaymentRule(C_PaySelection_ID);
|
||||
ArrayList<ValueNamePair> data = loadPaymentRule(m_C_PaySelection_ID);
|
||||
for(ValueNamePair pp : data)
|
||||
fPaymentRule.addItem(pp);
|
||||
|
||||
|
@ -313,8 +303,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
log.info("PaymentRule=" + PaymentRule);
|
||||
fNoPayments.setText(" ");
|
||||
|
||||
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey();
|
||||
String msg = loadPaymentRuleInfo(C_PaySelection_ID, PaymentRule);
|
||||
String msg = loadPaymentRuleInfo(m_C_PaySelection_ID, PaymentRule);
|
||||
|
||||
if(noPayments != null)
|
||||
fNoPayments.setText(noPayments);
|
||||
|
@ -514,7 +503,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
private boolean getChecks(String PaymentRule)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
FDialog.error(m_WindowNo, form, "VPayPrintNoRecords",
|
||||
|
@ -523,13 +512,12 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
}
|
||||
|
||||
// get data
|
||||
int C_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey();
|
||||
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
|
||||
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)
|
||||
|
@ -538,7 +526,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
"(" + Msg.translate(Env.getCtx(), "C_PaySelectionLine_ID") + " #0");
|
||||
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;
|
||||
} // getChecks
|
||||
|
||||
|
@ -546,4 +534,26 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
|||
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
|
||||
|
|
|
@ -43,6 +43,8 @@ public class PayPrint {
|
|||
public int m_C_BankAccount_ID = -1;
|
||||
/** Export Class for Bank Account */
|
||||
public String m_PaymentExportClass = null;
|
||||
/** Payment Selection */
|
||||
public int m_C_PaySelection_ID = 0;
|
||||
|
||||
/** Payment Information */
|
||||
public MPaySelectionCheck[] m_checks = null;
|
||||
|
|
Loading…
Reference in New Issue