cqp 2 месяцев назад
Родитель
Сommit
47ce09a1a7
3 измененных файлов с 62 добавлено и 11 удалено
  1. 9 3
      app/Service/ImportService.php
  2. 17 5
      app/Service/PersonSalaryService.php
  3. 36 3
      config/excel/monthPsOrder.php

+ 9 - 3
app/Service/ImportService.php

@@ -1983,9 +1983,12 @@ class ImportService extends Service
         $monthIdx = array_search('month', $keys);
         $monthIdx = array_search('month', $keys);
         $empIdx = array_search('employee_id', $keys);
         $empIdx = array_search('employee_id', $keys);
 
 
-        $numIdx = array_search('salary', $keys);
+        $numIdx = array_search('base_salary', $keys);
         $num2Idx = array_search('social_insurance', $keys);
         $num2Idx = array_search('social_insurance', $keys);
         $num3Idx = array_search('public_housing_fund', $keys);
         $num3Idx = array_search('public_housing_fund', $keys);
+        $num4Idx = array_search('performance_salary', $keys);
+        $num5Idx = array_search('bonus', $keys);
+        $num6Idx = array_search('other', $keys);
 
 
         // 1. 预加载基础数据
         // 1. 预加载基础数据
         $allEmpNumbers = array_filter(array_unique(array_column($array, $empIdx)));
         $allEmpNumbers = array_filter(array_unique(array_column($array, $empIdx)));
