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

try 
{
    session_start();
    $DocEntry = $_GET["DocEntry"];
    
    $sap = Login();
    $ConsultationsLinesList = $sap->getService("view.svc/B1_LINESB1SLQuery");
    $ConsultationsOrdonnanceList = $sap->getService("view.svc/B1_ORDONNANCEB1SLQuery");
    $ConsultationsAnalyseList = $sap->getService("view.svc/B1_ANALYSEB1SLQuery");
    $ConsultationsRadioList = $sap->getService("view.svc/B1_RADIOB1SLQuery");

    //LINES
    $ConsultationsLines_result = $ConsultationsLinesList->queryBuilder() ->select('DocEntry,U_Consultation,U_Description,U_Notes') ->where(new Equal("DocEntry", $DocEntry)) ->findAll();
    $ConsultationLines = array_values(((array) $ConsultationsLines_result)["value"]);
    var_dump($ConsultationLines);

    //ORDONNANCE
    $ConsultationsOrdonnance_result = $ConsultationsOrdonnanceList->queryBuilder() ->select('DocEntry,U_ItemCode,U_Description,U_Qte,U_Instructions') ->where(new Equal("DocEntry", $DocEntry )) ->findAll();
    $ConsultationOrdonnance = array_values(((array) $ConsultationsOrdonnance_result)["value"]);
    var_dump($ConsultationOrdonnance);

    //ANALYSE
    $ConsultationsAnalyse_result = $ConsultationsAnalyseList->queryBuilder() ->select('DocEntry,U_ItemCode,U_Description,U_Instructions') ->where(new Equal("DocEntry", $DocEntry)) ->findAll();
    $ConsultationAnalyse = array_values(((array) $ConsultationsAnalyse_result)["value"]);
    var_dump($ConsultationAnalyse);

    //RADIO
    $ConsultationsRadio_result = $ConsultationsRadioList->queryBuilder() ->select('DocEntry,U_ItemCode,U_Description,U_Instructions') ->where(new Equal("DocEntry", $DocEntry )) ->findAll();
    $ConsultationRadio = array_values(((array) $ConsultationsRadio_result)["value"]);
    var_dump($ConsultationRadio);


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