Fix bug reported on [1913092] - Add the Payment Rule to Commissioning
https://sourceforge.net/tracker/index.php?func=detail&aid=1913092&group_id=176962&atid=879335 Bug reported here: https://sourceforge.net/projects/adempiere/forums/forum/610547/topic/3966649
This commit is contained in:
parent
987510a45b
commit
d69c6ebded
|
@ -0,0 +1,5 @@
|
||||||
|
-- Dec 11, 2010 10:19:59 AM COT
|
||||||
|
-- Fix bug on [1913092] - Add the Payment Rule to Commissioning
|
||||||
|
UPDATE AD_Column SET AD_Reference_ID=17,Updated=TO_DATE('2010-12-11 10:19:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=54679
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- Dec 11, 2010 10:19:59 AM COT
|
||||||
|
-- Fix bug on [1913092] - Add the Payment Rule to Commissioning
|
||||||
|
UPDATE AD_Column SET AD_Reference_ID=17,Updated=TO_TIMESTAMP('2010-12-11 10:19:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=54679
|
||||||
|
;
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class CommissionCalc extends SvrProcess
|
||||||
// CommissionOrders/Invoices
|
// CommissionOrders/Invoices
|
||||||
if (lines[i].isCommissionOrders())
|
if (lines[i].isCommissionOrders())
|
||||||
{
|
{
|
||||||
MUser[] users = MUser.getOfBPartner(getCtx(), m_com.getC_BPartner_ID());
|
MUser[] users = MUser.getOfBPartner(getCtx(), m_com.getC_BPartner_ID(), get_TrxName());
|
||||||
if (users == null || users.length == 0)
|
if (users == null || users.length == 0)
|
||||||
throw new AdempiereUserError ("Commission Business Partner has no Users/Contact");
|
throw new AdempiereUserError ("Commission Business Partner has no Users/Contact");
|
||||||
if (users.length == 1)
|
if (users.length == 1)
|
||||||
|
@ -236,8 +236,7 @@ public class CommissionCalc extends SvrProcess
|
||||||
+ "(SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID=").append(lines[i].getM_Product_Category_ID()).append(")");
|
+ "(SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID=").append(lines[i].getM_Product_Category_ID()).append(")");
|
||||||
// Payment Rule
|
// Payment Rule
|
||||||
if (lines[i].getPaymentRule() != null)
|
if (lines[i].getPaymentRule() != null)
|
||||||
sql.append(" AND h.PaymentRule IN "
|
sql.append(" AND h.PaymentRule='").append(lines[i].getPaymentRule()).append("'");
|
||||||
+ "(SELECT AD_Ref_List_ID FROM AD_Ref_List WHERE AD_Reference_ID=195 and value = '").append(lines[i].getPaymentRule()).append("')");
|
|
||||||
// Grouping
|
// Grouping
|
||||||
if (!m_com.isListDetails())
|
if (!m_com.isListDetails())
|
||||||
sql.append(" GROUP BY h.C_Currency_ID");
|
sql.append(" GROUP BY h.C_Currency_ID");
|
||||||
|
@ -339,17 +338,19 @@ public class CommissionCalc extends SvrProcess
|
||||||
* Create Commission Detail
|
* Create Commission Detail
|
||||||
* @param sql sql statement
|
* @param sql sql statement
|
||||||
* @param comAmt parent
|
* @param comAmt parent
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void createDetail (String sql, MCommissionAmt comAmt)
|
private void createDetail (String sql, MCommissionAmt comAmt) throws Exception
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, m_com.getAD_Client_ID());
|
pstmt.setInt(1, m_com.getAD_Client_ID());
|
||||||
pstmt.setTimestamp(2, p_StartDate);
|
pstmt.setTimestamp(2, p_StartDate);
|
||||||
pstmt.setTimestamp(3, m_EndDate);
|
pstmt.setTimestamp(3, m_EndDate);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
// CommissionAmount, C_Currency_ID, Amt, Qty,
|
// CommissionAmount, C_Currency_ID, Amt, Qty,
|
||||||
|
@ -372,26 +373,19 @@ public class CommissionCalc extends SvrProcess
|
||||||
cd.setConvertedAmt(date);
|
cd.setConvertedAmt(date);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!cd.save()) // creates memory leak
|
if (!cd.save())
|
||||||
throw new IllegalArgumentException ("CommissionCalc - Detail Not saved");
|
throw new IllegalArgumentException ("CommissionCalc - Detail Not saved");
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "createDetail", e);
|
throw new AdempiereSystemError("System Error: " + e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
} // createDetail
|
} // createDetail
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue