Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-timesheet2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-timesheet2
Commits
80b81907
Commit
80b81907
authored
Nov 28, 2023
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on Attendance integration
parent
71063350
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
13 deletions
+60
-13
index.tcl
www/hours/index.tcl
+60
-13
No files found.
www/hours/index.tcl
View file @
80b81907
...
@@ -55,6 +55,10 @@ set add_hours_all_p [im_permission $current_user_id "add_hours_all"]
...
@@ -55,6 +55,10 @@ set add_hours_all_p [im_permission $current_user_id "add_hours_all"]
set add_hours_direct_reports_p
[
im_permission
$current
_user_id
"add_hours_direct_reports"
]
set add_hours_direct_reports_p
[
im_permission
$current
_user_id
"add_hours_direct_reports"
]
set base_url_confirm_wf "
/intranet-timesheet2-workflow/conf-objects/new-timesheet-workflow
"
set base_url_confirm_wf "
/intranet-timesheet2-workflow/conf-objects/new-timesheet-workflow
"
set work_l10n
[
lang::message::lookup
""
intranet-attendance-management.Work
"Work"
]
set break_l10n
[
lang::message::lookup
""
intranet-attendance-management.Break
"Break"
]
set hour_l10n
[
lang::message::lookup
""
intranet-core.Hour_abbrev
"h"
]
switch
$user
_id_from_search {
switch
$user
_id_from_search {
"" - all - mine - direct_reports - employees - customers - providers {
"" - all - mine - direct_reports - employees - customers - providers {
set user_id_from_search
$current
_user_id
set user_id_from_search
$current
_user_id
...
@@ -187,6 +191,8 @@ if {$attendance_management_installed_p} {
...
@@ -187,6 +191,8 @@ if {$attendance_management_installed_p} {
# Sum up all attendances for all days of that month
# Sum up all attendances for all days of that month
# and store into att_work_hash and att_break_hash
# and store into att_work_hash and att_break_hash
set attendance_work 0.0
set attendance_break 0.0
db_foreach attendances
$attendance
_sql {
db_foreach attendances
$attendance
_sql {
set att_type
[
string
tolower
$type
]
set att_type
[
string
tolower
$type
]
switch
$attendance
_type_id {
switch
$attendance
_type_id {
...
@@ -196,6 +202,7 @@ if {$attendance_management_installed_p} {
...
@@ -196,6 +202,7 @@ if {$attendance_management_installed_p} {
if {
[
info
exists att_work_hash
(
$attendance
_start_julian
)]
} { set v
$att
_work_hash(
$attendance
_start_julian) }
if {
[
info
exists att_work_hash
(
$attendance
_start_julian
)]
} { set v
$att
_work_hash(
$attendance
_start_julian) }
set v
[
expr
$v
+
$duration
_hours
]
set v
[
expr
$v
+
$duration
_hours
]
set att_work_hash(
$attendance
_start_julian)
$v
set att_work_hash(
$attendance
_start_julian)
$v
set attendance_work
[
expr
$attendance
_work +
$duration
_hours
;]
}
}
92110 {
92110 {
# Break
# Break
...
@@ -203,6 +210,7 @@ if {$attendance_management_installed_p} {
...
@@ -203,6 +210,7 @@ if {$attendance_management_installed_p} {
if {
[
info
exists att_break_hash
(
$attendance
_start_julian
)]
} { set v
$att
_break_hash(
$attendance
_start_julian) }
if {
[
info
exists att_break_hash
(
$attendance
_start_julian
)]
} { set v
$att
_break_hash(
$attendance
_start_julian) }
set v
[
expr
$v
+
$duration
_hours
]
set v
[
expr
$v
+
$duration
_hours
]
set att_break_hash(
$attendance
_start_julian)
$v
set att_break_hash(
$attendance
_start_julian)
$v
set attendance_break
[
expr
$attendance
_break +
$duration
_hours
;]
}
}
}
}
}
}
...
@@ -408,19 +416,25 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
...
@@ -408,19 +416,25 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
"
"
}
}
# Monthly hour approval request
if {
$current
_date_ansi ==
$last
_day_of_month_ansi && ("
monthly
" in
$confirmation
_period) } {
set start_date_month_julian
[
dt_ansi_to_julian_single_arg
$first
_day_of_month_ansi
]
set end_date_month_julian
[
dt_ansi_to_julian_single_arg
$last
_day_of_month_ansi
]
set conf_url
[
export_vars -base
$base
_url_confirm_wf
{
{
user_id
$user
_id_from_search
}
{
start_date_julian
$start
_date_month_julian
}
{
end_date_julian
$end
_date_month_julian
}
return_url
}
]
set button_txt
[
lang::message::lookup
""
intranet-timesheet2.Confirm_monthly_hours
"Confirm hours for this month"
]
append html "
<p> 
;
</p><a href='$conf_url' class=button>$button_txt</a>
"
}
# Attendance Management
# Attendance Management
if {
$attendance
_management_installed_p} {
if {
$attendance
_management_installed_p} {
set work ""
# Get the URL and the ID of the portlet in order to show a direct link
if {
[
catch
{
db_1row portlet_props
"
select plugin_id, page_url
from im_component_plugins
where plugin_name = 'Attendance Management' and
package_name = 'intranet-attendance-management'
"
}
err_msg
]
} {
ad_return_complaint 1 "
<b>Error locating the attendance portlet</b>:
There is no portlet named 'Attendance Management' of package 'intranet-attendance-management'.<br>
"
}
set work_url
[
export_vars -base
$page
_url
{{
view_name
"component"
}
plugin_id
{
julian
$current
_date
}}]
# Calculate the actual work/break time
set work 0
if {
[
info
exists att_work_hash
(
$current
_date
)]
} {
if {
[
info
exists att_work_hash
(
$current
_date
)]
} {
set work
[
expr
round
(
10.0 *
$att
_work_hash
(
$current
_date
))
/ 10.0
]
set work
[
expr
round
(
10.0 *
$att
_work_hash
(
$current
_date
))
/ 10.0
]
}
}
...
@@ -429,14 +443,47 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
...
@@ -429,14 +443,47 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
set break
[
expr
round
(
10.0 *
$att
_break_hash
(
$current
_date
))
/ 10.0
]
set break
[
expr
round
(
10.0 *
$att
_break_hash
(
$current
_date
))
/ 10.0
]
}
}
# Calculate color coding
set attendance_required
[
im_attendance_daily_attendance_hours -user_id
$current
_user_id
]
set color_html ""
if {
$work
<
$attendance
_required} { set color_html "
<font color=red>
" }
set color_html_end ""
if {"" ne
$color
_html} { set color_html_end "
</font>
" }
# Write out lines for work and break
set line_items
[
list
]
set line_items
[
list
]
if {"" ne
$work
} { lappend line_items "
Work:
${work}
h
" }
if {"" ne
$work
} {
if {"" ne
$break
} { lappend line_items "
Break:
${break}
h
" }
lappend line_items "
<a href=$work_url target=_>$color_html
$work
_l10n:
${work}${hour_l10n}$color
_html_end</a>
"
}
if {"" ne
$break
} {
lappend line_items "
$break
_l10n:
${break}${hour_l10n}
"
}
if {
[
llength
$line
_items
]
> 0} {
if {
[
llength
$line
_items
]
> 0} {
append html "
<br>
[
join
$line
_items
", "
]
"
append html "
<br>
[
join
$line
_items
",
<br>
"
]
"
}
}
# Count workdays
# Comparison at the end of the month
if {
$current
_date_ansi ==
$last
_day_of_month_ansi} {
append html "
<br>Attend. month:
[
expr
round
(
10.0 *
$attendance
_work
)
/ 10.0
]
${hour_l10n}
"
}
}
}
# Monthly hour approval request
if {
$current
_date_ansi ==
$last
_day_of_month_ansi && ("
monthly
" in
$confirmation
_period) } {
set start_date_month_julian
[
dt_ansi_to_julian_single_arg
$first
_day_of_month_ansi
]
set end_date_month_julian
[
dt_ansi_to_julian_single_arg
$last
_day_of_month_ansi
]
set conf_url
[
export_vars -base
$base
_url_confirm_wf
{
{
user_id
$user
_id_from_search
}
{
start_date_julian
$start
_date_month_julian
}
{
end_date_julian
$end
_date_month_julian
}
return_url
}
]
set button_txt
[
lang::message::lookup
""
intranet-timesheet2.Confirm_monthly_hours
"Confirm hours for this month"
]
append html "
<p> 
;
</p><a href='$conf_url' class=button>$button_txt</a>
"
}
ns_set put
$calendar
_details
$current
_date "
$html
<br> 
;
"
ns_set put
$calendar
_details
$current
_date "
$html
<br> 
;
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment