<?php use_helper('UrlFunctions'); ?>
<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

	$o_SobranteFaltanteSystemClass = new SobranteFaltanteSystemClass(new ColaboradorBean());
	$a_Colaborador = $o_SobranteFaltanteSystemClass->getColaborador();

	$o_SobranteFaltanteBean = new SobranteFaltanteBean();
	$o_SobranteFaltanteBean->setIdSofa($id);
	$o_class = new SobranteFaltanteBL();
	$o_ObjectBean = $o_class->busquedaSobranteFaltante($o_SobranteFaltanteBean);
 
 ?>
 
<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">
            <span class="subtitle"><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:::&nbsp;Sobrantes Faltantes</I></span></td>
          <td align="right" valign="baseline">&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
      <script type="text/javascript">
        validatePass = function(){
          
            valid.onSubmit = false;
          
        }
      </script>
  <tr>
    <td valign="top">
      <form id="form1" name="form1" method="POST">
      <input type="hidden" name="control" value="1">
        <table hspace="20px" class="marco" width="99%">
          <tr>
            <td valign="top">
              <table width="100%" border="0" cellpadding="5" cellspacing="0" style="background: #E3E9E2">
          		<tr>
    				  <td height="0">
    				  <fieldset>
    					<legend class="fielsettex"><I>Datos Generales</I></legend>
    					 <table width="100%" border="0" cellspacing="6" cellpadding="0">
							  
							  <tr>
                  				<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtAdministrador" >Representante</label></td>
                  				 <td nowrap="nowrap"><label class="label" for="txtEspecialidadIdD">
                    				<?php foreach ($a_Colaborador as $iKey => $o_ColaboradorBean){ 
                            			if($o_ColaboradorBean->getIdColaborador() == $o_ObjectBean->getIdColaborador()){
                              			  echo $o_ColaboradorBean->getNombreCompleto();
                            			}
                          				}
                   					?></label>
                   				</td>
                				<td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
                 			    <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtMonto" >Monto</label></td>
  								<td width="38%" nowrap="nowrap"><label class="label" for="Monto"><?=$o_ObjectBean->getMonto() ?></label></td>
  								
							  </tr>
							   <tr>
							    <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtEstado" >Sobrante/Faltante</label></td>
								<td width="38%" nowrap="nowrap"><label class="label" for="Estado"><? if ($o_ObjectBean->getTipoSofa()=='s'){ echo "Sobrante";} else { echo "Faltante";}?></label></td>
								<td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
							  </tr>
							  <tr>
							    <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtEstado" >Estado</label></td>
								<td width="38%" nowrap="nowrap"><label class="label" for="Estado"><? if ($o_ObjectBean->getEstado()=='A'){ echo "Activo";} else { echo "Inactivo";}?></label></td>
								<td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
                 			    <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtFecha" >Fecha</label></td>
  								<td width="38%" nowrap="nowrap"><label class="label" for="FechaAdelanto"><?=$o_ObjectBean->getFechaSofa() ?></label></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" value="Grabar y Nuevo" onclick="$('typeSubmit').value='add';"/>-->

								  <input class="button" type="button" value="Cancelar" onclick="parent.objMainTab.windowsCloseAll();"/>
								</td>
							  </tr>
							  <tr>
								<td height="10">&nbsp;</td>
							  </tr>
							</table>
    					</fieldset>				
    				</td>
                </tr>
      </table>
      </form>
			<script type="text/javascript">
				var valid = new Validation('form1', {immediate : true});
			</script>
    </td>
  </tr>
</table>
