Commit 21141f16 authored by ssalve's avatar ssalve

done changes for reg_date and removed valid_upto


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106037 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f059d902
......@@ -56,14 +56,13 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
{
System.out.println("Inside GSTRegNoPosEJB Post Save ["+xmlstring+"] \n xtraParams ["+xtraParams+"] \n forcedFlag["+forcedFlag+"]");
String finEntity="",finDescr="",siteCode="",siteDescr="",regNo="",regNo1="",regNo2="";
String validUpto=null;
String regDate=null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Timestamp currDate = null;
Timestamp validUptoDate = null;
boolean isError = false,isLocCon = false;
Document dom = null;
String sql = "",retString = "",tranID = "", tranIdGSTN = "";
String gstInNo = "GSTIN_NO";
String gstUserName = "GST_UNAME";
......@@ -73,7 +72,7 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
String loginSite = "";
java.sql.Date chg_date=null;
String val = "";
String loginSiteCode = "";
try
{
if(conn == null || conn.isClosed())
......@@ -101,20 +100,19 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
NodeList detail1NodeList =dom.getElementsByTagName("Detail1");
int detail3NodeListlen = detail1NodeList.getLength();
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("loginSite>>>>>>>>>>"+loginSite);
for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++)
{
NodeList childNodeList = detail1NodeList.item(ctrH).getChildNodes();
int childNodeListlen = childNodeList.getLength();
System.out.println("childNodeListlen>>>>>"+childNodeListlen);
for(int ctrD = 0; ctrD < childNodeListlen ; ctrD++)
{
Node childNode = childNodeList.item(ctrD);
System.out.println("childNode.getNodeName()>>"+childNode.getNodeName());
if(childNode != null && "fin_entity".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
finEntity = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
......@@ -143,16 +141,20 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
{
regNo2 = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "valid_upto".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
else if(childNode != null && "reg_date".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
validUpto = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
regDate = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
}
}
System.out.println("finEntity["+finEntity+"]"+"finDescr["+finDescr+"]"+"siteCode["+siteCode+"]"+"siteDescr["+siteDescr+"]"+"regNo["+regNo+"]"+"regNo1["+regNo1+"]"+"regNo2["+regNo2+"]"+"validUpto["+validUpto+"]");
System.out.println("finEntity["+finEntity+"]"+"finDescr["+finDescr+"]"+"siteCode["+siteCode+"]"+"siteDescr["+siteDescr+"]"+"regNo["+regNo+"]"+"regNo1["+regNo1+"]"+"regNo2["+regNo2+"]"+"regDate["+regDate+"]");
validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(validUpto, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(regDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("validUptoDate["+validUptoDate+"]");
ArrayList refList = new ArrayList();
refList.add("GSTIN_NO");
refList.add("GST_UNAME");
refList.add("GST_GT");
ArrayList gstList = new ArrayList();
gstList.add(regNo);
......@@ -164,29 +166,36 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
map.put(regNo1, "GST_UNAME");
map.put(regNo2, "GST_GT");
sql = "select count(*) as cnt from siteregno where fin_entity=? AND site_code=?";
sql = "select count(*) as cnt from siteregno where fin_entity=? AND site_code=? AND ref_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,finEntity);
pstmt.setString(2,siteCode);
rs = pstmt.executeQuery();
for(int i=0;i<refList.size();i++)
{
String refCode = (String)refList.get(i);
System.out.println("refCode::::"+refCode);
pstmt.setString(1,finEntity);
pstmt.setString(2,siteCode);
pstmt.setString(3,refCode.trim());
rs = pstmt.executeQuery();
}
if(rs.next())
{
cnt = rs.getInt("cnt");
System.out.println("cnt>>>>>>>"+cnt);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
rs = null;
}
if(cnt>0)
{
sql = "update siteregno set reg_no=?, valid_upto=? where fin_entity=? AND site_code=? AND ref_code=?";
sql = "update siteregno set reg_no=?,reg_date=? where fin_entity=? AND site_code=? AND ref_code=?";
pstmt = conn.prepareStatement(sql);
for(int x =0 ; x< gstList.size(); x++)
{
......@@ -201,35 +210,37 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
pstmt.close();
pstmt = null;
}
}
else
{
sql = " insert into siteregno (fin_entity,site_code,ref_code,reg_no,valid_upto,chg_date,chg_user,eff_from) values(?,?,?,?,?,?,?,?)";
sql = " insert into siteregno (fin_entity,site_code,ref_code,reg_no,valid_upto,reg_date,chg_date,chg_user,eff_from) values(?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
for(int y =0 ; y< gstList.size(); y++)
{
gstRefCode = (String) gstList.get(y);
val = (String) map.get(gstRefCode);
pstmt.setString(1,finEntity);
pstmt.setString(2,siteCode);
pstmt.setString(3,val);
pstmt.setString(4, gstRefCode);
pstmt.setTimestamp(5,validUptoDate);
pstmt.setTimestamp(6,currDate);
pstmt.setString(7,loginSite);
pstmt.setTimestamp(8,currDate);
pstmt.addBatch();
}
pstmt.executeBatch();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
for(int y =0 ; y< gstList.size(); y++)
{
gstRefCode = (String) gstList.get(y);
val = (String) map.get(gstRefCode);
pstmt.setString(1,finEntity);
pstmt.setString(2,siteCode);
pstmt.setString(3,val);
pstmt.setString(4, gstRefCode);
pstmt.setTimestamp(5,currDate);
pstmt.setTimestamp(6,validUptoDate);
pstmt.setTimestamp(7,currDate);
pstmt.setString(8,loginSite);
pstmt.setTimestamp(9,currDate);
pstmt.addBatch();
}
pstmt.executeBatch();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}//End if Detail1 not found
else
{
......@@ -237,7 +248,7 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn);
return retString;
}
}
}// end of try block
catch(Exception e)
{
System.out.println("Exception GSTRegNoPosEJB ==>"+e.getMessage());
......
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