Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-resource-management
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
0
Merge Requests
0
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-resource-management
Commits
edfff500
Commit
edfff500
authored
Sep 04, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Absences half working
parent
ea96d455
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
20 deletions
+47
-20
intranet-resource-management-procs-percentage.tcl
tcl/intranet-resource-management-procs-percentage.tcl
+46
-19
resources-planning.tcl
www/resources-planning.tcl
+1
-1
No files found.
tcl/intranet-resource-management-procs-percentage.tcl
View file @
edfff500
...
...
@@ -35,7 +35,7 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
{
-excluded_group_ids
""
}
{
-return_url
""
}
{
-page_url:required
}
{
-absences_included_in_project_planning_p
""
}
{
-absences_included_in_project_planning_p
"
1
"
}
{
-debug_p 1
}
}
{
Creates Resource Report
...
...
@@ -46,6 +46,8 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
@param customer_id Id of customer's projects to show
}
{
set debug_p 1
# ---------------------------------------
# Defaults
#
...
...
@@ -176,17 +178,23 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
foreach gif
{
minus_9 plus_9 magnifier_zoom_in magnifier_zoom_out
}
{
set gif_hash
(
$gif
)
[
im_gif
$gif
]
}
set clicks
([
clock
clicks -microseconds
])
gifs
# ------------------------------------------------------------
ns_log Notice
"percentage-report: Store information about each day into hashes for speed"
#
for
{
set
i
$report
_start_julian
}
{
$i
<=
$report
_end_julian
}
{
incr
i
}
{
array unset date_comps
array set date_comps
[
im_date_julian_to_components
$i
]
# Calculate the date components and store in a hash
set date_components
[
util_memoize
[
list
im_date_julian_to_components
$i
]
100000
]
set date_components_hash
(
$i
)
$date
_components
array unset date_comps_hash
array set date_comps_hash
$date
_components
# Day of Week
set dow
$date
_comps
(
day_of_week
)
set dow
$date
_comps
_hash
(
day_of_week
)
set day_of_week_hash
(
$i
)
$dow
# Weekend
...
...
@@ -588,7 +596,7 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# Calculate the date component of the key, depending on top_vars
array unset date_hash
array set date_hash
[
im_date_julian_to_components
$j
]
array set date_hash
$date
_components_hash(
$j
)
set key_list
[
list
]
foreach top_var
$top
_vars {
set date_val
$date
_hash(
$top
_var)
...
...
@@ -615,19 +623,28 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# ------------------------------------------------------------
ns_log Notice "
percentage-report: Add absences to the aggregate
"
# ad_return_complaint 1 "
<pre>absences_hash=
[
array
get absences_hash
]
</pre>
"
#
if {
0 &&
"
1
" eq
$absences
_included_in_project_planning_p} {
foreach key
[
array
names absences_hash
]
{
set tuple
[
split
$key
"-"
]
if {"
1
" eq
$absences
_included_in_project_planning_p} {
foreach
absence_
key
[
array
names absences_hash
]
{
set tuple
[
split
$
absence
_
key
"-"
]
set j
[
lindex
$tuple
0
]
set user_id
[
lindex
$tuple
1
]
# Check that the user is assigned to a project. Otherwise it doesn't make sense here
if {!
[
info
exists left_dimension_hash
(
$user
_id
)]
} { continue }
set parent_list
$left
_dimension_hash(
$user
_id)
# Skip weekends
if {
[
info
exists weekend_hash
(
$j
)]
} { continue }
# Calculate the date component of the key, depending on top_vars
array unset date_hash
array set date_hash
$date
_components_hash(
$j
)
set key_list
[
list
]
foreach top_var
$top
_vars {
set date_val
$date
_hash(
$top
_var)
lappend key_list
$date
_val
}
# Logic depending on absence types
set absence_type_id
$absences
_hash(
$key
)
set absence_type_id
$absences
_hash(
$
absence
_
key)
switch
$absence
_type_id {
5005 {
continue ; # Exclude bank holidays
...
...
@@ -638,12 +655,14 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
set percentage 100
set availability
$object
_availability_hash(
$user
_id)
set assigavail
[
expr
$percentage
*
$availability
/ 100.0
]
# Get the list of objects from the left-hand side for the user
set parent_list
$left
_dimension_hash(
$user
_id)
foreach oid
$parent
_list {
set v 0
set key "
$j
-$oid
"
set key "
[
join
$key
_list
"-"
]
-$oid
"
if {
[
info
exists assignment_hash
(
$key
)]
} { set v
$assignment
_hash(
$key
) }
set assignment_hash(
$key
)
[
expr
$v
+
$assigavail
]
set assignment_hash(
$key
)
[
expr
$v
+
$assigavail
]
; # aggregate up the hierarchy
}
}
}
...
...
@@ -662,7 +681,7 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
set last_top_entry {}
for {set i
[
dt_ansi_to_julian_single_arg
$report
_start_date
]
} {
$i
<
[
dt_ansi_to_julian_single_arg
$report
_end_date
]
} {incr i} {
array unset date_hash
array set date_hash
[
im_date_julian_to_components
$i
]
array set date_hash
$date
_components_hash(
$i
)
# Each entry in the top_scale is a list of date parts defined by top_vars
set top_entry
[
list
]
...
...
@@ -932,6 +951,7 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
ns_log Notice "
percentage-report: Profiling HTML
"
#
set profiling_html ""
set first_click 0
if {
$debug
_p} {
set profiling_html "
<br> 
;
<br><table>
\n
"
set last_click 0
...
...
@@ -940,10 +960,17 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
set last_click
$click
set first_click
$click
}
append profiling_html "
<tr><td>$click</td><td>$clicks
(
$click
)
</td><td align=right>
[
expr
(
$click
-
$last
_click
)
/ 1000.0
]
</td></tr>
\n
"
append profiling_html "
<tr>
<td>$click</td>
<td>$clicks
(
$click
)
</td>
<td align=right>
[
expr
round
(
10.0 *
(
$click
-
$first
_click
)
/ 1000.0
)
/ 10.0
]
</td>
<td align=right>
[
expr
round
(
10.0 *
(
$click
-
$last
_click
)
/ 1000.0
)
/ 10.0
]
</td>
</tr>
"
set last_click
$click
}
append profiling_html "
<tr><td> </td><td><b>Total</b></td><td align=right>
[
expr
(
$last
_click -
$first
_click
)
/ 100
0.0
]
</td></tr>
\n
"
append profiling_html "
<tr><td> </td><td><b>Total</b></td><td align=right>
[
expr
round
(
10.0 *
(
$last
_click -
$first
_click
)
/ 1000.0
)
/ 1
0.0
]
</td></tr>
\n
"
append profiling_html "
<tr><td colspan=3> 
;
</tr>
\n
"
append profiling_html "
</table>
\n
"
}
...
...
www/resources-planning.tcl
View file @
edfff500
...
...
@@ -200,7 +200,7 @@ append filter_html "
"
}
if
{
1
}
{
if
{
0
}
{
set no_checked
""
if
{
"0"
eq
$absences
_included_in_project_planning_p
}
{
set no_checked
"checked"
}
set help_msg
[
lang::message::lookup
""
intranet-resource-management.Count_Absences_Help
"
...
...
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