prepare(" SELECT * FROM loans WHERE id = ? AND user_id = ? "); $stmt->execute([$id, $uid]); $loan = $stmt->fetch(); if (!$loan) { exit('대출 정보를 찾을 수 없습니다.'); } $stmt = $pdo->prepare(" SELECT * FROM accounts WHERE user_id = ? AND is_active = 1 AND account_type IN ('bank','cash','other') ORDER BY id ASC "); $stmt->execute([$uid]); $accounts = $stmt->fetchAll(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { try { $scheduleId = (int)($_POST['schedule_id'] ?? 0); $accountId = !empty($_POST['account_id']) ? (int)$_POST['account_id'] : null; $paymentDate = $_POST['payment_date'] ?? date('Y-m-d'); $description = trim($_POST['description'] ?? '') ?: null; pay_loan_schedule($uid, $scheduleId, $accountId, $paymentDate, $description); $msg = '상환 처리되었습니다.'; } catch (Throwable $e) { $error = $e->getMessage(); } } $stmt = $pdo->prepare(" SELECT ls.*, lp.payment_date, lp.description AS payment_description, lp.is_auto_generated, lp.payment_type FROM loan_schedules ls LEFT JOIN loan_payments lp ON lp.loan_schedule_id = ls.id WHERE ls.loan_id = ? ORDER BY ls.cycle_no ASC "); $stmt->execute([$id]); $schedules = $stmt->fetchAll(); $summary = get_loan_remaining_summary($id); require __DIR__ . '/../app/views/header.php'; ?>

대출 상세

중도상환 목록
원금
연이자율
%
거치기간
개월
상환기간
개월
남은 원금
남은 이자
남은 총액
회차 납부일 구간 기초원금 원금 이자 합계 기말원금 상태 처리
자동반영 납부완료
예정
-
스케줄이 없습니다.