<?php
	include("stilos/config.inc.php");
	include("../clases/BDConexion.php");
 
  include("../clases/clsPer.php");
  include("Funciones.php");
  include("funcion/funciones.php");
  session_start();
  $objPer=new clsPer;
  $resultado=$objPer->getEmpDatos($cod_emp);
  $filas=$objPer->NextRow($resultado);
//  $cod_emp=$filas['valor_e'].getNumCeros($filas['valor']);
  $cod_emp=$filas['cod_emp'];
  $razon_emp=$filas['razon_emp'];
  $dir_emp=$filas['dir_emp'];
  $ruc_emp=$filas['ruc_emp'];
  $contacto1_emp=$filas['contacto1_emp'];
  $contacto2_emp=$filas['contacto2_emp'];
  $cod_pais=$filas['cod_pais'];
  $ciudad_emp=$filas['ciudad_emp'];
?>
<? //include "sc_lib_ventana.php"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><MMString:LoadString id="insertbar/formsHidden" /></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">

<link href="Estilos.css" rel="stylesheet" type="text/css">

<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<script language="JavaScript"> 
<!--
//sURL,x,y
function Abrir_Ventanapopup1(sURL,x,y) { 
/*var especificaciones="top=0, left=0, toolbar=no,location=no, status=yes,menubar=no,scrollbars=no, resizable=no, width=1,height=1" 
var titulo="Titulo"
window.open(el_url,titulo,especificaciones);*/ 

if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=no"
			par = par + "menubar=no,toolbar=no,status=yes"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}
//--> 
</script>
<? 
$envia="fondo.php?k=$k&razonsocial=$razonsocial&distrito=$distrito";
$envia1="cvp_emp.php";
?>
<script>
function volverB(form)
{
location.reload('<? echo $envia1 ?>');
}
function volver(form)
{
location.reload('<? echo $envia ?>');
}
var vent = null;
function foco() {
   if (vent != null)
       vent.focus();
}
function cerrar() {
   vent = null;
}

</script>
<script language="JavaScript">
function selecciona(form)
{
 if(form.botones1.value)
  {
   form.zonasi.disabled=true;
  }
}

function cierra(form)
{
location.reload('../ventana.php');
}
function activainter(form)
{
   form.pais2.disabled=false;
   form.ciudad2.disabled=false;
   form.nacionalidad2.disabled=false;
   form.btn_ver2.disabled=false;
   form.btn_nuevo2.disabled=false;
   
   form.pais.value="";
   form.pais.disabled=true;
   form.ciudad.value="";
   form.ciudad.disabled=true;
   form.nacionalidad.value="";
   form.nacionalidad.disabled=true;
   form.idciudad1.value="";
   form.btn_ver1.disabled=true;
   form.btn_nuevo1.disabled=true;
}
</script>
<SCRIPT LANGUAGE=javascript>
function fn(form,field)
{
var next=0, found=false
var f=form
if(event.keyCode!=13) return;
for(var i=0;i<f.length;i++) {
if(field.name==f.item(i).name){
next=i+1;
found=true
break;
}
}
while(found){
if( f.item(next).disabled==false && f.item(next).type!='hidden'){
f.item(next).focus();
break;
}
else{
if(next<f.length-1)
next=next+1;
else
break;
}
}
}
</SCRIPT>
<script>
function enviar_url(form,url)
{

		if(form1.cod_emp.value==""){
		alert("Debe Ingresar el codigo de la empresa");
		form1.cod_emp.focus();
		return;		
	    }
		if(form1.razon_emp.value==""){
		alert("Debe Ingresar la razon");
		form1.razon_emp.focus;
		return;		
	    }
		if(form1.dir_emp.value==""){
		alert("Debe Ingresar la direccion");
		form1.dir_emp.focus;
		return;		
	    }
		if(form1.ruc_emp.value==""){
		alert("Debe Ingresar el RUC");
		form1.ruc_emp.focus;
		return;		
	    }
		if(form1.contacto1_emp.value==""){
		alert("Debe Ingresar el contacto 1");
		form1.contacto1_emp.focus;
		return;		
	    }
		if(form1.contacto2_emp.value==""){
		alert("Debe Ingresar el contacto 2");
		form1.contacto2_emp.focus;
		return;		
	    }
		if(form1.cod_pais.value==0){
		alert("Debe Ingresar el pais");
		form1.cod_pais.focus;
		return;		
	    }
		if(form1.ciudad_emp.value==""){
		alert("Debe Ingresar la ciudad");
		form1.ciudad_emp.focus;
		return;		
	    }
		if(form1.button.value)
		{
		form1.submit();
		}
}
</script>
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
</head>

