<?php
header('Content-Type: application/json');

require_once __DIR__ . '/../core/api.php';
global $pdo;

$id = $_GET['id'] ?? 0;

$stmt = $pdo->prepare("SELECT receipt_file FROM transactions WHERE id = ?");
$stmt->execute([$id]);
$res = $stmt->fetch(PDO::FETCH_ASSOC);

echo json_encode(['uploaded' => !empty($res['receipt_file'])]);
?>