Commit bc586df0 authored by vdhoble's avatar vdhoble

Changes as Per Gltrace preview acct effect.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@38253 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 98ba2c0e
......@@ -722,13 +722,15 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
{
//if(tranDate.compareTo(toDay) > 0) change done by kunal on 10/jun/14 comment if statement
//{
if(!isPreview)
{//avoiding update****Vishakha
sql =" update misc_drcr_rcp set tran_date = ? "
+" where tran_id = ?";
pstmt = conn.prepareStatement(sql);
//pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(1,toDay);//change done by kunal on 10/jun/14
pstmt.setString(2,tranId);
if(!isPreview){//avoiding update****Vishakha
upd = pstmt.executeUpdate();
if(upd <1 )
{
......@@ -739,8 +741,8 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
//}
}
}
if(!isPreview){ //if isPreview is true
System.out.println("roundAdj["+roundAdj+"]");
if(("null".equals(roundAdj)) || (roundAdj == 0))
{
amthdr1 = amount ;
......@@ -749,8 +751,12 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
amount = Dcommon.getRndamt(amthdr1,rndOff,rndTo);
}
System.out.println("754---amount["+amount+"]");
System.out.println("755---amthdr1["+amthdr1+"]");
if(amthdr1 != amount)
{
if(!isPreview)
{ //if isPreview is true
sql =" update misc_drcr_rcp "
+" set round_adj = ? ,amount = ? ,amount__bc = ? "
+" where tran_id = ? ";
......@@ -768,13 +774,14 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmt.close();
pstmt = null;
}//ending isPreview Condition
miscRcpMap.put("round_adj",(amount - amthdr1));
miscRcpMap.put("amount",amthdr1);
//miscRcpMap.put("amount",amthdr1);
miscRcpMap.put("amount",amount);
miscRcpMap.put("amount__bc",(amount * exchRate));
}
}
}//ending isPreview Condition
System.out.println("miscRcpMap--["+miscRcpMap+"]");
//insert into misc_drcr_rdet
// sqlInsert =" insert into misc_drcr_rdet "
......@@ -783,6 +790,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
// pstmtInsert = conn.prepareStatement(sqlInsert);
amountRadj =Double.parseDouble(miscRcpMap.get("round_adj").toString());
System.out.println("amountRadj["+amountRadj+"]");
if("null".equals(amountRadj))
{
amountRadj = 0;
......@@ -844,7 +852,8 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
//
// if(!(acctCodeRadj.equalsIgnoreCase(acctCode)) &&(cctrCodeRadj.equalsIgnoreCase(cctrCode)))
// {
if(!isPreview)
{
System.out.println("inserting into misc_drcr_rdetif(!(acctCodeRadj.equalsIgnoreCase(acctCode)) &&(cctrCodeRadj.equalsIgnoreCase(cctrCode)))");
sqlInsert =" insert into misc_drcr_rdet "
......@@ -852,13 +861,10 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
+" values (?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(sqlInsert);
miscRdetListMap = new HashMap();
miscRdetListMap = (HashMap) miscRdetList.get(miscRdetList.size()-1);
lineNo = (String) miscRdetListMap.get("line_no");
lineNo = (new Integer (Integer.parseInt(lineNo)+1)).toString() ;
// lineNo =lineNo+1;
// lineNo =lineNo+1;
pstmtInsert.setString(1,tranId);
pstmtInsert.setString(2,lineNo);
pstmtInsert.setString(3,acctCodeRadj);
......@@ -866,8 +872,22 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert.setDouble(5,amountRadj);
pstmtInsert.setString(6,"");
pstmtInsert.setString(7,"");
upd = pstmtInsert.executeUpdate();
pstmtInsert.close();
pstmtInsert=null;
if(upd <1)
{
throw new Exception("Update Fail");
}
}
// pstmtInsert.addBatch();
//adding values to miscRdetListMap
miscRdetListMap = new HashMap();
miscRdetListMap = (HashMap) miscRdetList.get(miscRdetList.size()-1);
lineNo = (String) miscRdetListMap.get("line_no");
lineNo = (new Integer (Integer.parseInt(lineNo)+1)).toString() ;
miscRdetMap = new HashMap();
miscRdetMap.put("tran_id", tranId);
miscRdetMap.put("line_no", lineNo);
......@@ -881,18 +901,12 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
//end
if(!isPreview)
{ //if isPreview is true
upd = pstmtInsert.executeUpdate();
pstmtInsert.close();
pstmtInsert=null;
if(upd <1)
{
throw new Exception("Update Fail");
}
}
else
{
if(!isPreview)
{ //if isPreview is true
// sqlInner =" update MISC_DRCR_RDET set amount = ? where tran_id = ? and line_no = ? ";
sqlInner =" update MISC_DRCR_RDET set amount =amount+ ? where tran_id = ? and line_no = ? ";
pstmtInner = conn.prepareStatement(sqlInner);
......@@ -900,16 +914,17 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInner.setDouble(1,amountRadj);
pstmtInner.setString(2,tranId);
pstmtInner.setString(3,lineNo);
if(!isPreview)
{ //if isPreview is true
updCnt = pstmtInner.executeUpdate();
if(updCnt <1)
{
throw new ITMException(new Exception("updateFail"));
}
pstmtInner.close();
}
pstmtInner = null;
}
//}
// modify Map for these new values
miscRdetListMap = new HashMap();
miscRdetListMap = (HashMap)miscRdetList.get(foundAt);
......@@ -942,7 +957,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
//end
}
}
// }
} // end of amountRadj !=0
......@@ -1189,30 +1204,32 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
}
}
if(!isPreview){ //if isPreview
if(!status)
// if(!(acctCodeReco.equalsIgnoreCase(acctCode)) &&(cctrCodeReco.equalsIgnoreCase(cctrCode)))
{
if(!isPreview)
{ //if isPreview
sqlInsert =" insert into misc_drcr_rdet "
+" (tran_id,line_no,acct_code,cctr_code,amount,emp_code,anal_code)"
+" values (?,?,?,?,?,?,?)";
pstmtInsert=conn.prepareStatement(sqlInsert);
// if(status && flg)
// {
// if(status && flg)
// {
miscRdetListMap = new HashMap();
miscRdetListMap = (HashMap) miscRdetList.get(miscRdetList.size()-1);
lineNo = (String) miscRdetListMap.get("line_no");
// flg=false;
// flg=false;
System.out.println("lineNo status" +lineNo +status);
// }
// }
lineNo = (new Integer (Integer.parseInt(lineNo)+1)).toString() ;
// lineNo = lineNo +1;
//for testing
// if(cctrCodeReco ==null)
// {
// cctrCodeReco="";
// }
// if(cctrCodeReco ==null)
// {
// cctrCodeReco="";
// }
//for testing
pstmtInsert.setString(1,tranId);
pstmtInsert.setString(2,lineNo);
......@@ -1222,6 +1239,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert.setString(6,"");
pstmtInsert.setString(7,"");
pstmtInsert.addBatch();
}
//adding values to miscRdetListMap
miscRdetMap = new HashMap();
miscRdetMap.put("tran_id", tranId);
......@@ -1238,8 +1256,10 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
}
else
{
if(!isPreview){ //if isPreview
// sqlInner =" update MISC_DRCR_RDET set amount = ? where tran_id = ? and line_no = ? ";
sqlInner =" update MISC_DRCR_RDET set amount = amount + ? where tran_id = ? and line_no = ? ";
pstmtInner = conn.prepareStatement(sqlInner);
......@@ -1256,6 +1276,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInner.close();
pstmtInner = null;
}
// modify Map for these new values
miscRdetListMap = new HashMap();
miscRdetListMap = (HashMap)miscRdetList.get(foundAt);
......@@ -1290,7 +1311,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
}
}//end of isPreview condition
//}//end of isPreview condition
// }
}// end while
......@@ -1315,7 +1336,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
{
if(("AI".equalsIgnoreCase(adjMiscCrn.trim())) || ("AC".equalsIgnoreCase(adjMiscCrn.trim())))
{
errString = this.gbfPopuMiscDrcrRcpAdj(tranId,miscRcpMap,adjMiscCrn,miscRcpInvList,conn);
errString = this.gbfPopuMiscDrcrRcpAdj(tranId,miscRcpMap,adjMiscCrn,miscRcpInvList,isPreview,conn);
if(errString != null && errString.trim().length() > 0)
{
return errString;
......@@ -1476,7 +1497,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
//migration of gbfPopuMiscDrcrRcpAdj
//populating automatic adjustment of advance of customer
private String gbfPopuMiscDrcrRcpAdj(String tranId,HashMap miscRcpMap,String adjMiscCrn,ArrayList miscRcpInvList,Connection conn)throws RemoteException,ITMException
private String gbfPopuMiscDrcrRcpAdj(String tranId,HashMap miscRcpMap,String adjMiscCrn,ArrayList miscRcpInvList,Boolean isPreview,Connection conn)throws RemoteException,ITMException
{
PreparedStatement pstmt = null;
PreparedStatement pstmtInsert = null;
......@@ -1499,7 +1520,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
int line =0;
int upd1=0;
int []batchCount =null;
HashMap<String, String>miscRcpInvMap=null;
try
{
System.out.println("<!@#> In gbfPopuMiscDrcrRcpAdj :::::::::::::::::::::::::::::::");
......@@ -1555,6 +1576,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert=null;
while (rs.next())
{
miscRcpInvMap = new HashMap<String, String>();
pstmtInsert = conn.prepareStatement(sqlInsert);
tranSer = rs.getString("tran_ser");
......@@ -1566,21 +1588,36 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert.setInt(2,line);
pstmtInsert.setString(3,tranSer);
pstmtInsert.setString(4,recNo.trim());
miscRcpInvMap.put("line_no",line+"");
miscRcpInvMap.put("ref_ser",tranSer);
miscRcpInvMap.put("ref_no",recNo.trim());
if(amt >= adjAmt)
{
totAdj = totAdj +adjAmt;
pstmtInsert.setDouble(5,adjAmt);
pstmtInsert.setDouble(6,adjAmt);
amt = amt - adjAmt;
miscRcpInvMap.put("adj_amt",adjAmt+"");
miscRcpInvMap.put("ref_bal_amt",adjAmt+"");
}
else
{
totAdj = totAdj + amt;
pstmtInsert.setDouble(5,amt);
pstmtInsert.setDouble(6,adjAmt);
miscRcpInvMap.put("adj_amt",amt+"");
miscRcpInvMap.put("ref_bal_amt",adjAmt+"");
}
pstmtInsert.addBatch();
//miscRcpInvMap.put("adj_amt",adjAmt);
//miscRcpInvMap.put("ref_bal_amt",refBalAmt);
miscRcpInvMap.put("mrp_value__adj","0");
miscRcpInvList.add(miscRcpInvMap);
// pstmtInsert.executeBatch();
// upd1 = pstmtInsert.executeUpdate();
// if(upd1<1)
......@@ -1590,6 +1627,8 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
}//end of while
if(!isPreview)
{
if(pstmtInsert !=null)
{
batchCount =pstmtInsert.executeBatch();
......@@ -1599,6 +1638,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert.close();
}
rs.close();
rs = null;
pstmt.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment