Skip to content

Commit

Permalink
Se creo listado de facturas para compras y demas servicios internos […
Browse files Browse the repository at this point in the history
…Finished#78033254]
  • Loading branch information
const3 committed Sep 9, 2014
1 parent 8ff5a4f commit 8ce4d72
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void pasar(Usuario usuario) throws CorreoMalFormadoException {
ProveedorFacturas proveedor = dao.obtiene(proveedorFacturas.getRfc());
if (proveedor.getCorreo() == null ? proveedorFacturas.getCorreo() != null : !proveedor.getCorreo().equals(proveedorFacturas.getCorreo())) {
log.debug("*****actualizando datos proveedor:{}", proveedor.getCorreo());
proveedor.setNombre(proveedorFacturas.getNombre());
proveedor.setCorreo(proveedorFacturas.getCorreo().trim());
proveedor.setUsername(proveedorFacturas.getCorreo().trim());
proveedor.setPassword(passwordEncoder.encodePassword(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
import mx.edu.um.mateo.rh.model.Empleado;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.persistence.annotations.ReadOnly;
import org.eclipse.persistence.internal.helper.ClassConstants;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
Expand Down Expand Up @@ -490,6 +492,77 @@ public String revisar(HttpServletRequest request, HttpServletResponse response,
return "/factura/informeProveedorDetalle/detalles";
}

@PreAuthorize("hasRole('ROLE_PRV_COMPRAS')")
@RequestMapping("/revisarFacturasCompras")
public String revisarFacturasCompras(HttpServletRequest request, HttpServletResponse response,
@RequestParam(required = false) String filtro,
@RequestParam(required = false) Long pagina,
@RequestParam(required = false) String tipo,
@RequestParam(required = false) String correo,
@RequestParam(required = false) String order,
@RequestParam(required = false) String sort,
Usuario usuario,
Errors errors,
Model modelo) {
log.debug("Entrando a revisar..**..");
Map<String, Object> params = new HashMap<>();
Long empresaId = (Long) request.getSession().getAttribute("empresaId");
params.put("empresa", empresaId);
params.put(Constantes.CONTAINSKEY_REPORTE, Constantes.CONTAINSKEY_REPORTE);
// InformeProveedor informeId = (InformeProveedor) request.getSession().getAttribute("informeId");
// params.put("informeProveedor", informeId.getId());
if (StringUtils.isNotBlank(filtro)) {
params.put(Constantes.CONTAINSKEY_FILTRO, filtro);
}
if (pagina != null) {
params.put(Constantes.CONTAINSKEY_PAGINA, pagina);
modelo.addAttribute(Constantes.CONTAINSKEY_PAGINA, pagina);
} else {
pagina = 1L;
modelo.addAttribute(Constantes.CONTAINSKEY_PAGINA, pagina);
}
if (StringUtils.isNotBlank(order)) {
params.put(Constantes.CONTAINSKEY_ORDER, order);
params.put(Constantes.CONTAINSKEY_SORT, sort);
}

if (StringUtils.isNotBlank(tipo)) {
params.put(Constantes.CONTAINSKEY_REPORTE, Constantes.CONTAINSKEY_REPORTE);
params = manager.revisar(params);
try {
generaReporte(tipo, (List<InformeProveedorDetalle>) params.get(Constantes.CONTAINSKEY_INFORMESPROVEEDOR_DETALLE),
response, "contrarecibo", Constantes.EMP, empresaId);
return null;
} catch (ReporteException e) {
log.error("No se pudo generar el reporte", e);
params.remove(Constantes.CONTAINSKEY_REPORTE);
//errors.reject("error.generar.reporte");
}
}

if (StringUtils.isNotBlank(correo)) {
params.put(Constantes.CONTAINSKEY_REPORTE, true);
params = manager.revisar(params);

params.remove(Constantes.CONTAINSKEY_REPORTE);
try {
enviaCorreo(correo, (List<InformeProveedorDetalle>) params.get(Constantes.CONTAINSKEY_INFORMESPROVEEDOR_DETALLE),
request, "contrarecibo", Constantes.EMP, empresaId);
modelo.addAttribute(Constantes.CONTAINSKEY_MESSAGE, "lista.enviada.message");
modelo.addAttribute(Constantes.CONTAINSKEY_MESSAGE_ATTRS, new String[]{messageSource.getMessage("detalle.lista.label", null, request.getLocale()), ambiente.obtieneUsuario().getUsername()});
} catch (ReporteException e) {
log.error("No se pudo enviar el reporte por correo", e);
}
}
params = manager.revisar(params);
log.debug("params{}", params.get(Constantes.CONTAINSKEY_INFORMESPROVEEDOR_DETALLE));
modelo.addAttribute(Constantes.CONTAINSKEY_INFORMESPROVEEDOR_DETALLE, params.get(Constantes.CONTAINSKEY_INFORMESPROVEEDOR_DETALLE));

pagina(params, modelo, Constantes.CONTAINSKEY_INFORMESPROVEEDOR_DETALLE, pagina);

return "/factura/informeProveedorDetalle/revisarFacturasCompras";
}

@RequestMapping("/listaRevisados")
public String revisados(HttpServletRequest request, HttpServletResponse response,
@RequestParam(required = false) String filtro,
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ login.password=Contrase\u00f1a
login.remember.me=Recu\u00e9rdame
login.entrar=Entrar
login.invalido=No se pudo identificar con los datos introducidos, favor de intentarlo nuevamente.
login.error=Favor de comunicarse a las extensiones 1054 o 1050 para que le demos acceso
login.error=Favor de comunicarse a la extensi\u00f3n 5557 para que le demos acceso
login.roles=Roles

#Upload File
Expand Down Expand Up @@ -117,6 +117,7 @@ ROLE_PRV=Proveedor
ROLE_PRV_USER=Proveedor Usuario
ROLE_PRV_GENERA=Proveedor Validar Facturas
ROLE_PRV_VALIDA=Proveedor Genera Contrarecibo
ROLE_PRV_COMPRAS=Proveedor Compras

NotEmpty={0} no puede estar vac\u00edo
campo.duplicado.message=El campo {0} esta duplicado, favor de elegir otro
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
<intercept-url pattern="/factura/proveedorFacturas/**" access="hasAnyRole('ROLE_PRV_VALIDA')" />
<intercept-url pattern="/factura/informeProveedor/**" access="hasAnyRole('ROLE_PRV_USER')" />
<intercept-url pattern="/factura/informeProveedorDetalle/revisar" access="hasAnyRole('ROLE_PRV_VALIDA')" />
<intercept-url pattern="/factura/informeProveedorDetalle/revisarFacturasCompras" access="hasAnyRole('ROLE_PRV_COMPRAS')" />
<intercept-url pattern="/factura/informeProveedorDetalle/autorizar" access="hasAnyRole('ROLE_PRV_VALIDA')" />
<intercept-url pattern="/factura/pasarProveedor" access="hasAnyRole('ROLE_PRV_VALIDA')" />
<intercept-url pattern="/factura/informeProveedorDetalle/downloadPdfFile/**" access="hasAnyRole('ROLE_PRV_GENERA','ROLE_PRV_VALIDA','ROLE_PRV_USER')" />
<intercept-url pattern="/factura/informeProveedorDetalle/downloadXmlFile/**" access="hasAnyRole('ROLE_PRV_GENERA','ROLE_PRV_VALIDA','ROLE_PRV_USER')" />
<intercept-url pattern="/factura/informeProveedorDetalle/downloadPdfFile/**" access="hasAnyRole('ROLE_PRV_GENERA','ROLE_PRV_VALIDA','ROLE_PRV_USER','ROLE_PRV_COMPRAS')" />
<intercept-url pattern="/factura/informeProveedorDetalle/downloadXmlFile/**" access="hasAnyRole('ROLE_PRV_GENERA','ROLE_PRV_VALIDA','ROLE_PRV_USER','ROLE_PRV_COMPRAS')" />
<intercept-url pattern="/factura/informeProveedorDetalle/listaRevisados" access="hasAnyRole('ROLE_PRV_GENERA')" />
<intercept-url pattern="/factura/informeProveedorDetalle/contrarecibos" access="hasAnyRole('ROLE_PRV_GENERA')" />
<intercept-url pattern="/factura/informeProveedorDetalle/pagar" access="hasAnyRole('ROLE_PRV_GENERA')" />
Expand Down Expand Up @@ -86,6 +87,7 @@
ROLE_PRV > ROLE_PRV_USER
ROLE_PRV > ROLE_PRV_VALIDA
ROLE_PRV > ROLE_PRV_GENERA
ROLE_PRV > ROLE_PRV_COMPRAS
ROLE_PRV > ROLE_USER
ROLE_USER > ROLE_AUTHENTICATED
ROLE_AUTHENTICATED > ROLE_UNAUTHENTICATED
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
<title><s:message code="autorizarFacturas.label" /></title>
</head>
<body>
<jsp:include page="../menu.jsp" >
<jsp:param name="menu" value="revisaProveedor" />
</jsp:include>




<div id="nuevo-colegio" class="content scaffold-list" role="main">
<h1><s:message code="autorizarFacturas.label" /></h1>
<form name="filtraLista" class="form-search" method="post" action="<c:url value='/factura/informeProveedorDetalle/revisar' />">
<input type="hidden" name="pagina" id="pagina" value="${pagina}" />
<input type="hidden" name="tipo" id="tipo" value="" />
<input type="hidden" name="correo" id="correo" value="" />
<input type="hidden" name="order" id="order" value="${param.order}" />
<input type="hidden" name="sort" id="sort" value="${param.sort}" />
<p class="well">
<input name="filtro" type="text" class="input-medium search-query" value="${param.filtro}">

<button type="submit" class="btn"><i class="icon-search"></i> <s:message code="buscar.label" /></button>
</p> </form>
<form:form commandName="informeProveedorDetalle" action="autorizar" method="get" >
<form:errors path="*">
<div class="alert alert-block alert-error fade in" role="status">
<a class="close" data-dismiss="alert">×</a>
<c:forEach items="${messages}" var="message">
<p>${message}</p>
</c:forEach>
</div>
</form:errors>
<div class="row-fluid" style="padding-bottom: 10px;">

<table id="lista" class="table table-striped table-hover">
<thead>
<tr>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="folio" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="proveedor" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="rfc" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="iva" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="subtotal" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="total" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="status" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="fechaFactura" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="informeProveedor" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="xml" />
</jsp:include>
<jsp:include page="/WEB-INF/jsp/columnaOrdenada.jsp" >
<jsp:param name="columna" value="pdf" />
</jsp:include>
</tr>
</thead>
<tbody>
<c:forEach items="${informesProveedorDetalle}" var="informeProveedorDetalle" varStatus="status">
<tr class="${status.index % 2 == 0 ? 'even' : 'odd'}">
<td>${informeProveedorDetalle.folioFactura}</td>
<td>${informeProveedorDetalle.nombreProveedor}</td>
<td>${informeProveedorDetalle.RFCProveedor}</td>
<td>${informeProveedorDetalle.IVA}</td>
<td>${informeProveedorDetalle.subtotal}</td>
<td>${informeProveedorDetalle.total}</td>
<td>${informeProveedorDetalle.statusTexto}</td>
<td>${informeProveedorDetalle.fechaFactura}</td>
<td>${informeProveedorDetalle.informeProveedor.id}</td>
<td ><input type="checkbox" disabled="true" <c:if test="${informeProveedorDetalle.pathXMl!= null && !informeProveedorDetalle.pathXMl.isEmpty()}">checked="checked"</c:if> /></td>
<td ><input type="checkbox" disabled="true" <c:if test="${informeProveedorDetalle.pathPDF!= null && !informeProveedorDetalle.pathPDF.isEmpty()}">checked="checked"</c:if> /></td>
<td><a href="<c:url value='/factura/informeProveedorDetalle/downloadPdfFile/${informeProveedorDetalle.id}' />">PDF</td>
<td><a href="<c:url value='/factura/informeProveedorDetalle/downloadXmlFile/${informeProveedorDetalle.id}' />">XML</a></td>
</tr>
</c:forEach>
</tbody>
</table>


</form:form>
</div>
<content>
<%--
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> --%>
<script>
$(document).ready(function() {
$('input#nombre').focus();
$("input#fechaFactura").datepicker($.datepicker.regional['es']);
$("input#fechaFactura").datepicker("option", "firstDay", 0);
});
$(document).ready(function() {
//add more file components if Add is clicked
$('#addFile').click(function() {
var fileIndex = $('#fileTable tr').children().length - 1;
$('#fileTable').append(
'<tr><td>' +
' <input type="file" name="files[' + fileIndex + ']" />' +
'</td></tr>');
});
});
</script>

</content>
</body>
</html>
3 changes: 3 additions & 0 deletions src/main/webapp/WEB-INF/jsp/factura/menu.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<li<c:if test="${param.menu eq 'informe'}"> class="active"</c:if>><a href="<s:url value='/factura/informe'/>" ><s:message code="informe.lista.label" /></a></li>
<li<c:if test="${param.menu eq 'revisa'}"> class="active"</c:if>><a href="<s:url value='/factura/informe/encabezados'/>" ><s:message code="revisarEmpleado.label" /></a></li>
</sec:authorize>
<sec:authorize access="hasRole('ROLE_PRV_COMPRAS')">
<li<c:if test="${param.menu eq 'revisaProveedor'}"> class="active"</c:if>><a href="<s:url value='/factura/informeProveedorDetalle/revisarFacturasCompras'/>" ><s:message code="revisarProveedor.label" /></a></li>
</sec:authorize>
<sec:authorize access="hasRole('ROLE_PRV_VALIDA')">
<li<c:if test="${param.menu eq 'revisaProveedor'}"> class="active"</c:if>><a href="<s:url value='/factura/informeProveedorDetalle/revisar'/>" ><s:message code="revisarProveedor.label" /></a></li>
<li<c:if test="${param.menu eq 'proveedorFacturas'}"> class="active"</c:if>><a href="<s:url value='/factura/proveedorFacturas'/>" ><s:message code="proveedor.label" /></a></li>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/jsp/menu.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<nav class="navbar navbar-fixed-top" role="navigation">
<ul class="nav">
<li<c:if test="${param.menu eq 'principal'}"> class="active"</c:if>><a href="<c:url value='/inicio' />"><s:message code="inicio.label" /></a></li>
<sec:authorize access="!hasAnyRole('ROLE_PRV_VALIDA','ROLE_PRV_GENERA','ROLE_PRV_USER')">
<sec:authorize access="!hasAnyRole('ROLE_PRV_VALIDA','ROLE_PRV_GENERA','ROLE_PRV_USER', 'ROLE_PRV_COMPRAS')">
<li><a href="<c:url value='/admin' />"><s:message code="admin.label" /></a></li>
<li><a href="<c:url value='/inventario' />"><s:message code="inventario.label" /></a></li>
<li><a href="<c:url value='/activoFijo' />"><s:message code="activoFijo.label" /></a></li>
Expand All @@ -15,7 +15,7 @@
<li><a href="<c:url value='/colportaje' />"><s:message code="colportaje.label" /></a></li>
<li><a href="<c:url value='/nomina' />"><s:message code="nomina.label" /></a></li>
</sec:authorize>
<sec:authorize access="hasAnyRole('ROLE_PRV_VALIDA','ROLE_PRV_GENERA','ROLE_PRV_USER')">
<sec:authorize access="hasAnyRole('ROLE_PRV_VALIDA','ROLE_PRV_GENERA','ROLE_PRV_USER','ROLE_PRV_COMPRAS')">
<li><a href="<c:url value='/factura' />"><s:message code="factura.label" /></a></li>
</sec:authorize>
</ul>
Expand Down

0 comments on commit 8ce4d72

Please sign in to comment.