Skip to content

Commit

Permalink
fixed overlapping day date by non-hourly earn code on the time detail…
Browse files Browse the repository at this point in the history
…s page. Updated employees list available to be assigned group manager form
  • Loading branch information
sibow committed Mar 7, 2024
1 parent a8a7c3c commit e48e258
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 80 deletions.
7 changes: 3 additions & 4 deletions src/main/java/in/bloomington/timer/HandleNotification.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ public void setDate(String val){
}
/**
*
select e.first_name,e.last_name,d.id from time_documents d,employees e,jobs j where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and j.clock_time_required is null and j.inactive is null and d.pay_period_id = 549 and e.username not like 'admin' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=549 and a.workflow_id=2) order by 1;
select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.clock_time_required is null and j.inactive is null and d.pay_period_id = 621 and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=621 and a.workflow_id=2) order by 2 limit 10; ";
select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.include_in_auto_batch is null and j.inactive is null and j.expire_date is null and d.pay_period_id = 682 and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=682 and a.workflow_id=2) ";
*/
//
// find all the employees who have initiated document time but
Expand All @@ -101,7 +100,7 @@ String findToBeNotifiedEmployees(){
// find all non clock employees that have documents for the
// specified pay_period_id but not submitted
//
String qq = " select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.clock_time_required is null and j.inactive is null and j.expire_date is null and d.pay_period_id = ? and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=? and a.workflow_id=2) ";
String qq = " select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.include_in_auto_batch is null and j.inactive is null and j.expire_date is null and d.pay_period_id = ? and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=? and a.workflow_id=2) ";
// initiated but not submitted for approval
try{
con = Helper.getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public String find(){
if(!qw.isEmpty()){
qq += " where "+qw;
}
qq += " order by r.description ";
qq += " order by r.name ";
con = UnoConnect.getConnection();
if(con == null){
msg = " Could not connect to DB ";
Expand Down Expand Up @@ -205,7 +205,7 @@ public String lookFor(){
if(!qw.isEmpty()){
qq += " where "+qw;
}
qq += " order by r.description ";
qq += " order by r.name ";
con = UnoConnect.getConnection();
if(con == null){
msg = " Could not connect to DB ";
Expand Down
144 changes: 72 additions & 72 deletions src/main/java/in/bloomington/timer/list/EarnCodeReasonList.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,102 +23,102 @@ public class EarnCodeReasonList{
String name = "", reason_category_id="";
static final long serialVersionUID = 54L;
static Logger logger = LogManager.getLogger(EarnCodeReasonList.class);
boolean active_only = false;
boolean active_only = false;
List<EarnCodeReason> reasons = null;
//
public EarnCodeReasonList(){
}
public EarnCodeReasonList(boolean deb){

debug = deb;
debug = deb;
}
// usefull for auto complete
// usefull for auto complete
public EarnCodeReasonList(String val){
setName(val);
setName(val);
}
//
public void setName(String val){
if(val != null)
name = val;
if(val != null)
name = val;
}
public void setReason_category_id(String val){
if(val != null && !val.equals("-1"))
reason_category_id = val;
if(val != null && !val.equals("-1"))
reason_category_id = val;
}
public void setActiveOnly(){
active_only = true;
active_only = true;
}
public List<EarnCodeReason> getReasons(){
return reasons;
return reasons;
}
//
// find all matching records
// return "" for success or any exception thrown by DB
//
public String find(){
//
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
//
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;

String qq = "select h.id,h.name,h.description,h.reason_category_id,h.inactive from "+
" earn_code_reasons h", qw = "";
if(!name.isEmpty()){
qw += " name like ? ";
}
if(!reason_category_id.isEmpty()){
qw += " reason_category_id = ? ";
}
if(active_only){
if(!qw.isEmpty()) qw += " and ";
qw += " inactive is null ";
}
if(!qw.isEmpty()){
qq += " where "+qw;
}
qq += " order by description ";
String back = "";
con = UnoConnect.getConnection();
if(con == null){
back = "Could not connect to DB ";
return back;
}
try{
if(debug){
logger.debug(qq);
}
pstmt = con.prepareStatement(qq);
int jj = 1;
if(!name.isEmpty()){
pstmt.setString(jj,"%"+name+"%");
}
if(!reason_category_id.isEmpty()){
pstmt.setString(jj, reason_category_id);
}
rs = pstmt.executeQuery();
while(rs.next()){
String str = rs.getString(1);
String str2 = rs.getString(2);
String str3 = rs.getString(3);
String str4 = rs.getString(4);
boolean str5 = rs.getString(5) != null;
if(reasons == null)
reasons = new ArrayList<>();
EarnCodeReason one =
new EarnCodeReason(debug, str, str2, str3, str4, str5);
if(!reasons.contains(one))
reasons.add(one);
}
}
catch(Exception ex){
back += ex;
logger.error(ex+":"+qq);
}
finally{
Helper.databaseDisconnect(pstmt, rs);
UnoConnect.databaseDisconnect(con);
}
return back;
String qq = "select h.id,h.name,h.description,h.reason_category_id,h.inactive from "+
" earn_code_reasons h", qw = "";
if(!name.isEmpty()){
qw += " name like ? ";
}
if(!reason_category_id.isEmpty()){
qw += " reason_category_id = ? ";
}
if(active_only){
if(!qw.isEmpty()) qw += " and ";
qw += " inactive is null ";
}
if(!qw.isEmpty()){
qq += " where "+qw;
}
qq += " order by name ";
String back = "";
con = UnoConnect.getConnection();
if(con == null){
back = "Could not connect to DB ";
return back;
}
try{
if(debug){
logger.debug(qq);
}
pstmt = con.prepareStatement(qq);
int jj = 1;
if(!name.isEmpty()){
pstmt.setString(jj,"%"+name+"%");
}
if(!reason_category_id.isEmpty()){
pstmt.setString(jj, reason_category_id);
}
rs = pstmt.executeQuery();
while(rs.next()){
String str = rs.getString(1);
String str2 = rs.getString(2);
String str3 = rs.getString(3);
String str4 = rs.getString(4);
boolean str5 = rs.getString(5) != null;
if(reasons == null)
reasons = new ArrayList<>();
EarnCodeReason one =
new EarnCodeReason(debug, str, str2, str3, str4, str5);
if(!reasons.contains(one))
reasons.add(one);
}
}
catch(Exception ex){
back += ex;
logger.error(ex+":"+qq);
}
finally{
Helper.databaseDisconnect(pstmt, rs);
UnoConnect.databaseDisconnect(con);
}
return back;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/calendarFullNew.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
data-order-index="<s:property value='#blockKey' />">
</s:else>
</s:else>
<div style="width:50%;display:inline;float:left"> <b><s:property value="#dayInt" /></b> </div><s:if test="#dayHours != '0.0'"><div style="width:50%;display:inline;float:right"> (<i><s:property value="#dayHours" />h</i>)</div> <br /></s:if>
<div style="width:50%;display:inline;float:left"> <b><s:property value="#dayInt" /></b> </div><s:if test="#dayHours != '0.0'"><div style="width:50%;display:inline;float:right"> (<i><s:property value="#dayHours" />h</i>)</div> </s:if><br />
</s:if>

<s:if test="hasData()">
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/calendarFullView.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
data-order-index="<s:property value='#blockKey' />">
</s:else>
</s:else>
<div style="width:50%;display:inline;float:left"> <b><s:property value="#dayInt" /></b> </div><s:if test="#dayHours != '0.0'"><div style="width:50%;display:inline;float:right"> (<i><s:property value="#dayHours" />h</i>)</div> <br /></s:if>
<div style="width:50%;display:inline;float:left"> <b><s:property value="#dayInt" /></b> </div><s:if test="#dayHours != '0.0'"><div style="width:50%;display:inline;float:right"> (<i><s:property value="#dayHours" />h</i>)</div></s:if><br />
</s:if>
<s:if test="hasData()">
<div class="data"
Expand Down

0 comments on commit e48e258

Please sign in to comment.