<?php
session_start();
foreach($_GET as $campo => $valor){${$campo}=$valor;} 
foreach($_POST as $campo => $valor){${$campo}=$valor;} 
include_once('lib_main.php');

if(!empty($empr)){$link_data=msql_connect('','','',$empr); $cfg_empr=$empr;}

$domd_o = new DOMDocument();
     $domd_o->encoding = 'utf-8';
     $domd_o->xmlVersion = '1.0';
     $domd_o->formatOutput = true;
$elem_o=$domd_o;

$response=$elem_o->appendChild($elem_o->createElement("response"));
$result=$response->appendChild($elem_o->createElement("result"));

$tabla='mdcn';

if($optlist=='mdcn')
{
     $sql_docu ='select * ';
     $sql_docu.='from '.$tabla.'0 ';
     $sql_docu.='where '.$tabla.'_status not in ("O","X") ';
     $sql_docu.='and (upper(mdcn_priact) like "%'.substr($fmco,0,10).'%"';
     $sql_docu.='or upper(mdcn_concen) like "%'.substr($fmco,0,10).'%")';
     $sql_docu.='order by mdcn_descri ';
     $res_docu=msql_query($sql_docu,$link_data);

     if(msql_num_rows($res_docu)==0)
     {
     $sql_docu ='select * ';
     $sql_docu.='from '.$tabla.'0 ';
     $sql_docu.='where '.$tabla.'_status not in ("O","X") ';
//      $sql_docu.='and (upper(mdcn_priact) like "%'.substr($fmco,0,10).'%"';
//      $sql_docu.='or upper(mdcn_concen) like "%'.substr($fmco,0,10).'%")';
     $sql_docu.='order by mdcn_descri ';
     $res_docu=msql_query($sql_docu,$link_data);

     }
     
     
     
     $zoptions='';
     
     
     while($aso_docu=msql_fetch_assoc($res_docu))
     {
          $xvalue=$aso_docu['mdcn_descri'];
          $xoption=$aso_docu['mdcn_descri'];
          $zoptions.=$xvalue.','.$xoption.';';
     }
}



// echo '*/*/*/*'.$plan1;

$zdom=$domd_o;
$zele=$response;
// $zvalue=$plan;
$zvalue=$plan1;
// $zdefa=$plan1;
$zmaintag='result';
include ('ele_select.php');

echo $domd_o->saveXML();
?>

