function Documento_Reporte($id_documento_reporte) { $this->_id = $id_documento_reporte; if ($this->_id > 0) { $sql = "SELECT \r\n id_documento,\r\n numero_registro,\r\n numero_documento,\r\n remitente,\r\n asunto,\r\n tipo,\r\n folio,\r\n referencia,\r\n anexo,\r\n observacion,\r\n prioridad,\r\n fecha_documento,\r\n fecha_registro,\r\n IF( p.tiempo_horas_respuesta_prioridad, \r\n ADDDATE(dr.fecha_registro, \r\n p.tiempo_horas_respuesta_prioridad/24 )\r\n , '-') AS fecha_respuesta,\r\n estado\r\n FROM documentos_reporte dr\r\n LEFT JOIN prioridades as p ON p.nombre_prioridad = dr.prioridad\r\n WHERE id_documento_reporte = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_id_documento = $row['id_documento']; $this->_codigo = $row['numero_registro']; $this->_numero = $row['numero_documento']; $this->_remitente = $row['remitente']; $this->_asunto = $row['asunto']; $this->_tipo = $row['tipo']; $this->_numero_folio = $row['folio']; $this->_referencia = $row['referencia']; $this->_anexo = $row['anexo']; $this->_observacion = $row['observacion']; $this->_prioridad = $row['prioridad']; $this->_fecha_documento = $row['fecha_documento']; $this->_fecha_registro = $row['fecha_registro']; $this->_fecha_respuesta = $row['fecha_respuesta']; $this->_estado = $row['estado']; $sql_movimientos = "SELECT * \r\n\t\t\t\t \t\t\t\t\tFROM movimientos \r\n\t\t\t\t\t\t\t\t\tWHERE id_documento_reporte = '" . $this->_id . "' \r\n\t\t\t\t\t\t\t\t\tORDER BY fecha_movimiento"; $query_movimientos = new Consulta($sql_movimientos); while ($rowh = $query_movimientos->VerRegistro()) { $this->_movimientos[] = array('id' => $rowh['id_documento_reporte'], 'origen' => $rowh['origen'], 'destino' => $rowh['destino'], 'accion' => $rowh['accion'], 'categoria' => $rowh['categoria'], 'usuario' => $rowh['usuario'], 'observacion' => $rowh['observacion'], 'fecha' => date('d/m/Y H:i', strtotime($rowh['fecha_movimiento'])), 'estado' => $rowh['estado'], 'tipo' => $rowh['tipo']); } } } }
function Estado($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM estados WHERE id_estado = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_estado']; $this->_abreviatura = $row['abrev_nombre_estado']; } } }
function Anp($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM areaspro_dbsiganp1.anp WHERE id_anp = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_anp']; $this->_siglas = $row['siglas_anp']; } } }
function TipoDocumento($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM tipos_documento WHERE id_tipo_documento = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_tipo_documento']; $this->_abreviatura = $row['abreviatura_tipo_documento']; } } }
function Rol($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM rol WHERE id_rol = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_rol']; $this->_rol = new Rol($row['orden_rol']); } } }
function Pagina($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM paginas WHERE id_pagina = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_pagina']; $this->_url = $row['url_pagina']; } } }
function Area($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM areas WHERE id_area = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_area']; $this->_responsable = $row['id_responsable_area']; $this->_abreviatura = $row['abve_nombre_area']; } } }
function Remitente($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM remitentes WHERE id_remitente = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_remitente']; $this->_abreviatura = $row['abreviatura_remitente']; $this->_tipo = $row['tipo_remitente']; } } }
function Prioridad($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM prioridades WHERE id_prioridad = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_prioridad']; $this->_tiempo_horas_respuesta = $row['tiempo_horas_respuesta_prioridad']; $this->_color = $row['color_prioridad']; } } }
function Accion($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM accion WHERE id_accion = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_nombre = $row['nombre_accion']; $this->_abreviatura = $row['abreviatura_accion']; $this->_descripcion = $row['descripcion_accion']; $this->_estado = $row['estado_accion']; } } }
function DocumentoFinalizado($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT * FROM documento_finalizado WHERE id_documento_finalizado = '" . $this->_id . "'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_codigo = $row['codigo_documento_finalizado']; $this->_id_documento = $row['id_documento']; $this->_tipo = new TipoDocumento($row['id_tipo_documento']); $this->_asunto = $row['asunto']; $this->_fecha_finalizado = $row['fecha_registro_documento']; $this->_usuario = $row['usuario']; } } }
function Borrador($id = 0) { $this->_id = $id; if ($this->_id > 0) { $sql = "SELECT\r\n b.id_borrador_respuesta AS id,\r\n b.id_documento AS id_documento,\r\n b.id_usuario AS id_usuario,\r\n b.descripcion_borrador_respuesta AS descripcion,\r\n b.fecha_borrador_respuesta AS fecha,\r\n b.categoria AS categoria,\r\n b.id_accion AS id_accion,\r\n b.id_area AS id_area,\r\n b.id_destino AS id_destino,\r\n b.aprobacion_respuesta_borrador AS aprobacion\r\n FROM\r\n borradores_respuesta AS b\r\n WHERE\r\n b.id_borrador_respuesta = '{$this->_id}'"; $query = new Consulta($sql); if ($query->NumeroRegistros()) { $row = $query->VerRegistro(); $this->_id_documento = $row['id_documento']; $this->_id_usuario = $row['id_usuario']; $this->_decripcion = $row['descripcion']; $this->_fecha = $row['fecha']; $this->_categoria = $row['categoria']; $this->_id_accion = $row['id_accion']; $this->_id_area = $row['id_area']; $this->_id_destino = $row['id_destino']; $this->_aprobacion = $row['aprobacion']; } } }
function TieneRegistroArchivo($id_documento) { $sql = "SELECT\r\n\t\t\tda.id_documento_archivo\r\n\t\t\tFROM\r\n\t\t\tarch_documento_archivo AS da\r\n\t\t\tWHERE\r\n\t\t\tda.id_documento = '{$id_documento}'"; $query = new Consulta($sql); if ($query->NumeroRegistros() > 0) { return true; } else { return false; } }
function copiaArchivadaUsuario() { $sql_arch = "SELECT\r\n\t\t\t\t\t a.id_documento\r\n\t\t\t\t\t FROM\r\n\t\t\t\t\t archivo_copia AS a\r\n\t\t\t\t\t WHERE\r\n\t\t\t\t\t a.id_documento = " . $this->_id . " AND\r\n\t\t\t\t\t a.id_area_duenia = " . $_SESSION['session'][5] . " AND\r\n\t\t\t\t\t a.id_usuario_duenio = " . $_SESSION['session'][0]; $query_arch = new Consulta($sql_arch); if ($query_arch->NumeroRegistros() > 0) { return true; } return false; }
function AccionesDetalle($ida) { $sql_areas = "Select * from categoria where display = 1 order by descripcion"; $query_areas = new Consulta($sql_areas); ?> <form id="form_detalle_accion" name="form_detalle_accion" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?opcion=addDetailAccion&id=<?php echo $ida; ?> "> <table width="55%" height="80" border="1" align="center"> <tr bgcolor="#6699CC"> <td width="90%"><div align="center">Nombre Categoria </div></td> <td><div align="center">Activar</div></td> </tr> <?php while ($row_areas = $query_areas->ConsultaVerRegistro()) { $id = $row_areas["id_categoria"]; ?> <tr> <td><div align="left"> <?php echo $row_areas["descripcion"]; ?> </div></td> <td width="93"><div align="center"> <?php $sql_a_a = "select *\r\n from accion_categoria\r\n where id_accion = {$ida}\r\n and id_categoria = {$id}"; $query_a_a = new Consulta($sql_a_a); $n = $query_a_a->NumeroRegistros(); ?> <input type="checkbox" name="opcion[]" value="<?php echo $id; ?> " <?php if ($n == 1) { echo "checked = checked"; } ?> /> </div></td> </tr> <?php } ?> <tr> <td height="23" colspan="3"><div align="center"> <input type="submit" name="guardar" value="Guardar" class="boton" /> <input class="boton" type="reset" name="cancelar" value="Cancelar" onclick="javascript:window.history.go(-1)"/> </div></td> </tr> </table> </form> <?php }
function UsuariosAdd() { if (!$_POST) { echo "<div id=error>ERROR: No se pudo Agregar Usuario por falta de datos </div>"; } else { if (!$_POST['lectura']) { $_POST['lectura'] = "NO"; } if (!$_POST['escritura']) { $_POST['escritura'] = "NO"; } $sq = new Consulta("SELECT * FROM usuarios WHERE nombre_usuario='" . $_POST['nombre'] . "' AND apellidos_usuario='" . $_POST['apellidos'] . "' AND email_usuario='" . $_POST['email'] . "' AND estado_usuario = 1"); $sq_bu = new Consulta("SELECT * FROM usuarios WHERE login_usuario='" . $_POST['usuario'] . "' AND estado_usuario = 1"); if ($sq->NumeroRegistros() == 0) { $sql = "INSERT INTO usuarios \r\n\t\t\t\tVALUES( '',\r\n\t\t\t\t'" . $_POST['rol'] . "',\r\n\t\t\t\t'" . $_POST['area'] . "',\r\n\t\t\t\t'" . $_POST['nombre'] . "' ,\r\n\t\t\t\t'" . $_POST['apellidos'] . "',\r\n \t'" . $_POST['iniciales'] . "',\r\n \t'" . $_POST['cargo'] . "',\r\n\t\t\t\t'" . $_POST['email'] . "',\r\n\t\t\t\t'" . $_POST['usuario'] . "',\r\n\t\t\t\t'" . $_POST['password'] . "',\r\n\t\t\t\t'" . date('Y-m-d') . "',\r\n\t\t\t\t'" . $_POST['lectura'] . "',\r\n\t\t\t\t'" . $_POST['escritura'] . "',\r\n\t\t\t\t'" . $_POST['anp'] . "',\r\n\t\t\t\t'1') "; $Query = new Consulta($sql); $nuevo_usu = $Query->NuevoId(); if ($Query->RespuestaConsulta()) { $sql = "INSERT INTO arch_usuarios\r\n\t\t\t\t\t\t\t(id_usuario,id_estado_usuario)\r\n\t\t\t\t\t\t\tVALUES ('" . $nuevo_usu . "','1')"; $Query = new Consulta($sql); } if ($_POST['rol'] == 6 || $_POST['rol'] == 4) { $sql_r = "INSERT into usuarios_paginas\r\n\t\t\t\t\t\t\t VALUES ('" . $nuevo_usu . "','7')"; $query_r = new Consulta($sql_r); } echo "<div id=error> Se Ingreso el Nuevo Usuario Correctamente </div>"; } else { if ($sq_bu->NumeroRegistros()) { ?> <script> alert(" El usuario ya existe, por favor ingrese otro nombre de usuario "); location.replace("usuarios.php?opcion=new") </script> <?php } else { echo "<div id=error> ERROR: no se puedo ingresar el usuario </div>"; } } } }
function RegistraListado($ide) { if ($ide == '') { //if($_SESSION['session'][6]){ //$where = "WHERE (d.id_estado = '3' OR d.id_estado = '13' OR d.id_estado = '12' OR d.id_estado = '11')"; //}else{ $where = "WHERE\r\n\t\t\t\t(((d.id_estado = '4' OR d.id_estado = '12' OR d.id_estado = '11' \r\n\t\t\t\tOR d.id_estado = '6' OR d.id_estado = '16' OR d.id_estado = '17' \r\n\t\t\t\tOR d.id_estado = '18' OR d.id_estado = '3' OR d.id_estado = '13' \r\n\t\t\t\tOR d.id_estado = '12')"; //} $sql_reg = "SELECT\r\n\t\t\t\thd.id_documento as id,\r\n\t\t\t\td.fecha_registro_documento as fecha,\r\n\t\t\t\td.asunto_documento as asunto,\r\n\t\t\t\td.codigo_documento as codigo,\r\n\t\t\t\ttd.nombre_tipo_documento as tipo,\r\n\t\t\t\tr.nombre_remitente as remitente,\r\n\t\t\t\thd.original_historial_documento as categoria,\r\n\t\t\t\td.numero_documento as numero,\r\n\t\t\t\td.id_estado as id_estado,\r\n\t\t\t\te.abrev_nombre_estado as estado\r\n\t\t\t\tFROM\r\n\t\t\t\thistorial_documentos AS hd\r\n\t\t\t\tInner Join documentos AS d ON d.id_documento = hd.id_documento\r\n\t\t\t\tInner Join estados AS e ON e.id_estado = d.id_estado\r\n\t\t\t\tLEFT Join remitentes AS r ON r.id_remitente = d.id_remitente\r\n\t\t\t\tLEFT Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento\r\n\t\t\t\t{$where}\r\n\t\t\t\tAND hd.original_historial_documento = 1) OR hd.original_historial_documento = 2 )\r\n\t\t\t\tAND hd.id_area = '" . $_SESSION['session'][5] . "'\r\n\t\t\t\tUNION\r\n\t\t\t\tSELECT\r\n\t\t\t\tha.id_documento as id,\r\n\t\t\t\td.fecha_registro_documento as fecha,\r\n\t\t\t\td.asunto_documento as asunto,\r\n\t\t\t\td.codigo_documento as codigo,\r\n\t\t\t\ttd.nombre_tipo_documento as tipo,\r\n\t\t\t\tr.nombre_remitente as remitente,\r\n\t\t\t\tha.original_historial_atencion as categoria,\r\n\t\t\t\td.numero_documento as numero,\r\n\t\t\t\td.id_estado as id_estado,\r\n\t\t\t\te.abrev_nombre_estado as estado\t\r\n\t\t\t\tFROM\r\n\t\t\t\thistorial_atencion AS ha\r\n\t\t\t\tInner Join documentos AS d ON ha.id_documento = d.id_documento\r\n\t\t\t\tInner Join estados AS e ON d.id_estado = e.id_estado\r\n\t\t\t\tLEFT Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento\r\n\t\t\t\tLEFT Join remitentes AS r ON d.id_remitente = r.id_remitente\r\n\t\t\t\t{$where}\r\n\t\t\t\tAND ha.original_historial_atencion = 1) OR ha.original_historial_atencion = 2 )\r\n AND(\r\n\t\t\t\t(ha.id_area = '" . $_SESSION['session'][5] . "' AND ha.tipo_historial_atencion=0) OR\r\n\t\t\t\t(ha.id_area_destino = '" . $_SESSION['session'][5] . "' AND ha.tipo_historial_atencion=1) OR\r\n (ha.id_area_destino = '" . $_SESSION['session'][5] . "' AND ha.tipo_historial_atencion=2)\r\n\t\t\t\t)\r\n\t\t\t\tORDER BY 1 DESC, 7 ASC"; $query_reg = new Consulta($sql_reg); } else { if ($ide == "LT") { $where = ""; } else { $where = "AND d.id_estado = {$ide} "; } $sql_reg = "SELECT\r\n\t\t\t\thd.id_documento as id,\r\n\t\t\t\td.fecha_registro_documento as fecha,\r\n\t\t\t\td.asunto_documento as asunto,\r\n\t\t\t\td.codigo_documento as codigo,\r\n\t\t\t\ttd.nombre_tipo_documento as tipo,\r\n\t\t\t\tr.nombre_remitente as remitente,\r\n\t\t\t\thd.original_historial_documento as categoria,\r\n\t\t\t\td.numero_documento as numero,\r\n\t\t\t\td.id_estado as id_estado,\r\n\t\t\t\te.abrev_nombre_estado as estado\r\n\t\t\t\tFROM\r\n\t\t\t\thistorial_documentos AS hd\r\n\t\t\t\tInner Join documentos AS d ON d.id_documento = hd.id_documento\r\n\t\t\t\tInner Join estados AS e ON e.id_estado = d.id_estado\r\n\t\t\t\tLEFT Join remitentes AS r ON r.id_remitente = d.id_remitente\r\n\t\t\t\tLEFT Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento\r\n\t\t\t\tWHERE \r\n\t\t\t\thd.id_area = '" . $_SESSION['session'][5] . "' \r\n\t\t\t\t" . $where . "\r\n\t\t\t\tUNION\r\n\t\t\t\tSELECT\r\n\t\t\t\tha.id_documento as id,\t\t\t\t\r\n\t\t\t\td.fecha_registro_documento as fecha,\r\n\t\t\t\td.asunto_documento as asunto,\r\n\t\t\t\td.codigo_documento as codigo,\r\n\t\t\t\ttd.nombre_tipo_documento as tipo,\r\n\t\t\t\tr.nombre_remitente as remitente,\r\n\t\t\t\tha.original_historial_atencion as categoria,\r\n\t\t\t\td.numero_documento as numero,\r\n\t\t\t\td.id_estado as id_estado,\r\n\t\t\t\te.abrev_nombre_estado as estado\r\n\t\t\t\tFROM\r\n\t\t\t\thistorial_atencion AS ha\r\n\t\t\t\tInner Join documentos AS d ON ha.id_documento = d.id_documento\r\n\t\t\t\tInner Join estados AS e ON d.id_estado = e.id_estado\r\n\t\t\t\tLEFT Join tipos_documento AS td ON d.id_tipo_documento = td.id_tipo_documento\r\n\t\t\t\tLEFT Join remitentes AS r ON d.id_remitente = r.id_remitente\r\n\t\t\t\tWHERE\r\n\t\t\t\t(\r\n\t\t\t\t(ha.id_area = '" . $_SESSION['session'][5] . "' AND ha.tipo_historial_atencion=0) OR\r\n\t\t\t\t(ha.id_area_destino = '" . $_SESSION['session'][5] . "' AND ha.tipo_historial_atencion=1) OR\r\n (ha.id_area_destino = '" . $_SESSION['session'][5] . "' AND ha.tipo_historial_atencion=2)\r\n\t\t\t\t) " . $where . "\r\n\t\t\t\tORDER BY id DESC,categoria"; $query_reg = new Consulta($sql_reg); } //Fin de if ide ?> <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"> <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="26%" 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="5%" class="ui-widget-header ui-th-column grid_resize">Estado</th> <th width="4%" class="ui-widget-header ui-th-column grid_resize">Cat</th> <th class="ui-widget-header ui-th-column grid_resize">Ubicacion</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 $codigo = ""; while ($row_reg = $query_reg->ConsultaVerRegistro()) { $ids = $row_reg["id"]; $estado = $row_reg["id_estado"]; $anterior = $codigo; $codigo = $row_reg["codigo"]; $cat = $row_reg["categoria"]; $loTengo = true; if ($codigo != $anterior) { if ($cat == 1) { if ($estado == 11 && $ide == "") { //No es un filtro y esta archivado $loTengo = false; // Para no mostrarlo } else { if ($_SESSION['session'][6] && $estado != 3 && $estado != 13 && $estado != 12 && $ide == "") { $loTengo = false; } elseif (!$_SESSION['session'][6] && ($estado == 3 || $estado == 13 || $estado == 12) && $ide == "") { $loTengo = false; } elseif ($estado == 3) { //Si es un despachado no pregunto si esta en mi area $doc = new Documento($ids); if ($doc->DespachoAreaTieneOriginal()) { $loTengo = true; } else { $loTengo = false; } } elseif ($estado == 4 || $estado == 13 || $estado == 12 || $estado == 6 || $estado == 16 || $estado == 17) { $total = 10; //Un numero Mayor a 0 para que tambien lo usen los otros estados if ($estado == 16 || $estado == 17) { $total = 0; $sql_hist = "SELECT Count(ha.id_historial_atencion) AS total\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\thistorial_atencion AS ha\r\n\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\tha.id_documento = {$ids}"; $query_hist = new Consulta($sql_hist); $row_hist = $query_hist->ConsultaVerRegistro(); $total = $row_hist["total"]; } //Si tiene historial se muestra en el area donde se quedo el ultimo original if ($total > 0) { $loTengo = false; $sql_destino = "SELECT ha.id_historial_atencion AS ultimo, \r\n\t\t\t\t\t\t\t\t\t\tha.tipo_historial_atencion,\r\n\t\t\t\t\t\t\t\t\t\tha.id_area,\r\n\t\t\t\t\t\t\t\t\t\tha.id_area_destino\r\n\t\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\t\thistorial_atencion AS ha\r\n\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\tha.id_documento=" . $ids . " AND\r\n\t\t\t\t\t\t\t\t\t\tha.original_historial_atencion=1\r\n\t\t\t\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\t\t\t\t`ha`.`id_historial_atencion` DESC\r\n\t\t\t\t\t\t\t\t\t\tLIMIT 1"; $query_destino = new Consulta($sql_destino); $row_destino = $query_destino->ConsultaVerRegistro(); if ($row_destino["tipo_historial_atencion"] > 0 && $row_destino["id_area_destino"] == $_SESSION['session'][5]) { $loTengo = true; } elseif ($row_destino["tipo_historial_atencion"] == 0) { if ($row_destino["id_area"] == $_SESSION['session'][5]) { $loTengo = true; } } //Fin elseif } //Fin if //Si no tiene historial anteriormente fue despacho asi que se muestra siempre ($loTengo estaba en true) } //Fin if Verificacion de estados } //Fin if estado = 11 } else { $sql_arch = "SELECT\r\n\t\t\t\t\t\ta.id_documento\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\tarchivo_copia AS a\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\ta.id_documento = {$ids} AND\r\n\t\t\t\t\t\ta.id_area_duenia = " . $_SESSION['session'][5] . " \r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t\ta.id_usuario_duenio = 0"; $query_arch = new Consulta($sql_arch); if ($query_arch->NumeroRegistros() > 0) { if ($ide == "LT" || $ide == 11) { $loTengo = true; } else { $loTengo = false; } } } //Pregunto si mi area lo tiene if ($loTengo) { $clase = "Estilo7"; if ($estado == 12) { $clase = "Estilo7 fila_finalizada"; } else { $dias_faltantes = ObtenerDiasFaltantes($ids, date('d/m/Y', strtotime($row_reg['fecha']))); if ($dias_faltantes <= 0) { $clase = "Estilo7 fila_peligro"; } elseif ($dias_faltantes > 0 && $dias_faltantes <= 3) { $clase = "Estilo7 fila_urgente"; } else { $clase = "Estilo7 fila_baja"; } } $tooltip_asunto = ""; if (!empty($row_reg['asunto'])) { $tooltip_asunto = "title ='" . $row_reg['asunto'] . "' class='tip'"; } ?> <tr class="ui-widget-content1 jqgrow <?php echo $clase; ?> "> <td width="16%" <?php echo $tooltip_asunto; ?> > <div align="center"> <?php if ($estado == 11 && $cat == 1) { ?> <?php echo $row_reg['codigo']; ?> <?php } else { ?> <a href="areas_acceso_registro.php?opcion=despachar&ids=<?php echo $ids; ?> &cat=<?php echo $row_reg['categoria']; ?> "> <?php echo $row_reg['codigo']; ?> </a> <?php } ?> </div></td> <td width="26%"><input name="Input3" value="<?php echo $row_reg['remitente']; ?> " style="width:100%"/></td> <td width="26%"><input value="<?php echo $row_reg['numero']; ?> " style="width:100%"/></td> <td width="13%"> <div align="center"> <input type="text" value="<?php echo date('d/m/Y H:i', strtotime($row_reg['fecha'])); ?> " style="text-align:center;width:100%;"/> </div></td> <?php $tooltip = ""; if ($estado == 5) { $sql_des = "SELECT\r\n\t\t\t\t\t\t\td.id_devuelto AS ultimo,\r\n\t\t\t\t\t\t\td.descripcion AS descripcion\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\tdevuelto AS d\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\td.id_documento = '" . $ids . "'\r\n\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\td.id_devuelto DESC\r\n\t\t\t\t\t\t\tLIMIT 1"; $query_des = new Consulta($sql_des); $row_des = $query_des->ConsultaVerRegistro(); if (!empty($row_des['descripcion'])) { $tooltip = "title ='" . $row_des['descripcion'] . "' class='tip'"; } } elseif ($estado == 11) { $sql_des = "SELECT\r\n\t\t\t\t\t\t\ta.id_archivo AS ultimo,\r\n\t\t\t\t\t\t\ta.descripcion AS descripcion\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\tarchivo AS a\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\ta.id_documento = '" . $ids . "'\r\n\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\ta.id_archivo DESC\r\n\t\t\t\t\t\t\tLIMIT 1"; $query_des = new Consulta($sql_des); $row_des = $query_des->ConsultaVerRegistro(); if (!empty($row_des['descripcion'])) { $tooltip = "title ='" . $row_des['descripcion'] . "' class='tip'"; } } elseif ($estado == 16 || $estado == 17) { $doc_d_a = new Documento($row_reg['id']); $tooltip = "title ='" . $doc_d_a->ObtenerDescripcionUltimoOriginal($estado) . "' class='tip'"; } ?> <td align="center" <?php if ($cat == 1) { echo $tooltip; } ?> width="5%"> <div align="center"> <?php if ($cat == 1) { ?> <?php if ($estado == 11) { ?> <a href="javascript:QuitarArchivado(<?php echo $row_reg['id']; ?> )" id="desarchivar"> <?php echo $row_reg['estado']; ?> </a> <?php } elseif ($estado == 12) { ?> <a href="javascript:QuitarFinalizar(<?php echo $row_reg['id']; ?> )" id="nofinalizar"> <?php echo $row_reg['estado']; ?> </a> <?php } else { ?> <input type="text" value="<?php echo $row_reg['estado']; ?> " size="3" style="text-align:center; width:100%"/> <?php } ?> <?php } else { $doc = new Documento(); $estado = $doc->ObtenerEstadoCopia($ids, 1); ?> <input type="text" value="<?php echo $estado; ?> " size="3" style="text-align:center; width:100%"/> <?php } ?> </div> </td> <td align="center" width="4%"> <div align="center"> <input type="text" value="<?php echo $row_reg['categoria'] == '1' ? 'O' : 'C'; ?> " style=" width:20PX; text-align:center"/> </div> </td> <?php $sql_data = " SELECT a.abve_nombre_area\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\tareas AS a \r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\ta.id_area = '" . $_SESSION['session'][5] . "' "; $query_data = new Consulta($sql_data); $data = $query_data->ConsultaVerRegistro(); ?> <td> <?php if ($row_reg['categoria'] != 1) { $doc = new Documento(); $ubic = $doc->ObtenerUbicacionCopia($ids, 1); $area = $data['abve_nombre_area']; $tooltip_ubic = ""; if (count($ubic) > 0) { $cont = 0; foreach ($ubic as $u) { if ($cont == 0) { $tooltip_ubic = $tooltip_ubic . "{$area} - " . $u["destino"]; } else { $tooltip_ubic = $tooltip_ubic . "<br/>{$area} - " . $u["destino"]; } $cont++; } if (count($ubic) == 1) { ?> <input type="text" value="<?php echo $tooltip_ubic; ?> " style="width:95%"/> <?php } else { ?> <input type="text" value="<?php echo $area . "- Varios"; ?> " style="width:95%" title ='<?php echo $tooltip_ubic; ?> ' class='tip'/> <?php } } else { ?> <input type="text" value="<?php echo $area; ?> " style="width:95%"/> <?php } } elseif ($row_reg['id_estado'] == '3' || $row_reg['id_estado'] == '12' || $row_reg['id_estado'] == '16' || $row_reg['id_estado'] == '17') { ?> <input type="text" value="<?php echo $data['abve_nombre_area']; ?> " /> <?php } elseif ($row_reg['id_estado'] == '13') { $sql_area_derivado = "SELECT ha.id_historial_atencion AS ultimo, \r\n\t\t\t\t\t\t\t\ta.id_area AS area,\r\n\t\t\t\t\t\t\t\ta.abve_nombre_area AS abreviatura\t\r\n\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\thistorial_atencion AS ha\r\n\t\t\t\t\t\t\t\tInner Join areas AS a ON a.id_area = ha.id_area_destino\r\n\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tha.id_documento=" . $ids . " and\r\n\t\t\t\t\t\t\t\tha.tipo_historial_atencion = 1 and\r\n\t\t\t\t\t\t\t\tha.original_historial_atencion = 1\r\n\t\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\t\tultimo DESC\r\n\t\t\t\t\t\t\t\tLIMIT 1"; $query_area_derivado = new Consulta($sql_area_derivado); $row_area_derivado = $query_area_derivado->ConsultaVerRegistro(); ?> <input name="text" type="text" value="<?php echo $row_area_derivado["abreviatura"]; ?> " /> <?php } elseif ($row_reg['id_estado'] == '4' || $row_reg['id_estado'] == '18') { $sql_usu = "SELECT\r\n\t\t\t\t\t\t\tha.id_historial_atencion AS ultimo,\r\n\t\t\t\t\t\t\ta.abve_nombre_area AS abreviatura,\r\n\t\t\t\t\t\t\tu.login_usuario\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\thistorial_atencion AS ha\r\n\t\t\t\t\t\t\tInner Join areas AS a ON a.id_area = ha.id_area\r\n\t\t\t\t\t\t\tLEFT Join usuarios AS u ON u.id_usuario = ha.id_usuario_destino\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tha.id_documento={$ids} and\r\n\t\t\t\t\t\t\t(ha.tipo_historial_atencion = 0 \r\n\t\t\t\t\t\t\tOR ha.tipo_historial_atencion = 5 \r\n\t\t\t\t\t\t\t)and\r\n\t\t\t\t\t\t\tha.original_historial_atencion = 1\r\n\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\tultimo DESC\r\n\t\t\t\t\t\t\tLIMIT 1"; $query_usu = new Consulta($sql_usu); $usu = $query_usu->ConsultaVerRegistro(); ?> <input type="text" value="<?php echo $usu['abreviatura'] . ' - ' . $usu['login_usuario']; ?> " /> <?php } elseif ($row_reg['id_estado'] == '6') { $sql_usu = "SELECT\r\n\t\t\t\t\t\t\ta.abve_nombre_area AS abreviatura,\r\n\t\t\t\t\t\t\tu.login_usuario AS login_usuario\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\tborradores_respuesta AS b\r\n\t\t\t\t\t\t\tInner Join usuarios AS u ON u.id_usuario = b.id_destino\r\n\t\t\t\t\t\t\tInner Join areas AS a ON a.id_area = u.id_area \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tb.id_documento = '" . $ids . "' AND\r\n\t\t\t\t\t\t\tb.categoria = '1'\r\n\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\tb.fecha_borrador_respuesta DESC\r\n\t\t\t\t\t\t\tLIMIT 1"; $query_usu = new Consulta($sql_usu); $usu = $query_usu->ConsultaVerRegistro(); ?> <input type="text" value="<?php echo $usu['abreviatura'] . ' - ' . $usu['login_usuario']; ?> " /> <?php } elseif ($row_reg['id_estado'] == '11') { $sql_usu = "SELECT\r\n\t\t\t\t\t\t\tar.abve_nombre_area\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\tarchivo AS a\r\n\t\t\t\t\t\t\tInner Join areas AS ar ON a.id_area = ar.id_area\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\ta.id_documento = '" . $ids . "'\r\n\t\t\t\t\t\t\tORDER BY a.id_archivo DESC\r\n\t\t\t\t\t\t\tLIMIT 1"; $query_usu = new Consulta($sql_usu); $usu = $query_usu->ConsultaVerRegistro(); ?> <input type="text" value="<?php echo $usu['abve_nombre_area']; ?> " /> <?php } ?> </td> </tr> <?php } //Fin de if categoria = 1 } //Fin de if anterior = codigo } //Fin de While ?> </table> </td> </tr> </table> </div> <?php }
function esResponsable() { $SQL = "SELECT 1\r\n\t\t\t\tFROM\r\n\t\t\t\tusuarios AS u\r\n\t\t\t\tInner Join areas AS a ON u.id_area = a.id_area\r\n\t\t\t\tWHERE\r\n\t\t\t\tu.id_usuario = '" . $this->_id . "'\r\n\t\t\t\tAND \r\n\t\t\t\tu.id_usuario = a.id_responsable_area"; $Query = new Consulta($SQL); if ($Query->NumeroRegistros() == 0) { return false; } else { return true; } }
function DespacharEliminarDestino($id, $ids) { $sql = " SELECT \r\n original_historial_documento AS categoria\r\n FROM historial_documentos \r\n\t\t\t \t\tWHERE id_historial_documento='" . $id . "'"; $q = new Consulta($sql); $row = $q->ConsultaVerRegistro(); $sst_r = "DELETE FROM historial_documentos \r\n\t\t\t where id_historial_documento='" . $id . "'"; $qt_r = new Consulta($sst_r); $sst_r = "DELETE FROM movimientos \r\n\t\t\t WHERE id_historial='" . $id . "' AND tipo=1"; $qt_r = new Consulta($sst_r); if ($row['categoria'] == 1) { /*$actua="Update documentos SET id_prioridad='', asunto_documento='' WHERE id_documento='".$ids."'"; $q_actua=new Consulta($actua); $actua_r = "Update documentos_reporte SET prioridad='', asunto='', ubicacion='' WHERE id_documento='".$ids."'"; $q_actua_r=new Consulta($actua_r);*/ } //Vemos si no tiene historial de originales $sql_t = "SELECT id_historial_documento\r\n from historial_documentos\r\n WHERE id_documento='" . $ids . "'\r\n AND original_historial_documento=1"; $query_t = new Consulta($sql_t); if ($query_t->NumeroRegistros() == 0) { $actua = "UPDATE documentos \r\n\t\t\t\t SET id_estado=1\r\n\t\t\t\t WHERE id_documento='" . $ids . "'"; $q_actua = new Consulta($actua); $actua_r = "UPDATE documentos_reporte \r\n\t\t\t\t\tSET estado='R'\r\n WHERE id_documento='" . $ids . "'"; $q_actua_r = new Consulta($actua_r); } }
function DespacharListarDestino($ids) { $doc = new Documento($ids); $estado = $doc->getestado(); $deshabilita_todo = false; if ($estado->getId() == 11 && $_REQUEST["cat"] == 1) { $deshabilita_todo = true; } elseif ($_REQUEST["cat"] == 2) { $sql_arch = "SELECT\r\n\t\t\t\t\t\ta.id_documento\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\tarchivo_copia AS a\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\ta.id_documento = {$ids} AND\r\n\t\t\t\t\t\ta.id_area_duenia = " . $_SESSION['session'][5] . " \r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t\ta.id_usuario_duenio = 0"; $query_arch = new Consulta($sql_arch); if ($query_arch->NumeroRegistros() > 0) { $deshabilita_todo = true; } else { $deshabilita_todo = false; } } ?> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" id="tabla_despacho" > <tr bgcolor="#6699CC" class="Estilo7"> <td width="5%" height="25" ><div align="center" class="msgok1"><strong>Nro</strong></div></td> <td width="21%"><div align="center" class="msgok1"><strong>ORIGEN</strong></div></td> <td width="24%"><div align="center" class="msgok1"><strong>DESTINO</strong></div></td> <td width="13%"><div align="center" class="msgok1"><strong>Fecha y Hora </strong></div></td> <td width="13%"><div align="center" class="msgok1"><strong>Acción</strong></div></td> <td width="10%"><div align="center" class="msgok1"><strong>Categoría</strong></div></td> <td width="14%"><div align="center" class="msgok1"><strong>Opciones </strong></div></td> </tr> <?php echo $sql_origen = "SELECT\r\n\t\t\t\t\t\thd.id_historial_documento AS id,\r\n\t\t\t\t\t\t'6' AS tipo_historial,\r\n\t\t\t\t\t\tnull AS id_usuario_destino,\r\n\t\t\t\t\t\thd.id_area AS id_area_destino,\r\n\t\t\t\t\t\tnull AS id_usuario,\r\n\t\t\t\t\t\tnull AS id_area,\r\n\t\t\t\t\t\tDATE_FORMAT(hd.fecha_historial_documento, '%Y-%m-%d %H:%i') AS fecha,\t\t\t\t \r\n\t\t\t\t\t\thd.original_historial_documento AS categoria,\r\n\t\t\t\t\t\thd.observacion_historial_documento AS observacion,\r\n\t\t\t\t\t\ta.nombre_accion AS nombre_accion\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\thistorial_documentos AS hd\r\n\t\t\t\t\t\tInner Join accion AS a ON a.id_accion = hd.id_accion\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thd.id_documento = '" . $ids . "'\r\n\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tth.id_historial_atencion AS id,\r\n\t\t\t\t\t\tth.tipo_historial_atencion AS tipo_historial,\r\n\t\t\t\t\t\tth.id_usuario_destino AS id_usuario_destino,\r\n\t\t\t\t\t\tth.id_area_destino AS id_area_destino,\r\n\t\t\t\t\t\tth.id_usuario AS id_usuario,\r\n\t\t\t\t\t\tth.id_area AS id_area,\r\n\t\t\t\t\t\tDATE_FORMAT(th.fecha_historial_atencion, '%Y-%m-%d %H:%i') AS fecha,\r\n\t\t\t\t\t\tth.original_historial_atencion AS categoria,\r\n\t\t\t\t\t\tth.observacion_historial_atencion AS observacion,\r\n\t\t\t\t\t\ttac.nombre_accion AS nombre_accion\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\thistorial_atencion AS th\r\n\t\t\t\t\t\tLEFT Join accion AS tac ON tac.id_accion = th.id_accion\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tth.id_documento ='" . $ids . "'\r\n\t\t\t\t\t\tAND (th.tipo_historial_atencion = 0 OR th.tipo_historial_atencion = 1\r\n\t\t\t\t\t\tOR th.tipo_historial_atencion = 2 OR th.tipo_historial_atencion = 4)\r\n\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tb.id_borrador_respuesta AS id,\r\n\t\t\t\t\t\t'3' AS tipo_historial,\r\n\t\t\t\t\t\tb.id_destino AS id_usuario_destino,\r\n\t\t\t\t\t\tnull AS id_area_destino,\r\n\t\t\t\t\t\tb.id_usuario AS id_usuario,\r\n\t\t\t\t\t\tb.id_area AS id_area,\r\n\t\t\t\t\t\tDATE_FORMAT(b.fecha_borrador_respuesta, '%Y-%m-%d %H:%i') AS fecha,\r\n\t\t\t\t\t\tb.categoria AS categoria,\r\n\t\t\t\t\t\tb.descripcion_borrador_respuesta AS observacion,\r\n\t\t\t\t\t\taccion.nombre_accion AS nombre_accion\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\tborradores_respuesta AS b\r\n\t\t\t\t\t\tLEFT Join accion ON accion.id_accion = b.id_accion\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tb.id_documento ='" . $ids . "'\r\n\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\td.id_devuelto,\r\n\t\t\t\t\t\t'7' AS tipo_historial,\r\n\t\t\t\t\t\tnull AS id_usuario_destino,\r\n\t\t\t\t\t\tnull AS id_area_destino,\r\n\t\t\t\t\t\td.id_usuario AS usuario,\r\n\t\t\t\t\t\td.id_area AS area,\r\n\t\t\t\t\t\tDATE_FORMAT(d.fecha_devolucion, '%Y-%m-%d %H:%i') AS fecha,\r\n\t\t\t\t\t\t'1' AS categoria,\r\n\t\t\t\t\t\td.descripcion,\r\n\t\t\t\t\t\t'DEVOLVER A DESPACHO' AS nombre_accion\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\tdevuelto AS d\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\td.id_documento ='" . $ids . "'\r\n\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\ta.id_archivo,\r\n\t\t\t\t\t\t'8' AS tipo_historial,\r\n\t\t\t\t\t\tnull AS id_usuario_destino,\r\n\t\t\t\t\t\ta.id_area AS id_area_destino,\r\n\t\t\t\t\t\ta.id_usuario AS usuario,\r\n\t\t\t\t\t\ta.id_area AS area,\r\n\t\t\t\t\t\tDATE_FORMAT(a.fecha_archivo, '%Y-%m-%d %H:%i') AS fecha,\r\n\t\t\t\t\t\t'1' AS categoria,\r\n\t\t\t\t\t\ta.descripcion,\r\n\t\t\t\t\t\t'ARCHIVAR' AS nombre_accion\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\tarchivo AS a\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\ta.id_documento ='" . $ids . "'\r\n\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\tfecha ASC,\r\n\t\t\t\t\t\tcategoria ASC"; $query_origen = new Consulta($sql_origen); $query = new Consulta($sql_origen); $ultimo_original = 0; $contador = 1; while ($row = $query->ConsultaVerRegistro()) { //Recorremos para saber cual es el �ltimo original if ($row["categoria"] == 1 && $contador != 1) { $ultimo_original = $contador; } $contador++; } $hayOriginal = 0; $cont = 0; while ($row_org = $query_origen->ConsultaVerRegistro()) { $noEsMio = ''; $idp = $row_org[0]; if ($row_org["tipo_historial"] == 0) { //Es de AREA a usuarios del area $id_ori = new Area($row_org['id_area']); $origen = $id_ori->getNombre(); $id_dest = new Usuario($row_org['id_usuario_destino']); $destino = $id_dest->getNombreCompleto(); } elseif ($row_org["tipo_historial"] == 1) { //Es de AREA a AREA $id_ori = new Area($row_org['id_area']); $id_des = new Area($row_org['id_area_destino']); $origen = $id_ori->getNombre(); $destino = $id_des->getNombre(); } elseif ($row_org["tipo_historial"] == 2) { //Es de USUARIO a AREA $id_ori = new Usuario($row_org['id_usuario']); $id_des = new Area($row_org['id_area_destino']); $origen = $id_ori->getNombreCompleto(); $destino = $id_des->getNombre(); } elseif ($row_org["tipo_historial"] == 3 || $row_org["tipo_historial"] == 4 || $row_org["tipo_historial"] == 5) { //Es de USUARIO a USUARIO $id_ori = new Usuario($row_org['id_usuario']); $id_des = new Usuario($row_org['id_usuario_destino']); $origen = $id_ori->getNombreCompleto(); $destino = $id_des->getNombreCompleto(); } elseif ($row_org["tipo_historial"] == 6) { //Es de MESA a AREA $id_des = new Area($row_org['id_area_destino']); $origen = "DESPACHO GENERAL"; $destino = $id_des->getNombre(); } elseif ($row_org["tipo_historial"] == 7) { //Es de AREA a MESA $id_ori = new Area($row_org['id_area']); $origen = $id_ori->getNombre(); $destino = "DESPACHO GENERAL"; } elseif ($row_org["tipo_historial"] == 8) { //Es de AREA a ARCHIVO $id_ori = new Area($row_org['id_area']); $origen = $id_ori->getNombre(); $destino = $origen; } //Solo se muestra como historial(no lo hizo el area actual) if ($row_org["id_area"] != $_SESSION['session'][5]) { $noEsMio = "class = 'historial'"; } ?> <tr <?php echo $noEsMio; ?> > <td><input type="hidden" value="<?php echo $idp; ?> "><div align="center"><?php echo ++$cont; ?> </div></td> <td><?php echo $origen; ?> </td> <td><?php echo $destino; ?> </td> <td><div align="center"><?php echo date('d/m/Y H:i', strtotime($row_org['fecha'])); ?> </div></td> <td><div align="center"><?php echo $row_org['nombre_accion']; ?> </div></td> <td> <div align="center"><?php echo $row_org['categoria'] == '1' ? 'ORIGINAL' : 'COPIA'; ?> </div> </td> <td> <div align="center"> <?php //Eliminar if ($deshabilita_todo) { ?> <img src="public_root/imgs/b_drop_d.png" alt="Eliminar" width="16" height="16" border="0"> <?php } elseif (($row_org['id_area'] == $_SESSION['session'][5] || $row_org['id_usuario'] == $_SESSION['session'][0] || $row_org['id_area_destino'] == $_SESSION['session'][5]) && $row_org["categoria"] == 2) { ?> <a href="areas_acceso_registro.php?opcion=eliminar&ids=<?php echo $ids; ?> &idp=<?php echo $idp; ?> &cat=<?php echo $_REQUEST["cat"]; ?> &th=<?php echo $row_org["tipo_historial"]; ?> "><img src="public_root/imgs/b_drop.png" alt="Eliminar" width="16" height="16" border="0"></a> <?php } elseif (($row_org['id_area'] == $_SESSION['session'][5] || $row_org['id_usuario'] == $_SESSION['session'][0] || $row_org['id_area_destino'] == $_SESSION['session'][5]) && $ultimo_original == $cont) { //Yo lo envie lo puedo eliminar ?> <a href="areas_acceso_registro.php?opcion=eliminar&ids=<?php echo $ids; ?> &idp=<?php echo $idp; ?> &cat=<?php echo $_REQUEST["cat"]; ?> &th=<?php echo $row_org["tipo_historial"]; ?> "><img src="public_root/imgs/b_drop.png" alt="Eliminar" width="16" height="16" border="0"></a> <?php } elseif ($row_org['id_usuario'] == $_SESSION['session'][0] && $row_org["tipo_historial"] == 3 && $ultimo_original == $cont) { ?> <a href="areas_acceso_registro.php?opcion=eliminar&ids=<?php echo $ids; ?> &idp=<?php echo $idp; ?> &cat=<?php echo $_REQUEST["cat"]; ?> &th=<?php echo $row_org["tipo_historial"]; ?> "><img src="public_root/imgs/b_drop.png" alt="Eliminar" width="16" height="16" border="0"></a> <?php } else { ?> <img src="public_root/imgs/b_drop_d.png" alt="Eliminar" width="16" height="16" border="0"> <?php } //Fin del if de eliminar ?> <?php $observacion = trim($row_org['observacion']); if (!empty($observacion)) { ?> <a href="javascript:VerDetalleObservacion(<?php echo $cont; ?> )"> <img src="public_root/imgs/b_search.png" width="16" height="16" border="0" alt="Ver Detalle" /> </a> <?php } else { ?> <img src="public_root/imgs/b_search_d.png" width="16" height="16" border="0" alt="Ver Detalle" /> <?php } ?> <?php $tipo = $row_org['tipo_historial']; if ($tipo == 2 || $tipo == 3 || $tipo == 4 || $tipo == 8) { $doc_archivo = new Documento($ids); $archivo = array(); if ($tipo == 4) { $archivo = $doc_archivo->obtenerJustificacionesEscaneadas($idp); } elseif ($tipo == 2) { $archivo = $doc_archivo->obtenerAprobacionesEscaneadas($idp); } elseif ($tipo == 8) { $archivo = $doc_archivo->obtenerArchivadosEscaneados($idp); } else { $archivo = $doc_archivo->obtenerBorradoresEscaneados($idp); } if (count($archivo) > 0) { ?> <a href="javascript:void(0)" onclick="ver_mas_adjuntos($(this))"> <img src="public_root/imgs/attach.png" width="16" height="16" border="0" alt="Ver Archivo" /> </a> <div id="doc_adjuntos<?php echo $cont; ?> " class="doc_adjuntos"> <p>Documentos Adjuntos : </p> <?php for ($i = 0; $i < count($archivo); $i++) { $ruta = ""; if ($tipo == 2) { $ruta = "Aprobacion/" . rawurlencode($archivo[$i]); $nombre = $archivo[$i]; } elseif ($tipo == 4) { $ruta = "Justificados/" . rawurlencode($archivo[$i]); $nombre = $archivo[$i]; } elseif ($tipo == 8) { if ($archivo[$i]["tipo"] == 1) { $ruta = "Archivados_Respuesta/" . rawurlencode($archivo[$i]["nombre"]); } else { $ruta = "Adjuntos_Archivo/" . rawurlencode($archivo[$i]["nombre"]); } $nombre = $archivo[$i]["nombre"]; } else { $ruta = "Borradores/" . rawurlencode($archivo[$i]); $nombre = $archivo[$i]; } ?> <p><a href="<?php echo $ruta; ?> " target="_blank"><?php echo $nombre; ?> </a></p> <?php } ?> </div> <?php } else { ?> <img src="public_root/imgs/attach_d.png" width="16" height="16" border="0" alt="Ver Archivo"/> <?php } } else { ?> <img src="public_root/imgs/attach_d.png" width="16" height="16" border="0" alt="Ver Archivo"/> <?php } ////Fin del if para file.gif ?> </div> </td> </tr> <tr> <td colspan="7" align="center"> <div style="display:none; text-align:left;" id="detalle_observacion<?php echo $cont; ?> "> <?php echo $observacion; ?> </div> </td> </tr> <?php } //Fin del While ?> </tr> </table> <?php }
function AreasDetalleArea($ida) { $sql_areas = "Select * from areas where id_area <> {$ida}"; $query_areas = new Consulta($sql_areas); ?> <form id="form_detalle_area" name="form_detalle_area" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?opcion=addArea&id=<?php echo $ida; ?> "> <table width="491" height="80" border="1" align="center"> <tr bgcolor="#6699CC"> <td width="240"><div align="center">Nombre</div></td> <td width="136"><div align="center">Abreviatura</div></td> <td width="93"><div align="center">Activar</div></td> </tr> <?php while ($row_areas = $query_areas->ConsultaVerRegistro()) { $id = $row_areas["id_area"]; ?> <tr> <td><div align="left"> <?php echo $row_areas["nombre_area"]; ?> </div></td> <td><div align="center"> <?php echo $row_areas["abve_nombre_area"]; ?> </div></td> <td width="93"><div align="center"> <?php $sql_a_a = "select *\r\n from areas_areas\r\n where id_area_primaria = {$ida}\r\n and id_area_secundaria = {$id}"; $query_a_a = new Consulta($sql_a_a); $n = $query_a_a->NumeroRegistros(); ?> <input type="checkbox" name="opcion[]" value="<?php echo $id; ?> " <?php if ($n == 1) { echo "checked = checked"; } ?> /> </div></td> </tr> <?php } ?> <tr> <td height="23" colspan="4"><div align="center"> <input type="submit" name="guardar" value="Guardar" class="boton" /> <input class="boton" type="reset" name="cancelar" value="Cancelar" onclick="javascript:window.history.go(-1)"/> </div></td> </tr> </table> </form> <?php }
$where = "Inner Join movimientos AS m ON dr.id_documento_reporte = m.id_documento_reporte\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tdr.remitente LIKE '%" . $_GET['rem'] . "%' AND dr.asunto LIKE '%" . $_GET['asu'] . "%' \r\n\t\t\t\t\t\tAND dr.numero_documento LIKE '%" . $_GET['doc'] . "%' AND dr.ubicacion LIKE '" . $_GET['ubi'] . "%' \r\n\t\t\t\t\t\tAND date(dr.fecha_registro) = '" . formato_date('/', $_GET['fecha1']) . "' \r\n\t\t\t\t\t\tAND (date(m.fecha_movimiento) BETWEEN '" . formato_date('/', $_GET['fecha3']) . "' \r\n\t\t\t\t\t\tAND '" . formato_date('/', $_GET['fecha4']) . "'\tAND {$fin_derivado})\r\n\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\tdr.id_documento_reporte"; } elseif (!$_GET['fecha4']) { //Solo se escogio rango de fecha de registro $where = "Inner Join movimientos AS m ON dr.id_documento_reporte = m.id_documento_reporte\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tdr.remitente LIKE '%" . $_GET['rem'] . "%' AND dr.asunto LIKE '%" . $_GET['asu'] . "%' \r\n\t\t\t\t\t\tAND dr.numero_documento LIKE '%" . $_GET['doc'] . "%' AND dr.ubicacion LIKE '" . $_GET['ubi'] . "%' \r\n\t\t\t\t\t\tAND date(dr.fecha_registro) BETWEEN '" . formato_date('/', $_GET['fecha1']) . "' \r\n\t\t\t\t\t\tAND '" . formato_date('/', $_GET['fecha2']) . "'\r\n\t\t\t\t\t\tAND (date(m.fecha_movimiento) = '" . formato_date('/', $_GET['fecha3']) . "' \r\n\t\t\t\t\t\tAND {$fin_derivado})\r\n\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\tdr.id_documento_reporte"; } else { $where = "Inner Join movimientos AS m ON dr.id_documento_reporte = m.id_documento_reporte\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tdr.remitente LIKE '%" . $_GET['rem'] . "%' AND dr.asunto LIKE '%" . $_GET['asu'] . "%' \r\n\t\t\t\t\t\tAND dr.numero_documento LIKE '%" . $_GET['doc'] . "%' AND dr.ubicacion LIKE '" . $_GET['ubi'] . "%' \r\n\t\t\t\t\t\tAND date(dr.fecha_registro) BETWEEN '" . formato_date('/', $_GET['fecha1']) . "' \r\n\t\t\t\t\t\tAND '" . formato_date('/', $_GET['fecha2']) . "'\r\n\t\t\t\t\t\tAND (date(m.fecha_movimiento) BETWEEN '" . formato_date('/', $_GET['fecha3']) . "' \r\n\t\t\t\t\t\tAND '" . formato_date('/', $_GET['fecha4']) . "'\tAND {$fin_derivado})\r\n\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\tdr.id_documento_reporte"; } } } else { $where = "WHERE numero_registro like '" . $_GET['anp'] . "%-%" . $_GET['reg'] . "'"; } $sql = "SELECT\r\n\t\t\tdr.id_documento_reporte\r\n\t\t\tFROM\r\n\t\t\tdocumentos_reporte AS dr\r\n\t\t\t{$where}"; //echo $sql; $query_sql = new Consulta($sql); // calculate the number of rows for the query. We need this to paging the result $count = $query_sql->NumeroRegistros(); // calculation of total pages for the query if ($count > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } // if for some reasons the requested page is greater than the total // set the requested page to total page if ($page > $total_pages) { $page = $total_pages; } // calculate the starting position of the rows $start = $limit * $page - $limit; // do not put $limit*($page - 1) // if for some reasons start position is negative set it to 0