Initial commit - expense
Deploy to VPS (PAT over HTTPS) / deploy (push) Has been cancelled

This commit is contained in:
root
2026-06-01 15:01:03 +07:00
parent 9e9fab4a3f
commit 1c1418f3e0
123 changed files with 18622 additions and 10376 deletions
+14 -10
View File
@@ -1,19 +1,23 @@
<?php
namespace App\Helpers;
use Illuminate\Support\Carbon;
class PeriodeHelper
{
public static function getPeriodeRange($month, $year)
{
$month = (int) date('m', strtotime($month));
$year = (int) $year;
/**
* Mendapatkan rentang tanggal fisik pengakuan untuk sebuah periode akuntansi (Bulan & Tahun)
* Contoh: Periode "april 2026" -> Start: 11 April 2026, End: 13 Mei 2026 (Closing Date)
*/
public static function getPeriodeRange(string $month, int $year): array
{
// 1. Tentukan tanggal 11 di bulan dan tahun yang dipilih
$startDate = Carbon::parse("11 $month $year")->startOfDay()->toDateTimeString();
// Jika Januari, periode dimulai dari 11 Januari hingga 10 Februari
$start = Carbon::create($year, $month, 11)->startOfDay();
$end = $start->copy()->addMonth()->subDay()->endOfDay();
// 2. Tentukan tanggal 13 di bulan berikutnya (Bulan berjalan + 1)
$endDate = Carbon::parse("13 $month $year")->addMonth()->endOfDay()->toDateTimeString();
return [$start, $end];
}
}
return [$startDate, $endDate];
}
}