Commit 11218c2e authored by smane's avatar smane

Update EJB file for site master (S14GSUN003)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96687 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 27f55cbb
...@@ -893,176 +893,7 @@ public class SiteIC extends ValidatorEJB implements SiteICLocal, SiteICRemote ...@@ -893,176 +893,7 @@ public class SiteIC extends ValidatorEJB implements SiteICLocal, SiteICRemote
return valueXmlString.toString(); return valueXmlString.toString();
} }
public String getfinparm(String pCode , String varName ,Connection conn)
{
String sql = "";
String varValue = "";
String addValue = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
sql = "select var_value, addl_value from finparm where prd_code = ? and var_name = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,pCode);
pstmt.setString(2,varName);
rs = pstmt.executeQuery();
if(rs.next())
{
varValue = rs.getString("var_value");
addValue = rs.getString("addl_value");
}
}
catch (Exception e) {
// TODO: handle exception
}
if(addValue == null || addValue.trim().length() == 0)
{
return varValue;
}
else
{
return varValue.trim()+";"+addValue.trim();
}
}
public String supplier_cctr(String cctrCode , String acctCode, Connection conn)
{
String sql = "";
String errCode = "";
String finparamCcterm ="";
int count = 1;
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
finparamCcterm = getfinparm("999999","CCTR_CHECK",conn);
if(finparamCcterm.equals("Y"))
{
if(acctCode.trim().length() > 0 && acctCode != null)
{
sql = "select count(*) from costctr where cctr_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cctrCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
errCode = "VMCCTR1";
}
}
sql = "select count(*) from accounts_cctr where acct_code = ? and cctr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCode);
pstmt.setString(2,cctrCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
sql = "select count(*) from accounts_cctr where acct_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count > 0)
{
errCode = "VMCCTR2";;
}
else if(count == 0)
{
errCode = "VMCCTR2";
}
}
}
}
catch (Exception e) {
// TODO: handle exception
}
return errCode;
}
public String supplier_acct( String siteCode ,String acctcode ,Connection conn )
{
String sql = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
String siteSpec = "";
String active = "";
String errCode="";
int count =0;
try
{
sql = "select var_value from finparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_ACCT' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
siteSpec = rs.getString(1);
}
sql = "select count(*) from accounts where acct_code = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctcode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count != 0)
{
sql="select active from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctcode);
rs = pstmt.executeQuery();
if(rs.next())
{
active = rs.getString("active");
}
if(!active.equals("Y"))
{
errCode = "VMACCTA";
}
else if(siteSpec != null && !siteSpec.equals("Y"))
{
sql = "select count(*) from site_account where site_code = ? and acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,acctcode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
errCode = "VMACCT3";
}
}
}
else
{
errCode = "VMACCT1";
}
}
catch (Exception e) {
// TODO: handle exception
}
return errCode;
}
public String mid(String fname ,int i , int j) public String mid(String fname ,int i , int j)
{ {
String name = fname.substring(1, 40); String name = fname.substring(1, 40);
...@@ -1156,7 +987,11 @@ public class SiteIC extends ValidatorEJB implements SiteICLocal, SiteICRemote ...@@ -1156,7 +987,11 @@ public class SiteIC extends ValidatorEJB implements SiteICLocal, SiteICRemote
while(rs.next()) while(rs.next())
{ {
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
catch(Exception ex) catch(Exception ex)
{ {
......
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