Location: PHPKode > projects > PMbyAS - Gestione Attivita > versione_4_1/pmbyas_4_1_script/PMbyAS-4-0/trvalagg.php
<?php
/*******************************************************************************
 *  filename    : trvalagg.php
 *  last change : 2008 - 11 - 10
 *
 *  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="trvlagg.php";
// --------------- connessione
require_once "./_fcom/fconn.php";
// --------------- sessione
require_once "./_fcom/fsess.php";
// --------------- dati di sessione
require_once "./_fcom/fperiodo.php";
// inclusione $urip = prefisso URI per header(location
require_once "./_fcom/pref_uri.php";

$oggi = date("Y.m.d");


$query = "LOCK TABLES vrf_tmrep WRITE, time_report WRITE";
$qlock = mysqli_query($connessione,$query) or die("Query  lock vrf_tmrep fallita");  

// ============================================ singole righe
if ($_POST['sub'] == "registra") { 

foreach ($_POST as $key => $value){
   if ($key <> "sub"){
   $wka = explode(";",$key); $num = $wka[0]; $riga = $wka[1];
//   print "\nnum=$num; riga=$riga<br />";

    $query = "UPDATE vrf_tmrep 
                 SET VrGtmStato  =\"V\", 
                     VrGtmStDay = \"$oggi\"
                 WHERE VrGtmNum = $num AND VrGtmRiga = \"$riga\"";
    $qupd = mysqli_query($connessione,$query) or die("Query upd  vrf_tmrep  fallita");}
}}

// ============================================ convalida tutto
if ($_POST['sub'] == "convalida tutto"){
// ---------------------------------------- lettura time report
$query = "SELECT * FROM vrf_tmrep, time_report 
           WHERE   VrGtmNum = Gtmnum and VrGtmRiga = GtmRiga and VrGtmStato <> \"V\"
           and VrGtmResp = \"$SE_rsucod\"" ; 
$rsns = mysqli_query($connessione,$query) or die("Query time report fallita");
while ($rg = mysqli_fetch_assoc($rsns)) {
   $num = $rg["GtmNum"]; $riga = $rg["GtmRiga"];
    $query = "UPDATE vrf_tmrep 
                 SET VrGtmStato  =\"V\", 
                     VrGtmStDay = \"$oggi\"
                 WHERE VrGtmNum = $num and VrGtmRiga = \"$riga\"";
    $qupd = mysqli_query($connessione,$query) or die("Query upd  vrf_tmrep  fallita");  
}}


$query = "UNLOCK TABLES ";
$rsulk = mysqli_query($connessione,$query) or die("Query unlock gru fallita");  
    
$urif = "trvalb.php"; // ------------ rientro
header ("location:$urip$urif" );      exit;


?>
Return current item: PMbyAS - Gestione Attivita