<?php
include("../sessionreserved.php");
include("../../db.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Osservatorio Edile Biella - C.P.T. | Nuova visita</title>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAvnzqYxi83_Kgi00fv8YJyRSQ2BMzX7Vse3YRADHpruIA_5wdfBTuS_-_g9D8QDYRKpiBXG69dEO1Vw"></script>
<!--    <script src="http://maps.google.com/maps?file=api&v=2&key=AIzaSyDjFlJAclBBn9-qsEylLZdEvIKf8pBWTNw" type="text/javascript"></script>-->

<script language="javascript" src="../js/script.js"></script>
<script language="javascript" src="js/rlst.js"></script>
<script language="javascript" src="js/maps.js"></script>
<script language="javascript" src="../maps/js/maps.js"></script>

<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>

<body onload="document.getElementById('checkCustom').checked = false">

<div id="header"></div>
<div id="container">
	<div id="mainHeader" class="clearfix"><?php include("mainHeader.php");?></div>
	<?php include("mainMenu.php");?>
   
    <div id="mainContainer">
        <span class="mainContentTitle">Compilare il seguente modulo relativo ad una nuova visita.</span>
        <div id="mainContent" class="clearfix">
            <form name="newCant" method="post" action="visita_save.php" onsubmit="return ver_cant()">
            <div class="form clearfix">
            	<div class="row">
                	Il Geometra <strong><?php echo $_SESSION['user']['anagrafica'];?></strong> 
                    in qualit&agrave; di tecnico C.P.T. ha effettuato 
                    in Data 
                    <input name="datavisita" type="text" id="datavisita" size="10" maxlength="10" />
            		per conto di
                    <select name="percontodi" id="percontodi">
                    <option selected="selected" value="0"></option>
                    <?php
					$result = mysql_query("SELECT * FROM users WHERE zona <> '' AND dir = '".$_SESSION['dir']."' ORDER BY anagrafica");
						while($row = mysql_fetch_array($result))
							echo '<option value="'.$row['userid'].'">'.utf8_encode($row['anagrafica']).'</option>';
					?>
                    </select>
                </div>
                <div class="row">
                    <input class="check" type="radio" name="tipovisita" value="aziendale" /> Visita aziendale &nbsp;&nbsp;
                    <input class="check" type="radio" name="tipovisita" value="richiesta" /> Visita richiesta &nbsp;&nbsp;
                    <input class="check" type="radio" name="tipovisita" value="pos" /> Visione P.O.S. &nbsp;&nbsp;
                    <input class="check" type="radio" name="tipovisita" value="altro" maxlength="50" /> altro <input type="text" name="tipoaltro" />
                </div>
            	<div class="row">
                	Visita n. 1 <input type="hidden" name="nvisita" value="1" /> &nbsp;&nbsp;
                    <input name="congiunta" type="checkbox" class="check" value="1" /> Visita congiunta <input type="text" name="congiuntadesc" maxlength="100" size="40" onkeyup="checkcontrol('newCant','congiunta',this.value)" />
                </div>
            	<div class="sep"></div>
            	<div class="row" id="exactindirizzo">
                    Cantiere: Comune 
                   	<select id="ID_COMUNE" name="ID_COMUNE" onChange="stradario('via',this.value,'strad_via')">
                    <option selected="selected" value="0"></option>
                    <?php
					$result = mysql_query("SELECT * FROM civici_provbi GROUP BY Nome_Comun ORDER BY Nome_Comun");
						while($row = mysql_fetch_array($result))
							echo '<option value="'.$row['Codice_Com'].'">'.utf8_encode($row['Nome_Comun']).'</option>';
					?>
                    </select>
                    <span id="strad_via"></span>
                    <span id="strad_civico"></span>
                    <span id="strad_coord"></span>
                 </div>
				 <div class="row">
                    <input class="check" type="checkbox" id="checkCustom" onclick="customInd(this.checked)" /> Fuori provincia <br />
                 </div>
                 <div class="row" id="customindirizzo" style="display:none">
                    Comune <input type="text" size="30" id="custom_comune" name="custom_comune" maxlength="60" /> 
                    indirizzo <input type="text" id="custom_strada" name="custom_strada" size="50" maxlength="255" /> 
                    n. <input type="text" id="custom_numero" name="custom_numero" size="4" maxlength="20" /> 
                </div>                 
            	<div class="row">
                    Lavoro: &nbsp;&nbsp;<input class="check" type="radio" name="lavpubblico" value="1" /> pubblico
                    <input class="check" type="radio" name="lavpubblico" value="0" /> privato
                </div>
            	<div class="row">
                    Committente <input type="text" name="commit_anagra" maxlength="255" /> 
                    P.iva <input type="text" name="commit_piva" maxlength="11" /> 
                    C.f. <input type="text" name="commit_codfis" maxlength="16" />
                </div>
            	<div class="row">
                    via <input type="text" name="commit_via" maxlength="100" /> 
                    n <input type="text" size="4" name="commit_n" maxlength="16" /> 
                    Comune <input type="text" name="commit_comune" maxlength="100" />
                    prov <input type="text" size="2" name="commit_prov" maxlength="2" /> 
                    tel <input type="text" name="commit_tel" maxlength="50" /> 
                </div>
            	<div class="row">
                    Natura dell'opera:
					<select name="codnat" onChange="natopera(this.value)">
                    <option></option>
					<?php
					$result = mysql_query("SELECT * FROM natopera GROUP BY codnat ORDER BY nat");
						while($row = mysql_fetch_array($result))
							echo '<option value="'.$row['codnat'].'">'.utf8_encode($row['nat']).'</option>';
					?>
					</select>
                	<span id="natopera02"></span>
                </div>
            	
                <div class="sep"></div>
            	
                <!-- impresa -->
                
                <div class="row rowTitle">
                	<button type="button" onclick="lightShow('on','../imprese.php')">Seleziona impresa</button>
                	<a name="impresa" id="impresa"></a>
                </div>
                
                <div id="impHide">
                
                <div class="row">
                    Ragione Sociale Impresa <input name="imp_anagrafica" type="text" size="50" maxlength="255" /> 
                    Comune sede legale <input name="imp_comune" type="text" maxlength="100" />
                    Provincia <input size="3" name="imp_prov" type="text" maxlength="2" />
                </div>
                <div class="row">
                    via <input name="imp_indirizzo" type="text" size="35" maxlength="100" /> 
                    n. <input name="imp_numero" type="text" size="4" maxlength="16" /> 
                    P.iva <input name="imp_piva" type="text" maxlength="11" /> 
                    C.f. <input name="imp_codfisc" type="text" maxlength="16" />
                </div>
            	<div class="row">
                	Ditta: &nbsp;&nbsp;<input class="check" type="radio" name="imp_esterna" value="1" /> esterna &nbsp;&nbsp;
                    <input class="check" type="radio" name="imp_esterna" value="2" /> iscritta a Cassa Edile &nbsp;&nbsp;&nbsp;&nbsp;
                    associata: <input class="check" type="radio" name="imp_assoc" value="COL" /> Collegio costruttori &nbsp;&nbsp;
                    <input class="check" type="radio" name="imp_assoc" value="CNA" /> Cna &nbsp;&nbsp;
                    <input class="check" type="radio" name="imp_assoc" value="CON" /> Confartigianato
                </div>
            	<div class="row">
					Tel <input name="imp_telefono" type="text" maxlength="50" /> 
                    Fax <input name="imp_fax" type="text" maxlength="50" /> 
                    E-Mail <input name="imp_email" maxlength="255" size="45" type="text" />
				</div>
                <div class="row">
                	Attivit&agrave; svolta <input name="imp_attivita" type="text" size="50" maxlength="255" /> 
                    CCNL edilizia: &nbsp;&nbsp;
                    <input class="check" type="radio" name="ccnl" value="ind" /> ind &nbsp;&nbsp;
                    <input class="check" type="radio" name="ccnl" value="art" /> art &nbsp;&nbsp;
                    <input class="check" type="radio" name="ccnl" value="altro" /> altro 
                    <input type="text" name="ccnl_altro" maxlength="50" />
                </div>
                <div class="row attspec">
                   	<strong>Specifica attivit&agrave; svolta in cantiere:</strong><br /><br />
                    1) Tipologia: <select name="tipologiacod" onChange="attspec(this,'lavorazionecod')">
                    <option selected="selected"></option>
                    <?php
					$result = mysql_query("SELECT * FROM attivitaspec GROUP BY tipologiacod");
						while($row = mysql_fetch_array($result))
							echo '<option value="'.$row['tipologiacod'].'">'.utf8_encode($row['tipologia']).'</option>';
					?>
                    </select>
                    <span id="tipologiacod"></span>
                    <span id="lavorazionecod"></span>
                    <span id="attivitacod"></span>
                 </div>
                <div class="row">
                    RLS int. Sign <input type="text" size="35" name="rls" maxlength="100" />
                </div>
                <div class="row">
                	<table class="standard" cellspacing="0" cellpadding="0">
                      <tr>
                        <td>&nbsp;</td>
                        <td width="13%">n. addetti</td>
                        <td width="13%">operai</td>
                        <td width="13%">impiegati</td>
                        <td width="13%">apprendisti</td>
                        <td width="13%">interinali</td>
                        <td width="13%">part time</td>
                        <td width="13%">lav. autonomi</td>
                      </tr>
                      <tr>
                        <td>Totali</td>
                        <td><input type="text" size="3" name="n_addetti" maxlength="4" /></td>
                        <td><input type="text" size="3" name="n_operai" maxlength="4" /></td>
                        <td><input type="text" size="3" name="n_impiegati" maxlength="4" /></td>
                        <td><input type="text" size="3" name="n_apprendisti" maxlength="4" /></td>
                        <td><input type="text" size="3" name="n_interinali" maxlength="4" /></td>
                        <td><input type="text" size="3" name="n_parttime" maxlength="4" /></td>
                        <td><input type="text" size="3" name="n_autonomi" maxlength="4" /></td>
                      </tr>
                    </table>
                </div>
                <div class="row">
                	n. addetti presenti <input type="text" size="3" name="n_addettipres" maxlength="4" /> 
                    Data inizio lavori <input type="text" size="10" name="data_inizlav" maxlength="10" /> 
                    Data fine lavori <input type="text" size="10" name="data_finelav" maxlength="10" />
                </div>
                </div>
                
                <!-- fine selezione impresa -->
                
                
                <div class="row">
                    <table class="standard" width="100%" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="34%">Partecipanti</td>
                        <td width="34%">Funzione</td>
                        <td width="32%">Firma</td>
                      </tr>
                      <tr>
                        <td><input type="text" size="40" name="partecip1" maxlength="100" /></td>
                        <td><input type="text" size="40" name="partecip1_funz" maxlength="100" /></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><input type="text" size="40" name="partecip2" maxlength="100" /></td>
                        <td><input type="text" size="40" name="partecip2_funz" maxlength="100" /></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><input type="text" size="40" name="partecip3" maxlength="100" /></td>
                        <td><input type="text" size="40" name="partecip3_funz" maxlength="100" /></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><input type="text" size="40" name="partecip4" maxlength="100" /></td>
                        <td><input type="text" size="40" name="partecip4_funz" maxlength="100" /></td>
                        <td>&nbsp;</td>
                      </tr>
                    </table>
                </div>
                
                <div class="row">
                	<center><strong>Documenti Visionati</strong></center>
                </div>
                <div class="row">
                	<table align="left" class="docVisionati" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="20%">visionato</td>
                        <td>&nbsp;</td>
                        <td width="20%">idoneo</td>
                      </tr>
                      <tr>
                        <td><input name="psc_vis" type="radio" class="check" value="1" /> si <input name="psc_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Piano di Sicurezza Cantiere</td>
                        <td><input name="psc_ido" type="radio" class="check" value="1" /> si <input name="psc_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="pos_vis" type="radio" class="check" value="1" /> si <input name="pos_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Piano Operativo Sicurezza</td>
                        <td><input name="pos_ido" type="radio" class="check" value="1" /> si <input name="pos_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="pss_vis" type="radio" class="check" value="1" /> si <input name="pss_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Piano Sost. Sicurezza</td>
                        <td><input name="pss_ido" type="radio" class="check" value="1" /> si <input name="pss_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="docinfo_vis" type="radio" class="check" value="1" /> si <input name="docinfo_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Documenti di info/formazione</td>
                        <td><input name="docinfo_ido" type="radio" class="check" value="1" /> si <input name="docinfo_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="libretti_vis" type="radio" class="check" value="1" /> si <input name="libretti_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Libretti/manuali</td>
                        <td><input name="libretti_ido" type="radio" class="check" value="1" /> si <input name="libretti_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="reginf_vis" type="radio" class="check" value="1" /> si <input name="reginf_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Registro infortuni</td>
                        <td><input name="reginf_ido" type="radio" class="check" value="1" /> si <input name="reginf_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="duvri_vis" type="radio" class="check" value="1" /> si <input name="duvri_vis" type="radio" class="check" value="2" /> no</td>
                        <td>D.u.v.r.</td>
                        <td><input name="duvri_ido" type="radio" class="check" value="1" /> si <input name="duvri_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td class="newline">distribuiti</td>
                        <td class="newline">&nbsp;</td>
                        <td class="newline">formazione</td>
                      </tr>
                      <tr>
                        <td><input name="dpi1_dist" type="radio" class="check" value="1" /> si <input name="dpi1_dist" type="radio" class="check" value="2" /> no</td>
                        <td>D.P.I. tipo 1</td>
                        <td><input name="dpi1_form" type="radio" class="check" value="1" /> si <input name="dpi1_form" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="dpi2_dist" type="radio" class="check" value="1" /> si <input name="dpi2_dist" type="radio" class="check" value="2" /> no</td>
                        <td>D.P.I. tipo 2</td>
                        <td><input name="dpi2_form" type="radio" class="check" value="1" /> si <input name="dpi2_form" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="dpi3_dist" type="radio" class="check" value="1" /> si <input name="dpi3_dist" type="radio" class="check" value="2" /> no</td>
                        <td>D.P.I. tipo 3</td>
                        <td><input name="dpi3_form" type="radio" class="check" value="1" /> si <input name="dpi3_form" type="radio" class="check" value="2" /> no</td>
                      </tr>
                    </table>
                	
                    <table align="right" class="docVisionati" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="20%">visionato</td>
                        <td>&nbsp;</td>
                        <td width="20%">idoneo</td>
                      </tr>
                      <tr>
                        <td><input name="rchimico_vis" type="radio" class="check" value="1" /> si <input name="rchimico_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Rischio chimico</td>
                        <td><input name="rchimico_ido" type="radio" class="check" value="1" /> si <input name="rchimico_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="rvibraz_vis" type="radio" class="check" value="1" /> si <input name="rvibraz_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Rischio vibrazioni</td>
                        <td><input name="rvibraz_ido" type="radio" class="check" value="1" /> si <input name="rvibraz_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="rrumore_vis" type="radio" class="check" value="1" /> si <input name="rrumore_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Rischio rumore</td>
                        <td><input name="rrumore_ido" type="radio" class="check" value="1" /> si <input name="rrumore_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="pimus_vis" type="radio" class="check" value="1" /> si <input name="pimus_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Pimus</td>
                        <td><input name="pimus_ido" type="radio" class="check" value="1" /> si <input name="pimus_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="orario_vis" type="radio" class="check" value="1" /> si <input name="orario_vis" type="radio" class="check" value="2" /> no</td>
                        <td>Orario lavoro</td>
                        <td><input name="orario_ido" type="radio" class="check" value="1" /> si <input name="orario_ido" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td class="newline">presenti</td>
                        <td class="newline">&nbsp;</td>
                        <td class="newline">a norma</td>
                      </tr>
                      <tr>
                        <td><input name="servizi_pres" type="radio" class="check" value="1" /> si <input name="servizi_pres" type="radio" class="check" value="2" /> no</td>
                        <td>Servizi igienici</td>
                        <td><input name="servizi_norma" type="radio" class="check" value="1" /> si <input name="servizi_norma" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="spogliat_pres" type="radio" class="check" value="1" /> si <input name="spogliat_pres" type="radio" class="check" value="2" /> no</td>
                        <td>Spogliatoio/ricovero</td>
                        <td><input name="spogliat_norma" type="radio" class="check" value="1" /> si <input name="spogliat_norma" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="mensa_pres" type="radio" class="check" value="1" /> si <input name="mensa_pres" type="radio" class="check" value="2" /> no</td>
                        <td>Mensa</td>
                        <td><input name="mensa_norma" type="radio" class="check" value="1" /> si <input name="mensa_norma" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="cassetta_pres" type="radio" class="check" value="1" /> si <input name="cassetta_pres" type="radio" class="check" value="2" /> no</td>
                        <td>Cassetta pronto soccorso</td>
                        <td><input name="cassetta_norma" type="radio" class="check" value="1" /> si <input name="cassetta_norma" type="radio" class="check" value="2" /> no</td>
                      </tr>
                      <tr>
                        <td><input name="numeri_pres" type="radio" class="check" value="1" /> si <input name="numeri_pres" type="radio" class="check" value="2" /> no</td>
                        <td>Numeri utili</td>
                        <td><input name="numeri_norma" type="radio" class="check" value="1" /> si <input name="numeri_norma" type="radio" class="check" value="2" /> no</td>
                      </tr>
                    </table>
                </div>
                <div class="row">
                	<center><strong>Note</strong></center>
                </div>
                <div class="row">
                	<textarea name="note" class="note"></textarea>
                </div>
                <div class="row">
                	Prossima visita per verifica: Giorno <input name="data_prossvisita" type="text" id="data_prossvisita" size="10" maxlength="10" /> Ora <input name="ora_prossvisita" type="text" id="ora_prossvisita" value="00:00" size="5" maxlength="5" />
                </div>
                <div class="row">
                	Gravit&agrave; 
                    <select name="gravita">
                        <option value="0"></option>
                        <?php
                        for($i=1;$i<=10;$i++)
                            echo '<option value="'.$i.'">'.$i.'</option>';
                        ?>
                    </select>
                </div>
                <div class="row">
                	<input name="chiuso" type="checkbox" class="check" value="1" /> Cantiere Chiuso 
                </div>
                <div class="row">
                	<input name="completata" type="checkbox" class="check" value="1" /> Visita completata 
                </div>
                <div class="row buttons">
                	<center>
                    	<button id="btn_form_save" type="submit">Inserisci</button>
                    </center>
                </div>
            </div>
        </form>
        </div>
    </div>
    
</div>

<div id="footer"></div>
</body>
</html>