Files
HRM-System/test_payroll.php

35 lines
1.2 KiB
PHP

<?php
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
use App\Models\User;
use App\Models\PayrollRun;
use App\Services\PayrollService;
$service = new PayrollService();
$users = User::whereIn('name', ['Paul Rei Paas', 'Ana Regina Mariano', 'Dinh Chavez'])->get();
// Let's use April 1-15 2026 or April 16-30 2026.
$startDate = '2026-04-11';
$endDate = '2026-04-25';
foreach($users as $user) {
echo "========================================\n";
echo "Employee: " . $user->name . "\n";
$result = $service->calculateForPeriod($user->employee, $startDate, $endDate);
echo "Basic Salary: " . $result['basic_salary'] . "\n";
echo "Total Earnings: " . $result['total_earnings'] . "\n";
echo "Net Pay: " . $result['net_pay'] . "\n";
echo "Earnings Breakdown:\n";
foreach($result['earnings'] as $e) echo " - " . $e['name'] . ": " . $e['amount'] . "\n";
echo "Deductions Breakdown:\n";
foreach($result['deductions'] as $d) echo " - " . $d['name'] . ": " . $d['amount'] . "\n";
echo "Summary: " . json_encode($result['summary'], JSON_PRETTY_PRINT) . "\n\n";
}