<?php
$host = 'localhost';
$database = 'C:\Program Files (x86)\Common Files\Aspel\Sistemas Aspel\SAE7.00\Ejemplos\Ejemplos.FDB';
$username = 'SYSDBA';
$password = 'masterkey';

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

try {
    $dbh = new PDO("firebird:host=$host;dbname=$database;charset=UTF8", $username, $password);

    $query = "SELECT CVE_CPTO, DESCR, CPN FROM CONM01 ORDER BY CVE_CPTO";
    $stmt = $dbh->prepare($query);
    $stmt->execute();

    $conceptos = $stmt->fetchAll(PDO::FETCH_ASSOC);
    echo json_encode(['success' => true, 'data' => $conceptos]);
} catch (PDOException $e) {
    echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}
?>