MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/www/liquidacion_directores_sucursales.php
<?php 
require_once("mainfile.php");
include ("config.php");
require_once("Conectarse.php");

$godr = mysql_query('SELECT MAX(mes) FROM eval_direc_super_oficinas WHERE cedula = "'.$_GET["cedula"].'" and estado="1"  ');
if (!$godr) {
	die('Error de godr: ' . mysql_error());
}
list($maxmes) = mysql_fetch_row($godr);
	 
///ESTO ES ADICIONAL PRUEBA
$mesanterior = $mes -1;
$busca = mysql_query('SELECT acumulado_total_mes FROM eval_direc_super_oficinas WHERE mes = "'.$mesanterior.'" and cedula = "'.$_GET["cedula"].'" ');
list($acumuladomesesito) = mysql_fetch_row($busca);
//resultado = 0; hay que traer la sumatoria de las tablas
$maximomes = mysql_query('SELECT MAX(mes) FROM eval_direc_super_oficinas WHERE cedula = "'.$_GET["cedula"].'" ');
if (!$maximomes) {
	die('Error de maximomes: ' . mysql_error());
}
list($elultimomes) = mysql_fetch_row($maximomes);

$puntosasistentegerenciaadministrativa = mysql_query('SELECT acumulado_mensual FROM eval_direc_asist_gerencia_adm WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsasistentegerenciaadministrativa)=mysql_fetch_row($puntosasistentegerenciaadministrativa);

$puntosasistentegerenciacomercial = mysql_query('SELECT acumulado_mensual FROM eval_direc_asist_gerencia_comercial WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsasistentegerenciacomercial)=mysql_fetch_row($puntosasistentegerenciacomercial);

$puntosasistenteventas = mysql_query('SELECT acumulado_mensual FROM eval_direc_asist_ventas WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsasistenteventas)=mysql_fetch_row($puntosasistenteventas);

$puntoscontrolinterno = mysql_query('SELECT acumulado_mensual FROM eval_direc_control_interno WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointscontrolinterno)=mysql_fetch_row($puntoscontrolinterno);

$puntosgerenciaadministrativa = mysql_query('SELECT acumulado_mensual FROM eval_direc_gerencia_adm WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsgerenciaadministrativa)=mysql_fetch_row($puntosgerenciaadministrativa);

$puntosgerenciageneral = mysql_query('SELECT acumulado_mensual FROM eval_direc_gerencia_gen WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsgerenciageneral)=mysql_fetch_row($puntosgerenciageneral);

$puntoshistoser = mysql_query('SELECT acumulado_mensual FROM eval_direc_histoser WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointshistoser)=mysql_fetch_row($puntoshistoser);

$puntosjuridicas = mysql_query('SELECT acumulado_mensual FROM eval_direc_juridicas WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsjuridicas)=mysql_fetch_row($puntosjuridicas);

$puntosmonitoreocamaras = mysql_query('SELECT acumulado_mensual FROM eval_direc_moni_camaras WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsmonitoreocamaras)=mysql_fetch_row($puntosmonitoreocamaras);

$puntosoficinas = mysql_query('SELECT acumulado_mensual FROM eval_direc_super_oficinas WHERE cedula = "'.$_GET["cedula"].'" and  mes = "'.$elultimomes.'" ');
list($pointsoficinas)=mysql_fetch_row($puntosoficinas);

$pointstotales = $pointsasistentegerenciaadministrativa + $pointsasistentegerenciacomercial + $pointsasistenteventas + $pointscontrolinterno + $pointsgerenciaadministrativa + $pointsgerenciageneral + $pointshistoser + $pointsjuridicas + $pointsmonitoreocamaras + $pointsoficinas;

//////////

	 
$control3= mysql_query("SELECT acumulado_anual FROM eval_direc_super_oficinas WHERE cedula = '".$_GET["cedula"]."' and mes='".$maxmes."'");	
if (!$control3) {     
	die('Invalid query 0: ' . mysql_error());
}				
list($acumuladoanualso) = mysql_fetch_row($control3);





/////////////////////////////////////////////////////////
		
$control = mysql_query('SELECT id,cedula,nombre_completo,mes,acumulado_mensual,acumulado_anual,estado FROM eval_direc_super_oficinas WHERE cedula = "'.$_GET["cedula"].'" and id = "'.$_GET["id"].'"');    
if (!$control) {
	die('Invalid query 1: ' . mysql_error()); 
}
$num=mysql_num_rows($control);   
list($id,$cedula,$nombre,$mes,$acumuladomes,$acumuladoanual,$estado) = mysql_fetch_row($control);
		
		
$calificado = $_GET['e'];
echo $calificado;
		
	

?>
<html>
<head>
<title>Registro de Formulario Juridico</title>
<style type="text/css">
<!--
img {border: 0}
body,td {font-family: Verdana,Arial; font-size: 8pt; color: #000000}
input,select {font-family: Verdana,Arial; font-size: 7.5pt}
a:link, a:visited {text-decoration: none; color: #2030F0}
a:hover, a:active {text-decoration: underline; color: #D02010}
body table tr td table tr td form table {
	font-size: 14px;
	font-family: Georgia, "Times New Roman", Times, serif;
}
body table tr td table tr td form table tr td div strong {
	font-size: 10pt;
}
body table tr td table tr td form table tr td div strong {
	font-size: 9pt;
}
body table tr td table tr td form table tr td b {
	font-size: 9pt;
}
body table tr td table tr td form table tr td div {
	font-size: 7pt;
}
.polici {background-color: #FFCC66; font-size: 14px; font-family: Arial; color: #000099; width:10px display: block;}

.polici2 {background-color: #306090; font-size: 14px; font-family: Arial; color: #FFFFFF; width:10px display: block;}
-->
</style>

<script>
function Verificar() {
	
	
if(document.frm.funcionario.value == "") {
  alert("Por Favor Seleccione Funcionario");
  document.frm.funcionario.focus();
  return false;
 }	

 if(document.frm.nombre.value == "") {
  alert("Por Favor Escriba El Nombre");
  document.frm.nombre.focus();
  return false;
 }
 


 
 return true;
}
</script>
 


</head>
 
<body bgcolor="#EFEFEF" text="#000000" topmargin="0" leftmargin="0">
<br>
<center> <img src="ELEMENTOS\CABEZOTE SERVIASJUDINET.jpg" WIDTH=60% > </center>
<br>
<table width="100%" height="75%" bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0">
         
  <tr>
    <td height="10" valign="top">
 
      <table width="70%" border="0" cellspacing="0" cellpadding="0">
 
      </table>
    </td>
  </tr>
 
  <tr>
    <td align="center">
 
      <table width="77%" bgcolor="#EFEFEF" align="center" border="5" cellspacing="0" cellpadding="6">
 <tr>
   <td align="center" bgcolor="#306090"><big style="color:#FFFFFF"><b>REALIZAR LIQUIDACION</b></big></td>
  
 </tr>
 
 <tr>
   <td align="center" colspan="2">
 
<script>
function Verificar() {
	
	
if(document.frm.apellidos.value == "") {
  alert("Por Favor Escriba Los Apellidos");
  document.frm.apellidos.focus();
  return false;
 }	

 if(document.frm.nombre.value == "") {
  alert("Por Favor Escriba El Nombre");
  document.frm.nombre.focus();
  return false;
 }
 
 if(document.frm.ced.value == "") {
  alert("Por Favor Escriba El Numero De Cedula");
  document.frm.ced.focus();
  return false;
 }
 
 if(document.frm.ecivil.value == "") {
  alert("Por Favor Escriba El Estado Civil");
  document.frm.ecivil.focus();
  return false;
 } 
 
  if(document.frm.funcionario.value == "") {
  alert("Por Favor Seleccione El Funcionario");
  document.frm.funcionario.focus();
  return false;
 } 


 
 return true;
}
</script>
 
     <form method="post" name="frm" onSubmit="return Verificar()">
       <table border="0" bgcolor="#EFEFEF" cellspacing="5">
 <!--<td><div align="right"><strong> Fecha Registro</strong></div></td>
    <td><div align="left">
      <input name="dia2" type="text" id="dia2" value="<?php echo date("d"); ?>" size="2" maxlength="2" readonly>
      <input name="mes2" type="text" id="mes2" value="<?php echo date("m"); ?>" size="2" maxlength="2" readonly>
      <input name="ano2" type="text" id="ano2" value="<?php echo date("Y"); ?>" size="4" maxlength="4" readonly>
    </div></td> 
  </tr>  -->
 
     <form method="post" name="frm" onSubmit="return Verificar()">
       <table border="0" bgcolor="#EFEFEF" cellspacing="5">

    
       
         <tr>
  <td align="right"><b>Nombres:</b></td> 
  <td><input type="text" name="nombre"  value="<? echo $nombre?>"size="50" maxlength="40" readonly></td>
       </tr>
 
   <tr>
  <td align="right"><b>Cedula:</b></td>
  <td><input type="text" name="ced" value="<? echo $cedula?>"size="50" maxlength="40" readonly></td>
       </tr>
		   
   <tr>
  <td align="right"><b>Puntos Mes Anterior:</b></td>
  <td><input type="text" name="ced" value="<? echo $acumuladoanualso ?>"size="50" maxlength="40" readonly></td>
       </tr>
       
        <tr>
  <td align="right"><b>Puntos Totales:</b></td>
  <td><input type="text" name="acumulado" value="<? echo $pointstotales ?>"size="50" maxlength="40"></td>
       </tr>
  
  
       
   </table><br>


   <input name="guardar5" type="submit" class="polici2" id="guardar5" value="Liquidar Pago"/>
 
 
     </form> 
     
     
     </form> 
 
   </td>
 </tr>
      </table><br>
 
    </td>
  </tr>
 
 
  <td height="22" colspan="2" bgcolor="#EFEFEF" class="fecha"><div align="center">
  
  
   
    <input name="button" type="button" onClick="javascript:window.close()" value="REGRESAR AL LISTADO">
    </div></td> 
 <br>
 </table>

</body> 
</html>

<?php
	
	
if(isset($_POST["guardar5"]))
{
	
	if($calificado == "CALIFICADO"){
		echo "<script>alert('Ya Tiene Pago');</script>";
		exit();
	}
	
	
	else{
	

$fechast = date("y").'-'.date("m").'-'.date("d");

////////////////////////// CALIFICACION eval_direc_super_oficinas
$control2= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_super_oficinas WHERE cedula = '".$_GET["cedula"]."' and id='".$_GET["id"]."' ");	
 
		 if (!$control2) {     
				die('Invalid query 0: ' . mysql_error());
			}	
			
list($totalmensualso,$acumuladototalmes) = mysql_fetch_row($control2);		


$godr = mysql_query('SELECT MAX(mes) FROM eval_direc_super_oficinas WHERE cedula = "'.$_GET["cedula"].'" and estado="1"  ');
			if (!$godr) {
				die('Error de godr: ' . mysql_error());
			}
     list($maxmes) = mysql_fetch_row($godr);
	 
	 
$control3= mysql_query("SELECT acumulado_anual FROM eval_direc_super_oficinas WHERE cedula = '".$_GET["cedula"]."' and mes='".$maxmes."'");	
 
		 if (!$control3) {     
				die('Invalid query 0: ' . mysql_error());
			}	
			
list($acumuladoanualso) = mysql_fetch_row($control3);





////////////////////////// CALIFICACION eval_direc_gerencia_gen

$control4= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_gerencia_gen WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control4) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualgg,$acumuladototalmesegg) = mysql_fetch_row($control4);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_control_interno


$control5= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_control_interno WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control5) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualci,$acumuladototalmeseci) = mysql_fetch_row($control5);	
///////////////////////////


////////////////////////// CALIFICACION eval_direc_gerencia_adm


$control6= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_gerencia_adm WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control6) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualga,$acumuladototalmesga) = mysql_fetch_row($control6);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_asist_gerencia_adm

$control7= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_asist_gerencia_adm WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control7) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualaga,$acumuladototalmesaga) = mysql_fetch_row($control7);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_juridicas

$control8= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_juridicas WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control8) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualaj,$acumuladototalmesaj) = mysql_fetch_row($control8);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_moni_camaras

$control9= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_moni_camaras WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control9) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualmc,$acumuladototalmesmc) = mysql_fetch_row($control9);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_asist_ventas

$control10= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_asist_ventas WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control10) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualav,$acumuladototalmesav) = mysql_fetch_row($control10);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_asist_gerencia_comercial

$control11= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_asist_gerencia_comercial WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control11) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualagc,$acumuladototalmesagc) = mysql_fetch_row($control11);	
///////////////////////////

