update
This commit is contained in:
parent
c1c9eb3d80
commit
62ec8e6e3c
@ -17,6 +17,7 @@ namespace app\adminapi\lists\project;
|
|||||||
|
|
||||||
use app\adminapi\lists\BaseAdminDataLists;
|
use app\adminapi\lists\BaseAdminDataLists;
|
||||||
use app\common\model\project\Project;
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectSalaryDetail;
|
||||||
use app\common\model\project\ProjectSalaryPayment;
|
use app\common\model\project\ProjectSalaryPayment;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
|
||||||
@ -57,13 +58,15 @@ class ProjectSalaryPaymentLists extends BaseAdminDataLists implements ListsSearc
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return ProjectSalaryPayment::where($this->searchWhere)
|
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)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function($item){
|
||||||
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||||
$item['project_name'] = $project['name'];
|
$item['project_name'] = $project['name'];
|
||||||
$item['project_code'] = $project['project_code'];
|
$item['project_code'] = $project['project_code'];
|
||||||
|
//总工资付款
|
||||||
|
$item['total_amount'] = ProjectSalaryDetail::where('salary_payment_id',$item['id'])->sum('apply_amount');
|
||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -52,8 +52,6 @@ class ProjectSalaryPaymentLogic extends BaseLogic
|
|||||||
'project_id' => $params['project_id'],
|
'project_id' => $params['project_id'],
|
||||||
'payment_type' => $params['payment_type'],
|
'payment_type' => $params['payment_type'],
|
||||||
'apply_date' => strtotime($params['apply_date']),
|
'apply_date' => strtotime($params['apply_date']),
|
||||||
'total_amount' => $params['total_amount'],
|
|
||||||
'total_amount_uppercase' => $params['total_amount_uppercase'],
|
|
||||||
'remark' => $params['remark'] ?? '',
|
'remark' => $params['remark'] ?? '',
|
||||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||||
]);
|
]);
|
||||||
@ -85,7 +83,7 @@ class ProjectSalaryPaymentLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function detail($params): array
|
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();
|
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||||
$data['project_name'] = $project['name'];
|
$data['project_name'] = $project['name'];
|
||||||
$data['project_code'] = $project['project_code'];
|
$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_work_type_text'] = $person->work_type_text;
|
||||||
$item['person_deposit_bank'] = $person['deposit_bank'];
|
$item['person_deposit_bank'] = $person['deposit_bank'];
|
||||||
$item['person_bank_no'] = $person['bank_no'];
|
$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');
|
$daily_income = ProjectAttendanceDetail::where('person_id',$item['person_id'])->sum('daily_income');
|
||||||
//总施工收入
|
//总施工收入
|
||||||
|
@ -38,9 +38,7 @@ class ProjectSalaryPaymentValidate extends BaseValidate
|
|||||||
'project_id' => 'require|checkProject',
|
'project_id' => 'require|checkProject',
|
||||||
'payment_type' => 'require|checkPaymentType',
|
'payment_type' => 'require|checkPaymentType',
|
||||||
'apply_date' => 'require|dateFormat:Y-m-d',
|
'apply_date' => 'require|dateFormat:Y-m-d',
|
||||||
'total_amount' => 'require|float|egt:0',
|
'annex' => 'checkAnnex',
|
||||||
'total_amount_uppercase' => 'require',
|
|
||||||
'annex' => 'checkFile',
|
|
||||||
'payment_detail' => 'require|checkPaymentDetail'
|
'payment_detail' => 'require|checkPaymentDetail'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -50,10 +48,6 @@ class ProjectSalaryPaymentValidate extends BaseValidate
|
|||||||
'payment_type.require' => '请选择付款类型',
|
'payment_type.require' => '请选择付款类型',
|
||||||
'apply_date.require' => '请选择申请日期',
|
'apply_date.require' => '请选择申请日期',
|
||||||
'apply_date.dateFormat' => '申请日期格式错误',
|
'apply_date.dateFormat' => '申请日期格式错误',
|
||||||
'total_amount.require' => '请填写合计金额',
|
|
||||||
'total_amount.float' => '合计金额值必须是数字',
|
|
||||||
'total_amount.egt' => '合计金额值必须大于等于0',
|
|
||||||
'total_amount_uppercase.require' => '请填写合计金额大写文字',
|
|
||||||
'payment_detail.require' => '工资支付明细不能为空',
|
'payment_detail.require' => '工资支付明细不能为空',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -120,11 +114,10 @@ class ProjectSalaryPaymentValidate extends BaseValidate
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkFile($value): bool|string
|
public function checkAnnex($value): bool|string
|
||||||
{
|
{
|
||||||
if($value != ''){
|
if(!empty($value) && $value != ''){
|
||||||
$file = $value;//json_decode($value,true);
|
if(!is_array($value)){
|
||||||
if(empty($file)){
|
|
||||||
return '附件必须是json数组';
|
return '附件必须是json数组';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user