diff --git a/project_report/report/project_revenue_custom_report3.py b/project_report/report/project_revenue_custom_report3.py index f2a6bcd..cf9a0be 100644 --- a/project_report/report/project_revenue_custom_report3.py +++ b/project_report/report/project_revenue_custom_report3.py @@ -168,8 +168,9 @@ data1 as ( 0.0 AS profit_per FROM pro_data left join account_analytic_line AAL on AAL.project_id=pro_data.pproject_id - where pro_data.pricing_type = 'fixed_rate' AND AAL.sub_project is null - --and COALESCE(pro_data.is_sub_project, FALSE) = False + where pro_data.pricing_type = 'fixed_rate' + and AAL.sub_project is null + and COALESCE(pro_data.is_sub_project, FALSE) = False group by pro_data.pproject_id, pro_data.project_active, @@ -214,8 +215,8 @@ data1_sub as ( FROM sub_pro_data left join account_analytic_line AAL on AAL.sub_project=sub_pro_data.sub_project where sub_pro_data.pricing_type = 'fixed_rate' - AND AAL.sub_project is not null - --and COALESCE(pro_data.is_sub_project, FALSE) = False + and AAL.sub_project is not null + and sub_pro_data.is_sub_project = TRUE group by sub_pro_data.parent_project, sub_pro_data.project_active, @@ -259,7 +260,9 @@ data2 as ( 0.0 AS profit_per FROM pro_data left join account_analytic_line AAL on AAL.project_id=pro_data.pproject_id - WHERE pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_no_limit' and COALESCE(pro_data.is_sub_project, FALSE) = False + WHERE pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_no_limit' + and AAL.sub_project is null + and COALESCE(pro_data.is_sub_project, FALSE) = False group by pro_data.pproject_id, pro_data.project_active, @@ -304,7 +307,7 @@ SELECT left join account_analytic_line AAL on AAL.project_id=pro_data.pproject_id WHERE pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_no_limit' AND AAL.sub_project is null - --and COALESCE(pro_data.is_sub_project, FALSE) = False + AND COALESCE(pro_data.is_sub_project, FALSE) = False group by pro_data.pro_sdate, pro_data.pro_edate, @@ -399,8 +402,8 @@ SELECT FROM sub_pro_data left join account_analytic_line AAL on AAL.sub_project=sub_pro_data.sub_project WHERE sub_pro_data.pricing_type='employee_rate' and sub_pro_data.project_type='hours_no_limit' - AND AAL.sub_project is not null - --and COALESCE(pro_data.is_sub_project, FALSE) = False + and AAL.sub_project is not null + and sub_pro_data.is_sub_project = TRUE group by sub_pro_data.pro_sdate, sub_pro_data.pro_edate, @@ -451,7 +454,9 @@ SELECT 0.0 as profit_per FROM pro_data left join account_analytic_line AAL on AAL.project_id=pro_data.pproject_id - where pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_in_consultant' and COALESCE(pro_data.is_sub_project, FALSE) = False + where pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_in_consultant' + and AAL.sub_project is null + and COALESCE(pro_data.is_sub_project, FALSE) = False group by pro_data.pproject_id, pro_data.project_active, @@ -554,7 +559,7 @@ SELECT <= cons_data1.end_date::date + '23:59:59'::time AT TIME ZONE 'UTC' where pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_in_consultant' AND AAL.sub_project is null - --AND COALESCE(pro_data.is_sub_project, FALSE) = False + AND COALESCE(pro_data.is_sub_project, FALSE) = False group by pro_data.pproject_id, AAL.employee_id, @@ -715,7 +720,7 @@ SELECT <= cons_data1.end_date::date + '23:59:59'::time AT TIME ZONE 'UTC' where sub_pro_data.pricing_type='employee_rate' and sub_pro_data.project_type='hours_in_consultant' AND AAL.sub_project is not null - --AND sub_pro_data.is_sub_project = True + AND sub_pro_data.is_sub_project = True group by sub_pro_data.pproject_id, AAL.employee_id,