Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3750aa82d3 | |||
| 3f49372822 | |||
| 90ebd7c545 | |||
| 1b1aed2858 | |||
| 114c7fbcc9 | |||
| 751a4f9283 |
@@ -44,11 +44,11 @@ class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatti
|
||||
return ['C'];
|
||||
}
|
||||
|
||||
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false)
|
||||
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false)
|
||||
{
|
||||
$controller = app(KeseluruhanController::class);
|
||||
|
||||
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025);
|
||||
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero);
|
||||
$this->bulanTerakhir = $controller->getBulanTerakhir($tahun);
|
||||
}
|
||||
|
||||
|
||||
@@ -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_v5_'.$tahun.'_'.($jenisPegawai ?: 'semua');
|
||||
|
||||
return collect(Cache::remember($cacheKey, now()->addHours(6), fn () => $this->computeRekap($tahun, $jenisPegawai)));
|
||||
}
|
||||
@@ -161,6 +167,7 @@ class KeseluruhanController extends Controller
|
||||
->selectRaw('SUM(rpb.p2_bruto) as total')
|
||||
->whereNull('rpb.deleted_at')
|
||||
->where('jp.periode', $periodeSemester1)
|
||||
->where('jp.active', true)
|
||||
->when($jenisPegawai, fn ($q) => $q->where('jpd.jenis_pegawai', $jenisPegawai))
|
||||
->groupBy('verifikator.pegawais.nip')
|
||||
->havingRaw('SUM(rpb.p2_bruto) > 0')
|
||||
|
||||
@@ -142,6 +142,7 @@ class P2Controller extends Controller
|
||||
->selectRaw('SUM(rpb.p2_netto) as total_p2_netto')
|
||||
->whereNull('rpb.deleted_at')
|
||||
->where('jp.periode', $periode)
|
||||
->where('jp.active', true)
|
||||
->groupBy('verifikator.pegawais.nip', 'verifikator.pegawais.nama')
|
||||
->havingRaw('SUM(rpb.p2_bruto) > 0');
|
||||
|
||||
|
||||
@@ -77,9 +77,15 @@
|
||||
<option value="dosen">Dosen</option>
|
||||
<option value="tendik">Tendik</option>
|
||||
</select>
|
||||
<div class="form-check mt-1">
|
||||
<input class="form-check-input" type="checkbox" id="include_pppk_2025">
|
||||
<label class="form-check-label" for="include_pppk_2025">PPPK 2025</label>
|
||||
<div class="d-flex align-items-center gap-3 mt-1">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="include_pppk_2025">
|
||||
<label class="form-check-label" for="include_pppk_2025">PPPK 2025</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="include_p1_zero">
|
||||
<label class="form-check-label" for="include_p1_zero">P1 = 0</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -169,6 +175,7 @@
|
||||
d.unit = $('#filter-unit').val();
|
||||
d.tahun = $('#filter-tahun').val();
|
||||
d.include_pppk_2025 = $('#include_pppk_2025').is(':checked') ? 1 : 0;
|
||||
d.include_p1_zero = $('#include_p1_zero').is(':checked') ? 1 : 0;
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
@@ -214,7 +221,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun, #include_pppk_2025').on('change', function() {
|
||||
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun, #include_pppk_2025, #include_p1_zero').on('change', function() {
|
||||
table.draw();
|
||||
});
|
||||
|
||||
@@ -239,11 +246,13 @@
|
||||
var unit = $('#filter-unit').val();
|
||||
var tahun = $('#filter-tahun').val();
|
||||
var includePppk2025 = $('#include_pppk_2025').is(':checked') ? 1 : 0;
|
||||
var includeP1Zero = $('#include_p1_zero').is(':checked') ? 1 : 0;
|
||||
|
||||
if (jenisPegawai) { params.push('jenis_pegawai=' + jenisPegawai); }
|
||||
if (unit) { params.push('unit=' + unit); }
|
||||
if (tahun) { params.push('tahun=' + tahun); }
|
||||
params.push('include_pppk_2025=' + includePppk2025);
|
||||
params.push('include_p1_zero=' + includeP1Zero);
|
||||
|
||||
var url = "{{ route('remunerasi.keseluruhan.export') }}";
|
||||
if (params.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user