|
@@ -78,10 +78,14 @@ class ajax {
|
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //Notify Party Bill to Destination Operator 是tracking里的,但booking没有,所以不影响
|
|
|
$search_field_mapping = array("Origin Agent"=>"origin as code",
|
|
$search_field_mapping = array("Origin Agent"=>"origin as code",
|
|
|
"Destination Agent"=>"agent as code",
|
|
"Destination Agent"=>"agent as code",
|
|
|
"Shipper Name"=>"shipper as code",
|
|
"Shipper Name"=>"shipper as code",
|
|
|
"Consignee Name"=>"consignee as code",
|
|
"Consignee Name"=>"consignee as code",
|
|
|
|
|
+ "Notify Party" =>"notify_party as code",
|
|
|
|
|
+ "Bill to" =>"billto as code",
|
|
|
|
|
+ "Destination Operator"=>"dest_op as code",
|
|
|
"Sales"=>"sales_rep as code",
|
|
"Sales"=>"sales_rep as code",
|
|
|
"Voyage/Flight_booking"=>"f_voyage as code,m_voyage as code_2",
|
|
"Voyage/Flight_booking"=>"f_voyage as code,m_voyage as code_2",
|
|
|
"Vessel_booking"=>"f_vessel as code,m_vessel as code_2",
|
|
"Vessel_booking"=>"f_vessel as code,m_vessel as code_2",
|
|
@@ -92,6 +96,9 @@ class ajax {
|
|
|
"Destination Agent"=>" and (agent ilike '" . common::check_input($term) . "%')",
|
|
"Destination Agent"=>" and (agent ilike '" . common::check_input($term) . "%')",
|
|
|
"Shipper Name"=>" and (shipper ilike '" . common::check_input($term) . "%')",
|
|
"Shipper Name"=>" and (shipper ilike '" . common::check_input($term) . "%')",
|
|
|
"Consignee Name"=>" and (consignee ilike '" . common::check_input($term) . "%')",
|
|
"Consignee Name"=>" and (consignee ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Notify Party"=>" and (notify_party ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Bill to"=>" and (billto ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Destination Operator"=>" and (dest_op ilike '" . common::check_input($term) . "%')",
|
|
|
"Sales"=>" and (sales_rep ilike '" . common::check_input($term) . "%')",
|
|
"Sales"=>" and (sales_rep ilike '" . common::check_input($term) . "%')",
|
|
|
"Voyage/Flight_booking"=>" and (f_voyage ilike '" . common::check_input($term) . "%' or m_voyage ilike '" . common::check_input($term) . "%')",
|
|
"Voyage/Flight_booking"=>" and (f_voyage ilike '" . common::check_input($term) . "%' or m_voyage ilike '" . common::check_input($term) . "%')",
|
|
|
"Vessel_booking"=>" and (f_vessel ilike '" . common::check_input($term) . "%' or m_vessel ilike '" . common::check_input($term) . "%')",
|
|
"Vessel_booking"=>" and (f_vessel ilike '" . common::check_input($term) . "%' or m_vessel ilike '" . common::check_input($term) . "%')",
|
|
@@ -107,9 +114,9 @@ class ajax {
|
|
|
$sql_where = $sql_where_mapping[$search_field];
|
|
$sql_where = $sql_where_mapping[$search_field];
|
|
|
|
|
|
|
|
$table = $search_mode == "tracking" ? "public.online_ocean " : "public.online_booking ";
|
|
$table = $search_mode == "tracking" ? "public.online_ocean " : "public.online_booking ";
|
|
|
-
|
|
|
|
|
- $sql = "select $str from $table $sqlWhere $sql_where ";
|
|
|
|
|
- $sql .= " order by id limit 20";
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select * from (select DISTINCT $str from $table $sqlWhere $sql_where) as temp";
|
|
|
|
|
+ $sql .= " order by code limit 20";
|
|
|
$rs = common::excuteListSql($sql);
|
|
$rs = common::excuteListSql($sql);
|
|
|
}
|
|
}
|
|
|
$rs = common::excuteListSql($sql);
|
|
$rs = common::excuteListSql($sql);
|
|
@@ -137,30 +144,38 @@ class ajax {
|
|
|
$term = trim($term);
|
|
$term = trim($term);
|
|
|
$search_field = $_POST['search_field'];
|
|
$search_field = $_POST['search_field'];
|
|
|
$search_mode = $_POST['search_mode'];
|
|
$search_mode = $_POST['search_mode'];
|
|
|
- $in_sql = $this->getPortsUncity($search_field,$search_mode);
|
|
|
|
|
|
|
+ $_sql_arr = $this->getPortsUncity($search_field,$search_mode,$term);
|
|
|
|
|
|
|
|
$rc = $_POST ['rc'];
|
|
$rc = $_POST ['rc'];
|
|
|
if ($rc == - 1) {
|
|
if ($rc == - 1) {
|
|
|
- $sql = "SELECT count(1) from public.ports where (isoname ilike '" . common::check_input($term) . "%'
|
|
|
|
|
- or uncity ilike '" . common::check_input($term) . "%' or uncode ilike '" . common::check_input($term) . "%')
|
|
|
|
|
- and $in_sql";
|
|
|
|
|
|
|
+ $sql = $_sql_arr['count_sql'];
|
|
|
$rc = common::excuteOneSql($sql);
|
|
$rc = common::excuteOneSql($sql);
|
|
|
|
|
+ error_log($sql);
|
|
|
}
|
|
}
|
|
|
$tp = ceil($rc / $ps);
|
|
$tp = ceil($rc / $ps);
|
|
|
if ($rc > 0) {
|
|
if ($rc > 0) {
|
|
|
- $sql = "SELECT isoname as country, uncity as city,uncode from public.ports where (isoname ilike '" . common::check_input($term) . "%'
|
|
|
|
|
- or uncity ilike '" . common::check_input($term) . "%' or uncode ilike '" . common::check_input($term) . "%')
|
|
|
|
|
- and $in_sql";
|
|
|
|
|
- $sql .= " order by code limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $sql = $_sql_arr['sql'];
|
|
|
|
|
+ $sql = "select * from ($sql) as temp ";
|
|
|
|
|
+ $sql .= " order by city limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
|
|
|
+
|
|
|
$rs = common::excuteListSql($sql);
|
|
$rs = common::excuteListSql($sql);
|
|
|
//前端要加上id 从1开始
|
|
//前端要加上id 从1开始
|
|
|
$retData = array();
|
|
$retData = array();
|
|
|
|
|
+ $i = 0;
|
|
|
foreach($rs as $key => $val){
|
|
foreach($rs as $key => $val){
|
|
|
- if(!empty($val['country'])){
|
|
|
|
|
- $val["id"] = $key +1;
|
|
|
|
|
- $retData[] = $val;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if($search_field == "Port of Loading"){
|
|
|
|
|
+ if(!empty($val['uncode'])){
|
|
|
|
|
+ $val["id"] = $i +1;
|
|
|
|
|
+ $retData[] = $val;
|
|
|
|
|
+ $i = $i +1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(!empty($val['city'])){
|
|
|
|
|
+ $val["id"] = $i +1;
|
|
|
|
|
+ $retData[] = $val;
|
|
|
|
|
+ $i = $i +1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$arrTmp = array('searchData' => $retData,
|
|
$arrTmp = array('searchData' => $retData,
|
|
|
'rc' => $rc,
|
|
'rc' => $rc,
|
|
@@ -440,138 +455,174 @@ class ajax {
|
|
|
return $sqlWhere;
|
|
return $sqlWhere;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- PUBLIC function getPortsUncity($search_field,$search_mode){
|
|
|
|
|
- $uncity = array();
|
|
|
|
|
|
|
+ PUBLIC function getPortsUncity($search_field,$search_mode,$term){
|
|
|
|
|
+ //uncode 前两位便是 isoname,不用模糊查询这个了
|
|
|
if($search_field == "Origin" && $search_mode == "booking"){
|
|
if($search_field == "Origin" && $search_mode == "booking"){
|
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
|
- $sql = "select shipper_city from public.online_booking $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['shipper_city'])){
|
|
|
|
|
- $uncity[] = $city['shipper_city'];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT shipper_city)
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (shipper_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or shippr_uncode ilike '" . common::check_input($term) . "%') ";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (shipper_city) left(shippr_uncode, 2) as country,shipper_city as city, shippr_uncode as uncode
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (shipper_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or shippr_uncode ilike '" . common::check_input($term) . "%') ";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if($search_field == "Destination" && $search_mode == "booking"){
|
|
if($search_field == "Destination" && $search_mode == "booking"){
|
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
|
- $sql = "select consignee_city from public.online_booking $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['consignee_city'])){
|
|
|
|
|
- $uncity[] = $city['consignee_city'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select count(DISTINCT consignee_city)
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (consignee_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or consignee_uncode ilike '" . common::check_input($term) . "%') ";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (consignee_city) left(consignee_uncode, 2) as country,consignee_city as city, consignee_uncode as uncode
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (consignee_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or consignee_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Place of Receipt" && $search_mode == "booking"){
|
|
if($search_field == "Place of Receipt" && $search_mode == "booking"){
|
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
|
- $sql = "select place_of_receipt_exp from public.online_booking $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['place_of_receipt_exp'])){
|
|
|
|
|
- $uncity[] = $city['place_of_receipt_exp'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT place_of_receipt_exp)
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (place_of_receipt_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_receipt_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (place_of_receipt_exp) left(place_of_receipt_uncode, 2) as country,place_of_receipt_exp as city, place_of_receipt_uncode as uncode
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (place_of_receipt_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_receipt_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Port of Loading" && $search_mode == "booking"){
|
|
if($search_field == "Port of Loading" && $search_mode == "booking"){
|
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
|
- $sql = "select fport_of_loading_exp from public.online_booking $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['fport_of_loading_exp'])){
|
|
|
|
|
- $uncity[] = $city['fport_of_loading_exp'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT fport_of_loading_exp)
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (fport_of_loading_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or fport_of_loading_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (fport_of_loading_exp) left(fport_of_loading_uncode, 2) as country,fport_of_loading_exp as city, fport_of_loading_uncode as uncode
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (fport_of_loading_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or fport_of_loading_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Place of delivery" && $search_mode == "booking"){
|
|
if($search_field == "Place of delivery" && $search_mode == "booking"){
|
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
$sqlWhere = $this->getBookingSearchWhere();
|
|
|
- $sql = "select place_of_delivery_exp from public.online_booking $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['place_of_delivery_exp'])){
|
|
|
|
|
- $uncity[] = $city['place_of_delivery_exp'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT place_of_delivery_exp)
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (place_of_delivery_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_delivery_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (place_of_delivery_exp) left(place_of_delivery_uncode, 2) as country,place_of_delivery_exp as city, place_of_delivery_uncode as uncode
|
|
|
|
|
+ from public.online_booking $sqlWhere
|
|
|
|
|
+ and (place_of_delivery_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_delivery_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//tracking
|
|
//tracking
|
|
|
if($search_field == "Origin" && $search_mode == "tracking"){
|
|
if($search_field == "Origin" && $search_mode == "tracking"){
|
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
|
- $sql = "select shipper_city,consignee_city from public.online_ocean $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['shipper_city'])){
|
|
|
|
|
- $uncity[] = $city['shipper_city'];
|
|
|
|
|
- }
|
|
|
|
|
- if(!empty($city['consignee_city'])){
|
|
|
|
|
- $uncity[] = $city['consignee_city'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT city) from (select left(shippr_uncode, 2) as country,shipper_city as city, shippr_uncode as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (shipper_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or shippr_uncode ilike '" . common::check_input($term) . "%')
|
|
|
|
|
+ union
|
|
|
|
|
+ select left(consignee_uncode, 2) as country,consignee_city as city, consignee_uncode as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (consignee_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or consignee_uncode ilike '" . common::check_input($term) . "%')) as temp";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select * from(select DISTINCT ON (shipper_city) left(shippr_uncode, 2) as country,shipper_city as city, shippr_uncode as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (shipper_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or shippr_uncode ilike '" . common::check_input($term) . "%')
|
|
|
|
|
+ union
|
|
|
|
|
+ select DISTINCT ON (consignee_city) left(consignee_uncode, 2) as country,consignee_city as city, consignee_uncode as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (consignee_city ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or consignee_uncode ilike '" . common::check_input($term) . "%')) as temp";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Destination" && $search_mode == "tracking"){
|
|
if($search_field == "Destination" && $search_mode == "tracking"){
|
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
|
- $sql = "select final_desination_exp from public.online_ocean $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['final_desination_exp'])){
|
|
|
|
|
- $uncity[] = $city['final_desination_exp'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT final_desination_exp)
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (final_desination_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or final_desination_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (final_desination_exp) left(final_desination_uncode, 2) as country,final_desination_exp as city, final_desination_uncode as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (final_desination_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or final_desination_uncode ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Place of Receipt" && $search_mode == "tracking"){
|
|
if($search_field == "Place of Receipt" && $search_mode == "tracking"){
|
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
|
- $sql = "select place_of_receipt_exp from public.online_ocean $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['place_of_receipt_exp'])){
|
|
|
|
|
- $uncity[] = $city['place_of_receipt_exp'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT place_of_receipt_exp)
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (place_of_receipt_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_receipt_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (place_of_receipt_exp) left(place_of_receipt_un, 2) as country,place_of_receipt_exp as city, place_of_receipt_un as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (place_of_receipt_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_receipt_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Port of Loading" && $search_mode == "tracking"){
|
|
if($search_field == "Port of Loading" && $search_mode == "tracking"){
|
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
|
- $sql = "select port_of_loading from public.online_ocean $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['port_of_loading'])){
|
|
|
|
|
- $uncity[] = $city['port_of_loading'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT port_of_loading)
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (port_of_loading ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or fport_of_loading_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (port_of_loading) left(fport_of_loading_un, 2) as country,port_of_loading as city, fport_of_loading_un as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (port_of_loading ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or fport_of_loading_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Place of Discharge" && $search_mode == "tracking"){
|
|
if($search_field == "Place of Discharge" && $search_mode == "tracking"){
|
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
|
- $sql = "select port_of_discharge from public.online_ocean $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['port_of_discharge'])){
|
|
|
|
|
- $uncity[] = $city['port_of_discharge'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT port_of_discharge)
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (port_of_discharge ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or mport_of_discharge_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (port_of_discharge) left(mport_of_discharge_un, 2) as country,port_of_discharge as city, mport_of_discharge_un as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (port_of_discharge ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or mport_of_discharge_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($search_field == "Place of delivery" && $search_mode == "tracking"){
|
|
if($search_field == "Place of delivery" && $search_mode == "tracking"){
|
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
$sqlWhere = $this->getTrackingSearchWhere();
|
|
|
- $sql = "select place_of_delivery_exp from public.online_ocean $sqlWhere";
|
|
|
|
|
- $city_temp = common::excuteListSql($sql);
|
|
|
|
|
- foreach($city_temp as $city){
|
|
|
|
|
- if(!empty($city['place_of_delivery_exp'])){
|
|
|
|
|
- $uncity[] = $city['place_of_delivery_exp'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $uncity = utils::removeDuplicateArray($uncity);
|
|
|
|
|
- $in_sql = utils::getInSql(utils::implode(';', $uncity));
|
|
|
|
|
- if(!empty($uncity)){
|
|
|
|
|
- $in_sql = " lower(uncity) ".$in_sql;
|
|
|
|
|
|
|
+ $count_sql = "select COUNT(DISTINCT place_of_delivery_exp)
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (place_of_delivery_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_delivery_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select DISTINCT ON (place_of_delivery_exp) left(place_of_delivery_un, 2) as country,place_of_delivery_exp as city, place_of_delivery_un as uncode
|
|
|
|
|
+ from public.online_ocean $sqlWhere
|
|
|
|
|
+ and (place_of_delivery_exp ilike '" . common::check_input($term) . "%'
|
|
|
|
|
+ or place_of_delivery_un ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
+ return array("count_sql"=>$count_sql,"sql"=>$sql);
|
|
|
}
|
|
}
|
|
|
- return $in_sql;
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|