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/consulta_accion_funv2.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Generador de Pagos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.titulos {font: 16px; color: red; font-family:Arial; font-weight:bold}
.boton {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.texto {background-color: #CCFFCC; font-size: 11px; font-family: Arial; color:#0000CC; display: block;}
.texto2 {background-color: #CCCCCC; font-size: 11px; font-family: Arial; color:#0000CC; display: block;}
.fecha {font-size: 12px; font-family: Arial; color:#990000; display: block; }
.campo {background-color:#FFFFAA; width: 100px; border:2px solid #990000;}
.lista {font-family: Arial; font-size: 11px;	color: #990000;}
.Estilo2 {font-family: Arial;	font-size: 16px;	color: #990000;}
.boton2 {font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid; width:70px; height:22px;}
body {
	background-image: url();
}
.Estilo19 {
	font-family: "Arial Narrow";
	font-weight: bold;
	color: #993333;
	font-size: 14px;
}
.Estilo50 {color: #CC3333;
	font-family: "Arial Narrow";
	font-weight: bold;
}
.botongp {
	font-family: "Courier New", Courier, monospace;
	font-weight: bold;
	background-color: #9DF4C0;
	margin: 2px;
	padding: 2px;
	height: 1cm;
	width: 4cm;
	border: medium outset #0033CC;
}
.botongp {
	background-color: #ADF1CA;
	margin: 2px;
	padding: 2px;
	height: 0.5cm;
	width: 3cm;
	border: medium outset #0033CC;
}
.botongp {
	background-color: #A9FAD3;
	margin: 2px;
	padding: 2px;
	height: 0.7cm;
	width: 3cm;
	border: medium outset #003399;
}
-->
</style>
<script languaje="JavaScript">
function Mostrar_Fecha()
{
         var mydate=new Date()
         var year=mydate.getYear()
         if (year < 1000)
                 year+=1900
                 var day=mydate.getDay()
                 var month=mydate.getMonth()
                 var daym=mydate.getDate()
                 if (daym<10)
                    daym="0"+daym
                    var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
                    var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
                    document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}					
</script>
<script language="javascript">
function AbreGral()
{ 
    var menu;   
	menu=window.open("mostrar_ingreso.php","","toolbar=no,scrollbars=no,width=800,height=500,status=yes");  
	menu.focus();  
	var ventana = window.self;  
	ventana.opener = window.self;  
	ventana.close();
}
</script>
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
</head>
<?php
   
   require_once("mainfile.php");
   include ("config.php");
   global $dbi;
   
    require_once("Conectarse.php");

	$sql = mysql_query('SELECT * FROM sucursal');
			if (!$sql) {
				die('Invalid query: ' . mysql_error());  
			}	
	$row_sql = mysql_fetch_assoc($sql);
	$totalRows_sql = mysql_num_rows($sql);
?>
<body onLoad="document.formulario.cedula.focus()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="formulario" action="" method="post">
<table width="671" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><fieldset><table width="669" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr bgcolor="#FFFFCC">
    <td class="titulos"><div align="center">GENERACION DE PAGOS  </div></td>
  </tr>
  <tr bgcolor="#ECE9D8">
    <td  align="center"><div align="center"><span class="Estilo19 ">Fecha dd-mm/aaaa:</span><span class="Estilo21"> <span class="Estilo13">
          <input name="dia"  id="dia2" value="<?php echo date("d"); ?>" size="2" maxlength="2" readonly="">
          <input name="mes"  id="mes2" value="<?php echo date("m"); ?>" size="2" maxlength="2" readonly="">
          <input name="ano"  id="ano2" value="<?php echo date("Y"); ?>" size="4" maxlength="4" readonly="">
        </span></span></div></td>
        
  </tr>
  <tr bgcolor="#FFCC99">
    <td height="42"><fieldset>
   <legend><span class="texto">Ingrese Sucursal :</span></legend>
   <table  border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td><span class="Estilo2">Sucursal:</span></td>
       <td><select name="sucursal" id="ced_funcionario" class="js-example-basic-single" required>
         <option>SELECCIONE SUCURSAL</option>
         <?php
     do {  
?>
         <option value="<?php echo $row_sql['nombre'];?>"><?php echo $row_sql['nombre']?></option>
         <?php
} while ($row_sql = mysql_fetch_assoc($sql));
  $rows = mysql_num_rows($sql);
  if($rows > 0) {
      mysql_data_seek($sql, 0);
       $row_sql = mysql_fetch_assoc($sql);
  }
?>
       </select></td>
	   <td>
	   </td>
	    <td>
	   </td>
	  
	    <td><span class="Estilo2">Sucursal:</span></td>
	    <td>
	    <input name="nomsucu" type="text"  id="celufun" value="<?php echo $_POST['sucursal']; ?>" size="10" maxlength="10" readonly="">
	   </td>
     </tr>
   </table>

    </fieldset></td></tr>
  <tr bgcolor="#FFCC99">
    <td><div align="center">
      <input name="menu2" type="button" class="Estilo50" id="menu2" onClick="window.location.href='menu_histoser.php'" value="IR AL MENU">
	  
	
    </div></td>
  </tr>
  
  <tr bgcolor="#FFCC99">
    <td><div align="center">
      <input name="consultar" id="consultar" type="submit" class="boton" value="Consultar">
      <input name="button" type="button" class="boton" onclick="history.back()" value="Atr&aacute;s">
      <input name="button" type="button" class="boton" onclick="window.location.reload()" value="Actualizar">
    </div></td>
  </tr>
  <tr bgcolor="#FFCC99">
    <td><div align="center">
      <label>
      <input name="gp" type="submit" class="botongp" id="gp" value="Generar Pago">
      </label>
    </div></td>
  </tr>
</table>
</fieldset></td>
  </tr>
</table>
</form>
<script >
	// In your Javascript (external .js resource or <script> tag)
	$(document).ready(function() {
		$('.js-example-basic-single').select2();
	});
</script>
</body>
</html>


<?php

if(isset($_POST["consultar"]))
{
	$cont=0;
	$total=0;
    echo "<form name='form' action='' method='post'>";
    require_once("mainfile.php");
    include ("config.php");
    global $dbi;


	///consulta todos loa abogados por sucarsal seleccionada 
	$control3 = mysql_query('SELECT cedula, nombre_completo, sucursal  FROM asjudinet_abogados WHERE ((vigentes = 1 and estado = 0) and (codigo_abogado != 1 and codigo_abogado != 667)) and sucursal = "'.$_POST['sucursal'].'" ORDER BY nombre_completo  ASC ');
	if (!$control3) {
		die('Invalid query: ' . mysql_error());
	}

	if ((mysql_num_rows($control3)!=0)) 
	{

		while(list($cedulfun) = mysql_fetch_row($control3)) 
		{ 


			$mssql = mysql_query('SELECT * FROM record_servicios WHERE cedula_funcionario = "' . $cedulfun . '"  and estado = "1" ');
			if (!$mssql) {
				die('Invalid query: ' . mysql_error());
			}	
					
			if($mssql)
			{
				$filas = mysql_num_rows($mssql);
				
				if ($filas > 0)
				{
					$misql3 = mysql_query('SELECT Nombre_Completo FROM Usuarios WHERE Cedula = "' . $cedulfun . '" ');
					if (!$misql3) {
						die('Invalid query 14: ' . mysql_error());
					} 	 
					list($nomfun) = mysql_fetch_row($misql3);
				
							
					$control = mysql_query('SELECT cedula , numero_atencion , fecha_servicio , cedula_funcionario , tipo  FROM record_servicios WHERE cedula_funcionario = "' . $cedulfun . '"  and estado = "1" order by numero_atencion');
					if (!$control) {
						die('Invalid query: ' . mysql_error());
					}
					
					
					if ((mysql_num_rows($control)!=0)) 
					{
						echo "<TABLE width='1000' border='0' align='center' cellpadding='5' cellspacing='3'>
						<TR>
						<TD bgcolor='#FFCC66'><div align='center'><span class='texto2'>NOMBRE FUNCIONARIO</span></div></TD>
						<TD bgcolor='#FFCC66'><div align='center'><span class='texto2'>FECHA RANGO</span></div></TD>";	
						printf("<tr>						   
						<td bgcolor='#C5D6FC'><div align='center' class='lista'>".$nomfun."</span></div></td>
						<td bgcolor='#C5D6FC'><div align='center' class='lista'>".date('Y-m-d')."</span></div></td>");
						echo "</table>";			  
									
						echo "<TABLE width='1000' border='0' align='center' cellpadding='0' cellspacing='1'>
									
						<TR>
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>NUMERO ATENCION</span></div></TD>
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>CEDULA</span></div></TD>	
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>FECHA SERVICIO</span></div></TD>
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>TIPO</span></div></TD>
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>NUMERO ORDEN</span></div></TD>
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>TIPO ORDEN</span></div></TD>
						<TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>CONCEPTO</span></div></TD>";		 		  
									
						///bucle 2
						while(list($cedul , $numaten, $fs, $cedfun, $ti ) = mysql_fetch_row($control)) 
						{  
							$cont++;
			
							$control2 = mysql_query('SELECT id, cedula_afiliado, numero_atencion, cedula_funcionario, numero_orden, tipo_orden, concepto_servicio FROM accion_tomada WHERE cedula_afiliado  = "' . "$cedul". '"  and numero_atencion  = "' . "$numaten". '"  and (concepto_servicio = "EXCELENTE" || concepto_servicio = "BUENO")  order by numero_atencion ');
							if (!$control2) {
								die('Invalid query 20: ' . mysql_error());
							} 
										
							list($id, $cedula_afiliado, $numero_atencion, $cedula_funcionario, $numero_orden, $tipo_orden, $concepto_servicio) = mysql_fetch_row($control2);		   
										
							printf("<tr>
							<td bgcolor='#ECE9D8'><div align='center' class='lista'><input type='button' value=$numero_atencion name='cedu' class=boton2 onClick =window.open('modificar_atencion.php?id=$cedula_afiliado&atencion=$numero_atencion','','top=50,left=100,toolbar=no,scrollbars=no,width=800,height=700,status=yes')></a></span></div></td>
										
							<td bgcolor='#ECE9D8'><div align='center' class='lista'>".$cedula_afiliado."</a></span></div></td>
							<td bgcolor='#C5D6FC'><div align='center' class='lista'>".$fs."</span></div></td>
							<td bgcolor='#C5D6FC'><div align='center' class='lista'>".$ti."</span></div></td>
							<td bgcolor='#C5D6FC'><div align='center' class='lista'>".$numero_orden."</span></div></td>	
							<td bgcolor='#C5D6FC'><div align='center' class='lista'>".$tipo_orden."</span></div></td>
							<td bgcolor='#C5D6FC'><div align='center' class='lista'>".$concepto_servicio."</span></div></td>
							");
						}
						echo "</table>";		  
					}
					else
					{
						echo "<script>alert('Los datos ingresados no existe');</script>";
					}
				}
			}
			else
			{
				echo "<script>alert('La informacion no se encuentra en la base de datos');</script>";
			}
			
			$total=$cont*8000;
			
			if($cont <> 0){
				echo  "<TD bgcolor='#FF3300'><div align='center'><span class='texto'>TOTAL PAGO </span></div></TD>";
				echo  "<td bgcolor='#0000CC'><div align='center' class='lista'>".$total."</a></span></div></td>";
				echo  "<TD bgcolor='#FF3300'><div align='center'><span class='texto'>NUMERO TOTAL ATENCIONES</span></div></TD>";
				echo "<td bgcolor='#0000CC'><div align='center' class='lista'>".$cont."</a></span></div></td>";
				echo "<br>";
			}

			$total = 0;
			$cont = 0;
			
		}
	}
}	





if(isset($_POST["gp"]))
{
	$fecha_pago = ($_POST["ano"]."-".$_POST["mes"]."-".$_POST["dia"]);


	$contro30 = mysql_query('SELECT codigo FROM sucursal where nombre="'.$_POST['nomsucu'].'"');
	if (!$contro30) {
		die('Invalid query 20: ' . mysql_error());
	} 
										
	list($codigo) = mysql_fetch_row($contro30);		   
							

 	$control = mysql_query('SELECT cedula , numero_atencion , fecha_servicio , cedula_funcionario , tipo  FROM record_servicios WHERE sucursal = "' . $codigo. '"  and estado = "1" ');
	if (!$control) {
		die('Invalid query: ' . mysql_error());
	}

	while(list($cedul , $numaten, $fs, $cedfun, $ti ) = mysql_fetch_row($control)) 
    { 
		$mssql = mysql_query("UPDATE  accion_tomada  set estado = '2' WHERE cedula_afiliado  = '" . $cedul. "' and numero_atencion   = '" . $numaten. "' and  (concepto_servicio = 'EXCELENTE' || concepto_servicio = 'BUENO') and estado = '1' ");
		if (!$mssql) {
			die('Invalid query updete 1: ' . mysql_error());
		}  
      
	  				
		$mssql = mysql_query("UPDATE  actuaciones_servicios    set estado = '2' WHERE cedula   = '" . $cedul. "' and numero_atencion    = '" . $numaten. "' and estado = '1' ");
		if (!$mssql) {
			die('Invalid query updete 1: ' . mysql_error());
		}  
					
		$mssql = mysql_query("UPDATE  record_servicios   set fecha_pago = '" . $fecha_pago . "' , estado = '2' WHERE cedula   = '" . $cedul. "' and numero_atencion    = '" . $numaten. "' and estado = '1' ");
		if (!$mssql) {
			die('Invalid query updete 1: ' . mysql_error());
		}  
	}	 
}	
?>