Commit 32d8ed00 authored by ngadkari's avatar ngadkari

Lc voucher close migration

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@188543 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2949375c
...@@ -264,23 +264,40 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -264,23 +264,40 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
pstmt=null; pstmt=null;
rs.close(); rs.close();
rs=null; rs=null;
sql = "SELECT UDF_STR1 FROM GENCODES WHERE FLD_NAME = 'TRAN_TYPE' AND (MOD_NAME = 'W_LC_VOUCHER' OR MOD_NAME = 'X')" sql = "SELECT UDF_STR1 FROM GENCODES WHERE FLD_NAME = 'TRAN_TYPE' AND (MOD_NAME = 'W_LC_VOUCHER') "
+ "AND RTRIM(FLD_VALUE) = ? "; + "AND RTRIM(FLD_VALUE) = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranType); pstmt1.setString(1, tranType);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if (rs1.next()) if (rs1.next())
{ {
genCodeVal=rs1.getString("UDF_STR1"); ////gencode val if Y then boolean true genCodeVal=rs1.getString("UDF_STR1"); //gencode val if Y then boolean true
} }
if(genCodeVal.equalsIgnoreCase("N")) pstmt1.close();
pstmt1=null;
rs1.close();
rs1=null;
if(genCodeVal == null || genCodeVal.trim().length() <= 0 )
{ {
NoacctEffect=true; //No accounting effect boolean sql = "SELECT UDF_STR1 FROM GENCODES WHERE FLD_NAME = 'TRAN_TYPE' AND (MOD_NAME = 'X')"
+ "AND RTRIM(FLD_VALUE) = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranType);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
genCodeVal=rs1.getString("UDF_STR1"); //gencode val if Y then boolean true
} }
pstmt1.close(); pstmt1.close();
pstmt1=null; pstmt1=null;
rs1.close(); rs1.close();
rs1=null; rs1=null;
}
if(genCodeVal.equalsIgnoreCase("N"))
{
NoacctEffect=true; //No accounting effect boolean
}
//Initializing HashMaps //Initializing HashMaps
HashMap glTraceUpd=new HashMap(); HashMap glTraceUpd=new HashMap();
...@@ -348,6 +365,8 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -348,6 +365,8 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
} }
} }
if(!NoacctEffect) //No accounting effect
{
// credit lc account - cr end // credit lc account - cr end
// update misc_payables for LCVOUH // update misc_payables for LCVOUH
sql = "select adj_amt from misc_payables WHERE TRAN_SER = 'LCVOUH' and ref_no =?" ; sql = "select adj_amt from misc_payables WHERE TRAN_SER = 'LCVOUH' and ref_no =?" ;
...@@ -377,12 +396,12 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -377,12 +396,12 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
pstmt.setTimestamp(2,new Timestamp(System.currentTimeMillis())); pstmt.setTimestamp(2,new Timestamp(System.currentTimeMillis()));
pstmt.setString(3,"LCVOUH"); pstmt.setString(3,"LCVOUH");
pstmt.setString(4,tranId); pstmt.setString(4,tranId);
int upd = pstmt.executeUpdate(); int cnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(upd>0) if (cnt < 0) {
{ errString = itmDbAccessEjb.getErrorString("", "DS000", "", "", conn);
System.out.println("upd tot_amt"+upd); return errString;
} }
// debit supplier / site dr - start // debit supplier / site dr - start
...@@ -390,10 +409,9 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -390,10 +409,9 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
//debit supplier /site dr -start //debit supplier /site dr -start
//debit supplier / site a/c dr -start //debit supplier / site a/c dr -start
if(!NoacctEffect) //No accounting effect
{
if(!lbCustFor) if(!lbCustFor)
{ //HashMap glTraceUpd=new HashMap(); { //HashMap glTraceUpd=new HashMap();
if(lbSameSite || ("R".equalsIgnoreCase(lsLink) || "C".equalsIgnoreCase(lsLink)) ) if(lbSameSite || ("R".equalsIgnoreCase(lsLink) || "C".equalsIgnoreCase(lsLink)) )
...@@ -556,9 +574,9 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -556,9 +574,9 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
int upd1 = pstmt.executeUpdate(); int upd1 = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(upd1>0) if (upd1 < 0) {
{ errString = itmDbAccessEjb.getErrorString("", "DS000", "", "", conn);
System.out.println("upd tot_amt"+upd); return errString;
} }
...@@ -615,7 +633,10 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -615,7 +633,10 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
updcnt=pstmt1.executeUpdate(); updcnt=pstmt1.executeUpdate();
pstmt1.close(); pstmt1.close();
pstmt1=null; pstmt1=null;
if (updcnt < 0) {
errString = itmDbAccessEjb.getErrorString("", "DS000", "", "", conn);
return errString;
}
if(updcnt==0) if(updcnt==0)
{ {
...@@ -629,6 +650,35 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -629,6 +650,35 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally {
try {
if (rs1 != null) {
rs1.close();
rs1 = null;
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (pstmt1 != null) {
pstmt1.close();
pstmt1 = null;
}
Fcommon = null;
genericUtility=null;
itmDbAccessEjb =null;
} catch (Exception e) {
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return errString; return errString;
...@@ -679,7 +729,11 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -679,7 +729,11 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
System.out.println("Exception :CreateDistOrder :saveData :==>"); System.out.println("Exception :CreateDistOrder :saveData :==>");
throw new ITMException(e); throw new ITMException(e);
} }
finally {
genericUtility=null;
}
return retString; return retString;
} }
public String gbfCreateMiscDr(HashMap lcVouchHdr,String drType,String xtraParams,Connection conn) throws ITMException public String gbfCreateMiscDr(HashMap lcVouchHdr,String drType,String xtraParams,Connection conn) throws ITMException
{ {
...@@ -931,10 +985,15 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -931,10 +985,15 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
System.out.println("Debit Note xml["+xmlBuff.toString()+"]"); System.out.println("Debit Note xml["+xmlBuff.toString()+"]");
errString=saveData(xtraParams, site, xmlBuff.toString(), conn); errString=saveData(xtraParams, site, xmlBuff.toString(), conn);
System.out.println("MiscDebit Note savedata()"+errString); System.out.println("MiscDebit Note savedata()"+errString);
if (errString != null && errString.trim().length() > 0) if (errString != null && "SUCCESS".equals(errString))
{
System.out.println("errString = [" + errString + "]");
}
else
{ {
return errString; return errString;
} }
} }
} }
...@@ -943,6 +1002,28 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -943,6 +1002,28 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
Fcommon = null;
itmDbAccessEjb =null;
} catch (Exception e) {
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return errString; return errString;
} }
public String gbfCreateLc(HashMap lcVouchHdr,String xtraParams,Connection conn) throws ITMException public String gbfCreateLc(HashMap lcVouchHdr,String xtraParams,Connection conn) throws ITMException
...@@ -1046,6 +1127,26 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal, ...@@ -1046,6 +1127,26 @@ public class LcVouchClose extends ActionHandlerEJB implements LcVouchCloseLocal,
throw new ITMException(e); throw new ITMException(e);
} }
finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
genericUtility=null;
} catch (Exception e) {
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return errString; return errString;
} }
......
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