<?php
checkLogin('adm');
checkEnteService('pps');
$p = new Page('Servizio Pre / Post scuola');
$p->addMenu('logged');
$p->printHeader();

//numero iscritti per servizio
$result = $mysqli->query("
SELECT COUNT(*) AS tot FROM serv_pps 
LEFT JOIN anagrafiche ON serv_pps.anagr_id = anagrafiche.anagr_id
WHERE servpps_pre = 1 AND servpps_sospeso = 0 AND anagrafiche.ente_id = ".$_SESSION['user']['ente_id']." AND anagrafiche.anno = ".$_SESSION['user']['ente_anno']);
$pre = $result->fetch_object()->tot;
$result = $mysqli->query("
SELECT COUNT(*) AS tot FROM serv_pps 
LEFT JOIN anagrafiche ON serv_pps.anagr_id = anagrafiche.anagr_id
WHERE servpps_post = 1 AND servpps_sospeso = 0 AND anagrafiche.ente_id = ".$_SESSION['user']['ente_id']." AND anagrafiche.anno = ".$_SESSION['user']['ente_anno']);
$post = $result->fetch_object()->tot;

?>

	
<h3 class="p-title">Servizio Pre / Post scuola</h3>
<div class="panel panel-default">
	<div class="panel-body" style="min-height:150px">
    	<div class="row">
        	<div class="col-sm-4 col-md-3 m-top-bottom-5">
            	<button data-open="modal" data-url="/servizi/diag/gruppi/?serv=pps" data-small="1" class="btn btn-service btn-lg btn-block">
                <span class="glyphicon glyphicon-th-list"></span> Gestione scuole</button>
            </div>
        	<div class="col-sm-4 col-md-3 m-top-bottom-5 btn-group">
                  <button type="button" class="btn btn-service dropdown-toggle btn-lg btn-block" data-toggle="dropdown">
                    <span class="glyphicon glyphicon-print"></span>
                    Stampe <span class="caret"></span>
                  </button>
                  <ul class="dropdown-menu" role="menu">
                    <li><a href="#" data-open="modal" data-url="/serv_pps/diag/print_presenze/" data-small="1">Stampa presenze</a></li>
                    <li><a href="../print_delegati/">Stampa delegati ritiro</a></li>
                  </ul>
            </div>
        	<div class="col-sm-4 col-md-3 m-top-bottom-5">
            	<a href="../show_presenze/"class="btn btn-service btn-lg btn-block">
                <span class="glyphicon glyphicon-user"></span> Registro presenze</a>
            </div>
            <div class="col-sm-4 col-md-3 m-top-bottom-5">
                <a href="../settings/" class="btn btn-service btn-lg btn-block"><span class="glyphicon glyphicon-cog"></span> Impostazioni</a>
            </div>
        </div>
        <br>
        <div class="row p-bottom-5">
            <div class="col-sm-4 col-md-3">
                <span class="badge"><?php echo $pre;?></span> <span class="m-left-10 text-info">Iscritti <strong>PRE</strong> Scuola</span>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4 col-md-3">
                <span class="badge"><?php echo $post;?></span> <span class="m-left-10 text-info">Iscritti <strong>POST</strong> Scuola</span>
            </div>
        </div>
        
    </div>
</div>
<?php
if(isset($_GET['noprintresult']))
	Js('alert("Nessuna anagrafica da stampare");');

$p->printFooter();
?>