@@ -2097,9 +2100,12 @@ class ImportService extends Service
 
 
             // E. 数字格式校验
             // E. 数字格式校验
             $numChecks = [
             $numChecks = [
-                $numIdx => '工资总额',
+                $numIdx => '基本工资',
                 $num2Idx => '社保',
                 $num2Idx => '社保',
-                $num3Idx => '公积金'
+                $num3Idx => '公积金',
+                $num4Idx => '绩效工资',
+                $num5Idx => '奖金',
+                $num6Idx => '其他',
             ];
             ];
             foreach ($numChecks as $idx => $label) {
             foreach ($numChecks as $idx => $label) {
                 $res = $this->checkNumber($row[$idx] ?? 0, 2, 'non-negative');
                 $res = $this->checkNumber($row[$idx] ?? 0, 2, 'non-negative');

+ 17 - 5
app/Service/PersonSalaryService.php

@@ -71,7 +71,10 @@ class PersonSalaryService extends Service
                 $unit[] = [
                 $unit[] = [
                     'main_id' => $id,
                     'main_id' => $id,
                     'employee_id' => $value['employee_id'],
                     'employee_id' => $value['employee_id'],
-                    'salary' => $value['salary'],
+                    'base_salary' => $value['base_salary'],
+                    'performance_salary' => $value['performance_salary'],
+                    'bonus' => $value['bonus'],
+                    'other' => $value['other'],
                     'social_insurance' => $value['social_insurance'],
                     'social_insurance' => $value['social_insurance'],
                     'public_housing_fund' => $value['public_housing_fund'],
                     'public_housing_fund' => $value['public_housing_fund'],
                     'crt_time' => $time,
                     'crt_time' => $time,
@@ -85,7 +88,7 @@ class PersonSalaryService extends Service
     private function getDetail($id){
     private function getDetail($id){
         $data = MonthlyPsOrderDetails::where('del_time',0)
         $data = MonthlyPsOrderDetails::where('del_time',0)
             ->where('main_id', $id)
             ->where('main_id', $id)
-            ->select('employee_id', 'salary', 'social_insurance', 'public_housing_fund')
+            ->select('employee_id', 'base_salary', 'social_insurance', 'public_housing_fund', 'performance_salary', 'bonus', 'other')
             ->get()->toArray();
             ->get()->toArray();
 
 
         $id = array_column($data,'employee_id');
         $id = array_column($data,'employee_id');
@@ -208,12 +211,18 @@ class PersonSalaryService extends Service
         if(empty($data['details'])) return [false, '人员月度工时单明细不能为空'];
         if(empty($data['details'])) return [false, '人员月度工时单明细不能为空'];
         foreach ($data['details'] as $key => $value){
         foreach ($data['details'] as $key => $value){
             if(empty($value['employee_id'])) return [false, '人员不能为空'];
             if(empty($value['employee_id'])) return [false, '人员不能为空'];
-            $res = $this->checkNumber($value['salary'],2,'non-negative');
-            if(! $res['valid']) return [false,'工资:' . $res['error']];
+            $res = $this->checkNumber($value['base_salary'],2,'non-negative');
+            if(! $res['valid']) return [false,'基本工资:' . $res['error']];
+            $res = $this->checkNumber($value['performance_salary'],2,'non-negative');
+            if(! $res['valid']) return [false,'绩效工资:' . $res['error']];
             $res = $this->checkNumber($value['social_insurance'],2,'non-negative');
             $res = $this->checkNumber($value['social_insurance'],2,'non-negative');
             if(! $res['valid']) return [false,'社保:' . $res['error']];
             if(! $res['valid']) return [false,'社保:' . $res['error']];
             $res = $this->checkNumber($value['public_housing_fund'],2,'non-negative');
             $res = $this->checkNumber($value['public_housing_fund'],2,'non-negative');
             if(! $res['valid']) return [false,'公积金:' . $res['error']];
             if(! $res['valid']) return [false,'公积金:' . $res['error']];
+            $res = $this->checkNumber($value['bonus'],2,'non-negative');
+            if(! $res['valid']) return [false,'奖金工资:' . $res['error']];
+            $res = $this->checkNumber($value['other'],2,'non-negative');
+            if(! $res['valid']) return [false,'其他:' . $res['error']];
             $data['details'][$key]['top_depart_id'] = $data['top_depart_id'];
             $data['details'][$key]['top_depart_id'] = $data['top_depart_id'];
         }
         }
         list($status, $msg) = $this->checkArrayRepeat($data['details'],'employee_id','人员');
         list($status, $msg) = $this->checkArrayRepeat($data['details'],'employee_id','人员');
@@ -305,9 +314,12 @@ class PersonSalaryService extends Service
             $res[$item->main_id][] = [
             $res[$item->main_id][] = [
                 'employee_number' => $tmpEmp ? $tmpEmp->number : '',
                 'employee_number' => $tmpEmp ? $tmpEmp->number : '',
                 'employee_title' => $tmpEmp ? $tmpEmp->title : '',
                 'employee_title' => $tmpEmp ? $tmpEmp->title : '',
-                'salary'     => $item->salary,
+                'base_salary'     => $item->base_salary,
                 'social_insurance'  => $item->social_insurance,
                 'social_insurance'  => $item->social_insurance,
                 'public_housing_fund'    => $item->public_housing_fund,
                 'public_housing_fund'    => $item->public_housing_fund,
+                'performance_salary'     => $item->performance_salary,
+                'bonus'     => $item->bonus,
+                'other'     => $item->other,
             ];
             ];
         }
         }
         return $res; // 返回 [main_id => [detail_row, detail_row]]
         return $res; // 返回 [main_id => [detail_row, detail_row]]

+ 36 - 3
config/excel/monthPsOrder.php

@@ -47,9 +47,9 @@ return [
             'comments' => '选填(便于操作人查看编码对应的名称)'
             'comments' => '选填(便于操作人查看编码对应的名称)'
         ],
         ],
         [
         [
-            'key' =>'salary',
-            'export' =>'salary',
-            'value' => '工资总额',
+            'key' =>'base_salary',
+            'export' =>'base_salary',
+            'value' => '基本工资',
             'required' => true,
             'required' => true,
             'is_main' => false,
             'is_main' => false,
             'default' => 0,
             'default' => 0,
@@ -57,6 +57,17 @@ return [
             'enums' => [],
             'enums' => [],
             'comments' => '必填'
             'comments' => '必填'
         ],
         ],
+        [
+            'key' =>'performance_salary',
+            'export' =>'performance_salary',
+            'value' => '绩效工资',
+            'required' => false,
+            'is_main' => false,
+            'default' => 0,
+            'unique' => false,
+            'enums' => [],
+            'comments' => '必填'
+        ],
         [
         [
             'key' =>'social_insurance',
             'key' =>'social_insurance',
             'export' =>'social_insurance',
             'export' =>'social_insurance',
@@ -79,5 +90,27 @@ return [
             'enums' => [],
             'enums' => [],
             'comments' => '必填'
             'comments' => '必填'
         ],
         ],
+        [
+            'key' =>'bonus',
+            'export' =>'bonus',
+            'value' => '奖金',
+            'required' => false,
+            'is_main' => false,
+            'default' => 0,
+            'unique' => false,
+            'enums' => [],
+            'comments' => ''
+        ],
+        [
+            'key' =>'other',
+            'export' =>'other',
+            'value' => '其他',
+            'required' => false,
+            'is_main' => false,
+            'default' => 0,
+            'unique' => false,
+            'enums' => [],
+            'comments' => ''
+        ],
     ]
     ]
 ];
 ];