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
c9878a02
Commit
c9878a02
authored
Nov 21, 2023
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added basic display of attendance management information
parent
f253df40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
4 deletions
+64
-4
index.tcl
www/hours/index.tcl
+64
-4
No files found.
www/hours/index.tcl
View file @
c9878a02
...
...
@@ -98,8 +98,7 @@ set fill_up_first_last_row_p [parameter::get -package_id [apm_package_id_from_ke
set start_day
[
parameter::get -package_id
[
apm_package_id_from_key intranet-timesheet2
]
-parameter
"WeekStartDay"
-default 0
]
set show_link_log_hours_for_week_p
[
parameter::get -package_id
[
apm_package_id_from_key intranet-timesheet2
]
-parameter
"ShowLinkToWeeklyTimesheetP"
-default 0
]
set hours_base_url
[
parameter::get -package_id
[
apm_package_id_from_key intranet-timesheet2
]
-parameter
"HourURL"
-default
"/intranet-timesheet2/hours"
]
set attendance_management_installed_p
[
im_table_exists im_attendance_intervals
]
set header_days_of_week "";
...
...
@@ -167,6 +166,52 @@ if { "" != [parameter::get -package_id [apm_package_id_from_key intranet-timeshe
if {!
[
im_column_exists im_hours conf_object_id
]
} { set confirm_timesheet_hours_p 0 }
# ---------------------------------------------------------------
# Attendance Management
# ---------------------------------------------------------------
if {
$attendance
_management_installed_p} {
set attendance_sql "
select ai.*,
to_char
(
ai.attendance_start, 'J'
)
as attendance_start_julian,
im_category_from_id
(
ai.attendance_type_id
)
as type,
round
((
extract
(
epoch from attendance_end - attendance_start
)
/ 3600
)
::numeric, 2
)
as duration_hours
from im_attendance_intervals ai
where ai.attendance_start::date >= :first_day_of_month_ansi::date and
ai.attendance_id is not null and -- discard elements in process
ai.attendance_end::date <= :last_day_of_month_ansi::date
"
# Sum up all attendances for all days of that month
# and store into att_work_hash and att_break_hash
db_foreach attendances
$attendance
_sql {
set att_type
[
string
tolower
$type
]
switch
$attendance
_type_id {
92100 {
# Work Attendance
set v 0.0
if {
[
info
exists att_work_hash
(
$attendance
_start_julian
)]
} { set v
$att
_work_hash(
$attendance
_start_julian) }
set v
[
expr
$v
+
$duration
_hours
]
set att_work_hash(
$attendance
_start_julian)
$v
}
92110 {
# Break
set v 0.0
if {
[
info
exists att_break_hash
(
$attendance
_start_julian
)]
} { set v
$att
_break_hash(
$attendance
_start_julian) }
set v
[
expr
$v
+
$duration
_hours
]
set att_break_hash(
$attendance
_start_julian)
$v
}
}
}
}
# ---------------------------------------------------------------
# Render the Calendar widget
# ---------------------------------------------------------------
...
...
@@ -327,8 +372,6 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
set html "
${hours}${curr_absence}$log
_hours_for_the_week_html
"
}
# ds_comment "
$column
_ctr, current_date_ansi:
$current
_date_ansi, last_day_of_month_ansi:
$last
_day_of_month_ansi, show_last_confirm_button_p:
$show
_last_confirm_button_p
"
# Weekly total
if {(
$column
_ctr == 7 || 0 &&
$current
_date_ansi ==
$last
_day_of_month_ansi) &&
$show
_last_confirm_button_p } {
append html "
<br>
...
...
@@ -377,6 +420,23 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
append html "
<p> 
;
</p><a href='$conf_url' class=button>$button_txt</a>
"
}
# Attendance Management
if {
$attendance
_management_installed_p} {
set work ""
if {
[
info
exists att_work_hash
(
$current
_date
)]
} { set work
$att
_work_hash(
$current
_date) }
set break ""
if {
[
info
exists att_break_hash
(
$current
_date
)]
} { set work
$att
_break_hash(
$current
_date) }
set line_items
[
list
]
if {"" ne
$work
} { lappend line_items "
Work:
${work}
h
" }
if {"" ne
$break
} { lappend line_items "
Break:
${break}
h
" }
if {
[
llength
$line
_items
]
> 0} {
append html "
<br>
[
join
$line
_items
", "
]
"
}
}
ns_set put
$calendar
_details
$current
_date "
$html
<br> 
;
"
# we keep track of the day of the week we are on
...
...
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