<%@ include file="/project/include.jsp" %>

<script type="text/javascript">
	function tformat_cpst_righe_valida(element, value, name) {	
		var tkns = element.parentNode.id.split('_');
		var rowIndex = parseInt(tkns[tkns.length-1]);
		if (value == 'si') {		
			var txt = '<a href="javascript:annullaRigaPagamento(' + rowIndex + ');">';
			txt+='<img title="Annulla riga" style="border:0px;" src="' + juiceGetResource('shell', 'img/misc/check_small.gif') + '" />';
			txt+='</a>';
			element.style.paddingTop = '0px';
			element.style.paddingBottom = '0px'
			element.innerHTML = txt;
		} else if (value == 'no') {		
			var txt = '<a href="javascript:ripristinaRigaPagamento(' + rowIndex + ');">';
			txt+='<img title="Ripristina riga" style="border:0px;" src="' + juiceGetResource('shell', 'img/misc/delete-small.gif') + '" />';
			txt+='</a>';
			element.style.paddingTop = '0px';
			element.style.paddingBottom = '0px'
			element.innerHTML = txt;
		}
	}
	
	function annullaRigaPagamento(rowIndex) {
		var tableId = CP_SLAVE_TABLE_ID + '_righe';
		var idRigaPag = cpGetColumnValueOfRow(tableId, parseInt(rowIndex), 'idRiga');
		if (idRigaPag) {
		    if (confirm('Annullare la riga pagamento selezionata?')) {	
		    	var currentMasterRow = cpGetMasterCurrentRow();	
				var event = "pagamenti.impostaValiditaRigaPagamento?valida=false&currentMasterRow=" + currentMasterRow + "&idRigaPagamento=" + idRigaPag;
			 	juiceChangeLocation(event);
			 }
		}
	}
	
	function ripristinaRigaPagamento(rowIndex) {
		var tableId = CP_SLAVE_TABLE_ID + '_righe';
		var idRigaPag = cpGetColumnValueOfRow(tableId, parseInt(rowIndex), 'idRiga');
		if (idRigaPag) {
			var response = jsLoadString('it.cedaf.icare.pagamenti.control.action.VerificaRigaPagamentoRipristinabileExecutor', 'idRigaPagamento=' + idRigaPag);
			if (response == 'NO') {
				alert('Impossibile ripristinare la riga pagamento.\nEsiste gi� una riga pagamento valida con lo stesso numero bollettino.');
				return;
			} else if (confirm('Ripristinare la riga pagamento selezionata?')) {	
		    	var currentMasterRow = cpGetMasterCurrentRow();	
				var event = "pagamenti.impostaValiditaRigaPagamento?valida=true&currentMasterRow=" + currentMasterRow + "&idRigaPagamento=" + idRigaPag;
			 	juiceChangeLocation(event);
			 }
		}
	}	
</script>

<j:tile slave="righe" name="shell.slaveToolbar" />

<shell:grid slave="righe" description="intestatario,35%; codiceFiscale,15%; importoNetto,15%,-1,right; importoConguaglio,10%,-1,right; totaleImposte,10%,-1,right; importo,10%,-1,right; valida,5%,-1,center" />

<shell:fieldset title="Informazioni generali">
	<table border="0" cellspacing="3" cellpadding="0" >	
		<tr>
			<td class="form-label">
				<shell:label prop="importoNetto" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="importoNetto" />
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="importoEsenteIva" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="importoEsenteIva" />
				</bui:out>
			</td>
		</tr>	
		<tr>
			<td class="form-label">
				<shell:label prop="totaleImposte" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="totaleImposte" />
				</bui:out>
			</td>
		</tr>	
		<tr>
			<td class="form-label">
				<shell:label prop="importoConguaglio" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="importoConguaglio" />
				</bui:out>
			</td>
		</tr>		
		<tr>
			<td class="form-label">
				<shell:label prop="importo" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="importo" />
				</bui:out>
			</td>
		</tr>
 	</table> 
	<table border="0" cellspacing="3" cellpadding="0" >
 		<tr>
	  		<td class="form-label">
				<shell:label prop="elencoRate" />
			</td>
			<td class="form-values">	
				<bui:out modes="view" slave="${_slave}">
					<shell:grid slave="${_slave}" description="importo,50%,-1,right;numeroBollettino,30%;dataScadenza,20%" property="elencoRate" />
				</bui:out>
			</td>
		</tr>
	</table> 	
</shell:fieldset>

