fix:일일자금일보 거래 중복 표시 및 잔액 NaN 버그 수정

- periodReport에서 동일 거래(계좌+일시+금액) 중복 제거 로직 추가
- EaccountController save() 금액 비교를 정수 캐스트로 변경하여 decimal 정밀도 차이 중복 방지
- 합계행 잔액 계산 시 Number() 캐스트로 NaN 방지

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-06 17:55:27 +09:00
parent a2849d2fb1
commit e9466344c9
3 changed files with 9 additions and 6 deletions

View File

@@ -928,12 +928,13 @@ public function save(Request $request): JsonResponse
];
// Upsert: 있으면 업데이트, 없으면 생성
// 금액 비교 시 정수로 캐스트하여 decimal 정밀도 차이로 인한 중복 방지
$existing = BankTransaction::where('tenant_id', $tenantId)
->where('bank_account_num', $data['bank_account_num'])
->where('trans_dt', $transDt)
->where('deposit', $data['deposit'])
->where('withdraw', $data['withdraw'])
->where('balance', $data['balance'])
->whereRaw('CAST(deposit AS SIGNED) = ?', [(int) $data['deposit']])
->whereRaw('CAST(withdraw AS SIGNED) = ?', [(int) $data['withdraw']])
->whereRaw('CAST(balance AS SIGNED) = ?', [(int) $data['balance']])
->first();
if ($existing) {