Penambahn P1 Dev

This commit is contained in:
Ariyutta
2026-10-20 10:24:22 +07:00
parent 8418a63fc0
commit ee0e6deacc
43 changed files with 5406 additions and 44 deletions
@@ -192,15 +192,17 @@ class P1Controller extends Controller
$previousYear = $bulan === 1 ? $tahun - 1 : $tahun;
$jenisPegawai = $request->input('jenis_pegawai');
$arah = $request->input('arah', '');
$includePppk2025 = $request->boolean('include_pppk_2025');
$monthNames = [
1 => 'Januari', 2 => 'Februari', 3 => 'Maret', 4 => 'April', 5 => 'Mei', 6 => 'Juni',
7 => 'Juli', 8 => 'Agustus', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Desember',
];
$baseQuery = function (int $queryYear, int $queryMonth) use ($unit, $jenisPegawai) {
$baseQuery = function (int $queryYear, int $queryMonth) use ($unit, $jenisPegawai, $includePppk2025) {
return P1::query()
->where('tahun', $queryYear)
->where('bulan', $queryMonth)
->when(! $includePppk2025, fn ($query) => $query->where('nip', 'not like', '%202521%'))
->when($unit !== null && $unit !== '', fn ($query) => $query->where('id_unit_kerja', $unit))
->when($jenisPegawai === 'dosen' || $jenisPegawai === 'tendik', fn ($query) => $query->whereRaw('LOWER(jenis_pegawai) = ?', [$jenisPegawai]))
->get()
@@ -522,6 +524,7 @@ class P1Controller extends Controller
$tahun = (int) ($request->tahun ?? $tahunNow);
$bulan = $request->bulan ?? null;
$arah = $request->arah ?? '';
$includePppk2025 = $request->boolean('include_pppk_2025');
$unitIdForModel = ($unit == 99) ? 0 : $unit;
@@ -544,13 +547,13 @@ class P1Controller extends Controller
$namaBulanSekarang = $bulanNames[(int) $bulanNow];
$filename = "P1_Perbandingan_Januari_sampai_{$namaBulanSekarang}_{$tahun}{$unitName}.xlsx";
return Excel::download(new P1PerbandinganExport($jenisPegawai, $tahun, null, $unitIdForModel, $arah), $filename);
return Excel::download(new P1PerbandinganExport($jenisPegawai, $tahun, null, $unitIdForModel, $arah, $includePppk2025), $filename);
}
$bulanName = $bulanNames[(int) $bulan];
$filename = "P1_Perbandingan_{$bulanName}_{$tahun}{$unitName}.xlsx";
return Excel::download(new P1PerbandinganExport($jenisPegawai, $tahun, (int) $bulan, $unitIdForModel, $arah), $filename);
return Excel::download(new P1PerbandinganExport($jenisPegawai, $tahun, (int) $bulan, $unitIdForModel, $arah, $includePppk2025), $filename);
}
public function logs(Request $request): JsonResponse