<?php 
include "functions.php";
use SAPb1\Filters\Equal;
use SAPb1\Filters\InArray;
try 
{
    session_start();
    if(isset($_POST['projet'])){
        $_SESSION['projet']  =$_POST['projet'];
    }
    if (isset($_POST['client'])) {
        $_SESSION['client'] =$_POST['client'];
    }
    if (isset($_POST['article'])) {
        $_SESSION['article'] =$_POST['article'];
    }
    if (isset($_POST['dated'])) {
        $_SESSION['dated'] =$_POST['dated'];
    }
    $sap = Login();
    $ItemsList = $sap->getService("view.svc/B1_BpsIncrimB1SLQuery");
    $ItemsList->headers(['Prefer' => 'odata.maxpagesize=777740']);
    $Items_result = $ItemsList->queryBuilder()
    ->select('U_CardCode,U_CodeProject,itemcode,incr,dated')
    ->where(new Equal("U_CardCode",$_SESSION['client']))
    ->where(new Equal("U_CodeProject",$_SESSION['projet']))
    ->where(new Equal("dated",$_SESSION['dated']))
    //->where(new Equal("itemcode",$_SESSION['article']))
    ->findAll();
   // echo $_SESSION['client'].'-----'.$_SESSION['projet'].'<br>';
     header('Content-Type: application/json');
     echo json_encode($Items_result);
    // $data=json_encode($Items_result);

   
// ItemCode='00211' and U_CardCode ='1005' and u_codeproject=9

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