Location: PHPKode > projects > PMbyAS - Gestione Attivita > versione_4_1/pmbyas_4_1_script/PMbyAS-4-0/rd011_d.php
<?php
/*******************************************************************************
 *  filename    : rd001_d.php
 *  last change : 2006 - 11 - 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.
 ******************************************************************************/
// --------------- connessione
require_once "./_fcom/fconn.php";
// --------------- sessione
require_once "./_fcom/fsess.php";
// --------------- dati di sessione
require_once "./_fcom/fperiodo.php";

// -------------------------------- parametri di lavoro
$vs = substr($_REQUEST['opt'],0,1);
$tm = substr($_REQUEST['opt'],1,1); 
$wka = explode("-",$_REQUEST['opt']);
$ccr = $wka[1]; 
$pgm="rd011_d.php?opt=".$vs.$tm."-".$ccr;

// --------------- lettura ccr
$query = "SELECT * FROM unita WHERE UnCod = \"$ccr\" ";
$rsok = mysqli_query($connessione,$query) or die("Query fallita");
$rgp = mysqli_fetch_assoc($rsok);
$dexccr = $rgp['UnCod']." &middot ".$rgp['UnDex'];


// ======================================  versione video / stampa
// --- versione video
if ($tm <> "P") {
   require_once "./_fcom/doctype.php"; // --- testata html video
   require_once "./_fcom/nav.php";     // --- barra di navigazione
   $tsfun="Dettaglio Centro di Responsabilità";
   $tsextra = $dexccr;
   if ($vs == "P")                     
      {$tsprint = "rd011_d.php?opt=PP"."-".$ccr;
       require_once "./_fcom/tstper.php"; require_once "./_fcom/tstdxgen.php"; }
   else {$tsprint = "rd011_d.php?opt=MP"."-".$ccr;
         require_once "./_fcom/tstme.php"; require_once "./_fcom/tstdxgen.php"; }
}
// --- versione stampa
else  {require_once "./_fcom/doctype_p.php"; // --- testata html stampa
      if ($vs == "P")  {require_once "./_fcom/pr_perdx.php";}
      else             {require_once "./_fcom/pr_medx.php";}
      $rptitle="Dettaglio Centro di Responsabilità &nbsp; ".$dexccr;
      $len = 673; 
      $rptdex= $pr_inizio." &nbsp; - &nbsp; ".$pr_fine;
      require_once "./_fcom/rptesta.php";  
}
// ------------------------------------------------------------------


// --------------------------------- edit ore/minuti
require_once "./_fcom/ed_hh_mm.php";

// ============================================================================ lettura agenda
$query = "SELECT AgPgm, AgPgmUff, AgDay, AgEMin, AgEVal, AgVtp, AgRsu, 
                 RsuCod, RsuDex, PgmCcr
            from age_pgm, pge_ru, prog
           WHERE AgDay >= \"$SEDTI\" and AgDay <= \"$SEDTF\"  
             and RsuCod = AgRsu and PgmCod = AgPgm
             and PgmCcr = \"$ccr\"
            ORDER BY  AgRsu "; 
