</head>
<body  background="" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
<?php 
if ($modo == "edit" or $modo == "new") {
    $_SESSION["ADD_NEW"] = 0;
    $id_integrazione = isset($_POST["id"]) && $_POST["id"] ? $_POST["id"] : null;
    $nomeiter = $_POST["nomeiter"];
    $iter = $_POST["iter"];
    $tabella_integrazione = new tabella_v("{$tabpath}/integrazioni.tab", $modo);
    $tabella_integrati = new tabella_h("{$tabpath}/doc_integrati.tab", $modo);
    $tabella_mancanti = new tabella_h("{$tabpath}/doc_integrati.tab", $modo);
    $num_integrati = $tabella_integrati->set_dati("integrazione={$id_integrazione} and iter={$iter} and mancante=0");
    $num_mancanti = $tabella_mancanti->set_dati("pratica={$idpratica} and iter={$iter} and mancante=1");
    //$tabella_integrati->set_titolo("Documenti integrati o sostituiti");
    //$tabella_mancanti->set_titolo("Documenti mancanti");
    $tabella_mancanti->set_color("#E7EFFF", "#FF0000", 0, 0);
    include "./inc/inc.page_header.php";
    //-- <<<<<<<<<<<<<<<<<<<<<   MODALITA' FORM IN EDITING  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>--->
    ?>
	<FORM id="" name="" method="post" action="praticaweb.php">
		<TABLE cellPadding=0  cellspacing=0 border=0 class="stiletabella" width="99%" align="center">		
				  
		  <tr> 
			<td> 
			<!-- intestazione-->
				<H2 class="blueBanner">Integrazione documenti fase: <?php 
    echo $nomeiter;
    ?>
</H2>
			<!-- fine intestazione-->
			</td>
</head>
<body  background="" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
<?php 
if ($modo == "edit") {
    $_SESSION["ADD_NEW"] = 0;
    $iter = $_POST["iter"];
    $nomeiter = $_POST["nomeiter"];
    include "./inc/inc.page_header.php";
    $tabella_allegati = new tabella_h("{$tabpath}/doc_allegati", $modo);
    $tabella_elenco = new tabella_h("{$tabpath}/doc_elenco", $modo);
    $dummytable = new tabella_h("buttons", 'new');
    $num_allegati = $tabella_allegati->set_dati("pratica={$idpratica} and iter={$iter} and (allegato=1 or mancante=1)");
    $num_elenco = $tabella_elenco->set_dati("iter={$iter} and id not in (select 'doc_'||documento::varchar as id from pe.allegati inner join pe.e_documenti on(e_documenti.id=documento) where iter={$iter} and (allegato=1 or integrato=1 or mancante=1) and pratica={$idpratica})");
    $tabella_allegati->set_titolo($nomeiter);
    $tabella_elenco->set_titolo($nomeiter);
    $tabella_allegati->set_color("#728bb8", "#FFFFFF", 0, 0);
    ?>
		<H2 class=blueBanner>Gestione allegati:&nbsp;<?php 
    echo $nomeiter;
    ?>
</H2>
        <FORM method="POST" action="praticaweb.php">
		<TABLE cellPadding=0  cellspacing=0 border=0 class="stiletabella" width="99%" align="center">		
			<tr> 
                <td> 
			<!-- contenuto-->		
			<?php 
    if (!$num_elenco) {
        ?>
			<h2>l'elenco dei documenti per la fase <?php 
        echo $nomeiter;