<?php

  include_once('config.php');

  ob_start('ob_gzhandler');


  $query = ibase_query(
      "select CR.NROLANCTO, CR.DATAVENCTO, CR.VALOR, CR.CODPORTADOR, CR.CODVENDEDOR, CR.NRODOCUMENTO, CR.VALORPAGO, CR.CODCLIENTE, ".
      "CR.NROPARC, CR.DATAEMISSAO, CR.SITUACAO, CR.HASH_PIX, CR.IDENTIF_PIX ".
      "from PEDIDOS P ".
      "join VENDAS V on V.NROVENDA = P.NROVENDA ".
      "join CONTASRECEBER CR ON V.NROVENDA = CR.NROVENDA ".
      "where P.NROPEDIDO = ".$_GET["nropedido"]);
  $array = array();
  while ($row = ibase_fetch_assoc($query)) {
    $array[] = $row;
  }

  print json_encode($array);

?>