Files
sam-manage/app/Http/Controllers/HR/BusinessIncomePaymentController.php
김보곤 f922646b7b feat: [hr] 사업소득자 임금대장 입력 기능 구현
- BusinessIncomePayment 모델 (소득세3%/지방소득세0.3% 자동계산)
- BusinessIncomePaymentService (일괄저장/통계/CSV내보내기)
- 웹/API 컨트롤러 (ALLOWED_PAYROLL_USERS 접근 제한)
- 스프레드시트 UI (인라인 편집, 실시간 세금 계산)
- HTMX 연월 변경 갱신, CSV 내보내기
2026-02-27 20:22:07 +09:00

49 lines
1.5 KiB
PHP

<?php
namespace App\Http\Controllers\HR;
use App\Http\Controllers\Controller;
use App\Services\HR\BusinessIncomePaymentService;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class BusinessIncomePaymentController extends Controller
{
private const ALLOWED_PAYROLL_USERS = ['이경호', '전진선', '김보곤'];
public function __construct(
private BusinessIncomePaymentService $service
) {}
/**
* 사업소득자 임금대장 페이지
*/
public function index(Request $request): View|Response
{
if ($request->header('HX-Request')) {
return response('', 200)->header('HX-Redirect', route('hr.business-income-payments.index'));
}
if (! in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS)) {
return view('hr.payrolls.restricted');
}
$year = $request->integer('year') ?: now()->year;
$month = $request->integer('month') ?: now()->month;
$earners = $this->service->getActiveEarners();
$payments = $this->service->getPayments($year, $month);
$paymentsByUser = $payments->keyBy('user_id');
$stats = $this->service->getMonthlyStats($year, $month);
return view('hr.business-income-payments.index', [
'earners' => $earners,
'paymentsByUser' => $paymentsByUser,
'stats' => $stats,
'year' => $year,
'month' => $month,
]);
}
}