<?php
include 'db.php';
$stmt = $pdo->query("SELECT DISTINCT YEAR(inv_date) AS year FROM transactions WHERE terms='Cash' ORDER BY year DESC");
$years = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($years);
?>
