Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11d7ed7eb1 | |||
| d01d4b090c | |||
| c10cdf39ca | |||
| 6672f34adc | |||
| 70c796d230 | |||
| 1d58c66a7a | |||
| a1462095a7 | |||
| dcf57bcfdc | |||
| 05ab6fee35 | |||
| f2aeb9c695 | |||
| 261fa7ff8f |
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports;
|
||||||
|
|
||||||
|
use App\Exports\Concerns\ForcesTextColumns;
|
||||||
|
use App\Http\Controllers\Perhitungan\Remunerasi\KeseluruhanController;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromArray;
|
||||||
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
|
class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatting, WithCustomValueBinder, WithHeadings, WithMapping, WithStyles
|
||||||
|
{
|
||||||
|
use ForcesTextColumns;
|
||||||
|
|
||||||
|
protected function nipColumns(): array
|
||||||
|
{
|
||||||
|
return ['C'];
|
||||||
|
}
|
||||||
|
|
||||||
|
private array $rows;
|
||||||
|
|
||||||
|
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit)
|
||||||
|
{
|
||||||
|
$this->rows = app(KeseluruhanController::class)->getRekapRows($tahun, $jenisPegawai, $unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function array(): array
|
||||||
|
{
|
||||||
|
return $this->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headings(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'No.',
|
||||||
|
'Nama',
|
||||||
|
'NIP',
|
||||||
|
'Jenis Pegawai',
|
||||||
|
'Unit Kerja',
|
||||||
|
'Jumlah P1',
|
||||||
|
'Jumlah P2',
|
||||||
|
'Jumlah THR',
|
||||||
|
'Jumlah R13',
|
||||||
|
'Jumlah Publikasi',
|
||||||
|
'Total',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function map($row): array
|
||||||
|
{
|
||||||
|
static $no = 0;
|
||||||
|
$no++;
|
||||||
|
|
||||||
|
return [
|
||||||
|
$no,
|
||||||
|
$row['nama'],
|
||||||
|
$row['nip'],
|
||||||
|
$row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'),
|
||||||
|
$row['nama_unit'],
|
||||||
|
$row['jumlah_p1'],
|
||||||
|
$row['jumlah_p2'],
|
||||||
|
$row['jumlah_thr'],
|
||||||
|
$row['jumlah_r13'],
|
||||||
|
$row['jumlah_publikasi'],
|
||||||
|
$row['total'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columnFormats(): array
|
||||||
|
{
|
||||||
|
$accountingFormat = '_("Rp"\ * #,##0.00_);_("Rp"\ * \-#,##0.00_);_("Rp"\ * "-"??_);_(@_)';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'C' => '@',
|
||||||
|
'F' => $accountingFormat,
|
||||||
|
'G' => $accountingFormat,
|
||||||
|
'H' => $accountingFormat,
|
||||||
|
'I' => $accountingFormat,
|
||||||
|
'J' => $accountingFormat,
|
||||||
|
'K' => $accountingFormat,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function styles(Worksheet $sheet)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
1 => [
|
||||||
|
'font' => ['bold' => true, 'color' => ['rgb' => 'FFFFFF']],
|
||||||
|
'fill' => [
|
||||||
|
'fillType' => Fill::FILL_SOLID,
|
||||||
|
'startColor' => ['rgb' => '4472C4'],
|
||||||
|
],
|
||||||
|
'alignment' => [
|
||||||
|
'horizontal' => Alignment::HORIZONTAL_CENTER,
|
||||||
|
'vertical' => Alignment::VERTICAL_CENTER,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Perhitungan\Remunerasi;
|
||||||
|
|
||||||
|
use App\Exports\KeseluruhanExport;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Rekapitulasi\P1;
|
||||||
|
use App\Models\Verifikator\Periode;
|
||||||
|
use App\Models\Verifikator\Publikasi;
|
||||||
|
use App\Models\Verifikator\UnitKerja;
|
||||||
|
use App\Models\Verifikator\View\Pegawai;
|
||||||
|
use App\Services\DawaiService;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class KeseluruhanController extends Controller
|
||||||
|
{
|
||||||
|
private function authorizeAccess(): void
|
||||||
|
{
|
||||||
|
abort_unless(auth()->user()->hasRole('Superuser'), 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
$this->authorizeAccess();
|
||||||
|
|
||||||
|
$title = 'Keseluruhan';
|
||||||
|
|
||||||
|
return view('perhitungan.remunerasi.keseluruhan.index', compact('title'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function data(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->authorizeAccess();
|
||||||
|
|
||||||
|
$tahun = (int) ($request->tahun ?: now()->year);
|
||||||
|
$jenisPegawai = $request->jenis_pegawai ?: null;
|
||||||
|
$unit = $request->unit;
|
||||||
|
|
||||||
|
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit));
|
||||||
|
|
||||||
|
return DataTables::of($rows)
|
||||||
|
->editColumn('jenis_pegawai', fn ($row) => $row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'))
|
||||||
|
->editColumn('jumlah_p1', fn ($row) => 'Rp. '.number_format($row['jumlah_p1'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_p2', fn ($row) => 'Rp. '.number_format($row['jumlah_p2'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_thr', fn ($row) => 'Rp. '.number_format($row['jumlah_thr'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_r13', fn ($row) => 'Rp. '.number_format($row['jumlah_r13'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_publikasi', fn ($row) => 'Rp. '.number_format($row['jumlah_publikasi'], 2, ',', '.'))
|
||||||
|
->editColumn('total', fn ($row) => 'Rp. '.number_format($row['total'], 2, ',', '.'))
|
||||||
|
->with([
|
||||||
|
'jumlahPegawai' => $rows->count(),
|
||||||
|
'totalKeseluruhan' => number_format($rows->sum('total'), 2, ',', '.'),
|
||||||
|
])
|
||||||
|
->make();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export(Request $request): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$this->authorizeAccess();
|
||||||
|
|
||||||
|
set_time_limit(300);
|
||||||
|
|
||||||
|
$tahun = (int) ($request->tahun ?: now()->year);
|
||||||
|
$jenisPegawai = $request->jenis_pegawai ?: null;
|
||||||
|
$unit = $request->unit;
|
||||||
|
|
||||||
|
$unitName = '_Semua_Unit_Kerja';
|
||||||
|
if ($unit !== null && $unit !== '') {
|
||||||
|
$unitKerja = UnitKerja::find((int) $unit === 99 ? 0 : (int) $unit);
|
||||||
|
if ($unitKerja) {
|
||||||
|
$unitName = '_'.str_replace(['/', ' ', '.'], '_', $unitKerja->nama);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = "Remunerasi_Keseluruhan_{$tahun}{$unitName}.xlsx";
|
||||||
|
|
||||||
|
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit), $filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bangun daftar rekap per pegawai (Pegawai, Unit Kerja, Jumlah P1/P2/THR/R13/Publikasi) untuk
|
||||||
|
* 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): array
|
||||||
|
{
|
||||||
|
$rows = $this->buildRekap($tahun, $jenisPegawai);
|
||||||
|
|
||||||
|
if ($unit !== null && $unit !== '') {
|
||||||
|
$unitBucket = (int) $unit;
|
||||||
|
$rows = $rows->filter(function ($row) use ($unitBucket) {
|
||||||
|
if ($unitBucket === 99) {
|
||||||
|
return $row['unit_kerja_id'] === null || ! in_array((int) $row['unit_kerja_id'], range(1, 9), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) $row['unit_kerja_id'] === $unitBucket;
|
||||||
|
})->values();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rows->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildRekap(int $tahun, ?string $jenisPegawai): Collection
|
||||||
|
{
|
||||||
|
$cacheKey = 'remunerasi_keseluruhan_v1_'.$tahun.'_'.($jenisPegawai ?: 'semua');
|
||||||
|
|
||||||
|
return collect(Cache::remember($cacheKey, now()->addHours(6), fn () => $this->computeRekap($tahun, $jenisPegawai)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function computeRekap(int $tahun, ?string $jenisPegawai): array
|
||||||
|
{
|
||||||
|
$normalize = fn ($nip) => preg_replace("/['.\-]/", '', (string) $nip);
|
||||||
|
|
||||||
|
// 1. P1 = akumulasi Januari s.d. bulan berjalan (atau Desember untuk tahun yang sudah lewat)
|
||||||
|
$bulanTerakhir = $tahun === (int) now()->year ? (int) now()->month : 12;
|
||||||
|
|
||||||
|
$p1 = P1::query()
|
||||||
|
->where('tahun', $tahun)
|
||||||
|
->whereBetween('bulan', [1, $bulanTerakhir])
|
||||||
|
->when($jenisPegawai, fn ($q) => $q->whereRaw('LOWER(jenis_pegawai) = ?', [strtolower($jenisPegawai)]))
|
||||||
|
->get()
|
||||||
|
->groupBy(fn ($row) => $normalize($row->nip))
|
||||||
|
->map(fn ($rows) => (float) $rows->sum('gaji_yang_dibayarkan'));
|
||||||
|
|
||||||
|
// 2. P2 = Semester 1 tahun terpilih
|
||||||
|
$periodeSemester1 = Periode::where('nama', 'LIKE', "%{$tahun} Semester 1%")->value('id_periode');
|
||||||
|
|
||||||
|
$p2 = collect();
|
||||||
|
if ($periodeSemester1) {
|
||||||
|
$p2 = Pegawai::withoutGlobalScopes()
|
||||||
|
->join('verifikator.jabatan_pegawais as jp', 'verifikator.pegawais.nip', '=', 'jp.nip')
|
||||||
|
->join('verifikator.jabatan_pegawai_details as jpd', 'jp.id', '=', 'jpd.jabatan_pegawai_id')
|
||||||
|
->join('verifikator.remunerasi_per_bulans as rpb', 'jpd.id', '=', 'rpb.jabatan_pegawai_detail_id')
|
||||||
|
->select('verifikator.pegawais.nip')
|
||||||
|
->selectRaw('SUM(rpb.p2_bruto) as total')
|
||||||
|
->whereNull('rpb.deleted_at')
|
||||||
|
->where('jp.periode', $periodeSemester1)
|
||||||
|
->when($jenisPegawai, fn ($q) => $q->where('jpd.jenis_pegawai', $jenisPegawai))
|
||||||
|
->groupBy('verifikator.pegawais.nip')
|
||||||
|
->havingRaw('SUM(rpb.p2_bruto) > 0')
|
||||||
|
->get()
|
||||||
|
->keyBy(fn ($row) => $normalize($row->nip))
|
||||||
|
->map(fn ($row) => (float) $row->total);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. THR & 4. R13 = data eksternal (API Dawai), untuk seluruh unit sekaligus lalu di-cache
|
||||||
|
// per hari seperti pola THRController/R13Controller.
|
||||||
|
$jenisPegawaiParam = $jenisPegawai ?? '';
|
||||||
|
|
||||||
|
$thrData = Cache::remember(
|
||||||
|
"keseluruhan_thr_{$jenisPegawaiParam}_{$tahun}",
|
||||||
|
now()->addDay(),
|
||||||
|
fn () => (new DawaiService)->getDataThr($jenisPegawaiParam, $tahun, null, false)
|
||||||
|
);
|
||||||
|
$thr = collect($thrData)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_thr'] ?? 0));
|
||||||
|
|
||||||
|
$r13Data = Cache::remember(
|
||||||
|
"keseluruhan_r13_{$jenisPegawaiParam}_{$tahun}",
|
||||||
|
now()->addDay(),
|
||||||
|
fn () => (new DawaiService)->getDataR13($jenisPegawaiParam, $tahun, null, false)
|
||||||
|
);
|
||||||
|
$r13 = collect($r13Data)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_r13'] ?? 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');
|
||||||
|
|
||||||
|
$publikasiQuery = Publikasi::query()
|
||||||
|
->whereIn('periode', $periodeIds)
|
||||||
|
->where('poin_total', '>', 0)
|
||||||
|
->select('nip')
|
||||||
|
->selectRaw('SUM(biaya_remunerasi) as total');
|
||||||
|
|
||||||
|
if ($jenisPegawai) {
|
||||||
|
$publikasiQuery->whereHas('pegawai', function ($q) use ($jenisPegawai) {
|
||||||
|
$q->withoutGlobalScopes()->where('jenis_pegawai', $jenisPegawai);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$publikasi = $publikasiQuery->groupBy('nip')->get()
|
||||||
|
->keyBy(fn ($row) => $normalize($row->nip))
|
||||||
|
->map(fn ($row) => (float) $row->total);
|
||||||
|
|
||||||
|
$allNips = $p1->keys()
|
||||||
|
->merge($p2->keys())
|
||||||
|
->merge($thr->keys())
|
||||||
|
->merge($r13->keys())
|
||||||
|
->merge($publikasi->keys())
|
||||||
|
->unique()
|
||||||
|
->values();
|
||||||
|
|
||||||
|
if ($allNips->isEmpty()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$pegawaiInfo = Pegawai::withoutGlobalScopes()
|
||||||
|
->leftJoin('verifikator.unit_kerja_pegawais as ukp', 'verifikator.pegawais.unit_kerja_id', '=', 'ukp.id')
|
||||||
|
->select([
|
||||||
|
'verifikator.pegawais.nip',
|
||||||
|
'verifikator.pegawais.nama',
|
||||||
|
'verifikator.pegawais.jenis_pegawai',
|
||||||
|
'verifikator.pegawais.unit_kerja_id',
|
||||||
|
'ukp.nama as nama_unit',
|
||||||
|
])
|
||||||
|
->get()
|
||||||
|
->keyBy(fn ($row) => $normalize($row->nip));
|
||||||
|
|
||||||
|
return $allNips->map(function ($nip) use ($pegawaiInfo, $p1, $p2, $thr, $r13, $publikasi, $jenisPegawai) {
|
||||||
|
$info = $pegawaiInfo->get($nip);
|
||||||
|
|
||||||
|
if (! $info) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($jenisPegawai && strtolower((string) $info->jenis_pegawai) !== strtolower($jenisPegawai)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jumlahP1 = $p1->get($nip, 0.0);
|
||||||
|
$jumlahP2 = $p2->get($nip, 0.0);
|
||||||
|
$jumlahThr = $thr->get($nip, 0.0);
|
||||||
|
$jumlahR13 = $r13->get($nip, 0.0);
|
||||||
|
$jumlahPublikasi = $publikasi->get($nip, 0.0);
|
||||||
|
$total = $jumlahP1 + $jumlahP2 + $jumlahThr + $jumlahR13 + $jumlahPublikasi;
|
||||||
|
|
||||||
|
if ($total <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'nip' => ltrim($info->nip ?? $nip, "'"),
|
||||||
|
'nama' => $info->nama ?? '-',
|
||||||
|
'jenis_pegawai' => strtolower($info->jenis_pegawai ?? ''),
|
||||||
|
'unit_kerja_id' => $info->unit_kerja_id,
|
||||||
|
'nama_unit' => $info->nama_unit ?? '-',
|
||||||
|
'jumlah_p1' => $jumlahP1,
|
||||||
|
'jumlah_p2' => $jumlahP2,
|
||||||
|
'jumlah_thr' => $jumlahThr,
|
||||||
|
'jumlah_r13' => $jumlahR13,
|
||||||
|
'jumlah_publikasi' => $jumlahPublikasi,
|
||||||
|
'total' => $total,
|
||||||
|
];
|
||||||
|
})->filter()->values()->all();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -553,6 +553,15 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endrole
|
@endrole
|
||||||
|
|
||||||
|
@role('Superuser')
|
||||||
|
<li class="li-remunerasi-keseluruhan">
|
||||||
|
<a href="{{ route('remunerasi.keseluruhan.index') }}">
|
||||||
|
<i class="uil-layer-group" style="margin-right: 3px; font-size:18px"></i>
|
||||||
|
<span> Keseluruhan </span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endrole
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -0,0 +1,281 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript:void(0);">Perhitungan</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="javascript:void(0);">Remunerasi</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
|
||||||
|
</ol>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<!-- Summary Card -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-6">
|
||||||
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<div class="bg-primary text-white rounded-2 p-2">
|
||||||
|
<i class="uil-coins fs-4"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1 ms-3">
|
||||||
|
<h6 class="text-muted mb-1">Total Keseluruhan</h6>
|
||||||
|
<h4 class="mb-0" id="totalKeseluruhanDisplay">-</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6">
|
||||||
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<div class="bg-success text-white rounded-2 p-2">
|
||||||
|
<i class="uil-users-alt fs-4"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1 ms-3">
|
||||||
|
<h6 class="text-muted mb-1">Jumlah Pegawai</h6>
|
||||||
|
<h4 class="mb-0" id="jumlahPegawaiDisplay">-</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Table -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
|
@php
|
||||||
|
$actionButtons = '<button type="button" class="btn btn-sm btn-outline-success me-2" id="btn-export">
|
||||||
|
<i class="uil-file-download-alt"></i> Export
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-secondary" id="btnRefresh">
|
||||||
|
<i class="uil-refresh"></i>
|
||||||
|
Refresh
|
||||||
|
</button>';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@include('components.datatable-header', [
|
||||||
|
'title' => 'Rekap Keseluruhan Remunerasi',
|
||||||
|
'description' => 'Rekap Jumlah P1, P2, THR, R13, dan Publikasi per pegawai',
|
||||||
|
'actionButton' => $actionButtons,
|
||||||
|
])
|
||||||
|
|
||||||
|
<!-- Filter Section -->
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="filter-jenis-pegawai" class="form-label">Jenis Pegawai</label>
|
||||||
|
<select name="jenis_pegawai" id="filter-jenis-pegawai" class="form-select select2" data-placeholder="Semua Jenis">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="dosen">Dosen</option>
|
||||||
|
<option value="tendik">Tendik</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="filter-unit" class="form-label">Unit Kerja</label>
|
||||||
|
<select name="unit" id="filter-unit" class="form-select select2" data-placeholder="Semua Unit Kerja">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="99">Universitas</option>
|
||||||
|
<option value="1">Fakultas Hukum</option>
|
||||||
|
<option value="2">Fakultas Ekonomi dan Bisnis</option>
|
||||||
|
<option value="3">Fakultas Pertanian</option>
|
||||||
|
<option value="4">Fakultas Teknik</option>
|
||||||
|
<option value="5">Fakultas Ilmu Sosial dan Ilmu Politik</option>
|
||||||
|
<option value="6">Fakultas Keguruan dan Ilmu Pendidikan</option>
|
||||||
|
<option value="7">Fakultas Kehutanan</option>
|
||||||
|
<option value="8">Fakultas Matematika dan Ilmu Pengetahuan Alam</option>
|
||||||
|
<option value="9">Fakultas Kedokteran</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="filter-tahun" class="form-label">Tahun</label>
|
||||||
|
<select name="tahun" id="filter-tahun" class="form-select select2" data-placeholder="Pilih Tahun">
|
||||||
|
@for ($year = date('Y'); $year >= 2025; $year--)
|
||||||
|
<option value="{{ $year }}" {{ $year == date('Y') ? 'selected' : '' }}>{{ $year }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tabel Data -->
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered w-100 dt-styled" id="keseluruhan-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Pegawai</th>
|
||||||
|
<th>Unit Kerja</th>
|
||||||
|
<th class="text-center">Jumlah P1</th>
|
||||||
|
<th class="text-center">Jumlah P2</th>
|
||||||
|
<th class="text-center">Jumlah THR</th>
|
||||||
|
<th class="text-center">Jumlah R13</th>
|
||||||
|
<th class="text-center">Jumlah Publikasi</th>
|
||||||
|
<th class="text-center">Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('js')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
function renderRupiah(data) {
|
||||||
|
if (!data) {
|
||||||
|
return 'Rp. 0,00';
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderJenisPegawaiTag(jenis) {
|
||||||
|
var config = {
|
||||||
|
'Dosen': { color: 'var(--ct-primary)', rgb: 'var(--ct-primary-rgb)', icon: 'uil-user-graduate' },
|
||||||
|
'Tendik': { color: '#fd7e14', rgb: '253, 126, 20', icon: 'uil-briefcase-alt' }
|
||||||
|
};
|
||||||
|
var c = config[jenis];
|
||||||
|
if (!c) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return '<small class="d-inline-block fw-bold" style="padding: 1px 18px 1px 6px; color: ' +
|
||||||
|
c.color + '; background: linear-gradient(to right, rgba(' + c.rgb + ', 0.25), rgba(' + c.rgb +
|
||||||
|
', 0)); clip-path: polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%);"><i class="' + c.icon +
|
||||||
|
'"></i> ' + jenis.toUpperCase() + '</small>';
|
||||||
|
}
|
||||||
|
|
||||||
|
var table = $('#keseluruhan-table').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
autoWidth: false,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('remunerasi.keseluruhan.data') }}",
|
||||||
|
data: function(d) {
|
||||||
|
d.jenis_pegawai = $('#filter-jenis-pegawai').val();
|
||||||
|
d.unit = $('#filter-unit').val();
|
||||||
|
d.tahun = $('#filter-tahun').val();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
data: 'nama',
|
||||||
|
name: 'nama',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type !== 'display') {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
var nama = data || '-';
|
||||||
|
var nip = row.nip || '-';
|
||||||
|
return '<div>' +
|
||||||
|
'<div class="fw-semibold">' + nama + '</div>' +
|
||||||
|
'<div class="text-muted small font-monospace">' + nip + '</div>' +
|
||||||
|
'<div class="mt-1">' + renderJenisPegawaiTag(row.jenis_pegawai) + '</div>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ data: 'nama_unit', name: 'nama_unit' },
|
||||||
|
{ data: 'jumlah_p1', name: 'jumlah_p1', className: 'text-end font-monospace', orderable: false },
|
||||||
|
{ data: 'jumlah_p2', name: 'jumlah_p2', className: 'text-end font-monospace', orderable: false },
|
||||||
|
{ data: 'jumlah_thr', name: 'jumlah_thr', className: 'text-end font-monospace', orderable: false },
|
||||||
|
{ data: 'jumlah_r13', name: 'jumlah_r13', className: 'text-end font-monospace', orderable: false },
|
||||||
|
{ data: 'jumlah_publikasi', name: 'jumlah_publikasi', className: 'text-end font-monospace', orderable: false },
|
||||||
|
{ data: 'total', name: 'total', className: 'text-end font-monospace fw-bold', orderable: false }
|
||||||
|
],
|
||||||
|
order: [],
|
||||||
|
language: {
|
||||||
|
processing: "<div class='spinner'></div> Sedang Memuat...",
|
||||||
|
},
|
||||||
|
drawCallback: function(settings) {
|
||||||
|
var api = this.api();
|
||||||
|
var response = api.ajax.json();
|
||||||
|
|
||||||
|
if (response && response.totalKeseluruhan !== undefined) {
|
||||||
|
$('#totalKeseluruhanDisplay').text('Rp ' + response.totalKeseluruhan);
|
||||||
|
$('#jumlahPegawaiDisplay').text(response.jumlahPegawai + ' orang');
|
||||||
|
} else {
|
||||||
|
$('#totalKeseluruhanDisplay').text('Rp 0');
|
||||||
|
$('#jumlahPegawaiDisplay').text('0 orang');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun').on('change', function() {
|
||||||
|
table.draw();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnRefresh').on('click', function() {
|
||||||
|
var button = $(this);
|
||||||
|
var originalText = button.html();
|
||||||
|
|
||||||
|
button.prop('disabled', true).html('<i class="uil-sync uil-spin"></i> Refreshing...');
|
||||||
|
|
||||||
|
table.ajax.reload(function() {
|
||||||
|
button.prop('disabled', false).html(originalText);
|
||||||
|
showSuccess('Berhasil!', 'Data berhasil direfresh');
|
||||||
|
}, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btn-export').on('click', function() {
|
||||||
|
var button = $(this);
|
||||||
|
var originalHtml = button.html();
|
||||||
|
|
||||||
|
var params = [];
|
||||||
|
var jenisPegawai = $('#filter-jenis-pegawai').val();
|
||||||
|
var unit = $('#filter-unit').val();
|
||||||
|
var tahun = $('#filter-tahun').val();
|
||||||
|
|
||||||
|
if (jenisPegawai) { params.push('jenis_pegawai=' + jenisPegawai); }
|
||||||
|
if (unit) { params.push('unit=' + unit); }
|
||||||
|
if (tahun) { params.push('tahun=' + tahun); }
|
||||||
|
|
||||||
|
var url = "{{ route('remunerasi.keseluruhan.export') }}";
|
||||||
|
if (params.length > 0) {
|
||||||
|
url += '?' + params.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
button.prop('disabled', true).html('<i class="uil-sync uil-spin"></i> Exporting...');
|
||||||
|
|
||||||
|
fetch(url)
|
||||||
|
.then(function(response) {
|
||||||
|
if (!response.ok) { throw new Error('gagal'); }
|
||||||
|
var filename = 'remunerasi_keseluruhan.xlsx';
|
||||||
|
var disposition = response.headers.get('Content-Disposition');
|
||||||
|
if (disposition) {
|
||||||
|
var match = disposition.match(/filename[^;=\n]*=['"]?([^'"\n]+)['"]?/);
|
||||||
|
if (match) { filename = match[1]; }
|
||||||
|
}
|
||||||
|
return response.blob().then(function(blob) {
|
||||||
|
return { blob: blob, filename: filename };
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(function(data) {
|
||||||
|
var downloadUrl = URL.createObjectURL(data.blob);
|
||||||
|
var a = document.createElement('a');
|
||||||
|
a.href = downloadUrl;
|
||||||
|
a.download = data.filename;
|
||||||
|
a.style.display = 'none';
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
URL.revokeObjectURL(downloadUrl);
|
||||||
|
button.prop('disabled', false).html(originalHtml);
|
||||||
|
showSuccess('Berhasil!', 'File Excel berhasil didownload');
|
||||||
|
})
|
||||||
|
.catch(function() {
|
||||||
|
button.prop('disabled', false).html(originalHtml);
|
||||||
|
showError('Gagal', 'Terjadi kesalahan saat export Excel');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\DewasController;
|
use App\Http\Controllers\Perhitungan\Remunerasi\DewasController;
|
||||||
|
use App\Http\Controllers\Perhitungan\Remunerasi\KeseluruhanController;
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\P1Controller;
|
use App\Http\Controllers\Perhitungan\Remunerasi\P1Controller;
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\P2Controller;
|
use App\Http\Controllers\Perhitungan\Remunerasi\P2Controller;
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\PoinController;
|
use App\Http\Controllers\Perhitungan\Remunerasi\PoinController;
|
||||||
@@ -70,4 +71,10 @@ Route::middleware('permission:Baca Pembayaran')->prefix('/remunerasi')->name('re
|
|||||||
Route::prefix('/dewas')->name('dewas.')->group(function () {
|
Route::prefix('/dewas')->name('dewas.')->group(function () {
|
||||||
Route::get('/', [DewasController::class, 'index'])->name('index');
|
Route::get('/', [DewasController::class, 'index'])->name('index');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('/keseluruhan')->name('keseluruhan.')->group(function () {
|
||||||
|
Route::get('/', [KeseluruhanController::class, 'index'])->name('index');
|
||||||
|
Route::get('/data', [KeseluruhanController::class, 'data'])->name('data');
|
||||||
|
Route::get('/export', [KeseluruhanController::class, 'export'])->name('export');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user