Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-reporting-finance
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-reporting-finance
Commits
98418cf0
Commit
98418cf0
authored
Nov 14, 2017
by
cosine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- cosine massive update allowing for sub-types of financial documents
parent
6339aed5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
96 additions
and
101 deletions
+96
-101
customers-users-activities.tcl
www/customers-users-activities.tcl
+3
-3
finance-costs-monthly.tcl
www/finance-costs-monthly.tcl
+1
-4
finance-documents-projects.tcl
www/finance-documents-projects.tcl
+9
-9
finance-income-statement.tcl
www/finance-income-statement.tcl
+8
-8
finance-monthly-summary.tcl
www/finance-monthly-summary.tcl
+9
-9
finance-payment-balance.tcl
www/finance-payment-balance.tcl
+9
-9
finance-project-hierarchy-documents.tcl
www/finance-project-hierarchy-documents.tcl
+15
-15
finance-projects-documents.tcl
www/finance-projects-documents.tcl
+15
-15
finance-subprojects-documents.tcl
www/finance-subprojects-documents.tcl
+16
-16
finance-vat-advanced.tcl
www/finance-vat-advanced.tcl
+4
-6
finance-vat.tcl
www/finance-vat.tcl
+7
-7
No files found.
www/customers-users-activities.tcl
View file @
98418cf0
...
...
@@ -9,8 +9,8 @@ select
sum(amount) as amount
from (
select CASE
WHEN c.cost_type_id
=3700
THEN 'im_invoice'
WHEN c.cost_type_id
=3702
THEN 'im_quote'
WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN 'im_invoice'
WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN 'im_quote'
END as type,
c.customer_id as customer_id,
o.creation_user as user_id,
...
...
@@ -20,7 +20,7 @@ from (
acs_objects o
where c.cost_id = o.object_id and
c.effective_date > now()::date - 90 and
c.cost_type_id in (
3700, 3702
)
c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3702
}]
","
]
)
UNION
select o.object_type as type,
p.company_id as customer_id,
...
...
www/finance-costs-monthly.tcl
View file @
98418cf0
...
...
@@ -143,10 +143,7 @@ set sql "
(select * from im_biz_object_urls where url_type = 'view') bou
where c.cost_id = o.object_id and
o.object_type = bou.object_type and
c.cost_type_id in (
[
im_cost_type_expense_item
]
,
[
im_cost_type_bill
]
)
c.cost_type_id in (
[
join
[
im_sub_categories
[
list
[
im_cost_type_expense_item
]
[
im_cost_type_bill
]]]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
and c.effective_date::date < to_date(:end_date, 'YYYY-MM-DD')
...
...
www/finance-documents-projects.tcl
View file @
98418cf0
...
...
@@ -246,7 +246,7 @@ from
) r
where
c.cost_id = r.cost_id
and c.cost_type_id in (
3700, 3702, 3704, 3706
)
and c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3702 3704 3706
}]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
and c.effective_date::date < to_date(:end_date, 'YYYY-MM-DD')
...
...
@@ -264,17 +264,17 @@ select
im_category_from_id(cust.company_status_id) as customer_status,
prov.company_path as provider_nr,
prov.company_name as provider_name,
CASE WHEN c.cost_type_id
= 3700
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
= 3702
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
= 3704
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
= 3706
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
= 3700
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as invoice_amount_pretty,
CASE WHEN c.cost_type_id
= 3702
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as quote_amount_pretty,
CASE WHEN c.cost_type_id
= 3704
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as bill_amount_pretty,
CASE WHEN c.cost_type_id
= 3706
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as po_amount_pretty,
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency as paid_amount_pretty,
p.project_name,
...
...
www/finance-income-statement.tcl
View file @
98418cf0
...
...
@@ -191,7 +191,7 @@ from
im_costs c
LEFT OUTER JOIN acs_rels r on (c.cost_id = r.object_id_two)
where
c.cost_type_id in (
3700, 3704, 3720
)
c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3704 3720
}]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
and c.effective_date::date < to_date(:end_date, 'YYYY-MM-DD')
...
...
@@ -209,21 +209,21 @@ set sql "
select
c.*,
to_char(c.effective_date, :date_format) as effective_date_formatted,
CASE WHEN c.cost_type_id
= 3700
THEN c.amount_conv END as invoice_amount,
CASE WHEN c.cost_type_id
= 3704
THEN c.amount_conv END as bill_amount,
CASE WHEN c.cost_type_id
= 3720
THEN c.amount_conv END as expense_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN c.amount_conv END as invoice_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN c.amount_conv END as bill_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3720
]
","
]
)
THEN c.amount_conv END as expense_amount,
cust.company_path as customer_nr,
cust.company_name as customer_name,
prov.company_path as provider_nr,
prov.company_name as provider_name,
CASE
WHEN c.cost_type_id in (
3700
) THEN c.amount_conv * vat / 100
WHEN c.cost_type_id in (
3704,3720,3720
) THEN -c.amount_conv * vat / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
) THEN c.amount_conv * vat / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories
{
3704 3720
}]
","
]
) THEN -c.amount_conv * vat / 100
ELSE 0
END as vat_amount,
CASE
WHEN c.cost_type_id in (
3700
) THEN c.amount_conv * tax / 100
WHEN c.cost_type_id in
(3704,3720,3720
) THEN -c.amount_conv * tax / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
) THEN c.amount_conv * tax / 100
WHEN c.cost_type_id in
[
join
[
im_sub_categories
{
3704 3720
}]
","
]
) THEN -c.amount_conv * tax / 100
ELSE 0
END as tax_amount,
cust.company_id as customer_id,
...
...
www/finance-monthly-summary.tcl
View file @
98418cf0
...
...
@@ -166,7 +166,7 @@ select
from
im_costs c
where
c.cost_type_id in (
3700, 3702, 3704, 3706
)
c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3702 3704 3706
}]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
$where
_clause
...
...
@@ -181,14 +181,14 @@ select
cust.company_name as customer_name,
prov.company_path as provider_nr,
prov.company_name as provider_name,
CASE WHEN c.cost_type_id
= 3700
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
= 3702
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
= 3704
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
= 3706
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
= 3700
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as invoice_amount_pretty,
CASE WHEN c.cost_type_id
= 3702
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as quote_amount_pretty,
CASE WHEN c.cost_type_id
= 3704
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as bill_amount_pretty,
CASE WHEN c.cost_type_id
= 3706
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as po_amount_pretty,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as invoice_amount_pretty,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as quote_amount_pretty,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as bill_amount_pretty,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency END as po_amount_pretty,
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency as paid_amount_pretty
from
(
$inner
_sql) c
...
...
www/finance-payment-balance.tcl
View file @
98418cf0
...
...
@@ -189,7 +189,7 @@ from
LEFT OUTER JOIN im_costs c on (p.cost_id = c.cost_id)
LEFT OUTER JOIN acs_rels r on (c.cost_id = r.object_id_two)
where
c.cost_type_id in (
3700, 3702, 3704, 3706
)
c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3702 3704 3706
}]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
"
...
...
@@ -204,18 +204,18 @@ select
cust.company_name as customer_name,
prov.company_path as provider_nr,
prov.company_name as provider_name,
CASE WHEN c.cost_type_id
= 3700 THEN
c.paid_amount_converted END as paid_invoice_amount,
CASE WHEN c.cost_type_id
= 3702 THEN
c.paid_amount_converted END as paid_quote_amount,
CASE WHEN c.cost_type_id
= 3704 THEN
c.paid_amount_converted END as paid_bill_amount,
CASE WHEN c.cost_type_id
= 3706 THEN
c.paid_amount_converted END as paid_po_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
c.paid_amount_converted END as paid_invoice_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
c.paid_amount_converted END as paid_quote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
c.paid_amount_converted END as paid_bill_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
c.paid_amount_converted END as paid_po_amount,
CASE WHEN c.cost_type_id
= 3700 THEN
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
END as paid_invoice_amount_pretty,
CASE WHEN c.cost_type_id
= 3702 THEN
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
END as paid_quote_amount_pretty,
CASE WHEN c.cost_type_id
= 3704 THEN
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
END as paid_bill_amount_pretty,
CASE WHEN c.cost_type_id
= 3706 THEN
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency
END as paid_po_amount_pretty,
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency as paid_amount_pretty,
p.project_name,
...
...
www/finance-project-hierarchy-documents.tcl
View file @
98418cf0
...
...
@@ -274,7 +274,7 @@ set inner_sql "
c.cost_id = o.object_id
and (
c.cost_type_id is null
OR c.cost_type_id in (
3700, 3702, 3704, 3706, 3718, 3722, 3724, null
)
OR c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3702 3704 3706 3718 3722 3724
}]
","
]
)
)
"
...
...
@@ -297,27 +297,27 @@ select
mainp.project_nr as main_project_nr,
mainp.project_name as main_project_name,
CASE WHEN c.cost_type_id
= 3700
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
= 3702
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
= 3704
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
= 3706
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
= 3718
THEN c.amount_converted END as timesheet_amount,
CASE WHEN c.cost_type_id
= 3722
THEN c.amount_converted END as expense_amount,
CASE WHEN c.cost_type_id
= 3724
THEN c.amount_converted END as delnote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3718
]
","
]
)
THEN c.amount_converted END as timesheet_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3722
]
","
]
)
THEN c.amount_converted END as expense_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3724
]
","
]
)
THEN c.amount_converted END as delnote_amount,
CASE WHEN c.cost_type_id
= 3700
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as invoice_amount_pretty,
CASE WHEN c.cost_type_id
= 3702
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as quote_amount_pretty,
CASE WHEN c.cost_type_id
= 3704
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as bill_amount_pretty,
CASE WHEN c.cost_type_id
= 3706
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as po_amount_pretty,
CASE WHEN c.cost_type_id
= 3718
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3718
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as timesheet_amount_pretty,
CASE WHEN c.cost_type_id
= 3722
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3722
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as expense_amount_pretty,
CASE WHEN c.cost_type_id
= 3724
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3724
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as delnote_amount_pretty,
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency as paid_amount_pretty,
...
...
www/finance-projects-documents.tcl
View file @
98418cf0
...
...
@@ -295,7 +295,7 @@ set inner_sql "
c.cost_id = o.object_id
and (
c.cost_type_id is null
OR c.cost_type_id in (
3700, 3702, 3704, 3706, 3718, 3722, 3724, null
)
OR c.cost_type_id in (
[
join
[
im_sub_categories
{
3700 3702 3704 3706 3718 3722 3724
}]
","
]
)
)
"
...
...
@@ -327,27 +327,27 @@ select
prov.company_path as provider_nr,
prov.company_name as provider_name,
CASE WHEN c.cost_type_id
= 3700 THEN
c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
= 3702 THEN
c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
= 3704 THEN
c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
= 3706 THEN
c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
= 3718 THEN
c.amount_converted END as timesheet_amount,
CASE WHEN c.cost_type_id
= 3722 THEN
c.amount_converted END as expense_amount,
CASE WHEN c.cost_type_id
= 3724 THEN
c.amount_converted END as delnote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3718
]
","
]
)
c.amount_converted END as timesheet_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3722
]
","
]
)
c.amount_converted END as expense_amount,
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3724
]
","
]
)
c.amount_converted END as delnote_amount,
CASE WHEN c.cost_type_id
= 3700 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3700
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as invoice_amount_pretty,
CASE WHEN c.cost_type_id
= 3702 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3702
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as quote_amount_pretty,
CASE WHEN c.cost_type_id
= 3704 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3704
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as bill_amount_pretty,
CASE WHEN c.cost_type_id
= 3706 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3706
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as po_amount_pretty,
CASE WHEN c.cost_type_id
= 3718 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3718
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as timesheet_amount_pretty,
CASE WHEN c.cost_type_id
= 3722 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3722
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as expense_amount_pretty,
CASE WHEN c.cost_type_id
= 3724 THEN
to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in (
[
join
[
im_sub_categories 3724
]
","
]
)
to_char(c.amount, :cur_format) || ' ' || c.currency
END as delnote_amount_pretty,
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency as paid_amount_pretty,
...
...
www/finance-subprojects-documents.tcl
View file @
98418cf0
...
...
@@ -296,34 +296,34 @@ set inner_sql "
parent.end_date::date < to_date(:end_date, 'YYYY-MM-DD') and
child.tree_sortkey between parent.tree_sortkey and tree_right(parent.tree_sortkey) and
child.project_status_id not in (
[
im_project_status_deleted
]
) and
(c.cost_type_id is null OR c.cost_type_id in (
3700, 3702, 3704, 3706, 3718, 3722, 3724)
)
(c.cost_type_id is null OR c.cost_type_id in (
[
join
[
im_sub_categories
{
3700, 3702, 3704, 3706, 3718, 3722, 3724
}]
","
]
)
$where
_clause
"
set
sql
"
select c.*,
CASE WHEN c.cost_type_id
= 3700
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
= 3702
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
= 3704
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
= 3706
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
= 3718
THEN c.amount_converted END as timesheet_amount,
CASE WHEN c.cost_type_id
= 3722
THEN c.amount_converted END as expense_amount,
CASE WHEN c.cost_type_id
= 3724
THEN c.amount_converted END as delnote_amount,
CASE WHEN c.cost_type_id
= 3700
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3700
]
","
]
)
THEN c.amount_converted END as invoice_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3702
]
","
]
)
THEN c.amount_converted END as quote_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3704
]
","
]
)
THEN c.amount_converted END as bill_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3706
]
","
]
)
THEN c.amount_converted END as po_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3718
]
","
]
)
THEN c.amount_converted END as timesheet_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3722
]
","
]
)
THEN c.amount_converted END as expense_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3724
]
","
]
)
THEN c.amount_converted END as delnote_amount,
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3700
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as invoice_amount_pretty,
CASE WHEN c.cost_type_id
= 3702
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3702
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as quote_amount_pretty,
CASE WHEN c.cost_type_id
= 3704
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3704
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as bill_amount_pretty,
CASE WHEN c.cost_type_id
= 3706
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3706
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as po_amount_pretty,
CASE WHEN c.cost_type_id
= 3718
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3718
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as timesheet_amount_pretty,
CASE WHEN c.cost_type_id
= 3722
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3722
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as expense_amount_pretty,
CASE WHEN c.cost_type_id
= 3724
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
CASE WHEN c.cost_type_id
in(
[
join
[
im_sub_categories 3724
]
","
]
)
THEN to_char(c.amount, :cur_format) || ' ' || c.currency
END as delnote_amount_pretty,
to_char(c.paid_amount, :cur_format) || ' ' || c.paid_currency as paid_amount_pretty
from
...
...
www/finance-vat-advanced.tcl
View file @
98418cf0
...
...
@@ -195,7 +195,7 @@ from
im_costs c
LEFT OUTER JOIN acs_rels r on (c.cost_id = r.object_id_two)
where
c.cost_type_id in (
3700
)
c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
"
...
...
@@ -217,11 +217,11 @@ select
ascii(vat_type)::numeric
as quarter_cost_type_vat_type,
round(CASE
WHEN c.cost_type_id in (
3700
) THEN c.amount_conv * vat / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
) THEN c.amount_conv * vat / 100
ELSE 0
END,2) as vat_amount,
round(CASE
WHEN c.cost_type_id in (
3700
) THEN c.amount_conv * tax / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
) THEN c.amount_conv * tax / 100
ELSE 0
END,2) as tax_amount,
cust.company_id as customer_id,
...
...
@@ -426,10 +426,8 @@ db_foreach sql $sql {
set quarter_cost_type_vat_type
$cost
_id
}
set invoice_or_quote_p
[
expr
$cost
_type_id ==
[
im_cost_type_invoice
]
||
$cost
_type_id ==
[
im_cost_type_quote
]
||
$cost
_type_id ==
[
im_cost_type_delivery_note
]
||
$cost
_type_id ==
[
im_cost_type_interco_quote
]
||
$cost
_type_id ==
[
im_cost_type_interco_invoice
]]
set invoice_or_quote_p
[
im_cost_type_is_invoice_or_quote_p
$cost
_type_id
]
set vat_number
$customer
_vat_number
set cost_item_amount_pretty
[
im_report_format_number
$cost
_item_amount
$output
_format
$number
_locale
]
set vat_amount_pretty
[
im_report_format_number
$vat
_amount
$output
_format
$number
_locale
]
set tax_amount_pretty
[
im_report_format_number
$tax
_amount
$output
_format
$number
_locale
]
...
...
www/finance-vat.tcl
View file @
98418cf0
...
...
@@ -205,7 +205,7 @@ from
im_costs c
LEFT OUTER JOIN acs_rels r on (c.cost_id = r.object_id_two)
where
c.cost_type_id in (
3700,3704,3720,3730,3732
)
c.cost_type_id in (
[
join
[
im_sub_categories
[
list
3700 3704 3720 3730 3732
]]
","
]
)
and c.effective_date >= to_date(:start_date, 'YYYY-MM-DD')
and c.effective_date < to_date(:end_date, 'YYYY-MM-DD')
"
...
...
@@ -236,13 +236,13 @@ select
ascii(vat_type)::numeric
as quarter_cost_type_vat_type,
round(CASE
WHEN c.cost_type_id in (
3700
) THEN c.amount_conv * vat / 100
WHEN c.cost_type_id in (
3704,3720,3720
) THEN -c.amount_conv * vat / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
) THEN c.amount_conv * vat / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories
{
3704 3720
}]
","
]
) THEN -c.amount_conv * vat / 100
ELSE 0
END,2) as vat_amount,
round(CASE
WHEN c.cost_type_id in (
3700
) THEN c.amount_conv * tax / 100
WHEN c.cost_type_id in (
3704,3720,3720
) THEN -c.amount_conv * tax / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories 3700
]
","
]
) THEN c.amount_conv * tax / 100
WHEN c.cost_type_id in (
[
join
[
im_sub_categories
{
3704 3720
}]
","
]
) THEN -c.amount_conv * tax / 100
ELSE 0
END,2) as tax_amount,
cust.company_id as customer_id,
...
...
@@ -595,7 +595,7 @@ db_foreach sql $sql {
set quarter_cost_type_vat_type
$cost
_id
}
set invoice_or_quote_p
[
expr
$cost
_type_id ==
[
im_cost_type_invoice
]
||
$cost
_type_id ==
[
im_cost_type_quote
]
||
$cost
_type_id ==
[
im_cost_type_delivery_note
]
||
$cost
_type_id ==
[
im_cost_type_interco_quote
]
||
$cost
_type_id ==
[
im_cost_type_interco_invoice
]
]
set invoice_or_quote_p
[
im_cost_type_is_invoice_or_quote_p
$cost
_type_id
]
if
{
$invoice
_or_quote_p
}
{
set vat_number
$customer
_vat_number
}
else
{
...
...
@@ -617,7 +617,7 @@ db_foreach sql $sql {
if
{
$customer
_id ==
[
im_company_internal
]}
{
set company_html
"<a href=
$company
_url
$provider
_id>
$provider
_name</a>"
}
if
{
$cost
_type_id
==
[
im_cost_type_expense_item
]}
{
if
{
$cost
_type_id
in
[
im_sub_categories
[
im_cost_type_expense_item
]
]}
{
set company_html
$external
_company_name
}
...
...
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