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