forked from pasosdeJesus/SIVeL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buscaRepetidos.php
61 lines (53 loc) · 1.99 KB
/
buscaRepetidos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
// vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker fileencoding=utf-8:
/**
* Busca datos repetidos
*
* PHP version 5
*
* @category SIVeL
* @package SIVeL
* @author Vladimir Támara <[email protected]>
* @copyright 2010 Dominio público. Sin garantías.
* @license https://www.pasosdejesus.org/dominio_publico_colombia.html Dominio Público. Sin garantías.
* @version CVS: $Id: buscaRepetidos.php,v 1.13.2.2 2011/10/13 13:41:06 vtamara Exp $
* @link http://sivel.sf.net
*/
require_once "aut.php";
require_once $_SESSION['dirsitio'] . '/conf.php';
require_once "confv.php";
require_once "misc.php";
$aut_usuario = "";
$db = autenticaUsuario($dsn, $accno, $aut_usuario, 65);
echo '<table width="100%">'
. '<td style="white-space: nowrap; background-color: #CCCCCC;" '
. 'align="left" valign="top" colspan="2"><b>'
. '<div align=center>Reporte de casos repetidos ' . date('Y-m-d H:m') .
'</div></b></td></table><p/>';
$res =& hace_consulta(
$db, "SELECT c1.id, trim(c1.memo), count(c1.id) as num " .
" FROM caso c1 JOIN caso c2 ON c1.memo=c2.memo " .
" GROUP BY c1.id, c1.memo having count(c2.memo) > 1 " .
" ORDER BY c1.memo, c1.id"
);
echo "<table width='100%' border='1'><tr>" .
"<th width='50%'>Memo</th><th>Casos</th></tr>";
$reg = array();
while ($res->fetchInto($reg)) {
echo "<tr><td>" . htmlentities($reg[1]) . "</td><td>" .
"<a href='captura_caso.php?id=" . urlencode($reg[0]) .
"'>" . htmlentities($reg[0]) . "</a> ";
for ($i = 1; $i < $reg[2]; $i++) {
$reg2 =& $res->fetchRow();
echo "<a href='captura_caso.php?id=" . urlencode($reg2[0]) .
"'>" . htmlentities($reg2[0]) . "</a> ";
}
echo "</td></tr>\n";
}
echo "</table>";
echo "<p/>";
echo '<table width="100%">'
. '<td style="white-space: nowrap; background-color: #CCCCCC;" '
. 'align="left" valign="top" colspan="2"><b><div align=right>'
. '<a href="index.php">Menú Principal</a></div></b></td></table>';
?>