<?php
$accion = $_GET["accion"];
$accion();
function rutas(){
		include("config.php");
		$tr .= "<select name='ruta0' id='ruta0' class='form-control form-control-sm'>";
		$tr .="<option value=''></option>";
        $a = mysql_query("select * from rutas");
        while($rs = mysql_fetch_array($a)){
			$sector = $rs["sector"];
			
			$tr .= "<option value='$sector'>".$rs["sector"]."</option>";
			
        }
		$tr .= "</select>";
		echo $tr;
}

function cobradores(){
		include("config.php");
		$tr .= "<select name='cobrador0' id='cobrador0' class='form-control form-control-sm'>";
		$tr .="<option value=''>Todos</option>";
        $a = mysql_query("select * from cobradores");
        while($rs = mysql_fetch_array($a)){
			$nombre = $rs["nombre_cobrador"];
			
			$tr .= "<option value='$nombre'>".$rs["nombre_cobrador"]."</option>";
			
        }
		$tr .= "</select>";
		echo $tr;
}

function imei(){
		include("../php/config.php");
		$codigo=$_GET["codigo"];
		
		$tr .= "<select name='imeis' id='imeis' class='form-control form-control-sm'>";
			$tr .= "<option value=''> Seleccione un imei</option>";
        $a = mysql_query("select * from imei where codigo='$codigo' and vendido!=1") or die (mysql_error());
        while($rs = mysql_fetch_array($a)){
			$imei = $rs["imei"];
			
			$tr .= "<option value='$imei'>".$rs["imei"]."</option>";
			
        }
		$tr .= "</select>";
		echo $tr;
}

function clientes(){
		include("config.php");
		$tr .= "<select name='cliente0' id='cliente0' class='form-control form-control-sm mx-2 col-4' onChange='lista_prestamos(this.value)'>";
		$tr .="<option value=''></option>";
        $a = mysql_query("select * from clientes");
        while($rs = mysql_fetch_array($a)){
			$nombre = $rs["nombre"];
			$id = $rs["id_cliente"];
			$tr .= "<option value='$id'>".$rs["nombre"]."</option>";
			
        }
		$tr .= "</select>";
		echo $tr;
}
?>
