<?php use_helper('UrlFunctions'); ?>
<?php use_helper('UtilFunctions'); 

//echo $idbanco."-----------";


$o_ArBancoFN = new ArBancoFN();
$o_ArBancoFN->setIdbanco($idbanco);
$o_ArBancoBN = $o_ArBancoFN->selectByPK();
?>
<script>

acutalizarEspecialidad = function(destino,elm){
  $(destino).options.length = 1;
  var url = '<?=buildUrl('ajax/request')?>';
  var pars = 'type=getEspecialidad&nombreElm='+destino+'&value='+elm.value;
  
	var myAjax = new Ajax.Request(
                            		url, 
                            		{
                            			method: 'get', 
                            			parameters: pars, 
                            			onComplete: actualizaJSON
                            		});
}

</script>
<script>
actualizaJSON = function(request, json){
  var numeroElementos = json.length;
  for (var i = 0; i < numeroElementos; i++){
    if($(json[i][0])){
  	  switch ($(json[i][0]).tagName){
  	    case 'TD'      : Element.update(json[i][0], json[i][1]); break;
  	    case 'INPUT'   : $(json[i][0]).value=json[i][1]; break;
  	    case 'SELECT'  : 
  	      var objDDL = $(json[i][0]);
  	      if(typeof(cont) == 'undefined'){
  	        var cont = 0;
  	        objDDL.options.length = 1;
  	      }
  	      var a_contentValues = json[i][1].split("_;_");
      		var value	= a_contentValues[0];
      		var text	= a_contentValues[1];
  	      var option	= new Option(text,value);
      		try{
      			objDDL.add(option,null);
      		}catch (e){
      			objDDL.add(option,-1);
      		}
  	      cont++;
  	    break;
  	  }
    }else{
      if(json[i][0].indexOf("function") > -1){
        eval("scriptEval = "+json[i][0]);
        scriptEval();
      }
    }
  }
}
</script>
<?php
function eliminar_acento ( $cadena )
{
    $originales  = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ';
    $modificadas = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr';
    $cadena = utf8_decode($cadena);
    $cadena = strtr($cadena, utf8_decode($originales), $modificadas);
    $cadena = strtolower($cadena);
    return utf8_encode( stripAccents( $cadena ) );
}
function stripAccents( $string )
{
    return strtr($string,'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ','aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
}
$s_User = myUser::getUser()->getUserId();
if(isset($control)){
	
 //SE GUARA EL ARCHIVO
	
 	
    $o_ArCuentaDP = new ArCuentaDP();
    $o_ArCuentaDP->setIdbanco((int) $idbanco);
    $o_ArCuentaDP->setTipo( $tipo);
    $o_ArCuentaDP->setMoneda( $moneda);
    $o_ArCuentaDP->setTitular($titular);
    $o_ArCuentaDP->setNumero($numerocuenta);
    $o_ArCuentaDP->setEstado( "A" );
    $o_ArCuentaDP->setFechacreacion( date( "Y-m-d H:i:s" ) );
    $o_ArCuentaDP->setUsuariocreacion( $s_User );
    $b_Result = $o_ArCuentaDP->save();
  	$bResult = 1;
	if($bResult){
		
				?>
			    <script language="JavaScript">
			    //parent.recargarApp();
			    parent.objMainTab.reqBody('<?=buildUrl('bancocta/listctas')?>','&block=&insert=1&id=<?=$idbanco?>');
				parent.objMainTab.windowsCloseAll();
			    </script>
			    <?php
			
		
	}
}
    


?>
<img src="/images/common/spacer.gif" width="10">
<table class="cuerpo" width="98%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="0">
		  <table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
			  <td class="titleBody">
				<li>Nueva Cuenta Bancaria</li>
				</td>
			  <td align="right" valign="baseline">&nbsp;</td>
			</tr>
		  </table>
		</td>
	</tr> 
	<tr>
		<td valign="top">
			<form id="form1" name="form1" method="POST"  enctype="multipart/form-data">
				<input type="hidden" name="control" value="1">
				<table hspace="5px" class="marco" width="99%">
					<tr>
						<td valign="top">
							<table hspace="1px"  width="100%" style="border:1px solid #d3d3d3; min-height:220px">
								<tr>
									<td height="0">
								 
										<table width="100%" border="0" cellspacing="6" cellpadding="0"> 
											<tr>
												<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtOrigen" >Banco</label></td>
												<td nowrap="nowrap"><label class="label"><?php echo $o_ArBancoBN->getDescripcion();?></label></td>
											</tr>
											
											<tr>
												<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtOrigen" >Tipo</label></td>
												<td nowrap="nowrap"><select name="tipo">
												<option value="">Seleccione</option>
												<option value="CTA.CTE.">Cuenta Corriente</option>
												<option value="CTA.AHO.">Cuenta de Ahooro</option>
												</select></td>
											</tr>
											<tr>
												<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtOrigen" >Moneda</label></td>
												<td nowrap="nowrap"><select name="moneda">
												<option value="">Seleccione</option>
												<option value="SOL">Soles</option>
												<option value="DOL">Dolares</option>
												</select></td>
											</tr>
											
											<tr>
												<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtOrigen" >Numero</label></td>
												<td nowrap="nowrap"><div><input type="text" class="text required" id="numerocuenta" name="numerocuenta" size="30" maxlength="30" title="Ingresese la descripcion."></div></td>
												
											</tr>
											<tr>
												<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtOrigen" >Estado</label></td>
												<td nowrap="nowrap"><select name="estado">
												
												<option value="A">Activo</option>
												<option value="I">Inactivo</option>
												</select></td>
											</tr>
											
										</table>
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
										  <tr>
											 <td><img src="/images/common/spacer.gif" width="10"></td>
										  </tr>
										  <tr>
											<td align="center">
											  <input type="hidden" name="typeSubmit" id="typeSubmit">
											  <input class="button" type="submit" name="submit" id="submit" value="Grabar" onclick="$('typeSubmit').value='list';">
											  <input class="button" type="button" value="Cancelar" onclick="parent.objMainTab.windowsCloseAll();"/>
											</td>
										  </tr>
										  <tr>
											<td height="10">&nbsp;</td>
										  </tr>
										</table>
										
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
				
				
				 
			</form>
			
				<script type="text/javascript">
			
					
					
					Validation.add('file_pdf', 'Debe de ingresar formato pdf.', function (v) {
					     return Validation.get('IsEmpty').test(v) ||  /^(.*[.](?:pdf)$).*/i.test(v)
					});
					
					 var valid = new Validation( 'form1', { immediate : true } );
		               
		         
       
				</script>
		</td>
	</tr>
</table>
