fix
This commit is contained in:
parent
78420a72f8
commit
5b9ff7c445
@ -34,12 +34,12 @@ public function reports(Request $request)
|
||||
[$today->startOfYear()->toDateTimeString(), $today->endOfYear()->toDateTimeString()]
|
||||
);
|
||||
|
||||
$client = null;
|
||||
$requestClient = null;
|
||||
if($clientId) {
|
||||
$paymentQuery->whereHas('project', function($query) use ($clientId) {
|
||||
return $query->where('client_id', '=', $clientId);
|
||||
});
|
||||
$client = Client::find($clientId);
|
||||
$requestClient = Client::find($clientId);
|
||||
}
|
||||
$paymentsInThisYear = $paymentQuery->get();
|
||||
$thisYearPaymentGroup = $this->groupAndSumPaymentsByYear($paymentsInThisYear);
|
||||
@ -63,6 +63,6 @@ public function reports(Request $request)
|
||||
'sum' => $lastYearPaymentGroup->sum(),
|
||||
],
|
||||
];
|
||||
return view('reports', ['data' => $data, 'client' => $client, 'clients' => $clients]);
|
||||
return view('reports', ['data' => $data, 'requestClient' => $requestClient, 'clients' => $clients]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@if($client)
|
||||
<div>客戶: {{ $client->name }}</div>
|
||||
@if($requestClient)
|
||||
<div>客戶: {{ $requestClient->name }}</div>
|
||||
@endif
|
||||
|
||||
今年 ({{ $data['thisYearPaymentGroup']['year'] }}) 總收入 : {{ $data['thisYearPaymentGroup']['sum'] }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user