Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-cost
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-cost
Commits
6bb47e93
Commit
6bb47e93
authored
Jun 14, 2016
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added a consistency check to the cost center hierarchy
parent
0bb14834
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
2 deletions
+95
-2
index.adp
www/cost-centers/index.adp
+14
-2
index.tcl
www/cost-centers/index.tcl
+81
-0
No files found.
www/cost-centers/index.adp
View file @
6bb47e93
...
...
@@ -5,9 +5,21 @@
<property name="left_navbar">@left_navbar_html;literal@</property>
<h1>@page_title@</h1>
@help_txt;noquote@
<br><br>
<if @inconsistent_count@ gt 0>
<table border=0 bgcolor="#FF8080"><tr><td>
<h3>Inconsistent Cost Centers</h3>
<p><font color=black>The following cost centers have inconsistencies in their parent hierarchy.<br>
Please make sure that the cost center code (for example "CoOpMa" for Company - Operations - Maintencance) <br>
corresponds to the list of it's parents. Each level of CCs should be uniquely marked by a two letter
code.</font></p>
<listtemplate name="inconsistent_parents"></listtemplate>
</td></tr></table>
<br> <br>
</if>
<form action=cost-center-action method=post>
<%= [export_vars -form {return_url}] %>
<table width="100%">
...
...
www/cost-centers/index.tcl
View file @
6bb47e93
...
...
@@ -158,3 +158,84 @@ append left_navbar_html "
</ul>
</div>
"
# ------------------------------------------------------
# Cost Center Consistency Check
# ------------------------------------------------------
set
inconsistent_parents_sql
"
select t.*,
im_cost_center_name_from_id(parent_id) as parent,
im_cost_center_name_from_id(code_parent_id) as code_parent,
im_cost_center_name_from_id(sortkey_parent_id) as sortkey_parent
from (
select cc.*,
(select cc1.cost_center_id from im_cost_centers cc1 where cc1.cost_center_code = substring(cc.cost_center_code from '^(.*)..
$
')) as code_parent_id,
(select cc2.cost_center_id
from im_cost_centers cc2
where cc2.tree_sortkey = tree_ancestor_key(cc.tree_sortkey,tree_level(cc.tree_sortkey)-1)
) as sortkey_parent_id,
tree_ancestor_key(cc.tree_sortkey, 1) as parent_sortkey,
trunc(length(cc.cost_center_code) / 2) as code_level
from im_cost_centers cc
) t
where parent_id != sortkey_parent_id OR parent_id != code_parent_id
order by tree_sortkey
"
set
inconsistent_count 0
db_multirow -extend
{
cc_chk cc_url message indent
}
inconsistent_parents inconsistent_parents
$inconsistent
_parents_sql
{
set message
"asdf"
set indent
""
for
{
set
i 0
}
{
$i
<
$code
_level
}
{
incr
i
}
{
append indent
" "
}
set cc_url
[
export_vars -base
"/intranet-cost/cost-centers/new"
{
cost_center_id
{
form_mode edit
}}]
set cc_chk
"<input type=
\"
checkbox
\"
checked
name=
\"
cost_center_id
\"
value=
\"
$cost
_center_id
\"
id=
\"
subprojects,
$cost
_center_id
\"
>"
incr inconsistent_count
}
set
list_id
"inconsistent_parents"
set
bulk_actions_list
[
list
]
template::list::create
\
-name
"inconsistent_parents"
\
-multirow inconsistent_parents
\
-key cost_center_id
\
-has_checkboxes
\
-bulk_actions
$bulk
_actions_list
\
-elements
{
cc_chk
{
label
"<input type=
\"
checkbox
\"
checked
name=
\"
_dummy
\"
onclick=
\"
acs_ListCheckAll('inconsistent_parents', this.checked)
\"
title=
\"
Check/uncheck all rows
\"
>"
display_template
{
@inconsistent_parents.cc_chk
;
noquote@
}
}
cc_name
{
label
"
[
lang::message::lookup
{}
intranet-cost.Name Name
]
"
display_template
{
@inconsistent_parents.indent
;
noquote@<a href=@inconsistent_parents.cc_url
;
noquote@>@inconsistent_parents.cost_center_name@</a>
}
}
parent
{
label
"
[
lang::message::lookup
{}
intranet-cost.Direct_Parent
{
Direct Parent
}]
"
}
code_parent
{
label
"
[
lang::message::lookup
{}
intranet-cost.Code_Parent
{
Code Parent
}]
"
}
sortkey_parent
{
label
"
[
lang::message::lookup
{}
intranet-cost.Sortkey_Parent
{
Sortkey Parent
}]
"
}
}
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