Skip to content

Instantly share code, notes, and snippets.

@ojgarciab
Forked from ChrisGehm/control.php
Last active October 16, 2015 06:29
Show Gist options
  • Save ojgarciab/51eb8af72085bd34d171 to your computer and use it in GitHub Desktop.
Save ojgarciab/51eb8af72085bd34d171 to your computer and use it in GitHub Desktop.
<?php
require_once 'config.php';
$diferencia_mes = " ";
$estado = " ";
$mes_actual = " ";
$mes_actual = date("m");
$año_actual = date("Y");
//lista completa
$busqueda = mysql_query("SELECT anio, mes, estado, Id_Cliente AS cliente
FROM estado_tarea et
WHERE (et.estado = ' ' AND et.mes <= '".$mes_actual."') OR (et.estado = 'No' AND et.mes < '".$mes_actual."') OR (et.estado = 'Si' AND et.mes = '".$mes_actual."') OR (et.estado = 'No Aplica' AND et.mes = '".$mes_actual."')
GROUP BY c.Denominacion");
if ($busqueda === false) {
die('Error consultando la base de datos: ' . mysql_error());
}
$tablerodecomando = "seminario/seguimiento/tablero-de-comando.php?id=";
?>
<table class="sortable" width="85%" border="1" id="a">
<tr>
<td style="background-color:#590556; color:#FFF; text-align:center; font-size:10px;">Cliente</td>
<td style="background-color:#590556; color:#FFF; text-align:center; font-size:10px;">Estado</td>
<td class="titulostablas"></td>
</tr>
<?php
while($f=mysql_fetch_array($busqueda))
{
$diferencia_mes = $mes_actual - $f['mes'];
echo "<br>Mes: ".$f['mes']." | Diferencia mes: ".$diferencia_mes." | Estado: ".$f['estado'];
if (($f['estado'] == 'No Aplica' OR $f['estado'] == 'Si') AND ($diferencia_mes == 1 OR $diferencia_mes == 0 OR $diferencia_mes == 2))
{
$estado = "Sin Atraso";
}
if ($f['estado'] == ' ' AND ($diferencia_mes == 1 OR $diferencia_mes == 0))
{
$estado = "Sin Atraso";
}
if ($f['estado'] == 'No' OR $f['estado'] == NULL OR $f['estado'] == ' ' )
{
//if ($diferencia_mes == 3 OR $diferencia_mes == 4 OR $diferencia_mes == 0)
if ($diferencia_mes == 2 OR $diferencia_mes == 3)
{
$estado = "Atrasado";
}
if ($diferencia_mes == 4 OR $diferencia_mes > 4)
{
$estado = "3 o m&aacute;s meses atrasados";
}
}
if ($f['estado'] == 'Si' AND $diferencia_mes == 0)
{
$estado = "Sin Atraso";
}
echo '<td height="22" style="font-size:10px; text-align:center;" >'.$f['cliente'].'</td>';
echo '<td style="font-size:10px;">'.$estado.'</td>';
echo '<td style="font-size:10px; text-align:center;"><a href="/'.$borrar.''.$f['IDCliente'].'" onclick="return confirmar()">Borrar</a></td>';
echo '</tr>';
}
?>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment