cqp 2 hete
szülő
commit
acaf7c9894
1 módosított fájl, 1 hozzáadás és 67 törlés
  1. 1 67
      app/Service/StatisticsService.php

+ 1 - 67
app/Service/StatisticsService.php

@@ -461,72 +461,6 @@ class StatisticsService extends Service
         return [true, [$model, $time]];
     }
 
-    public function statisticsDeviceFillExportData1($data, $ergs, $device, $item_total){
-        $device_map = $device_map_2 = [];
-        foreach ($data as $value){
-            if(isset($device_map[$value['data_id']])){
-                $total_hours = bcadd($device_map[$value['data_id']], $value['total_hours'],2);
-                $device_map[$value['data_id']] = $total_hours;
-            }else{
-                $device_map[$value['data_id']] = $value['total_hours'];
-            }
-            $key = $value['data_id'];
-            if(isset($device_map_2[$key][$value['item_id']])){
-                $total_hours_2 = bcadd($device_map_2[$key][$value['item_id']], $value['total_hours'],2);
-                $device_map_2[$key][$value['item_id']] = $total_hours_2;
-            }else{
-                $device_map_2[$key][$value['item_id']] = $value['total_hours'];
-            }
-        }
-        unset($data);
-
-        $tmp = [];
-        foreach ($item_total as $value){
-            $tmp[$value['id']] = 0;
-        }
-        foreach ($device as $key => $value){
-            $device[$key]['in_time'] = $value['in_time'] ? date("Y-m-d", $value['in_time']) : '';
-
-            //汇总研发工时单里的总工时
-            $rd_total_hours = $device_map[$value['id']] ?? 0;
-            $rd_total_hours = bcdiv($rd_total_hours,60,2);
-            $device[$key]['rd_total_hours'] = $rd_total_hours;
-            $device[$key]['set_total_hours'] = $rd_total_hours;
-            //每个项目的工时
-            $every_item_hours = $device_map_2[$value['id']] ?? [];
-
-            $details = $tmp;
-            $my_item = "";
-            if(! empty($every_item_hours)){
-                foreach ($every_item_hours as $item => $item_hour){
-                    if(isset($details[$item])) {
-                        $details[$item] = bcdiv($item_hour,60,2);
-                    }
-//                    $code = $item_map[$item] ?? "";
-//                    if(! empty($code)) $my_item .= $code . ",";
-                }
-//                $my_item = rtrim($my_item,',');
-            }
-            foreach ($details as $it => $d_v){
-                $device[$key]['extra_' . $it] = $d_v;
-            }
-
-            $device[$key]['my_item'] = $my_item;
-
-            $device[$key]['type_title'] = Device::$type[$value['type']] ?? "";
-            $device[$key]['type_2_title'] = Device::$type_2[$value['type_2']] ?? "";
-
-            $rate_one = "100";
-            $device[$key]['rate_one'] = $rate_one . "%";
-            $rate_two = floatval($rd_total_hours) > 0.0 ? bcdiv($rd_total_hours, $rd_total_hours,2) : 0;
-            $rate_two = bcmul($rate_two, 100,2);
-            $device[$key]['rate_two'] = $rate_two . "%";
-            $device[$key]['rate_three'] = $rate_two . "%";
-        }
-
-        return $device;
-    }
-
     public function statisticsDeviceFillExportData($data, $ergs, $device, $item_total, $is_count = false, $set_map = []) {
         $device_map = $device_map_2 = [];
         foreach ($data as $value) {
@@ -577,7 +511,7 @@ class StatisticsService extends Service
             $device[$key]['rate_one'] = $rate_one . "%";
             $rate_two = floatval($rd_total_hours) > 0.0 ? bcdiv($rd_total_hours, $set_total_hours,2) : 0;
             $rate_two = bcmul($rate_two, 100,2);
-            $device[$key]['rate_two'] = $rate_two;
+            $device[$key]['rate_two'] = $rate_two . "%";
             $rate_three = bcmul(bcdiv($rate_two, $rate_one,2),100,2);
             $device[$key]['rate_three'] = $rate_three . "%";
         }