|
|
@@ -304,12 +304,19 @@ class StatisticsService extends Service
|
|
|
$device[$key]['type_title'] = Device::$type[$value['type']] ?? "";
|
|
|
$device[$key]['type_2_title'] = Device::$type_2[$value['type_2']] ?? "";
|
|
|
|
|
|
- $rate_one = "100";
|
|
|
+ //应有占比
|
|
|
+ if($value['type_2'] == Device::type_one){
|
|
|
+ $rate_one = "100";
|
|
|
+ } else{
|
|
|
+ $rate_one = "10";
|
|
|
+ }
|
|
|
+ $rate_one = $rate_one . "%";
|
|
|
$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_three'] = $rate_two . "%";
|
|
|
+ $rate_three = bcmul(bcdiv($rate_two, $rate_one,2),100,2);
|
|
|
+ $device[$key]['rate_three'] = $rate_three . "%";
|
|
|
}
|
|
|
|
|
|
return $device;
|
|
|
@@ -562,11 +569,18 @@ class StatisticsService extends Service
|
|
|
$device[$key]['type_2_title'] = Device::$type_2[$value['type_2']] ?? "";
|
|
|
|
|
|
// 百分比计算
|
|
|
- $device[$key]['rate_one'] = "100%";
|
|
|
+ //应有占比
|
|
|
+ if($value['type_2'] == Device::type_one){
|
|
|
+ $rate_one = "100";
|
|
|
+ } else{
|
|
|
+ $rate_one = "10";
|
|
|
+ }
|
|
|
+ $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_three'] = $rate_two;
|
|
|
+ $rate_three = bcmul(bcdiv($rate_two, $rate_one,2),100,2);
|
|
|
+ $device[$key]['rate_three'] = $rate_three . "%";
|
|
|
}
|
|
|
|
|
|
// --- 合计逻辑 ---
|