gogs пре 1 месец
родитељ
комит
575c6321b3
1 измењених фајлова са 15 додато и 2 уклоњено
  1. 15 2
      app/Service/BIService.php

+ 15 - 2
app/Service/BIService.php

@@ -41,9 +41,14 @@ class BIService extends Service
 
     public function homePageData($data, $user)
     {
+        $model = Item::TopClear($user,$data);
+        $start_time = $model->where('del_time',0)
+            ->orderby('id', 'desc')->value("start_time");
+        $year =  date('Y-01-01',$start_time);
+        $data['month_start'] = $year;
+//        $data['month_start'] = "2024-01-01";
         list($status, $month_start, $month_end) = $this->commonRule($data);
         if (!$status) return [false, $month_start];
-
         //人员费用
         list($total_man, $salary_map) = $this->getEmployeeSalary($month_start, $month_end, $data, $user);
 
@@ -95,13 +100,20 @@ class BIService extends Service
         $man_work = $this->manWork($month_start, $month_end, $data, $user);
 
         //加计扣除金额
+        $statisticService = new StatisticService();
+        $attendance = $statisticService->employeeAttendanceMonthStatistic(["year"=>$year, "s" => "/api/employeeAttendanceMonthStatistic"],$user);
         $discount = 0; //todo
+        foreach ($attendance[1]['list'] as $v){
+            $discount += $v['jj_total_amount']*100;
+        }
+
+
 
         return [true, [
             'rd_total' => $total,
             'rd_unit' => '¥',
             'rd_title' => '研发费用总额', //-----
-            'discount_total' => $discount,
+            'discount_total' => round($discount/100,2),
             'discount_unit' => '¥',
             'discount_title' => '加计扣除金额', //------
             'over_time' => $over_time, // 加班
@@ -110,6 +122,7 @@ class BIService extends Service
             'rd_trend' => $rd_trend, //研发费用趋势
             'rd_rate' => $rd_rate, // 研发费用报销占比
             'man_work' => $man_work, //项目人员工时汇总
+            'year' => date('Y',strtotime($year)),
         ]];
     }