<?php 
$tenant = $_REQUEST['tenant'];
if(file_exists('../../../'.$tenant.'/config.php')){require_once('../../../'.$tenant.'/config.php');}
if(file_exists('/config.php')){require_once('/config.php');}


if($_REQUEST['FCN']=="genNewLists"){
    $stmt = $GLOBALS['con']->prepare("SELECT * FROM `dd_plant` ORDER BY `code` ASC")or die(mysqli_error($GLOBALS['con']));
    $stmt->execute();$cc=$stmt->get_result();$stmt->close();	
    while($pd=mysqli_fetch_array($cc)){$ca[]=$pd;}
    
    $ret=array();
    $dat1='';
    foreach($ca as $px){
        if($c==$px['code']){$s="SELECTED";}else{$s="";}
        $dat1.='<option value="'.$px['code'].'" title="'.$px['description'].'" '.$s.'>'.$px['code'].'</option>';//.PHP_EOL;
    }
    //$ret[]=$dat;
    $dat2='';
    foreach($ca as $px){
        if($c==$px['code']){$s="SELECTED";}else{$s="";}
        $dat2.='<option value="'.$px['description'].'" title="'.$px['code'].'" '.$s.'>'.$px['description'].'&nbsp;&nbsp;&nbsp;&nbsp;('.$px['frequency'].' months)</option>';//.PHP_EOL;
    }
    //$ret[]=$dat;

    //$return=json_encode($ret);
    echo $dat1."[SPLIT]".$dat2;
    exit();
}