<?
include("../../conexion/class-sb-conexion.php");

//	Autorización
	$id_empresa = $_SESSION['ss_empresa'];
	$id_user = $_SESSION['ss_user'];
	$id_autoriza=73;
	include("../../../conex.php");
	include("../../../autoriza.php");

	if($evento=='inst'){
		//$id_autoriza=73;
		//include("../../../conex.php");
		//include("../../../seguridad/autoriza.php");
		if ($crear==0)  
		{
		echo "<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		echo "No Autorizado";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		exit();
		}
	}
	 
	 if($evento=='upda'){
		//$id_autoriza=73;
		//include("../../../conex.php");
		//include("../../../seguridad/autoriza.php");
		if ($editar==0)  
		{
		echo "<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		echo "No Autorizado";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		exit();
		}
	}
	



	$dbx = new sb_mysql();   
	if($evento=='upda'){
	$consulta = $dbx->consulta_free("select Rut_Empresa,
							   Codigo_Empresa,
							   Nombre_Empresa,
							   Nombre_Fantasia_Empresa,
							   Direccion_Empresa,
							   Fono_Empresa,
							   Fax_Empresa,
							   Mail_Empresa,
							   Tamano_Empresa,
							   Codigo_Act_Empresa,
							   Rut_Rep_Legal,
							   Nombre_Rep_Legal,
							   Gratificacion_Empresa 
							   from sb_empresas_lista where Codigo_Empresa=".$id);
	$registro = $dbx->sb_array($consulta);
    }

?>
<form name="form" action="tb_mant_empresas_guardar.php" target="guardar">
<br />
<br />
<fieldset >

<table  border="0" cellpadding="0" cellspacing="3" style="font-size:13px" align="center" >
  <caption style="color:#21426B;" class="caption">
    Empresa
  </caption>
  <tr style="color:#21426B;">
  	<th width="100"  align="right" style="background-color:threedface; color:#21426B;" scope="row">
    	&nbsp;Codigo:    </th>
    <td width="213" align="left">&nbsp;
    	<?=$registro['Codigo_Empresa']?>
        <input name="evento" type="hidden" value="<?=$evento?>" />
        <input name="id" type="hidden" value="<?=$id?>" />
    </td>
    
  </tr>
  <tr  style="color:#21426B;">
    <th style="background-color:threedface" scope="row" align="right">
    	&nbsp;Rut:
    </th>
    <td align="left" >
    	&nbsp;<input id='rut1' name="campo['Rut_Empresa']" size="10"
        onBlur="this.value = this.value.toUpperCase();valida1();"
        type="text" value="<?=$registro['Rut_Empresa']?>" >
     </td>
    
  </tr>
  <tr style="color:#21426B;">
    <th style="background-color:threedface" scope="row" align="right">&nbsp;Nombre:</th>
    <td align="left">&nbsp;<input name="campo['Nombre_Empresa']"
    onBlur="this.value = this.value.toUpperCase();"
     size="30" type="text" value="<?=$registro['Nombre_Empresa']?>" ></td>
    
  </tr>
  <tr style="color:#21426B;">
    <th style="background-color:threedface" scope="row" align="right">&nbsp;Nombre Fantasia:</th>
    <td align="left">&nbsp;<input name="campo['Nombre_Fantasia_Empresa']"
    onBlur="this.value = this.value.toUpperCase();"
     size="30" type="text" value="<?=$registro['Nombre_Fantasia_Empresa']?>" >
    </td>
    
  </tr>
  <tr style="color:#21426B;">
  <th  align="right" style="background-color:threedface" scope="row">
    	&nbsp;Direccion:
     </th>
    <td  align="left" >
    	&nbsp;<input name="campo['Direccion_Empresa']"
        onBlur="this.value = this.value.toUpperCase();"
         size="30" type="text" value="<?=$registro['Direccion_Empresa']?>" >
	</td>
  </tr>
  
  <tr style="color:#21426B;">
  <th style="background-color:threedface" scope="row" align="right">
    	&nbsp;Comuna:
    </th>
    <td align="left" >
    	&nbsp;<input name="campo['Codigo_Comuna_Empresa']"
        onBlur="this.value = this.value.toUpperCase();"
         size="30" type="text" value="<?=$registro['Comuna_Empresa']?>" >
	</td>
  </tr>
  <tr style="color:#21426B;">
  <th style="background-color:threedface" scope="row" align="right">&nbsp;Fono:</th>
    <td align="left">&nbsp;<input style="text-align:right" name="campo['Fono_Empresa']" 
    size="30" type="text" value="<?=$registro['Fono_Empresa']?>" >
    </td>
  </tr>
  <tr style="color:#21426B;">
    <th style="background-color:threedface" scope="row" align="right">&nbsp;Mail:</th>
    <td align="left">&nbsp;<input name="campo['Mail_Empresa']" size="30" type="text" value="<?=$registro['Mail_Empresa']?>" ></td>
  	
  </tr>
  <tr style="color:#21426B;">
    <th style="background-color:threedface" scope="row" align="right">&nbsp;Codigo Act:</th>
    <td align="left">&nbsp;<input style="text-align:right" name="campo['Codigo_Act_Empresa']" size="10" type="text" value="<?=$registro['Codigo_Act_Empresa']?>" ></td>
  	
  </tr>
<tr style="color:#21426B;">
		<th align="right" style="background-color:threedface" scope="row">Gratificacion</th>
		<td align="left" >
        <select name="campo['Gratificacion_Empresa']" style="width:100px" >
            <option value="0" <? if($registro['Gratificacion_Empresa']==0){ ?>selected="selected";<? }?> >No</option>
            <option value="1" <? if($registro['Gratificacion_Empresa']==1){ ?>selected="selected";<? }?> >Si</option>
        </select>
        </td>
</tr>
</table>
</fieldset>
<fieldset>
<table  border="0" cellpadding="0" cellspacing="3" style="font-size:13px" align="center" >
  <caption style="color:#21426B;" class="caption">
    Representante Legal
  </caption>
  
  <tr style="color:#21426B;">
    <th width="100" style="background-color:threedface" scope="row" align="right">&nbsp;Rut:</th>
    <td align="left">&nbsp;<input id='rut2' name="campo['Rut_Rep_Legal']" 
    onBlur="this.value = this.value.toUpperCase();valida2();"
    size="10" type="text" value="<?=$registro['Rut_Rep_Legal']?>" ></td>
  	
  </tr>
  <tr style="color:#21426B;">
    <th style="background-color:threedface" scope="row" align="right">&nbsp;Nombre:</th>
    <td align="left">&nbsp;<input name="campo['Nombre_Rep_Legal']"
    onBlur="this.value = this.value.toUpperCase();"
     size="30" type="text" value="<?=$registro['Nombre_Rep_Legal']?>" ></td>
  	
  </tr>	
 <tr><td colspan="4"><input type="submit" value="Guardar" /></td></tr> 

</table>
</fieldset>
</form>
<iframe name="guardar" width="0" height="0" ></iframe>

