Penambahan Filter P1 = 0 pada menu Remunerasi Keseluruhan

This commit is contained in:
Ariyutta
2026-09-29 09:52:25 +07:00
parent 751a4f9283
commit 114c7fbcc9
3 changed files with 25 additions and 10 deletions
@@ -43,8 +43,9 @@ class KeseluruhanController extends Controller
$jenisPegawai = $request->jenis_pegawai ?: null;
$unit = $request->unit;
$includePppk2025 = $request->boolean('include_pppk_2025');
$includeP1Zero = $request->boolean('include_p1_zero');
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025));
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero));
return DataTables::of($rows)
->editColumn('jenis_pegawai', fn ($row) => $row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'))
@@ -71,6 +72,7 @@ class KeseluruhanController extends Controller
$jenisPegawai = $request->jenis_pegawai ?: null;
$unit = $request->unit;
$includePppk2025 = $request->boolean('include_pppk_2025');
$includeP1Zero = $request->boolean('include_p1_zero');
$unitName = '_Semua_Unit_Kerja';
if ($unit !== null && $unit !== '') {
@@ -82,7 +84,7 @@ class KeseluruhanController extends Controller
$filename = "Remunerasi_Keseluruhan_{$tahun}{$unitName}.xlsx";
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit, $includePppk2025), $filename);
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero), $filename);
}
/**
@@ -90,7 +92,7 @@ class KeseluruhanController extends Controller
* tahun terpilih. Dipakai bersama oleh data() (DataTables) dan KeseluruhanExport supaya kedua
* sisi (tampilan web & export Excel) selalu konsisten.
*/
public function getRekapRows(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false): array
public function getRekapRows(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false): array
{
$rows = $this->buildRekap($tahun, $jenisPegawai);
@@ -109,12 +111,16 @@ class KeseluruhanController extends Controller
$rows = $rows->filter(fn ($row) => ! str_contains($row['nip'] ?? '', '202521'))->values();
}
if (! $includeP1Zero) {
$rows = $rows->filter(fn ($row) => ($row['jumlah_p1'] ?? 0) > 0)->values();
}
return $rows->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
}
private function buildRekap(int $tahun, ?string $jenisPegawai): Collection
{
$cacheKey = 'remunerasi_keseluruhan_v2_'.$tahun.'_'.($jenisPegawai ?: 'semua');
$cacheKey = 'remunerasi_keseluruhan_v4_'.$tahun.'_'.($jenisPegawai ?: 'semua');
return collect(Cache::remember($cacheKey, now()->addHours(6), fn () => $this->computeRekap($tahun, $jenisPegawai)));
}