<?php
  include("stilos/config.inc.php");
  include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("Funciones.php");
  include("funcion/funciones.php");
  session_start();
  session_register('charlas');
  $objPer=new clsPer;
  $resultado=$objPer->getCodPer();
  $filas=$objPer->NextRow($resultado);
  $cod_per=$filas['valor_e'].getNumCeros($filas['valor']);
  if ($borrar==1){
  		$charlas=array();      
   }
   if(!isset($valor)){$valor=1;}
?>

<!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) { 
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();
}

function Abrir_Ventanapopup2(sURL,x,y) { 
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_personal.php";
?>
<script language="JavaScript">
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 language="JavaScript">
   function Enviar()
{
     var doc_id = window.document.form1.doc_id.value;
   	 var tipo_cap = window.document.form1.tipo_cap.value;
     var fecha_char = window.document.form1.fecha_char.value;
     var tema_char = window.document.form1.tema_char.value;
     var resp_char = window.document.form1.resp_char.value;
   	 var lugar_charl = window.document.form1.lugar_charl.value;
	 var expo_char = window.document.form1.expo_char.value;
	 var cod_emp = window.document.form1.cod_emp.value;
	 if (form1.person.value==""){
     alert("No Eligió un personal");
	 form1.btn_buscar.focus();
	 return;
     }else{
	 window.location ="procesos/cvp_personal_agregarItem.php?doc_id="+doc_id+"&valor="+tipo_cap+"&fecha_char="+fecha_char+"&tema_char="+tema_char+"&resp_char="+resp_char+"&lugar_charl="+lugar_charl+"&expo_char="+expo_char+"&cod_emp="+cod_emp;
	 }

}

function Enviar1()
  
{
   var existe='<?php echo contarItem ?>';
   if (form1.tipo_cap.value=="--"){
     alert("No Eligio un personal");
	 form1.btn_buscar.focus();
	 return;
      }
	 if (form1.fecha_char.value==""){
     alert("Debe Elegir la fecha de Exposicion");
	 form1.fecha_char.focus();
	 return;
      }
	 if (form1.tema_char.value==""){
     alert("No Escribio el Tema y Es Importante");
	 form1.tema_char.focus();
	 return;
      }
	  if (form1.resp_char.value==""){
     alert("Debe Escribir un Responsable y Es Importante");
	 form1.resp_char.focus();
	 return;
      }
	 if (form1.lugar_charl.value==""){
     alert("Debe Escribir el Lugar de la Exposicion y Es Importante");
	 form1.lugar_charl.focus();
	 return;
      }
	 if (form1.doc_id.value==""){
     alert("No se Ingreso un Personal a la Lista");
	 form1.btn_buscar.focus();
	 return;
      }

   if (form1.btn_grabar){form1.submit()}
}
function Enviar2(){
		window.location="cvp_charlas_a_per.php?borrar=1";
               }
</script>
<script language="JavaScript">
function Datos(clave){
	 var doc_id = window.document.form1.doc_id.value;
   	 var tipo_cap = window.document.form1.tipo_cap.value;
     var fecha_char = window.document.form1.fecha_char.value;
     var tema_char = window.document.form1.tema_char.value;
     var resp_char = window.document.form1.resp_char.value;
   	 var lugar_charl = window.document.form1.lugar_charl.value;
	 var expo_char = window.document.form1.expo_char.value;
	 var cod_emp = window.document.form1.cod_emp.value;
	 window.location="procesos/cvp_borrarItem_pers_char.php?clave="+clave+"&doc_id="+doc_id+"&valor="+tipo_cap+"&fecha_char="+fecha_char+"&tema_char="+tema_char+"&resp_char="+resp_char+"&lugar_charl="+lugar_charl+"&expo_char="+expo_char+"&cod_emp="+cod_emp;
     }
</script>
<script language="JavaScript">
function poner_imagen()
{
imagen1=new Image;
imagen1.src=document.form1.foto.value;
document.imagenes['foto'].src=imagen1.src;
}
</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>
<? if($foco==1){?>
<body background="../imagenes/fondo.jpg" onLoad="document.form1.btn_buscar.focus()">
<? }else{?>
<body 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_grabarcharla.php" enctype="multipart/form-data">
          <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" > <strong>REGISTRO DE ASISTENCIA A CHARLAS HSEQ-CR </strong> - PERSONAL BARRETT </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>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td width="397">&nbsp;</td>
                      <td width="20">&nbsp;</td>
                      <td width="45" colspan="3">&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Tipo de Capacitaci&oacute;n</div></td>
                      <td>:</td>
					  <?php if(isset($valor))$valor=$valor;?>
                      <td colspan="5"><?php $tipo_cap="tipo_cap"; echo $objPer->TiposCapacitacion($tipo_cap,$valor) ?></td>
                    </tr>
                    <tr class="lblCampo">
                      <td width="204" height="18"><div align="left">Fecha de la Exposici&oacute;n</div></td>
                      <td width="13"><div align="left">:</div></td>
                      <td colspan="5"><div align="left">
                      </div>                        <input name="fecha_char" type="text" class="lblForm1" id="fecha_char2" onKeyUp=fn(this.form,this) value="<?=$fecha_char?>" size="12">
                      <a href="javascript:show_calendar('form1.fecha_char');"><img src="../imagenes/calendar.jpg" width="16" height="15" border="0"></a> </td>
                    </tr>
                    <tr class="lblCampo">
                      <td height="18">Expositor</td>
                      <td>:</td>
                      <td><input name="expo_char" type="text" id="expo_char3" value="<?=$expo_char?>" size="50"></td>
                      <td>&nbsp;</td>
                      <td colspan="3"><input name="doc_id" type="hidden" size="3" id="doc_id3" value="<?=$doc_id?>"></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Tema a Tratar </div></td>
                      <td><div align="left">:</div></td>
                      <td colspan="5"><div align="left">
                      </div>                        <div align="left">
                        <input name="tema_char" type="text" id="tema_char4" value="<?=$tema_char?>" size="50">
</div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Responsable</div></td>
                      <td><div align="left">:</div></td>
                      <td colspan="5"><div align="left">
                        </div>                        
                        <div align="left"></div>                      <div align="left"></div>                      <div align="left">
                          <input name="resp_char" type="text" class="lblForm1" id="resp_char2" onKeyUp=fn(this.form,this) value="<?=$resp_char?>" size="50">
                        </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td>Lugar</td>
                      <td>:</td>
                      <td colspan="5"><input name="lugar_charl" type="text" id="lugar_charl3" value="<?=$lugar_charl?>" size="50."></td>
                    </tr>
                    <tr class="lblCampo">
                      <td>Empresa Service </td>
                      <td>:</td>
                      <td colspan="5"><select name="cod_emp" class="lblForm1" id="select2" onkeyup=fn(this.form,this)>
                        <option value="0">Varios</option>
                        <? 
							echo $objPer->getCboEmp($cod_emp);
							?>
                      </select></td>
                    </tr>
                    <tr class="normal">
                      <td colspan="7">
                        <hr align="left" size="1" color="#000000">
                      </td>
                    </tr>
                    <tr class="normal">
                      <td colspan="7">
					    <div align="center">
					      <table width="660" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="139"><div align="center">
                                <FIELDSET>
                                <LEGEND>Buscar Personal</LEGEND>
                                
                                </FIELDSET>
                              </div></td>
                              <td width="160"><input name="person" type="text" class="lblForm1" id="cod_per2" onkeyup=fn(this.form,this) size="30" readonly></td>
                              <td width="92"><input name="btn_buscar" type="button" style="<?=$stylo['st2']?>" class="botira" value=".:Buscar:." onClick="javascript:Abrir_Ventanapopup1('reg_personal_ver.php',500,300)"></td>
                              <td><input name="btn_nuevo" type="button" style="<?=$stylo['st2']?>" class="botira" value=".:Nuevo:." onClick="javascript:Abrir_Ventanapopup2('cvp_personal2.php',800,400)" ></td>
                              <td><input name="btn_agregar_item" type="button" style="<?=$stylo['st2']?>" class="botira" value=".:Agregar a la Lista >>:." onClick="Enviar()"></td>
                            </tr>
                            <tr>
                              <td colspan="5">
                              <table width="600" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="<?=$bordetabla?>" bgcolor="<?=$c_fondo['fondo tabla']?>" style="<?=$stylo['tabla']?>">
                                <tr bordercolor="#00CC00" bgcolor="#2F8523">
                                  <td width="43" class="rdoBanners"><div align="center">N&ordm;</div></td>
                                  <td width="247" class="rdoBanners"><div align="center">Nombre </div></td>
                                  <td width="139" class="rdoBanners"><div align="center">Empresa </div></td>
                                  <td width="96" class="rdoBanners"><div align="center">Doc Identidad </div></td>
                                  <td width="63" class="rdoBanners"><div align="center">Quitar</div></td>
                                </tr>
                                <?php if (isset($charlas)){
								    $contarItem = count($charlas);
									while(list($clave,$valor)=each($charlas)){
									$doc_id=$valor[0];
									$empresa=$valor[1];
									$nombres=$valor[2];
 								 ?>
                                <tr>
                                  <td class="lblReporte"><?php echo ($clave + 1)?></td>
                                  <td class="lblReporte" align="left"><?php echo $nombres?></td>
                                  <td class="lblReporte"><?php echo $empresa?></td>
                                  <td class="lblReporte"><?php echo $doc_id?></td>
                                  <td><div align="center"><a href="#" onClick="Datos('<?=$clave?>')"><img src="../imagenes/btn_eliminar.gif" width="20" height="20" border="0"></a></div></td>
                                </tr>
                                <?php }}?>
                              </table> 
                              </td>
                            </tr>
                            <tr>
                              <td>Observacion:</td>
                              <td colspan="4"><textarea name="observ_char" cols="90" rows="2" id="observ_char"><?=$observ_char?>
                              </textarea>                                </td>
                            </tr>
                            <tr>
                              <td colspan="2"><div align="right">
                                <input name="btn_grabar" type="button" style="<?=$stylo['st2']?>" class="botira" value=".:  Grabar Lista  :." onClick="Enviar1()">
                              </div></td>
                              <td>&nbsp;</td>
                              <td width="70"><div align="center">
                              </div></td>
                              <td width="199"><div align="left">
                                <input name="btn_cancelar" type="button" style="<?=$stylo['st2']?>" class="botira" value=".: Cancelar :." 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>
<map name="Map">
  <area shape="rect" coords="3,4,23,21" href="fondo.php">
</map>
</body>
</html>

