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

$sql = "select ARTICULO, DESCRIPCION, CANTVTAS, UNIDAD, BASEVTAS-BASEDEV BASE from VENTAS_ARTICULO_CLIENTE('" . $_GET["nitcli"] . "', '" . $_GET["desde"] . "','". $_GET["hasta"] . "','N',0)";

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


?>