<?php 

	require_once 'controls/verifylogin.php';
	require_once 'funcoes.php';
	require_once('Connections/paivaconex.php'); 


//USING
require_once 'controls/verifylogin.php';
	
	
mysql_select_db($database_paivaconex, $paivaconex);
$query_fornecedor = "SELECT * FROM mfin_fornecedores Order by NomeFantasia";
$fornecedor = mysql_query($query_fornecedor, $paivaconex) or die(mysql_error());
$row_fornecedor = mysql_fetch_assoc($fornecedor);
$totalRows_fornecedor = mysql_num_rows($fornecedor);

mysql_select_db($database_paivaconex, $paivaconex);
$query_cliente = "SELECT * FROM mfin_clientes Order by NomeFantasia";
$cliente = mysql_query($query_cliente, $paivaconex) or die(mysql_error());
$row_cliente = mysql_fetch_assoc($cliente);
$totalRows_cliente = mysql_num_rows($cliente);

mysql_select_db($database_paivaconex, $paivaconex);
$query_pasta = "SELECT * FROM mfin_pastas Order by Numero";
$pasta = mysql_query($query_pasta, $paivaconex) or die(mysql_error());
$row_pasta = mysql_fetch_assoc($pasta);
$totalRows_pasta = mysql_num_rows($pasta);

mysql_select_db($database_paivaconex, $paivaconex);
$query_contas = "SELECT * FROM mfin_contas Order by Nome";
$contas = mysql_query($query_contas, $paivaconex) or die(mysql_error());
$row_contas = mysql_fetch_assoc($contas);
$totalRows_contas = mysql_num_rows($contas);

mysql_select_db($database_paivaconex, $paivaconex);
$query_grupo_contas = "SELECT * FROM mfin_grupocontas Order by Nome";
$grupo_contas = mysql_query($query_grupo_contas, $paivaconex) or die(mysql_error());
$row_grupo_contas = mysql_fetch_assoc($grupo_contas);
$totalRows_grupo_contas = mysql_num_rows($grupo_contas);

?>

<!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=windows-1252">
	
		<title>Módulo Financeiro</title>
        
<script src="js/jquery-1.7.2.js" type="text/javascript"></script>
<script src="js/jquery.maskedinput-1.3.min.js" type="text/javascript"></script>
<script>
        jQuery(function($){
		   $("#data_ini").mask("99/99/9999");
		   $("#data_fim").mask("99/99/9999");
		 });
        
</script>
<script type="text/javascript">
$(document).ready(function() {
    var a = 0;
			
			$("#data_ini").keyup(function(){
				var b = 0;
				a = $(this).val();
				$.each( a, function( key, value ) {
					if(value != '_'){
						b = b+1;
					}  
				});
				
				if (b == 10){
					$("#data_fim").focus();
				}
			});
        });
        
</script>
        
		
		<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
		<?php include_once('controls/import.php'); ?>
	
	<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
	</head>
<body>
	
<?php include_once('controls/header.php'); ?>

	<div class="content">
	
		<div class="form">
		
		<?php include_once('controls/menu.php'); ?>
			
			<div id="conteudo-site">
			
				<div class="titulo-conteudo-site">
					<img src="images/applications.png" title="" alt="" /> Módulo Financeiro  
				</div>
				<p>&nbsp;</p>
			  <p>&nbsp;</p>
                <form id="form1" name="form1" method="get" action="lucro_relatorio.php">
      <table border="1" align="center">
        <tr>
          <td colspan="2">Pagamentos</td>
          </tr>
          <tr>
            <td>Status</td>
            <td><input name="status" type="radio" id="status" value="0" checked="checked" />Todos
            <input type="radio" name="status" id="status" value="1" />
            Em Aberto
            <input type="radio" name="status" id="status" value="2" />
            Pagos
            </td>
          </tr>
          <tr>
          <td><p>Fornecedor:</p></td>
          <td><select name="fornec_id" id="fornec_id">
            <option value="0">Todos</option>
            <?php
do {  
?>
            <option value="<?php echo $row_fornecedor['Id']?>"><?php echo $row_fornecedor['NomeFantasia']?></option>
            <?php
} while ($row_fornecedor = mysql_fetch_assoc($fornecedor));
?>
          </select></td>
          </tr>
          <tr>
          <td>Cliente:</td>
          <td><select name="cliente_id" id="cliente_id">
          <option value="0">Todos</option>
            <?php
do {  
?>
            <option value="<?php echo $row_cliente['Id']?>"><?php echo $row_cliente['NomeFantasia']?></option>
            <?php
} while ($row_cliente = mysql_fetch_assoc($cliente));
?>
          </select></td>
          </tr>
          <tr>
          <td><p>Pasta:</p></td>
          <td><select name="pasta_id" id="pasta_id">
          <option value="0">Todos</option>
            <?php
do {  
?>
            <option value="<?php echo $row_pasta['Id']?>"><?php echo $row_pasta['Numero']?></option>
            <?php
} while ($row_pasta = mysql_fetch_assoc($pasta));
?>
          </select></td>
          </tr>
          <tr>
          <td>Contas:</td>
          <td><select name="contas_id" id="contas_id">
          <option value="0">Todos</option>
            <?php
do {  
?>
            <option value="<?php echo $row_contas['Id']?>"><?php echo $row_contas['Nome']?></option>
            <?php
} while ($row_contas = mysql_fetch_assoc($contas));
?>
          </select></td>
          </tr>
          <tr>
          <td>Grupo de Contas:</td>
          <td><select name="grupo_contas_id" id="grupo_contas_id">
          <option value="0">Todos</option>
            <?php
do {  
?>
            <option value="<?php echo $row_grupo_contas['Id']?>"><?php echo $row_grupo_contas['Nome']?></option>
            <?php
} while ($row_grupo_contas = mysql_fetch_assoc($grupo_contas));
?>
          </select></td>
          </tr>
          
        <tr>
          <td colspan="2"><input type="submit" name="Ok" id="Ok" value="Vizualizar" /></td>
        </tr>
        </table>
      
    </form>
    
          </div>
			
		</div>
		
	</div>
	
	<?php include_once('controls/footer.php'); ?>
</body>
</html>