<?php
session_start();
include 'config.php';

$sql = "select MONV_ID, MONV_NOMBRE from MOTIVO_NO_VENTA";

try {
	$dbh = new PDO("firebird:dbname=$dbname", $_SESSION['usuario'], $_SESSION['clave']);	
//	$dbh = new PDO("firebird:dbname=$dbname", 'SYSDBA', 'MASTER123');	
	$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$stmt = $dbh->prepare($sql);
	$stmt->execute();
	$listas = $stmt->fetchAll(PDO::FETCH_OBJ);
	$dbh = null;
	echo '{"items":'. json_encode($listas) .'}'; 
} catch(PDOException $e) {
	echo '{"items":[{"UNIDAD":"UND","FACCAN":"1"}]}'; 
}

?>