Skip to content

Commit

Permalink
updated sql script that was throwing error in termination operation.
Browse files Browse the repository at this point in the history
Improved leave management operations
  • Loading branch information
sibow committed Dec 20, 2024
1 parent f1363c2 commit db1f7da
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public String execute(){
addError(back);
}
else{
// if(true){
if(activeMail){
back = informManager();
if(!back.isEmpty()){ // saved even if manger not informed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ public class NWEmpJobsAction extends TopAction{
static final long serialVersionUID = 3800L;
static Logger logger = LogManager.getLogger(NWEmpJobsAction.class);
//
String date = "04/18/2024";
String emp_number="2661", emp_id="1635";
String date = "12/20/2024";
String emp_number="3495", emp_id="2359";
// String emp_number="864", emp_id="13";
List<JobTask> jobs = null;
NWEmployeeJobs nwEmpJobs = null;
String pay_period_id = "686";
String pay_period_id = "702";
public String execute(){
String ret = SUCCESS;

Expand Down Expand Up @@ -57,9 +58,11 @@ public List<JobTask> getJobs(){
if(!emp_id.isEmpty() && jobs == null){
JobTaskList jtl = new JobTaskList();
jtl.setEmployee_id(emp_id);

if(!pay_period_id.isEmpty()){
jtl.setPay_period_id(pay_period_id);
}

jtl.setActiveOnly();
String back = jtl.find();
if(back.isEmpty()){
Expand Down
44 changes: 35 additions & 9 deletions src/main/java/in/bloomington/timer/action/TerminateJobAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,30 @@ public String execute(){
}
// if(hasTempJobs){
ret = "select_jobs";
//}
// else { // one job
//ret = "set_expire_date";
//}
}
}
else if(action.equals("Edit")){
if(!id.isEmpty()){
term = new EmpTerminate(id);
back = term.doSelect();
if(!back.isEmpty()){
addError(back);
}
}
}
else if(action.startsWith("Next")){
//
if(selected_job_ids != null &&
!last_day_of_work.isEmpty()){
getTerm();
getEmp();
findLastPayPeriodDate();
if(emp_id.isEmpty()){
getJob(); // to get emp_id
}
term.setEmployee_id(emp_id);
term.setJob_ids(selected_job_ids);
term.setEmail(emp.getEmail());
// term.findAllJobs();
// term.findSupervisor();
// term.findSupervisorPhone(envBean);
Expand Down Expand Up @@ -179,7 +186,7 @@ else if(action.startsWith("Send")){
ret = "view";
}
}
}
}
return ret;
}
void findLastPayPeriodDate(){
Expand Down Expand Up @@ -211,6 +218,10 @@ String findMatchingJobsInNW(){
if(nej.hasNwJob()){
JobTerminate jj = nej.updateFoundJob();
jj.setBadge_code(emp.getId_code());
jj.setTerminate_id(id);
jj.setLast_day_of_work(last_day_of_work);
jj.findSupervisor();
jj.findSupervisorInfo(envBean);
back += jj.doSave();
if(!back.isEmpty()){
System.err.println(" after jobterm save "+back);
Expand All @@ -219,8 +230,21 @@ String findMatchingJobsInNW(){
jobTerms.add(jj);
}
else{
back = "No job term found ";
System.err.println(" no match found ");
for(String j_id:selected_job_ids){
JobTerminate jj = new JobTerminate();
jj.setJob_id(j_id);
jj.setLast_day_of_work(last_day_of_work);
jj.setBadge_code(emp.getId_code());
jj.setTerminate_id(id);
jj.findSupervisor();
jj.findSupervisorInfo(envBean);
back = jj.doSave();
if(!back.isEmpty()){
System.err.println(" after jobterm save "+back);
}
jobTerms = new ArrayList<>();
jobTerms.add(jj);
}
}
}
else{
Expand All @@ -229,9 +253,11 @@ String findMatchingJobsInNW(){
jobTerms = ones;
for(JobTerminate jj:jobTerms){
jj.setTerminate_id(id);
// jj.findSupervisor();
// jj.findSupervisorInfo(envBean);
jj.findSupervisor();
jj.findSupervisorInfo(envBean);
jj.setBadge_code(emp.getId_code());
jj.setLast_day_of_work(last_day_of_work);
jj.setBadge_code(emp.getId_code());
back += jj.doSave();
}
if(!back.isEmpty()){
Expand Down
84 changes: 44 additions & 40 deletions src/main/java/in/bloomington/timer/bean/EmpTerminate.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class EmpTerminate{
jobTitles="";
// String job_grade="", job_step="", supervisor_id="", supervisor_phone="";
String employment_type="", // full, part time, temp, union
last_pay_period_date="";
last_pay_period_date="", suspension="";


String emp_address="", emp_city="", emp_state="",
Expand Down Expand Up @@ -98,16 +98,16 @@ public EmpTerminate(
String str22, String str23, String str24,

double str25, double str26, double str27,
String str28, String str29,String str30,

String str31, boolean str32){
String str28, boolean str29, String str30,
String str31,
String str32, boolean str33){
setVals(str, str2, str3, str4, str5,
str6, str7, str8, str9, str10,
str11, str12, str13, str14, str15,
str16, str17, str18, str19, str20,
str21, str22, str23, str24, str25,
str26, str27, str28, str29, str30,
str31, str32);
str31, str32, str33);

}

Expand All @@ -125,11 +125,12 @@ void setVals(
double str25, double str26, double str27,

String str28,
String str29,
boolean str29,
String str30,

String str31,
boolean str32){

String str32,
boolean str33){
setId(str);
setEmployee_id(str2);
setFull_name(str3);
Expand Down Expand Up @@ -163,11 +164,12 @@ void setVals(
setVac_time(str26);
setPto(str27);
setRemarks(str28);
setSubmitted_by_id(str29);
setSubmitted_date(str30);
setSuspension(str29);
setSubmitted_by_id(str30);
setSubmitted_date(str31);

setProcess_status(str31);
setRecipients_informed(str32);
setProcess_status(str32);
setRecipients_informed(str33);

}
public boolean equals(Object obj){
Expand Down Expand Up @@ -297,11 +299,10 @@ public String getForward_emails(){
public String getForward_days_cnt(){
return forward_days_cnt;
}
/**
public String getLast_day_of_work(){
return last_day_of_work;
public boolean getSuspension(){
return !suspension.isEmpty();
}
*/

public String getDrive_action(){
return drive_action;
}
Expand Down Expand Up @@ -470,11 +471,13 @@ public String getJobTitles(){
*/
return "";
}

public boolean hasJobs(){
findJobs();
return jobs != null && jobs.size() > 0;
}
public boolean hasJobTerms(){
findJobs();
return jobTerms != null && jobTerms.size() > 0;
}
public List<JobTerminate> getJobTerms(){
Expand Down Expand Up @@ -683,6 +686,10 @@ public void setEmp_phone(String val){
if(val != null)
emp_phone = val;
}
public void setSuspension(boolean val){
if(val)
suspension = "y";
}
public void setEmp_alt_phone(String val){
if(val != null)
emp_alt_phone = val;
Expand Down Expand Up @@ -943,18 +950,6 @@ public String doTerminate(){
back += one.doUpdate();
}
}
/**
if(emp.hasDepartments()){
// we are keeping the dept info for now since
// some employees come back such as seasonal
// List<DepartmentEmployee> ones =
// emp.getDepartmentEmployees();
// for(DepartmentEmployee one:ones){
// one.setExpire_date(last_pay_priod_date);
// back += one.doUpdate();
//}
}
*/
}
if(hasDocuments()){
CleanUp cleanUp = new CleanUp();
Expand Down Expand Up @@ -1121,7 +1116,7 @@ public String doSave(){
String qq = "insert into emp_terminations values(0,?,?,?,?, ?,?,?,?,?,"+
"?,?,?,?,?, ?,?,?,?,?,"+
"?,?,?,?,?, ?,?,?,?,?,"+
"'Started', null)";
"?,'Started', null)";
process_status="Started";
con = UnoConnect.getConnection();
if(con == null){
Expand Down Expand Up @@ -1160,6 +1155,7 @@ public String doSave(){
}
return back;
}
/**
public String saveJobTerms(){
String back = "";
if(jobTerms != null && jobTerms.size() > 0){
Expand All @@ -1173,6 +1169,7 @@ public String saveJobTerms(){
}
return back;
}
*/
String setParams(PreparedStatement pstmt){
String back = "";
int jj=1;
Expand Down Expand Up @@ -1273,15 +1270,19 @@ String setParams(PreparedStatement pstmt){
pstmt.setNull(27, Types.VARCHAR);
else
pstmt.setString(27, remarks);
if(suspension.isEmpty())
pstmt.setNull(28, Types.CHAR);
else
pstmt.setString(28, "y");
if(submitted_by_id.isEmpty())
pstmt.setNull(28, Types.VARCHAR);
pstmt.setNull(29, Types.VARCHAR);
else
pstmt.setString(28, submitted_by_id);
pstmt.setString(29, submitted_by_id);
if(submitted_date.isEmpty())
submitted_date = Helper.getToday();
pstmt.setDate(29, new java.sql.Date(dateFormat.parse(submitted_date).getTime()));
pstmt.setDate(30, new java.sql.Date(dateFormat.parse(submitted_date).getTime()));
if(!id.isEmpty()){
pstmt.setString(30,process_status);
pstmt.setString(31,process_status);
}
}catch(Exception ex){
back += ex;
Expand Down Expand Up @@ -1325,6 +1326,7 @@ public String doUpdate(){

"pto=?,"+
"remarks=?,"+
"suspension=?,"+
"submitted_by_id=?,"+
"submitted_date=?, "+ // date
"process_status=? "+
Expand All @@ -1351,7 +1353,7 @@ public String doUpdate(){
pstmt = con.prepareStatement(qq);
back = setParams(pstmt);
if(back.isEmpty()){
pstmt.setString(31, id);
pstmt.setString(32, id);
pstmt.executeUpdate();
}
if(badge_returned != null){
Expand Down Expand Up @@ -1455,9 +1457,9 @@ public String doSelect(){
"vac_time,"+
"pto,"+
"remarks,"+
"suspension,"+
"submitted_by_id,"+
"date_format(submitted_date,'%m/%d/%Y'), "+ // date

"process_status, "+
"recipients_informed "+
" from emp_terminations where id =? ";
Expand Down Expand Up @@ -1505,11 +1507,12 @@ public String doSelect(){

rs.getDouble(26),
rs.getDouble(27),
rs.getString(28),
rs.getString(29),
rs.getString(28),
rs.getString(29) != null,
rs.getString(30),
rs.getString(31),
rs.getString(32) != null);
rs.getString(31),
rs.getString(32),
rs.getString(33) != null);

}
}
Expand Down Expand Up @@ -1586,7 +1589,8 @@ primary key(id),
// add foreign key to term_notifications if emp_terminations is dropped
//
alter table term_notifications add foreign key(termination_id) references emp_terminations (id);
alter table emp_terminations add suspension char(1) after remarks;
*/

}
1 change: 0 additions & 1 deletion src/main/java/in/bloomington/timer/bean/JobTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class JobTask implements Serializable{
static Set<String> deptSet = new HashSet<>();
static {
deptSet.add("6"); // clerk
deptSet.add("20"); // Police
deptSet.add("23"); // Utilities
deptSet.add("36"); // council
/**
Expand Down
Loading

0 comments on commit db1f7da

Please sign in to comment.