Código PHP:
<?php
require_once('conexion.php');
if (isset($_POST['busc'])){
$estado=$_POST['estado'];
$tipac=$_POST['tipac'];
$num_accion=$_POST['num_accion'];
$num_ruc=$_POST['num_ruc'];
$sql="select * from tbldocumentosicr where icr_estado='$estado' or icr_tipo_accion='$tipac' or icr_num_accion='$num_accion' or icr_ruc='$num_ruc' order by icr_fecha_registro ASC";
}else{
$sql="select * from tbldocumentosicr order by icr_fecha_registro ASC";
}
$reg=mysql_query($sql,$cnx);
?>
<html>
<head>
<title>Reporte</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" language="javascript">
function cambiar(id,color){
document.getElementById(id).style.backgroundColor=color;
}
</script>
<style type="text/css">
body,td,th {
color: #000;
}
body {
}
</style>
<script>
function abrir() {
open('alerta.php','','top=300,left=300,width=350,height=300,menubar=yes,scrollbars=yes,resizable=yes');
}
</script>
</head>
<body onload="abrir()">
<form action="listar_icr.php" method="POST" >
<table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB" BORDER="1" width="900" align="center" cellpadding="1" >
<tr>
<td colspan=6 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>
</tr>
<tr>
<td align=left><B><h5>Numero de Acción:</h5></B>
<td align=left> <input type="text" name="num_accion" onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onMouseOut="this.style.backgroundColor='#FBF9D5'"/>
</td>
<td align=left><B>
<h5>Tipo de Accion:</h5>
</B></td>
<td align=left>
<SELECT NAME="tipac" style="background-color:#FBF9D5" >
<OPTION value="---" selected>Elegir</OPTION>
<OPTION value="2">Orden de Fiscalización</OPTION>
<OPTION value="1">Acción Inductiva</OPTION>
</SELECT></td>
<TR>
<TD align=left><B><h5>RUC:</h5></B>
<TD align=left> <input type="text" name="num_ruc" onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onMouseOut="this.style.backgroundColor='#FBF9D5'"/>
</TD>
<TD align=left><B><h5>Estado:</h5></B></TD>
<TD align=left>
<SELECT name="estado" style="background-color:#FBF9D5">
<OPTION value="---" selected>Elegir</OPTION>
<option value="1">Registrado</option>
<option value="2">Con Comunicación</option>
<option value="3">Notificación Comunicación</option>
<option value="4">Con Resolución</option>
<option value="5">Notificado con RI</option>
<option value="6">Reportado a Lima</option>
</SELECT></TD>
</TR>
<TR>
<TD colspan=6>
<br/>
<center>
<input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
</table>
</form>
<br></br>
<table width="100%" align="center" cellspacing="0">
<TD align=left><input type="submit" name="reporta" value="Reportar" onClick="location.href='reportlima.php'" style='width:150px; height:35px'></TD>
</table>
<table BGCOLOR="F9FBFC" BORDERCOLOR="" BORDER=5 width="100%" align="center" cellspacing="0">
<tr>
<td colspan=17 align="center" bgcolor="#FFFFFF"><h2><strong></strong></h2></td>
</tr>
<tr>
<td BGCOLOR="C1D4D6" width="85" align=center><h5>TIPO DE ACCIÓN</h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>NÚMERO DE ACCIÓN</h5></td>
<td BGCOLOR="C1D4D6" width="230" align=center><h5>CONTRIBUYENTE</h5></td>
<td BGCOLOR="C1D4D6" width="85" align=center><b><h5>RUC</h5></b></td>
<td BGCOLOR="C1D4D6" width="230" align=center><h5>INFRACCIÓN <br>COMETIDA</h5></td>
<td BGCOLOR="C1D4D6" width="75" align=center><h5>FECHA<BR>REGISTRO</h5></td>
<td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA EMISION<BR>COMUNICACIÓN</h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>NOTIFICACIÓN<BR>COMUNICACIÓN</h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>VENCIMIENTO<BR>COMUNICACIÓN 10 dias habiles</h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA EMISION<BR>RESOLUCIÓN</h5></td>
<td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA<BR>NOTIFICACIÓN RI</h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>VENCIMIENTO<BR>RESOLUCIÓN 15 dias habiles </h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>REPORTE</h5></td>
<td BGCOLOR="C1D4D6" width="90" align=center><h5>ESTADO</h5></td>
<td BGCOLOR="C1D4D6" width="125" align=center></td>
</tr>
<?php
$i=0;
while($res=mysql_fetch_array($reg)){
?>
<tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
<td width="85" align=center>
<?php if($res['icr_tipo_accion']==2){?>Orden Fiscalización<?php }
elseif($res['icr_tipo_accion']==1){?>Acción Inductiva<?php }
?>
</td>
<td width="90" align=center><a href="reporte.php?num_accion=<?php echo $res[1];?>"><strong><?php echo $res['icr_num_accion'];?></strong></a></td>
<td width="230" align=justify><?php echo $res['icr_contribuyente'];?></td>
<td width="85" align=justify><?php echo $res['icr_ruc'];?></td>
<td width="230" align=justify>
<?php if($res['icr_infraccion']==1){?>Inciso b) numeral 9.3: Condición de domicilio fiscal NO HABIDO
<?php }elseif($res['icr_infraccion']==2){?>Inciso c) numeral 9.3: No comparecer o comparecer fuera del plazo establecido.
<?php }elseif($res['icr_infraccion']==3){?>Inciso d) numeral 9.3: No emitir y/o no otorgar CDP, distintos a guías de remisión (num.1, art.174° CT)
<?php }elseif($res['icr_infraccion']==4){?>Inciso d) numeral 9.3: Omitir llevar libros y/o registros y/o otros medios de control (num.1, art.175° CT)
<?php }elseif($res['icr_infraccion']==5){?>Inciso d) numeral 9.3: No presentar declaraciones determinativas dentro de los plazos (num.1, art.176° CT)
<?php }elseif($res['icr_infraccion']==6){?>Inciso d) numeral 9.3: No exhibir libros, registros u otros documentos solicitados (num.1, art.177° CT)
<?php }elseif($res['icr_infraccion']==7){?>Inciso d) numeral 9.3: No declarar ingresos, rentas, patrimonio, tributos retenidos, o declarar datos falsos
<?php }?></td>
<td width="75" align=center><?php echo $res['icr_fecha_registro'];?></td>
<td width="100" align=center><?php echo $res['icr_fecha_comunicacion'];?></td>
<td width="90" align=center><?php echo $res['icr_fecha_noti_comu'];?></td>
<td width="90" align=center><?php
$fechaactual=date("Y-m-d");
if($res['icr_fecha_venci_not_comu']<=$fechaactual){
?>
<font color="#FF0000"> <?php echo $res['icr_fecha_venci_not_comu'];?></font>
<?php }else{ ?>
<?php echo $res['icr_fecha_venci_not_comu'];?>
<?php } ?>
</td>
<td width="90" align=center><?php echo $res['icr_fecha_resolucion'];?></td>
<td width="100" align=justify><?php echo $res['icr_fecha_ri'];?></td>
<td width="90" align=center><?php
$fechaactual=date("Y-m-d");
if($res['icr_fecha_venci_resol']<=$fechaactual){
?>
<font color="#FF0000"> <?php echo $res['icr_fecha_venci_resol'];?></font>
<?php }else{ ?>
<?php echo $res['icr_fecha_venci_resol'];?>
<?php } ?>
</td>
<td width="90" align=center><?php echo $res['icr_fecha_reporte'];?></td>
<td width="90" align=center>
<?php if($res["icr_estado"]==1){?>Registrado
<?php }elseif($res["icr_estado"]==2){?>Con Comunicación
<?php }elseif($res["icr_estado"]==3){?>Notificación Comunicación
<?php }elseif($res["icr_estado"]==4){?>Con Resolución
<?php }elseif($res["icr_estado"]==5){?>Notificado con RI
<?php }elseif($res["icr_estado"]==6){?>Reportado
<?php }?>
</td>
<td width="125" align=justify><a href="registro_comun.php?num_accion=<?php echo $res[1];?>"><strong>1.- Comunicación</strong></br>
<a href="registro_resolu.php?num_accion=<?php echo $res[1];?>"><strong>2.- Resolución</strong></br>
<a href="registro_notif_ri.php?num_accion=<?php echo $res[1];?>"><strong>3.- Notificación RI</br></strong></td>
<!--- <a href="reportlima.php"><strong>4.- Reportar</strong></a></td> --->
</tr>
<?php
$i=$i+1;
}
?>
</table>
<tr>
<td colspan=17 align="center" bgcolor="#FFFFFF"><strong>Total de Registros:</strong>
<?php
$cantidad = "select count(icr_num_accion) from tbldocumentosicr";
$total= mysql_query($cantidad) or die(mysql_error());
$total_registros = mysql_result($total,0,0);
?>
<?php echo $total_registros;?>
</td>
</tr>
</br>
<tr>
<td colspan=17 align="center" bgcolor="#FFFFFF"><strong>Registros Encontrados:</strong>
<?php
$cantidad = "select count(icr_num_accion) from tbldocumentosicr where icr_estado='$estado' or icr_tipo_accion='$tipac' or icr_num_accion='$num_accion' or icr_ruc='$num_ruc'";
$total= mysql_query($cantidad) or die(mysql_error());
$total_registros = mysql_result($total,0,0);
?>
<?php echo $total_registros;?>
</td>
</tr>
</body>
</html>