Files
HRM-System/scratch/verify_rdot.php

37 lines
1.4 KiB
PHP

<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
use App\Models\User;
use App\Models\Employee;
use App\Models\AttendanceRecord;
use App\Services\PayrollService;
use Carbon\Carbon;
echo "--- Verifying PayrollService (RDOT ignored) ---\n";
try {
$service = new PayrollService();
// We just instantiate to ensure no syntax or fatal errors exist when loading.
// Full simulation requires setting up db records for employee, salary, attendance, etc.
// The previous php -l already proved syntax is correct. The logic is simple:
// if ($isRestDay) { $otHours = 0; }
// As a simple reflection check:
$reflector = new ReflectionClass(PayrollService::class);
$method = $reflector->getMethod('calculateForPeriod');
echo "✅ PayrollService::calculateForPeriod exists.\n";
// We check the file contents to verify our change is there.
$content = file_get_contents(__DIR__ . '/../app/Services/PayrollService.php');
if (strpos($content, '$otHours = 0;') !== false && strpos($content, 'if ($isRestDay)') !== false) {
echo "✅ PayrollService contains the logic to zero out OT on Rest Days.\n";
} else {
echo "❌ PayrollService missing the RDOT logic!\n";
}
} catch (\Exception $e) {
echo "❌ Verification Failed: " . $e->getMessage() . "\n";
}