|
@@ -63,49 +63,68 @@ class ajax {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//不查询全局的信息,查询该用户,最近3个月内输入过的信息自动补全
|
|
//不查询全局的信息,查询该用户,最近3个月内输入过的信息自动补全
|
|
|
- public function autody_new(){
|
|
|
|
|
|
|
+ public function autody(){
|
|
|
$term = $_POST['term'];
|
|
$term = $_POST['term'];
|
|
|
$type = $_POST['type'];
|
|
$type = $_POST['type'];
|
|
|
$search_field = $_POST['search_field'];
|
|
$search_field = $_POST['search_field'];
|
|
|
$search_mode = $_POST['search_mode'];
|
|
$search_mode = $_POST['search_mode'];
|
|
|
|
|
|
|
|
$term = trim($term);
|
|
$term = trim($term);
|
|
|
- if (strtolower($type) == "apex") {
|
|
|
|
|
- $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
|
|
- $sqlWhere = " " . $sqlWhere;
|
|
|
|
|
- $search_field_mapping = array("Origin Agent"=>"origin",
|
|
|
|
|
- "Destination Agent"=>"agent",
|
|
|
|
|
- "Shipper Name"=>"shipper",
|
|
|
|
|
- "Consignee Name"=>"consignee",
|
|
|
|
|
- "Sales"=>"sales_rep",
|
|
|
|
|
- "Voyage"=>"voyage",
|
|
|
|
|
- "Vessel"=>"vessel");
|
|
|
|
|
-
|
|
|
|
|
- $str = $search_field_mapping['$search_field '];
|
|
|
|
|
- $table = $search_mode == "Tracking" ? "public.online_ocean" : "public.online_ocean";
|
|
|
|
|
-
|
|
|
|
|
- $sql = "select $str from $table where 1=1 $sqlWhere and f_etd >= current_date - INTERVAL '3 months'";
|
|
|
|
|
- $sql .= " order by contact_id limit 20";
|
|
|
|
|
- $rs = common::excuteListSql($sql);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (strtolower($type) == "apex" || strtolower($type) == "contanct" || strtolower($type) == "sales"
|
|
|
|
|
+ || strtolower($type) == "vessel") {
|
|
|
|
|
+ if($search_mode == "tracking"){
|
|
|
|
|
+ $sqlWhere = $this->getTrackingSearchWhere();
|
|
|
|
|
+ }elseif($search_mode == "booking"){
|
|
|
|
|
+ $sqlWhere = $this->getBookingSearchWhere();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- //Shipper 和Consignee 的查询,但是表contact_v ,从ocean和air. 如果不做区分的话,可以上面的apex的Origin Agent/Destination Agent,合并
|
|
|
|
|
- if (strtolower($type) == "contanct") {
|
|
|
|
|
- $sql = "SELECT company as code from contact_v where active = true and (contact_id ilike '" . common::check_input($term) . "%' or company ilike '" . common::check_input($term) . "%')";
|
|
|
|
|
- $sql .= " order by contact_id limit 20";
|
|
|
|
|
- $rs = common::excuteListSql($sql);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $search_field_mapping = array("Origin Agent"=>"origin as code",
|
|
|
|
|
+ "Destination Agent"=>"agent as code",
|
|
|
|
|
+ "Shipper Name"=>"shipper as code",
|
|
|
|
|
+ "Consignee Name"=>"consignee as code",
|
|
|
|
|
+ "Sales"=>"sales_rep as code",
|
|
|
|
|
+ "Voyage/Flight_booking"=>"f_voyage as code,m_voyage as code_2",
|
|
|
|
|
+ "Vessel_booking"=>"f_vessel as code,m_vessel as code_2",
|
|
|
|
|
+ "Voyage/Flight_tracking"=>"voyage as code,f_voyage as code_2",
|
|
|
|
|
+ "Vessel_tracking"=>"vessel as code,f_vessel as code_2");
|
|
|
|
|
+
|
|
|
|
|
+ $sql_where_mapping = array("Origin Agent"=>" and (origin ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Destination Agent"=>" and (agent ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Shipper Name"=>" and (shipper ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Consignee Name"=>" and (consignee 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) . "%')",
|
|
|
|
|
+ "Vessel_booking"=>" and (f_vessel ilike '" . common::check_input($term) . "%' or m_vessel ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Voyage/Flight_tracking"=>" and (voyage ilike '" . common::check_input($term) . "%' or f_voyage ilike '" . common::check_input($term) . "%')",
|
|
|
|
|
+ "Vessel_tracking"=>" and (vessel ilike '" . common::check_input($term) . "%' or f_vessel ilike '" . common::check_input($term) . "%')");
|
|
|
|
|
|
|
|
|
|
+ //特殊处理一下合并Voyage和Vessel
|
|
|
|
|
+ if ($search_field == "Voyage/Flight" || $search_field == "Vessel"){
|
|
|
|
|
+ $_str = $search_mode == "tracking" ? "tracking" : "booking";
|
|
|
|
|
+ $search_field = $search_field ."_".$_str;
|
|
|
|
|
+ }
|
|
|
|
|
+ $str = $search_field_mapping[$search_field];
|
|
|
|
|
+ $sql_where = $sql_where_mapping[$search_field];
|
|
|
|
|
+
|
|
|
|
|
+ $table = $search_mode == "tracking" ? "public.online_ocean " : "public.online_booking ";
|
|
|
|
|
+
|
|
|
|
|
+ $sql = "select $str from $table $sqlWhere $sql_where ";
|
|
|
|
|
+ $sql .= " order by id limit 20";
|
|
|
|
|
+ $rs = common::excuteListSql($sql);
|
|
|
|
|
+ }
|
|
|
$rs = common::excuteListSql($sql);
|
|
$rs = common::excuteListSql($sql);
|
|
|
$array = array();
|
|
$array = array();
|
|
|
foreach($rs as $v){
|
|
foreach($rs as $v){
|
|
|
if(!empty($v['code'])){
|
|
if(!empty($v['code'])){
|
|
|
$array[] = $v['code'];
|
|
$array[] = $v['code'];
|
|
|
}
|
|
}
|
|
|
|
|
+ if ($search_field == "Voyage/Flight" || $search_field == "Vessel"){
|
|
|
|
|
+ $array[] = $v['code_2'];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ $array = utils::removeDuplicateArray($array);
|
|
|
common::echo_json_encode(200,$array);
|
|
common::echo_json_encode(200,$array);
|
|
|
exit();
|
|
exit();
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function autoPort() {
|
|
public function autoPort() {
|
|
@@ -114,6 +133,55 @@ class ajax {
|
|
|
if (empty($ps))
|
|
if (empty($ps))
|
|
|
$ps = 20;
|
|
$ps = 20;
|
|
|
|
|
|
|
|
|
|
+ $term = $_POST['term'];
|
|
|
|
|
+ $term = trim($term);
|
|
|
|
|
+ $search_field = $_POST['search_field'];
|
|
|
|
|
+ $search_mode = $_POST['search_mode'];
|
|
|
|
|
+ $in_sql = $this->getPortsUncity($search_field,$search_mode);
|
|
|
|
|
+
|
|
|
|
|
+ $rc = $_POST ['rc'];
|
|
|
|
|
+ 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";
|
|
|
|
|
+ $rc = common::excuteOneSql($sql);
|
|
|
|
|
+ }
|
|
|
|
|
+ $tp = ceil($rc / $ps);
|
|
|
|
|
+ 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;
|
|
|
|
|
+
|
|
|
|
|
+ $rs = common::excuteListSql($sql);
|
|
|
|
|
+ //前端要加上id 从1开始
|
|
|
|
|
+ $retData = array();
|
|
|
|
|
+ foreach($rs as $key => $val){
|
|
|
|
|
+ if(!empty($val['country'])){
|
|
|
|
|
+ $val["id"] = $key +1;
|
|
|
|
|
+ $retData[] = $val;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $arrTmp = array('searchData' => $retData,
|
|
|
|
|
+ 'rc' => $rc,
|
|
|
|
|
+ 'ps' => $ps,
|
|
|
|
|
+ 'cp' => $cp,
|
|
|
|
|
+ 'tp' => $tp);
|
|
|
|
|
+ common::echo_json_encode(200,$arrTmp);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $arrTmp = array('searchData' => array(), 'rc' => 0);
|
|
|
|
|
+ common::echo_json_encode(200, $arrTmp);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function autoPort_old() {
|
|
|
|
|
+ $cp = common::check_input($_POST ['cp']); //current_page
|
|
|
|
|
+ $ps = common::check_input($_POST ['ps']); //ps
|
|
|
|
|
+ if (empty($ps))
|
|
|
|
|
+ $ps = 20;
|
|
|
|
|
+
|
|
|
$term = $_POST['term'];
|
|
$term = $_POST['term'];
|
|
|
$term = trim($term);
|
|
$term = trim($term);
|
|
|
$_curr_schemas = $_POST['model'];
|
|
$_curr_schemas = $_POST['model'];
|
|
@@ -159,7 +227,7 @@ class ajax {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function autody() {
|
|
|
|
|
|
|
+ public function autody_old() {
|
|
|
$term = $_POST['term'];
|
|
$term = $_POST['term'];
|
|
|
$type = $_POST['type'];
|
|
$type = $_POST['type'];
|
|
|
|
|
|
|
@@ -220,6 +288,291 @@ class ajax {
|
|
|
common::echo_json_encode(200,$array);
|
|
common::echo_json_encode(200,$array);
|
|
|
exit();
|
|
exit();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function getTrackingSearchWhere(){
|
|
|
|
|
+ $sqlWhere = ' where ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
|
|
+ $sqlWhere .= search::getInstance()->getSearchSQL("Ocean_Search");
|
|
|
|
|
+
|
|
|
|
|
+ if (!empty($_REQUEST["_reportRef"])) {
|
|
|
|
|
+ $_reportType = $_REQUEST["_reportType"];
|
|
|
|
|
+ $_reportRef = $_REQUEST["_reportRef"];
|
|
|
|
|
+ if ($_reportType == "r3") {
|
|
|
|
|
+ if ($_reportRef == "Previous 7 Days") {
|
|
|
|
|
+ $sqlWhere .= " and eta>(current_date-interval '7 days') and eta<current_date";
|
|
|
|
|
+ } else if ($_reportRef == "0 Day") {
|
|
|
|
|
+ $sqlWhere .= " and eta=current_date";
|
|
|
|
|
+ } else if ($_reportRef == "1-2 Days") {
|
|
|
|
|
+ $sqlWhere .= " and eta>current_date and eta<=(current_date+interval '2 days')";
|
|
|
|
|
+ } else if ($_reportRef == "3-6 Days") {
|
|
|
|
|
+ $sqlWhere .= " and eta>(current_date+interval '2 days') and eta<=(current_date+interval '6 days')";
|
|
|
|
|
+ } else if ($_reportRef == "7 Days") {
|
|
|
|
|
+ $sqlWhere .= " and eta>(current_date+interval '6 days')";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and 1<>1";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ($_reportType == "r4") {
|
|
|
|
|
+ if ($_reportRef == "Previous 7 Days") {
|
|
|
|
|
+ $sqlWhere .= " and etd>(current_date-interval '7 days') and etd<current_date";
|
|
|
|
|
+ } else if ($_reportRef == "0 Day") {
|
|
|
|
|
+ $sqlWhere .= " and etd=current_date";
|
|
|
|
|
+ } else if ($_reportRef == "1-2 Days") {
|
|
|
|
|
+ $sqlWhere .= " and etd>current_date and etd<=(current_date+interval '2 days')";
|
|
|
|
|
+ } else if ($_reportRef == "3-6 Days") {
|
|
|
|
|
+ $sqlWhere .= " and etd>(current_date+interval '2 days') and etd<=(current_date+interval '6 days')";
|
|
|
|
|
+ } else if ($_reportRef == "7 Days") {
|
|
|
|
|
+ $sqlWhere .= " and etd>(current_date+interval '6 days')";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and 1<>1";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ($_reportType == "ata_r3") {
|
|
|
|
|
+ if ($_reportRef == "0 Day") {
|
|
|
|
|
+ $sqlWhere .= " and ata >= etd and (ata-etd) >= 0 and (ata-etd) < 1";
|
|
|
|
|
+ } else if ($_reportRef == "1-2 Days") {
|
|
|
|
|
+ $sqlWhere .= " and ata >= etd and (ata-etd) >= 1 and (ata-etd) < 2";
|
|
|
|
|
+ } else if ($_reportRef == "3-6 Days") {
|
|
|
|
|
+ $sqlWhere .= " and ata >= etd and (ata-etd) >= 2 and (ata-etd) < 6";
|
|
|
|
|
+ } else if ($_reportRef == "7 Days") {
|
|
|
|
|
+ $sqlWhere .= " and ata >= etd and (ata-etd) >= 6";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and 1<>1";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ($_reportType == "atd_r4") {
|
|
|
|
|
+ if ($_reportRef == "0 Day") {
|
|
|
|
|
+ $sqlWhere .= " and atd >= etd and (atd-etd) >= 0 and (atd-etd) < 1";
|
|
|
|
|
+ } else if ($_reportRef == "1-2 Days") {
|
|
|
|
|
+ $sqlWhere .= " and atd >= etd and (atd-etd) >= 1 and (atd-etd) < 2";
|
|
|
|
|
+ } else if ($_reportRef == "3-6 Days") {
|
|
|
|
|
+ $sqlWhere .= " and atd >= etd and (atd-etd) >= 2 and (atd-etd) < 6";
|
|
|
|
|
+ } else if ($_reportRef == "7 Days") {
|
|
|
|
|
+ $sqlWhere .= " and atd >= etd and (atd-etd) >= 6 ";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and 1<>1";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ($_reportType == "top") {
|
|
|
|
|
+ if (!empty($_reportRef)) {
|
|
|
|
|
+ $_reportStationType = $_REQUEST["_reportStationType"];
|
|
|
|
|
+
|
|
|
|
|
+ if($_reportStationType == 'shippr_uncode'){
|
|
|
|
|
+ $sqlWhere = " and shippr_uncode = '$_reportRef'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($_reportStationType == 'fport_of_loading_un'){
|
|
|
|
|
+ $sqlWhere = " and fport_of_loading_un = '$_reportRef'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($_reportStationType == 'consignee_uncode'){
|
|
|
|
|
+ $sqlWhere .= " and consignee_uncode = '$_reportRef'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($_reportStationType == 'mport_of_discharge_un'){
|
|
|
|
|
+ $sqlWhere .= " and mport_of_discharge_un = '$_reportRef'";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and 1<>1";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ($_reportType == "co2e") {
|
|
|
|
|
+ $_reportDataType = $_REQUEST["_reportDataType"];
|
|
|
|
|
+ //查询sea 其他的为空
|
|
|
|
|
+ if (!empty($_reportRef) && $_reportDataType == "sea") {
|
|
|
|
|
+ $_reportStationType = $_REQUEST["_reportStationType"];
|
|
|
|
|
+ if($_reportStationType == 'origin'){
|
|
|
|
|
+ $sqlWhere .= " and shippr_uncode = '$_reportRef'";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $sqlWhere .= " and consignee_uncode = '$_reportRef'";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and 1<>1";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $_reportRef = explode("-", $_REQUEST["_reportRef"]);
|
|
|
|
|
+ $_reportRefb_date = $_REQUEST["_reportRefb_date"];
|
|
|
|
|
+ $bdate = common::excuteOneSql("select to_date('$_reportRefb_date','mm/YYYY')");
|
|
|
|
|
+ $_reportRefe_date = $_REQUEST["_reportRefe_date"];
|
|
|
|
|
+ $edate = common::excuteOneSql("select to_date('$_reportRefe_date','mm/YYYY') + interval '1 month' - interval '1 day'");
|
|
|
|
|
+ //$sqlWhere .= " and eta>='$bdate' and eta<='$edate'";
|
|
|
|
|
+ if ($_REQUEST["_reportRef"] == "Over 80 Days") {
|
|
|
|
|
+ $sqlWhere .= " and (eta-etd)>80";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and (eta-etd)>" . $_reportRef[0] . " and (eta-etd)<=" . substr($_reportRef[1], 0, 2);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //处理reference类型的组合查询 Search booking No./HBL No./PO No./Carrier Booking No.
|
|
|
|
|
+ if (!empty($_POST["_textSearch"])) {
|
|
|
|
|
+ $textSearch_arr = $_POST['_textSearch'];
|
|
|
|
|
+ if(!is_array($textSearch_arr)){
|
|
|
|
|
+ $textSearch_arr = array($textSearch_arr);
|
|
|
|
|
+ }
|
|
|
|
|
+ $more_sql = "1<>1";
|
|
|
|
|
+ foreach($textSearch_arr as $tsv){
|
|
|
|
|
+ $more_sql .= " or booking_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or h_bol ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or po_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or carrier_booking ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($more_sql <> "1<>1"){
|
|
|
|
|
+ $sqlWhere .= " and ($more_sql)";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $sqlWhere;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getBookingSearchWhere(){
|
|
|
|
|
+ $sqlWhere = ' where ' . common::searchExtendHandNew("booking", $_SESSION["ONLINE_USER"]);
|
|
|
|
|
+ $sqlWhere .= search::getInstance()->getSearchSQL("Booking_Search");
|
|
|
|
|
+ //新版要排除type2情况,总数才会对的上
|
|
|
|
|
+ $sqlWhere .= " and (not(bol_type != 'BOOKING' and booking_no is not null and booking_no <> ''))";
|
|
|
|
|
+ //处理reference类型的组合查询 Search booking No./HBL No./PO No./Carrier Booking No.
|
|
|
|
|
+ if (!empty($_POST["_textSearch"])) {
|
|
|
|
|
+ $textSearch_arr = $_POST['_textSearch'];
|
|
|
|
|
+ if(!is_array($textSearch_arr)){
|
|
|
|
|
+ $textSearch_arr = array($textSearch_arr);
|
|
|
|
|
+ }
|
|
|
|
|
+ $more_sql = "1<>1";
|
|
|
|
|
+ foreach($textSearch_arr as $tsv){
|
|
|
|
|
+ $more_sql .= " or booking_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or h_bol ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or po_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or carrier_booking ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($more_sql <> "1<>1"){
|
|
|
|
|
+ $sqlWhere .= " and ($more_sql)";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $sqlWhere;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ PUBLIC function getPortsUncity($search_field,$search_mode){
|
|
|
|
|
+ $uncity = array();
|
|
|
|
|
+ if($search_field == "Origin" && $search_mode == "booking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if($search_field == "Destination" && $search_mode == "booking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Place of Receipt" && $search_mode == "booking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Port of Loading" && $search_mode == "booking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Place of delivery" && $search_mode == "booking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //tracking
|
|
|
|
|
+ if($search_field == "Origin" && $search_mode == "tracking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Destination" && $search_mode == "tracking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Place of Receipt" && $search_mode == "tracking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Port of Loading" && $search_mode == "tracking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Place of Discharge" && $search_mode == "tracking"){
|
|
|
|
|
+ $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'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($search_field == "Place of delivery" && $search_mode == "tracking"){
|
|
|
|
|
+ $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;
|
|
|
|
|
+ }
|
|
|
|
|
+ return $in_sql;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
?>
|