|
|
@@ -388,7 +388,7 @@ class ocean_order {
|
|
|
if (stripos($filterTag, "Cargo Received") !== FALSE) {
|
|
|
$_sqlwhere .= " or (dd.new_status = 'Cargo Received')";
|
|
|
}
|
|
|
- if (stripos($filterTag, "Departed") !== FALSE) {
|
|
|
+ if (stripos($filterTag, "Departure") !== FALSE) {
|
|
|
$_sqlwhere .= " or (dd.new_status = 'Departed')";
|
|
|
}
|
|
|
if (stripos($filterTag, "Arrived") !== FALSE) {
|
|
|
@@ -994,82 +994,77 @@ class ocean_order {
|
|
|
if($type == "Booked"){
|
|
|
$Booked_sqlWhere = " and (1<>1 or dd.new_status ='Booked')";
|
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
- from ocean_milestone a
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
- and a.description in (
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
- order by id desc limit 1) dd on true" . $sqlWhere.$Booked_sqlWhere;
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
+ else 'Booked' END as new_status
|
|
|
+ from ocean_milestone a
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere.$Booked_sqlWhere;
|
|
|
}
|
|
|
if($type == "Cargo Received"){
|
|
|
$Cargo_Received_sqlWhere = " and (1<>1 or dd.new_status ='Cargo Received')";
|
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
- from ocean_milestone a
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
- and a.description in (
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
- order by id desc limit 1) dd on true" . $sqlWhere.$Cargo_Received_sqlWhere;
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
+ else 'Booked' END as new_status
|
|
|
+ from ocean_milestone a
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere.$Cargo_Received_sqlWhere;
|
|
|
}
|
|
|
if($type == "Departed"){
|
|
|
$Departed_sqlWhere = " and (1<>1 or dd.new_status ='Departed')";
|
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
- from ocean_milestone a
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
- and a.description in (
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
- order by id desc limit 1) dd on true" . $sqlWhere.$Departed_sqlWhere;
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
+ else 'Booked' END as new_status
|
|
|
+ from ocean_milestone a
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere.$Departed_sqlWhere;
|
|
|
}
|
|
|
if($type == "Arrived"){
|
|
|
$Arrived_sqlWhere = " and (1<>1 or dd.new_status ='Arrived')";
|
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
- from ocean_milestone a
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
- and a.description in (
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
- order by id desc limit 1) dd on true" . $sqlWhere.$Arrived_sqlWhere;
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
+ else 'Booked' END as new_status
|
|
|
+ from ocean_milestone a
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere.$Arrived_sqlWhere;
|
|
|
}
|
|
|
if($type == "Completed"){
|
|
|
$Completed_sqlWhere = " and (1<>1 or dd.new_status ='Completed')";
|
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
- from ocean_milestone a
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
- and a.description in (
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
- order by id desc limit 1) dd on true" . $sqlWhere.$Completed_sqlWhere;
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
+ else 'Booked' END as new_status
|
|
|
+ from ocean_milestone a
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere.$Completed_sqlWhere;
|
|
|
}
|
|
|
}
|
|
|
|