Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-invoices
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-invoices
Commits
db175043
Commit
db175043
authored
Aug 23, 2023
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cosine #5687: Sort FinDoc successors by type_id
parent
8fa677c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
+33
-9
dependency-tree.tcl
lib/dependency-tree.tcl
+33
-9
No files found.
lib/dependency-tree.tcl
View file @
db175043
...
...
@@ -162,7 +162,7 @@ set list [list $filter_invoice_id]
set cnt 0
set predecessor_html ""
set predecessor_num 0
while {
[
llength
$list
]
> 0 &&
$cnt
< 10} {
while {
[
llength
$list
]
> 0 &&
$cnt
< 10
000
} {
incr cnt
set id
[
lindex
$list
0
]
...
...
@@ -213,12 +213,14 @@ while {[llength $list] > 0 && $cnt < 10} {
# Show successors
# -------------------------------------------------------------
# Calculate successors recursively
set list
[
list
$filter
_invoice_id
]
set cnt 0
set successor_html ""
array set successor_html_hash {}; # Hash with HTML per cost type
set successor_num 0
set successor_sum 0.0
while {
[
llength
$list
]
> 0 &&
$cnt
< 100} {
array set successor_sum_hash {}; # Hash with sum per cost type
while {
[
llength
$list
]
> 0 &&
$cnt
< 10000} {
incr cnt
set id
[
lindex
$list
0
]
...
...
@@ -232,26 +234,36 @@ while {[llength $list] > 0 && $cnt < 100} {
if {
[
info
exists name_hash
(
$id
)]
} {
set name
$name
_hash(
$id
)
set amount_formatted
$amount
_formatted_hash(
$id
)
set type
[
im_category_from_id
$type
_hash
(
$id
)]
set type_id
$type
_hash(
$id
)
set type
[
im_category_from_id
$type
_id
]
set status
[
im_category_from_id
$status
_hash
(
$id
)]
# Sum up amounts per cost type
set amount
$amount
_hash(
$id
)
if {"" eq
$amount
} { set amount 0.0 }
set successor_sum
[
expr
$successor
_sum +
$amount
]
set successor_sum
[
expr
$successor
_sum +
$amount
]
; # obsolete ToDo: remove
set s 0.0
if {
[
info
exists successor_sum_hash
(
$type
_id
)]
} { set s
$successor
_sum_hash(
$type
_id) }
set successor_sum_hash(
$type
_id)
[
expr
$s
+
$amount
]
} else {
set name "
Unknown #$id
"
set amount_formatted ""
set type ""
set status ""
}
append successor_html "
<tr>
set line_html "
<tr>
<td><a href=$url>$name</a></td>
<td align=right>$amount_formatted</td>
<td>$type</td>
<td>$status</td>
</tr>
\n
"
set l ""
if {
[
info
exists successor_html_hash
(
$type
_id
)]
} { set l
$successor
_html_hash(
$type
_id) }
append l
$line
_html
set successor_html_hash(
$type
_id)
$l
}
set successors {}
...
...
@@ -263,10 +275,22 @@ while {[llength $list] > 0 && $cnt < 100} {
foreach id
[
array
names hash
]
{
lappend list
$id
}
}
if {
$successor
_sum != 0} {
# Display the successors per cost type
set type_ids
[
lsort
[
array
names successor_html_hash
]]
foreach type_id
$type
_ids {
# Add section header if there is more than one section
if {
[
llength
$type
_ids
]
> 1} {
append successor_html "
<tr><td colspan=4><h4>
[
im_category_from_id
$type
_id
]
</h4></td></tr>
\n
"
}
# Add the HTML fragment for type_id calculated above
append successor_html
$successor
_html_hash(
$type
_id)
# Add sum
set successor_sum
$successor
_sum_hash(
$type
_id)
append successor_html "
<tr>
<td><b>
[
lang::message::lookup
""
intranet-core.Sum
"Sum"
]
:</b></td>
...
...
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