<?php
include "conexao.php";

$sql_consult = $sqli->query("SELECT * FROM empresas WHERE id='".$_GET['id']."'");
$row_consult = $sql_consult->fetch_assoc();

$sql_atividade = $sqli->query("SELECT * FROM atividades WHERE id='".$row_consult['id_atividade']."'");
$row_atividade = $sql_atividade->fetch_assoc();

$sql_grupos = $sqli->query("SELECT * FROM grupos WHERE id='".$row_consult['id_grupo']."'");
$row_grupos = $sql_grupos->fetch_assoc();

$sql_setores = $sqli->query("SELECT * FROM setores WHERE id='".$row_consult['id_setor']."'");
$row_setores = $sql_setores->fetch_assoc();

header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=".$row_consult['razao_social'].".doc");

?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
        body, h2{
            font-family: Arial;
        }

    </style>

</head>

<body>


<h2>Dados Iniciais</h2>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Razão Social</b></label>
    <p class="font-info"><?php echo $row_consult['razao_social'] ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Ramo de Atividade</b></label>
    <p class="font-info"><?php echo $row_atividade['atividade'] ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Setor</b></label>
    <p class="font-info"><?php echo $row_setores['setor'] ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Controlador</b></label>
    <p class="font-info"><?php echo $row_consult['controlador'] ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Grupo</b></label>
    <p class="font-info"><?php echo $row_grupos['grupo'] ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Data de abertura</b></label>
    <p class="font-info"><?php echo date('d/m/Y', strtotime($row_consult['data_abertura'])); ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Missão</b></label>
    <p class="font-info"><?php echo $row_consult['missao'] ?></p>
</div>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Estrelas</b></label>
    <p class="font-info">
        <?php
        if($row_consult['transparencia'] == 0) {
            echo 0;
        }
        else {
            for ($i = 1; $i <= $row_consult['transparencia']; $i++) {
                ?>
                <i class="fa fa-star"></i>
                <?php
            }
        }
        ?>
    </p>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Transparência</b></label>
    <p class="font-info"><?php echo nl2br($row_consult['transparencia_txt']); ?></p>
</div>
<br><br><br>
<h2>Dados adicionais</h2>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Informações sobre Empresa</b></label>
    <div class="font-info" ><?php echo nl2br($row_consult['informacoes_empresa']); ?></div>
</div>
<br>
<div class="form-group"  >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Política de Patrocínio?</b></label>
    <div class="font-info" ><?php echo $row_consult['politica_patrocinio'] == 1 ? 'Sim' : 'Não' ?></div>
</div>
<br>
<div class="form-group" style=" padding-bottom: 40px;">
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Investe em Esporte?</b></label>
    <div class="font-info" ><?php echo $row_consult['esporte_txt'] ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Investe em Sociocultural?</b></label>
    <div class="font-info" ><?php echo $row_consult['sociocultura'] ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Perfil de investimento</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['perfil_investimento']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Recebimento de projetos</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['periodo_projetos']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Para encaminhar projeto</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['receber_projetos']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Critérios</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['criterios']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Lei de Incentivo</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['lei_incentivo']); ?></div>
</div>
<br><br><br>

<h2>Contatos</h2>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Local da sede</b></label>
    <p class="font-info"><?php echo $row_consult['cidade'] ?> / <?php echo $row_consult['estado'] ?></p>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Endereço</b></label>
    <p class="font-info"><?php echo $row_consult['endereco'] ?></p>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Website</b></label>
    <p class="font-info"><a href="http://<?php echo $row_consult['site'] ?>" target="_blank"><?php echo $row_consult['site'] ?></a></p>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Contatos</b></label>
    <p class="font-info"><?php echo $row_consult['dados_contato']; ?></p>
</div>
<br><br><br>
<h2>Social</h2>

<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Áreas de atuação</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['area_atuacao']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Beneficiários</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['beneficiarios']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Região de Atuação</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['regiao_atuacao']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Projetos que desenvolve</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['projetos_desenvolve']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Projetos que apoia</b></label>
    <div class="font-info" ><?php echo nl2br($row_consult['projetos_apoia']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Critérios para apoio</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['criterio_apoio']); ?></div>
</div>
<br>
<div class="form-group">
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Quem pode se candidatar</b></label>
    <p class="font-info"><?php echo nl2br($row_consult['quem_pode_candidatar']); ?></p>
</div>
<br>
<div class="form-group">
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Para Enviar Projetos social</b></label>
    <div class="font-info"><?php echo nl2br($row_consult['envio_projetos']); ?></div>
</div>
<br>
<div class="form-group" >
    <label class="control-label" style="color:#666; font-weight: bold;"><b>Para Receber Projetos</b></label>
    <div class="font-info"><?php echo  nl2br($row_consult['para_receber_projetos']); ?></div>
</div>
</body>
</html>