<body bgcolor="<?=$c_fondo['fondo']?>" onfocus="foco()" background="../imagenes/fondo.jpg">
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr valign="top" >
    <td height="25" colspan="4">
    <div align="left" ></div></td>
  </tr>
  <tr class="lblCampo" >
    <td colspan="4"><div align="center">
        <form name="form1" method="post" action="procesos/cvp_emp_editar.php">
          <table width="730" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="25"><img src="../estilo_tabla/parte_sup_izq.gif" width="25" height="25"></td>
              <td width="680" background="../estilo_tabla/parte_sup_cen.gif" valign="bottom">
                <div align="left" class="lblTitulo" >Registro de Empresas </div></td>
              <td width="25"><img src="../estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#Map"></td>
            </tr>
            <tr>
              <td  background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
              <td  height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
                  <table width="679" border="0" cellspacing="0" cellpadding="0">
                    <tr class="lblCampo">
                      <td colspan="6">&nbsp; </td>
                    </tr>
                    <tr class="lblCampo">
                      <td width="120"><div align="left">Cod Empresa </div></td>
                      <td width="5"><div align="left">:</div></td>
                      <td width="208"><div align="left">
                          <input name="cod_emp" type="text" id="apellidos2" onkeyup=fn(this.form,this) value="<? echo $cod_emp?>" size="20">
                      </div></td>
                      <td width="96">Razon</td>
                      <td width="5"><div align="left">:</div></td>
                      <td width="245"><input name="razon_emp" type="text" id="razon_emp" onkeyup=fn(this.form,this) value="<? echo $razon_emp?>" size="45" maxlength="45"></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Direccion</div></td>
                      <td><div align="left">:</div></td>
                      <td>
                        <div align="left">
                          <input name="dir_emp" type="text" id="dir_emp" onkeyup=fn(this.form,this) value="<? echo $dir_emp?>" size="35">
                      </div></td>
                      <td>RUC</td>
                      <td><div align="left">:</div></td>
                      <td><input name="ruc_emp" type="text" id="ruc_emp" onkeyup=fn(this.form,this) value="<? echo $ruc_emp?>" size="35"></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Contacto 1 </div></td>
                      <td><div align="left">:</div></td>
                      <td><div align="left">
                        <input name="contacto1_emp" type="text" id="appat_per4" onkeyup=fn(this.form,this) value="<? echo $contacto1_emp?>" size="35">
                        </div></td>
                      <td>Contacto 2 </td>
                      <td><div align="left">:</div></td>
                      <td>
                        <div align="left">
                          <input name="contacto2_emp" type="text" id="appat_per32" onkeyup=fn(this.form,this) value="<? echo $contacto2_emp?>" size="35">
                        </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Pais de Origen </div></td>
                      <td><div align="left">:</div></td>
                      <td><div align="left">
                        <select name="cod_pais" id="cod_pais" onkeyup=fn(this.form,this)>
                          <option value="0">Seleccionar Pais</option>
                  			<? 
							echo $objPer->getCboPais($cod_pais);
							?>
                        </select>
                      </div></td>
                      <td>Ciudad</td>
                      <td><div align="left">:</div></td>
                      <td><input name="ciudad_emp" type="text" id="fnac_per3" onkeyup=fn(this.form,this) value="<? echo $ciudad_emp?>" size="15"></td>
                    </tr>
                    <tr class="normal">
                      <td colspan="6">
                        <hr align="left" size="1" color="#000000">
                      </td>
                    </tr>
                    <tr class="normal">
                      <td colspan="6">
					    <div align="center">
					      <table width="660" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="220"><div align="right">
                                <input name="button" type="button" style="<?=$stylo['st2']?>" class="botira" value=".:Grabar:." onClick="enviar_url(form1,'procesos/cvp_emp_editar.php')">
                              </div></td>
                              <td width="220"><div align="center">
                                <input name="des" type="hidden" id="des" value="<? echo $des?>">
                              </div></td>
                              <td width="220"><div align="left">
                                <input name="Submit2" type="button" style="<?=$stylo['st2']?>" class="botira" value=".: Salir :." onClick="volver(this.form);">
                              </div></td>
                            </tr>
                          </table>
			          </div></td>
                    </tr>
                  </table>
              </div></td>
              <td background="../estilo_tabla/parte_med_der.gif">&nbsp;</td>
            </tr>
            <tr>
              <td><img src="../estilo_tabla/parte_inf_izq.gif" width="25" height="25"></td>
              <td background="../estilo_tabla/parte_inf_cen.gif">&nbsp;</td>
              <td><img src="../estilo_tabla/parte_inf_der.gif" width="25" height="25"></td>
            </tr>
          </table>
        </form>
    </div></td>
  </tr>
  <tr valign="top" class="lblCampo" >
    <td colspan="4">
    <div align="center"> </div></td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="3,4,23,21" href="fondo.php">
</map>
</body>
</html>

