Location: PHPKode > projects > PMbyAS - Gestione Attivita > versione_4_1/pmbyas_4_1_script/PMbyAS-4-0/svdtrg.php
<?php
/*******************************************************************************
 *  filename    : agdet_a.php
 *  last change : 2006 - 10 - 20
 *
 *  http://www.avesan.it/
 *  Copyright 2006 Alberto Santoro
 *
 *  PMbyAS is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 ******************************************************************************/
$pgm="agdet_a.php";
// --------------- connessione
require_once "./_fcom/fconn.php";
// --------------- sessione
require_once "./_fcom/fsess.php";
// --------------- dati di sessione
require_once "./_fcom/fperiodo.php";

// --------------- inclusione della testata HTML
require_once "./_fcom/doctype.php";
// ------------- inclusione barra navigazione
require_once "./_fcom/nav.php";

$opt = $_REQUEST['opt'];
$mese = $_REQUEST["mese"];

// --------------------------------------------- impostazione inizio e fine periodo
if ($opt == "T") {$dxper = "fino ad oggi";}
else  { $dti = substr($mese,0,4)."-".substr($mese,4,2)."-01"; 
        $ani = substr($dti,0,4); $mei = substr($dti,5,2); $ggi = substr($dti,8,2); 
        $gmm = date("t",mktime(0,0,0,$mei,$ggi,$ani));   
        $dtf = $ani."-".$mei."-".$gmm; 
        $dati = getdate(mktime(0,0,0,$mei,$ggi,$ani));
        $mdx = $dati['mon'];   $mesedex = f_dex_mese($mdx);
        $dxper = "per il mese di: ".$mesedex." ".$ani; } 

//print "$dti; $dtf";

// --------------- Intestazione di funzione 
$tsfun="Statistiche di registrazione";
$tsdt1 = $dxper;
$tsdt2=" "; 
require_once "./_fcom/tstnopm.php"; 

print "\n<div class=\"cpnn\">";
if ($opt == "T") {
   print "\n<table class=\"tbover\" width=\"240\"><thead><tr>";
   print "\n<th class=\"t8n\" width=\"40\">&nbsp;</th>";
   print "\n<th class=\"t8n\" width=\"20\">&nbsp;</th>";
   print "\n<th class=\"t8c\" width=\"60\">mese</th>";
   print "\n<th class=\"t8d\" width=\"80\">registrazioni&nbsp;</th>";
   print "\n</tr></thead><tbody>";      
// ----------------- estrazione da time report 
$query = "SELECT EXTRACT(YEAR_MONTH FROM AgDay) as mese, COUNT(AgDay) as nreg FROM age_pgm GROUP BY mese";
$rsns = mysqli_query($connessione,$query) or die("Query age fallita");
while ($rg = mysqli_fetch_assoc($rsns))   {
   
   $pme = substr($rg["mese"],4,2);  $pan = substr($rg["mese"],0,4);
   print "\n<tr><td>&nbsp;</td>";
   print "\n<td class=\"pup\"><a href=\"svdtrg.php?opt=M&mese={$rg["mese"]}\">$_pup</a></td>";
   print "\n<td class=\"c8c\">$pme &middot; $pan</td>"; 
   print "\n<td class=\"c8d\">{$rg["nreg"]}&nbsp;</td></tr>"; 
   $tot = $tot + $rg["nreg"];                  
   }
print "\n<tr><td colspan=\"3\" class=\"c8d\">totale&nbsp;</td>";
print "\n<td class=\"c8d\">$tot&nbsp;</td></tr></tbody>"; 
print "\n<tfoot><tr><td>&nbsp</td>
       <td colspan=\"3\">&curren; &nbsp; dettaglio dei giorni del mese</td></tr></tfoot></table>"; 
}

else {
   print "\n<table class=\"tbover\" width=\"280\"><thead><tr>";
   print "\n<th class=\"t8n\" width=\"40\">&nbsp;</th>";
   print "\n<th class=\"t8n\" width=\"20\">&nbsp;</th>";
   print "\n<th class=\"t8c\" width=\"60\">giorno</th>";
   print "\n<th class=\"t8d\" width=\"80\">registrazioni&nbsp;</th>";
   print "\n<th class=\"t8n\" width=\"60\">&nbsp;</th>";
   print "\n</tr></thead><tbody>";   
// ----------------- estrazione da time report 
$query = "SELECT EXTRACT(DAY FROM AgDay) as giorno, 
                 COUNT(AgDay) as nreg FROM age_pgm 
                 WHERE AgDay <= \"$dtf\" and AgDay >= \"$dti\"
                 GROUP BY giorno";
$rsns = mysqli_query($connessione,$query) or die("Query age 2 fallita");
while ($rg = mysqli_fetch_assoc($rsns))   {

   print "\n<tr><td>&nbsp;</td>";
   $day = $ani."-".$mei."-".$rg["giorno"];
   print "\n<td class=\"pup\"><a href=\"rpagp_gg.php?opt=PV&day=$day\">$_pup</a></td>";
   print "\n<td class=\"c8c\">{$rg["giorno"]}</td>"; 
   print "\n<td class=\"c8d\">{$rg["nreg"]}&nbsp;</td></tr>"; 
   $tot = $tot + $rg["nreg"];
               
   }
print "\n<tr><td colspan=\"3\" class=\"c8d\">totale&nbsp;</td>";
print "\n<td class=\"c8d\">$tot&nbsp;</td></tr></tbody>"; 
print "\n<tfoot><tr><td>&nbsp</td>
       <td colspan=\"4\">&curren; &nbsp; dettaglio registrazioni del giorno</td></tr></tfoot></table>"; 

}
print "\n</div>";
             
?>
</div>
</body>
</html>
Return current item: PMbyAS - Gestione Attivita