From 62ec8e6e3c479707a11651479941a6cc321f3bc8 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Tue, 23 Jan 2024 18:53:21 +0800 Subject: [PATCH] update --- .../lists/project/ProjectSalaryPaymentLists.php | 5 ++++- .../logic/project/ProjectSalaryPaymentLogic.php | 6 +++--- .../project/ProjectSalaryPaymentValidate.php | 15 ++++----------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/adminapi/lists/project/ProjectSalaryPaymentLists.php b/app/adminapi/lists/project/ProjectSalaryPaymentLists.php index a2cabb07b..986b5be9c 100644 --- a/app/adminapi/lists/project/ProjectSalaryPaymentLists.php +++ b/app/adminapi/lists/project/ProjectSalaryPaymentLists.php @@ -17,6 +17,7 @@ namespace app\adminapi\lists\project; use app\adminapi\lists\BaseAdminDataLists; use app\common\model\project\Project; +use app\common\model\project\ProjectSalaryDetail; use app\common\model\project\ProjectSalaryPayment; use app\common\lists\ListsSearchInterface; @@ -57,13 +58,15 @@ class ProjectSalaryPaymentLists extends BaseAdminDataLists implements ListsSearc public function lists(): array { return ProjectSalaryPayment::where($this->searchWhere) - ->field(['id', 'payment_code', 'project_id', 'payment_type', 'apply_date', 'total_amount', 'total_amount_uppercase', 'remark', 'annex']) + ->field(['id', 'payment_code', 'project_id', 'payment_type', 'apply_date', 'remark', 'annex']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty(); $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; + //总工资付款 + $item['total_amount'] = ProjectSalaryDetail::where('salary_payment_id',$item['id'])->sum('apply_amount'); return $item; }) ->toArray(); diff --git a/app/adminapi/logic/project/ProjectSalaryPaymentLogic.php b/app/adminapi/logic/project/ProjectSalaryPaymentLogic.php index 71eb864fa..821ac9007 100644 --- a/app/adminapi/logic/project/ProjectSalaryPaymentLogic.php +++ b/app/adminapi/logic/project/ProjectSalaryPaymentLogic.php @@ -52,8 +52,6 @@ class ProjectSalaryPaymentLogic extends BaseLogic 'project_id' => $params['project_id'], 'payment_type' => $params['payment_type'], 'apply_date' => strtotime($params['apply_date']), - 'total_amount' => $params['total_amount'], - 'total_amount_uppercase' => $params['total_amount_uppercase'], 'remark' => $params['remark'] ?? '', 'annex' => $params['annex']? json_encode($params['annex']) : null, ]); @@ -85,7 +83,7 @@ class ProjectSalaryPaymentLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectSalaryPayment::field('id,payment_code,project_id,payment_type,apply_date,total_amount,total_amount_uppercase,remark,annex')->findOrEmpty($params['id'])->toArray(); + $data = ProjectSalaryPayment::field('id,payment_code,project_id,payment_type,apply_date,remark,annex')->findOrEmpty($params['id'])->toArray(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; @@ -97,6 +95,8 @@ class ProjectSalaryPaymentLogic extends BaseLogic $item['person_work_type_text'] = $person->work_type_text; $item['person_deposit_bank'] = $person['deposit_bank']; $item['person_bank_no'] = $person['bank_no']; + //总工资付款 + $item['total_amount'] = ProjectSalaryDetail::where('salary_payment_id',$item['id'])->sum('apply_amount'); //总考勤收入 $daily_income = ProjectAttendanceDetail::where('person_id',$item['person_id'])->sum('daily_income'); //总施工收入 diff --git a/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php b/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php index 09d030bb0..df8ec2bdc 100644 --- a/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php +++ b/app/adminapi/validate/project/ProjectSalaryPaymentValidate.php @@ -38,9 +38,7 @@ class ProjectSalaryPaymentValidate extends BaseValidate 'project_id' => 'require|checkProject', 'payment_type' => 'require|checkPaymentType', 'apply_date' => 'require|dateFormat:Y-m-d', - 'total_amount' => 'require|float|egt:0', - 'total_amount_uppercase' => 'require', - 'annex' => 'checkFile', + 'annex' => 'checkAnnex', 'payment_detail' => 'require|checkPaymentDetail' ]; @@ -50,10 +48,6 @@ class ProjectSalaryPaymentValidate extends BaseValidate 'payment_type.require' => '请选择付款类型', 'apply_date.require' => '请选择申请日期', 'apply_date.dateFormat' => '申请日期格式错误', - 'total_amount.require' => '请填写合计金额', - 'total_amount.float' => '合计金额值必须是数字', - 'total_amount.egt' => '合计金额值必须大于等于0', - 'total_amount_uppercase.require' => '请填写合计金额大写文字', 'payment_detail.require' => '工资支付明细不能为空', ]; @@ -120,11 +114,10 @@ class ProjectSalaryPaymentValidate extends BaseValidate return true; } - public function checkFile($value): bool|string + public function checkAnnex($value): bool|string { - if($value != ''){ - $file = $value;//json_decode($value,true); - if(empty($file)){ + if(!empty($value) && $value != ''){ + if(!is_array($value)){ return '附件必须是json数组'; } }