<shell:fieldset title="Informazioni contabilit�">
	<table border="0" cellspacing="3" cellpadding="0" >	
		<tr>
			<td class="form-label">
				<shell:label prop="codiceContabilita" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="codiceContabilita" />
				</bui:out>
			</td>
		</tr>
 	</table>	 	
</shell:fieldset>

<shell:fieldset title="Modalit� pagamento">


	<table align="center" width="100%">
		<tr>
			<td class="form-label">
				<shell:label prop="cognome" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="cognome" />
				</bui:out>
			</td>			
		</tr>		
		<tr>
			<td class="form-label">
				<shell:label prop="nome"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="nome" />
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="codiceFiscale"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="codiceFiscale" />
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="indirizzo"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="indirizzo" />
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="civico"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="civico" />
				</bui:out>
			</td>
		</tr>		
		<tr>
			<td class="form-label">
				<shell:label prop="comune"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="comune" />
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="cap" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="cap" />
				</bui:out>
			</td>			
		</tr>		
	</table>

	<table  border="0" cellspacing="3" cellpadding="0" >	
		<tr>
			<td class="form-label">
				<shell:label prop="tipoIncasso"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="tipoIncasso" />
				</bui:out>
			</td>
		</tr>		
		<tr>
			<td class="form-label">
				<shell:label prop="convenzione"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile slave="${_slave}" name="shell.plaintext" prop="convenzione" />
				</bui:out>
			</td>
		</tr>		
		<tr>			
			<td colspan="2">
				<table align="left" border="0" cellspacing="3" cellpadding="0">
					<tr>
						<td class="form-label">
							<shell:label prop="banca"/>							
						</td>
						<td class="form-values" colspan="6">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="banca" />
							</bui:out>
						</td>						
					</tr>
					<tr>
						<td class="form-label">
							<shell:label prop="indirizzoBanca"/>							
						</td>
						<td class="form-values" colspan="6">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="indirizzoBanca" />
							</bui:out>
						</td>						
					</tr>
					<tr>
						<td class="form-label">
							<shell:label prop="comuneBanca"/>							
						</td>
						<td class="form-values" colspan="6">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="comuneBanca" />
							</bui:out>
						</td>						
					</tr>		
					<tr>
						<td class="form-label">
							<shell:label prop="capBanca"/>							
						</td>
						<td class="form-values" colspan="6">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="capBanca" />
							</bui:out>
						</td>						
					</tr>	
					<tr>
						<td class="form-label" rowspan="4">
							<shell:label prop="coordinateBancarie"/>							
						</td>						
						<td class="form-values" align="right">
							ABI:
						</td>
						<td class="form-values">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="abi" />
							</bui:out>
						</td>
						<td class="form-values" align="right">
							CAB:
						</td>
						<td class="form-values">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="cab" />
							</bui:out>
						</td>
						<td class="form-values" align="right">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CIN:
						</td>
						<td class="form-values">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="cin" />
							</bui:out>
						</td>
					</tr>
					<tr>
						<td class="form-values" align="right">
							Conto corrente: 
						</td>
						<td class="form-values" colspan="5">						
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="contoCorrente" />
							</bui:out>
						</td>
					</tr>
					<tr>
						<td class="form-values" align="right">
							Codice paese: 
						</td>
						<td class="form-values">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="codicePaese"/>								
							</bui:out>
						</td>
						<td class="form-values" align="right" colspan="3">
							Numero controllo: 
						</td>
						<td class="form-values">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="numeroControllo"/>								
							</bui:out>
						</td>
					</tr>
					<tr>
						<td class="form-values" align="right">
							IBAN: 
						</td>
						<td class="form-values" colspan="5">
							<bui:out modes="view" slave="${_slave}">
								<j:tile  slave="${_slave}" name="shell.plaintext" prop="iban"/>
							</bui:out>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="causale"/>
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="causale" />
				</bui:out>
			</td>
		</tr>			
		<tr>
			<td class="form-label">
				<shell:label prop="note" />
			</td>
			<td class="form-values">
				<bui:out modes="view" slave="${_slave}">
					<j:tile  slave="${_slave}" name="shell.plaintext" prop="notePagamento" />
				</bui:out>				
			</td>
		</tr>
	</table>	
</shell:fieldset>
<%-- 
<shell:fieldset title="Rate pagamento">
	<table border="0" cellspacing="3" cellpadding="0" >
 		<tr>
	  		<td class="form-label">
				<shell:label prop="elencoRate" />
			</td>
			<td class="form-values">	
				<bui:out modes="view" slave="${_slave}">
					<shell:grid description="elencoRate" property="elencoRate" />
				</bui:out>
			</td>
		</tr>
	</table>	 	
</shell:fieldset>--%>