Penambahan Kekurangan P2 Manual
This commit is contained in:
@@ -227,7 +227,11 @@ class KeseluruhanController extends Controller
|
||||
*/
|
||||
private function rekapCacheKey(int $tahun, ?string $jenisPegawai, string $sumberP1): string
|
||||
{
|
||||
$key = 'remunerasi_keseluruhan_v8_'.$tahun.'_'.($jenisPegawai ?: 'semua');
|
||||
$key = 'remunerasi_keseluruhan_v9_'.$tahun.'_'.($jenisPegawai ?: 'semua');
|
||||
|
||||
// Cache ikut berganti bila JSON kekurangan P2 diubah.
|
||||
$mtimeP2 = collect(glob(resource_path("data/{$tahun}/kekurangan_p2_*.json")) ?: [])->map(fn ($f) => filemtime($f))->max();
|
||||
$key .= '_p2json_'.($mtimeP2 ?? 0);
|
||||
|
||||
if ($sumberP1 === 'dawai') {
|
||||
$file = P1DawaiSnapshot::latestPath($tahun);
|
||||
@@ -341,11 +345,11 @@ class KeseluruhanController extends Controller
|
||||
$p2Pajak = $p2Rows->map(fn ($row) => (float) $row->total_pajak);
|
||||
$p2Netto = $p2Rows->map(fn ($row) => (float) $row->total_netto);
|
||||
|
||||
// Fallback untuk pegawai (CPNS) yang P2-nya belum tersimpan di remunerasi_per_bulans:
|
||||
// ambil dari snapshot JSON hasil perhitungan (read-only), tanpa menulis ke DB.
|
||||
// Snapshot JSON hasil perhitungan (read-only, tanpa menulis ke DB): bila pegawai ada di JSON
|
||||
// dengan P2 > 0, nilai JSON menimpa nilai dari DB (juga untuk pegawai yang belum ada di DB, mis. CPNS).
|
||||
foreach ($this->loadP2Snapshot($tahun, $periodeSemester1) as $nip => $nilai) {
|
||||
$key = $normalize($nip);
|
||||
if (! $p2->has($key) && ($nilai['p2_bruto'] ?? 0) > 0) {
|
||||
if (($nilai['p2_bruto'] ?? 0) > 0) {
|
||||
$p2->put($key, (float) $nilai['p2_bruto']);
|
||||
$p2Pajak->put($key, (float) ($nilai['p2_pajak'] ?? 0));
|
||||
$p2Netto->put($key, (float) ($nilai['p2_netto'] ?? 0));
|
||||
@@ -374,9 +378,9 @@ class KeseluruhanController extends Controller
|
||||
$r13 = collect($r13Data)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_r13'] ?? 0));
|
||||
$r13Netto = collect($r13Data)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_r13_setelah_pajak'] ?? 0));
|
||||
|
||||
// 5. Publikasi = seluruh periode yang namanya memuat tahun terpilih (mis. "2026 Semester 1"
|
||||
// maupun "2025/2026 Ganjil"), karena publikasi tidak terikat pada satu format periode tertentu.
|
||||
$periodeIds = Periode::where('nama', 'LIKE', "%{$tahun}%")->pluck('id_periode');
|
||||
// 5. Publikasi = hanya periode Semester 1 tahun terpilih (mis. 401 untuk 2026), sama seperti P2;
|
||||
// Semester 2 belum waktunya perhitungan dan periode Ganjil/Genap tahun sebelumnya tidak dihitung.
|
||||
$periodeIds = collect($periodeSemester1 ? [$periodeSemester1] : []);
|
||||
|
||||
$publikasiQuery = Publikasi::query()
|
||||
->whereIn('periode', $periodeIds)
|
||||
|
||||
Reference in New Issue
Block a user