timezone related issue code updated

This commit is contained in:
root 2022-09-20 14:51:10 +05:30
parent 9c6df53751
commit 6dec1811a8
1 changed files with 10 additions and 10 deletions

View File

@ -76,9 +76,9 @@ with pro_data as (
cons_data1 as (
SELECT
date_trunc('month', min(PRO_EMP.start_date)) AS min,
date_trunc('month', coalesce(max(PRO_EMP.end_date), current_date)) AS max,
date_trunc('month', coalesce(max(PRO_EMP.end_date), current_date AT TIME ZONE 'UTC')) AS max,
PRO_EMP.start_date as start_date,
coalesce(PRO_EMP.end_date, current_date) as end_date,
coalesce(PRO_EMP.end_date, current_date AT TIME ZONE 'UTC') as end_date,
PRO_EMP.project_id,
PRO_EMP.employee_id,
PRO_EMP.role,
@ -154,9 +154,9 @@ data1 as (
left join tsheet_data1 on tsheet_data1.project_id=drange_data1.project_id and tsheet_data1.employee_id=drange_data1.employee_id
left join account_analytic_line AAL on AAL.project_id=tsheet_data1.project_id and AAL.employee_id=tsheet_data1.employee_id
and AAL.start_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
>= drange_data1.start_date::date + '00:00:00'::time
>= drange_data1.start_date::date + '00:00:00'::time AT TIME ZONE 'UTC'
and AAL.end_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
<= drange_data1.end_date::date + '23:59:59'::time
<= drange_data1.end_date::date + '23:59:59'::time AT TIME ZONE 'UTC'
where pro_data.pricing_type = 'fixed_rate' and COALESCE(pro_data.is_sub_project, FALSE) = False
group by
drange_data1.start_date,
@ -248,9 +248,9 @@ SELECT
left join pro_data on pro_data.pproject_id = drange_data1.project_id
left join account_analytic_line AAL on AAL.project_id=drange_data1.project_id and AAL.employee_id=drange_data1.employee_id
and AAL.start_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
>= drange_data1.start_date::date + '00:00:00'::time
>= drange_data1.start_date::date + '00:00:00'::time AT TIME ZONE 'UTC'
and AAL.end_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
<= drange_data1.end_date::date + '23:59:59'::time
<= drange_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_no_limit' and COALESCE(pro_data.is_sub_project, FALSE) = False
group by
drange_data1.start_date,
@ -400,14 +400,14 @@ SELECT
left join tsheet_data1 on tsheet_data1.project_id=drange_data1.project_id and tsheet_data1.employee_id=drange_data1.employee_id
left join account_analytic_line AAL on AAL.project_id=tsheet_data1.project_id and AAL.employee_id=tsheet_data1.employee_id
and AAL.start_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
>= drange_data1.start_date::date + '00:00:00'::time
>= drange_data1.start_date::date + '00:00:00'::time AT TIME ZONE 'UTC'
and AAL.end_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
<= drange_data1.end_date::date + '23:59:59'::time
<= drange_data1.end_date::date + '23:59:59'::time AT TIME ZONE 'UTC'
left join cons_data1 on cons_data1.project_id=drange_data1.project_id and cons_data1.employee_id=drange_data1.employee_id
and AAL.start_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
>= cons_data1.start_date::date + '00:00:00'::time
>= cons_data1.start_date::date + '00:00:00'::time AT TIME ZONE 'UTC'
and AAL.end_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
<= cons_data1.end_date::date + '23:59:59'::time
<= 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 COALESCE(pro_data.is_sub_project, FALSE) = False
group by
drange_data1.start_date,