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
9f1ed9da
Commit
9f1ed9da
authored
Jun 28, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added financial comparison portlet
parent
3a08b645
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
1 deletion
+189
-1
finance-document-comparison.adp
lib/finance-document-comparison.adp
+1
-0
finance-document-comparison.tcl
lib/finance-document-comparison.tcl
+85
-0
intranet-invoices-create.sql
sql/postgresql/intranet-invoices-create.sql
+61
-1
intranet-invoices-procs.tcl
tcl/intranet-invoices-procs.tcl
+42
-0
No files found.
lib/finance-document-comparison.adp
0 → 100644
View file @
9f1ed9da
@html;noquote@
lib/finance-document-comparison.tcl
0 → 100644
View file @
9f1ed9da
# project_id set by portlet TCL
if
{
!
[
info
exists project_id
]}
{
ad_page_contract
{}
{
project_id:integer
}
}
set
current_user_id
[
auth::require_login
]
im_project_permissions
$current
_user_id
$project
_id view_p read_p write_p admin_p
if
{
!$read_p
}
{
ad_return_complaint 1
"You don't have read permissions on #
$project
_id"
ad_script_abort
}
set
html
[
im_ad_hoc_query -format html
"
select i.item_outline_number as outline,
i.item_name,
im_category_from_id(i.item_uom_id) as uom,
(
select sum(tii.item_units)
from im_costs tc,
im_invoice_items tii,
im_projects p
where tii.invoice_id = tc.cost_id and
tii.item_outline_number = i.item_outline_number and
tii.item_uom_id = i.item_uom_id and
tc.cost_type_id = 3702 and
tc.project_id = p.project_id and
p.tree_sortkey between i.tree_sortkey and tree_right(i.tree_sortkey)
) as quotes,
(
select sum(tii.item_units)
from im_costs tc,
im_invoice_items tii,
im_projects p
where tii.invoice_id = tc.cost_id and
tii.item_outline_number = i.item_outline_number and
tii.item_uom_id = i.item_uom_id and
tc.cost_type_id = 3700 and
tc.project_id = p.project_id and
p.tree_sortkey between i.tree_sortkey and tree_right(i.tree_sortkey)
) as invoices,
(
select sum(tii.item_units)
from im_costs tc,
im_invoice_items tii,
im_projects p
where tii.invoice_id = tc.cost_id and
tii.item_outline_number = i.item_outline_number and
tii.item_uom_id = i.item_uom_id and
tc.cost_type_id = 3706 and
tc.project_id = p.project_id and
p.tree_sortkey between i.tree_sortkey and tree_right(i.tree_sortkey)
) as pos,
(
select sum(tii.item_units)
from im_costs tc,
im_invoice_items tii,
im_projects p
where tii.invoice_id = tc.cost_id and
tii.item_outline_number = i.item_outline_number and
tii.item_uom_id = i.item_uom_id and
tc.cost_type_id = 3704 and
tc.project_id = p.project_id and
p.tree_sortkey between i.tree_sortkey and tree_right(i.tree_sortkey)
) as bills
from (select distinct
ii.item_outline_number,
ii.item_uom_id,
ii.item_name,
main_p.tree_sortkey
from im_costs c,
im_invoices i,
im_invoice_items ii,
im_projects sub_p,
im_projects main_p
where c.cost_id = i.invoice_id and
ii.invoice_id = i.invoice_id and
c.project_id = sub_p.project_id and
sub_p.tree_sortkey between main_p.tree_sortkey and tree_right(main_p.tree_sortkey) and
main_p.project_id = :project_id
) i
order by i.item_outline_number
"
]
sql/postgresql/intranet-invoices-create.sql
View file @
9f1ed9da
...
...
@@ -1458,7 +1458,67 @@ SELECT im_component_plugin__new (
SELECT
im_grant_permission
(
(
select
plugin_id
from
im_component_plugins
where
plugin_name
=
'Filestorage Financial Document'
),
(
select
group_id
from
groups
where
name
=
'Employees'
),
(
select
group_id
from
groups
where
group_name
=
'Employees'
),
'read'
);
SELECT
im_component_plugin__new
(
null
,
-- plugin_id
'im_component_plugin'
,
-- object_type
now
(),
-- creation_date
null
,
-- creation_user
null
,
-- creation_ip
null
,
-- context_id
'Financial Cross-Tracking'
,
-- plugin_name
'intranet-invoices'
,
-- package_name
'bottom'
,
-- location
'/intranet/projects/view'
,
-- page_url
null
,
-- view_name
100
,
-- sort_order
'im_invoice_cross_tracking_component $project_id'
-- component_tcl
);
SELECT
im_grant_permission
(
(
select
plugin_id
from
im_component_plugins
where
plugin_name
=
'Financial Cross-Tracking'
),
(
select
group_id
from
groups
where
group_name
=
'Accounting'
),
'read'
);
SELECT
im_grant_permission
(
(
select
plugin_id
from
im_component_plugins
where
plugin_name
=
'Financial Cross-Tracking'
),
(
select
group_id
from
groups
where
group_name
=
'Senior Managers'
),
'read'
);
SELECT
im_component_plugin__new
(
null
,
-- plugin_id
'im_component_plugin'
,
-- object_type
now
(),
-- creation_date
null
,
-- creation_user
null
,
-- creation_ip
null
,
-- context_id
'Financial Document Comparison'
,
-- plugin_name
'intranet-invoices'
,
-- package_name
'bottom'
,
-- location
'/intranet/projects/view'
,
-- page_url
null
,
-- view_name
100
,
-- sort_order
'im_invoices_finance_document_comparison_component $project_id'
-- component_tcl
);
SELECT
im_grant_permission
(
(
select
plugin_id
from
im_component_plugins
where
plugin_name
=
'Financial Document Comparison'
),
(
select
group_id
from
groups
where
group_name
=
'Accounting'
),
'read'
);
SELECT
im_grant_permission
(
(
select
plugin_id
from
im_component_plugins
where
plugin_name
=
'Financial Document Comparison'
),
(
select
group_id
from
groups
where
group_name
=
'Senior Managers'
),
'read'
);
...
...
tcl/intranet-invoices-procs.tcl
View file @
9f1ed9da
...
...
@@ -392,6 +392,48 @@ ad_proc im_invoices_default_company_template {
# Components
# ---------------------------------------------------------------
ad_proc -public im_invoices_finance_document_comparison_component
{
project_id
}
{
Returns a HTML table with a comparison of the volume of FinDocs
per type and outline_number.
}
{
set params
[
list
\
[
list
project_id
$project
_id
]
\
]
set result
[
ad_parse_template -params
$params
"/packages/intranet-invoices/lib/finance-document-comparison"
]
return
[
string
trim
$result
]
}
ad_proc im_invoices_project_cross_tracking_component
{
project_id
}
{
Track the financial performance of projects based on outline numbers.
}
{
set outline_number_enabled_p
[
im_column_exists im_invoice_items item_outline_number
]
if
{
!$outline_number_enabled_p
}
{
return
""
}
# Get the list of all invoice outline numbers across the project
set outline_numbers
[
db_list outline_numbers
"
select distinct item_outline_number
from im_invoice_items ii,
im_invoices i,
im_costs c,
im_projects main_p,
im_projects sub_p
where c.cost_id = i.invoice_id and
c.cost_id = ii.invoice_id and
c.project_id = sub_p.project_id and
sub_p.tree_sortkey between main_p.tree_sortkey and tree_right(main_p.tree_sortkey) and
main_p.project_id = :project_id
order by item_outline_number
"
]
return
""
}
ad_proc im_invoices_object_list_component
{
user_id invoice_id read write return_url
}
{
Returns a HTML table containing a list of objects
associated with a particular financial document.
...
...
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