<?php
 	include("stilos/config.inc.php");
	include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("../clases/clsTdoc.php");
  include("funcion/funciones.php");
  include("Funciones.php");  
  session_start();
  $objPer=new clsPer;
  $objTdoc=new clsTdoc;
  $result=$objPer->getTradoc($codigo);
  $row=$objPer->NextRow($result);
  
  
  if($_SESSION['usuarea']!=""){
  
?>

<head>


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

<link href="Estilos.css" rel="stylesheet" type="text/css">
<link href="estilitos.css" rel="stylesheet" type="text/css" />
<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="styless.css" />
<link rel="stylesheet" type="text/css" href="stylesss.css" />
<link rel="stylesheet" type="text/css" href="stylessss.css" />
<script type="text/javascript" src="ajax.js"></script>
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<? $url="per_total_doc.php?tipodoc=$tipodoc&campo=$campo&des=$des&fecha1=$fecha1&fecha2=$fecha2&ver=1&pagina=$pagina&i=$pagina"?>
<script>
function volver(form)
{
location.reload('<? echo $url ?>');
}
</script>
<script>
function enviar_url(form,url)
{
		if(form1.button.value)
		{
			form1.submit();			
		}
}
</script>
<script type="text/javascript">
function deshabilita(){
document.getElementById('send').disabled=true;
document.getElementById('input').disabled=true;
return false;
}
function habilita(){
document.getElementById('send').disabled=false;
document.getElementById('input').disabled=false;
return false;
}
function deshabi(){
document.getElementById('banco').disabled=true;
document.getElementById('cuenta').disabled=true;
return false;
}
function habi(){
document.getElementById('banco').disabled=false;
document.getElementById('cuenta').disabled=false;
return false;
}
</script>
</head>
<body>
<form name="form1" method="post" action="procesos/per_editar_doc_save.php">
  <table width="504" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="66" class="lblCampo"><div align="left">Codigo</div></td>
      <td width="5">&nbsp;</td>
      <td width="433"><div align="left">
          <input name="codigodoc" type="text" id="codigodoc" value="<? echo $codigo;?>" size="35" readonly="true"/>
      </div></td>
    </tr>
    <tr>
      <td class="lblCampo"><div align="left">Fecha</div></td>
      <td>&nbsp;</td>
      <td><div align="left">
          <input name="fecha" type="text" class="lblCampoF" id="fecha" value="<? echo extraerfechanormal($row['fechatradoc'])?>" size="12" readonly="true"/>
          <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fecha');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a>
          <input name="tipodoc" type="hidden" size="5" id="tipodoc" value="<?=$tipodoc?>">
          <input name="i" type="hidden" id="i" value="<?=$pagina?>">
      </div></td>
    </tr>
    <? if($tipodoc=="PRO"){?>
    <tr>
      <td  class="lblCampo"><div align="left">Titulo</div></td>
      <td>&nbsp;</td>
      <td><div align="left">
          <input name="titulo" type="text" id="titulo" value="<? echo $row['titulo']?>" size="30">
      </div></td>
    </tr>
    <? }?>
    <? if($tipodoc=="MEM"){?>
    <tr>
      <td  class="lblCampo"><div align="left">De</div></td>
      <td>&nbsp;</td>
      <td><div align="left">
          <input name="de" type="text" id="de" value="<? echo $row['de']?>" size="30" />
      </div></td>
    </tr>
    <? }?>
    <? if(($tipodoc=="MEM") or ($tipodoc=="CAR")){?>
    <tr valign="top">
      <td  class="lblCampo"><div align="left">Para</div></td>
      <td><div align="left"></div></td>
      <td><div align="left">
          <input name="para" type="text" id="para" value="<? echo $row['para']?>" size="30">
      </div></td>
    </tr>
    <? }?>
    <? if($tipodoc=="CAR"){?>
    <tr>
      <td class="lblCampo"><div align="left">Referencia</div></td>
      <td>&nbsp;</td>
      <td><div align="left">
          <input name="referencia" type="text" id="referencia" value="<? echo $row['referencia']?>" size="30">
      </div></td>
    </tr>
    <? }?>
    <? if(($tipodoc=="MEM") or ($tipodoc=="CAR")){?>
    <tr>
      <td  class="lblCampo"><div align="left">Asunto</div></td>
      <td>&nbsp;</td>
      <td><div align="left">
          <input name="asunto" type="text" id="asunto" value="<? echo $row['asunto']?>" size="30" />
      </div></td>
    </tr>
    <? }?>
    <? if(($tipodoc=="CTO") or ($tipodoc=="PAG")){?>
    <tr>
      <td  class="lblCampo"><div align="left">Beneficiario</div></td>
      <td>&nbsp;</td>
      <td><div align="left">
          <input name="personal" type="text" id="personal" value="<? echo $row['personal']?>" size="30" />
      </div></td>
    </tr>
    <? }?>
    <? if($tipodoc=="PAG"){?>
    <tr>
      <td colspan="3"  class="lblCampo"><div align="left">
          <table width="501" border="0" cellspacing="0" cellpadding="0">
            <tr class="lblCampo">
              <td><div align="left">Fecha Pago </div></td>
              <td><div align="left">
                  <input name="fechareq" type="text" id="fechareq" value="<? echo extraerfechanormal($row['fechareq'])?>" size="12">
              <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fechareq');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td width="65"><div align="left">Ruc</div></td>
              <td width="197"><div align="left">
                  <input name="ruc" type="text" id="ruc" value="<? echo $row['ruc']?>" size="25">
              </div></td>
              <td width="58"><div align="right">Tipo Comprobante </div></td>
              <td width="181"><div align="left">
                  <input name="tipocomp" type="text" id="tipocomp" value="<? echo $row['tipocomp']?>" size="25">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="left">Monto</div></td>
              <td><div align="left">
                  <input name="monto" type="text" id="monto" value="<? echo $row['monto']?>" size="10">
                  <select name="tipomon" id="tipomon">
                    <option value="S/" <? if($row['tipomon']=='S/'){?>selected<? }?>>S/</option>
                    <option value="USD" <? if($row['tipomon']=='USD'){?>selected<? }?>>USD</option>
                  </select>
              </div></td>
              <td><div align="right">Comprobante #</div></td>
              <td><div align="left">
                  <input name="numcomp" type="text" id="numcomp" value="<? echo $row['numcomp']?>" size="20">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="rdoa" type="radio" value="1" <? if($row['cajachica']=='X'){?>checked<? }?> onClick="deshabi()">
              </div></td>
              <td><div align="left">Caja Chica </div></td>
              <td><div align="right"></div></td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="rdoa" type="radio" value="2" onClick="deshabi()" <? if($row['carta']=='X'){?>checked<? }?>>
              </div></td>
              <td><div align="left">Carta</div></td>
              <td><div align="right"></div></td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="rdoa" type="radio" value="3" onClick="deshabi()" <? if($row['chequeg']=='X'){?>checked<? }?>>
              </div></td>
              <td><div align="left">Cheque de Gerencia </div></td>
              <td><div align="right">Banco</div></td>
              <td><div align="left">
                  <input name="banco" type="text" id="banco" value="<? echo $row['banco']?>" size="25">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="rdoa" type="radio" value="4" onClick="deshabi()" <? if($row['chequen']=='X'){?>checked<? }?>>
              </div></td>
              <td><div align="left">Cheque Normal - Entrega a RH </div></td>
              <td><div align="right">Cuenta</div></td>
              <td><div align="left">
                  <input name="cuenta" type="text" id="cuenta" value="<? echo $row['cuenta']?>" size="25">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="rdoa" type="radio" value="5" onClick="habi()" <? if($row['transfacta']=='X'){?>checked<? }?>>
              </div></td>
              <td><div align="left">Transferencia a CTA Beneficiario </div></td>
              <td><div align="right"></div></td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="rdoa" type="radio" value="6" onClick="deshabi()" <? if($row['transfnomina']=='X'){?>checked<? }?>>
              </div></td>
              <td><div align="left">Transferencia Nomina </div></td>
              <td><div align="right"></div></td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td>&nbsp;</td>
              <td colspan="2"><div align="center">Centro de Costo </div></td>
              <td>&nbsp;</td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">CC</div></td>
              <td><div align="center">Monto</div></td>
              <td><div align="center">CC</div></td>
              <td><div align="center">Monto</div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="cc1" type="text" id="cc1" value="<? echo $row['cc1']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc1" type="text" id="mc1" value="<? echo $row['mc1']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="cc5" type="text" id="cc5" value="<? echo $row['cc5']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc5" type="text" id="mc5" value="<? echo $row['mc5']?>" size="10">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="cc2" type="text" id="cc2" value="<? echo $row['cc2']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc2" type="text" id="mc2" value="<? echo $row['mc2']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="cc6" type="text" id="cc6" value="<? echo $row['cc6']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc6" type="text" id="mc6" value="<? echo $row['mc6']?>" size="10">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="cc3" type="text" id="cc3" value="<? echo $row['cc3']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc3" type="text" id="mc3" value="<? echo $row['mc3']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="cc7" type="text" id="cc7" value="<? echo $row['cc7']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc7" type="text" id="mc7" value="<? echo $row['mc7']?>" size="10">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="center">
                  <input name="cc4" type="text" id="cc4" value="<? echo $row['cc4']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc4" type="text" id="mc4" value="<? echo $row['mc4']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="cc8" type="text" id="cc8" value="<? echo $row['cc8']?>" size="10">
              </div></td>
              <td><div align="center">
                  <input name="mc8" type="text" id="mc8" value="<? echo $row['mc8']?>" size="10">
              </div></td>
            </tr>
            <tr class="lblCampo" valign="top">
              <td><div align="left">Concepto</div></td>
              <td colspan="3"><div align="left">
                  <input name="concepto" type="text" id="concepto" value="<? echo $row['concepto']?>" size="70">
              </div></td>
            </tr>
            <tr class="lblCampo">
              <td><div align="left">Solicitado por </div></td>
              <td>
                <div align="left">
                  <input name="solicita" type="text" id="solicita" onKeyUp="javascript:autocompletar1('solici',this.value);" value="<? echo $row['solicita']?>" size="20"/>
                <span id="reloj1"><img src='../imagenes/image.gif' alt="13" border=0 /></span> </div></td>
              <td><div align="right">Aprobado por </div></td>
              <td><input name="aprueba" type="text" id="aprueba" onKeyUp="javascript:autocompletar2('aprue',this.value);" value="<? echo $row['aprueba']?>" size="25">
                  <span id="reloj2"><img src='../imagenes/image.gif' alt="12" border=0 /></span></td>
            </tr>
            <tr class="lblCampo">
              <td colspan="2"><div id="solici"></div></td>
              <td colspan="2"><div id="aprue"></div></td>
            </tr>
          </table>
      </div></td>
    </tr>
    <? }?>
    <tr>
      <td  class="lblCampo"><div align="left">confidencial</div></td>
      <td>&nbsp;</td>
      <td class="lblCampo"><div align="left">
          <input name="confidencial" type="radio" value="1" onClick="deshabilita()" <? if($row['confidencial']=='1'){?>checked<? }?>/>
        si
        <input name="confidencial" type="radio" value="0" <? if($row['confidencial']=='0'){?>checked<? }?> onClick="habilita()"/>
        no </div></td>
    </tr>
    <tr class="lblCampo">
      <td  class="lblCampo"><div align="left">Copy To </div></td>
      <td>&nbsp;</td>
      <td class="lblCampo"><div align="left">
          <input type="text" name="send" id="send" onKeyUp="javascript:autocompletar('lista',this.value);" size="15" />
        <span id="reloj"><img src='../imagenes/image.gif' alt="i1" border=0 /></span>
          <input name="input" type="text" id="input" value="<? echo $row['areas']?>" size="52">
      </div></td>
    </tr>
    <tr>
      <td colspan="3"  class="lblCampo"><div id="lista"></div></td>
    </tr>
    <tr>
      <td colspan="3"><div id="listar" align="center">
          <table width="336" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="169"><input name="button" type="button" class="botira" id="button" style="<?=$stylo['st2']?>" onClick="enviar_url(form1,'procesos/per_editar_doc_save.php')" value="Editar Doc"></td>
              <td width="167"><input type="button" name="Submit2" value="Regresar" onClick="volver(this.form);" style="<?=$stylo['st2']?>" class="botira"></td>
            </tr>
          </table>
        <? //include_once("per_lista_areas.php");?>
          
        <input name="archivoactual" type="hidden" size="10" id="archivoactual" value="<? echo $row['archivo']?>">
      </div></td>
    </tr>
  </table>
</form>
</body>
<?
}else{
echo "La session finalizo debe cerrar el sistema y volver a entrar";
}?>
