<?php
require_once __DIR__ . '/../db/config.php';
require_once __DIR__ . '/../includes/accounting_functions.php';

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

$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($id > 0) {
    $data = get_journal_entry_details($id);
    if ($data) {
        echo json_encode(['success' => true, 'data' => $data]);
        exit;
    }
}
echo json_encode(['success' => false, 'error' => 'Entry not found.']);