Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - tomasvreal28

#1
PHP / Paginacion en PHP
28 Febrero 2016, 01:47 AM
Hola Y espero que me puedan ayudar
Lo que pasa es que pasa es que hecho una paginacion a un listado en el cual también hay aun campo de búsqueda y tengo agregarlo a un archivo donde se  agrega la ruta del archivo php 

por ejemplo

case 1073
http://foro.elhacker.net/programacion/listar.php

Entonces
cuando ingresa al sistema la url sale
http://foro.elhacker.net/programacion/default.php?op=1073

Y en la paginacion cuando le doy siguiente a la 2da pagina

cambia a
http://foro.elhacker.net/programacion/default.php?pagina2
y no se muestra nada

porque no esta tomando la ruta correcta
por eso quería que por favor me ayudes con esa parte del código que cuando uno vaya a la siguiente pagina no se actualice la url

Espero que por favor me puedas ayudar

Código (php) [Seleccionar]


/****conexion.php***\
<?php
$cnx
mysql_connect("localhost","root","123456");
if (!
$cnx) {
die(
"Fallo la conexión a la Base de Datos: "mysql_error());
}
$bd mysql_select_db("bdexample"$cnx);
if (!
$bd) {
die(
"Fallo la selección de la Base de Datos: " mysql_error());
}
?>


/*************listar.php*****************\
<?php
session_start
();
require_once(
'conexion.php');
if (isset(
$_POST['busc'])){
$num=$_POST['num'];
$sql="select * from tblCondominio where codigo='$num' order by fechaAcceso DESC";
}else{
$sql="select * from tblCondominio order by fechaAcceso DESC";
}
$_SESSION["SQL_SHOW"]=$sql;
$tmp_rs mysql_query($sql);
$num_total_registros mysql_num_rows($tmp_rs);
$TAMANO_PAGINA 5;
$pagina $_GET["pagina"];
if (!
$pagina) {
$inicio 0;
$pagina 1;
}
else {
$inicio = ($pagina 1) * $TAMANO_PAGINA;
}
$total_paginas ceil($num_total_registros $TAMANO_PAGINA);
$consulta $sql." LIMIT ".$inicio."," $TAMANO_PAGINA;
$reg mysql_query($consulta);
?>

<html>
<head>
<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>
</head>
<body>
<form action="default.php?op=1073" method="POST" >
<table width="700" align="center" border="1">
<tr>
<td colspan=6 align="center">Modificaci&oacute;n</td></tr>
<tr><td align=right>Codigo
<td align=left><input type="text" name="codigo"/></td></tr>
<tr>
<td colspan=6><center><input type="submit" name="busc" value="Buscar">
</center>
</table>
</form>
<table width="100%" align="center" border="1">
<tr><td width="62" align=center>TIPO</td>
<td width="70" align=center>CODIGO</td>
<td width="340" align=center>NOMBRE</td>
<td width="40" align=right>DOCUMENTOS</td>
<td width="40" align=center>OBSERVACIONES</td>
<td width="30" align=center>OPCIONES</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="62" align=center>
<?php if($res['tipo']==2){?>casa
<?php }
elseif(
$res['tipo']==1){?>

departamento
<?php }
?>
</td>

<td width="70" align=center><?php echo $res['codigo'];?></td>
<td width="340" align=justify><?php echo $res['nombre'];?></td>
<td width="40" align=center>
<a href="recaudacion/data2/documents2/<?php echo $res['documentosReg'];?>" target="_blank"><?php echo $res['documentosReg'];?></a></h6></td>
<td width="40"><?php echo $res['observaciones'];?></td>
<td width="30"><a href="editar.php?num=<?php echo $res[2];?>"><strong>Editar</strong></a></td></tr>
<?php
$i
=$i+1;
}
?>

</table>
<table width="100%" align="center">
<tr>
<td width="8"></td>
<td width="474" align="left" ><h3>
<?php
if ($total_paginas 1) {
if (
$pagina != 1)
echo 
'<a href="'.$url.'?pagina='.($pagina-1).'" class="Estilo1" >Anterior < </a>';
for (
$i=1;$i<=$total_paginas;$i++) {
if (
$pagina == $i)
echo 
$pagina;
else
echo 
' <a href="'.$url.'?pagina='.$i.'" class="Estilo1">'.$i.'</a> ';
}
if (
$pagina != $total_paginas)
echo 
'<a href="'.$url.'?pagina='.($pagina+1).'" class="Estilo1"> >Siguiente </a>';
}
?>

</h3></td>
<td width="105"></td>
<td width="250" align="left"><strong>Total de Registros: <span class="Estilo4">
<?php
$cantidad 
"select count(codigo) from tblCondominio";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>

<?php echo $total_registros;?><br>
</span></strong><strong>Registros Encontrados: <span class="Estilo4">
<?php
$cantidad 
"select count(codigo) from tblCondominio where codigo='$num'";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>

<?php echo $total_registros;?></span></strong></td>
</tr>
</table>
</body>
</html>
#2
PHP / Descargar Excel en php
12 Diciembre 2015, 02:52 AM
Buenas estoy tratando de descargar a excel
pero necesito que a la hora de descargar se registre la fecha y se cambie el estado 5 al 6
de todos los registros que descargo


Código (php) [Seleccionar]



<?php

require_once('conexion.php');
    
header ("Cache-Control: no-cache, must-revalidate");  
    
header ("Pragma: no-cache");  
    
header ("Content-Type: application/vnd.ms-excel"); 
    
header ("Content-Disposition: attachment; filename=reporte.xls" );

$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";

$reg=mysql_query($sql,$cnx);
?>

<table width="100%"  align="center" cellspacing="0">
<tr><td colspan="12"  width="25" align=center><h5>TITULO</h5></td></tr>
<tr><td colspan="12" width="90" align=center><h5>TITULO </h5></td></tr>
<tr><td colspan="12" width="150" align=center><h5>TITULO PERIODO:</h5></td></tr>

</table>
<table width="100%"  BORDER=3  align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="FFFFFF">

<tr>
<td width="25" align=center valign="top" BGCOLOR="C1D4D6"><h5>Nª</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>DEPENDENCIA</h5></td>
<td width="85" align=center valign="top" BGCOLOR="C1D4D6"><b><h5>CODIGO</h5></b></td>
<td width="150" align=center valign="top" BGCOLOR="C1D4D6"><h5>N CUENTA</h5></td>
<td width="230" align=center valign="top" BGCOLOR="C1D4D6"><h5>NOMBRE</h5></td>
<td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>CODIGO RESLUCION</h5></td>
<td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>FECHA NOTIFICACION</h5></td>
<td width="450" align=center valign="top" BGCOLOR="C1D4D6"><h5>CAUSAL DE INGRESO DE RECAUDACION</h5></td>
<td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>TIPO MONTO A TRASLADAR</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>OBSERVACIONES</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>PERIODOS DE REVISION</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>MONTO A TRASLADAR</h5></td>
</tr>
<?php
$i
=0;
while(
$res=mysql_fetch_array($reg)){
?>

<td width="25" align=center><h5><?php echo $i+1;?></h5></td>
<td width="90"><h5>00<?php echo $res['icr_dependencia'];?></h5></td>
<td width="85" align=center><h5><?php echo $res['icr_codigo'];?></h5></td>
<td width="150"><h5><?php echo $res['icr_cuenta_bn'];?></h5></td>
<td width="230" align=justify><h6><?php echo $res['icr_nombre'];?></h6></td>
<td width="100" align=center><h5>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></h5></td>
<td width="100" align=center><h5><?php echo $res['icr_fecha_ri'];?></h5></td>
<td width="450" align=justify><h5><?php echo $res['icr_causal'];?></h5></td>

    <td width="90" align=center>
  <h5>
    <?php if($res["icr_traslado"]==1){?> Saldo Parcial
    <?php }elseif($res["icr_traslado"]==2){?> Saldo Total
    <?php }?>   
        </h5></td>
<td width="90" align=justify><h6><?php echo $res['icr_observaciones_a'];?></h6></td>

<td width="90" align=center>
<?php
date_default_timezone_set
('America/Lima');  
$calendario_meses = array( 
    
'January'=>'Enero'
    
'Febuary'=>'Febrero'
    
'March'=>'Marzo'
    
'April'=>'Abril'
    
'May'=>'Mayo'
    
'June'=>'Junio'
    
'July'=>'Julio'
    
'August'=>'Agosto'
    
'September'=>'Septiembre'
    
'October'=>'Octubre'
    
'November'=>'Noviembre'
    
'December'=>'Diciembre' 
);  

$data1 explode('-'$res['icr_fecha_revision1']);  
$fecha1 date('F \d\e\l Y'strtotime($data1[0] . '-' $data1[1])); 
$fecha1 strtr($fecha1$calendario_meses); 
  
echo 
$fecha1?>
  -

<?php
date_default_timezone_set
('America/Lima');   
$calendario_meses2 = array( 
    
'January'=>'Enero'
    
'Febuary'=>'Febrero'
    
'March'=>'Marzo'
    
'April'=>'Abril'
    
'May'=>'Mayo'
    
'June'=>'Junio'
    
'July'=>'Julio'
    
'August'=>'Agosto'
    
'September'=>'Septiembre'
    
'October'=>'Octubre'
    
'November'=>'Noviembre'
    
'December'=>'Diciembre' 
);  

$data2 explode('-'$res['icr_fecha_revision2']);  
$fecha2 date('F \d\e\l Y'strtotime($data2[0] . '-' $data2[1])); 
$fecha2 strtr($fecha2$calendario_meses2); 
echo 
$fecha2?>

</td>
<td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>
</tr>
    <?php
$i=$i+1;
}
?>

</table>
</body>
</html>
#3
Desarrollo Web / Script que solo salga una vez
9 Diciembre 2015, 00:40 AM
Hola como se puede hacer para que el script solo salga una vez


Código (php) [Seleccionar]

<script> 
function abrir() { 
open('alerta.php','','top=150,left=200,width=350,height=300,menubar=yes,scrollbars=yes,resizable=yes'); 

</script> 
<body onLoad="abrir()">
</body> 

#4
PHP / Mostar campo Fecha Vacio
8 Diciembre 2015, 03:12 AM
Hola tengo un campo que en ocasiones esta vacio

este me devuelve con fecha de diciembre del 1969
cuando debería aparecerme en blanco como puedo hacer que solo aparezca los que tienen fechas y los que están con campos vacíos en blanco

Código (php) [Seleccionar]

<?php
date_default_timezone_set
('America/Lima');  
  
$calendario_meses = array( 
    
'January'=>'Enero'
    
'Febuary'=>'Febrero'
    
'March'=>'Marzo'
    
'April'=>'Abril'
    
'May'=>'Mayo'
    
'June'=>'Junio'
    
'July'=>'Julio'
    
'August'=>'Agosto'
    
'September'=>'Septiembre'
    
'October'=>'Octubre'
    
'November'=>'Noviembre'
    
'December'=>'Diciembre' 
);  
  
$data explode('-'$res['icr_fecha_revision2']);  
$fecha date('F \d\e\l Y'strtotime($data[0] . '-' $data[1])); 
$fecha strtr($fecha$calendario_meses); 
  
echo 
$fecha;  
?>

#5
PHP / PHP Error enpaginado
6 Diciembre 2015, 23:39 PM
Hola
Estoy tratando de empaginar
Me empaginan normal
Por ejemplo me muestra 30 registros totales
y me empagina 10 por hoja hasta ahi normal

Pero a la hora de hacer la busqueda por fechas no me funciona la busqueda
es decir no me lista el resultado

Todo lo contrario me sigue mostranto todos los registros


Código (php) [Seleccionar]

<?php
require_once('conexion.php');

if (isset(
$_POST['busc'])){
$fecha_reporte=$_POST['fecha_reporte'];
$fecha_reporte2=$_POST['fecha_reporte2'];

$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte
and icr_fecha_ri<='
$fecha_reporte2' order by icr_fecha_ri ASC ";
}else{
$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
}
$reg=mysql_query($sql,$cnx);

?>



<?php
require_once('conexion.php');
$num_registros=mysql_num_rows($reg);
if(
$num_registros==0){
  echo 
"No existen registros";
  exit(
0);  
  }
$registros=5;
$pagina=$_GET['num'];
if(
is_numeric($pagina)){
  
$inicio=($pagina 1)*$registros;
  } 
else{
  
$inicio=0;
  }
$sql="select * from tbldocumentosicr order by icr_fecha_ri  limit $inicio,$registros";
$reg=mysql_query($sql,$cnx);
$paginas=ceil($num_registros/$registros); 
?>




<html>
<head>

<title>Listado</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <script type="text/javascript" src="jquery.quick.pagination.min.js"></script>
    <script type="text/javascript" src="jquery.quick.pagination.js"></script>
    <script type="text/javascript" src="calendar.js"></script>
    <script type="text/javascript" src="calendar-setup.js"></script>
    <script type="text/javascript" src="calendar-es.js"></script>
    <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>

<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: #000000;
   }
   body {
   }
a:link {
   color: #0058B0;
   text-decoration: none;
}
a:visited {
   text-decoration: none;
}
a:hover {
   text-decoration: none;
}
a:active {
   text-decoration: none;
}
.Estilo4 {color: #004080}
</style>


</head>
<body>
<form action="reportlima.php" method="POST" >

<table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER="1" width="33%" align="center" cellpadding="1" >
<tr>
   <td colspan=7 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>
</tr>
   
<tr>
<TD colspan=5 align=left><B>Fecha Notificacion RI</B></TD>
<TR>
   <TD colspan=4 align=right><B> Desde:</B></TD>
   <TD colspan=2 align=left> <input name="fecha_reporte" type="text" id="fecha_reporte" style="background-color:#FBF9D5"/>
   <button type="submit" id="button1">....</button>
   <script type="text/javascript">                Calendar.setup({
                                inputField    : "fecha_reporte",
                                button        : "button1",
                                align         : "center"
                              });
                               </script></TD>
</TR>

<TR>
   <TD colspan=4 align=right><B> Hasta:</B></TD>
   <TD colspan=2 align=left> <input type="text" name="fecha_reporte2" id="fecha_reporte2" style="background-color:#FBF9D5"/>
   <button type="submit" id="button2">....</button>
   <script type="text/javascript">                Calendar.setup({
                                inputField    : "fecha_reporte2",
                                button        : "button2",
                                align         : "center"
                              });
                               </script></TD>
</TR>

<TR>
    <TD colspan=7>
    <br/>
<center>   
   <input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
   <input type="button" name="reg" value="Regresar" style='width:100px; height:35px' onClick="history.back()">
</center>
</table>

</form>
<br></br>
<table width="100%"  align="center" cellspacing="0">
   <TD align=left><input type="submit" name="exporta" value="Exportar a Excel"  style='width:150px; height:35px'>

</TD>
</table>

<table width="100%"  BORDER=3  align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="F9FBFC">

<tr>
   <td BGCOLOR="C1D4D6" width="25" align=center><h5>Nª</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>DEPENDENCIA</h5></td>
   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>CODIGO</h5></b></td>
   <td BGCOLOR="C1D4D6" width="150" align=center><h5>N CUENTA</h5></td>
   <td BGCOLOR="C1D4D6" width="230" align=center><h5>NOMBRE</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>CODIGO RESLUCION</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA NOTIFICACION</h5></td>
   <td BGCOLOR="C1D4D6" width="330" align=center><h5>CAUSAL DE INGRESO</BR>DERECAUDACION</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>TIPO MONTO<BR> A TRASLADAR</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>OBSERVACIONES</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>MONTO A TRASLADAR</h5></td>
   <td BGCOLOR="C1D4D6" width="70" align=center><h5>ESTADO</h5></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="25" align=center><h5><?php echo $res[''];?></h5></td>
    <td width="90" align=center><h5>00<?php echo $res['icr_dependencia'];?></h5></td>
    <td width="85" align=center><h5><?php echo $res['icr_codigo'];?></h5></td>
    <td width="150" align=center><h5><?php echo $res['icr_cuenta_bn'];?></h5></td>
    <td width="230" align=justify><h6><?php echo $res['icr_nombre'];?></h6></td>
    <td width="100" align=center><h5>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></h5></td>
    <td width="100" align=center><h5><?php echo $res['icr_fecha_ri'];?></h5></td>
    <td width="330" align=justify><h5><?php echo $res['icr_causal'];?></h5></td>

    <td width="90" align=center>
     <h5>
       <?php if($res["icr_traslado"]==1){?>
       Saldo Parcial
       <?php }elseif($res["icr_traslado"]==2){?>
       Saldo Total
       <?php }?>   
      </h5></td>
     
<td width="90" align=justify><h6><?php echo $res['icr_observaciones_a'];?></h6></td>

<td width="90" align=justify><h6><?php echo $res[''];?></h6></td>


<td width="90" align=center>

<?php
    $data 
explode('-'$res['icr_fecha_revision1']);
    echo 
date('F \d\e\l Y'strtotime($data[0] . '-' $data[1])); ?>
-

<?php
    $data 
explode('-'$res['icr_fecha_revision2']);
    echo 
date('F \d\e\l Y'strtotime($data[0] . '-' $data[1])); ?>

   
</td>

   <td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>

   <td width="70" align=center>
    <h5>
      <?php if($res["icr_estado"]==5){?>Notificado con RI
      <?php }elseif($res["icr_estado"]==6){?>Reportado
      <?php }?>
      </h5></td>

</tr>
   <?php
   $i
=$i+1;
   }
   
?>

</table>

<tr>
<td align="center" bgcolor="#FFFFFF"><h3><strong>Total de Registros:
   <span class="Estilo4">
     <?php
$cantidad 
"select count(icr_num_accion) from tbldocumentosicr  where icr_estado='5'";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>

      <?php echo $total_registros;?> <br></span></strong><strong>Registros Encontrados: <span class="Estilo4">
      <?php
$cantidad 
"select count(icr_num_accion) from tbldocumentosicr where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2'";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>

      <?php echo $total_registros;?></span></strong></h3></td>
</tr>




<?php
if($pagina>1)
echo 
"<a href='reportlima.php?num=".($pagina -1)."' >Anterior</a> ";
for(
$cont=1;$cont<=$paginas;$cont++){
if(
$cont==$pagina)
 echo 
$cont ." ";
 else
 echo 
"<a href='reportlima.php?num=".$cont."' >$cont</a> ";
}
if(
$pagina<$paginas)
 echo 
"<a href='reportlima.php?num=".($pagina +1)."' >Siguiente</a> ";
 
?>

</body>
</html>

#6
PHP / PHP Cambiar idioma de fecha
6 Diciembre 2015, 23:31 PM
Hola a todos
Espero que me puedan ayudar
Tengo un campo en la bd Fecha que esta en cadena y le convertido como Fecha

Pero a la hora de Listarlo
Como yo quiero es por ejemplo Diciembre del 2015
Me sale en ingles December del 2015

Estoy tratando de hacerlo con un array pero no me funciona



Código (php) [Seleccionar]

<?php 
  
date_default_timezone_set
('America/Lima'); 
  
$calendario_meses = array(1=>"Enero",2=>"Febrero",3=>"Marzo",4=>"Abril",5=>"Mayo",6=>"Junio"
7=>"Julio",8=>"Agosto",9=>"Septiembre",10=>"Octubre"
11=>"Noviembre",12=>"Diciembre"); 
  
?>

 
// Esta es la manera como extraigo de la BD

<?php 
    $data 
explode('-'$res['icr_fecha_revision2']); 
    echo 
date('F \d\e\l Y'strtotime($data[0] . '-' $data[1])); ?>
 
</td>
#7
PHP / PHP Cambiar fecha cadena a date
2 Diciembre 2015, 02:15 AM
Buenas he encontrado un campo fecha pero esta en varchar  pero no puedo cambiarlo a date por que se perderían registros

Tengo que hacer un listado que me muestre ( Mes y Año )
Por ejemplo
con este formato Abril del 2015

podrían ayudarme como se puede convertir en mes y año de una cadena
las fechas estas guardadas así
Año-Mes-Dias
2015-12-24

Dejo comentado en donde se agrega el codigo
<!--- 
<td width="25" align=center><?php echo $res['icr_fecha_revision1'];?></td>

si lo hago de esta manera me  sale asi 2015-12-24
Pero lo que quiero es que salga Diciembre del 2015                                                                     
--->

Código (php) [Seleccionar]



<?php
require_once('conexion.php');

if (isset(
$_GET['busc'])){
$fecha_reporte=$_GET['fecha_reporte'];
$fecha_reporte2=$_GET['fecha_reporte2'];
$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2' order by icr_fecha_ri ASC";
}else{
$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
}
$reg=mysql_query($sql,$cnx);
?>

<html>
<head>
<title>Listado</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="calendar.js"></script>
    <script type="text/javascript" src="calendar-setup.js"></script>
    <script type="text/javascript" src="calendar-es.js"></script>
    <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>

<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>
</head>

<body>
<form action="reportlima.php" method="get" >

<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>Fecha Notificacion RI</B></TD>

<TR>
<TD align=right><B> Desde:</B></TD>
<TD align=left> <input type="text" name="fecha_reporte" id="fecha_reporte" style="background-color:#FBF9D5"/>
<button type="submit" id="button1">....</button>
<script type="text/javascript">          Calendar.setup({
              inputField    : "fecha_reporte",
              button        : "button1",
              align         : "center"
            });
                </script>
</TD></TR>

<TR>
<TD align=right><B> Hasta:</B></TD>
<TD align=left> <input type="text" name="fecha_reporte2" id="fecha_reporte2" style="background-color:#FBF9D5"/>

<button type="submit" id="button2">....</button>
<script type="text/javascript">          Calendar.setup({
              inputField    : "fecha_reporte2",
              button        : "button2",
              align         : "center"
            });
                </script>
</TD></TR>
  <TR>
   <TD colspan=6>
    <br/>

<center>   
<input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
<input type="button" name="reg" value="Regresar" style='width:100px; height:35px' onClick="history.back()"></center>

</table>
</form>
<br></br>
<table width="1450"  align="center" cellspacing="0">
<TD align=left><input type="submit" name="exporta" value="Exportar a Excel" style='width:150px; height:35px'></TD>

</table>
<table BGCOLOR="F9FBFC" BORDERCOLOR=""  BORDER=5 width="1450"  align="center" cellspacing="0">
<tr>
<td colspan=14 align="center" bgcolor="#FFFFFF"><h2><strong></strong></h2></td>
  </tr>
<tr>
   <td BGCOLOR="C1D4D6" width="25" align=center><h5>N &#176;</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>DEPENDENCIA</h5></td>
   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>RUC</h5></b></td>
   <td BGCOLOR="C1D4D6" width="150" align=center><h5>N CUENTA</h5></td>
   <td BGCOLOR="C1D4D6" width="230" align=center><h5>RAZON SOCIAL</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>CODIGO RESLUCION</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA NOTIFICACION</h5></td>
<td BGCOLOR="C1D4D6" width="330" align=center><h5>CAUSAL DE INGRESO</BR>DERECAUDACION</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>TIPO MONTO<BR> A TRASLADAR</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>OBSERVACIONES</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>MONTO A TRASLADAR</h5></td>
   <td BGCOLOR="C1D4D6" width="70" align=center><h5>ESTADO</h5></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="25" align=center><?php echo $res[''];?></td>
    <td width="90" align=center>00<?php echo $res['icr_dependencia'];?></td>
    <td width="85" align=center><?php echo $res['icr_ruc'];?></td>
    <td width="150" align=center><?php echo $res['icr_cuenta_bn'];?></td>
    <td width="230" align=justify><?php echo $res['icr_contribuyente'];?></td>
    <td width="100" align=center>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></td>
    <td width="100" align=center><?php echo $res['icr_fecha_ri'];?></td>
    <td width="330" align=justify><?php echo $res['icr_causal'];?></td>
    <td width="90" align=center>
<?php if($res["icr_traslado"]==1){?>Saldo Parcial
<?php }elseif($res["icr_traslado"]==2){?>Saldo Total
<?php }?> </td>
<td width="90" align=justify><?php echo $res[''];?></td>



<!---  AQUI ES DONDE SE DEBE AGREGAR EL CODIGO

<td width="25" align=center><?php echo $res['icr_fecha_revision1'];?></td>

si lo hago de esta manera me  sale asi 2015-12-24
Pero lo que quiero es que salga Diciembre del 2015
--->

<td width="90" align=center><?php echo $res['icr_monto_icr'];?></td>

  <td width="70" align=center>
<?php if($res["icr_estado"]==1){?>Registrado
<?php }elseif($res["icr_estado"]==2){?>Con Comunicaci&oacute;n
<?php }elseif($res["icr_estado"]==3){?>Notificaci&#243n Comunicaci&#243n
<?php }elseif($res["icr_estado"]==4){?>Con Resoluci&oacute;n
<?php }elseif($res["icr_estado"]==5){?>Notificado con RI
<?php }elseif($res["icr_estado"]==6){?>Reportado
<?php }?>
</td>

</tr>
<?php
$i
=$i+1;
}
?>

</table>
</body>

</html>





#8
PHP / Calcular días hábiles en PHP
28 Noviembre 2015, 17:53 PM
Buenas espero que me puedan ayudar
estoy queriendo sumar 10 días hábiles (Lunes a Viernes) y sin contar feriados
a partir de una fecha
Lo que hecho es sumarle 10 días pero no quiero que cuente los sábados ni domingos y tampoco los feriados

Por ejemplo estos son algunos feriados

2015-12-08     2015-12-25     2016-01-01    


Código (php) [Seleccionar]
<?php

require_once('conexion.php');

$num_accion=$_POST['num_accion'];
$fecha_noti=$_POST['fecha_noti'];

$fecha_venci_notidate("Y-m-d"strtotime("$fecha_noti + 10 days"));

$sql="update tbldias set 

dc_fecha_noti='"
.$fecha_noti."',
dc_fecha_venci_noti='"
.$fecha_venci_noti."' 

where dc_num_accion="
.$num_accion;

$res=mysql_query($sql,$cnx);

?>


Mod: Obligatorio el uso de etiquetas GeSHi.