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
68deab25
Commit
68deab25
authored
May 11, 2023
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a sum to FinDoc successors
parent
60f86aa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
dependency-tree.tcl
lib/dependency-tree.tcl
+29
-10
No files found.
lib/dependency-tree.tcl
View file @
68deab25
...
...
@@ -8,19 +8,18 @@ if {![info exists invoice_id]} {
ad_page_contract
{}
{
invoice_id:integer
""
}
}
set
current_user_id
[
auth::require_login
]
set
filter_invoice_id
$invoice
_id
set
default_currency
[
im_parameter -package_id
[
im_package_cost_id
]
"DefaultCurrency"
""
"EUR"
]
set
invoice_base_url
"/intranet-invoices/view"
# ad_return_complaint 1 "dependency-tree: invoice_id=$filter_invoice_id"
set
current_user_id
[
auth::require_login
]
im_invoice_permissions
$current
_user_id
$filter
_invoice_id view_p read_p write_p admin_p
if
{
!$read_p
}
{
ad_return_complaint 1
"You don't have read permissions to see this portlet"
ad_script_abort
}
set
invoice_base_url
"/intranet-invoices/view"
# Check if the calling page (invoices/view?invoice_id=123
)
has a locale set
set
locale
[
uplevel
2
{
if
{[
info
exists locale
]}
{
set locale
}}]
if
{
""
eq
$locale
}
{
...
...
@@ -48,12 +47,13 @@ lappend main_project_ids 0
set
costs_sql
"
select cost_id, item_id, cost_name, cost_nr, cost_type_id, cost_status_id, item_source_invoice_id,
coalesce(cost_amount, 0.0) as cost_amount, cost_currency,
coalesce(cost_amount, 0.0) as cost_amount, cost_currency,
cost_amount_converted,
CASE WHEN item_source_invoice_id = cost_id THEN null ELSE item_source_invoice_id END as source_id
from (
select c.*,
c.amount as cost_amount,
c.currency as cost_currency,
round(c.amount * im_exchange_rate(c.effective_date::date, c.currency, :default_currency)::numeric, 2) as cost_amount_converted,
i.*,
ii.*
from im_projects p,
...
...
@@ -69,6 +69,7 @@ set costs_sql "
select c.*,
coalesce(c.amount, 0.0) as cost_amount,
c.currency as cost_currency,
round(c.amount * im_exchange_rate(c.effective_date::date, c.currency, :default_currency)::numeric, 2) as cost_amount_converted,
i.*,
ii.*
from im_projects p,
...
...
@@ -97,7 +98,8 @@ db_foreach costs $costs_sql {
set name_hash
(
$cost
_id
)
$cost
_name
set type_hash
(
$cost
_id
)
$cost
_type_id
set status_hash
(
$cost
_id
)
$cost
_status_id
set amount_hash
(
$cost
_id
)
"
[
lc_numeric
$cost
_amount
"%.2f"
$locale
]
$cost
_currency"
set amount_hash
(
$cost
_id
)
$cost
_amount_converted
set amount_formatted_hash
(
$cost
_id
)
"
[
lc_numeric
$cost
_amount
"%.2f"
$locale
]
$cost
_currency"
if
{
""
ne
$source
_id
}
{
set predecessors
{}
...
...
@@ -172,7 +174,7 @@ while {[llength $list] > 0 && $cnt < 10} {
set url
[
export_vars -base
$invoice
_base_url
{{
invoice_id
$id
}}]
if {
[
info
exists name_hash
(
$id
)]
} {
set name
$name
_hash(
$id
)
set amount
$amount
_hash(
$id
)
set amount
$amount
_
formatted_
hash(
$id
)
set type
[
im_category_from_id
$type
_hash
(
$id
)]
set status
[
im_category_from_id
$status
_hash
(
$id
)]
set link "
<a href=$url>$name</a>
"
...
...
@@ -215,6 +217,7 @@ set list [list $filter_invoice_id]
set cnt 0
set successor_html ""
set successor_num 0
set successor_sum 0.0
while {
[
llength
$list
]
> 0 &&
$cnt
< 100} {
incr cnt
...
...
@@ -228,18 +231,23 @@ while {[llength $list] > 0 && $cnt < 100} {
if {
[
info
exists name_hash
(
$id
)]
} {
set name
$name
_hash(
$id
)
set amount
$amount
_hash(
$id
)
set amount
_formatted
$amount
_formatted
_hash(
$id
)
set type
[
im_category_from_id
$type
_hash
(
$id
)]
set status
[
im_category_from_id
$status
_hash
(
$id
)]
set amount
$amount
_hash(
$id
)
if {"" eq
$amount
} { set amount 0.0 }
set successor_sum
[
expr
$successor
_sum +
$amount
]
} else {
set name "
Unknown #$id
"
set amount ""
set amount
_formatted
""
set type ""
set status ""
}
append successor_html "
<tr>
<td><a href=$url>$name</a></td>
<td
>$amount
</td>
<td
align=right>$amount_formatted
</td>
<td>$type</td>
<td>$status</td>
</tr>
\n
...
...
@@ -258,6 +266,17 @@ while {[llength $list] > 0 && $cnt < 100} {
}
if {
$successor
_sum != 0} {
append successor_html "
<tr>
<td><b>
[
lang::message::lookup
""
intranet-core.Sum
"Sum"
]
:</b></td>
<td align=right><b>
[
lc_numeric
$successor
_sum
"%.2f"
$locale
]
$default
_currency</b></td>
<td></td>
<td></td>
</tr>
\n
"
}
# -------------------------------------------------------------
# Output HTML
...
...
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