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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "currid")
    $su_id = $paramValue;
}

$dal = new DAL();
       
$sql = "SELECT LO.id, LO.name AS 'Lot Name', CO.descr AS Composition, " .
       "MC.descr AS Colour, LI.descr as Interpretation " .
       "FROM operationspatialunit OS, spatialunitlot SL, lot LO, " .
       "lotcomposition LC, composition CO, lotinterpret LI, munselcolour MC " .
       "WHERE OS.spatialunit_id = $su_id AND SL.operationspatialunit_id = OS.id " .
       "AND LO.id = SL.lot_id AND LC.lot_id = LO.id AND CO.id = LC.composition_id " .
       "AND LI.id = lotinterpret_id AND MC.id = LC.munselcolour_id ";
$result = $dal->query($sql);

echo json_encode($result);

?>

