Files
sam-api/app/Models/Tenants/JournalEntry.php
유병철 12d172e4c3 feat: [finance] 계정과목 및 일반전표 API 추가
- AccountCode 모델/서비스/컨트롤러 구현
- JournalEntry, JournalEntryLine 모델 구현
- GeneralJournalEntry 서비스/컨트롤러 구현
- FormRequest 검증 클래스 추가
- finance 라우트 등록
- i18n 메시지 키 추가 (message.php, error.php)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:10:45 +09:00

54 lines
1.2 KiB
PHP

<?php
namespace App\Models\Tenants;
use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class JournalEntry extends Model
{
use BelongsToTenant, SoftDeletes;
protected $fillable = [
'tenant_id',
'entry_no',
'entry_date',
'entry_type',
'description',
'total_debit',
'total_credit',
'status',
'source_type',
'source_key',
'created_by_name',
'attachment_note',
];
protected $casts = [
'entry_date' => 'date',
'total_debit' => 'integer',
'total_credit' => 'integer',
];
// Status
public const STATUS_DRAFT = 'draft';
public const STATUS_CONFIRMED = 'confirmed';
// Source type
public const SOURCE_MANUAL = 'manual';
public const SOURCE_BANK_TRANSACTION = 'bank_transaction';
// Entry type
public const TYPE_GENERAL = 'general';
/**
* 분개 행 관계
*/
public function lines(): HasMany
{
return $this->hasMany(JournalEntryLine::class)->orderBy('line_no');
}
}