ShuanghongS hace 1 año
padre
commit
b38dab7458
Se han modificado 3 ficheros con 55 adiciones y 33 borrados
  1. 23 23
      main_new_version.php
  2. 26 4
      service/ocean_order.class.php
  3. 6 6
      utils/common.class.php

+ 23 - 23
main_new_version.php

@@ -587,7 +587,7 @@ switch ($action) {
         exit();
         break;
     case 'main_map_new':
-        //include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
+        include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
         //修改添加port_of_transshipment 和port_of_transshipment_name的坐标获取(有为空的可能)
         $serial_no = $_REQUEST["serial_no"];
         //$serial_no = "F41E6016-1A97-4C93-8198-53D8B3B26220";
@@ -620,28 +620,28 @@ switch ($action) {
         //           {"lng":"100.88333333","lat":"13.08333333","label":"Destination","infor":"LAEM CHABANG PORT,THAILAND","sort":"1","stime":null,"ptype":"pol"},
         //           {"lng":"-122.28640000","lat":"37.79784000","label":"Transfer","infor":"OAKLAND, CA, USA","sort":"2","stime":null,"ptype":"pod"}]';
         //$rss = json_decode($json,true);
-        // global $mapdb;
-        // //查询线(包含所有的线)
-        // $Line = $mapdb->GetAll("select * from get_track_data('$serial_no',true)");
-        // $solidLine = array();
-        // $dottedLine = array();
-        // $rangePoint = array();
-        // foreach($Line as $line){
-        //     if($line['tp'] == "1"){
-        //         $solidLine[] = $line;
-        //     }elseif($line['tp'] == "0"){
-        //         $dottedLine[] = $line;
-        //     }else{
-        //         $rangePoint[] = $line;
-        //     }
-        // }
-        // //如果没有虚线,这这个范围点也是异常的,不需要显示
-        // if(empty($dottedLine)){
-        //     $rangePoint = array();
-        // }
-        // $data = array("point"=>$rss,"solidLine"=>$solidLine,"dottedLine"=>$dottedLine,"rangePoint"=>$rangePoint);
-        // common::echo_json_encode(200, $data);
-        common::echo_json_encode(200, $rss);
+        global $mapdb;
+        //查询线(包含所有的线)
+        $Line = $mapdb->GetAll("select * from get_track_data('$serial_no',true)");
+        $solidLine = array();
+        $dottedLine = array();
+        $rangePoint = array();
+        foreach($Line as $line){
+            if($line['tp'] == "1"){
+                $solidLine[] = $line;
+            }elseif($line['tp'] == "0"){
+                $dottedLine[] = $line;
+            }else{
+                $rangePoint[] = $line;
+            }
+        }
+        //如果没有虚线,这这个范围点也是异常的,不需要显示
+        if(empty($dottedLine)){
+            $rangePoint = array();
+        }
+        $data = array("point"=>$rss,"solidLine"=>$solidLine,"dottedLine"=>$dottedLine,"rangePoint"=>$rangePoint);
+        common::echo_json_encode(200, $data);
+        //common::echo_json_encode(200, $rss);
         exit();
         break;
     case 'main_welcome':

+ 26 - 4
service/ocean_order.class.php

@@ -899,14 +899,36 @@ class ocean_order {
         }
         $param = '{"user_login":"'._getLoginName().'","report_type":"ALL","date_from":"'.$date_from.'","date_to":"'.$date_to.'"}';
 
-        $sql = "SELECT * FROM get_customer_revenue_report('$param');FETCH ALL FROM r2;";
+        //$sql = "SELECT * FROM get_customer_revenue_report('$param');FETCH ALL FROM r2;";
         //$sql = "select * from _test_data_table";
-        $r2_data = common::excuteListSql($sql);
-
+        //$r2_data = common::excuteListSql($sql);
+        //只取r3  代码去计总r2 ,避免二次请求数据库
         $sql = "SELECT * FROM get_customer_revenue_report('$param');FETCH ALL FROM r3;";
         //$sql = "select * from _test_data_table_two";
         $r3_data = common::excuteListSql($sql);
-       
+
+        $group_data = array();
+        foreach($r3_data as $r3){
+            $r3['invoice_date'] = strtoupper(date('M,Y', strtotime($r3['invoice_date'])));
+            $group_data[] = $r3;
+        }
+        //按货币和日期分组
+        $groupedItems = array();
+        foreach ($group_data as $item) {
+            $key = $item['currency']."_".$item['invoice_date'];
+            if(array_key_exists($key, $groupedItems)){
+                $temp = $groupedItems[$key];
+                $temp['invoice_amount'] = $temp['invoice_amount'] + $item['ivnoice_amount'];
+                $groupedItems[$key] = $temp;
+            }else{
+                $groupedItems[$key] = array("month"=>$item['invoice_date'],"currency"=>$item['currency'],"invoice_amount"=>$item['ivnoice_amount']);
+            }
+        }
+        $r2_data = array();
+        foreach($groupedItems as $gt){
+            $gt['invoice_amount'] = number_format($gt['invoice_amount'], 4, '.', '');
+            $r2_data[] = $gt;
+        }
         common::echo_json_encode(200,array("msg"=>"success","r2" => $r2_data,"r3"=>$r3_data,"r2_cloumn" => $r2_cloumn,"r3_cloumn" => $r3_cloumn,
            "r2_title"=>"Monthly Summary Data","r3_title"=>"Invoice Detailed Data"));
         exit;

+ 6 - 6
utils/common.class.php

@@ -1652,12 +1652,12 @@ class common {
             "title"=>"Container Count",
             "switchValue"=>true,
             "text"=>"Pie chart showing figures of shipments which are soon to depart/arrive (Calculated from ETD/ETA).");
-        // if(_isRevenueDisplay()){    
-        //     $Management[] = array("id"=>5 ,
-        //         "title"=>"Revenue Spent",
-        //         "switchValue"=>true,
-        //         "text"=>"Revenue data for the past 12 months."); 
-        // }   
+        if(_isRevenueDisplay()){    
+            $Management[] = array("id"=>5 ,
+                "title"=>"Revenue Spent",
+                "switchValue"=>true,
+                "text"=>"Revenue data for the past 12 months."); 
+        }   
         $Management[] = array("id"=>6 ,
             "title"=>"Top 10 Origin/Destination",
             "switchValue"=>true,