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
ea96d455
Commit
ea96d455
authored
Sep 04, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Aggregation now working for week and month
parent
fa4854ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
46 deletions
+83
-46
intranet-resource-management-procs-percentage.tcl
tcl/intranet-resource-management-procs-percentage.tcl
+70
-30
resources-planning.adp
www/resources-planning.adp
+1
-1
resources-planning.tcl
www/resources-planning.tcl
+12
-15
No files found.
tcl/intranet-resource-management-procs-percentage.tcl
View file @
ea96d455
...
@@ -297,8 +297,8 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -297,8 +297,8 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
child.project_name,
child.project_name,
child.parent_id,
child.parent_id,
(length(child.tree_sortkey) / 8) - 3 as level,
(length(child.tree_sortkey) / 8) - 3 as level,
to_char(child.start_date, 'J') as
child_start_julian,
greatest(to_char(child.start_date::date, 'J')::integer, :report_start_julian::integer)
child_start_julian,
to_char(child.end_date, 'J'
) as child_end_julian
least(to_char(child.end_date, 'J')::integer, :report_end_julian::integer
) as child_end_julian
from im_projects parent,
from im_projects parent,
im_projects child
im_projects child
where parent.project_id in (
[
join
$main
_project_list
","
]
)
where parent.project_id in (
[
join
$main
_project_list
","
]
)
...
@@ -566,6 +566,7 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -566,6 +566,7 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# ------------------------------------------------------------
# ------------------------------------------------------------
ns_log Notice "
percentage-report: Aggregate percentage assignments up the project hierarchy
"
ns_log Notice "
percentage-report: Aggregate percentage assignments up the project hierarchy
"
#
#
# ad_return_complaint 1 "
<pre>
[
join
[
array
get project_user_assignment_hash
]
"
\n
"
]
</pre>
"
foreach key
[
array
names project_user_assignment_hash
]
{
foreach key
[
array
names project_user_assignment_hash
]
{
set tuple
[
split
$key
"-"
]
set tuple
[
split
$key
"-"
]
set project_id
[
lindex
$tuple
0
]
set project_id
[
lindex
$tuple
0
]
...
@@ -581,22 +582,41 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -581,22 +582,41 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
foreach oid
$parent
_list {
foreach oid
$parent
_list {
for {set j
$start
_julian} {
$j
<=
$end
_julian} {incr j} {
for {set j
$start
_julian} {
$j
<=
$end
_julian} {incr j} {
# 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
[
im_date_julian_to_components
$j
]
set key_list
[
list
]
foreach top_var
$top
_vars {
set date_val
$date
_hash(
$top
_var)
lappend key_list
$date
_val
}
lappend key_list
$oid
# Append the object part of the cell to the key
set otype
$object
_type_hash(
$oid
)
set otype
$object
_type_hash(
$oid
)
switch
$otype
{
switch
$otype
{
im_project { set key "
$j-$oid-$user
_id
" }
im_project {
default { set key "
$j-$oid
" }
lappend key_list
$user
_id
}
}
}
set key
[
join
$key
_list
"-"
]
set v 0
set v 0
if {
[
info
exists assignment_hash
(
$key
)]
} { set v
$assignment
_hash(
$key
) }
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
]
}
}
}
}
}
}
# ad_return_complaint 1 "
<pre>
[
join
[
array
get assignment_hash
]
"
\n
"
]
</pre>
"
# ------------------------------------------------------------
# ------------------------------------------------------------
ns_log Notice "
percentage-report: Add absences to the aggregate
"
ns_log Notice "
percentage-report: Add absences to the aggregate
"
#
#
if {"
1
" eq
$absences
_included_in_project_planning_p} {
if {
0 &&
"
1
" eq
$absences
_included_in_project_planning_p} {
foreach key
[
array
names absences_hash
]
{
foreach key
[
array
names absences_hash
]
{
set tuple
[
split
$key
"-"
]
set tuple
[
split
$key
"-"
]
set j
[
lindex
$tuple
0
]
set j
[
lindex
$tuple
0
]
...
@@ -631,31 +651,40 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -631,31 +651,40 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# ad_return_complaint 1 "
<pre>
[
join
[
array
get assignment_hash
]
"
\n
"
]
</pre>
"
# ad_return_complaint 1 "
<pre>
[
join
[
array
get assignment_hash
]
"
\n
"
]
</pre>
"
set clicks(
[
clock
clicks -microseconds
]
) aggregate
set clicks(
[
clock
clicks -microseconds
]
) aggregate
# --------------------------------------------------
# --------------------------------------------------
ns_log Notice "
percentage-report: Top Scale
"
ns_log Notice "
percentage-report: Top Scale
"
#
#
# Top scale is a list of lists like {{2006 01} {2006 02} ...}
# Top scale is a list of lists like {{2006 01} {2006 02} ...}
set top_scale {}
set top_scale {}
set last_top_
dim
{}
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} {
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 unset date_hash
array set date_hash
[
im_date_julian_to_components
$i
]
array set date_hash
[
im_date_julian_to_components
$i
]
# Each entry in the top_scale is a list of date parts defined by top_vars
# Each entry in the top_scale is a list of date parts defined by top_vars
set top_
dim
[
list
$i
]
set top_
entry
[
list
]
foreach top_var
$top
_vars {
foreach top_var
$top
_vars {
set date_val ""
set date_val ""
catch { set date_val
$date
_hash(
$top
_var) }
catch { set date_val
$date
_hash(
$top
_var) }
lappend top_
dim
$date
_val
lappend top_
entry
$date
_val
}
}
# "
distinct clause
": Add the values of top_vars to the top scale, if it is different from the last one...
# "
distinct clause
": Add the values of top_vars to the top scale, if it is different from the last one...
# This is necessary for aggregated top scales like weeks and months.
# This is necessary for aggregated top scales like weeks and months.
if {
$top
_dim !=
$last
_top_dim} {
set key
[
join
$top
_entry
"-"
]
lappend top_scale
$top
_dim
if {
$top
_entry !=
$last
_top_entry} {
set last_top_dim
$top
_dim
lappend top_scale
$top
_entry
}
set last_top_entry
$top
_entry
set days_per_cell_hash(
$key
) 0
}
set days_per_cell
$days
_per_cell_hash(
$key
)
if {!
[
info
exists weekend_hash
(
$i
)]
} { incr days_per_cell }
set days_per_cell_hash(
$key
)
$days
_per_cell
}
}
# Determine how many date rows (year, month, day, ...) we've got
# Determine how many date rows (year, month, day, ...) we've got
...
@@ -668,6 +697,9 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -668,6 +697,9 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
set clicks(
[
clock
clicks -microseconds
]
) top_scale
set clicks(
[
clock
clicks -microseconds
]
) top_scale
# -------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------
ns_log Notice "
percentage-report: Write out matrix
"
ns_log Notice "
percentage-report: Write out matrix
"
#
#
...
@@ -756,17 +788,25 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -756,17 +788,25 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# ------------------------------------------------------------
# ------------------------------------------------------------
ns_log Notice "
percentage-report: Start writing out the matrix elements
"
ns_log Notice "
percentage-report: Start writing out the matrix elements
"
#
#
for {set j
$report
_start_julian} {
$j
<
$report
_end_julian} {incr j} {
foreach top_entry
$top
_scale {
set key_list
$top
_entry
set days_per_cell 1
set key
[
join
$top
_entry
"-"
]
if {
[
info
exists days_per_cell_hash
(
$key
)]
} { set days_per_cell
$days
_per_cell_hash(
$key
) }
if {0 eq
$days
_per_cell} { set days_per_cell 0.000001 }
# Check for Absences. Weekends are already included in the absences_hash(..)
set list_of_absences ""
set list_of_absences ""
set absence_key "
$j-$object
_id
"
set ttt {
if {
[
info
exists absences_hash
(
$absence
_key
)]
} {
# Check for Absences. Weekends are already included in the absences_hash(..)
set list_of_absences
$absences
_hash(
$absence
_key)
set absence_key "
$j-$object
_id
"
}
if {
[
info
exists absences_hash
(
$absence
_key
)]
} {
if {
[
info
exists weekend_hash
(
$j
)]
} {
set list_of_absences
$absences
_hash(
$absence
_key)
lappend list_of_absences
$weekend
_hash(
$j
)
}
if {
[
info
exists weekend_hash
(
$j
)]
} {
lappend list_of_absences
$weekend
_hash(
$j
)
}
}
}
set col_attrib ""
set col_attrib ""
...
@@ -777,10 +817,11 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -777,10 +817,11 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
}
}
# Format user or department cells - choose a font color according to overallocation
# Format user or department cells - choose a font color according to overallocation
set cell_html ""
set cell_html "
 
;
 
;
 
;
 
;
"
set key "
$j-$object
_id
"
set key "
[
join
$key
_list
"-"
]
-$object_id
"
# ad_return_complaint 1 "
<pre>$key<br>
[
array
names assignment_hash
]
</pre>
"
if {
[
info
exists assignment_hash
(
$key
)]
} {
if {
[
info
exists assignment_hash
(
$key
)]
} {
set assig
[
expr
round
(
$assignment
_hash
(
$key
))
]
set assig
[
expr
round
(
$assignment
_hash
(
$key
))
/
$days
_per_cell
]
set color "
black
"
set color "
black
"
if {
$availability
> 0} {
if {
$availability
> 0} {
set overassignment_ratio
[
expr
(
1.0 *
$assig
/
$availability
)
- 1.0
]
set overassignment_ratio
[
expr
(
1.0 *
$assig
/
$availability
)
- 1.0
]
...
@@ -793,11 +834,11 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -793,11 +834,11 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
}
}
# Normal project assignment - don't compare and don't change color
# Normal project assignment - don't compare and don't change color
set key "
$j
-$project
_id-$user_id
"
set key "
[
join
$key
_list
"-"
]
-$project_id-$user_id
"
if {
[
info
exists assignment_hash
(
$key
)]
} {
if {
[
info
exists assignment_hash
(
$key
)]
} {
set assig
[
expr
round
(
$assignment
_hash
(
$key
))]
set assig
[
expr
round
(
$assignment
_hash
(
$key
))
/
$days
_per_cell
]
if {"" ne
$assig
} { set assig "
$assig
%
" }
if {"" ne
$assig
} { set assig "
$assig
%
" }
append
cell_html
$assig
set
cell_html
$assig
}
}
switch
$object
_type {
switch
$object
_type {
...
@@ -829,11 +870,11 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -829,11 +870,11 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# Each date entry starts with the julian of the date, so we have to skip row=0
# Each date entry starts with the julian of the date, so we have to skip row=0
#
#
set header_html ""
set header_html ""
for {set row
1
} {
$row
<
$top
_scale_rows} { incr row } {
for {set row
0
} {
$row
<
$top
_scale_rows} { incr row } {
# Create the name of the date part in the very first (left) cell
# Create the name of the date part in the very first (left) cell
append header_html "
<tr class=rowtitle>
\n
"
append header_html "
<tr class=rowtitle>
\n
"
set top_var
[
lindex
$top
_vars
[
expr
$row-1
]
]
set top_var
[
lindex
$top
_vars
$row
]
set col_l10n
[
lang::message::lookup
""
"intranet-resource-management.Dim_
$top
_var"
$top
_var
]
set col_l10n
[
lang::message::lookup
""
"intranet-resource-management.Dim_
$top
_var"
$top
_var
]
if {0 ==
$row
} {
if {0 ==
$row
} {
set zoom_in "
<a href=
[
export_vars -base
$this
_url
{
top_vars
{
zoom
"in"
}}]
>$gif_hash
(
magnifier_zoom_in
)
</a>
\n
"
set zoom_in "
<a href=
[
export_vars -base
$this
_url
{
top_vars
{
zoom
"in"
}}]
>$gif_hash
(
magnifier_zoom_in
)
</a>
\n
"
...
@@ -844,7 +885,6 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
...
@@ -844,7 +885,6 @@ ad_proc -public im_resource_mgmt_resource_planning_percentage {
# Loop through the date dimension
# Loop through the date dimension
for {set col 0} {
$col
<=
[
expr
[
llength
$top
_scale
]
-1
]
} { incr col } {
for {set col 0} {
$col
<=
[
expr
[
llength
$top
_scale
]
-1
]
} { incr col } {
set scale_entry
[
lindex
$top
_scale
$col
]
set scale_entry
[
lindex
$top
_scale
$col
]
set scale_item
[
lindex
$scale
_entry
$row
]
set scale_item
[
lindex
$scale
_entry
$row
]
...
...
www/resources-planning.adp
View file @
ea96d455
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<property name="sub_navbar">@sub_navbar;literal@</property>
<property name="sub_navbar">@sub_navbar;literal@</property>
<property name="show_context_help">@show_context_help_p;literal@</property>
<property name="show_context_help">@show_context_help_p;literal@</property>
<property name="left_navbar">@left_navbar_html;literal@</property>
<property name="left_navbar">@left_navbar_html;literal@</property>
<property name="show_context_help">@show_context_help_p
;literal
@</property>
<property name="show_context_help">@show_context_help_p@</property>
<div style="clear:both;display:table;min-width:200px;width:50%">
<div style="clear:both;display:table;min-width:200px;width:50%">
@help_html;noquote@
@help_html;noquote@
...
...
www/resources-planning.tcl
View file @
ea96d455
...
@@ -38,7 +38,7 @@ ad_page_contract {
...
@@ -38,7 +38,7 @@ ad_page_contract {
# Defaults & Security
# Defaults & Security
# ---------------------------------------------------------------
# ---------------------------------------------------------------
im_permission_flush
#
im_permission_flush
set
current_user_id
[
auth::require_login
]
set
current_user_id
[
auth::require_login
]
if
{
!
[
im_permission
$current
_user_id
"view_projects_all"
]}
{
if
{
!
[
im_permission
$current
_user_id
"view_projects_all"
]}
{
...
@@ -53,7 +53,7 @@ set page_title [lang::message::lookup "" intranet-reporting.Gantt_Resources "Gan
...
@@ -53,7 +53,7 @@ set page_title [lang::message::lookup "" intranet-reporting.Gantt_Resources "Gan
set
page_url
"/intranet-resource-management/resources-planning"
set
page_url
"/intranet-resource-management/resources-planning"
set
sub_navbar
""
set
sub_navbar
""
set
main_navbar_label
"resource_management"
set
main_navbar_label
"resource_management"
set
show_context_help_p
0
set
show_context_help_p
1
set
return_url
[
im_url_with_query
]
set
return_url
[
im_url_with_query
]
regsub
-all
{
%20
}
$top
_vars
" "
top_vars
regsub
-all
{
%20
}
$top
_vars
" "
top_vars
...
@@ -114,7 +114,7 @@ if {"" == $html} {
...
@@ -114,7 +114,7 @@ if {"" == $html} {
set
filter_html
"
set
filter_html
"
<form method=get name=projects_filter action='
$page
_url'>
<form method=get name=projects_filter action='
$page
_url'>
[
export_vars -form
{
debug_p
}]
[
export_vars -form
{
debug_p
}]
<table border=0 cellpadding=0 cellspacing=1>
<table border=0 cellpadding=0 cellspacing=1>
"
"
...
@@ -127,10 +127,7 @@ if {0} {
...
@@ -127,10 +127,7 @@ if {0} {
"
"
}
}
if
{
$customer
_id eq
""
}
{
if
{
$customer
_id eq
""
}
{
set customer_id 0
}
set customer_id 0
}
if
{
0
}
{
if
{
0
}
{
append filter_html
"
append filter_html
"
<tr>
<tr>
...
@@ -141,18 +138,18 @@ if {0} {
...
@@ -141,18 +138,18 @@ if {0} {
}
}
if
{
0
}
{
if
{
1
}
{
# Not yet supported:
"year quarter_of_year"
,
"Quarter"
# Not yet supported:
"year quarter_of_year"
,
"Quarter"
set top_var_options
{
set top_var_options
[
list
\
"year
week_of_year day_of_week"
"Week and Day"
"year
month_of_year"
[
lang::message::lookup
""
intranet-resource-management.Year_and_Month
"Year and Month"
]
\
"year
month_of_year day_of_month"
"Month and Day"
"year
week_of_year"
[
lang::message::lookup
""
intranet-resource-management.Year_and_Week
"Year and Week"
]
\
"year week_of_year
"
"Week"
"year week_of_year
day_of_week"
[
lang::message::lookup
""
intranet-resource-management.Year_Week_and_Day
"Year, Week and Day"
]
\
}
"year month_of_year day_of_month"
[
lang::message::lookup
""
intranet-resource-management.Year_Month_and_Day
"Year, Month and Day"
]
\
# "year month_of_year" "Month"
]
append filter_html
"
append filter_html
"
<tr>
<tr>
<td class=form-label>
[
lang::message::lookup
""
intranet-
ganttproject.Top_Scale
"Top
Scale"
]
:</td>
<td class=form-label>
[
lang::message::lookup
""
intranet-
resource-management.Date_Scale
"Date
Scale"
]
:</td>
<td class=form-widget>
[
im_select top_vars
$top
_var_options
$top
_vars
]
</td>
<td class=form-widget>
[
im_select top_vars
$top
_var_options
$top
_vars
]
</td>
</tr>
</tr>
"
"
...
...
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