|
|
@@ -209,18 +209,18 @@ class AuxiliaryAccountService extends Service
|
|
|
$model->crt_id = $user['id'];
|
|
|
$model->top_depart_id = $user['top_depart_id'];
|
|
|
$model->save();
|
|
|
- $this->saveDetail($model->id, time(), $data,$user['id']);
|
|
|
+ $this->saveDetail($model->id, time(), $data,$user['id'],$user['top_depart_id']);
|
|
|
|
|
|
DB::commit();
|
|
|
}catch (\Exception $exception){
|
|
|
DB::rollBack();
|
|
|
- return [false,$exception->getMessage()];
|
|
|
+ return [false,$exception->getLine().':'.$exception->getMessage()];
|
|
|
}
|
|
|
|
|
|
return [true, ''];
|
|
|
}
|
|
|
|
|
|
- private function saveDetail($id, $time, $data,$crt_id){
|
|
|
+ private function saveDetail($id, $time, $data,$crt_id,$user){
|
|
|
if(! empty($data['details'])){
|
|
|
$unit = [];
|
|
|
foreach ($data['details'] as $value){
|
|
|
@@ -239,7 +239,7 @@ class AuxiliaryAccountService extends Service
|
|
|
'entrust2_amount' => $value['entrust2_amount']??0,
|
|
|
'aggregation_amount' => $value['aggregation_amount']??00,
|
|
|
'total_amount' => $value['total_amount'],
|
|
|
- 'top_depart_id' => $data['top_depart_id'],
|
|
|
+ 'top_depart_id' => $user['top_depart_id'],
|
|
|
'item_id' => $value['item_id'],
|
|
|
'crt_time' => $time,
|
|
|
'crt_id' => $crt_id,
|
|
|
@@ -286,7 +286,7 @@ class AuxiliaryAccountService extends Service
|
|
|
if ($claimTime < $monthStart || $claimTime > $monthEnd) return [false, "第" . ($index + 1) . "凭证日期必须早于当前结算月份(" . date("Y-m", $data['month']) . ")"];
|
|
|
}
|
|
|
|
|
|
- $query = AuxiliaryAccount::where('top_depart_id', $data['top_depart_id'])
|
|
|
+ $query = AuxiliaryAccount::where('top_depart_id', $user['top_depart_id'])
|
|
|
->where('month', $monthStart)
|
|
|
->where('del_time', 0);
|
|
|
|