<?php
session_start();
$conexion = odbc_connect('ASA11', 'srvpedidos', 'strateRLexPe') or die(odbc_errormsg());
$conexion2 = odbc_connect('ResdisEnlace', 'resdis', '00reset') or die(odbc_errormsg());

		$usu = ("SELECT nom_client, cif_client, ema_faxcli, cod_client,min(porcentaje) porcentaje 
                FROM fsclient, fsfaxcli,outer margen
                WHERE emp_client = emp_faxcli
                and cod_client = cliente and cod_client = cli_faxcli and baj_client is null
                and ema_faxcli IS NOT NULL  GROUP BY 1,2,3,4 ORDER BY cod_client; ");
        $usuario = odbc_exec($conexion2, $usu);
        echo "<ul>";
		while($us = odbc_fetch_array($usuario)){
		$cod_client = $us['cod_client'];//trim(odbc_result($usu,"cod_client"));
        $nom_cli = $us['nom_client']; //trim(odbc_result($usu,"nom_client"));
        $cif_cli = $us['cif_client']; //trim(odbc_result($usu,"cif_client"));
        $ema_faxcli = $us['ema_faxcli']; //trim(odbc_result($usu,"ema_faxcli"));
        $por_client = $us['porcentaje']; //trim(odbc_result($usu,"porcentaje"));
        $contraa=substr(md5(trim($cif_cli).trim($ema_faxcli).trim($cod_client)),6,6);
		echo "<li>".$cod_client."  ..  ".$nom_cli."  ..  ".$contraa."</li>";
		}
		echo "</ul>";
?>		