////////////////////////// CALIFICACION eval_direc_histoser

$control12= mysql_query("SELECT acumulado_mensual,acumulado_total_mes FROM eval_direc_histoser WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."' ");	
 
		 if (!$control12) {     
				die('Invalid query 4: ' . mysql_error());
			}	
			
list($totalmensualhi,$acumuladototalmeshi) = mysql_fetch_row($control12);	
///////////////////////////












$totalmensuales = $totalmensualso + $totalmensualgg + $totalmensualci + $totalmensualga + $totalmensualaga + $totalmensualaj + $totalmensualmc + $totalmensualav + $totalmensualagc + $totalmensualhi;
$valortotal=$acumuladoanualso+$totalmensuales;


$valortotalmes=$acumuladomes;


$mssql3 = mysql_query("UPDATE eval_direc_super_oficinas set acumulado_total_mes = '".$totalmensuales."', acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and id='".$_GET["id"]."' " );     
           
            if (!$mssql3) {   
				die('Invalid query so MODIFICAR: ' . mysql_error());
		}   
	
$mssql4 = mysql_query("UPDATE eval_direc_gerencia_gen set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql4) {   
				die('Invalid query gg MODIFICAR: ' . mysql_error());
		} 
		
$mssql5 = mysql_query("UPDATE eval_direc_control_interno set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql5) {   
				die('Invalid query ci MODIFICAR: ' . mysql_error());
		} 
		
$mssql6 = mysql_query("UPDATE eval_direc_gerencia_adm set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql6) {   
				die('Invalid query ga MODIFICAR: ' . mysql_error());
		}
		
$mssql7 = mysql_query("UPDATE eval_direc_asist_gerencia_adm set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql7) {   
				die('Invalid query aga MODIFICAR: ' . mysql_error());
		}
		
$mssql8 = mysql_query("UPDATE eval_direc_juridicas set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql8) {   
				die('Invalid query aj MODIFICAR: ' . mysql_error());
		}
		
$mssql9 = mysql_query("UPDATE eval_direc_moni_camaras set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql9) {   
				die('Invalid query mc MODIFICAR: ' . mysql_error());
		}
		
$mssql10 = mysql_query("UPDATE eval_direc_asist_ventas set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql10) {   
				die('Invalid query av MODIFICAR: ' . mysql_error());
		}
		
$mssql11 = mysql_query("UPDATE eval_direc_asist_gerencia_comercial set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql11) {   
				die('Invalid query agc MODIFICAR: ' . mysql_error());
		}
		
		
$mssql12 = mysql_query("UPDATE eval_direc_histoser set acumulado_total_mes = '".$totalmensuales."',acumulado_anual = '".$valortotal."',estado='1' WHERE cedula = '".$_GET["cedula"]."' and mes='".$_GET["mes"]."'" );     
           
            if (!$mssql12) {   
				die('Invalid query hi MODIFICAR: ' . mysql_error());
		}

		
		
		 		
	
	
	echo "<script>alert('Los datos fueron Guardados');</script>";
	echo "<script languaje='javascript' type='text/javascript'>window.close();</script>";	
		
			}
			
}
		
?>