|
@@ -99,6 +99,7 @@ class ExpenseClaimsService extends Service
|
|
|
'employee_id' => $value['employee_id'] ?? "",
|
|
'employee_id' => $value['employee_id'] ?? "",
|
|
|
'fee_id' => $value['fee_id'] ?? 0,
|
|
'fee_id' => $value['fee_id'] ?? 0,
|
|
|
'amount' => $value['amount'] ?? 0,
|
|
'amount' => $value['amount'] ?? 0,
|
|
|
|
|
+ 'entrust_amount' => $value['entrust_amount'] ?? 0,
|
|
|
'remark' => $value['remark'] ?? "",
|
|
'remark' => $value['remark'] ?? "",
|
|
|
'claim_date' => strtotime($value['claim_date']),
|
|
'claim_date' => strtotime($value['claim_date']),
|
|
|
'entrust_type' => $value['entrust_type'] ?? 0,
|
|
'entrust_type' => $value['entrust_type'] ?? 0,
|
|
@@ -155,6 +156,14 @@ class ExpenseClaimsService extends Service
|
|
|
// 判断:claim_date 必须早于 month
|
|
// 判断:claim_date 必须早于 month
|
|
|
// 如果 claim_date 是 2026-02-28,而 month 是 2026-03-01,则校验通过
|
|
// 如果 claim_date 是 2026-02-28,而 month 是 2026-03-01,则校验通过
|
|
|
if ($claimTime < $monthStart || $claimTime > $monthEnd) return [false, "第" . ($index + 1) . "行项费用产生日期必须在当前月份内(" . date("Y-m", $data['month']) . ")"];
|
|
if ($claimTime < $monthStart || $claimTime > $monthEnd) return [false, "第" . ($index + 1) . "行项费用产生日期必须在当前月份内(" . date("Y-m", $data['month']) . ")"];
|
|
|
|
|
+ if( ! empty($item['entrust_type']) ) {
|
|
|
|
|
+ if(! isset(ExpenseClaimsDetails::State_Type[$item['entrust_type']])) return [false, "第" . ($index + 1) . "委托类型不存在"];
|
|
|
|
|
+ $title = ExpenseClaimsDetails::State_Type[$item['entrust_type']];
|
|
|
|
|
+ if(! isset($item['entrust_amount'])) return [false, "第" . ($index + 1) . "行{$title}金额不能存在"];
|
|
|
|
|
+ $res = $this->checkNumber($item['entrust_amount'], 2, 'non-negative');
|
|
|
|
|
+ if (!$res['valid']) return [false, "第" . ($index + 1) . "行{$title}金额". $res['error']];
|
|
|
|
|
+ if(floatval($item['entrust_amount'] > $item['amount'])) return [false, "第" . ($index + 1) . "行{$title}金额不能超过费用金额"];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$query = ExpenseClaims::where('top_depart_id', $data['top_depart_id'])
|
|
$query = ExpenseClaims::where('top_depart_id', $data['top_depart_id'])
|