- 급여 관리 API 추가 (SalaryController, SalaryService, Salary 모델) - 급여 목록/상세/등록/수정/삭제 - 상태 변경 (scheduled/completed) - 일괄 상태 변경 - 통계 조회 - 더미 시더 확장 - 근태, 휴가, 부서, 사용자 시더 추가 - 기존 시더 tenant_id/created_by/updated_by 필드 추가 - 부서 서비스 개선 (tree 조회 기능 추가) - 카드 서비스 수정 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
2.4 KiB
PHP
60 lines
2.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('salaries', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
|
|
$table->unsignedBigInteger('employee_id')->comment('직원 ID');
|
|
$table->unsignedSmallInteger('year')->comment('년도');
|
|
$table->unsignedTinyInteger('month')->comment('월');
|
|
|
|
// 급여 금액
|
|
$table->decimal('base_salary', 15, 2)->default(0)->comment('기본급');
|
|
$table->decimal('total_allowance', 15, 2)->default(0)->comment('총 수당');
|
|
$table->decimal('total_overtime', 15, 2)->default(0)->comment('초과근무수당');
|
|
$table->decimal('total_bonus', 15, 2)->default(0)->comment('상여');
|
|
$table->decimal('total_deduction', 15, 2)->default(0)->comment('총 공제');
|
|
$table->decimal('net_payment', 15, 2)->default(0)->comment('실지급액');
|
|
|
|
// 상세 내역 (JSON)
|
|
$table->json('allowance_details')->nullable()->comment('수당 상세 내역');
|
|
$table->json('deduction_details')->nullable()->comment('공제 상세 내역');
|
|
|
|
// 지급 정보
|
|
$table->date('payment_date')->nullable()->comment('지급일');
|
|
$table->enum('status', ['scheduled', 'completed'])->default('scheduled')->comment('상태: 지급예정/지급완료');
|
|
|
|
// 감사 필드
|
|
$table->unsignedBigInteger('created_by')->nullable()->comment('생성자');
|
|
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자');
|
|
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
// 인덱스
|
|
$table->index('tenant_id');
|
|
$table->index('employee_id');
|
|
$table->index(['year', 'month']);
|
|
$table->index('status');
|
|
$table->unique(['tenant_id', 'employee_id', 'year', 'month'], 'unique_salary_per_employee_month');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('salaries');
|
|
}
|
|
}; |