$qok = mysqli_query($connessione,$query) or die("Query fallita");
$nrec = mysqli_num_rows($qok);
if ($nrec == 0) {print "\n<br /><div class=\"cpnn\"><div class=\"pd8c\">Nessuna registrazione</div></div>";}
else {

// --------------- campi per totalizzazioni
$pmin = 0;  $pcl = 0; $pcs = 0;
$tmin = 0;  $tcl = 0; $tcs = 0; 
$gmin = 0;  $gcl = 0; $gcs = 0; 

$rsu = " ";  $sw1 = 0; $dex = " ";
// ------------------------ testata tabella risorse
print "\n<div class=\"cpnn\">";
print "\n<table ><thead><tr>";
print "\n<td width=\"22\" >&nbsp;</td>";
print "\n<th class=\"t8s\" width=\"300\">codice e descrizione risorsa</th>";
print "\n<th class=\"t8d\" width=\"90\">ore</th>";
print "\n<th class=\"t8d\"  width=\"110\">costo lavoro</th>";
print "\n<th class=\"t8d\"  width=\"110\">spese</th>";
// --- corpo scrollabile
print "\n<th  width=\"20\">&nbsp</th>";
print "\n</tr></thead>";
if ($tm <> "P")  
   {print "\n<tfoot><tr>";
    print "\n<td class=\"pd8s\"colspan=\"6\">&curren; dettaglio ore e spese &nbsp; &nbsp; &nbsp; Arrotondamenti all'unità</td>";}
else print "\n<td colspan=\"6\">&nbsp;</td>";
print "\n</tr></tfoot>";
print "\n<tbody><tr><td colspan=\"6\"><div class=\"win478\"><table class=\"tbover\">";

// -------------------------------------------------------------------------
while ($rg = mysqli_fetch_assoc($qok))  {
   if ($sw1 == 0)
      {$rsu = $rg["AgRsu"];   $dex = $rg["RsuDex"];
       $sw1 = 1;}
   
   if ($rsu <> $rg["AgRsu"]) {

   print "\n<tr>\n";

   $swp = "P"; $swt = "-"; $fal = "N";
   $lk = "agdet_u.php?opt=PV-".$rsu."-".$job;
if ($tm <> "P") {
   print "\n<td width=\"20\" class=\"pup\"><a href=$lk>$_pup</a></td>";}
else print "\n<td width=\"20\">&nbsp;</td>";
   print "\n<td width=\"300\" class=\"c8s\">$rsu &middot; $dex</td>";
   $whm = ed_ore_minuti($pmin);  
   print "\n<td width=\"90\" class=\"c8d\">$whm[4]</td>";
   $ecl = number_format($pcl, 2, ',', '.');
   print "\n<td width=\"110\" class=\"c8d\">$ecl</td>";
   $ecs = number_format($pcs, 2, ',', '.');
   print "\n<td width=\"110\" class=\"c8d\">$ecs</td>";
   $rsu = $rg["AgRsu"]; $dex = $rg["RsuDex"];
   $pmin = 0;  $pcl = 0; $pcs = 0; 
   }

// -------------------- totalizzazioni   
   $pmin = $pmin + $rg["AgEMin"]; 
   $tmin = $tmin + $rg["AgEMin"]; 
   $gmin = $gmin + $rg["AgEMin"]; 

   if ($rg["AgVtp"] == "RU")
        {$pcl = $pcl + $rg["AgEVal"];
         $tcl = $tcl + $rg["AgEVal"];
         $gcl = $gcl + $rg["AgEVal"];}
   else {$pcs = $pcs + $rg["AgEVal"];
         $tcs = $tcs + $rg["AgEVal"];
         $gcs = $gcs + $rg["AgEVal"];}

  }
// --------------------- ultima riga
print "\n</tr><tr>";

$swp = "P"; $swt = "-"; $fal = "N";
$lk = "agdet_u.php?opt=PV-".$rsu."-".$job;
if ($tm <> "P") {
   print "\n<td width=\"20\" class=\"pup\"><a href=$lk>$_pup</a></td>";}
else print "\n<td width=\"20\">&nbsp;</td>";
print "\n<td width=\"300\" class=\"c8s\">$rsu &middot; $dex</td>";
$whm = ed_ore_minuti($pmin); 
print "\n<td width=\"90\" class=\"c8d\">$whm[4]</td>";
$ecl = number_format($pcl, 2, ',', '.');
print "\n<td width=\"110\" class=\"c8d\">$ecl</td>";
$ecs = number_format($pcs, 2, ',', '.');
print "\n<td width=\"110\" class=\"c8d\">$ecs</a></td>";

// ------------------totali
print "\n</tr><tr>";
print "\n<td class=\"c8d\" colspan=\"2\">Totale&nbsp;</td>";
$whm = ed_ore_minuti($tmin); 
print "\n<td class=\"c8d\">$whm[4]</td>";
$ecl = number_format($tcl, 2, ',', '.');
print "\n<td class=\"c8d\">$ecl</td>";
$ecs = number_format($tcs, 2, ',', '.');
print "\n<td class=\"c8d\">$ecs</td>";

print "\n</tr></table></div></td></tr></tbody></table></div>";

// --------------------------------------------------------
} // --- fine zero records


if ($tm <> "P") print "\n</div>";

?>
</body>
</html> 
Return current item: PMbyAS - Gestione Attivita