|
|
@@ -1115,11 +1115,14 @@ class ocean_order {
|
|
|
if($_schemas == 'public'){
|
|
|
$_schemas = "ocean";
|
|
|
}
|
|
|
- $sql = "SELECT m_eta as _m_eta, h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
|
|
|
+ $sql = "with o as(
|
|
|
+ SELECT o.* from ocean o where serial_no = '" . $serial_no . "'
|
|
|
+ )
|
|
|
+ SELECT m_eta as _m_eta, h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
|
|
|
o.* ,sh.*, cn.* ,aa.*,dd.*,fd.*,oo.*,
|
|
|
(select uncode from ports where code = o.port_of_transshipment) as port_of_transshipment_un
|
|
|
- from ocean o
|
|
|
- LEFT JOIN LATERAL ( SELECT tracking_no as _tracking_no,shippr_uncode,shipper_city,
|
|
|
+ from o
|
|
|
+ LEFT JOIN LATERAL ( SELECT tracking_no as _tracking_no,shippr_uncode,shipper_city,
|
|
|
consignee_uncode,consignee_city,incoterms,
|
|
|
fport_of_loading_un,
|
|
|
mport_of_discharge_un,
|
|
|
@@ -1180,8 +1183,7 @@ class ocean_order {
|
|
|
LEFT JOIN LATERAL ( SELECT
|
|
|
city as fd_city,
|
|
|
(select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
|
|
|
- FROM $_schemas.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true
|
|
|
- where serial_no = '" . $serial_no . "'";
|
|
|
+ FROM $_schemas.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
|
|
|
//error_log($sql);
|
|
|
return $sql;
|
|
|
}
|