<?php
	session_start();
	if (isset($_SESSION['acesso_admin'])){
		$acesso_idusuario=$_SESSION['acesso_idusuario'];
		$acesso_idempresa=$_SESSION['acesso_idempresa'];
		$acesso_admin=$_SESSION['acesso_admin'];
		$acesso_revenda=$_SESSION['acesso_revenda'];
		include ('../Amfphp/Services/conexao.php');
		include('funcoes.php');
		$con = new conexao();
		$dia=date('d');
		$mes=date('m');
		$ano=date('Y');
		$dataatual=date('d/m/Y');
		$horaatual=date('h:i');	
	} else {
		echo "<script>window.location='index.php';</script>";
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSPADM Mobile - Renovacao / Bloqueio de Clientes</title>
<link href="cspadm.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="post" action="renovar_mobile.php">
  <table width="410" border="1">
    <tr bgcolor="#FFFFCC" class="txtAlertaBOX">
      <td colspan="2"><a href="menu_mobile.php">(&lt;-- Voltar)<br />
        Renovacao / Bloqueio de Clientes</a></td>
    </tr>
    <tr class="txtBOX">
      <td width="139">Login:</td>
      <td width="255"><label for="edt_login"></label>
      <input type="text" name="edt_login" id="edt_login" /></td>
    </tr>
    <tr class="txtBOX">
      <td>Vencimento:</td>
      <td><label for="edt_validoem"></label>
      <input name="edt_validoem" type="text" id="edt_validoem" size="12" maxlength="10" /> 
      ate 
      <label for="edt_vencimentoate"></label>
      <input name="edt_vencimentoate" type="text" id="edt_vencimentoate" size="12" maxlength="10" /></td>
    </tr>
    <tr class="txtBOX">
      <td colspan="2" align="center"><input type="submit" name="Filtrar" id="Filtrar" value="Filtrar" /></td>
    </tr>
    <tr class="txtBOX">
      <td colspan="2" class="relatorio3">Registros encontrados ...</td>
    </tr>
    <tr class="txtBOX">
      <td colspan="2" class="relatorio3"><table width="408" border="0">
      <?php
		$sql = "select csp_user.*, profile.profile as profile from csp_user, provedor, profile where csp_user.idempresa = '$acesso_idempresa' and csp_user.id = provedor.idprovedor and provedor.idrevendedor='$acesso_idusuario' and csp_user.idprofile = profile.idprofile";
		if ($edt_login <> ""){
			$sql .= "  and csp_user.name like '$edt_login%'";	
		}
		if ($edt_validoem <>"" && $edt_validoate <>""){
			$validoI = ymd($edt_validoem);
			$validoF = ymd($edt_validoate);
			$sql .= " and csp_user.expiredate between '$validoI' and '$validoF'" ;
		}
		$resultado = $con->banco->Execute($sql);
		while ($registro = $resultado->FetchNextObject()){
			$csp_login    = $registro->NAME;
			$csp_expire   = dmy($registro->EXPIREDATE);
			$csp_situacao =  $registro->ENABLED;
			$csp_profile  = $registro->PROFILE;
			?>
        <tr>
          <td><a href="acao_renovar_mobile.php?idempresa='<?php echo $acesso_idempresa;?>&csp_login=<?php echo $csp_login;?>"><?php echo $csp_login;?></a></td>
          <td><?php echo $csp_situacao;?></td>
          <td><?php echo $csp_profile;?></td>
        </tr>
        <?php } ?>
      </table></td>
    </tr>
  </table>
</form>
</body>
</html>