Files
sam-manage/app/Models/Finance/CorporateCardPrepayment.php
김보곤 d78d431350 feat:법인카드 요약카드 개선 (결제일/사용금액/선불결제)
- 요약카드 4개→6개 확장 (등록카드, 총한도, 매월결제일, 사용금액, 선불결제, 잔여한도)
- 매월결제일: 휴일/주말 시 다음 영업일로 자동 조정 표시
- 사용금액: barobill_card_transactions 기반 청구기간 실거래 합산
- 선불결제: 수정 모달로 테넌트 단위 월별 금액 관리
- 잔여한도: (총한도 - 사용금액 + 선불결제) 계산

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 10:24:39 +09:00

26 lines
632 B
PHP

<?php
namespace App\Models\Finance;
use Illuminate\Database\Eloquent\Model;
class CorporateCardPrepayment extends Model
{
protected $table = 'corporate_card_prepayments';
protected $fillable = ['tenant_id', 'year_month', 'amount', 'memo'];
public function scopeForTenant($query, int $tenantId)
{
return $query->where('tenant_id', $tenantId);
}
public static function getOrCreate(int $tenantId, string $yearMonth): self
{
return static::firstOrCreate(
['tenant_id' => $tenantId, 'year_month' => $yearMonth],
['amount' => 0, 'memo' => null]
);
}
}