<!--	VENDAS		-->
<?php
	$dir = $_SERVER['DOCUMENT_ROOT']."/".substr(substr($_SERVER['REQUEST_URI'], 1), 0, strpos(substr($_SERVER['REQUEST_URI'], 1), '/'))."/phone_gap/";
	require_once($dir."/classes/Dados.class.php");
	require_once($dir."/dao/ConfigDAO.class.php");
	$dados = new Dados();
	
	$configdao = new ConfigDAO();
	$exibirData= $configdao->getDisponibilizar()->getData_rel_vendas();

	echo '<script src="vendas/vendas.js?ver='.$dados->getVersao().'"></script>';
?>
<div data-role="page" data-theme="b" data-control-title="Vendas" id="vendas" class="loading-show loading-hide mobipicker verifica-login">
	<div  data-role="header" data-position="fixed">
		<h3>
			Vendas
		</h3>
		<a href="#home" id="botaovoltarvendas" data-role="button" data-direction="reverse" data-transition="slide" class="ui-btn ui-shadow ui-corner-all ui-btn-icon-left ui-icon-back">
			Voltar
		</a>
	</div>
	<div data-role="content" class="conteudo">
		<div data-role="fieldcontain" data-controltype="dateinput">
			<label for="datainivendas">
				De:
			</label>
			<input class="mobipick" id="datainivendas" value='<?php echo date('Y-m-01'); ?>' type="text">
		</div>
		<div data-role="fieldcontain" data-controltype="dateinput">
			<label for="datafinvendas">
				Até:
			</label>
			<input class="mobipick" id="datafinvendas" value='<?php echo date('Y-m-t'); ?>' type="text">
		</div>
		
		<div data-controltype="checkboinput">
			<label for="descdev">
				 Descontar Devoluções
			</label>
			<input type="checkbox" id="descdev" checked="true">
		</div>
		
		<div data-controltype="checkboinput">
			<label for="somafrete">Somar Frete</label>
			<input type="checkbox" id="somafrete" checked="true">
		</div>
		
		<div data-role="fieldcontain" data-controltype="selectmenu">
			<label for="trocapor">% Troca:</label>
			<select id="trocapor" name="" >
				<option value="Quantidade" selected="selected">Quantidade</option>
				<option value="Faturamento">Faturamento</option>
			</select> 
		</div>
		
		<a id="botaofiltrar" data-role="button" data-transition="slide"  data-icon="arrow-r" data-iconpos="right" href="#filtros">
			Filtrar
		</a>
		<div data-role="fieldcontain" data-controltype="selectmenu">
			<label for="vendasmostrarpor">Mostrar por:</label>

			<select id="vendasmostrarpor" class="gambito" name="" >
				<option value="Supervisor">Supervisor</option>
				<option value="Vendedor">Vendedor</option>
				<option value="Cliente">Cliente</option>
				<option value="Familia">Familia</option>
				<option value="Marca">Marca</option>
				<option value="Grupo">Grupo</option>
				<option value="Subgrupo">Subgrupo</option>
				<option value="Produto" selected="selected">Produto</option>
				<option value="Portador">Portador</option>
				<option value="CondPagto">Condição de Pagamento</option>
			</select>
		</div>
		<div data-role="fieldcontain" data-controltype="selectmenu">
			<label for="vendasagrupar">Agrupar por:</label>

			<select id="vendasagrupar" name="" >
				<option value="" selected="selected">Sem Agrupamento</option>
				<option value="Supervisor">Supervisor</option>
				<option value="Vendedor">Vendedor</option>
				<option value="Cliente">Cliente</option>
				<option value="Cidade">Cidade</option>
				<option value="Familia">Familia</option>
				<option value="Grupo">Grupo</option>
				<option value="Produto">Produto</option>
				<option value="Data">Data</option>
				<option value="Portador">Portador</option>
				<option value="CondPagto">Condição de Pagamento</option>
			</select>
		</div>
		<div data-role="fieldcontain" data-controltype="selectmenu">
			<label for="vendasordenar">Ordenar por:</label>

			<select id="vendasordenar" name="" >
				<option value="3">Codigo</option>
				<option value="4" selected="selected">Descrição</option>
				<option value="5">Data</option>
				<option value="7">Qtde Venda</option>
				<option value="8">Qtde Bonif</option>
				<option value="11">Qtde Troca</option>
				<option value="13">Perc Troca</option>
				<option value="14">Perc Troca R$</option>
				<option value="9">Valor Venda</option>
				<option value="10">Valor Bonif</option>
				<option value="12">Valor Troca</option>
				<option value="6">Peso Bruto</option>
			</select> 
		</div>
		<a id="botaovisualizarvendas" data-role="button" data-transition="slide"  data-icon="arrow-r" data-iconpos="right" href="#relvendas">
			Visualizar
		</a>
	</div>
</div>

<!--	VISUALIZAR VENDAS	-->
<div data-role="page" data-theme="b" data-control-title="Home"  id="relvendas" class="loading-show verifica-login">
	<div  data-role="header" data-position="fixed" data-position="fixed">
		<h3 class="ui-title" role="heading" aria-level="1">
			Vendas
		</h3>
		<a href="#vendas" data-role="button" data-direction="reverse"  data-transition="slide" class="ui-btn ui-shadow ui-corner-all ui-btn-icon-left ui-icon-back" id="voltarrelvendas">
			Voltar
		</a>
		<!--<a data-role="button"  class="ui-btn ui-shadow ui-corner-all ui-btn-icon-right ui-icon-action" id="btimprimirvendas" class="imprimir">
			Imprimir
		</a>-->
	</div>
	<div data-role="content" id='divtabelavendas' class="conteudo">
		<table data-role="table" id="tabelarelvendas" data-mode="columntoggle" class="ui-body-d ui-shadow table-stripe ui-responsive" data-column-btn-theme="b" data-column-btn-text="Colunas" data-column-popup-theme="b" style="text-align: center;">
			<thead>
			  <tr class="ui-bar-d">
				<th data-priority="5" style="text-align: left;">Codigo</th>
				<th id="colmostarporrelvendas" style="text-align: left;">Familia</th>
				<?php
					if ($exibirData)
						echo '<th data-priority="8">Data</th>';
				?>
				<th data-priority="3">Qtde Venda</th>
				<th data-priority="4">Qtde Bonif</th>
				<th data-priority="5">Qtde Troca</th>
				<th data-priority="13">Perc Troca</th>
				<th data-priority="14">Perc Troca R$</th>
				<th data-priority="1">Valor Venda</th>
				<th data-priority="2">Valor Bonif</th>
				<th data-priority="6">Valor Troca</th>
				<th data-priority="7">Peso Bruto</th>				
			  </tr>
			</thead>
			<tbody>

			</tbody>
		</table>
	</div>
</div>