Penambahn P1 Dev
This commit is contained in:
@@ -30,13 +30,16 @@ class P1PerbandinganExport implements WithMultipleSheets
|
||||
|
||||
protected $arah;
|
||||
|
||||
public function __construct($jenisPegawai, $tahun, $bulan, $unit, $arah = '')
|
||||
protected bool $includePppk2025;
|
||||
|
||||
public function __construct($jenisPegawai, $tahun, $bulan, $unit, $arah = '', bool $includePppk2025 = false)
|
||||
{
|
||||
$this->jenisPegawai = $jenisPegawai;
|
||||
$this->tahun = $tahun;
|
||||
$this->bulan = $bulan;
|
||||
$this->unit = $unit;
|
||||
$this->arah = $arah;
|
||||
$this->includePppk2025 = $includePppk2025;
|
||||
}
|
||||
|
||||
public function sheets(): array
|
||||
@@ -45,7 +48,7 @@ class P1PerbandinganExport implements WithMultipleSheets
|
||||
$months = $this->bulan === null ? range(1, Carbon::now()->month) : [$this->bulan];
|
||||
|
||||
foreach ($months as $month) {
|
||||
$sheets[] = new P1PerbandinganMonthlySheet($this->jenisPegawai, $this->tahun, $month, $this->unit, $this->arah);
|
||||
$sheets[] = new P1PerbandinganMonthlySheet($this->jenisPegawai, $this->tahun, $month, $this->unit, $this->arah, $this->includePppk2025);
|
||||
}
|
||||
|
||||
return $sheets;
|
||||
@@ -76,6 +79,8 @@ class P1PerbandinganMonthlySheet implements FromCollection, ShouldAutoSize, With
|
||||
|
||||
protected $arah;
|
||||
|
||||
protected bool $includePppk2025;
|
||||
|
||||
private $cachedCollection;
|
||||
|
||||
private array $totals = [];
|
||||
@@ -95,13 +100,14 @@ class P1PerbandinganMonthlySheet implements FromCollection, ShouldAutoSize, With
|
||||
12 => 'Desember',
|
||||
];
|
||||
|
||||
public function __construct($jenisPegawai, $tahun, $bulan, $unit, $arah = '')
|
||||
public function __construct($jenisPegawai, $tahun, $bulan, $unit, $arah = '', bool $includePppk2025 = false)
|
||||
{
|
||||
$this->jenisPegawai = $jenisPegawai;
|
||||
$this->tahun = $tahun;
|
||||
$this->bulan = $bulan;
|
||||
$this->unit = $unit;
|
||||
$this->arah = $arah;
|
||||
$this->includePppk2025 = $includePppk2025;
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
@@ -123,6 +129,7 @@ class P1PerbandinganMonthlySheet implements FromCollection, ShouldAutoSize, With
|
||||
return P1::query()
|
||||
->where('tahun', $queryYear)
|
||||
->where('bulan', $queryMonth)
|
||||
->when(! $this->includePppk2025, fn ($query) => $query->where('nip', 'not like', '%202521%'))
|
||||
->when($this->unit !== null && $this->unit !== '', fn ($query) => $query->where('id_unit_kerja', $this->unit))
|
||||
->when($this->jenisPegawai === 'dosen' || $this->jenisPegawai === 'tendik', fn ($query) => $query->whereRaw('LOWER(jenis_pegawai) = ?', [$this->jenisPegawai]))
|
||||
->get()
|
||||
|
||||
Reference in New Issue
Block a user