BF [ 2240484 ] Re MatchingPO, MMatchPO doesn't contains Invoice info

https://sourceforge.net/tracker/index.php?func=detail&aid=2240484&group_id=176962&atid=879332
This commit is contained in:
bayucahya 2008-11-08 09:34:01 +00:00
parent b4a53d76a8
commit 421f7abe31
2 changed files with 68 additions and 0 deletions

View File

@ -40,6 +40,10 @@ import org.compiere.util.Env;
* *
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>BF [ 1926113 ] MMatchInv.getNewerDateAcct() should work in trx * <li>BF [ 1926113 ] MMatchInv.getNewerDateAcct() should work in trx
*
* @author Bayu Cahya, Sistematika
* <li>BF [ 2240484 ] Re MatchingPO, MMatchPO doesn't contains Invoice info
*
*/ */
public class MMatchInv extends X_M_MatchInv public class MMatchInv extends X_M_MatchInv
{ {
@ -541,4 +545,47 @@ public class MMatchInv extends X_M_MatchInv
return ""; return "";
} }
// Bayu, Sistematika
/**
* Get Inv Matches for InOutLine
* @param ctx context
* @param M_InOutLine_ID shipment
* @param trxName transaction
* @return array of matches
*/
public static MMatchInv[] getInOutLine (Properties ctx,
int M_InOutLine_ID, String trxName)
{
if (M_InOutLine_ID == 0)
return new MMatchInv[]{};
//
String sql = "SELECT * FROM M_MatchInv m "
+ "WHERE m.M_InOutLine_ID=?";
ArrayList<MMatchInv> list = new ArrayList<MMatchInv>();
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, M_InOutLine_ID);
rs = pstmt.executeQuery ();
while (rs.next ())
list.add (new MMatchInv (ctx, rs, trxName));
}
catch (Exception e)
{
s_log.log(Level.SEVERE, sql, e);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
MMatchInv[] retValue = new MMatchInv[list.size()];
list.toArray (retValue);
return retValue;
} // getInOutLine
// end Bayu
} // MMatchInv } // MMatchInv

View File

@ -37,6 +37,9 @@ import org.compiere.util.Env;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MMatchPO.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MMatchPO.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
*
* @author Bayu Cahya, Sistematika
* <li>BF [ 2240484 ] Re MatchingPO, MMatchPO doesn't contains Invoice info
*/ */
public class MMatchPO extends X_M_MatchPO public class MMatchPO extends X_M_MatchPO
{ {
@ -506,6 +509,24 @@ public class MMatchPO extends X_M_MatchPO
setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID());
} }
// Bayu, Sistematika
// BF [ 2240484 ] Re MatchingPO, MMatchPO doesn't contains Invoice info
// If newRecord, set c_invoiceline_id while null
if (newRecord && getC_InvoiceLine_ID() == 0)
{
MMatchInv[] mpi = MMatchInv.getInOutLine(getCtx(), getM_InOutLine_ID(), get_TrxName());
for (int i = 0; i < mpi.length; i++)
{
if (mpi[i].getC_InvoiceLine_ID() != 0 &&
mpi[i].getM_AttributeSetInstance_ID() == getM_AttributeSetInstance_ID())
{
setC_InvoiceLine_ID(mpi[i].getC_InvoiceLine_ID());
break;
}
}
}
// end Bayu
// Find OrderLine // Find OrderLine
if (getC_OrderLine_ID() == 0) if (getC_OrderLine_ID() == 0)
{ {