[ 1811114 ] Is necessary add the payment authorization code as filter

http://sourceforge.net/tracker/index.php?func=detail&aid=1811114&group_id=176962&atid=879335

Revert my overwrite error in VCreateFromShipment.java
This commit is contained in:
vpj-cd 2007-10-11 04:36:39 +00:00
parent 3626c3881c
commit 975526b813
2 changed files with 54 additions and 10 deletions

View File

@ -599,7 +599,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
iol.setUser1_ID(il.getUser1_ID());
iol.setUser2_ID(il.getUser2_ID());
}
/*else if (M_RMALine_ID != 0)
else if (M_RMALine_ID != 0)
{
rmal = new MRMALine(Env.getCtx(), M_RMALine_ID, null);
iol.setM_RMALine_ID(M_RMALine_ID);
@ -624,7 +624,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
iol.setC_Charge_ID(il.getC_Charge_ID());
else if (rmal != null && rmal.getC_Charge_ID() != 0) // from rma
iol.setC_Charge_ID(rmal.getC_Charge_ID());
}*/
}
//
iol.setM_Locator_ID(M_Locator_ID);
if (!iol.save())
@ -665,7 +665,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
inout.setUser1_ID(m_invoice.getUser1_ID());
inout.setUser2_ID(m_invoice.getUser2_ID());
}
/*if (m_rma != null && m_rma.getM_RMA_ID() != 0)
if (m_rma != null && m_rma.getM_RMA_ID() != 0)
{
MInOut originalIO = m_rma.getShipment();
inout.setIsSOTrx(!m_rma.isSOTrx());
@ -678,7 +678,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
inout.setC_Activity_ID(originalIO.getC_Activity_ID());
inout.setUser1_ID(originalIO.getUser1_ID());
inout.setUser2_ID(originalIO.getUser2_ID());
}*/
}
inout.save();
return true;
} // save

View File

@ -22,6 +22,7 @@ import java.sql.*;
import java.text.*;
import java.util.*;
import java.util.logging.*;
import java.awt.event.ActionEvent;
import javax.swing.table.*;
import org.compiere.apps.*;
import org.compiere.grid.ed.*;
@ -33,6 +34,8 @@ import org.compiere.util.*;
*
* @author Jorg Janke
* @version $Id: VCreateFromStatement.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
* @author Victor Perez, e-Evolucion
* <li> RF [1811114] http://sourceforge.net/tracker/index.php?func=detail&aid=1811114&group_id=176962&atid=879335
*/
public class VCreateFromStatement extends VCreateFrom implements VetoableChangeListener
{
@ -73,7 +76,11 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
bankAccountField.setValue(new Integer(C_BankAccount_ID));
// initial Loading
loadBankAccount(C_BankAccount_ID);
//RF [1811114]
String R_AuthCode="";
authorizationField = new VString ("authorization", false, false, true, 10, 30, null, null);
authorizationField.addActionListener(this);
loadBankAccount(C_BankAccount_ID, R_AuthCode);
return true;
} // dynInit
@ -93,12 +100,19 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
public void vetoableChange (PropertyChangeEvent e)
{
log.config(e.getPropertyName() + "=" + e.getNewValue());
int C_BankAccount_ID=0;
//RF [1811114]
String R_AuthCode = (authorizationField.getValue().toString());
// BankAccount
if (e.getPropertyName().equals("C_BankAccount_ID"))
{
int C_BankAccount_ID = ((Integer)e.getNewValue()).intValue();
loadBankAccount(C_BankAccount_ID);
//RF [1811114]
C_BankAccount_ID = ((Integer)e.getNewValue()).intValue();
if (authorizationField.getValue().toString().equals(""))
loadBankAccount(C_BankAccount_ID, null);
else
loadBankAccount(C_BankAccount_ID, R_AuthCode);
}
tableChanged(null);
} // vetoableChange
@ -106,8 +120,10 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
/**
* Load Data - Bank Account
* @param C_BankAccount_ID Bank Account
* @param Autorization Code
*/
private void loadBankAccount (int C_BankAccount_ID)
//RF [1811114]
private void loadBankAccount (int C_BankAccount_ID, String R_AuthCode)
{
log.config ("C_BankAccount_ID=" + C_BankAccount_ID);
/**
@ -127,8 +143,12 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
+ " LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) "
+ "WHERE p.Processed='Y' AND p.IsReconciled='N'"
+ " AND p.DocStatus IN ('CO','CL','RE','VO') AND p.PayAmt<>0" // Bug 1564453 Added Voided payment to bank statement payement selection
+ " AND p.C_BankAccount_ID=?" // #2
+ " AND NOT EXISTS (SELECT * FROM C_BankStatementLine l "
+ " AND p.C_BankAccount_ID=?"; // #2
//RF [1811114]
if (R_AuthCode!= "" && R_AuthCode!= null)
sql = sql + " AND p.R_AuthCode LIKE ?";
sql = sql + " AND NOT EXISTS (SELECT * FROM C_BankStatementLine l "
// Voided Bank Statements have 0 StmtAmt
+ "WHERE p.C_Payment_ID=l.C_Payment_ID AND l.StmtAmt <> 0)";
@ -142,6 +162,9 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setTimestamp(1, ts);
pstmt.setInt(2, C_BankAccount_ID);
//RF [1811114]
if (R_AuthCode!= "" && R_AuthCode!= null){
pstmt.setString(3, R_AuthCode);}
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
@ -256,5 +279,26 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
} // for all rows
return true;
} // save
/*
* Action Listener
* @param e event*/
//RF [1811114]
public void actionPerformed(ActionEvent e)
{
super.actionPerformed(e);
log.config("Action=" + e.getActionCommand());
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
if (e.getSource().equals(authorizationField))
{
String R_AuthCode = (authorizationField.getValue().toString());
if (authorizationField.getValue().toString().equals(""))
{
loadBankAccount(C_BankAccount_ID, null);
}
else
loadBankAccount(C_BankAccount_ID, R_AuthCode);
}
}
} // VCreateFromStatement