|
|
@@ -3109,7 +3109,7 @@ class common {
|
|
|
$utc = common::getUTCOffsetFormatted($zone);
|
|
|
return date($format, strtotime($date)).$time_str." UTC".$utc;
|
|
|
}
|
|
|
- return date($format, strtotime($date)).$time;
|
|
|
+ return date($format, strtotime($date)).$time_str;
|
|
|
}
|
|
|
|
|
|
public static function getUTCOffsetFormatted($timezone) {
|
|
|
@@ -3134,76 +3134,6 @@ class common {
|
|
|
$sqlArr = explode(";", $fixed_sql);
|
|
|
if(count($sqlArr) > 1){
|
|
|
$sqlDetail = $sqlArr[1];
|
|
|
- $sqlDetail = "with oo as(
|
|
|
- SELECT h_bol, place_of_receipt_exp, place_of_delivery_exp,serial_no,transport_mode,order_from
|
|
|
- FROM public.kln_ocean oo
|
|
|
- WHERE <{ExtendHand_KLN}> and ((oo.ata is not null and oo.ata >= CURRENT_DATE - INTERVAL '3 months' AND oo.ata < CURRENT_DATE)
|
|
|
- or not exists( select 1 from public.ocean_milestone a where a.serial_no = oo.serial_no and a.act_date is not null and a.code = 'IFFDEL')) and oo.transport_mode = 'sea' and order_from = 'public' order by id limit 10
|
|
|
- )
|
|
|
-
|
|
|
- SELECT oo.*,mil.description,mil.act_date,mil.act_time,o.cargo_type,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'timezone' as timezone,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'locations' as locations
|
|
|
- from oo
|
|
|
- inner join LATERAL (select case when is_hazardous = 't' then 'Dangerous Goods'::text else 'General'::text end as cargo_type
|
|
|
- from public.ocean o where o.serial_no = oo.serial_no) o on true
|
|
|
- left join LATERAL (select a.code,s.description,to_char(a.act_date, 'YYYY-MM-DD') as act_date ,a.act_time
|
|
|
- from public.ocean_milestone a
|
|
|
- left join public.customer_service_milestone_sno s on a.code = s.code
|
|
|
- and s.type = 'sea'
|
|
|
- and a.serial_no = oo.serial_no
|
|
|
- and a.act_date is not null
|
|
|
- order by s.sno desc limit 1) mil on true
|
|
|
- left join LATERAL (select public.getTimeAndLocationForKln(oo.serial_no,mil.code,''::text)::jsonb as jsonb_data) lt on true
|
|
|
- where oo.transport_mode = 'sea' and order_from = 'public'
|
|
|
- union all
|
|
|
- SELECT oo.*,mil.description,mil.act_date,mil.act_time,o.cargo_type,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'timezone' as timezone,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'locations' as locations
|
|
|
- from oo
|
|
|
- inner join LATERAL (select case when is_hazardous = 't' then 'Dangerous Goods'::text else 'General'::text end as cargo_type
|
|
|
- from sfs.ocean o where o.serial_no = oo.serial_no) o on true
|
|
|
- left join LATERAL (select a.code,s.description,to_char(a.act_date, 'YYYY-MM-DD') as act_date ,a.act_time
|
|
|
- from public.ocean_milestone a
|
|
|
- left join public.customer_service_milestone_sno s on a.code = s.code
|
|
|
- and s.type = 'air'
|
|
|
- and a.serial_no = oo.serial_no
|
|
|
- and a.act_date is not null
|
|
|
- order by s.sno desc limit 1) mil on true
|
|
|
- left join LATERAL (select public.getTimeAndLocationForKln(oo.serial_no,mil.code,''::text)::jsonb as jsonb_data) lt on true
|
|
|
- where oo.transport_mode = 'sea' and order_from = 'sfs'
|
|
|
- union all
|
|
|
- SELECT oo.*,mil.description,mil.act_date,mil.act_time,o.cargo_type,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'timezone' as timezone,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'locations' as locations
|
|
|
- from oo
|
|
|
- inner join LATERAL (select case when is_hazardous = 't' then 'Dangerous Goods'::text else 'General'::text end as cargo_type
|
|
|
- from public.ocean o where o.serial_no = oo.serial_no) o on true
|
|
|
- left join LATERAL (select a.code,s.description,to_char(a.act_date, 'YYYY-MM-DD') as act_date ,a.act_time
|
|
|
- from public.air_milestone a
|
|
|
- left join public.customer_service_milestone_sno s on a.code = s.code
|
|
|
- and s.type = 'air'
|
|
|
- and a.serial_no = oo.serial_no
|
|
|
- and a.act_date is not null
|
|
|
- order by s.sno desc limit 1) mil on true
|
|
|
- left join LATERAL (select public.getTimeAndLocationForKln(oo.serial_no,mil.code,''::text)::jsonb as jsonb_data) lt on true
|
|
|
- where oo.transport_mode = 'air' and order_from = 'public'
|
|
|
- union all
|
|
|
- SELECT oo.*,mil.description,mil.act_date,mil.act_time,o.cargo_type,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'timezone' as timezone,
|
|
|
- COALESCE(jsonb_data->>'milestone','')::jsonb->>'locations' as locations
|
|
|
- from oo
|
|
|
- inner join LATERAL (select case when is_hazardous = 't' then 'Dangerous Goods'::text else 'General'::text end as cargo_type
|
|
|
- from sfs.ocean o where o.serial_no = oo.serial_no) o on true
|
|
|
- left join LATERAL (select a.code,s.description,to_char(a.act_date, 'YYYY-MM-DD') as act_date ,a.act_time
|
|
|
- from sfs.air_milestone a
|
|
|
- left join public.customer_service_milestone_sno s on a.code = s.code
|
|
|
- and s.type = 'air'
|
|
|
- and a.serial_no = oo.serial_no
|
|
|
- and a.act_date is not null
|
|
|
- order by s.sno desc limit 1) mil on true
|
|
|
- left join LATERAL (select public.getTimeAndLocationForKln(oo.serial_no,mil.code,''::text)::jsonb as jsonb_data) lt on true
|
|
|
- where oo.transport_mode = 'air' and order_from = 'sfs'";
|
|
|
$search = 'limit 10';
|
|
|
$sqlDetail = str_ireplace($search, '', $sqlDetail);
|
|
|
}
|