|
|
@@ -53,14 +53,13 @@ class ExpenseClaimsService extends Service
|
|
|
|
|
|
try {
|
|
|
DB::beginTransaction();
|
|
|
- $month = strtotime(date("Ymd", strtotime($data['month'])));
|
|
|
$model = new ExpenseClaims();
|
|
|
$model->code = $this->generateBillNo([
|
|
|
'top_depart_id' => $user['top_depart_id'],
|
|
|
'type' => ExpenseClaims::Order_type,
|
|
|
- 'period' => $month
|
|
|
+ 'period' => date("Ym", $data['month'])
|
|
|
]);
|
|
|
- $model->month = $month;
|
|
|
+ $model->month = $data['month'];
|
|
|
$model->crt_id = $user['id'];
|
|
|
$model->top_depart_id = $data['top_depart_id'];
|
|
|
$model->save();
|
|
|
@@ -121,11 +120,13 @@ class ExpenseClaimsService extends Service
|
|
|
|
|
|
private function expenseClaimsRule(&$data, $user, $is_add = true){
|
|
|
$data['top_depart_id'] = $user['top_depart_id'];
|
|
|
- if(!isset($data['month'])) return [false,"月份必传"];
|
|
|
- $monthStr = $data['month']; // 假设是 "2026-03"
|
|
|
- $monthStart = strtotime($monthStr); // 2026-03-01 00:00:00
|
|
|
+ if (empty($data['month'])) return [false, '月份不能为空'];
|
|
|
+ $data['month'] = $this->changeDateToDate($data['month']);
|
|
|
+// if(!isset($data['month'])) return [false,"月份必传"];
|
|
|
+// $monthStr = $data['month']; // 假设是 "2026-03"
|
|
|
+ $monthStart = $data['month'];
|
|
|
// 获取该月最后一秒:下个月 1 号减去 1 秒
|
|
|
- $monthEnd = strtotime("$monthStr +1 month") - 1;
|
|
|
+ $monthEnd = strtotime('+1 month', $monthStart) - 1;
|
|
|
if(empty($data['details'])) return [false, '项目费用报销单详情不能为空'];
|
|
|
foreach ($data['details'] as $index => $item) {
|
|
|
if(empty($item['item_id'])) return [false, "第" . ($index + 1) . "项目不能为空"];
|
|
|
@@ -162,11 +163,10 @@ class ExpenseClaimsService extends Service
|
|
|
|
|
|
try {
|
|
|
DB::beginTransaction();
|
|
|
- $month = strtotime(date("Ymd", strtotime($data['month'])));
|
|
|
$model = ExpenseClaims::where('id',$data['id'])->first();
|
|
|
- $model->month = $month;
|
|
|
- $model->crt_id = $user['id'];
|
|
|
- $model->save();
|
|
|
+// $model->month = $data['month'];
|
|
|
+// $model->crt_id = $user['id'];
|
|
|
+// $model->save();
|
|
|
|
|
|
$time = time();
|
|
|
$old = ExpenseClaimsDetails::where('del_time',0)
|