getMessage(); } } $ym = $_GET['ym'] ?? ''; $accountId = (int)($_GET['account_id'] ?? 0); $q = trim($_GET['q'] ?? ''); $params = [$uid]; $where = ["i.user_id = ?"]; if ($ym !== '') { $where[] = "i.start_year_month = ?"; $params[] = $ym; } if ($accountId > 0) { $where[] = "i.account_id = ?"; $params[] = $accountId; } if ($q !== '') { $where[] = "(t.merchant_name LIKE ? OR t.description LIKE ? OR a.account_name LIKE ?)"; $like = '%' . $q . '%'; $params[] = $like; $params[] = $like; $params[] = $like; } $sql = " SELECT i.*, a.account_name, a.institution_name, t.transaction_date, t.merchant_name, t.description, COALESCE(SUM(CASE WHEN s.is_billed = 0 THEN s.principal_amount ELSE 0 END), 0) AS remaining_principal, COALESCE(SUM(CASE WHEN s.is_billed = 0 THEN s.interest_amount ELSE 0 END), 0) AS remaining_interest, COALESCE(SUM(CASE WHEN s.is_billed = 0 THEN s.total_amount ELSE 0 END), 0) AS remaining_total, COALESCE(SUM(CASE WHEN s.is_billed = 1 THEN s.total_amount ELSE 0 END), 0) AS billed_total, COALESCE(MIN(CASE WHEN s.is_billed = 0 THEN s.cycle_no ELSE NULL END), 0) AS next_cycle FROM installments i JOIN accounts a ON a.id = i.account_id JOIN transactions t ON t.id = i.transaction_id LEFT JOIN installment_schedules s ON s.installment_id = i.id WHERE " . implode(' AND ', $where) . " GROUP BY i.id, i.user_id, i.transaction_id, i.account_id, i.principal_amount, i.interest_total, i.total_billed_amount, i.installment_months, i.annual_interest_rate, i.start_year_month, i.interest_type, i.current_cycle, i.is_completed, i.prepaid_principal_amount, i.prepaid_interest_amount, i.created_at, i.updated_at, a.account_name, a.institution_name, t.transaction_date, t.merchant_name, t.description ORDER BY i.created_at DESC, i.id DESC "; $stmt = $pdo->prepare($sql); $stmt->execute($params); $installments = $stmt->fetchAll(); $stmt = $pdo->prepare(" SELECT id, account_name, institution_name FROM accounts WHERE user_id = ? AND is_active = 1 AND account_type = 'card' ORDER BY id ASC "); $stmt->execute([$uid]); $cardAccounts = $stmt->fetchAll(); require __DIR__ . '/../app/views/header.php'; ?>

할부 내역

할부 청구 관리
초기화
0) { $progress = (($row['total_billed_amount'] - $row['remaining_total']) / (float)$row['total_billed_amount']) * 100; $progress = max(0, min(100, $progress)); } $scheduleStmt = $pdo->prepare(" SELECT * FROM installment_schedules WHERE installment_id = ? ORDER BY cycle_no ASC "); $scheduleStmt->execute([$row['id']]); $schedules = $scheduleStmt->fetchAll(); ?>
/
결제일 ·
0 ? '진행중' : '완료' ?>
연이자율 %
원금
총 할부이자
총 청구금액
개월 수
개월
남은 원금
남은 이자
남은 총액
다음 회차
0 ? ((int)$row['next_cycle'] . '회차') : '-' ?>
진행률 %
회차 청구월 원금 이자 합계 상태
회차 청구완료 미청구
회차 정보가 없습니다.
등록된 할부 내역이 없습니다.