Commit 8bbb7708 authored by dpingle's avatar dpingle

* Migration on Perk Process Load on [12/09/19]

d_empperk_brow.srd
d_empperk_det_brow.srd
d_empperk_det_edit.srd
d_empperk_edit.srd
w_empperk.sql
PerkProcessLoadPrs.java
PerkProcessLoadPrsLocal.java
PerkProcessPrsLoadRemote.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@207302 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e849c126
This diff is collapsed.
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
public class PerkProcessLoadPrs extends ActionHandlerEJB implements PerkProcessLoadPrsLocal, PerkProcessPrsLoadRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
Connection conn = null;
ITMDBAccessEJB itmDbAccess = new ITMDBAccessEJB();
boolean isError = false;
try
{
conn = getConnection();
System.out.println("Conn==>[" + conn + "]");
retString = confirm(tranId,xtraParams,forcedFlag,conn);
System.out.println("returning String from StatusChangeConfirm :confirm():==>[" + retString + "]");
if(retString == null || retString.trim().length() == 0)
//if(retString != null && retString.trim().length() > 0)
{
isError = false;
retString = itmDbAccess.getErrorString("", "VMTRNCNFR", "", "", conn);
return retString;
}
else
{
isError = true;
//return retString;
}
}
catch(Exception e)
{
isError = true;
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
if(isError)
{
conn.rollback();
}
else
{
conn.commit();
}
conn.close();
conn = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
public String confirm(String TranId, String xtraParams, String forcedFlag, Connection conn) throws ITMException
{
String retString = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
String sql ="";
String empCode = "";
String siteCodePay = "";
String adCode = "";
String conf = "";
String trandId = "";
String expDate = "";
String userId = "";
String termid = "";
double lcDiffAmt = 0.0;
double amt = 0.0;
int cnt = 0;
int cnt1 = 0;
java.sql.Timestamp processedFor = null;
java.sql.Timestamp ldChgdate = null;
java.sql.Timestamp nextProcess = null;
java.sql.Timestamp ldEnddt = null;
try
{
genericUtility = new E12GenericUtility();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
UtilMethods utilMethods = new UtilMethods();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
termid = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
System.out.println("termid:::userId::::"+termid+userId);
sql = "select emp_code,"
+ " PROCESSED_FOR, "
+ "SITE_CODE__PAY, "
+ "AD_CODE, NEXT_PROCESS, "
+ "nvl(AMOUNT , 0) as amt,"
+ " nvl(diff_amt , 0) as diff,"
+ " confirmed, tran_id, "
+ "exp_date"
+ " from perk_process "
+ "where tran_id = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,TranId);
rs = pstmt.executeQuery();
if (rs.next())
{
empCode = rs.getString("emp_code");
processedFor = rs.getTimestamp("PROCESSED_FOR");
siteCodePay = rs.getString("SITE_CODE__PAY");
adCode = rs.getString("AD_CODE");
nextProcess = rs.getTimestamp("NEXT_PROCESS");
amt = rs.getDouble("amt");
lcDiffAmt = rs.getDouble("diff");
conf = rs.getString("confirmed");
trandId = rs.getString("tran_id");
expDate = rs.getString("exp_date");
}
System.out.println("emp_code:::::::"+empCode);
System.out.println("PROCESSED_FOR:::::::"+processedFor);
System.out.println("SITE_CODE__PAY:::::::"+siteCodePay);
System.out.println("AD_CODE:::::::"+adCode);
System.out.println("NEXT_PROCESS:::::::"+nextProcess);
System.out.println("amt:::::::"+amt);
System.out.println("diff:::::::"+lcDiffAmt);
System.out.println("confirmed:::::::"+conf);
System.out.println("tran_id:::::::"+trandId);
System.out.println("exp_date:::::::"+expDate);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
sql="update perk_process set confirmed = 'Y'"
+ " where emp_code =? and processed_for =? and"
+ " site_code__pay = ? and "
+ "ad_code =? AND "
+ "tran_id =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,processedFor);
pstmt.setString(3,siteCodePay);
pstmt.setString(4,adCode);
pstmt.setString(5,trandId);
cnt = pstmt.executeUpdate();
if(cnt > 0)
{
System.out.println("cnt:::::::"+cnt);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
String ldChgdateStr = sdf.format(new java.util.Date());
ldChgdate = Timestamp.valueOf(genericUtility.getValidDateTimeString(ldChgdateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
System.out.println("ldChgdate:::::::"+ldChgdate);
if (amt == 0 && lcDiffAmt == 0 );
ldEnddt = utilMethods.RelativeDate(nextProcess, -1);
System.out.println("ldEnddt:::::::"+ldEnddt);
sql ="select count(*) as cnt1 from allowdedn_bal"
+ " where emp_code = ? and"
+ " ad_code = ? "
+ "and start_date = ? "
+ "and end_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, adCode);
pstmt.setTimestamp(3, processedFor);
pstmt.setTimestamp(4, ldEnddt);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt1 = rs.getInt("cnt1");
System.out.println("cnt1:::::::"+cnt1);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt1 == 0)
{
sql="insert into allowdedn_bal "
+ "(emp_code, ad_code, start_date, "
+ "end_date, amount, amt_adj,"
+ " amt_bal, chg_date, chg_user,"
+ " chg_term,ref_type,ref_no,exp_date) "
+ "values (?, ? , ?, ?, ?, 0, ?, ?, ?, ?,'K', ?, ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, adCode);
pstmt.setTimestamp(3, processedFor);
pstmt.setTimestamp(4, ldEnddt);
pstmt.setDouble(5, amt);
pstmt.setDouble(6, amt);
pstmt.setTimestamp(7, ldChgdate);
pstmt.setString(8, userId);
pstmt.setString(9, termid);
pstmt.setString(10, trandId);
pstmt.setString(11, expDate);
int cnt2 = pstmt.executeUpdate();
System.out.println("cnt2:::::::"+cnt2);
if(cnt2 > 0)
{
System.out.println("cnt2:::::::"+cnt2);
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
{
sql ="update allowdedn_bal "
+ "set amount = amount + ?, "
+ "amt_bal = amt_bal + ?, "
+ "ref_type = 'K', "
+ "ref_no = ?,"
+ "chg_date = ?, "
+ "chg_user = ?, "
+ "chg_term = ?, "
+ "exp_date = ? "
+ "where "
+ "emp_code = ? "
+ "and ad_code = ? "
+ "and start_date = ? "
+ "and end_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,lcDiffAmt);
pstmt.setDouble(2,lcDiffAmt);
pstmt.setString(3,trandId);
pstmt.setTimestamp(4,ldChgdate);
pstmt.setString(5,userId);
pstmt.setString(6,termid);
pstmt.setString(7, expDate);
pstmt.setString(8, empCode);
pstmt.setString(9, adCode);
pstmt.setTimestamp(10, processedFor);
pstmt.setTimestamp(11, ldEnddt);
int cnt3 = pstmt.executeUpdate();
System.out.println("cnt3:::::::"+cnt3);
if(cnt3 > 0)
{
System.out.println("cnt3:::::::"+cnt3);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}
catch(Exception e)
{
System.out.println("Exception :PerkProcessLoadPrs:::confirm() :" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
public interface PerkProcessLoadPrsLocal extends ActionHandlerLocal
{
public String confirm(String tranId, String xtraParams, String forcedFlag)throws RemoteException,ITMException;
public String confirm(String TranId, String xtraParams, String forcedFlag,Connection conn) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
public interface PerkProcessPrsLoadRemote extends ActionHandlerRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag)throws RemoteException,ITMException;
public String confirm(String TranId, String xtraParams, String forcedFlag,Connection conn) throws RemoteException,ITMException;
}
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