function EscaneaListado($ide) { $filtro = $ide; if ($ide == '') { $ide = 'LNE'; } else { if ($ide == 'LT') { $where = ""; } else { if ($ide != 'LNE') { //No escogio Listar por no escaneados $where = " WHERE estados.id_estado='" . $ide . "' "; } } } if ($ide == 'LNE') { /* QUERY ESCANEADOS $sql = "SELECT * FROM documentos AS d Inner Join remitentes AS r ON r.id_remitente = d.id_remitente Inner Join estados AS e ON d.id_estado = e.id_estado Inner Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento Inner Join documentos_escaneados ON documentos_escaneados.id_documento = d.id_documento group by d.id_documento ORDER BY d.id_documento DESC"; $sql = "SELECT * FROM documentos AS d Inner Join remitentes AS r ON r.id_remitente = d.id_remitente Inner Join estados AS e ON d.id_estado = e.id_estado Inner Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento WHERE d.id_documento NOT IN (SELECT distinct id_documento from documentos_escaneados) AND d.id_estado <> 12 AND d.id_estado <> 11 group by d.id_documento ORDER BY d.id_documento DESC"; */ $dia_hoy = date('Y-m-d'); $sql = "SELECT *\r\n\t\t\t\tFROM\r\n\t\t\t\tdocumentos AS d\r\n\t\t\t\tInner Join remitentes AS r ON r.id_remitente = d.id_remitente\r\n\t\t\t\tInner Join estados AS e ON d.id_estado = e.id_estado\r\n\t\t\t\tInner Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento\r\n\t\t\t\tWHERE\r\n\r\nd.fecha_registro_documento>='" . $dia_hoy . "' \r\n\r\n\t\t\t\tAND d.id_estado <> 12 AND d.id_estado <> 11 \r\nand\r\n\t\t\t\td.id_documento NOT IN \r\n\t\t\t\t(SELECT id_documento from documentos_escaneados where fecha_escaneo >='" . $dia_hoy . "' group by id_documento)\r\n\t\t\t\tgroup by d.id_documento\r\n\t\t\t\tORDER BY d.id_documento DESC"; } else { $sql = "SELECT * FROM documentos\r\n\t\t\t\tInner Join remitentes ON remitentes.id_remitente = documentos.id_remitente\r\n\t\t\t\tInner Join estados ON estados.id_estado = documentos.id_estado\r\n\t\t\t\tInner Join tipos_documento ON tipos_documento.id_tipo_documento = \t\t\t\t\r\n\t\t\t\tdocumentos.id_tipo_documento \t\r\n\t\t\t\t" . $where . "\t\r\n\t\t\t\tORDER BY documentos.id_documento DESC"; } $query = new Consulta($sql); ?> <div class="ui-jqgrid ui-widget ui-widget-content ui-corner-all"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="tabla_despacho" class="gview_frmgrid"> <tr> <td> <table width="100%" class="ui-jqgrid-htable" cellpadding="0" cellspacing="0"> <tr bgcolor="#6699CC" class="ui-widget-header ui-th-column grid_resize" height="25"> <th width="16%" class="ui-widget-header ui-th-column grid_resize">Reg. Nro</th> <th width="26%" class="ui-widget-header ui-th-column grid_resize">Remitente</th> <th width="28%" class="ui-widget-header ui-th-column grid_resize">Documento</th> <th width="13%" class="ui-widget-header ui-th-column grid_resize">Registrado</th> <th width="6%" class="ui-widget-header ui-th-column grid_resize">Estado</th> <th class="ui-widget-header ui-th-column grid_resize">Ubicacion Original</th> </tr> </table> </td> </tr> <tr class="ui-jqgrid-bdiv"> <td> <table id="frmgrid" width="100%" class="ui-jqgrid-btable" cellpadding="0" cellspacing="0"> <?php while ($row_reg = $query->ConsultaVerRegistro()) { $id = $row_reg[0]; $estado = $row_reg["id_estado"]; $tooltip = ""; $tieneRegArchivo = Escaneos::TieneRegistroArchivo($id); if (!empty($row_reg['asunto_documento'])) { $tooltip = "title ='" . $row_reg['asunto_documento'] . "' class='tip'"; } if ($tieneRegArchivo && $filtro == '') { //No se lista, no hace nada } else { ?> <tr class="ui-widget-content1 jqgrow <?php echo $estado == 12 ? "Estilo2 fila_finalizada" : "Estilo2"; ?> "> <td <?php echo $tooltip; ?> width="16%"> <div align="center"> <?php $cod = $row_reg[1]; if ($estado != 12 && $estado != 11) { ?> <a href="escaneo_acceso_registro.php?opcion=edit&id=<?php echo $id; ?> "> <?php echo $cod; ?> </a> <?php } else { echo $cod; } ?> </div> </td> <td width="26%"><input size="50" value="<?php echo $row_reg["nombre_remitente"]; ?> "/></td> <td width="28%"><input size="45" value="<?php echo $row_reg["numero_documento"]; ?> "/></td> <td width="13%"> <div align="center"> <input type="text" style="text-align:center; width:100%" value="<?php echo date('d/m/Y H:i', strtotime($row_reg['fecha_registro_documento'])); ?> " size="3"/> </div> </td> <td align="center" width="6%"> <div align="center"> <input type="text" style="text-align:center; width:100%" value="<?php echo $row_reg['abrev_nombre_estado']; ?> " size="3"/> </div> </td> <?php $sql_ultimo = " SELECT Max(`hd`.`id_historial_documento`) AS `ultimo`\r\n\t\t\t\t\t\tFROM `historial_documentos` AS `hd`\r\n\t\t\t\t\t\tWHERE hd.id_documento='" . $row_reg['id_documento'] . "'\r\n\t\t\t\t\t\tGROUP BY `hd`.`id_documento`"; $query_ultimo = new Consulta($sql_ultimo); $ultimo = $query_ultimo->ConsultaVerRegistro(); $sql_data = " SELECT hd.id_documento,a.nombre_area, a.abve_nombre_area FROM historial_documentos AS hd \r\n \t\tInner Join areas AS a ON a.id_area = hd.id_area\r\n \t\twhere hd.id_historial_documento='" . $ultimo['ultimo'] . "'"; $query_data = new Consulta($sql_data); $data = $query_data->ConsultaVerRegistro(); $sql_usu = "SELECT Max(`ha`.`id_historial_atencion`) AS `ultimo`, `ha`.`id_documento`\r\n \t\t\t\tFROM\r\n \t\t\t\t`historial_atencion` AS `ha`\r\n \t\t\t\tWHERE\r\n ha.original_historial_atencion = '1' and\r\n \t\t\t\tha.id_documento='" . $row_reg['id_documento'] . "'\r\n \t\t\t\tGROUP BY\r\n \t\t\t\t`ha`.`id_documento`\t"; $query_usu = new Consulta($sql_usu); $usu = $query_usu->ConsultaVerRegistro(); $susu = "SELECT `u`.`login_usuario`, `a`.`abve_nombre_area`\r\n \t\t\tFROM\r\n \t\t\t`historial_atencion` AS `ha`\r\n\t\t\t\tInner Join `usuarios` AS `u` ON `u`.`id_usuario` = `ha`.`id_usuario_destino`\r\n\t\t\t\tInner Join `areas` AS `a` ON `a`.`id_area` = `u`.`id_area`\r\n\t\t\t\tWHERE\r\n\t\t\t\t`ha`.`id_historial_atencion` = '" . $usu['ultimo'] . "' "; $qusu = new Consulta($susu); $u = $qusu->ConsultaVerRegistro(); ?> <td> <div align="center"> <?php $documento = new Documento($row_reg['id_documento']); ?> <input name="text4" type="text" value="<?php echo $documento->UltimaUbicacionReporte(); ?> " /> </div> </td> </tr> <?php } } ?> </table> </td> </tr> </table> </div> <?php }
Plantilla::PlantillaIzquierdo(); ?> </td> <td> <table class="contenido" cellpadding="0" cellspacing="0" width="100%" align="left"> <tr> <td><?php Plantilla::menuSuperior("areas_acceso_registro.php", $menu, $_GET['id'], false); ?> </td> </tr> <tr> <td style="width:100%; height:417px"> <?php $escaneos = new Escaneos(); $campo = $_REQUEST['campo']; $valor = $_REQUEST['valor']; switch ($_GET['opcion']) { case 'add': $escaneos->EscaneaGuardar(); $escaneos->EscaneaEditar($_GET['id']); break; case 'edit': $escaneos->EscaneaEditar($_GET['id']); break; case 'detalle': $documento = new Documento($_GET['id']); $docs->detalleDocumentosPorUsuario($usuario, $documento); break; case 'addha':