<?php
	require $_SERVER["DOCUMENT_ROOT"].'/inc/conexao.php';
	require $_SERVER["DOCUMENT_ROOT"].'/inc/functions.php';
	require $_SERVER["DOCUMENT_ROOT"].'/api/pages/nova-aposta.php';

	// Recebe variáveis
	$urlbase = $_SERVER['SERVER_NAME'].$_SERVER ['REQUEST_URI'];
	$parts = parse_url($urlbase);
	parse_str($parts['query'], $query);
	$_GET = $query;
?>

<style>

	* {
		font-family: Arial, Helvetica;
	}

	.f13 { font-size: 13px; }
	.f14 { font-size: 14px; }
	.f15 { font-size: 15px; }
	.f16 { font-size: 16px; }
	.f17 { font-size: 17px; }
	.f18 { font-size: 18px; }
	.f19 { font-size: 19px; }
	.f20 { font-size: 20px; }
	.margin0 { margin: 0; }

	.center {
		text-align: center;
	}

	.print_area {
		width: 100%;
		max-width: 7.9cm;
		margin: 10px auto;
	}

	.print_area h2 {
		margin: 8px 0;
	}

	.print_area .dashed {
		border-top: 1px dashed #000;
		height: 2px;
		margin: 5px 0;
		display: block;
	}

	.print_area .dashed10 { margin: 10px 0 !important; }

	.print_area .pull-right { float: right; }

	.print_area .event { border: 2px solid #000; font-weight: bold; padding: 5px 0; margin-bottom: 5px; }

	.odd {
		padding: 3px;
		border: 1px solid #000;
	}

	.datediv { padding: 10px 0; }

</style>

<div class="print_area">
	<h2 class="center"><?php echo utf8_encode($_SESSION["configs"]["config_nome"]); ?></h2>
	<div class="tel center f14">TEL.: <?php echo exibirTelImpressao($_SESSION["configs"]["config_tel_impressao"], $_SESSION["configs"]["config_telefone"], $cupom["cupom_usuario"], $users); ?></div>
	<div class="dashed dashed10"></div>
	<div class="f14"><b>Data: </b> <span class="pull-right"><?php echo date('d/m/Y H:i:s'); ?></span></div>
	<div class="dashed dashed10"></div>
	<h4 class="center margin0">TABELA</h4>
	<div class="dashed dashed10"></div>

	<?php
        foreach ($p["data"] as $pais => $i) {
        	foreach ($i as $event => $m) {
        		if(count($m) == 0){ continue; }
                if(in_array($event, $removidos)){ continue; }
        		if(isset($_GET["campeonato"]) && $_GET["campeonato"] <> '' && ($event <> $_GET["campeonato"] && $pais.' - '.$event <> $_GET["campeonato"])){ continue; }

				echo '<div class="event f16 center">'.$event.'</div>';
                foreach ($m as $mid => $match) {
                    if(in_array($mid, $removidos)){ continue; }
	?>
	<div class="item">
		<b><?php echo $match['name']; ?></b>
		<div class="datediv"><?php echo $match['data']; ?> <span class="pull-right"><b><?php echo ('<a class="odd">'.$match["casa"].'</a> <a class="odd">'.$match["empate"].'</a> <a class="odd">'.$match["fora"].'</a>'); ?></b></span></div>
		<div class="dashed"></div>
	</div>
	<?php
				}
			}
		}
	?>

	<div class="center f13">Sistema FBET</div>
	<div class="dashed"></div>
</div>


<script> print(); </script>