<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "listid")
    $lo_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT I.id, I.descr AS text " .
       "FROM  inclusion I " .
       "LEFT JOIN (lotcompositioninclusion LCI, lotcomposition LC) " .
       "ON (LCI.inclusion_id = I.id AND LC.id = LCI.lotcomposition_id " .
       "AND LC.lot_id = $lo_id) " .
       "WHERE LC.composition_id IS NULL " .
       "ORDER BY descr ";
$result = $dal->query($sql);

echo json_encode($result);

?>

