<?php 
include "functions.php";
use SAPb1\Filters\Equal;
use SAPb1\Filters\InArray;

try 
{
    session_start();
    $DocEntry = $_GET["DocEntry"];
    $sap = Login();
  

    $DocEntryList = $sap->getService("view.svc/B1_GetPreviousDocEntryB1SLQuery");
    $DocEntry_result = $DocEntryList->queryBuilder()
    ->select('DocEntry,PDocEntry')
    ->where(new Equal("DocEntry", intval($DocEntry) ))->findAll(); 
     
    $PDocEntry = json_decode(json_encode($DocEntry_result), TRUE);
    echo json_encode($PDocEntry['value']);


} catch (Exception $e) {
    echo $e->getMessage();    
}