Commit 57d942a2 authored by prane's avatar prane

Open Cursor Issue in Receivables Opening

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@190793 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 88c1413d
......@@ -78,11 +78,11 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
//Statement stmt = null;
PreparedStatement pstmt = null,pstmt1 = null;;
ResultSet rs = null,rs1 = null;;
StringBuffer valueXmlString = new StringBuffer();
String sql = "";
String sql = "", sql1;
String columnValue = "";
String retValue1 = "";
String retValue2 = "";
......@@ -187,18 +187,23 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
currCode = rs.getString(4);
currDescr = rs.getString(5);
}
pstmt.close();
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT ACCT_PRD FROM PARAMETER";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
acctPrd = rs.getString(1);
}
stmt.close();
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("AcctPrd :" + acctPrd + " SiteCode : " + loginSite + " FinEntity :" + finEntity + " CurrCode :" + currCode + " EmpCode :" + empCode );
valueXmlString.append("<acct_prd>").append(acctPrd).append("</acct_prd>");
valueXmlString.append("<site_code>").append(loginSite).append("</site_code>");
......@@ -225,8 +230,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
+ "WHERE A.FIN_ENTITY = B.FIN_ENTITY "
+ "AND B.CURR_CODE = C.CURR_CODE "
+ "AND A.SITE_CODE ='" +columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
siteDescr = rs.getString(1);
......@@ -236,7 +242,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
currDescr = rs.getString(5);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -261,14 +269,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
sql = "SELECT DESCR FROM CURRENCY WHERE CURR_CODE ='" +columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
currDescr = rs.getString(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -320,14 +331,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
valueXmlString.append("<currency_descr>").append("<![CDATA["+currDescr+"]]>").append("</currency_descr>");// Gulzar - 30/12/06
sql = "SELECT CURR_CODE FROM FINENT WHERE FIN_ENTITY = '" + finEntity + "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
currCodeFin = rs.getString(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("CurrCode :[" + currCode.trim() + "] CurrCodeFin : [" + currCodeFin.trim() + "]");
if(currCode.trim().equalsIgnoreCase(currCodeFin.trim()))
{
......@@ -344,8 +358,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
sql = "SELECT CUST_NAME,ACCT_CODE__AR,CCTR_CODE__AR FROM CUSTOMER WHERE CUST_CODE= '"+columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
custName = rs.getString(1);
......@@ -353,7 +368,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
cctrCode = rs.getString(3);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -377,14 +394,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
sql = "SELECT DESCR FROM CURRENCY WHERE CURR_CODE ='" +columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
currDesc = rs.getString(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -420,14 +440,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
crTerm = genericUtility.getColumnValue("cr_term",dom);
System.out.println("crTerm : " + crTerm + " refDate: " + refDate);
sql = "SELECT CR_DAYS FROM CRTERM WHERE CR_TERM ='" +crTerm+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
crDays = rs.getInt(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
Calendar cal = Calendar.getInstance();
......@@ -490,8 +513,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
+ "WHERE TRAN_SER = '"+tranSer+"' AND REF_NO = '"+columnValue+"' AND REF_TYPE ='OPN' "; //REF_TYPE ADDED GULZAR 02-12-06
//System.out.println("REF SQL................."+refSql);
stmt = conn.createStatement();
rs = stmt.executeQuery(refSql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(refSql);
rs = pstmt.executeQuery();
if (rs.next())
{
refDate1 = rs.getDate(1);
......@@ -515,7 +539,6 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
saleOrder = rs.getString(19);
dueDate1 = rs.getDate(20);
rs.close();
if(crTerm == null)
{
crTerm = "";
......@@ -525,44 +548,56 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
salesPers = "";
}
sql = "SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE= '"+custCode+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if (rs.next())
{
custName = rs.getString(1);
}
rs.close();
stmt.close();
sql = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS= '"+salesPers+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if (rs.next())
{
spName = rs.getString(1);
sql1 = "SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE= '"+custCode+ "'";
//stmt = conn.createStatement();
pstmt1 = conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
custName = rs1.getString(1);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql1 = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS= '"+salesPers+ "'";
//stmt = conn.createStatement();
pstmt1 = conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
spName = rs1.getString(1);
}
rs.close();
stmt.close();
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS= '"+salesPers1+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if (rs.next())
{
spName1 = rs.getString(1);
}
rs.close();
stmt.close();
sql = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS= '"+salesPers2+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if (rs.next())
{
spName2 = rs.getString(1);
}
rs.close();
stmt.close();
sql1 = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS= '"+salesPers1+ "'";
//stmt = conn.createStatement();
pstmt1 = conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
spName1 = rs1.getString(1);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql1 = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS= '"+salesPers2+ "'";
//stmt = conn.createStatement();
pstmt1 = conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
spName2 = rs1.getString(1);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
/*
if(crTerm != null)
{
......@@ -627,7 +662,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
valueXmlString.append("<cust_code protect = '0'>").append(custCode).append("</cust_code>");
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
}//for
}//try
......@@ -674,14 +711,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
sql = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS ='" +columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
salesPers = rs.getString(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -701,14 +741,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
sql = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS ='" +columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
salesPers1 = rs.getString(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -728,14 +771,17 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
sql = "SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS ='" +columnValue+ "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
salesPers2 = rs.getString(1);
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -800,7 +846,8 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
String errString = "";
String errCode = "";
String sql = "";
Statement stmt = null;
//Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String userId = "";
String loginSite = "";
......@@ -823,7 +870,7 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
try
{
conn = getConnection();
stmt = conn.createStatement();
//stmt = conn.createStatement();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
userId = getValueFromXTRA_PARAMS(xtraParams,"userId");
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
......@@ -889,7 +936,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
}
currCode = childNode.getFirstChild().getNodeValue().trim();
sql = "SELECT COUNT(1) AS COUNT FROM CURRENCY WHERE CURR_CODE = '"+currCode+"'";
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("COUNT");
......@@ -900,6 +949,10 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
break;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if (childNodeName.equals("fin_entity"))
{
......@@ -956,24 +1009,34 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
System.out.println("tranSer : " + tranSer);
System.out.println("refNo : " + refNo);
sql = "SELECT COUNT(*) AS COUNT FROM RECEIVABLES WHERE TRAN_SER = '"+tranSer+"' AND REF_NO = '"+refNo+"'";
System.out.println("sql : " + sql);
rs = stmt.executeQuery(sql);
//System.out.println("sql : " + sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
refTypeCnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("refTypeCnt : " + refTypeCnt);
if (refTypeCnt > 0)
{
sql = "SELECT (CASE WHEN REF_TYPE IS NULL THEN ' ' ELSE REF_TYPE END) AS REF_TYPE FROM RECEIVABLES WHERE TRAN_SER = '"+tranSer+"' AND REF_NO = '"+refNo+"'";
System.out.println("sql : " + sql);
rs = stmt.executeQuery(sql);
//System.out.println("sql : " + sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
refType = rs.getString("REF_TYPE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("refType : " + refType);
if (!refType.equals("OPN"))
{
......@@ -1072,7 +1135,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
}
currCode = childNode.getFirstChild().getNodeValue().trim();
sql = "SELECT COUNT(1) AS COUNT FROM CURRENCY WHERE CURR_CODE = '"+currCode+"'";
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
int cnt = rs.getInt("COUNT");
......@@ -1084,6 +1149,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else if(childNodeName.equals("exch_rate"))
......@@ -1135,7 +1203,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
{
System.out.println("crtermLen : " + crTerm.trim().length() + "CRTERM : " + crTerm);
sql = "SELECT COUNT(1) AS COUNT FROM CRTERM WHERE CR_TERM = '"+crTerm+"'";
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
int cnt = rs.getInt("COUNT");
......@@ -1147,6 +1217,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
}
......@@ -1185,7 +1258,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
}
itemSer = childNode.getFirstChild().getNodeValue().trim();
sql = "SELECT COUNT(1) AS COUNT FROM ITEMSER WHERE ITEM_SER = '"+itemSer+"'";
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("COUNT");
......@@ -1200,6 +1275,10 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
//Check in customer_series
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else if(childNodeName.equals("sales_pers"))
......@@ -1210,7 +1289,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
if(salesPers != null && salesPers.trim().length()>0)
{
sql = "SELECT COUNT(1) AS COUNT FROM SALES_PERS WHERE SALES_PERS = '"+salesPers+"'";
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
int cnt = rs.getInt("COUNT");
......@@ -1222,6 +1303,9 @@ public class ReceivablesOpening extends ValidatorEJB implements ReceivablesOpeni
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
else
......
......@@ -66,8 +66,8 @@ public class ReceivablesOpeningConf extends ActionHandlerEJB implements Receivab
private String confirmReceivables(String tranID, String xtraParams) throws RemoteException,ITMException
{
String retString = "";
Statement stmt = null, stmt1 = null, stmt2 = null, stmt3 = null;
PreparedStatement pstmt = null;
//Statement stmt = null, stmt1 = null, stmt2 = null, stmt3 = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null;
ResultSet rs = null;
ResultSet rsDtl = null;
ResultSet rsMst = null;
......@@ -160,8 +160,9 @@ conn = getConnection();
try
{
sqlHdr = "SELECT TRAN_DATE, SITE_CODE, FIN_ENTITY, CURR_CODE, TOT_AMT, ADJ_AMT, EMP_CODE__APRV, CONFIRMED, ACCT_PRD, TRAN_TYPE FROM RECEIVABLES_HDR WHERE TRAN_ID ='"+ tranID +"'"; //ACCT_PRD and TRAN_TYPE ADDED GULZAR 02-12-06
stmt = conn.createStatement();
rs = stmt.executeQuery(sqlHdr);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sqlHdr);
rs = pstmt.executeQuery();
if (rs.next())
{
tranDate = rs.getTimestamp("TRAN_DATE");
......@@ -175,6 +176,10 @@ conn = getConnection();
acctPrd = rs.getString("ACCT_PRD"); //Gulzar 30/11/6
refType = rs.getString("TRAN_TYPE"); //Gulzar 02-12-06
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
}
catch(SQLException se)
{
......@@ -194,9 +199,10 @@ conn = getConnection();
{
try
{
stmt.close();
stmt = null;
pstmt.close();
pstmt = null;
rs.close();
rs = null;
}
catch(Exception e)
{
......@@ -220,9 +226,9 @@ conn = getConnection();
try
{
sqlDtl = "SELECT TRAN_SER, REF_NO, REF_DATE, TRAN_DATE, CUST_CODE, ACCT_CODE, CCTR_CODE, CURR_CODE, EXCH_RATE, TOT_AMT, ADJ_AMT, CR_TERM, DUE_DATE, REAS_CODE, ITEM_SER, SALES_PERS, SALES_PERS__1, SALES_PERS__2, CONTACT_CODE, FIN_SCHEME, SALE_ORDER, DIFF_AMT FROM RECEIVABLES_DTL WHERE TRAN_ID ='"+tranID+"'";
stmt = conn.createStatement();
rsDtl = stmt.executeQuery(sqlDtl);
//stmt = conn.createStatement();
pstmt3 = conn.prepareStatement(sqlDtl);
rsDtl = pstmt3.executeQuery();
while (rsDtl.next())
......@@ -261,12 +267,17 @@ conn = getConnection();
{
sql = "SELECT COUNT(1) AS COUNT FROM RECEIVABLES "
+ "WHERE TRAN_SER = '"+ tranSer +"' AND REF_NO = '"+ refNo +"' AND SITE_CODE = '"+ siteCode +"'";
stmt1 = conn.createStatement();
rsMst = stmt1.executeQuery(sql);
//stmt1 = conn.createStatement();
pstmt1 = conn.prepareStatement(sql);
rsMst = pstmt1.executeQuery();
if (rsMst.next())
{
cnt = rsMst.getInt("COUNT");
}
pstmt1.close();
pstmt1 = null;
rsMst.close();
rsMst = null;
}
catch(SQLException se)
{
......@@ -288,8 +299,8 @@ conn = getConnection();
{
rsMst.close();
rsMst = null;
stmt1.close();
stmt1 = null;
pstmt1.close();
pstmt1 = null;
}
catch(Exception e)
{
......@@ -304,14 +315,19 @@ conn = getConnection();
sql = "SELECT TOT_AMT FROM RECEIVABLES "
+ "WHERE TRAN_SER = '"+ tranSer +"' AND REF_NO = '"+ refNo +"' AND SITE_CODE = '"+ siteCode +"'";
stmt2 = conn.createStatement();
rs = stmt2.executeQuery(sql);
//stmt2 = conn.createStatement();
pstmt1 = conn.prepareStatement(sql);
rsMst = pstmt1.executeQuery();
if (rs.next())
if (rsMst.next())
{
totAmtOld = rs.getDouble("TOT_AMT");
totAmtOld = rsMst.getDouble("TOT_AMT");
}
rs.close();
//rs.close();
pstmt1.close();
pstmt1 = null;
rsMst.close();
rsMst = null;
diffAmt = totAmt - totAmtOld;
System.out.println("diffAmt = totAmt - totAmtOld : " + diffAmt);
if (totAmtOld < 0)
......@@ -334,7 +350,7 @@ conn = getConnection();
crAmtNew = 0d;
drAmtNew = totAmt;
}
stmt2.close();
//stmt2.close();
drAmt = drAmtNew - drAmtOld;
crAmt = crAmtNew - crAmtOld;
System.out.println("drAmt = drAmtNew - drAmtOld : " + drAmt);
......@@ -349,13 +365,17 @@ conn = getConnection();
//sql = "SELECT KEY_STRING FROM TRANSETUP WHERE TRAN_WINDOW = 'T_RCVABLES'"; //Gulzar 29/08/06
sql = "SELECT KEY_STRING FROM TRANSETUP WHERE TRAN_WINDOW = 't_rcvables'"; //Gulzar 29/08/06
stmt3 = conn.createStatement();
rs = stmt3.executeQuery(sql);
if(rs.next())
//stmt3 = conn.createStatement();
pstmt1 = conn.prepareStatement(sql);
rsMst = pstmt1.executeQuery();
if(rsMst.next())
{
keyString = rs.getString("KEY_STRING");
keyString = rsMst.getString("KEY_STRING");
}
rs.close();
rsMst.close();
rsMst = null;
pstmt1.close();
pstmt1 = null;
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1><item_ser>"+itemSer+"</item_ser>"+
"\r\n<site_code>"+siteCode+"</site_code>\r\n<tran_date>"+tranDate+"</tran_date></Detail1></Root>";
......@@ -423,6 +443,8 @@ conn = getConnection();
pstmt.setString(41,saleOrder);
pstmt.setString(42,"1");
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Insert Query Executed : FOR 000000 IN RECEIVABLES MASTER");
}
catch(SQLException se)
......@@ -450,11 +472,12 @@ conn = getConnection();
finally
{
try
{
if (pstmt != null)
{
pstmt.close();
pstmt = null;
stmt3.close();
}
}
catch(Exception e)
{
......@@ -528,6 +551,7 @@ conn = getConnection();
pstmt.executeUpdate();
System.out.println("Upadte Query Executed : 000000 IN RECEIVABLES MASTER");
pstmt.close();
pstmt = null;
}
catch(SQLException se)
{
......@@ -669,6 +693,10 @@ conn = getConnection();
//conn.commit(); //Jiten 27/07/06 - not required
}
rsDtl.close();
rsDtl = null;
pstmt3.close();
pstmt3 = null;
try
{
String sqlUpdateHdr = "UPDATE RECEIVABLES_HDR SET CONFIRMED = 'Y', CONF_DATE = ? ,EMP_CODE__APRV = ? WHERE TRAN_ID = ?";
......@@ -678,6 +706,8 @@ conn = getConnection();
pstmt.setString(2,empCode);
pstmt.setString(3,tranID);
int conf = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if(conf == 1)
{
System.out.println("RECEIVABLES_HDR Updated...(Confirmed)" + userId);
......@@ -689,6 +719,7 @@ conn = getConnection();
{
System.out.println("RECEIVABLES_HDR Not Updated...(Not Confirmed)");
}
}
catch(SQLException se)
{
......@@ -747,10 +778,10 @@ conn = getConnection();
{
try
{
if (stmt != null)
if (pstmt != null)
{
stmt.close();
stmt = null;
pstmt.close();
pstmt = null;
}
if (rsDtl != null)
{
......@@ -785,31 +816,31 @@ conn = getConnection();
{
try
{
if (stmt1 != null)
{
stmt1.close();
stmt1 = null;
}
if (stmt2 != null)
if (pstmt1 != null)
{
stmt2.close();
stmt2 = null;
pstmt1.close();
pstmt1 = null;
}
if (stmt3 != null)
if (pstmt2 != null)
{
stmt3.close();
stmt3 = null;
pstmt2.close();
pstmt2 = null;
}
if (stmt != null)
if (pstmt3 != null)
{
stmt.close();
stmt = null;
pstmt3.close();
pstmt3 = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
/*if (pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
if (rsDtl != null)
{
rsDtl.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