fix: report

This commit is contained in:
Nawcodes 2025-04-27 18:23:37 +07:00
parent b998c9eff3
commit 5cc5bd1938
2 changed files with 18 additions and 8 deletions

View File

@ -58,7 +58,7 @@ class Dashboard extends \Filament\Pages\Dashboard implements HasForms, HasAction
public function printTrendPasienAction(): Action public function printTrendPasienAction(): Action
{ {
$filtering_date = $this->data['filtering_date']; $original_date = $this->data['filtering_date'];
if ($this->data['filtering_date']) { if ($this->data['filtering_date']) {
$filtering_date = explode(' - ', $this->data['filtering_date']); $filtering_date = explode(' - ', $this->data['filtering_date']);
$start_date = $filtering_date[0]; $start_date = $filtering_date[0];
@ -86,11 +86,11 @@ class Dashboard extends \Filament\Pages\Dashboard implements HasForms, HasAction
->scale(2) ->scale(2)
->print() // Enable print option ->print() // Enable print option
->preview() ->preview()
->filename(function ($record) use ($filtering_date) { ->filename(function ($record) use ($original_date) {
return 'trends-pasien.pdf'; return 'trends-pasien.pdf';
}) })
->content(function ($record) use ($data, $filtering_date) { ->content(function ($record) use ($data, $original_date) {
return view('components.pdf.trends-pasien', ['pasien' => $data, 'filtering_date' => $filtering_date]); return view('components.pdf.trends-pasien', ['pasien' => $data, 'filtering_date' => $original_date]);
}) })
->savePdf() // Enable save as PDF option ->savePdf() // Enable save as PDF option
->requiresConfirmation() // Show confirmation modal ->requiresConfirmation() // Show confirmation modal
@ -103,7 +103,7 @@ class Dashboard extends \Filament\Pages\Dashboard implements HasForms, HasAction
public function printTrendPendapatanAction(): Action public function printTrendPendapatanAction(): Action
{ {
$filtering_date = $this->data['filtering_date']; $original_date = $this->data['filtering_date'];
if ($this->data['filtering_date']) { if ($this->data['filtering_date']) {
$filtering_date = explode(' - ', $this->data['filtering_date']); $filtering_date = explode(' - ', $this->data['filtering_date']);
$start_date = $filtering_date[0]; $start_date = $filtering_date[0];
@ -128,11 +128,11 @@ class Dashboard extends \Filament\Pages\Dashboard implements HasForms, HasAction
->scale(2) ->scale(2)
->print() ->print()
->preview() ->preview()
->filename(function ($record) use ($filtering_date) { ->filename(function ($record) use ($original_date) {
return 'trends-pendapatan.pdf'; return 'trends-pendapatan.pdf';
}) })
->content(function ($record) use ($data, $filtering_date) { ->content(function ($record) use ($data, $original_date) {
return view('components.pdf.trends-pendapatan', ['pendapatans' => $data, 'filtering_date' => $filtering_date]); return view('components.pdf.trends-pendapatan', ['pendapatans' => $data, 'filtering_date' => $original_date]);
}) })
->savePdf() // Enable save as PDF option ->savePdf() // Enable save as PDF option
->requiresConfirmation() // Show confirmation modal ->requiresConfirmation() // Show confirmation modal

View File

@ -43,12 +43,22 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@php
$total_pasien = 0;
@endphp
@foreach ($pasien as $tanggal => $jumlah) @foreach ($pasien as $tanggal => $jumlah)
@php
$total_pasien += $jumlah;
@endphp
<tr> <tr>
<td>{{ $tanggal }}</td> <td>{{ $tanggal }}</td>
<td>{{ $jumlah }}</td> <td>{{ $jumlah }}</td>
</tr> </tr>
@endforeach @endforeach
<tr>
<td colspan="1">Total Pasien</td>
<td>{{ $total_pasien }}</td>
</tr>
</tbody> </tbody>
</table> </table>