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'; ?>
| 회차 | 납부일 | 구간 | 기초원금 | 원금 | 이자 | 합계 | 기말원금 | 상태 | 처리 |
|---|---|---|---|---|---|---|---|---|---|
| = $s['cycle_no'] ?> | = h($s['due_date']) ?> | = $s['payment_phase'] === 'grace' ? '거치' : '상환' ?> | = won($s['opening_principal']) ?> | = won($s['scheduled_principal']) ?> | = won($s['scheduled_interest']) ?> | = won($s['scheduled_total']) ?> | = won($s['closing_principal']) ?> |
자동반영
납부완료
= h($s['payment_date']) ?>
= h($s['payment_description']) ?>
예정
|
- |
| 스케줄이 없습니다. | |||||||||