From 052d1f89c6aa31ad4d681691f42770fdfe74fca6 Mon Sep 17 00:00:00 2001 From: Karthick Date: Fri, 4 Mar 2016 16:10:47 +0530 Subject: [PATCH 01/46] Show opening balance for current month --- app/controllers/wkattendance_controller.rb | 16 +++++++++++++--- app/helpers/wktime_helper.rb | 2 +- app/views/wkattendance/reportattn.html.erb | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 740078945..84f8e1390 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -127,22 +127,24 @@ def report def reportattn dateStr = getConvertDateStr('start_time') sqlStr = "" + leaveSql = "select u.id as user_id, i.id as issue_id, l.balance, l.accrual, l.used, l.accrual_on, lm.balance + lm.accrual - lm.used as open_bal from users u cross join (select id from issues where id in (#{getReportLeaveIssueIds})) i left join (#{getLeaveQueryStr(@from,@to)}) l on l.user_id = u.id and l.issue_id = i.id left join (#{getLeaveQueryStr(@from << 1,@from - 1)}) lm on lm.user_id = u.id and i.id = lm.issue_id" if isAccountUser @userlist = User.where("type = ?", 'User').order('id') - leave_data = WkUserLeave.where("issue_id in (#{getReportLeaveIssueIds}) and accrual_on between '#{@from}' and '#{@to}'") + #leave_data = WkUserLeave.where("issue_id in (#{getReportLeaveIssueIds}) and accrual_on between '#{@from}' and '#{@to}'") leave_entry = TimeEntry.where("issue_id in (#{getLeaveIssueIds}) and spent_on between '#{@from}' and '#{@to}'") sqlStr = "select user_id,#{dateStr} as spent_on,sum(hours) as hours from wk_attendances where start_time between '#{@from}' and '#{@to}' group by user_id,#{dateStr}" else @userlist = User.where("type = ? AND id = ?", 'User', User.current.id) - leave_data = WkUserLeave.where("issue_id in (#{getReportLeaveIssueIds}) and accrual_on between '#{@from}' and '#{@to}' and user_id = #{User.current.id} " ) + #leave_data = WkUserLeave.where("issue_id in (#{getReportLeaveIssueIds}) and accrual_on between '#{@from}' and '#{@to}' and user_id = #{User.current.id} " ) leave_entry = TimeEntry.where("issue_id in (#{getLeaveIssueIds}) and spent_on between '#{@from}' and '#{@to}' and user_id = #{User.current.id} " ) sqlStr = "select user_id,#{dateStr} as spent_on,sum(hours) as hours from wk_attendances where start_time between '#{@from}' and '#{@to}' and user_id = #{User.current.id} group by user_id,#{dateStr}" end + leave_data = WkUserLeave.find_by_sql(leaveSql) daily_entries = WkAttendance.find_by_sql(sqlStr) @attendance_entries = Hash.new if !leave_data.blank? leave_data.each_with_index do |entry,index| - @attendance_entries[entry.user_id.to_s + '_' + entry.issue_id.to_s + '_balance'] = entry.balance + @attendance_entries[entry.user_id.to_s + '_' + entry.issue_id.to_s + '_balance'] = entry.open_bal @attendance_entries[entry.user_id.to_s + '_' + entry.issue_id.to_s + '_used'] = entry.used @attendance_entries[entry.user_id.to_s + '_' + entry.issue_id.to_s + '_accrual'] = entry.accrual end @@ -160,6 +162,14 @@ def reportattn render :action => 'reportattn' end + def getLeaveQueryStr(from,to) + queryStr = "select * from wk_user_leaves WHERE issue_id in (#{getLeaveIssueIds}) and accrual_on between '#{from}' and '#{to}'" + if !isAccountUser + queryStr = queryStr + " and user_id = #{User.current.id} " + end + queryStr + end + # Retrieves the date range based on predefined ranges or specific from/to param dates def retrieve_date_range @free_period = false diff --git a/app/helpers/wktime_helper.rb b/app/helpers/wktime_helper.rb index c5469cf71..4c50f4df9 100644 --- a/app/helpers/wktime_helper.rb +++ b/app/helpers/wktime_helper.rb @@ -611,7 +611,7 @@ def sendNonSubmissionMail " inner join members m on p.id = m.project_id and p.status not in (#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})" + " inner join member_roles mr on m.id = mr.member_id" + " inner join roles r on mr.role_id = r.id and r.permissions like '%:log_time%'" + - " inner join users u on m.user_id = u.id" + + " inner join users u on m.user_id = u.id and u.status = #{User::STATUS_ACTIVE}" + " left outer join wktimes w on u.id = w.user_id and w.begin_date = '" + startDate.to_s + "'" + " where (w.status is null or w.status = 'n')" diff --git a/app/views/wkattendance/reportattn.html.erb b/app/views/wkattendance/reportattn.html.erb index 7b5f9f54b..3fa8db8c3 100644 --- a/app/views/wkattendance/reportattn.html.erb +++ b/app/views/wkattendance/reportattn.html.erb @@ -97,9 +97,9 @@ <%=h used1 %> <%=h used2 %> <%=h used3 %> -<%=h (balance1.blank? ? 0 : balance1) + (accrual1.blank? ? 0 : accrual1) - (used1.blank? ? 0 : used1) %> -<%=h (balance2.blank? ? 0 : balance2) + (accrual2.blank? ? 0 : accrual2) - (used2.blank? ? 0 : used2) %> -<%=h (balance3.blank? ? 0 : balance3) + (accrual3.blank? ? 0 : accrual3) - (used3.blank? ? 0 : used3) %> +<%=h (accrual1.blank? && used1.blank? ? '' : (balance1.blank? ? 0 : balance1) + (accrual1.blank? ? 0 : accrual1) - (used1.blank? ? 0 : used1)) %> +<%=h (accrual2.blank? && used2.blank? ? '' : (balance2.blank? ? 0 : balance2) + (accrual2.blank? ? 0 : accrual2) - (used2.blank? ? 0 : used2)) %> +<%=h (accrual3.blank? && used3.blank? ? '' : (balance3.blank? ? 0 : balance3) + (accrual3.blank? ? 0 : accrual3) - (used3.blank? ? 0 : used3)) %> <% for i in 1..31 hour = @attendance_entries[entry.id.to_s + '_' + i.to_s + '_hours'] leave = @attendance_entries[entry.id.to_s + '_' + i.to_s + '_leave'] From 5c08797462df74c06c69529de3fa41a70072bae3 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 7 Mar 2016 15:42:49 +0530 Subject: [PATCH 02/46] Fixed Alignment issue in worktime header --- app/views/wktime/_edit_hours.html.erb | 3 +- app/views/wktime/_worktime_header.html.erb | 14 ++++---- assets/javascripts/edit.js | 39 +++++++++++----------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app/views/wktime/_edit_hours.html.erb b/app/views/wktime/_edit_hours.html.erb index acc81d057..db3d36836 100644 --- a/app/views/wktime/_edit_hours.html.erb +++ b/app/views/wktime/_edit_hours.html.erb @@ -26,7 +26,7 @@ %> <%#if this is from a previous template, don't print the hours%> - +
<%=h text_field_tag('hours' + @row.to_s() +'[]', entry.nil? || @prev_template ? '' : ("%.2f" % entry.hours) ,:size => "#{controller.textfield_size}", :disabled => disable, :onchange => "validateTotal(this, #{@wday_index},'#{controller.maxHour}');") %> @@ -92,6 +92,7 @@ <% end %> <% end %> +
<% @wday_index += 1 %> <% end %> diff --git a/app/views/wktime/_worktime_header.html.erb b/app/views/wktime/_worktime_header.html.erb index 82eee5321..ffc595971 100644 --- a/app/views/wktime/_worktime_header.html.erb +++ b/app/views/wktime/_worktime_header.html.erb @@ -53,25 +53,27 @@ <% end %> <% if (isEditable) %> - -
- <%=h text_field_tag( "#{str}_#{(i+1)}" , "#{str}" == "start" ? startvalue[i] : endvalue[i],:size => 3, :disabled => true, :class => (@startday + i).past? ? 'clock-textbox' : ((@startday + i).today? ? 'clock-todaytextbox' : '' ), :onchange => "validateHr(this,#{(i+1)});") %> + +
+
+ <%=h text_field_tag( "#{str}_#{(i+1)}" , "#{str}" == "start" ? startvalue[i] : endvalue[i],:size => 4, :disabled => true, :class => (@startday + i).past? ? 'clock-textbox' : ((@startday + i).today? ? 'clock-todaytextbox' : '' ), :onchange => "validateHr(this,#{(i+1)});") %> <%=h hidden_field_tag('hd' + "#{str}_#{(i+1)}", hiddenvalue[i] ) %> <%=h hidden_field_tag('hours' + "#{str}_#{(i+1)}", hiddenvalue[i] ) %>
<% if ("#{str}" == "start" || "#{str}" == "end") && controller.showClockInOut && (i == col_num) && User.current.id == @user.id %> <% imgname = "#{str}" == "start" ? "clock8.jpg" : "clockout8.jpg" %> -
+
<% image_tg = image_tag("#{imgname}", :id => "#{str}" == "start" ? 'start_img' : 'end_img' , :plugin => "redmine_wktime", :title => "#{str}" == "start" ? l(:label_clock_in) : l(:label_clock_out) ) %> <%= link_to image_tg, "javascript:setClockInOut('#{str}','#{col_num}');", {:id => "clock_#{str}"} %>
<% end %> - +
+
<% else %> - + <% end %> <% end %> diff --git a/assets/javascripts/edit.js b/assets/javascripts/edit.js index 5aad4da1f..6f7dd2fb9 100644 --- a/assets/javascripts/edit.js +++ b/assets/javascripts/edit.js @@ -1334,23 +1334,23 @@ function showclkDialog(day) } function setClockInOut(strid,id) { - var d = new Date(); - var hh = d.getHours(); - var mm = d.getMinutes(); - id++; - elementhour = hh + ":" + mm; - elementend = hh + ":" + mm; - if( strid == 'start') - { - document.getElementById('clock_end' ).style.visibility = "visible"; - document.getElementById('clock_start').style.visibility = 'hidden'; - } - else - { - document.getElementById('clock_start' ).style.visibility = "visible"; - document.getElementById('clock_end').style.visibility = 'hidden'; - } - updateClockInOut(elementhour, strid, id, elementend ); + var d = new Date(); + var hh = d.getHours(); + var mm = d.getMinutes(); + id++; + elementhour = hh + ":" + mm; + elementend = hh + ":" + mm; + if( strid == 'start') + { + document.getElementById('clock_end' ).style.visibility = "visible"; + document.getElementById('clock_start').style.visibility = 'hidden'; + } + else + { + document.getElementById('clock_start' ).style.visibility = "visible"; + document.getElementById('clock_end').style.visibility = 'hidden'; + } + updateClockInOut(elementhour, strid, id, elementend ); } function updateClockInOut(entrytime, strid, id, elementend){ @@ -1690,8 +1690,9 @@ function totalClockInOut(id, flag) var issueTable = document.getElementById("issueTable"); var totTimeRow = issueTable.rows[3]; totHrCell = totTimeRow.cells[hStartIndex + j ]; - addval[j] = addval[j] ? addval[j] : "00:00" ; - totHrCell.innerHTML = ( (flag == 1 && j == id) ? tot : addval[j] ) + " "; + addval[j] = addval[j] ? addval[j] : "00:00" ; +//TODO -- Move this to UI(HTML page) + totHrCell.innerHTML = "
" + ( (flag == 1 && j == id) ? tot : addval[j] ) + "
"; } //} From 2afedab67cba47a74c8990d56b6b08b81994efb4 Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 8 Mar 2016 18:44:20 +0530 Subject: [PATCH 03/46] Add termination date. --- app/controllers/wkattendance_controller.rb | 26 +++++++++++++++++---- app/views/settings/_tab_attendance.html.erb | 8 +++++-- app/views/wkattendance/reportattn.html.erb | 12 ++++------ config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/locales/fr.yml | 1 + config/locales/it.yml | 1 + 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 84f8e1390..97a986252 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -127,18 +127,16 @@ def report def reportattn dateStr = getConvertDateStr('start_time') sqlStr = "" + userSqlStr = getUserQueryStr leaveSql = "select u.id as user_id, i.id as issue_id, l.balance, l.accrual, l.used, l.accrual_on, lm.balance + lm.accrual - lm.used as open_bal from users u cross join (select id from issues where id in (#{getReportLeaveIssueIds})) i left join (#{getLeaveQueryStr(@from,@to)}) l on l.user_id = u.id and l.issue_id = i.id left join (#{getLeaveQueryStr(@from << 1,@from - 1)}) lm on lm.user_id = u.id and i.id = lm.issue_id" if isAccountUser - @userlist = User.where("type = ?", 'User').order('id') - #leave_data = WkUserLeave.where("issue_id in (#{getReportLeaveIssueIds}) and accrual_on between '#{@from}' and '#{@to}'") leave_entry = TimeEntry.where("issue_id in (#{getLeaveIssueIds}) and spent_on between '#{@from}' and '#{@to}'") sqlStr = "select user_id,#{dateStr} as spent_on,sum(hours) as hours from wk_attendances where start_time between '#{@from}' and '#{@to}' group by user_id,#{dateStr}" else - @userlist = User.where("type = ? AND id = ?", 'User', User.current.id) - #leave_data = WkUserLeave.where("issue_id in (#{getReportLeaveIssueIds}) and accrual_on between '#{@from}' and '#{@to}' and user_id = #{User.current.id} " ) leave_entry = TimeEntry.where("issue_id in (#{getLeaveIssueIds}) and spent_on between '#{@from}' and '#{@to}' and user_id = #{User.current.id} " ) sqlStr = "select user_id,#{dateStr} as spent_on,sum(hours) as hours from wk_attendances where start_time between '#{@from}' and '#{@to}' and user_id = #{User.current.id} group by user_id,#{dateStr}" end + @userlist = User.find_by_sql(userSqlStr) leave_data = WkUserLeave.find_by_sql(leaveSql) daily_entries = WkAttendance.find_by_sql(sqlStr) @attendance_entries = Hash.new @@ -162,6 +160,26 @@ def reportattn render :action => 'reportattn' end + def getUserQueryStr + queryStr = "select u.id , u.firstname, u.lastname,cvt.value as termination_date, cvj.value as joining_date, " + + "cvdob.value as date_of_birth, cveid.value as employee_id, cvdesg.value as designation from users u " + + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + + "left join custom_values cvj on (u.id = cvj.customized_id and cvj.custom_field_id = #{getSettingCfId('wktime_attn_join_date_cf')} ) " + + "left join custom_values cvdob on (u.id = cvdob.customized_id and cvdob.custom_field_id = #{getSettingCfId('wktime_attn_user_dob_cf')} ) " + + "left join custom_values cveid on (u.id = cveid.customized_id and cveid.custom_field_id = #{getSettingCfId('wktime_attn_employee_id_cf')} ) " + + "left join custom_values cvdesg on (u.id = cvdesg.customized_id and cvdesg.custom_field_id = #{getSettingCfId('wktime_attn_designation_cf')} ) " + + "where u.type = 'User' and (cvt.value is null or #{getConvertDateStr('cvt.value')} >= '#{@from}')" + if !isAccountUser + queryStr = queryStr + " and u.id = #{User.current.id} " + end + queryStr = queryStr + " order by u.created_on" + end + + def getSettingCfId(settingId) + cfId = Setting.plugin_redmine_wktime[settingId].blank? ? 0 : Setting.plugin_redmine_wktime[settingId].to_i + cfId + end + def getLeaveQueryStr(from,to) queryStr = "select * from wk_user_leaves WHERE issue_id in (#{getLeaveIssueIds}) and accrual_on between '#{from}' and '#{to}'" if !isAccountUser diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 28bac5378..1cd7e29eb 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -38,7 +38,7 @@ lblYear = "<%=l(:label_year) %>"; %> <%= select_tag('settings[wktime_break_time]', - options_for_select(breakTime, :selected => 'settings[wktime_break_time]'), :multiple=> true, :style => "width:200px; height:150px;")%> + options_for_select(breakTime, :selected => 'settings[wktime_break_time]'), :multiple=> true, :style => "width:200px; height:100px;")%>

@@ -120,7 +120,7 @@ lblYear = "<%=l(:label_year) %>"; %> <%= select_tag('settings[wktime_leave]', - options_for_select(leave, :selected => 'settings[wktime_leave]'), :multiple=> true, :style => "min-width:200px; height:150px;")%> + options_for_select(leave, :selected => 'settings[wktime_leave]'), :multiple=> true, :style => "min-width:200px; height:100px;")%>

@@ -181,6 +181,10 @@ lblYear = "<%=l(:label_year) %>";

<%=h select_tag('settings[wktime_attn_join_date_cf]', options_for_select(cfd, :selected => @settings['wktime_attn_join_date_cf'])) %> +

+

+ <%=h select_tag('settings[wktime_attn_terminate_date_cf]', + options_for_select(cfd, :selected => @settings['wktime_attn_terminate_date_cf'])) %>

<%=h select_tag('settings[wktime_attn_user_dob_cf]', diff --git a/app/views/wkattendance/reportattn.html.erb b/app/views/wkattendance/reportattn.html.erb index 3fa8db8c3..388c62304 100644 --- a/app/views/wkattendance/reportattn.html.erb +++ b/app/views/wkattendance/reportattn.html.erb @@ -81,16 +81,12 @@ <%if showSlno %> <%=h index+1 %> <%else%> - <%=h entry.custom_field_values.detect { |cfv| - cfv.custom_field.id == Setting.plugin_redmine_wktime['wktime_attn_employee_id_cf'].to_i } %> + <%=h entry.employee_id %> <%end%> <%=h entry.firstname + " " + entry.lastname %> -<%=h entry.custom_field_values.detect { |cfv| - cfv.custom_field.id == Setting.plugin_redmine_wktime['wktime_attn_join_date_cf'].to_i } %> -<%=h entry.custom_field_values.detect { |cfv| - cfv.custom_field.id == Setting.plugin_redmine_wktime['wktime_attn_user_dob_cf'].to_i } %> -<%=h entry.custom_field_values.detect { |cfv| - cfv.custom_field.id == Setting.plugin_redmine_wktime['wktime_attn_designation_cf'].to_i } %> +<%=h entry.joining_date %> +<%=h entry.date_of_birth %> +<%=h entry.designation %> <%=h balance1 %> <%=h balance2 %> <%=h balance3 %> diff --git a/config/locales/de.yml b/config/locales/de.yml index 07bcdfd40..bf3fa35f9 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -161,6 +161,7 @@ de: label_difference: Differences label_grand_total: Total Hours label_wk_attn_join_date: Joining date + label_wk_attn_termination_date: Termination date label_wk_attn_user_dob: Date of birth label_wk_designation: Designation label_employee_id: Employee Id diff --git a/config/locales/en.yml b/config/locales/en.yml index ea27a0262..cfcbb3eec 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -162,6 +162,7 @@ en: label_difference: Differences label_grand_total: Total Hours label_wk_attn_join_date: Joining date + label_wk_attn_termination_date: Termination date label_wk_attn_user_dob: Date of birth label_wk_designation: Designation label_employee_id: Employee Id diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9217064df..a538f02ca 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -161,6 +161,7 @@ fr: label_Difference: Differences label_grand_total: Total Hours label_wk_attn_join_date: Joining date + label_wk_attn_termination_date: Termination date label_wk_attn_user_dob: Date of birth label_wk_designation: Designation label_employee_id: Employee Id diff --git a/config/locales/it.yml b/config/locales/it.yml index 92e0b6536..dfd871b95 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -159,6 +159,7 @@ it: label_Difference: Differences label_grand_total: Total Hours label_wk_attn_join_date: Joining date + label_wk_attn_termination_date: Termination date label_wk_attn_user_dob: Date of birth label_wk_designation: Designation label_employee_id: Employee Id From e26b1746819868596f77874d1b7ce80bfae68c22 Mon Sep 17 00:00:00 2001 From: Karthick Date: Thu, 10 Mar 2016 13:42:28 +0530 Subject: [PATCH 04/46] Apply termination date logic to Attendance List page --- app/controllers/wkattendance_controller.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 97a986252..65d26c538 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -9,12 +9,13 @@ class WkattendanceController < ApplicationController def index sqlStr = "" + fromDate = Date.civil(Date.today.year, Date.today.month, 1) << 1 if(Setting.plugin_redmine_wktime['wktime_leave'].blank?) sqlStr = " select u.id as user_id, -1 as issue_id from users u where u.type = 'User' " else listboxArr = Setting.plugin_redmine_wktime['wktime_leave'][0].split('|') issueId = listboxArr[0] - sqlStr = getQueryStr + " where i.id in (#{issueId}) and u.type = 'User'" + sqlStr = getQueryStr + " where i.id in (#{issueId}) and u.type = 'User' and (cvt.value is null or date(cvt.value) >= '#{fromDate}')" end if !isAccountUser sqlStr = sqlStr + " and u.id = #{User.current.id} " @@ -108,12 +109,16 @@ def getReportLeaveIssueIds def getQueryStr queryStr = '' - queryStr = "select u.id as user_id, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u - cross join issues i left join (SELECT wl.* FROM wk_user_leaves wl inner join" - queryStr = queryStr + " ( select max(accrual_on) as accrual_on, user_id, issue_id from wk_user_leaves - group by user_id, issue_id) t" - queryStr = queryStr + " on wl.user_id = t.user_id and wl.issue_id = t.issue_id - and wl.accrual_on = t.accrual_on) w on w.user_id = u.id and w.issue_id = i.id" + fromDate = Date.civil(Date.today.year, Date.today.month, 1) -1 + queryStr = "select u.id as user_id, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u " + + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + + "cross join issues i left join wk_user_leaves w on w.user_id = u.id and w.issue_id = i.id + and w.accrual_on = '#{fromDate}'" + #"cross join issues i left join (SELECT wl.* FROM wk_user_leaves wl inner join" + #queryStr = queryStr + " ( select max(accrual_on) as accrual_on, user_id, issue_id from wk_user_leaves + #group by user_id, issue_id) t" + #queryStr = queryStr + " on wl.user_id = t.user_id and wl.issue_id = t.issue_id + #and wl.accrual_on = t.accrual_on) w on w.user_id = u.id and w.issue_id = i.id" queryStr end From ecfa4522e09cb733739013c642e9dcbec5ca57f1 Mon Sep 17 00:00:00 2001 From: Karthick Date: Thu, 10 Mar 2016 13:47:24 +0530 Subject: [PATCH 05/46] Naming Conversion --- app/controllers/wkattendance_controller.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 65d26c538..15d973435 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -9,13 +9,13 @@ class WkattendanceController < ApplicationController def index sqlStr = "" - fromDate = Date.civil(Date.today.year, Date.today.month, 1) << 1 + lastMonthStartDt = Date.civil(Date.today.year, Date.today.month, 1) << 1 if(Setting.plugin_redmine_wktime['wktime_leave'].blank?) sqlStr = " select u.id as user_id, -1 as issue_id from users u where u.type = 'User' " else listboxArr = Setting.plugin_redmine_wktime['wktime_leave'][0].split('|') issueId = listboxArr[0] - sqlStr = getQueryStr + " where i.id in (#{issueId}) and u.type = 'User' and (cvt.value is null or date(cvt.value) >= '#{fromDate}')" + sqlStr = getQueryStr + " where i.id in (#{issueId}) and u.type = 'User' and (cvt.value is null or date(cvt.value) >= '#{lastMonthStartDt}')" end if !isAccountUser sqlStr = sqlStr + " and u.id = #{User.current.id} " @@ -109,16 +109,11 @@ def getReportLeaveIssueIds def getQueryStr queryStr = '' - fromDate = Date.civil(Date.today.year, Date.today.month, 1) -1 + lastAccrualOn = Date.civil(Date.today.year, Date.today.month, 1) -1 queryStr = "select u.id as user_id, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u " + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + "cross join issues i left join wk_user_leaves w on w.user_id = u.id and w.issue_id = i.id - and w.accrual_on = '#{fromDate}'" - #"cross join issues i left join (SELECT wl.* FROM wk_user_leaves wl inner join" - #queryStr = queryStr + " ( select max(accrual_on) as accrual_on, user_id, issue_id from wk_user_leaves - #group by user_id, issue_id) t" - #queryStr = queryStr + " on wl.user_id = t.user_id and wl.issue_id = t.issue_id - #and wl.accrual_on = t.accrual_on) w on w.user_id = u.id and w.issue_id = i.id" + and w.accrual_on = '#{lastAccrualOn}'" queryStr end From 115989068ce116b4ead43769803259246104d2fc Mon Sep 17 00:00:00 2001 From: Karthick Date: Thu, 10 Mar 2016 17:02:14 +0530 Subject: [PATCH 06/46] Fix for sql server compatibility --- app/controllers/wkattendance_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 15d973435..301a5c9e6 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -15,7 +15,7 @@ def index else listboxArr = Setting.plugin_redmine_wktime['wktime_leave'][0].split('|') issueId = listboxArr[0] - sqlStr = getQueryStr + " where i.id in (#{issueId}) and u.type = 'User' and (cvt.value is null or date(cvt.value) >= '#{lastMonthStartDt}')" + sqlStr = getQueryStr + " where i.id in (#{issueId}) and u.type = 'User' and (cvt.value is null or #{getConvertDateStr('cvt.value')} >= '#{lastMonthStartDt}')" end if !isAccountUser sqlStr = sqlStr + " and u.id = #{User.current.id} " From dae8120d4c2147787ed4d1fd0ad5d2d2e7e93a06 Mon Sep 17 00:00:00 2001 From: Karthick Date: Thu, 10 Mar 2016 19:56:41 +0530 Subject: [PATCH 07/46] Previous Next in attendance edit page --- app/controllers/wkattendance_controller.rb | 13 ++++---- app/views/wkattendance/_list.html.erb | 7 ++-- app/views/wkattendance/edit.html.erb | 39 ++++++++++++++++------ 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 301a5c9e6..90abfb154 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -11,7 +11,7 @@ def index sqlStr = "" lastMonthStartDt = Date.civil(Date.today.year, Date.today.month, 1) << 1 if(Setting.plugin_redmine_wktime['wktime_leave'].blank?) - sqlStr = " select u.id as user_id, -1 as issue_id from users u where u.type = 'User' " + sqlStr = " select u.id as user_id, u.firstname, u.lastname, -1 as issue_id from users u where u.type = 'User' " else listboxArr = Setting.plugin_redmine_wktime['wktime_leave'][0].split('|') issueId = listboxArr[0] @@ -24,7 +24,7 @@ def index end def edit - sqlStr = getQueryStr + " where i.id in (#{getLeaveIssueIds}) and u.type = 'User' and u.id = #{params[:user_id]}" + sqlStr = getQueryStr + " where i.id in (#{getLeaveIssueIds}) and u.type = 'User' and u.id = #{params[:user_id]} order by i.id" @leave_details = WkUserLeave.find_by_sql(sqlStr) render :action => 'edit' end @@ -33,6 +33,7 @@ def update errorMsg =nil wkuserleave = nil ids = params[:ids] + accrualOn = params[:accrual_on] newIssueIds = params[:new_issue_ids] newIssueArr = newIssueIds.split(',') userId = params[:user_id] @@ -58,7 +59,7 @@ def update wkuserleave.balance = params["balance_"+issueId] wkuserleave.accrual = params["accrual_"+issueId] wkuserleave.used = params["used_"+issueId] - wkuserleave.accrual_on = Date.civil(Date.today.year, Date.today.month, 1) -1 + wkuserleave.accrual_on = accrualOn #Date.civil(Date.today.year, Date.today.month, 1) -1 if !wkuserleave.save() errorMsg = wkuserleave.errors.full_messages.join('\n') end @@ -109,11 +110,11 @@ def getReportLeaveIssueIds def getQueryStr queryStr = '' - lastAccrualOn = Date.civil(Date.today.year, Date.today.month, 1) -1 - queryStr = "select u.id as user_id, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u " + + accrualOn = params[:accrual_on].blank? ? Date.civil(Date.today.year, Date.today.month, 1) -1 : params[:accrual_on].to_s.to_date + queryStr = "select u.id as user_id, u.firstname, u.lastname, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u " + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + "cross join issues i left join wk_user_leaves w on w.user_id = u.id and w.issue_id = i.id - and w.accrual_on = '#{lastAccrualOn}'" + and w.accrual_on = '#{accrualOn}'" queryStr end diff --git a/app/views/wkattendance/_list.html.erb b/app/views/wkattendance/_list.html.erb index 0f3142d3b..77e61723d 100644 --- a/app/views/wkattendance/_list.html.erb +++ b/app/views/wkattendance/_list.html.erb @@ -7,6 +7,7 @@ <%= l(:field_user) %> <% isAvailable = false + lastAccrualOn = Date.civil(Date.today.year, Date.today.month, 1) -1 isAvailable = true if @leave_entries[0].issue_id != -1 %> <% if isAvailable %> @@ -19,12 +20,12 @@ <% @leave_entries.each do |entry| -%> "> -<%=h entry.user.name %> +<%=h entry.firstname + ' ' + entry.lastname%> <% if isAvailable %> -<%=h entry.balance %> +<%=h (entry.balance.blank? ? 0 : entry.balance) + (entry.accrual.blank? ? 0 : entry.accrual) - (entry.used.blank? ? 0 : entry.used) %> <% end %> - <%= link_to image_tag('edit.png'), {:controller => controller.controller_name, :action => 'edit', :user_id => entry.user_id, :tab => controller.controller_name}, + <%= link_to image_tag('edit.png'), {:controller => controller.controller_name, :action => 'edit', :user_id => entry.user_id, :accrual_on => lastAccrualOn, :tab => controller.controller_name}, :title => l(:button_edit) %> diff --git a/app/views/wkattendance/edit.html.erb b/app/views/wkattendance/edit.html.erb index 72fba0ce1..8e8549ecc 100644 --- a/app/views/wkattendance/edit.html.erb +++ b/app/views/wkattendance/edit.html.erb @@ -1,18 +1,33 @@

<%= l(:label_wk_leave) + " " + l(:field_summary) %>

<%= form_tag({:controller => 'wkattendance', :action => 'update'}, :method => :post, :id => 'wkattendance_update') do %> <% - accurual_entries = @leave_details.select{ |entry| !entry.accrual_on.blank? } - if accurual_entries.blank? - accural_on = "" - user_data = User.find(params[:user_id]) - user_name = user_data.firstname + " " + user_data.lastname - else - accural_on = accurual_entries[0].accrual_on.strftime("%B") + ", " + accurual_entries[0].accrual_on.strftime("%Y") - user_name = @leave_details[0].user.name - end + lastAccrualOn = Date.civil(Date.today.year, Date.today.month, 1) -1 + accrual_on = params[:accrual_on].to_s.to_date + accrualOnStr = accrual_on.strftime("%B") + ", " + accrual_on.strftime("%Y") + user_name = @leave_details[0].firstname + ' ' + @leave_details[0].lastname + hasNext = accrual_on < lastAccrualOn %> -
-
+ + + + + + + + + + + + +
<%=l(:field_user)%><%=h user_name %>
<%=l(:label_wk_attn_for)%><%=h accrualOnStr %>
+ <%= link_to("\xc2\xab " + l(:label_previous ), {:controller => controller.controller_name, :action => 'edit', :user_id => params[:user_id], :accrual_on => ((accrual_on + 1) << 1) -1, :tab => controller.controller_name}, + :title => l(:label_wk_prev_week_tip)) %> + <%if hasNext%> + | + <%= link_to(l(:label_next) + " \xc2\xbb", {:controller => controller.controller_name, :action => 'edit', :user_id => params[:user_id], :accrual_on => ((accrual_on + 1) >> 1) -1, :tab => controller.controller_name}, + :title => l(:label_wk_next_week_tip)) %> + <%end%> +

@@ -67,6 +82,8 @@ <%=h hidden_field_tag('user_id', userId) %> + <%=h hidden_field_tag('accrual_on', accrual_on) %> + <%=h hidden_field_tag('new_issue_ids', newIssueIds) %> <%=h hidden_field_tag('ids', ids) %> From aeaff686601e06edfc13135e96f05dbdc165c67a Mon Sep 17 00:00:00 2001 From: Karthick Date: Mon, 14 Mar 2016 15:31:06 +0530 Subject: [PATCH 08/46] Add Group filter in report --- app/controllers/wkattendance_controller.rb | 38 ++++++++++++++++--- app/views/wkattendance/_report_index.html.erb | 11 ++++++ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 90abfb154..28b5a506e 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -24,7 +24,7 @@ def index end def edit - sqlStr = getQueryStr + " where i.id in (#{getLeaveIssueIds}) and u.type = 'User' and u.id = #{params[:user_id]} order by i.id" + sqlStr = getQueryStr + " where i.id in (#{getLeaveIssueIds}) and u.type = 'User' and u.id = #{params[:user_id]} order by i.subject" @leave_details = WkUserLeave.find_by_sql(sqlStr) render :action => 'edit' end @@ -119,6 +119,12 @@ def getQueryStr end def report + @groups = Group.sorted.all + if params[:searchlist].blank? && session[:wkattendance].nil? + session[:wkattendance] = {:group_id => params[:group_id]} + elsif params[:searchlist] =='wkreport' + session[:wkattendance][:group_id] = params[:group_id] + end retrieve_date_range if params[:report_type] == 'attendance_report' reportattn @@ -126,10 +132,26 @@ def report end def reportattn + if !params[:group_id].blank? + group_id = params[:group_id] + else + group_id = session[:wkattendance][:group_id] + end + if group_id.blank? + group_id = 0 + end dateStr = getConvertDateStr('start_time') sqlStr = "" - userSqlStr = getUserQueryStr - leaveSql = "select u.id as user_id, i.id as issue_id, l.balance, l.accrual, l.used, l.accrual_on, lm.balance + lm.accrual - lm.used as open_bal from users u cross join (select id from issues where id in (#{getReportLeaveIssueIds})) i left join (#{getLeaveQueryStr(@from,@to)}) l on l.user_id = u.id and l.issue_id = i.id left join (#{getLeaveQueryStr(@from << 1,@from - 1)}) lm on lm.user_id = u.id and i.id = lm.issue_id" + userSqlStr = getUserQueryStr(group_id) + leaveSql = "select u.id as user_id, gu.group_id, i.id as issue_id, l.balance, l.accrual, l.used, l.accrual_on," + + " lm.balance + lm.accrual - lm.used as open_bal from users u" + + " left join groups_users gu on (gu.user_id = u.id and gu.group_id = #{group_id})" + + " cross join (select id from issues where id in (#{getReportLeaveIssueIds})) i" + + " left join (#{getLeaveQueryStr(@from,@to)}) l on l.user_id = u.id and l.issue_id = i.id" + + " left join (#{getLeaveQueryStr(@from << 1,@from - 1)}) lm on lm.user_id = u.id and i.id = lm.issue_id" + if group_id.to_i > 0 + leaveSql = leaveSql + " Where gu.group_id is not null" + end if isAccountUser leave_entry = TimeEntry.where("issue_id in (#{getLeaveIssueIds}) and spent_on between '#{@from}' and '#{@to}'") sqlStr = "select user_id,#{dateStr} as spent_on,sum(hours) as hours from wk_attendances where start_time between '#{@from}' and '#{@to}' group by user_id,#{dateStr}" @@ -161,15 +183,19 @@ def reportattn render :action => 'reportattn' end - def getUserQueryStr - queryStr = "select u.id , u.firstname, u.lastname,cvt.value as termination_date, cvj.value as joining_date, " + + def getUserQueryStr(group_id) + queryStr = "select u.id , gu.group_id, u.firstname, u.lastname,cvt.value as termination_date, cvj.value as joining_date, " + "cvdob.value as date_of_birth, cveid.value as employee_id, cvdesg.value as designation from users u " + + "left join groups_users gu on (gu.user_id = u.id and gu.group_id = #{group_id}) " + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + "left join custom_values cvj on (u.id = cvj.customized_id and cvj.custom_field_id = #{getSettingCfId('wktime_attn_join_date_cf')} ) " + "left join custom_values cvdob on (u.id = cvdob.customized_id and cvdob.custom_field_id = #{getSettingCfId('wktime_attn_user_dob_cf')} ) " + "left join custom_values cveid on (u.id = cveid.customized_id and cveid.custom_field_id = #{getSettingCfId('wktime_attn_employee_id_cf')} ) " + "left join custom_values cvdesg on (u.id = cvdesg.customized_id and cvdesg.custom_field_id = #{getSettingCfId('wktime_attn_designation_cf')} ) " + "where u.type = 'User' and (cvt.value is null or #{getConvertDateStr('cvt.value')} >= '#{@from}')" + if group_id.to_i > 0 + queryStr = queryStr + " and gu.group_id is not null" + end if !isAccountUser queryStr = queryStr + " and u.id = #{User.current.id} " end @@ -271,7 +297,7 @@ def getProjectByIssue respond_to do |format| format.text { render :text => project_id } end - end + end def setLimitAndOffset if api_request? diff --git a/app/views/wkattendance/_report_index.html.erb b/app/views/wkattendance/_report_index.html.erb index 9d4129767..f2b58f042 100644 --- a/app/views/wkattendance/_report_index.html.erb +++ b/app/views/wkattendance/_report_index.html.erb @@ -4,11 +4,22 @@ prevTab = 'tab-<%= "wkreport" %>'; <%= form_tag({:controller => controller_name, :action => 'report'}, :method => :get, :id => 'query_form') do %> +<% + groupid =session[:wkattendance][:group_id] +%>
+<% if isAccountUser %> + + +<% end %>
<%= l(:label_report) + " " + l(:field_type) %> <%= select_tag 'report_type', options_for_report_select, :style=> "width:200px;" %><%=l(:label_group_plural)%> + <%=h select_tag('group_id', + options_for_select( [[l(:label_all),0]] + (@groups.collect {|p| [p.name, p.id ]}), + :selected => !groupid.nil? ? groupid.to_i: 0), :style=> "width:300px;") %> +
<%= render :partial => 'wkattendance/date_range' %> From 4577672f45dd2d78d98a408e60ba6b82fc8ccd88 Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 15 Mar 2016 17:01:41 +0530 Subject: [PATCH 09/46] Alter project dropdown in settings attendance tab. Remove closed and locked project. Show the sub project name as like edit time sheet project dropdown. --- app/views/settings/_tab_attendance.html.erb | 69 ++++++++++----------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 1cd7e29eb..7519ba624 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -96,14 +96,11 @@ lblYear = "<%=l(:label_year) %>"; else issueslist = Array.new issueslist << [ "", 0] - end - project_list = Project.order('name') - unless project_list.blank? - projectlist = project_list.collect {|project| [project.name, project.id] } - else - projectlist = Array.new - projectlist << [ "", 0] - end + end + projects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name') + wktime_helper = Object.new.extend(WktimeHelper) + projArr = wktime_helper.options_for_wktime_project(projects,false) + if(@settings['wktime_leave'].blank?) leave = '' else @@ -130,33 +127,35 @@ lblYear = "<%=l(:label_year) %>";

-

- - <%=h select_tag('leave_project', - options_for_select(projectlist),:onchange => "projectChanged(this,-1);") %> -

-

- - <%=h select_tag('leave_issue', - options_for_select(issueslist)) %> -

-

- <%= text_field_tag 'wk_leave_short_name','', :size => 5, :maxlength => 4 %> -

-

- <%= text_field_tag('leave_accrual','', :size => 2.5, :maxlength => 3) %> <%= l(:label_hours_per_month) %> -

-

- <%= text_field_tag 'leave_accrual_after','', :size => 2.5, :maxlength => 3 %> <%= l(:label_year) %> -

-

- - <%=h select_tag('wk_attn_leave_reset_month', - options_for_select(l('date.month_names').collect.with_index.to_a)) %> -

-

- <%= hidden_field_tag :hdnAction, "" %> -

+ + + + + + + + + + + + + + + + + + + + + + + + + + + <%= hidden_field_tag :hdnAction, "" %> + +
<%=h select_tag('leave_project', options_for_select(projArr),:onchange => "projectChanged(this,-1);") %>
<%=h select_tag('leave_issue', options_for_select(issueslist)) %>
<%= text_field_tag 'wk_leave_short_name','', :size => 4, :maxlength => 4 %>
<%= text_field_tag('leave_accrual','', :size => 2.5, :maxlength => 3) %> <%= l(:label_hours_per_month) %>
<%= text_field_tag 'leave_accrual_after','', :size => 2.5, :maxlength => 3 %> <%= l(:label_year) %>
<%=h select_tag('wk_attn_leave_reset_month', options_for_select(l('date.month_names').collect.with_index.to_a)) %>
<% custom_fields = UserCustomField.order('name') From 8307dce3678ac138f0c11fb0910c25deff109170 Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 15 Mar 2016 19:40:21 +0530 Subject: [PATCH 10/46] Fix for blank termination date and round off hours in attendance --- app/controllers/wkattendance_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 28b5a506e..0e4f7cb9b 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -112,7 +112,7 @@ def getQueryStr queryStr = '' accrualOn = params[:accrual_on].blank? ? Date.civil(Date.today.year, Date.today.month, 1) -1 : params[:accrual_on].to_s.to_date queryStr = "select u.id as user_id, u.firstname, u.lastname, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u " + - "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.value != '' and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + "cross join issues i left join wk_user_leaves w on w.user_id = u.id and w.issue_id = i.id and w.accrual_on = '#{accrualOn}'" queryStr @@ -177,7 +177,7 @@ def reportattn end if !daily_entries.blank? daily_entries.each_with_index do |entry,index| - @attendance_entries[entry.user_id.to_s + '_' + entry.spent_on.to_date.strftime("%d").to_i.to_s + '_hours'] = entry.hours + @attendance_entries[entry.user_id.to_s + '_' + entry.spent_on.to_date.strftime("%d").to_i.to_s + '_hours'] = entry.hours.is_a?(Float) ? entry.hours.round(2) : entry.hours end end render :action => 'reportattn' @@ -187,7 +187,7 @@ def getUserQueryStr(group_id) queryStr = "select u.id , gu.group_id, u.firstname, u.lastname,cvt.value as termination_date, cvj.value as joining_date, " + "cvdob.value as date_of_birth, cveid.value as employee_id, cvdesg.value as designation from users u " + "left join groups_users gu on (gu.user_id = u.id and gu.group_id = #{group_id}) " + - "left join custom_values cvt on (u.id = cvt.customized_id and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.value != '' and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + "left join custom_values cvj on (u.id = cvj.customized_id and cvj.custom_field_id = #{getSettingCfId('wktime_attn_join_date_cf')} ) " + "left join custom_values cvdob on (u.id = cvdob.customized_id and cvdob.custom_field_id = #{getSettingCfId('wktime_attn_user_dob_cf')} ) " + "left join custom_values cveid on (u.id = cveid.customized_id and cveid.custom_field_id = #{getSettingCfId('wktime_attn_employee_id_cf')} ) " + From 3fe58186ba269544879b4b8eb33b04bf6cd1c86c Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Tue, 15 Mar 2016 19:14:18 +0530 Subject: [PATCH 11/46] clk in/out for nightshift change night shift, dialog note, fixed decimal point bug in expense --- app/controllers/wktime_controller.rb | 41 +++++-- app/views/settings/_tab_attendance.html.erb | 1 + app/views/wktime/_worktime_header.html.erb | 28 ++++- app/views/wktime/edit.html.erb | 10 +- assets/javascripts/edit.js | 123 ++++++++++++++------ config/locales/de.yml | 3 +- config/locales/en.yml | 3 +- config/locales/fr.yml | 3 +- config/locales/it.yml | 3 +- 9 files changed, 153 insertions(+), 62 deletions(-) diff --git a/app/controllers/wktime_controller.rb b/app/controllers/wktime_controller.rb index 4627bca7b..76706cff0 100644 --- a/app/controllers/wktime_controller.rb +++ b/app/controllers/wktime_controller.rb @@ -844,25 +844,41 @@ def updateAttendance paramvalues = Array.new entryvalues = Array.new ret = "" + count = 0 + oldendvalue = "" paramvalues = params[:editvalue].split(',') + if (params[:nightshift] == "false") + count = 1 + end for i in 0..paramvalues.length-1 entryvalues = paramvalues[i].split('|') + begin if !entryvalues[0].blank? #&& isAccountUser wkattendance = WkAttendance.find(entryvalues[0]) entrydate = wkattendance.start_time start_local = entrydate.localtime starttime = start_local.change({ hour: entryvalues[1].to_time.strftime("%H"), min: entryvalues[1].to_time.strftime("%M"), sec: entryvalues[1].to_time.strftime("%S") }) + oldendvalue = entryvalues[2] + if (params[:nightshift] == "true") + entryvalues[2] = "23:59" + end if !entryvalues[2].blank? endtime = start_local.change({ hour: entryvalues[2].to_time.strftime("%H"), min: entryvalues[2].to_time.strftime("%M"), sec: entryvalues[2].to_time.strftime("%S") }) end wkattendance.start_time = starttime wkattendance.end_time = endtime - wkattendance.hours = entryvalues[3] + wkattendance.hours = entryvalues[3] + entryvalues[0] = params[:nightshift] ? '' : entryvalues[0] else wkattendance = WkAttendance.new @startday = Date.parse params[:startdate] - entrydate = @startday + ((entryvalues[1].to_i)- 1) - wkattendance.user_id = params[:user_id].to_i + if(params[:nightshift] == "true") + entryvalues[1] = entryvalues[5] + entryvalues[2] = "00:00" + entryvalues[3] = oldendvalue + end + entrydate = @startday + ((entryvalues[1].to_i)- 1) + wkattendance.user_id = params[:user_id].to_i wkattendance.start_time = !entryvalues[2].blank? ? Time.parse("#{entrydate.to_s} #{ entryvalues[2].to_s}:00 ").localtime.to_s : '00:00' if !entryvalues[3].blank? wkattendance.end_time = Time.parse("#{entrydate.to_s} #{ entryvalues[3].to_s}:00 ").localtime.to_s @@ -871,8 +887,10 @@ def updateAttendance ret += '|' ret += entryvalues[1].to_s ret += ',' - end + count = 1 + end wkattendance.save() + end until count == 1 ret += wkattendance.id.to_s ret += ',' ret += ((wkattendance.start_time.localtime).to_formatted_s(:time)).to_s @@ -1116,8 +1134,8 @@ def gatherEntries end #timeEntry.hours = hours[j].blank? ? nil : hours[j].to_f #to allow for internationalization on decimal separator - #setValueForSpField(teEntry,hours[j],decimal_separator,entry) - teEntry.hours = hours[j].blank? ? nil : hours[j]#.to_f + setValueForSpField(teEntry,hours[j],decimal_separator,entry) + #teEntry.hours = hours[j].blank? ? nil : hours[j]#.to_f unless custom_fields.blank? teEntry.custom_field_values.each do |custom_value| @@ -1828,11 +1846,12 @@ def findEntriesByCond(cond) end def setValueForSpField(teEntry,spValue,decimal_separator,entry) - if (!spValue.blank? && is_number(spValue.gsub(decimal_separator, '.'))) - teEntry.hours = spValue.gsub(decimal_separator, '.').to_f - else - teEntry.hours = nil - end + teEntry.hours = spValue.blank? ? nil : spValue.to_hours + #if (!spValue.blank? && is_number(spValue.gsub(decimal_separator, '.'))) + # teEntry.hours = spValue.gsub(decimal_separator, '.').to_f + #else + # teEntry.hours = nil + #end end diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 7519ba624..82fdd1388 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -84,6 +84,7 @@ lblYear = "<%=l(:label_year) %>";

<%= hidden_field_tag :hdnAction, "" %>

+

<%= l(:label_hours_note) %>

diff --git a/app/views/wktime/_worktime_header.html.erb b/app/views/wktime/_worktime_header.html.erb index ffc595971..7bea360aa 100644 --- a/app/views/wktime/_worktime_header.html.erb +++ b/app/views/wktime/_worktime_header.html.erb @@ -45,11 +45,27 @@ <% endvalue[j] = '00:00' %> <% hiddenvalue[j] = '' %> <% end %> - <% end %> + <% end %> + <% nightclkout = false %> + <% count = 0 %> + <% futureTime = Time.now %> + <% currentTime = Time.now %> <% for i in 0..6%> <% if (@startday + i) == Date.today %> - <% col_num = i %> - <%=h hidden_field_tag('imgdisable', col_num ) %> + <% col_num = i %> + <% @wkmultiple = controller.multipleClockInOut %> + <% @wkmultiple.each do |entry| %> + <% multipleid = (entry.start_time.localtime).strftime('%Y-%m-%d') %> + <% if multipleid.to_s.to_date.wday == (@startday + (i-1)).wday && count != 1 %> + <% futureTime = (entry.start_time.localtime)+1440.minutes %> + <% count = 1 %> + <% end %> + <% end %> + <% if (endvalue[i-1] == '00:00' && startvalue[i-1] != '00:00') && (@startday + (i-1)) == Date.yesterday && futureTime.to_i > currentTime.to_i %> + <% nightclkout = true %> + <%=h hidden_field_tag('nightshift' , nightclkout ) %> + <% end %> + <%=h hidden_field_tag('imgdisable', !nightclkout ? col_num : col_num-1 ) %> <% end %> <% if (isEditable) %> @@ -57,15 +73,15 @@

<%=h text_field_tag( "#{str}_#{(i+1)}" , "#{str}" == "start" ? startvalue[i] : endvalue[i],:size => 4, :disabled => true, :class => (@startday + i).past? ? 'clock-textbox' : ((@startday + i).today? ? 'clock-todaytextbox' : '' ), :onchange => "validateHr(this,#{(i+1)});") %> - <%=h hidden_field_tag('hd' + "#{str}_#{(i+1)}", hiddenvalue[i] ) %> - <%=h hidden_field_tag('hours' + "#{str}_#{(i+1)}", hiddenvalue[i] ) %> + <%=h hidden_field_tag('hd' + "#{str}_#{(i+1)}", !nightclkout ? hiddenvalue[i] : hiddenvalue[i-1] ) %> + <%=h hidden_field_tag('hours' + "#{str}_#{(i+1)}", !nightclkout ? hiddenvalue[i] : hiddenvalue[i-1] ) %>
<% if ("#{str}" == "start" || "#{str}" == "end") && controller.showClockInOut && (i == col_num) && User.current.id == @user.id %> <% imgname = "#{str}" == "start" ? "clock8.jpg" : "clockout8.jpg" %>
<% image_tg = image_tag("#{imgname}", :id => "#{str}" == "start" ? 'start_img' : 'end_img' , :plugin => "redmine_wktime", :title => "#{str}" == "start" ? l(:label_clock_in) : l(:label_clock_out) ) %> - <%= link_to image_tg, "javascript:setClockInOut('#{str}','#{col_num}');", {:id => "clock_#{str}"} %> + <%= link_to image_tg, "javascript:setClockInOut('#{str}','#{!nightclkout ? col_num : col_num-1}');", {:id => "clock_#{str}"} %>
<% end %> diff --git a/app/views/wktime/edit.html.erb b/app/views/wktime/edit.html.erb index 29fa6ae8f..d1c1cfd39 100644 --- a/app/views/wktime/edit.html.erb +++ b/app/views/wktime/edit.html.erb @@ -100,9 +100,10 @@
- + + - +
@@ -156,12 +157,13 @@

<%= hidden_field_tag "newTotal_#{i}" , "" , :size => 4, :disabled => disable %>

- <% end %> + <% end %>
<% end %> <%=h hidden_field_tag("textlength", l ) %> - <%=h hidden_field_tag("grandtotal", totalvalue ) %> + <%=h hidden_field_tag("grandtotal", totalvalue ) %> + <%= l(:label_hours_note) %>
<%= render :partial => 'row_template' %> diff --git a/assets/javascripts/edit.js b/assets/javascripts/edit.js index 6f7dd2fb9..05b377c12 100644 --- a/assets/javascripts/edit.js +++ b/assets/javascripts/edit.js @@ -24,6 +24,7 @@ var rowid; var clktot; var addval = new Array(); var totalBreakTime = 0; +var nscount = 0; $(document).ready(function() { var e_comments = $( "#_edit_comments_" ); var e_notes = $( "#_edit_notes_" ); @@ -1112,9 +1113,9 @@ function updateRemainingHr(day) var totalRow = issueTable.rows[rowCount-2]; var rmTimeRow = issueTable.rows[rowCount-1]; var totTime= clktot ? clktot : "00:00:00",cell,rmTimeCell,dayTt,remainingTm = 0; - + var nsvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; //totTime = getTotalTime(day); - if(document.getElementById('grandTotal_'+day)) + if(document.getElementById('grandTotal_'+day) && !nsvalue ) { totTime = document.getElementById('grandTotal_'+day) != null ? document.getElementById('grandTotal_'+day).value+":00" : totTime ; } @@ -1333,14 +1334,18 @@ function showclkDialog(day) } } -function setClockInOut(strid,id) { +function setClockInOut(strid,id) { + if(nscount > 0) + { + id++; + } var d = new Date(); var hh = d.getHours(); var mm = d.getMinutes(); id++; elementhour = hh + ":" + mm; - elementend = hh + ":" + mm; - if( strid == 'start') + elementend = hh + ":" + mm; + if( strid == 'start' ) { document.getElementById('clock_end' ).style.visibility = "visible"; document.getElementById('clock_start').style.visibility = 'hidden'; @@ -1355,46 +1360,69 @@ function setClockInOut(strid,id) { function updateClockInOut(entrytime, strid, id, elementend){ var $this = $(this); - var hours,start,end, hoursdiff,hiddenvalue; + var hours,start,end, hoursdiff,hiddenvalue,updateendvalue; + var nsdiff, nshiddenvalue, nshours; + var paramval; + updateendvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; elementid = document.getElementById('hd'+strid + '_' + id).value; + start = document.getElementById('start_' + id).value; if(strid == "end") - { - start = document.getElementById('start_' + id).value; - end = elementend ;//document.getElementById('end_' + id).value; - hoursdiff = diff(start, end); + { + end = elementend ; + if(updateendvalue == "true") + { + end = "23:59"; + } + hoursdiff = diff(start, end); timediff(id,hoursdiff, 'hoursstart_'); hiddenvalue = document.getElementById('hoursstart_' + id).value; hours = timeStringToFloat(hiddenvalue); } - //var params = strid == 'start' ? {starttime: entrytime} : {endtime :entrytime, id: elementid, differences: hours }; - var paramval = (strid == 'start' ? "|"+ id : elementid ) + "|" + (strid == 'end' ? start : entrytime) + "|" + (strid == 'end' ? entrytime : "") + "|" + (strid == 'end' ? hours : "") + ","; + + if(updateendvalue == "true") + { + nsdiff = diff("00:00", entrytime); + timediff(id+1,nsdiff, 'hoursstart_'); + nshiddenvalue = document.getElementById('hoursstart_' + (id+1)).value; + nshours = timeStringToFloat(nshiddenvalue); + + } + paramval = (strid == 'start' ? "|"+ id : elementid ) + "|" + (strid == 'end' ? start : entrytime) + "|" + (strid == 'end' ? entrytime : "") + "|" + (strid == 'end' ? hours : "") + "|" + nshours + "|" + (id+1) + ","; updateAtt(paramval,false, strid, id); -/* $.ajax({ - url: 'saveAttendance', - type: 'get', - data: params, - success: function(data){ hiddenClockInOut(data, strid, id); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); */ } function hiddenClockInOut(data,strid,id){ var array = data.split(','); + + var updateendvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; + var setvalue = false; + if(updateendvalue && nscount == 0) + { + document.getElementById('end_' + (id)).value = "23:59"; + id++; + setvalue = true; + } hdstart = document.getElementById('hdstart_' + id); - hdstart.value = strid == 'start' ? array[1] : array[0]; + hdstart.value = strid == 'start' ? array[1] : (setvalue ? array[1] : array[0] ) ; hdend = document.getElementById('hdend_' + id); - hdend.value = strid == 'start' ? array[1] : array[0]; + hdend.value = strid == 'start' ? array[1] : (setvalue ? array[1] : array[0] ) ; elementid = document.getElementById(strid + '_' + id); - elementid.value = strid == 'start' ? array[2] : array[2]; + elementid.value = strid == 'start' ? array[2] : (setvalue ? array[3] : array[2] ) ; + if(strid == 'end') { - totalClockInOut(id, 1); + totalClockInOut(id, 1); } updateRemainingHr(id); - updateTotalHr(id); + updateTotalHr(id); + if(document.getElementById('nightshift') != null && updateendvalue ) + { + document.getElementById('nightshift').value = false; + nscount = 1; + } } function hoursClockInOut(s,id) @@ -1441,7 +1469,9 @@ function timediff(id, totTime, str) var count = 0, count1 = 0, count2 = 0 ; var i =0, j = 0; var minusdiff; + var oldstartval, oldendvalue; var oldtotal = "00:00:00" ; + var nsendvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; if(str == "total_") { startval = document.getElementById("popupstart_" + id).value ; @@ -1452,9 +1482,13 @@ function timediff(id, totTime, str) startval = document.getElementById("newstart_" + id).value ; endval = document.getElementById("newend_" + id).value ; } - else{ - startval = document.getElementById("start_" + id).value ; - endval = elementend ;//document.getElementById("end_" + id).value ; + else{ + startval = document.getElementById("start_" + id).value ; + endval = elementend ; + if(nsendvalue && startval != "00:00" && nscount == 0) + { + endval = "23:59"; + } } if(startval && endval) { @@ -1490,7 +1524,7 @@ function timediff(id, totTime, str) if (startBT == 1 && endBT == -1 ) { minusdiff = "0:00"; - } + } document.getElementById(str + id).value = minusdiff; } else @@ -1619,8 +1653,10 @@ function totalClockInOut(id, flag) var adding = 0; var seconds; var i = 0, j =1; - var clkdiff; + var clkdiff, prevdaytotal; var gtflag = false; + var nightshiftvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; + if(document.getElementById('hoursstart_'+id) != null) { clkdiff = document.getElementById('hoursstart_'+id).value; @@ -1662,13 +1698,21 @@ function totalClockInOut(id, flag) updateRemainingHr(i) } } - if(flag == 1 ) - { + if(flag == 1) + { var totalvalue = document.getElementById('grandtotal_'+id) != null ? document.getElementById('grandtotal_'+id).value+":00" : clktot; - tot = clktot != null ? MinutesDifferent(totalvalue, clkdiff+":00", 1 ) : clkdiff ; + tot = clktot != null ? MinutesDifferent(totalvalue, clkdiff+":00", 1 ) : clkdiff ; clktot = tot; addval[id] = clktot; - updateRemainingHr(id) + updateRemainingHr(id); + if((nightshiftvalue && nscount == 0 ) || nscount == 1 ) + { + prevdaytotal = document.getElementById('hoursstart_'+(id-1)).value; + addval[id-1] = prevdaytotal; + clktot = prevdaytotal; + updateRemainingHr(id-1); + } + clktot = tot; } if(flag == 2) @@ -1689,9 +1733,9 @@ function totalClockInOut(id, flag) { var issueTable = document.getElementById("issueTable"); var totTimeRow = issueTable.rows[3]; - totHrCell = totTimeRow.cells[hStartIndex + j ]; + totHrCell = totTimeRow.cells[hStartIndex + j ]; addval[j] = addval[j] ? addval[j] : "00:00" ; -//TODO -- Move this to UI(HTML page) + //TODO -- Move this to UI(HTML page) totHrCell.innerHTML = "
" + ( (flag == 1 && j == id) ? tot : addval[j] ) + "
"; } @@ -1711,11 +1755,16 @@ function timeStringToFloat(time) { function updateAtt(param, diff,str,id) { var datevalue = document.getElementById('startday').value; - var userid = document.getElementById('user_id').value; + var userid = document.getElementById('user_id').value; + var nightshift = false; + if(document.getElementById('nightshift') != null && !diff ) + { + nightshift = document.getElementById('nightshift').value; + } $.ajax({ url: 'updateAttendance', type: 'get', - data: {editvalue : param, startdate : datevalue, user_id : userid}, + data: {editvalue : param, startdate : datevalue, user_id : userid, nightshift : nightshift}, success: function(data){ if(!diff){ hiddenClockInOut(data, str, id);}else{ newClockInOut(data); } }, }); } diff --git a/config/locales/de.yml b/config/locales/de.yml index bf3fa35f9..33249af3b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -179,4 +179,5 @@ de: label_wk_form_q: FORM-Q label_wk_register_for_shops: REGISTER OF EMPLOYMENT FOR SHOPS AND ESTABLISHMENTS label_wk_name_address: Name and Address of the Establishment - label_date_of_entry_into_service: Date of entry into service \ No newline at end of file + label_date_of_entry_into_service: Date of entry into service + label_hours_note: "Note: Please enter time in 24 hours format." \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index cfcbb3eec..521b0dff9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -180,4 +180,5 @@ en: label_wk_form_q: FORM-Q label_wk_register_for_shops: REGISTER OF EMPLOYMENT FOR SHOPS AND ESTABLISHMENTS label_wk_name_address: Name and Address of the Establishment - label_date_of_entry_into_service: Date of entry into service \ No newline at end of file + label_date_of_entry_into_service: Date of entry into service + label_hours_note: "Note: Please enter time in 24 hours format." \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index a538f02ca..723dafcaf 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -179,4 +179,5 @@ fr: label_wk_form_q: FORM-Q label_wk_register_for_shops: REGISTER OF EMPLOYMENT FOR SHOPS AND ESTABLISHMENTS label_wk_name_address: Name and Address of the Establishment - label_date_of_entry_into_service: Date of entry into service \ No newline at end of file + label_date_of_entry_into_service: Date of entry into service + label_hours_note: "Note: Please enter time in 24 hours format." \ No newline at end of file diff --git a/config/locales/it.yml b/config/locales/it.yml index dfd871b95..550cc0489 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -177,4 +177,5 @@ it: label_wk_form_q: FORM-Q label_wk_register_for_shops: REGISTER OF EMPLOYMENT FOR SHOPS AND ESTABLISHMENTS label_wk_name_address: Name and Address of the Establishment - label_date_of_entry_into_service: Date of entry into service \ No newline at end of file + label_date_of_entry_into_service: Date of entry into service + label_hours_note: "Note: Please enter time in 24 hours format." \ No newline at end of file From 331ba5306d055426f3becab41130e21fdc22db9f Mon Sep 17 00:00:00 2001 From: Karthick Date: Thu, 17 Mar 2016 08:58:42 +0530 Subject: [PATCH 12/46] Show report in popup --- app/controllers/wkattendance_controller.rb | 2 +- app/views/wkattendance/_date_range.html.erb | 2 +- app/views/wkattendance/_report_index.html.erb | 2 +- app/views/wkattendance/reportattn.html.erb | 35 ++++++++++--------- assets/javascripts/index.js | 26 +++++++++++++- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 0e4f7cb9b..b77c4e083 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -180,7 +180,7 @@ def reportattn @attendance_entries[entry.user_id.to_s + '_' + entry.spent_on.to_date.strftime("%d").to_i.to_s + '_hours'] = entry.hours.is_a?(Float) ? entry.hours.round(2) : entry.hours end end - render :action => 'reportattn' + render :action => 'reportattn', :layout => false end def getUserQueryStr(group_id) diff --git a/app/views/wkattendance/_date_range.html.erb b/app/views/wkattendance/_date_range.html.erb index 8b16e63c5..bee687c6f 100644 --- a/app/views/wkattendance/_date_range.html.erb +++ b/app/views/wkattendance/_date_range.html.erb @@ -19,7 +19,7 @@

- <%= link_to_function l(:button_apply), '$("#query_form").submit(); return false;', :target => "_blank", :class => 'icon icon-checked' %> + <%= link_to l(:button_apply), "javascript: openReportPopup();", :class => 'icon icon-checked' %> <%#= link_to l(:button_apply), {:controller => controller_name, :action => action_name}, :class => 'icon icon-checked' %> <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name,:tab => "wkreport"}, :class => 'icon icon-reload' %>

diff --git a/app/views/wkattendance/_report_index.html.erb b/app/views/wkattendance/_report_index.html.erb index f2b58f042..c3cf945c9 100644 --- a/app/views/wkattendance/_report_index.html.erb +++ b/app/views/wkattendance/_report_index.html.erb @@ -2,6 +2,7 @@ <%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> <%= form_tag({:controller => controller_name, :action => 'report'}, :method => :get, :id => 'query_form') do %> <% @@ -23,6 +24,5 @@ <%= render :partial => 'wkattendance/date_range' %> -<%=h hidden_field_tag('tab', "wkreport") %> <%= hidden_field_tag "searchlist", "wkreport" %> <% end %> \ No newline at end of file diff --git a/app/views/wkattendance/reportattn.html.erb b/app/views/wkattendance/reportattn.html.erb index 388c62304..7a6aa7ae0 100644 --- a/app/views/wkattendance/reportattn.html.erb +++ b/app/views/wkattendance/reportattn.html.erb @@ -1,4 +1,3 @@ -

<%= l(:label_wk_attendance) + " " + l(:label_report) %>

<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> <%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> <%= render_tabs time_expense_tabs %> diff --git a/app/views/wkexpense/index.html.erb b/app/views/wkexpense/index.html.erb index 4b10dccba..c71da8349 100644 --- a/app/views/wkexpense/index.html.erb +++ b/app/views/wkexpense/index.html.erb @@ -3,7 +3,7 @@ wktimeIndexUrl = '<%=url_for(:controller => "wktime", :action => "index", :tab => "wktime")%>'; wkexpIndexUrl = '<%=url_for(:controller => "wkexpense", :action => "index", :tab => "wkexpense")%>'; wkattnIndexUrl = '<%=url_for(:controller => "wkattendance", :action => "index", :tab => "wkattendance")%>'; - wkReportUrl = '<%=url_for(:controller => "wkattendance", :action => "report", :tab => "wkreport")%>'; + wkReportUrl = '<%=url_for(:controller => "wkreport", :action => "index", :tab => "wkreport")%>'; <%= render_tabs time_expense_tabs %> diff --git a/app/views/wkattendance/_date_range.html.erb b/app/views/wkreport/_date_range.html.erb similarity index 100% rename from app/views/wkattendance/_date_range.html.erb rename to app/views/wkreport/_date_range.html.erb diff --git a/app/views/wkattendance/_report_index.html.erb b/app/views/wkreport/_report_index.html.erb similarity index 69% rename from app/views/wkattendance/_report_index.html.erb rename to app/views/wkreport/_report_index.html.erb index 7eaee5595..76b5a132d 100644 --- a/app/views/wkattendance/_report_index.html.erb +++ b/app/views/wkreport/_report_index.html.erb @@ -2,11 +2,11 @@ <%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> -<%= form_tag({:controller => controller_name, :action => 'report'}, :method => :get, :id => 'query_form') do %> +<%= form_tag({:controller => controller_name, :action => 'index'}, :method => :get, :id => 'query_form') do %> <% - groupid =session[:wkattendance][:group_id] + groupid =session[:wkreport][:group_id] %>
@@ -23,6 +23,6 @@ <% end %>
-<%= render :partial => 'wkattendance/date_range' %> +<%= render :partial => 'wkreport/date_range' %> <%= hidden_field_tag "searchlist", "wkreport" %> <% end %> \ No newline at end of file diff --git a/app/views/wkattendance/report.html.erb b/app/views/wkreport/index.html.erb similarity index 82% rename from app/views/wkattendance/report.html.erb rename to app/views/wkreport/index.html.erb index 97af9bec8..22696e977 100644 --- a/app/views/wkattendance/report.html.erb +++ b/app/views/wkreport/index.html.erb @@ -3,7 +3,7 @@ wktimeIndexUrl = '<%=url_for(:controller => "wktime", :action => "index", :tab => "wktime")%>'; wkexpIndexUrl = '<%=url_for(:controller => "wkexpense", :action => "index", :tab => "wkexpense")%>'; wkattnIndexUrl = '<%=url_for(:controller => "wkattendance", :action => "index", :tab => "wkattendance")%>'; - wkReportUrl = '<%=url_for(:controller => "wkattendance", :action => "report", :tab => "wkreport")%>'; + wkReportUrl = '<%=url_for(:controller => "wkreport", :action => "index", :tab => "wkreport")%>'; <%= render_tabs time_expense_tabs %> diff --git a/app/views/wkattendance/reportattn.html.erb b/app/views/wkreport/reportattn.html.erb similarity index 100% rename from app/views/wkattendance/reportattn.html.erb rename to app/views/wkreport/reportattn.html.erb diff --git a/app/views/wktime/index.html.erb b/app/views/wktime/index.html.erb index 5eda669dc..952649247 100644 --- a/app/views/wktime/index.html.erb +++ b/app/views/wktime/index.html.erb @@ -4,7 +4,7 @@ wktimeIndexUrl = '<%=url_for(:controller => "wktime", :action => "index", :tab => "wktime")%>'; wkexpIndexUrl = '<%=url_for(:controller => "wkexpense", :action => "index", :tab => "wkexpense")%>'; wkattnIndexUrl = '<%=url_for(:controller => "wkattendance", :action => "index", :tab => "wkattendance")%>'; - wkReportUrl = '<%=url_for(:controller => "wkattendance", :action => "report", :tab => "wkreport")%>'; + wkReportUrl = '<%=url_for(:controller => "wkreport", :action => "index", :tab => "wkreport")%>'; <%= render_tabs time_expense_tabs %> diff --git a/config/routes.rb b/config/routes.rb index a4b306559..7023767d4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -87,10 +87,6 @@ post 'wkattendance/index', :to => 'wkattendance#index' - get 'wkattendance/report', :to => 'wkattendance#report' - - get 'wkattendance/reportattn', :to => 'wkattendance#reportattn' - match 'wkattendance/edit', :to => 'wkattendance#edit', :via => [:get, :post] post 'wkattendance/update', :to => 'wkattendance#update' @@ -99,3 +95,10 @@ get 'wkattendance/getProjectByIssue', :to => 'wkattendance#getProjectByIssue' + #For Report + get 'wkreport/index', :to => 'wkreport#index' + + get 'wkreport/reportattn', :to => 'wkreport#reportattn' + + + From 0e930cc98efd91c97153c5a913ef3b85c75de430 Mon Sep 17 00:00:00 2001 From: Karthick Date: Fri, 18 Mar 2016 18:29:19 +0530 Subject: [PATCH 19/46] Bug fixing in attendance tab. --- app/controllers/wkattendance_controller.rb | 2 +- .../{_te_index.html.erb => _attn_index.html.erb} | 0 app/views/wkattendance/_list.html.erb | 5 +++-- app/views/wkattendance/index.html.erb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) rename app/views/wkattendance/{_te_index.html.erb => _attn_index.html.erb} (100%) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index cc10460f2..ab5ca5fd7 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -104,7 +104,7 @@ def getListQueryStr if index < 5 tAlias = "w#{index.to_s}" listboxArr = element.split('|') - joinTableStr = joinTableStr + "left join wk_user_leaves #{tAlias} on #{tAlias}.user_id = u.id and #{tAlias}.issue_id =" + listboxArr[0] + " and #{tAlias}.accrual_on = '#{accrualOn}'" + joinTableStr = joinTableStr + " left join wk_user_leaves #{tAlias} on #{tAlias}.user_id = u.id and #{tAlias}.issue_id = " + listboxArr[0] + " and #{tAlias}.accrual_on = '#{accrualOn}'" selectColStr = selectColStr + ", (#{tAlias}.balance + #{tAlias}.accrual - #{tAlias}.used) as total#{index.to_s}" end end diff --git a/app/views/wkattendance/_te_index.html.erb b/app/views/wkattendance/_attn_index.html.erb similarity index 100% rename from app/views/wkattendance/_te_index.html.erb rename to app/views/wkattendance/_attn_index.html.erb diff --git a/app/views/wkattendance/_list.html.erb b/app/views/wkattendance/_list.html.erb index 769b98c16..05ee141d0 100644 --- a/app/views/wkattendance/_list.html.erb +++ b/app/views/wkattendance/_list.html.erb @@ -3,7 +3,7 @@ <%= hidden_field_tag 'back_url', url_for(params) %> <% wktime_helper = Object.new.extend(WktimeHelper) %> <% if (wktime_helper.isAccountUser) %> -<%= form_tag(users_path, :method => :get) do %> +<%= form_tag({:controller => controller_name, :action => 'index'}, :method => :get) do %>
<%= l(:label_filter_plural) %> <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> @@ -16,8 +16,9 @@ <%= text_field_tag 'name', params[:name], :size => 30 %> <%= submit_tag l(:button_apply), :class => "small", :name => nil %> -<%= link_to l(:button_clear), users_path, :class => 'icon icon-reload' %> +<%= link_to l(:button_clear), {:controller => controller_name, :action => 'index', :tab => controller_name}, :class => 'icon icon-reload' %>
+<%=h hidden_field_tag('tab', "#{controller_name}") %> <% end %>   <% end %> diff --git a/app/views/wkattendance/index.html.erb b/app/views/wkattendance/index.html.erb index 99c415eb0..53b7c4947 100644 --- a/app/views/wkattendance/index.html.erb +++ b/app/views/wkattendance/index.html.erb @@ -7,5 +7,5 @@ <%= render_tabs time_expense_tabs %> -<%= render :partial => 'te_index' %> +<%= render :partial => 'attn_index' %> <% html_title(l(:label_ta)) -%> \ No newline at end of file From ee6c467171e6f3a9e4201b0c93c5a991f7f8496f Mon Sep 17 00:00:00 2001 From: Karthick Date: Mon, 21 Mar 2016 10:55:04 +0530 Subject: [PATCH 20/46] Filter names without case sensitive. --- app/controllers/wkattendance_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index ab5ca5fd7..4fee3c96a 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -29,7 +29,7 @@ def index sqlStr = sqlStr + " and gu.group_id = #{params[:group_id]}" end if !params[:name].blank? - sqlStr = sqlStr + " and (u.firstname like '%#{params[:name]}%' or u.lastname like '%#{params[:name]}%')" + sqlStr = sqlStr + " and (LOWER(u.firstname) like LOWER('%#{params[:name]}%') or LOWER(u.lastname) like LOWER('%#{params[:name]}%'))" end findBySql(sqlStr) end From b03528ed0466e7676651254f36ad3de6e3517e40 Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Tue, 22 Mar 2016 07:47:48 +0530 Subject: [PATCH 21/46] bug fixing clock in/out --- app/views/wktime/_worktime_header.html.erb | 8 ++++---- assets/javascripts/edit.js | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/wktime/_worktime_header.html.erb b/app/views/wktime/_worktime_header.html.erb index 7bea360aa..ee02b6216 100644 --- a/app/views/wktime/_worktime_header.html.erb +++ b/app/views/wktime/_worktime_header.html.erb @@ -55,17 +55,17 @@ <% col_num = i %> <% @wkmultiple = controller.multipleClockInOut %> <% @wkmultiple.each do |entry| %> - <% multipleid = (entry.start_time.localtime).strftime('%Y-%m-%d') %> - <% if multipleid.to_s.to_date.wday == (@startday + (i-1)).wday && count != 1 %> + <% stday = (entry.start_time.localtime).strftime('%Y-%m-%d') %> + <% if stday.to_s.to_date.wday == (@startday + (i-1)).wday && count != 1 %> <% futureTime = (entry.start_time.localtime)+1440.minutes %> <% count = 1 %> <% end %> <% end %> - <% if (endvalue[i-1] == '00:00' && startvalue[i-1] != '00:00') && (@startday + (i-1)) == Date.yesterday && futureTime.to_i > currentTime.to_i %> + <% if (endvalue[i-1] == '00:00' && startvalue[i-1] != '00:00') && (@startday + (i-1)) == (@startday + i).yesterday && futureTime.to_i > currentTime.to_i %> <% nightclkout = true %> <%=h hidden_field_tag('nightshift' , nightclkout ) %> <% end %> - <%=h hidden_field_tag('imgdisable', !nightclkout ? col_num : col_num-1 ) %> + <%=h hidden_field_tag('col_num', !nightclkout ? col_num : col_num-1 ) %> <% end %> <% if (isEditable) %> diff --git a/assets/javascripts/edit.js b/assets/javascripts/edit.js index 05b377c12..160d47e48 100644 --- a/assets/javascripts/edit.js +++ b/assets/javascripts/edit.js @@ -150,9 +150,9 @@ $(document).ready(function() { if(showWorkHeader) { //when initially load the page hidden the clock in Clock out button var imgend,imghide,imgstart; - if(document.getElementById('imgdisable') != null && document.getElementById('end_img') != null && document.getElementById('start_img') != null) + if(document.getElementById('col_num') != null && document.getElementById('end_img') != null && document.getElementById('start_img') != null) { - imghide = document.getElementById('imgdisable').value; + imghide = document.getElementById('col_num').value; imghide++; if(document.getElementById('end_'+imghide) != null) { @@ -1113,9 +1113,9 @@ function updateRemainingHr(day) var totalRow = issueTable.rows[rowCount-2]; var rmTimeRow = issueTable.rows[rowCount-1]; var totTime= clktot ? clktot : "00:00:00",cell,rmTimeCell,dayTt,remainingTm = 0; - var nsvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; + //var nsvalue = document.getElementById('nightshift') != null ? document.getElementById('nightshift').value : false; //totTime = getTotalTime(day); - if(document.getElementById('grandTotal_'+day) && !nsvalue ) + if(document.getElementById('grandTotal_'+day) ) { totTime = document.getElementById('grandTotal_'+day) != null ? document.getElementById('grandTotal_'+day).value+":00" : totTime ; } @@ -1705,7 +1705,7 @@ function totalClockInOut(id, flag) clktot = tot; addval[id] = clktot; updateRemainingHr(id); - if((nightshiftvalue && nscount == 0 ) || nscount == 1 ) + if(nightshiftvalue && nscount == 0 ) { prevdaytotal = document.getElementById('hoursstart_'+(id-1)).value; addval[id-1] = prevdaytotal; From 9f64b1546f3de2f89c57ed4e77a6278c3e2830b7 Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 22 Mar 2016 12:54:13 +0530 Subject: [PATCH 22/46] Fix for duplicate issue in attendance list and edit page --- app/controllers/wkattendance_controller.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 4fee3c96a..a030426a0 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -91,8 +91,7 @@ def getQueryStr queryStr = "select u.id as user_id, u.firstname, u.lastname, i.id as issue_id,w.balance, w.accrual, w.used, w.accrual_on, w.id from users u " + "left join custom_values cvt on (u.id = cvt.customized_id and cvt.value != '' and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + "cross join issues i left join wk_user_leaves w on w.user_id = u.id and w.issue_id = i.id - and w.accrual_on = '#{accrualOn}' " + - " left join groups_users gu on u.id = gu.user_id" + and w.accrual_on = '#{accrualOn}' " queryStr end @@ -108,7 +107,11 @@ def getListQueryStr selectColStr = selectColStr + ", (#{tAlias}.balance + #{tAlias}.accrual - #{tAlias}.used) as total#{index.to_s}" end end - queryStr = selectColStr + " from users u left join custom_values cvt on (u.id = cvt.customized_id and cvt.value != '' and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + joinTableStr + " left join groups_users gu on u.id = gu.user_id" + queryStr = selectColStr + " from users u left join custom_values cvt on (u.id = cvt.customized_id and cvt.value != '' and cvt.custom_field_id = #{getSettingCfId('wktime_attn_terminate_date_cf')} ) " + joinTableStr + + if !params[:group_id].blank? + queryStr = queryStr + " left join groups_users gu on u.id = gu.user_id" + end queryStr end From d73061a704d9b97f3374a6f4857bd78614c93722 Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 22 Mar 2016 13:25:53 +0530 Subject: [PATCH 23/46] Fix to show only active users in the report when termination date not set --- app/controllers/wkreport_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/wkreport_controller.rb b/app/controllers/wkreport_controller.rb index 4c637958f..6af5930f6 100644 --- a/app/controllers/wkreport_controller.rb +++ b/app/controllers/wkreport_controller.rb @@ -86,6 +86,9 @@ def getUserQueryStr(group_id) if group_id.to_i > 0 queryStr = queryStr + " and gu.group_id is not null" end + if getSettingCfId('wktime_attn_terminate_date_cf') < 1 + queryStr = queryStr + " and u.status = #{User::STATUS_ACTIVE}" + end if !isAccountUser queryStr = queryStr + " and u.id = #{User.current.id} " end From 082c65bb10853b5d41d0c48d31f115d17a04fcbd Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Tue, 22 Mar 2016 06:13:28 +0530 Subject: [PATCH 24/46] UI changes --- app/views/wktime/_worktime_header.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/wktime/_worktime_header.html.erb b/app/views/wktime/_worktime_header.html.erb index ee02b6216..3d07884c0 100644 --- a/app/views/wktime/_worktime_header.html.erb +++ b/app/views/wktime/_worktime_header.html.erb @@ -57,7 +57,7 @@ <% @wkmultiple.each do |entry| %> <% stday = (entry.start_time.localtime).strftime('%Y-%m-%d') %> <% if stday.to_s.to_date.wday == (@startday + (i-1)).wday && count != 1 %> - <% futureTime = (entry.start_time.localtime)+1440.minutes %> + <% futureTime = (entry.start_time.localtime)+1439.minutes %> <% count = 1 %> <% end %> <% end %> @@ -70,7 +70,7 @@ <% if (isEditable) %> -
+
<%=h text_field_tag( "#{str}_#{(i+1)}" , "#{str}" == "start" ? startvalue[i] : endvalue[i],:size => 4, :disabled => true, :class => (@startday + i).past? ? 'clock-textbox' : ((@startday + i).today? ? 'clock-todaytextbox' : '' ), :onchange => "validateHr(this,#{(i+1)});") %> <%=h hidden_field_tag('hd' + "#{str}_#{(i+1)}", !nightclkout ? hiddenvalue[i] : hiddenvalue[i-1] ) %> @@ -89,7 +89,7 @@
<% else %> - + <% end %> <% end %> From 68ba4daf8460c9381c9bffd3f4e959150aa22a8a Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Tue, 22 Mar 2016 06:44:19 +0530 Subject: [PATCH 25/46] Hide hours note --- app/views/settings/_tab_attendance.html.erb | 5 ++++- app/views/wktime/edit.html.erb | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 82fdd1388..5b0f9a9d9 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -84,7 +84,10 @@ lblYear = "<%=l(:label_year) %>";

<%= hidden_field_tag :hdnAction, "" %>

-

<%= l(:label_hours_note) %>

+ <% wktime_helper = Object.new.extend(WktimeHelper) %> + <% if (wktime_helper.isAccountUser) %> +

<%= l(:label_hours_note) %>

+ <% end %>

diff --git a/app/views/wktime/edit.html.erb b/app/views/wktime/edit.html.erb index d1c1cfd39..0cdb713c9 100644 --- a/app/views/wktime/edit.html.erb +++ b/app/views/wktime/edit.html.erb @@ -163,7 +163,9 @@ <%=h hidden_field_tag("textlength", l ) %> <%=h hidden_field_tag("grandtotal", totalvalue ) %> - <%= l(:label_hours_note) %> + <% if isAccountUser %> +

<%= l(:label_hours_note) %>

+ <% end %>
<%= render :partial => 'row_template' %> From 10b87715c865efa6bc8ed588f8054251bf12394b Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 22 Mar 2016 16:11:17 +0530 Subject: [PATCH 26/46] Right align in attendance list and title in attendance settings --- app/views/settings/_tab_attendance.html.erb | 4 ++-- app/views/wkattendance/_list.html.erb | 4 ++-- app/views/wkreport/reportattn.html.erb | 7 ++++++- assets/stylesheets/wk-time.css | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 5b0f9a9d9..335c913d8 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -12,8 +12,8 @@ lblLeaveIssue = "<%=l(:label_wk_leave_issue) %>"; lblYear = "<%=l(:label_year) %>";
-

diff --git a/app/views/wkattendance/_list.html.erb b/app/views/wkattendance/_list.html.erb index 05ee141d0..0ac5a568d 100644 --- a/app/views/wkattendance/_list.html.erb +++ b/app/views/wkattendance/_list.html.erb @@ -35,7 +35,7 @@ Setting.plugin_redmine_wktime['wktime_leave'].each_with_index do |element,index| if index < 5 listboxArr = element.split('|') %> - <%= Issue.find(listboxArr[0]).subject %> + <%= Issue.find(listboxArr[0]).subject %> <% end end @@ -53,7 +53,7 @@ end %> if index < 5 listboxArr = element.split('|') %> - <%=h entry['total'+index.to_s] %> + <%=h entry['total'+index.to_s] %> <% end end diff --git a/app/views/wkreport/reportattn.html.erb b/app/views/wkreport/reportattn.html.erb index c0a2233aa..acf1cb6cb 100644 --- a/app/views/wkreport/reportattn.html.erb +++ b/app/views/wkreport/reportattn.html.erb @@ -24,7 +24,12 @@ end %>

- +
+ <% @leave_entries.each do |entry| -%> - -"> + <%= entry.status == 3 ? "user locked" : "" %>" > <% if isAvailable Setting.plugin_redmine_wktime['wktime_leave'].each_with_index do |element,index| From 5314e1bd341c4a509edea0dc35eef2110bcb20f7 Mon Sep 17 00:00:00 2001 From: Karthick Date: Tue, 22 Mar 2016 17:19:06 +0530 Subject: [PATCH 28/46] Bug fixing in report with locked users --- app/controllers/wkreport_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/wkreport_controller.rb b/app/controllers/wkreport_controller.rb index 6af5930f6..64dbfc04b 100644 --- a/app/controllers/wkreport_controller.rb +++ b/app/controllers/wkreport_controller.rb @@ -82,13 +82,10 @@ def getUserQueryStr(group_id) "left join custom_values cvdob on (u.id = cvdob.customized_id and cvdob.custom_field_id = #{getSettingCfId('wktime_attn_user_dob_cf')} ) " + "left join custom_values cveid on (u.id = cveid.customized_id and cveid.custom_field_id = #{getSettingCfId('wktime_attn_employee_id_cf')} ) " + "left join custom_values cvdesg on (u.id = cvdesg.customized_id and cvdesg.custom_field_id = #{getSettingCfId('wktime_attn_designation_cf')} ) " + - "where u.type = 'User' and (cvt.value is null or #{getConvertDateStr('cvt.value')} >= '#{@from}')" + "where u.type = 'User' and (#{getConvertDateStr('cvt.value')} >= '#{@from}' or u.status = #{User::STATUS_ACTIVE})" if group_id.to_i > 0 queryStr = queryStr + " and gu.group_id is not null" end - if getSettingCfId('wktime_attn_terminate_date_cf') < 1 - queryStr = queryStr + " and u.status = #{User::STATUS_ACTIVE}" - end if !isAccountUser queryStr = queryStr + " and u.id = #{User.current.id} " end From 84c9fc6d11014565bb61ff8b104dc49e53add221 Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Wed, 23 Mar 2016 11:17:47 +0530 Subject: [PATCH 29/46] Bug fixing in attendance report for locked user --- app/controllers/wkreport_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wkreport_controller.rb b/app/controllers/wkreport_controller.rb index 64dbfc04b..ec537d8cf 100644 --- a/app/controllers/wkreport_controller.rb +++ b/app/controllers/wkreport_controller.rb @@ -82,7 +82,7 @@ def getUserQueryStr(group_id) "left join custom_values cvdob on (u.id = cvdob.customized_id and cvdob.custom_field_id = #{getSettingCfId('wktime_attn_user_dob_cf')} ) " + "left join custom_values cveid on (u.id = cveid.customized_id and cveid.custom_field_id = #{getSettingCfId('wktime_attn_employee_id_cf')} ) " + "left join custom_values cvdesg on (u.id = cvdesg.customized_id and cvdesg.custom_field_id = #{getSettingCfId('wktime_attn_designation_cf')} ) " + - "where u.type = 'User' and (#{getConvertDateStr('cvt.value')} >= '#{@from}' or u.status = #{User::STATUS_ACTIVE})" + "where u.type = 'User' and (#{getConvertDateStr('cvt.value')} >= '#{@from}' or (u.status = #{User::STATUS_ACTIVE} and cvt.value is null))" if group_id.to_i > 0 queryStr = queryStr + " and gu.group_id is not null" end From 8ba4b565150ea4a867b7814347e48d573cc4f3f9 Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Wed, 23 Mar 2016 23:03:12 +0530 Subject: [PATCH 30/46] bug fixing in clock in/out style validation change --- app/views/wktime/_worktime_header.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/wktime/_worktime_header.html.erb b/app/views/wktime/_worktime_header.html.erb index 3d07884c0..7efbad9d7 100644 --- a/app/views/wktime/_worktime_header.html.erb +++ b/app/views/wktime/_worktime_header.html.erb @@ -72,7 +72,7 @@
<%= l(:label_wk_form_q) %>
<%= l(:label_wk_register_for_shops) %>

<%= l(:label_wk_name_address) %>: <%= Setting.app_title %> <%= l(:label_month) %>: <%= @from.strftime("%B")%> diff --git a/assets/stylesheets/wk-time.css b/assets/stylesheets/wk-time.css index ae6df6cb1..56b071b1a 100644 --- a/assets/stylesheets/wk-time.css +++ b/assets/stylesheets/wk-time.css @@ -2,6 +2,7 @@ .div-left{float: left; padding-right: 50px;} .div-right{float: left; } .lbl-txt-align{text-align:left !important} +.lbl-num-align{text-align:right !important} .clock-textbox{border-style: solid; border-color: #FF7F50; } .clock-todaytextbox{border-style: solid; border-color: #008000 ;} .report-table{ width : 100%; border-collapse:collapse; cellspacing:0; frame:box; table-layout: fixed; word-wrap: break-word; text-align: center; white-space: line-height:1.4em;margin-top:5px; margin-bottom:10px; padding-left: 10px; color:#333333; From ce45c66af084d38c443bfec9359422daff9ab806 Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Tue, 22 Mar 2016 08:14:57 +0530 Subject: [PATCH 27/46] bug fixing locked user Gray colour text show in attendances list page --- app/controllers/wkattendance_controller.rb | 4 ++-- app/views/wkattendance/_list.html.erb | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index a030426a0..e00e64817 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -13,7 +13,7 @@ def index sqlStr = "" lastMonthStartDt = Date.civil(Date.today.year, Date.today.month, 1) << 1 if(Setting.plugin_redmine_wktime['wktime_leave'].blank?) - sqlStr = " select u.id as user_id, u.firstname, u.lastname, -1 as issue_id from users u where u.type = 'User' " + sqlStr = " select u.id as user_id, u.firstname, u.lastname, u.status, -1 as issue_id from users u where u.type = 'User' " else listboxArr = Setting.plugin_redmine_wktime['wktime_leave'][0].split('|') issueId = listboxArr[0] @@ -97,7 +97,7 @@ def getQueryStr def getListQueryStr accrualOn = params[:accrual_on].blank? ? Date.civil(Date.today.year, Date.today.month, 1) -1 : params[:accrual_on].to_s.to_date - selectColStr = "select u.id as user_id, u.firstname, u.lastname" + selectColStr = "select u.id as user_id, u.firstname, u.lastname, u.status" joinTableStr = "" Setting.plugin_redmine_wktime['wktime_leave'].each_with_index do |element,index| if index < 5 diff --git a/app/views/wkattendance/_list.html.erb b/app/views/wkattendance/_list.html.erb index 0ac5a568d..713af4863 100644 --- a/app/views/wkattendance/_list.html.erb +++ b/app/views/wkattendance/_list.html.erb @@ -45,8 +45,7 @@ end %>
<%=h entry.firstname + ' ' + entry.lastname%>
- <%=h text_field_tag( "#{str}_#{(i+1)}" , "#{str}" == "start" ? startvalue[i] : endvalue[i],:size => 4, :disabled => true, :class => (@startday + i).past? ? 'clock-textbox' : ((@startday + i).today? ? 'clock-todaytextbox' : '' ), :onchange => "validateHr(this,#{(i+1)});") %> + <%=h text_field_tag( "#{str}_#{(i+1)}" , "#{str}" == "start" ? startvalue[i] : endvalue[i],:size => 4, :disabled => true, :class => (@startday + i) < Date.today ? 'clock-textbox' : ((@startday + i) == Date.today ? 'clock-todaytextbox' : '' ), :onchange => "validateHr(this,#{(i+1)});") %> <%=h hidden_field_tag('hd' + "#{str}_#{(i+1)}", !nightclkout ? hiddenvalue[i] : hiddenvalue[i-1] ) %> <%=h hidden_field_tag('hours' + "#{str}_#{(i+1)}", !nightclkout ? hiddenvalue[i] : hiddenvalue[i-1] ) %>
From 09c0306f2eaaf67492960cff08b4fe0cfe106223 Mon Sep 17 00:00:00 2001 From: dhineshrajasekar Date: Thu, 24 Mar 2016 01:30:18 +0530 Subject: [PATCH 31/46] bug fixing breaktime popup note --- app/views/settings/_tab_attendance.html.erb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 335c913d8..34e2eff91 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -84,10 +84,7 @@ lblYear = "<%=l(:label_year) %>";

<%= hidden_field_tag :hdnAction, "" %>

- <% wktime_helper = Object.new.extend(WktimeHelper) %> - <% if (wktime_helper.isAccountUser) %> -

<%= l(:label_hours_note) %>

- <% end %> +

<%= l(:label_hours_note) %>

From 074feb81dab5cd2428d76ed69a8611018ba97d15 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Wed, 23 Mar 2016 11:09:29 +0530 Subject: [PATCH 32/46] Bug fixing in clock in/out --- assets/javascripts/edit.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/assets/javascripts/edit.js b/assets/javascripts/edit.js index 160d47e48..53bfba3b2 100644 --- a/assets/javascripts/edit.js +++ b/assets/javascripts/edit.js @@ -149,20 +149,21 @@ $(document).ready(function() { if(showWorkHeader) { //when initially load the page hidden the clock in Clock out button - var imgend,imghide,imgstart; + var clkStart, clkEnd, colNum, attnId; if(document.getElementById('col_num') != null && document.getElementById('end_img') != null && document.getElementById('start_img') != null) { - imghide = document.getElementById('col_num').value; - imghide++; - if(document.getElementById('end_'+imghide) != null) + colNum = document.getElementById('col_num').value; + colNum++; + if(document.getElementById('end_' + colNum) != null) { - imgend = document.getElementById('end_'+imghide).value; + clkEnd = document.getElementById('end_' + colNum).value; } - if(document.getElementById('start_'+imghide) != null) + if(document.getElementById('start_'+colNum) != null) { - imgstart = document.getElementById('start_'+imghide).value; + clkStart = document.getElementById('start_' + colNum).value; } - if( imgend == "00:00" && imgstart != "00:00" ) + attnId = document.getElementById('hdstart_' + colNum).value; + if(clkEnd == "00:00" && (clkStart != "00:00" || attnId > 0)) { document.getElementById('clock_end').style.visibility = "visible"; document.getElementById('clock_start').style.visibility = 'hidden'; From d875f964840437b854e4289d6c4366c26c0af92a Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Wed, 23 Mar 2016 11:09:54 +0530 Subject: [PATCH 33/46] Updated version number --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 20523822d..44469b653 100644 --- a/init.rb +++ b/init.rb @@ -140,7 +140,7 @@ def destroy name 'Time & Attendance' author 'Adhi Software Pvt Ltd' description 'This plugin is for entering Time & Attendance' - version '2.1.1' + version '2.1.2' url 'http://www.redmine.org/plugins/wk-time' author_url 'http://www.adhisoftware.co.in/' From c05898c975b2f3d0c283f54ec7b1b1502734814f Mon Sep 17 00:00:00 2001 From: Karthick Date: Wed, 23 Mar 2016 19:34:51 +0530 Subject: [PATCH 34/46] Partial fix for settings attendance leave Except issue dropdown --- app/controllers/wkattendance_controller.rb | 4 +++- assets/javascripts/settings.js | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index e00e64817..61430d944 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -152,13 +152,15 @@ def check_permission def getProjectByIssue project_id="" + project_by_issue="" if !params[:issue_id].blank? issue_id = params[:issue_id] issues = Issue.where(:id => issue_id.to_i) project_id = issues[0].project_id + project_by_issue = issues[0].project_id.to_s + '|' + issues[0].project.name end respond_to do |format| - format.text { render :text => project_id } + format.text { render :text => project_by_issue } end end diff --git a/assets/javascripts/settings.js b/assets/javascripts/settings.js index c15cc6523..0d9b59132 100644 --- a/assets/javascripts/settings.js +++ b/assets/javascripts/settings.js @@ -382,7 +382,7 @@ function updateCustFldDD(currCFDD,anotherCFDD) $.ajax({ url: issueUrl, type: 'get', - data: {format:fmt,project_id:id}, + data: {format:fmt,project_id:id,issue_id:issueId}, success: function(data){ updateIssueDD(data, issueDD,issueId); }, beforeSend: function(){ $this.addClass('ajax-loading'); }, complete: function(){ $this.removeClass('ajax-loading'); } @@ -415,13 +415,31 @@ function updateCustFldDD(currCFDD,anotherCFDD) var fmt = 'text'; var projectDD = document.getElementById("leave_project"); var leaveIssue = document.getElementById("leave_issue"); + var projOptions= projectDD.options; var $this = $(this); $.ajax({ url: projectUrl, type: 'get', data: {format:fmt,issue_id:issueId}, success: function(data){ - projectDD.value = data; + var i, index, val, text, start; + index = data.indexOf('|'); + start = 0; + if(index != -1){ + val = data.substring(start, index); + text = data.substring(index+1); + } + for (var i= 0;i=0){ + projectDD.options[0] = new Option(text, val, false); + projectDD.options[0].selected= true; + } + //projectDD.value = data; projectChanged(projectDD,issueId); }, beforeSend: function(){ $this.addClass('ajax-loading'); }, From 641d6544b83992a1160aa0a2a4a8e325a3356f88 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Thu, 24 Mar 2016 17:12:09 +0530 Subject: [PATCH 35/46] Report alignment changes Changed percentage to pixels --- app/views/wkreport/reportattn.html.erb | 39 ++++++++++++++------------ config/locales/de.yml | 6 ++-- config/locales/en.yml | 6 ++-- config/locales/fr.yml | 6 ++-- config/locales/it.yml | 6 ++-- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/app/views/wkreport/reportattn.html.erb b/app/views/wkreport/reportattn.html.erb index acf1cb6cb..d9d616748 100644 --- a/app/views/wkreport/reportattn.html.erb +++ b/app/views/wkreport/reportattn.html.erb @@ -26,9 +26,12 @@

- - - - - - - - - - - - + + + + + + + + + + + + @@ -88,8 +91,8 @@ <%end%> - - + + @@ -103,7 +106,7 @@ <% for i in 1..31 hour = @attendance_entries[entry.id.to_s + '_' + i.to_s + '_hours'] leave = @attendance_entries[entry.id.to_s + '_' + i.to_s + '_leave'] - attn_entry = shortName[leave].blank? ? hour : (hour.blank? ? shortName[leave] : hour.to_s + "/ " + shortName[leave]) + attn_entry = shortName[leave].blank? ? hour : (hour.blank? ? shortName[leave] : (hour.to_s) + "/" + shortName[leave]) %> <% end -%> diff --git a/config/locales/de.yml b/config/locales/de.yml index 8865d4ebc..97e7c7018 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -168,9 +168,9 @@ de: label_leave_beginning_of_mnth: Leave Credit at the Beginning of the Month label_leave_during_mnth: Leave Availed During the Month label_daily_workdone_inclede_ot: Daily Hours of Work done including Overtime(If any) - label_total_hours_ot: Total hours of Over-time worked - label_total_hours_during_mnth: Total hours of work done during the month - label_total_no_of_maternity_leave: Total no. Of days Maternity leave availed + label_total_hours_ot: Total OT hours + label_total_hours_during_mnth: Total hours for month + label_total_no_of_maternity_leave: Total Maternity leave days label_attn_sl_no: Sl. No. wk_label_opening: Opening wk_label_closing: Closing diff --git a/config/locales/en.yml b/config/locales/en.yml index 7887dbf0d..e7036d23c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -169,9 +169,9 @@ en: label_leave_beginning_of_mnth: Leave Credit at the Beginning of the Month label_leave_during_mnth: Leave Availed During the Month label_daily_workdone_inclede_ot: Daily Hours of Work done including Overtime(If any) - label_total_hours_ot: Total hours of Over-time worked - label_total_hours_during_mnth: Total hours of work done during the month - label_total_no_of_maternity_leave: Total no. Of days Maternity leave availed + label_total_hours_ot: Total OT hours + label_total_hours_during_mnth: Total hours for month + label_total_no_of_maternity_leave: Total Maternity leave days label_attn_sl_no: Sl. No. wk_label_opening: Opening wk_label_closing: Closing diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ad5f74cd9..b2e101ed5 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -168,9 +168,9 @@ fr: label_leave_beginning_of_mnth: Leave Credit at the Beginning of the Month label_leave_during_mnth: Leave Availed During the Month label_daily_workdone_inclede_ot: Daily Hours of Work done including Overtime(If any) - label_total_hours_ot: Total hours of Over-time worked - label_total_hours_during_mnth: Total hours of work done during the month - label_total_no_of_maternity_leave: Total no. Of days Maternity leave availed + label_total_hours_ot: Total OT hours + label_total_hours_during_mnth: Total hours for month + label_total_no_of_maternity_leave: Total Maternity leave days label_attn_sl_no: Sl. No. wk_label_opening: Opening wk_label_closing: Closing diff --git a/config/locales/it.yml b/config/locales/it.yml index aacaa1456..a306202bb 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -166,9 +166,9 @@ it: label_leave_beginning_of_mnth: Leave Credit at the Beginning of the Month label_leave_during_mnth: Leave Availed During the Month label_daily_workdone_inclede_ot: Daily Hours of Work done including Overtime(If any) - label_total_hours_ot: Total hours of Over-time worked - label_total_hours_during_mnth: Total hours of work done during the month - label_total_no_of_maternity_leave: Total no. Of days Maternity leave availed + label_total_hours_ot: Total OT hours + label_total_hours_during_mnth: Total hours for month + label_total_no_of_maternity_leave: Total Maternity leave days label_attn_sl_no: Sl. No. wk_label_opening: Opening wk_label_closing: Closing From fcc8bfa71cb5a3e80494dbc4f7fb561c898d3f70 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Thu, 24 Mar 2016 17:14:30 +0530 Subject: [PATCH 36/46] bug fix on closed projects in plugin setting page --- app/controllers/wkattendance_controller.rb | 8 +++++++- app/views/settings/_tab_attendance.html.erb | 9 ++++++++- assets/javascripts/settings.js | 8 ++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 61430d944..7ae630540 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -130,10 +130,16 @@ def getIssuesByProject def getPrjIssues issueList = [] project_id = 0 + project = nil if !params[:project_id].blank? project_id = params[:project_id] + project = Project.find(project_id) + end + if (!project.blank? && project.status == 5 && !params[:issue_id].blank?) + issueList = Issue.where(:id => params[:issue_id], :project_id => project_id) + else + issueList = Issue.where(:project_id => project_id) end - issueList = Issue.where(:project_id => project_id) issueList end diff --git a/app/views/settings/_tab_attendance.html.erb b/app/views/settings/_tab_attendance.html.erb index 34e2eff91..af273a0d6 100644 --- a/app/views/settings/_tab_attendance.html.erb +++ b/app/views/settings/_tab_attendance.html.erb @@ -198,4 +198,11 @@ lblYear = "<%=l(:label_year) %>"; <%=h select_tag('settings[wktime_attn_employee_id_cf]', options_for_select(cfs, :selected => @settings['wktime_attn_employee_id_cf'])) %>

- \ No newline at end of file + + + +<% if !projArr.blank? %> +
+ <%=h select_tag('template_projDD', options_for_select(projArr))%> +
+<% end %> \ No newline at end of file diff --git a/assets/javascripts/settings.js b/assets/javascripts/settings.js index 0d9b59132..1047e15c9 100644 --- a/assets/javascripts/settings.js +++ b/assets/javascripts/settings.js @@ -261,6 +261,14 @@ function updateCustFldDD(currCFDD,anotherCFDD) if('Add' == action) { leaveAction = action; + leaveProject.options.length = 0; //clear the existing values + var templateDD = document.getElementById('template_projDD'); + var ddlength = templateDD.options.length; + //Refill the dropdown + for(i=0; i < ddlength; i++) + { + leaveProject.options[i] = new Option(templateDD.options[i].text,templateDD.options[i].value); + } leaveProject.selectedIndex = 0; projectChanged(leaveProject,-1); leaveAccrual.value = ""; From d93e58f7623a4cfd7b420b352d35573024cc0b2a Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Thu, 24 Mar 2016 18:16:22 +0530 Subject: [PATCH 37/46] bug fixing and modified project status with constants --- app/controllers/wkattendance_controller.rb | 2 +- assets/javascripts/settings.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index 7ae630540..bf23882d1 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -135,7 +135,7 @@ def getPrjIssues project_id = params[:project_id] project = Project.find(project_id) end - if (!project.blank? && project.status == 5 && !params[:issue_id].blank?) + if (!project.blank? && (project.status == "#{Project::STATUS_CLOSED}" || project.status == "#{Project::STATUS_ARCHIVED}") && !params[:issue_id].blank?) issueList = Issue.where(:id => params[:issue_id], :project_id => project_id) else issueList = Issue.where(:project_id => project_id) diff --git a/assets/javascripts/settings.js b/assets/javascripts/settings.js index 1047e15c9..6d8a783e6 100644 --- a/assets/javascripts/settings.js +++ b/assets/javascripts/settings.js @@ -260,14 +260,16 @@ function updateCustFldDD(currCFDD,anotherCFDD) var shortName = document.getElementById("wk_leave_short_name"); if('Add' == action) { - leaveAction = action; - leaveProject.options.length = 0; //clear the existing values + leaveAction = action; var templateDD = document.getElementById('template_projDD'); - var ddlength = templateDD.options.length; - //Refill the dropdown - for(i=0; i < ddlength; i++) - { - leaveProject.options[i] = new Option(templateDD.options[i].text,templateDD.options[i].value); + if(templateDD) { + leaveProject.options.length = 0; //clear the existing values + var ddlength = templateDD.options.length; + //Refill the dropdown + for(i=0; i < ddlength; i++) + { + leaveProject.options[i] = new Option(templateDD.options[i].text,templateDD.options[i].value); + } } leaveProject.selectedIndex = 0; projectChanged(leaveProject,-1); From 815c1c2f8736d111965935e7386b4b088ff1eab9 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Thu, 24 Mar 2016 18:54:59 +0530 Subject: [PATCH 38/46] Report alignment changes --- app/views/wkreport/reportattn.html.erb | 41 ++++++++++++++------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/app/views/wkreport/reportattn.html.erb b/app/views/wkreport/reportattn.html.erb index d9d616748..67c308df9 100644 --- a/app/views/wkreport/reportattn.html.erb +++ b/app/views/wkreport/reportattn.html.erb @@ -28,9 +28,12 @@
- - - - + + + + @@ -90,19 +93,19 @@ <%else%> <%end%> - - - - - - - - - - - - - + + + + + + + + + + + + + <% for i in 1..31 hour = @attendance_entries[entry.id.to_s + '_' + i.to_s + '_hours'] leave = @attendance_entries[entry.id.to_s + '_' + i.to_s + '_leave'] From 0d9945d2559da326ca2eb398d429deb8393a6f43 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 10:50:29 +0530 Subject: [PATCH 39/46] Alignment changes --- app/views/wkreport/reportattn.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/wkreport/reportattn.html.erb b/app/views/wkreport/reportattn.html.erb index 67c308df9..915b6d63f 100644 --- a/app/views/wkreport/reportattn.html.erb +++ b/app/views/wkreport/reportattn.html.erb @@ -43,9 +43,9 @@ - - - + + + From 8cdb72c026957849b54ecb367ea7a5880a064540 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 13:27:38 +0530 Subject: [PATCH 40/46] bug fix --- app/controllers/wkattendance_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb index bf23882d1..b907373b9 100644 --- a/app/controllers/wkattendance_controller.rb +++ b/app/controllers/wkattendance_controller.rb @@ -135,7 +135,7 @@ def getPrjIssues project_id = params[:project_id] project = Project.find(project_id) end - if (!project.blank? && (project.status == "#{Project::STATUS_CLOSED}" || project.status == "#{Project::STATUS_ARCHIVED}") && !params[:issue_id].blank?) + if ((!project.blank? && (project.status == Project::STATUS_CLOSED || project.status == Project::STATUS_ARCHIVED)) && !params[:issue_id].blank?) issueList = Issue.where(:id => params[:issue_id], :project_id => project_id) else issueList = Issue.where(:project_id => project_id) From b88444fbbea7c3da0a6cf526fd52fd9603cb7cc4 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 17:35:38 +0530 Subject: [PATCH 41/46] Added SI No column at the end in report --- app/views/wkreport/reportattn.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/wkreport/reportattn.html.erb b/app/views/wkreport/reportattn.html.erb index 915b6d63f..a94566bd1 100644 --- a/app/views/wkreport/reportattn.html.erb +++ b/app/views/wkreport/reportattn.html.erb @@ -46,7 +46,7 @@ - + @@ -54,6 +54,7 @@ + @@ -116,6 +117,11 @@ +<%if showSlno %> + +<%else%> + +<%end%> <% end -%> <% end -%> From 999e0db67d734264719b14e2af00532b042ddba9 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 18:26:56 +0530 Subject: [PATCH 42/46] Updated Readme.doc for v2.1.2 --- README.rdoc | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/README.rdoc b/README.rdoc index 91dc3a264..8a3598e1f 100644 --- a/README.rdoc +++ b/README.rdoc @@ -3,10 +3,9 @@ This Plugin provides the capability to submit Time, Expense and Attendance withi member of a project with permission to log time. If the user has 'Edit time logs' permission, then he can manage other team member's Time & Expense as well. -This plugin uses the existing Time Entry model for Time sheets and has its own model called -Wk Expense Entry for Expense Sheets. New Time & Expense sheets can be entered using the link -‘New sheet’, new issues can be added to the Sheets using the ‘Add Row’ link. Users without -Edit permissions cannot edit/delete time & expense entries. +This plugin uses the existing Time Entry model for Time sheets and has its own Wk Expense Entry model +for Expense Sheets and Wk Attendance model for attendances. New Time & Expense sheets can be entered using the link ‘New sheet’, +new issues can be added to the Sheets using the ‘Add Row’ link. Users without Edit permissions cannot edit/delete time & expense entries. The time & expense sheets can be exported into pdf and csv format. The following configurations can be made on the plugin @@ -33,7 +32,7 @@ The following configurations can be made on the plugin - T&E Admin groups can be configured - Enable Clock In / Clock Out - Break time and Leaves can be configured - - Join date, Date of birth, Designation, Employee Id can be configured + - Join date, Date of birth, Designation, Employee Id, Termination date can be configured The Time & Expense sheets can be approved/rejected by supervisors after it is submitted by Project Members. Here is the workflow of Approval system.. @@ -78,19 +77,13 @@ If an apache passenger module is used then make sure the following settings are b) RailsAppSpawnerIdleTime 0 c) PassengerPreStart http://rails-app-url/ -Release Notes for 2.1 - The plugin name is renamed to Time & Attendance. - +Release Notes for 2.1.2 Features: - - Made compatible with Redmine 3.2.0. - - Attendance module is introduced. - - German translation is included. + - Made compatible with Redmine 3.2.1. + - User filter introduced in Attendance tab. + - Group filter introduced in Reports tab. Bugs: - - Fixed SQL Server issue. - - Fixed time entering format issue. - - Fixed issue forbidden error on "Enter issue as ID/Subject". - -We would like to thank Luna Lenardi for contributing towards German Translation and for fixing a currency issue. + - Fixed decimals are not taken into account when registering expenses bug(#50 in github) Customization: For any Customization/Support, please contact us, our consulting team will be happy to help you From 728d190b1c6c937ef99951659e1b2781b95e8346 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 19:05:08 +0530 Subject: [PATCH 43/46] updated readme.doc --- README.rdoc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index 8a3598e1f..80b7427a7 100644 --- a/README.rdoc +++ b/README.rdoc @@ -78,12 +78,16 @@ If an apache passenger module is used then make sure the following settings are c) PassengerPreStart http://rails-app-url/ Release Notes for 2.1.2 + Features: + - Made compatible with Redmine 3.2.1. - - User filter introduced in Attendance tab. + - User filter introduced in Attendance tab. + - Previous and Next link added in attendance detail page. - Group filter introduced in Reports tab. Bugs: - - Fixed decimals are not taken into account when registering expenses bug(#50 in github) + + - Fixed decimals are not taken into account when registering expenses bug. Customization: For any Customization/Support, please contact us, our consulting team will be happy to help you From 21d4015aada83c359ee406690251c16d7444c13a Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 19:09:21 +0530 Subject: [PATCH 44/46] formatted readme --- README.rdoc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.rdoc b/README.rdoc index 80b7427a7..a18ea1f30 100644 --- a/README.rdoc +++ b/README.rdoc @@ -78,16 +78,13 @@ If an apache passenger module is used then make sure the following settings are c) PassengerPreStart http://rails-app-url/ Release Notes for 2.1.2 - Features: - - - Made compatible with Redmine 3.2.1. + - Made compatible with Redmine 3.2.1. - User filter introduced in Attendance tab. - - Previous and Next link added in attendance detail page. + - Previous and Next link added in attendance detail page. - Group filter introduced in Reports tab. - Bugs: - - - Fixed decimals are not taken into account when registering expenses bug. + Bugs: + - Fixed decimals are not taken into account when registering expenses bug. Customization: For any Customization/Support, please contact us, our consulting team will be happy to help you From f18ec2655da775ce701576dcd0a29505f5c68c80 Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 19:11:45 +0530 Subject: [PATCH 45/46] Updated readme.doc --- README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index a18ea1f30..bb0e77756 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,4 +1,4 @@ -= wktime += Time & Attendance This Plugin provides the capability to submit Time, Expense and Attendance within redmine. The user must be a member of a project with permission to log time. If the user has 'Edit time logs' permission, then he can manage other team member's Time & Expense as well. From 46ad2cc2469f47b1bde40e550c30fc9d2e8bf56c Mon Sep 17 00:00:00 2001 From: suganya-thulasiraman Date: Mon, 28 Mar 2016 19:21:52 +0530 Subject: [PATCH 46/46] updated readme.doc --- README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index bb0e77756..0705912f8 100644 --- a/README.rdoc +++ b/README.rdoc @@ -84,7 +84,7 @@ Release Notes for 2.1.2 - Previous and Next link added in attendance detail page. - Group filter introduced in Reports tab. Bugs: - - Fixed decimals are not taken into account when registering expenses bug. + - Fixed decimals not taken into account when registering expenses. Customization: For any Customization/Support, please contact us, our consulting team will be happy to help you
<%= l(:label_wk_form_q) %>
<%= l(:label_wk_register_for_shops) %>

<%= l(:label_wk_name_address) %>: <%= Setting.app_title %> @@ -36,18 +39,18 @@ <%= l(:label_year) %>: <%= @from.strftime("%Y")%>
<%= l(:label_attn_sl_no) %><%= l(:field_user) %><%= l(:label_date_of_entry_into_service) %><%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %><%= l(:label_wk_designation) %><%= l(:label_leave_beginning_of_mnth) %><%= l(:label_leave_during_mnth) %><%= l(:label_wk_leave)+" "+l(:wk_field_balance) %><%= l(:label_daily_workdone_inclede_ot) %><%= l(:label_total_hours_ot) %><%= l(:label_total_hours_during_mnth) %><%= l(:label_total_no_of_maternity_leave) %><%= l(:label_attn_sl_no) %><%= l(:field_user) %><%= l(:label_date_of_entry_into_service) %><%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %><%= l(:label_wk_designation) %><%= l(:label_leave_beginning_of_mnth) %><%= l(:label_leave_during_mnth) %><%= l(:label_wk_leave)+" "+l(:wk_field_balance) %><%= l(:label_daily_workdone_inclede_ot) %><%= l(:label_total_hours_ot) %><%= l(:label_total_hours_during_mnth) %><%= l(:label_total_no_of_maternity_leave) %>
<%= shortName[headIssueId[0].to_i] %><%=h entry.employee_id %><%=h entry.firstname + " " + entry.lastname %><%=h entry.joining_date %><%=h entry.date_of_birth %><%=h entry.joining_date.blank? ? '' : format_date(entry.joining_date.to_date) %><%=h entry.date_of_birth.blank? ? '' : format_date(entry.date_of_birth.to_date) %> <%=h entry.designation %> <%=h balance1 %> <%=h balance2 %><%=h attn_entry %>
<%= l(:label_wk_form_q) %>
<%= l(:label_wk_register_for_shops) %>

@@ -40,10 +43,10 @@
<%= l(:label_attn_sl_no) %><%= l(:field_user) %><%= l(:label_date_of_entry_into_service) %><%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %><%= l(:label_wk_designation) %><%= l(:field_user) %><%= l(:label_date_of_entry_into_service) %><%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %><%= l(:label_wk_designation) %> <%= l(:label_leave_beginning_of_mnth) %> <%= l(:label_leave_during_mnth) %> <%= l(:label_wk_leave)+" "+l(:wk_field_balance) %><%=h entry.employee_id %><%=h entry.firstname + " " + entry.lastname %><%=h entry.joining_date.blank? ? '' : format_date(entry.joining_date.to_date) %><%=h entry.date_of_birth.blank? ? '' : format_date(entry.date_of_birth.to_date) %><%=h entry.designation %><%=h balance1 %><%=h balance2 %><%=h balance3 %><%=h used1 %><%=h used2 %><%=h used3 %><%=h (accrual1.blank? && used1.blank? ? '' : (balance1.blank? ? 0 : balance1) + (accrual1.blank? ? 0 : accrual1) - (used1.blank? ? 0 : used1)) %><%=h (accrual2.blank? && used2.blank? ? '' : (balance2.blank? ? 0 : balance2) + (accrual2.blank? ? 0 : accrual2) - (used2.blank? ? 0 : used2)) %><%=h (accrual3.blank? && used3.blank? ? '' : (balance3.blank? ? 0 : balance3) + (accrual3.blank? ? 0 : accrual3) - (used3.blank? ? 0 : used3)) %><%=h entry.firstname + " " + entry.lastname %><%=h entry.joining_date.blank? ? '' : format_date(entry.joining_date.to_date) %><%=h entry.date_of_birth.blank? ? '' : format_date(entry.date_of_birth.to_date) %><%=h entry.designation %><%=h balance1 %><%=h balance2 %><%=h balance3 %><%=h used1 %><%=h used2 %><%=h used3 %><%=h (accrual1.blank? && used1.blank? ? '' : (balance1.blank? ? 0 : balance1) + (accrual1.blank? ? 0 : accrual1) - (used1.blank? ? 0 : used1)) %><%=h (accrual2.blank? && used2.blank? ? '' : (balance2.blank? ? 0 : balance2) + (accrual2.blank? ? 0 : accrual2) - (used2.blank? ? 0 : used2)) %><%=h (accrual3.blank? && used3.blank? ? '' : (balance3.blank? ? 0 : balance3) + (accrual3.blank? ? 0 : accrual3) - (used3.blank? ? 0 : used3)) %>
<%= l(:label_attn_sl_no) %><%= l(:field_user) %><%= l(:label_date_of_entry_into_service) %><%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %><%= l(:field_user) %><%= l(:label_date_of_entry_into_service) %><%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %> <%= l(:label_wk_designation) %> <%= l(:label_leave_beginning_of_mnth) %> <%= l(:label_leave_during_mnth) %><%= l(:field_user) %> <%= l(:label_date_of_entry_into_service) %> <%= l(:label_age)+ " / " +l(:label_wk_attn_user_dob) %><%= l(:label_wk_designation) %><%= l(:label_wk_designation) %> <%= l(:label_leave_beginning_of_mnth) %> <%= l(:label_leave_during_mnth) %> <%= l(:label_wk_leave)+" "+l(:wk_field_balance) %><%= l(:label_total_hours_ot) %> <%= l(:label_total_hours_during_mnth) %> <%= l(:label_total_no_of_maternity_leave) %><%= l(:label_attn_sl_no) %>
<%= shortName[headIssueId[0].to_i] %><%=h "" %> <%=h "" %> <%=h "" %><%=h index+1 %><%=h entry.employee_id %>