Merge pull request 'Perbaikan P1 Remunerasi' (#6) from development into main #10
@@ -27,16 +27,20 @@ class SimulasiJabatanExport implements WithMultipleSheets
|
|||||||
/** Nilai filter khusus "Universitas" = seluruh unit non-fakultas. */
|
/** Nilai filter khusus "Universitas" = seluruh unit non-fakultas. */
|
||||||
public const UNIT_UNIVERSITAS = 99;
|
public const UNIT_UNIVERSITAS = 99;
|
||||||
|
|
||||||
|
/** Poin Grade 14-17 statis untuk simulasi dosen bergrade < 14. */
|
||||||
|
public const GRADE_1417_POIN = 12;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly int $periode,
|
private readonly int $periode,
|
||||||
private readonly ?int $bulan = null,
|
private readonly ?int $bulan = null,
|
||||||
private readonly ?string $jenis = null,
|
private readonly ?string $jenis = null,
|
||||||
private readonly int|string|null $unitKerjaId = null,
|
private readonly int|string|null $unitKerjaId = null,
|
||||||
|
private readonly bool $grade12 = false,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function sheets(): array
|
public function sheets(): array
|
||||||
{
|
{
|
||||||
$rows = SimulasiJabatanSheet::rows($this->periode, $this->bulan, $this->unitKerjaId, $this->jenis);
|
$rows = SimulasiJabatanSheet::rows($this->periode, $this->bulan, $this->unitKerjaId, $this->jenis, false, $this->grade12);
|
||||||
$sheets = [new SimulasiJabatanSheet('All', $rows)];
|
$sheets = [new SimulasiJabatanSheet('All', $rows)];
|
||||||
foreach ($rows->groupBy(fn ($row) => $row['unit_kerja'] ?: 'Tanpa Unit Kerja') as $unit => $unitRows) {
|
foreach ($rows->groupBy(fn ($row) => $row['unit_kerja'] ?: 'Tanpa Unit Kerja') as $unit => $unitRows) {
|
||||||
$sheets[] = new SimulasiJabatanSheet($unit, $unitRows->values());
|
$sheets[] = new SimulasiJabatanSheet($unit, $unitRows->values());
|
||||||
@@ -49,7 +53,7 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
|||||||
{
|
{
|
||||||
public function __construct(private readonly string $sheetTitle, private readonly Collection $items) {}
|
public function __construct(private readonly string $sheetTitle, private readonly Collection $items) {}
|
||||||
|
|
||||||
public static function rows(int $periode, ?int $bulan = null, int|string|null $unitKerjaId = null, ?string $jenis = null, bool $raw = false): Collection
|
public static function rows(int $periode, ?int $bulan = null, int|string|null $unitKerjaId = null, ?string $jenis = null, bool $raw = false, bool $grade12 = false): Collection
|
||||||
{
|
{
|
||||||
$q = JabatanPegawaiDetailPoin::query()->select([
|
$q = JabatanPegawaiDetailPoin::query()->select([
|
||||||
'verifikator.jabatan_pegawais.nip', 'verifikator.poin_per_bulans.jabatan_pegawai_detail_id',
|
'verifikator.jabatan_pegawais.nip', 'verifikator.poin_per_bulans.jabatan_pegawai_detail_id',
|
||||||
@@ -130,7 +134,7 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
|||||||
return collect($dp ?: [])->sum(fn ($u) => collect($u['adhoc_kegiatan'] ?? [])->sum('poin_p2'));
|
return collect($dp ?: [])->sum(fn ($u) => collect($u['adhoc_kegiatan'] ?? [])->sum('poin_p2'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return $source->map(function ($r) use ($excel, $details, $monthCounts, $jfPrices, $jttPrices, $remunSums, $adhocByNip, $raw) {
|
return $source->map(function ($r) use ($excel, $details, $monthCounts, $jfPrices, $jttPrices, $remunSums, $adhocByNip, $raw, $grade12) {
|
||||||
$d = $details->get($r->jabatan_pegawai_detail_id);
|
$d = $details->get($r->jabatan_pegawai_detail_id);
|
||||||
$price = function ($id, $model, $period) use ($jfPrices, $jttPrices) { return $id ? (float) (($model === JabatanFungsionalRiwayat::class ? $jfPrices : $jttPrices)->get($id.'-'.$period)?->harga ?? 0) : 0; };
|
$price = function ($id, $model, $period) use ($jfPrices, $jttPrices) { return $id ? (float) (($model === JabatanFungsionalRiwayat::class ? $jfPrices : $jttPrices)->get($id.'-'.$period)?->harga ?? 0) : 0; };
|
||||||
$jf374=$price($d?->jabatan_fungsional_id, JabatanFungsionalRiwayat::class,374); $jf377=$price($d?->jabatan_fungsional_id,JabatanFungsionalRiwayat::class,377);
|
$jf374=$price($d?->jabatan_fungsional_id, JabatanFungsionalRiwayat::class,374); $jf377=$price($d?->jabatan_fungsional_id,JabatanFungsionalRiwayat::class,377);
|
||||||
@@ -158,8 +162,17 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
|||||||
$remun = $remunSums->get($d?->jabatan_pegawai_id);
|
$remun = $remunSums->get($d?->jabatan_pegawai_id);
|
||||||
$hasRemun = $remun && (float) $remun->p2_bruto_sum > 0;
|
$hasRemun = $remun && (float) $remun->p2_bruto_sum > 0;
|
||||||
$final374 = $final377 = $finalExcel = 0.0;
|
$final374 = $final377 = $finalExcel = 0.0;
|
||||||
|
$final374g12 = $final377g12 = $finalExcelg12 = 0.0;
|
||||||
$adhocP2 = (float) ($adhocByNip[$r->nip] ?? 0) * 660000 / 6;
|
$adhocP2 = (float) ($adhocByNip[$r->nip] ?? 0) * 660000 / 6;
|
||||||
|
|
||||||
|
// Simulasi opsional: dosen yang TIDAK punya grade 14-17 pada jabatan
|
||||||
|
// fungsional MAUPUN jabatan tugas tambahan → tambahkan 12 poin (statis)
|
||||||
|
// ke total poin P2 sebelum dibagi JF/JTT, sama seperti pegawai grade 14-17.
|
||||||
|
$gradeJfVal = $jfPrices->get(($d?->jabatan_fungsional_id).'-377')?->grade ?? $jfPrices->get(($d?->jabatan_fungsional_id).'-374')?->grade;
|
||||||
|
$gradeJttVal = $jttPrices->get(($d?->jabatan_tambahan_id).'-377')?->grade ?? $jttPrices->get(($d?->jabatan_tambahan_id).'-374')?->grade;
|
||||||
|
$is1417 = fn ($g) => is_numeric($g) && (int) $g >= 14;
|
||||||
|
$eligibleGrade12 = ! $isTendik && ! $is1417($gradeJfVal) && ! $is1417($gradeJttVal);
|
||||||
|
|
||||||
if ($isTendik) {
|
if ($isTendik) {
|
||||||
// Tendik tidak memakai model pecah JF/JTT lama sama sekali.
|
// Tendik tidak memakai model pecah JF/JTT lama sama sekali.
|
||||||
$jf = $jtt = 0.0;
|
$jf = $jtt = 0.0;
|
||||||
@@ -186,6 +199,20 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
|||||||
$final374 = $adhocPortion377 + $jfPortion377 * $ratio($jf374, $jf377) + $jttPortion377 * $ratio($jtt374, $jtt377);
|
$final374 = $adhocPortion377 + $jfPortion377 * $ratio($jf374, $jf377) + $jttPortion377 * $ratio($jtt374, $jtt377);
|
||||||
$finalExcel = $adhocPortion377 + $jfPortion377 * $ratio($jfExcel, $jf377) + $jttPortion377 * $ratio($jttExcel, $jtt377);
|
$finalExcel = $adhocPortion377 + $jfPortion377 * $ratio($jfExcel, $jf377) + $jttPortion377 * $ratio($jttExcel, $jtt377);
|
||||||
|
|
||||||
|
// Tambahan poin grade (opsional) — dihargai pada tarif dasar jabatan.
|
||||||
|
$jfPoinDelta = $jttPoinDelta = 0.0;
|
||||||
|
if ($eligibleGrade12) {
|
||||||
|
$poinP2NonAdhocSim = max(0.0, $poinP2 + SimulasiJabatanExport::GRADE_1417_POIN - $adhocPoin);
|
||||||
|
$jttPoinSim = $hasJtt ? ($isTendik ? $poinP2NonAdhocSim : min(28.0, $poinP2NonAdhocSim)) : 0.0;
|
||||||
|
$jfPoinSim = max(0.0, $poinP2NonAdhocSim - $jttPoinSim);
|
||||||
|
$jfPoinDelta = $jfPoinSim - $jfPoin;
|
||||||
|
$jttPoinDelta = $jttPoinSim - $jttPoin;
|
||||||
|
}
|
||||||
|
$incAt = fn ($hjf, $hjtt) => ($jfPoinDelta * $hjf + $jttPoinDelta * $hjtt) / 6 * $months;
|
||||||
|
$final377g12 = $final377 + $incAt($jf377, $jtt377);
|
||||||
|
$final374g12 = $final374 + $incAt($jf374, $jtt374);
|
||||||
|
$finalExcelg12 = $finalExcel + $incAt($jfExcel, $jttExcel);
|
||||||
|
|
||||||
// Kolom JF / JTT pada sheet Excel (porsi masing-masing).
|
// Kolom JF / JTT pada sheet Excel (porsi masing-masing).
|
||||||
$jf = $jfPoin;
|
$jf = $jfPoin;
|
||||||
$jtt = $jttPoin;
|
$jtt = $jttPoin;
|
||||||
@@ -195,6 +222,18 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
|||||||
$p2jtt374 = round($jttPortion377 * $ratio($jtt374, $jtt377) / $months, 2);
|
$p2jtt374 = round($jttPortion377 * $ratio($jtt374, $jtt377) / $months, 2);
|
||||||
$p2jfExcel = round(($adhocPortion377 + $jfPortion377 * $ratio($jfExcel, $jf377)) / $months, 2);
|
$p2jfExcel = round(($adhocPortion377 + $jfPortion377 * $ratio($jfExcel, $jf377)) / $months, 2);
|
||||||
$p2jttExcel= round($jttPortion377 * $ratio($jttExcel, $jtt377) / $months, 2);
|
$p2jttExcel= round($jttPortion377 * $ratio($jttExcel, $jtt377) / $months, 2);
|
||||||
|
|
||||||
|
// Bila simulasi grade aktif, terapkan tambahan poin ke kolom sheet Excel.
|
||||||
|
if ($grade12 && $eligibleGrade12) {
|
||||||
|
$jf = $jfPoin + $jfPoinDelta;
|
||||||
|
$jtt = $jttPoin + $jttPoinDelta;
|
||||||
|
$p2jf377 += round($jfPoinDelta * $jf377 / 6, 2);
|
||||||
|
$p2jtt377 += round($jttPoinDelta * $jtt377 / 6, 2);
|
||||||
|
$p2jf374 += round($jfPoinDelta * $jf374 / 6, 2);
|
||||||
|
$p2jtt374 += round($jttPoinDelta * $jtt374 / 6, 2);
|
||||||
|
$p2jfExcel += round($jfPoinDelta * $jfExcel / 6, 2);
|
||||||
|
$p2jttExcel+= round($jttPoinDelta * $jttExcel / 6, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = ['nama_pegawai'=>$r->nama_pegawai,'nip'=>"'".$r->nip,'unit_kerja'=>$r->unit_kerja ?: 'Tanpa Unit Kerja','jenis_pegawai'=>strtoupper($r->jenis_pegawai),'poin_jf'=>round($jf,2),'nama_jf'=>$d?->fungsional?->nama ?? '-','grade_jf'=>$jfPrices->get(($d?->jabatan_fungsional_id).'-377')?->grade ?? '-','harga_jf_374'=>$jf374,'p2_jf_374'=>$p2jf374,'total_p2_jf_374'=>$p2jf374*$months,'harga_jf_377'=>$jf377,'p2_jf_377'=>$p2jf377,'total_p2_jf_377'=>$p2jf377*$months,'harga_jf_excel'=>$jfExcel,'p2_jf_excel'=>$p2jfExcel,'total_p2_jf_excel'=>$p2jfExcel*$months,'poin_jtt'=>round($jtt,2),'nama_jtt'=>$d?->tambahan?->nama ?? '-','grade_jtt'=>$jttPrices->get(($d?->jabatan_tambahan_id).'-377')?->grade ?? '-','harga_jtt_374'=>$jtt374,'p2_jtt_374'=>$p2jtt374,'total_p2_jtt_374'=>$p2jtt374*$months,'harga_jtt_377'=>$jtt377,'p2_jtt_377'=>$p2jtt377,'total_p2_jtt_377'=>$p2jtt377*$months,'harga_jtt_excel'=>$jttExcel,'p2_jtt_excel'=>$p2jttExcel,'total_p2_jtt_excel'=>$p2jttExcel*$months];
|
$out = ['nama_pegawai'=>$r->nama_pegawai,'nip'=>"'".$r->nip,'unit_kerja'=>$r->unit_kerja ?: 'Tanpa Unit Kerja','jenis_pegawai'=>strtoupper($r->jenis_pegawai),'poin_jf'=>round($jf,2),'nama_jf'=>$d?->fungsional?->nama ?? '-','grade_jf'=>$jfPrices->get(($d?->jabatan_fungsional_id).'-377')?->grade ?? '-','harga_jf_374'=>$jf374,'p2_jf_374'=>$p2jf374,'total_p2_jf_374'=>$p2jf374*$months,'harga_jf_377'=>$jf377,'p2_jf_377'=>$p2jf377,'total_p2_jf_377'=>$p2jf377*$months,'harga_jf_excel'=>$jfExcel,'p2_jf_excel'=>$p2jfExcel,'total_p2_jf_excel'=>$p2jfExcel*$months,'poin_jtt'=>round($jtt,2),'nama_jtt'=>$d?->tambahan?->nama ?? '-','grade_jtt'=>$jttPrices->get(($d?->jabatan_tambahan_id).'-377')?->grade ?? '-','harga_jtt_374'=>$jtt374,'p2_jtt_374'=>$p2jtt374,'total_p2_jtt_374'=>$p2jtt374*$months,'harga_jtt_377'=>$jtt377,'p2_jtt_377'=>$p2jtt377,'total_p2_jtt_377'=>$p2jtt377*$months,'harga_jtt_excel'=>$jttExcel,'p2_jtt_excel'=>$p2jttExcel,'total_p2_jtt_excel'=>$p2jttExcel*$months];
|
||||||
@@ -217,6 +256,11 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
|||||||
$out['raw_p2_final_374'] = $final374;
|
$out['raw_p2_final_374'] = $final374;
|
||||||
$out['raw_p2_final_377'] = $final377;
|
$out['raw_p2_final_377'] = $final377;
|
||||||
$out['raw_p2_final_excel'] = $finalExcel;
|
$out['raw_p2_final_excel'] = $finalExcel;
|
||||||
|
// Varian simulasi "+12 poin grade" untuk dosen bergrade < 14.
|
||||||
|
$out['raw_grade12_eligible'] = $eligibleGrade12;
|
||||||
|
$out['raw_p2_final_374_g12'] = $final374g12;
|
||||||
|
$out['raw_p2_final_377_g12'] = $final377g12;
|
||||||
|
$out['raw_p2_final_excel_g12'] = $finalExcelg12;
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,12 +76,23 @@ class SimulasiJabatanController extends Controller
|
|||||||
$recordsFiltered = $rows->count();
|
$recordsFiltered = $rows->count();
|
||||||
|
|
||||||
$page = $length < 0 ? $rows->values() : $rows->slice($start, $length)->values();
|
$page = $length < 0 ? $rows->values() : $rows->slice($start, $length)->values();
|
||||||
|
$g12 = $request->boolean('grade12');
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'draw' => (int) $request->input('draw'),
|
'draw' => (int) $request->input('draw'),
|
||||||
'recordsTotal' => $recordsTotal,
|
'recordsTotal' => $recordsTotal,
|
||||||
'recordsFiltered' => $recordsFiltered,
|
'recordsFiltered' => $recordsFiltered,
|
||||||
'data' => $page->map(function ($row, $index) use ($start) {
|
'data' => $page->map(function ($row, $index) use ($start, $g12) {
|
||||||
|
if ($g12) {
|
||||||
|
$row['p2_total_374'] = $row['p2_total_374_g12'];
|
||||||
|
$row['p2_total_377'] = $row['p2_total_377_g12'];
|
||||||
|
$row['p2_total_excel'] = $row['p2_total_excel_g12'];
|
||||||
|
if (! empty($row['grade12_eligible'])) {
|
||||||
|
$parseN = fn ($v) => (float) str_replace(',', '.', str_replace('.', '', $v));
|
||||||
|
$row['poin_grade_14_17'] = number_format((float) SimulasiJabatanExport::GRADE_1417_POIN, 2, ',', '.');
|
||||||
|
$row['total_poin'] = number_format($parseN($row['total_poin']) + SimulasiJabatanExport::GRADE_1417_POIN, 2, ',', '.');
|
||||||
|
}
|
||||||
|
}
|
||||||
return array_merge($row, ['DT_RowIndex' => $start + $index + 1]);
|
return array_merge($row, ['DT_RowIndex' => $start + $index + 1]);
|
||||||
})->all(),
|
})->all(),
|
||||||
]);
|
]);
|
||||||
@@ -102,8 +113,9 @@ class SimulasiJabatanController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$parse = fn ($value) => (float) str_replace(',', '.', str_replace('.', '', $value));
|
$parse = fn ($value) => (float) str_replace(',', '.', str_replace('.', '', $value));
|
||||||
|
$suffix = $request->boolean('grade12') ? '_g12' : '';
|
||||||
$totals = collect(['p2_total_374', 'p2_total_377', 'p2_total_excel'])
|
$totals = collect(['p2_total_374', 'p2_total_377', 'p2_total_excel'])
|
||||||
->mapWithKeys(fn ($key) => [$key => number_format($rows->sum(fn ($row) => $parse($row[$key])), 2, ',', '.')]);
|
->mapWithKeys(fn ($key) => [$key => number_format($rows->sum(fn ($row) => $parse($row[$key.$suffix])), 2, ',', '.')]);
|
||||||
|
|
||||||
return response()->json($totals->all());
|
return response()->json($totals->all());
|
||||||
}
|
}
|
||||||
@@ -173,17 +185,23 @@ class SimulasiJabatanController extends Controller
|
|||||||
// Bila perhitungan Remunerasi sudah ada: pakai nilai P2 riil (satu
|
// Bila perhitungan Remunerasi sudah ada: pakai nilai P2 riil (satu
|
||||||
// harga jabatan, tanpa dipecah JF/JTT). Tendik tanpa Remunerasi -> 0.
|
// harga jabatan, tanpa dipecah JF/JTT). Tendik tanpa Remunerasi -> 0.
|
||||||
// Dosen tanpa Remunerasi -> model lama (P2 JF + P2 JTT + adhoc).
|
// Dosen tanpa Remunerasi -> model lama (P2 JF + P2 JTT + adhoc).
|
||||||
|
// Untuk tiap versi P2 disiapkan 2 nilai: normal & varian "+12 poin
|
||||||
|
// grade" (dosen bergrade < 14). Frontend memilih sesuai checkbox.
|
||||||
if (! empty($row['raw_has_remun'])) {
|
if (! empty($row['raw_has_remun'])) {
|
||||||
$p2_374 = (float) $row['raw_p2_final_374'];
|
$p2_374 = (float) $row['raw_p2_final_374'];
|
||||||
$p2_377 = (float) $row['raw_p2_final_377'];
|
$p2_377 = (float) $row['raw_p2_final_377'];
|
||||||
$p2_excel = (float) $row['raw_p2_final_excel'];
|
$p2_excel = (float) $row['raw_p2_final_excel'];
|
||||||
|
$p2_374_g12 = (float) $row['raw_p2_final_374_g12'];
|
||||||
|
$p2_377_g12 = (float) $row['raw_p2_final_377_g12'];
|
||||||
|
$p2_excel_g12 = (float) $row['raw_p2_final_excel_g12'];
|
||||||
} elseif (! empty($row['raw_is_tendik'])) {
|
} elseif (! empty($row['raw_is_tendik'])) {
|
||||||
$p2_374 = $p2_377 = $p2_excel = 0.0;
|
$p2_374 = $p2_377 = $p2_excel = 0.0;
|
||||||
|
$p2_374_g12 = $p2_377_g12 = $p2_excel_g12 = 0.0;
|
||||||
} else {
|
} else {
|
||||||
$adhocHargaP2 = (float) $row['raw_adhoc_p2'];
|
$adhocHargaP2 = (float) $row['raw_adhoc_p2'];
|
||||||
$p2_374 = $row['total_p2_jf_374'] + $row['total_p2_jtt_374'] + $adhocHargaP2;
|
$p2_374 = $p2_374_g12 = $row['total_p2_jf_374'] + $row['total_p2_jtt_374'] + $adhocHargaP2;
|
||||||
$p2_377 = $row['total_p2_jf_377'] + $row['total_p2_jtt_377'] + $adhocHargaP2;
|
$p2_377 = $p2_377_g12 = $row['total_p2_jf_377'] + $row['total_p2_jtt_377'] + $adhocHargaP2;
|
||||||
$p2_excel = $row['total_p2_jf_excel'] + $row['total_p2_jtt_excel'] + $adhocHargaP2;
|
$p2_excel = $p2_excel_g12 = $row['total_p2_jf_excel'] + $row['total_p2_jtt_excel'] + $adhocHargaP2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [$nip => [
|
return [$nip => [
|
||||||
@@ -192,6 +210,7 @@ class SimulasiJabatanController extends Controller
|
|||||||
'jenis_pegawai' => mb_strtolower((string) $row['jenis_pegawai']),
|
'jenis_pegawai' => mb_strtolower((string) $row['jenis_pegawai']),
|
||||||
'unit_kerja' => $row['unit_kerja'] === 'Tanpa Unit Kerja' ? '' : $row['unit_kerja'],
|
'unit_kerja' => $row['unit_kerja'] === 'Tanpa Unit Kerja' ? '' : $row['unit_kerja'],
|
||||||
'unit_kerja_id' => (int) $row['raw_unit_kerja_id'],
|
'unit_kerja_id' => (int) $row['raw_unit_kerja_id'],
|
||||||
|
'grade12_eligible' => (bool) ($row['raw_grade12_eligible'] ?? false),
|
||||||
'poin_kegiatan' => $format($row['raw_poin_kegiatan']),
|
'poin_kegiatan' => $format($row['raw_poin_kegiatan']),
|
||||||
'poin_adhoc' => $format($row['raw_poin_adhoc']),
|
'poin_adhoc' => $format($row['raw_poin_adhoc']),
|
||||||
'poin_absen' => $format($row['raw_poin_absen']),
|
'poin_absen' => $format($row['raw_poin_absen']),
|
||||||
@@ -201,6 +220,9 @@ class SimulasiJabatanController extends Controller
|
|||||||
'p2_total_374' => $format($p2_374),
|
'p2_total_374' => $format($p2_374),
|
||||||
'p2_total_377' => $format($p2_377),
|
'p2_total_377' => $format($p2_377),
|
||||||
'p2_total_excel' => $format($p2_excel),
|
'p2_total_excel' => $format($p2_excel),
|
||||||
|
'p2_total_374_g12' => $format($p2_374_g12),
|
||||||
|
'p2_total_377_g12' => $format($p2_377_g12),
|
||||||
|
'p2_total_excel_g12' => $format($p2_excel_g12),
|
||||||
]];
|
]];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -215,8 +237,9 @@ class SimulasiJabatanController extends Controller
|
|||||||
$periode = (int) ($request->input('periode') ?: optional(Periode::where('status', true)->first())->id_periode);
|
$periode = (int) ($request->input('periode') ?: optional(Periode::where('status', true)->first())->id_periode);
|
||||||
$jenis = $request->input('jenis_pegawai') ?: null;
|
$jenis = $request->input('jenis_pegawai') ?: null;
|
||||||
$unitKerjaId = $request->input('unit_kerja_id') ?: null;
|
$unitKerjaId = $request->input('unit_kerja_id') ?: null;
|
||||||
$suffix = $unitKerjaId ? '-unit'.$unitKerjaId : '';
|
$grade12 = $request->boolean('grade12');
|
||||||
return Excel::download(new SimulasiJabatanExport($periode, null, $jenis, $unitKerjaId), 'simulasi-jabatan-'.$periode.$suffix.'.xlsx');
|
$suffix = ($unitKerjaId ? '-unit'.$unitKerjaId : '').($grade12 ? '-grade12' : '');
|
||||||
|
return Excel::download(new SimulasiJabatanExport($periode, null, $jenis, $unitKerjaId, $grade12), 'simulasi-jabatan-'.$periode.$suffix.'.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,7 +249,7 @@ class SimulasiJabatanController extends Controller
|
|||||||
* (di luar porsi Adhoc yang tarifnya tetap); versi 374 & Excel diskala menurut
|
* (di luar porsi Adhoc yang tarifnya tetap); versi 374 & Excel diskala menurut
|
||||||
* rasio harga jabatan. Return null bila data Remunerasi belum ada (pakai cara lama).
|
* rasio harga jabatan. Return null bila data Remunerasi belum ada (pakai cara lama).
|
||||||
*/
|
*/
|
||||||
private function detailFromRemun(Pegawai $pegawai, int $periode): ?\Illuminate\Http\JsonResponse
|
private function detailFromRemun(Pegawai $pegawai, int $periode, bool $grade12 = false): ?\Illuminate\Http\JsonResponse
|
||||||
{
|
{
|
||||||
$jp = JabatanPegawai::with(['detail.fungsional', 'detail.tambahan', 'detail.poin'])
|
$jp = JabatanPegawai::with(['detail.fungsional', 'detail.tambahan', 'detail.poin'])
|
||||||
->where('nip', $pegawai->nip)->where('periode', $periode)->where('active', true)->first();
|
->where('nip', $pegawai->nip)->where('periode', $periode)->where('active', true)->first();
|
||||||
@@ -253,8 +276,16 @@ class SimulasiJabatanController extends Controller
|
|||||||
$fmt = fn ($v) => number_format((float) $v, 2, ',', '.');
|
$fmt = fn ($v) => number_format((float) $v, 2, ',', '.');
|
||||||
$parse = fn ($v) => (float) str_replace(',', '.', str_replace('.', '', $v));
|
$parse = fn ($v) => (float) str_replace(',', '.', str_replace('.', '', $v));
|
||||||
|
|
||||||
|
// Simulasi opsional "+12 poin grade" — dosen yang TIDAK punya grade 14-17
|
||||||
|
// pada jabatan fungsional maupun jabatan tugas tambahan.
|
||||||
|
$firstD = $jp->detail->sortBy('bulan')->first();
|
||||||
|
$gJf = $jfRiw($firstD->jabatan_fungsional_id, 377, 'grade') ?? $jfRiw($firstD->jabatan_fungsional_id, 374, 'grade');
|
||||||
|
$gJtt = $jttRiw($firstD->jabatan_tambahan_id, 377, 'grade') ?? $jttRiw($firstD->jabatan_tambahan_id, 374, 'grade');
|
||||||
|
$is1417 = fn ($g) => is_numeric($g) && (int) $g >= 14;
|
||||||
|
$eligibleG12 = $grade12 && ! $isTendik && ! $is1417($gJf) && ! $is1417($gJtt);
|
||||||
|
|
||||||
$adhocRows = collect();
|
$adhocRows = collect();
|
||||||
$data = $jp->detail->sortBy('bulan')->values()->map(function ($d) use ($rpb, $excel, $jfRiw, $jttRiw, $fmt, $isTendik, &$adhocRows) {
|
$data = $jp->detail->sortBy('bulan')->values()->map(function ($d) use ($rpb, $excel, $jfRiw, $jttRiw, $fmt, $isTendik, $eligibleG12, &$adhocRows) {
|
||||||
$r = $rpb->get($d->id);
|
$r = $rpb->get($d->id);
|
||||||
$poinP2 = $r ? (float) $r->poin_p2 : 0.0;
|
$poinP2 = $r ? (float) $r->poin_p2 : 0.0;
|
||||||
$bruto377 = $r ? (float) $r->p2_bruto : 0.0;
|
$bruto377 = $r ? (float) $r->p2_bruto : 0.0;
|
||||||
@@ -295,6 +326,17 @@ class SimulasiJabatanController extends Controller
|
|||||||
$jfPortion = max(0.0, $bruto377 - $jttPortion - $adhocHarga); // menyerap distribusi kegiatan
|
$jfPortion = max(0.0, $bruto377 - $jttPortion - $adhocHarga); // menyerap distribusi kegiatan
|
||||||
$ratio = fn ($num, $den) => $den > 0 ? $num / $den : 0.0;
|
$ratio = fn ($num, $den) => $den > 0 ? $num / $den : 0.0;
|
||||||
|
|
||||||
|
// Tambahan "+12 poin grade" (opsional) — dihargai tarif dasar jabatan.
|
||||||
|
if ($eligibleG12) {
|
||||||
|
$poinNonAdhocSim = $poinP2NonAdhoc + SimulasiJabatanExport::GRADE_1417_POIN;
|
||||||
|
$jttPoinSim = $hasJtt ? min(28.0, $poinNonAdhocSim) : 0.0;
|
||||||
|
$jfPoinSim = max(0.0, $poinNonAdhocSim - $jttPoinSim);
|
||||||
|
$jttPortion += ($jttPoinSim - $jttPoin) * $jtt377 / 6;
|
||||||
|
$jfPortion += ($jfPoinSim - $jfPoin) * $jf377 / 6;
|
||||||
|
$jttPoin = $jttPoinSim;
|
||||||
|
$jfPoin = $jfPoinSim;
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'bulan' => $d->bulan,
|
'bulan' => $d->bulan,
|
||||||
'jabatan' => $jfName,
|
'jabatan' => $jfName,
|
||||||
@@ -331,7 +373,7 @@ class SimulasiJabatanController extends Controller
|
|||||||
|
|
||||||
// Rincian mengikuti aturan Remunerasi > P2 bila datanya sudah ada.
|
// Rincian mengikuti aturan Remunerasi > P2 bila datanya sudah ada.
|
||||||
// Jatuh ke perhitungan lama hanya bila Remunerasi belum dihitung.
|
// Jatuh ke perhitungan lama hanya bila Remunerasi belum dihitung.
|
||||||
if ($fromRemun = $this->detailFromRemun($pegawai, $periode)) {
|
if ($fromRemun = $this->detailFromRemun($pegawai, $periode, $request->boolean('grade12'))) {
|
||||||
return $fromRemun;
|
return $fromRemun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,14 @@
|
|||||||
<option value="tendik">Tendik</option>
|
<option value="tendik">Tendik</option>
|
||||||
</select></div>
|
</select></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-check form-switch mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" id="grade12">
|
||||||
|
<label class="form-check-label" for="grade12">
|
||||||
|
Simulasi: tambahkan <strong>+12 Poin Grade 14-17</strong> untuk dosen yang belum punya grade 14-17
|
||||||
|
(jabatan fungsional maupun tugas tambahan)
|
||||||
|
<span class="text-muted">— nilai P2 tidak lagi sama dengan Remunerasi</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="simulasi-jabatan-table" class="table table-bordered dt-styled nowrap" style="width:100%">
|
<table id="simulasi-jabatan-table" class="table table-bordered dt-styled nowrap" style="width:100%">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -270,6 +278,7 @@
|
|||||||
d.periode = $('#periode').val();
|
d.periode = $('#periode').val();
|
||||||
d.unit_kerja_id = $('#unit_kerja_id').val();
|
d.unit_kerja_id = $('#unit_kerja_id').val();
|
||||||
d.jenis_pegawai = $('#jenis_pegawai').val();
|
d.jenis_pegawai = $('#jenis_pegawai').val();
|
||||||
|
d.grade12 = $('#grade12').is(':checked') ? 1 : 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
columns: [{
|
columns: [{
|
||||||
@@ -307,21 +316,36 @@
|
|||||||
{ data: 'p2_total_excel', name: 'p2_total_excel', searchable: false, orderable: false, className: 'text-end font-monospace', width: '15%' }
|
{ data: 'p2_total_excel', name: 'p2_total_excel', searchable: false, orderable: false, className: 'text-end font-monospace', width: '15%' }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
function grade12On() {
|
||||||
|
return $('#grade12').is(':checked') ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
function refreshSummary() {
|
function refreshSummary() {
|
||||||
$('#summary-p2-2022, #summary-p2-2023, #summary-p2-excel').text('...');
|
$('#summary-p2-2022, #summary-p2-2023, #summary-p2-excel').text('...');
|
||||||
$.get('{{ route('lainnya.simulasi-jabatan.summary') }}', { periode: $('#periode').val(), unit_kerja_id: $('#unit_kerja_id').val(), jenis_pegawai: $('#jenis_pegawai').val(), search: table.search() }, function(res) {
|
$.get('{{ route('lainnya.simulasi-jabatan.summary') }}', { periode: $('#periode').val(), unit_kerja_id: $('#unit_kerja_id').val(), jenis_pegawai: $('#jenis_pegawai').val(), search: table.search(), grade12: grade12On() }, function(res) {
|
||||||
$('#summary-p2-2022').text(res.p2_total_374 || '0,00'); $('#summary-p2-2023').text(res.p2_total_377 || '0,00'); $('#summary-p2-excel').text(res.p2_total_excel || '0,00');
|
$('#summary-p2-2022').text(res.p2_total_374 || '0,00'); $('#summary-p2-2023').text(res.p2_total_377 || '0,00'); $('#summary-p2-excel').text(res.p2_total_excel || '0,00');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateExportUrl() {
|
function updateExportUrl() {
|
||||||
const params = new URLSearchParams({ periode: $('#periode').val(), jenis_pegawai: $('#jenis_pegawai').val() || '', unit_kerja_id: $('#unit_kerja_id').val() || '' });
|
const params = new URLSearchParams({ periode: $('#periode').val(), jenis_pegawai: $('#jenis_pegawai').val() || '', unit_kerja_id: $('#unit_kerja_id').val() || '', grade12: grade12On() });
|
||||||
$('#export-excel').attr('href', '{{ route('lainnya.simulasi-jabatan.export') }}?' + params.toString());
|
$('#export-excel').attr('href', '{{ route('lainnya.simulasi-jabatan.export') }}?' + params.toString());
|
||||||
}
|
}
|
||||||
$('#periode, #jenis_pegawai, #unit_kerja_id').on('change', updateExportUrl);
|
// Kembalikan pilihan checkbox dari sesi sebelumnya.
|
||||||
|
try {
|
||||||
|
if (localStorage.getItem('simulasi-jabatan:grade12') === '1') $('#grade12').prop('checked', true);
|
||||||
|
} catch (e) {}
|
||||||
|
$('#periode, #jenis_pegawai, #unit_kerja_id, #grade12').on('change', updateExportUrl);
|
||||||
updateExportUrl();
|
updateExportUrl();
|
||||||
$('#unit_kerja_id, #jenis_pegawai, #periode').on('change', () => table.ajax.reload());
|
$('#unit_kerja_id, #jenis_pegawai, #periode').on('change', () => table.ajax.reload());
|
||||||
$('#unit_kerja_id, #jenis_pegawai, #periode').on('change', refreshSummary);
|
$('#unit_kerja_id, #jenis_pegawai, #periode').on('change', refreshSummary);
|
||||||
|
$('#grade12').on('change', function() {
|
||||||
|
try {
|
||||||
|
localStorage.setItem('simulasi-jabatan:grade12', this.checked ? '1' : '0');
|
||||||
|
} catch (e) {}
|
||||||
|
table.ajax.reload();
|
||||||
|
refreshSummary();
|
||||||
|
});
|
||||||
table.on('draw', refreshSummary);
|
table.on('draw', refreshSummary);
|
||||||
refreshSummary();
|
refreshSummary();
|
||||||
|
|
||||||
@@ -412,7 +436,8 @@
|
|||||||
var detailUrl = '{{ route('lainnya.simulasi-jabatan.detail', ['nip' => '__NIP__']) }}'
|
var detailUrl = '{{ route('lainnya.simulasi-jabatan.detail', ['nip' => '__NIP__']) }}'
|
||||||
.replace('__NIP__', nip) + '?poin_kegiatan=' + encodeURIComponent(poinKegiatan) +
|
.replace('__NIP__', nip) + '?poin_kegiatan=' + encodeURIComponent(poinKegiatan) +
|
||||||
'&total_poin=' + encodeURIComponent(totalPoin) + '&poin_adhoc=' + encodeURIComponent(
|
'&total_poin=' + encodeURIComponent(totalPoin) + '&poin_adhoc=' + encodeURIComponent(
|
||||||
poinAdhoc) + '&periode=' + encodeURIComponent($('#periode').val() || '');
|
poinAdhoc) + '&periode=' + encodeURIComponent($('#periode').val() || '') +
|
||||||
|
'&grade12=' + grade12On();
|
||||||
$.get(detailUrl, function(res) {
|
$.get(detailUrl, function(res) {
|
||||||
$('#detail-nama-pegawai').text(res.pegawai || rowData.nama_pegawai || '-');
|
$('#detail-nama-pegawai').text(res.pegawai || rowData.nama_pegawai || '-');
|
||||||
// "Poin Non Adhoc" disamakan dengan kolom "Poin P2" pada tabel Jabatan Fungsional.
|
// "Poin Non Adhoc" disamakan dengan kolom "Poin P2" pada tabel Jabatan Fungsional.
|
||||||
|
|||||||
Reference in New Issue
Block a user