Commit c6232142cc0d1551374f3622b2f62d3db5928389
1 parent
986d8843
Exists in
master
Redmine #tarefa-5046
Showing
9 changed files
with
86 additions
and
41 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/RequisicaoConsumoDao.java
| ... | ... | @@ -9,7 +9,6 @@ import br.com.centralit.api.model.MaterialConsumo; |
| 9 | 9 | import br.com.centralit.api.model.RequisicaoConsumo; |
| 10 | 10 | import br.com.centralit.api.viewHelper.RequisicaoVH; |
| 11 | 11 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; |
| 12 | -import br.com.centralit.framework.model.Dominio; | |
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * <p> | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/impl/RequisicaoConsumoDaoHibernate.java
| ... | ... | @@ -19,7 +19,6 @@ import br.com.centralit.api.model.RequisicaoConsumoItem; |
| 19 | 19 | import br.com.centralit.api.viewHelper.RequisicaoVH; |
| 20 | 20 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
| 21 | 21 | import br.com.centralit.framework.dao.arquitetura.SearchSeven; |
| 22 | -import br.com.centralit.framework.model.Dominio; | |
| 23 | 22 | import br.com.centralit.framework.util.UtilColecao; |
| 24 | 23 | import br.com.centralit.framework.util.UtilObjeto; |
| 25 | 24 | import br.com.centralit.framework.util.UtilString; | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/BeanRequisicaoSubReport.java
| ... | ... | @@ -14,7 +14,9 @@ public class BeanRequisicaoSubReport { |
| 14 | 14 | private String atendidaEm; |
| 15 | 15 | private String cadEm; |
| 16 | 16 | private String centroCustos; |
| 17 | + private Boolean isAsterisco; | |
| 17 | 18 | private JRBeanCollectionDataSource materiais; |
| 19 | + private JRBeanCollectionDataSource resumoContabil; | |
| 18 | 20 | |
| 19 | 21 | public BeanRequisicaoSubReport(Object[] objArray) { |
| 20 | 22 | this.numeroRequisicao = (String) objArray[0]; |
| ... | ... | @@ -69,5 +71,22 @@ public class BeanRequisicaoSubReport { |
| 69 | 71 | |
| 70 | 72 | public void setMateriais(JRBeanCollectionDataSource materiais) { |
| 71 | 73 | this.materiais = materiais; |
| 72 | - } | |
| 74 | + } | |
| 75 | + | |
| 76 | + public Boolean getIsAsterisco() { | |
| 77 | + return isAsterisco; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setIsAsterisco(Boolean isAsterisco) { | |
| 81 | + this.isAsterisco = isAsterisco; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public JRBeanCollectionDataSource getResumoContabil() { | |
| 85 | + return resumoContabil; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setResumoContabil(JRBeanCollectionDataSource resumoContabil) { | |
| 89 | + this.resumoContabil = resumoContabil; | |
| 90 | + } | |
| 91 | + | |
| 73 | 92 | } | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/ReportGuiaRemessaAtendimentoConsumoController.java
| ... | ... | @@ -122,15 +122,14 @@ public class ReportGuiaRemessaAtendimentoConsumoController extends GenericContro |
| 122 | 122 | */ |
| 123 | 123 | @RequestMapping(method = RequestMethod.GET, value = "/imprimirRelatorio") |
| 124 | 124 | @ResponseBody |
| 125 | - public void gerarPdfConsumoPorPeriodo(@RequestParam(value = "idsRequisicao", required = false) Long requisicaoId, | |
| 125 | + public void gerarPdfConsumoPorPeriodo(@RequestParam(value = "requisicaoIds", required = false) Long[] requisicaoIds, | |
| 126 | 126 | @RequestParam(value = "download") boolean download, HttpServletResponse response) throws SQLException, JRException, IOException { |
| 127 | - | |
| 127 | + | |
| 128 | 128 | ByteArrayOutputStream baos = null; |
| 129 | 129 | InputStream input = null; |
| 130 | 130 | InputStream inputSub = null; |
| 131 | 131 | try { |
| 132 | 132 | is_FIFO = configuracaoParametroSistemaService.getParametro("TIPO_AVALIACAO_MONETARIA_ESTOQUE").getValor().equals(FIFO); |
| 133 | - final boolean isFinalizada = requisicaoConsumoService.findtipoStatusRequisicaoPorMaterial(requisicaoId).equals("FINALIZADA"); | |
| 134 | 133 | |
| 135 | 134 | Usuario usuarioLogado = (Usuario) usuarioService.find(((Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal() ).getId()); |
| 136 | 135 | Long organizacaoId = usuarioLogado.getOrganizacao().getId(); |
| ... | ... | @@ -145,7 +144,6 @@ public class ReportGuiaRemessaAtendimentoConsumoController extends GenericContro |
| 145 | 144 | JasperReport jasperReportSub = JasperCompileManager.compileReport(jasperDesignSub); |
| 146 | 145 | |
| 147 | 146 | Map<String, Object> parameters = new HashMap<String, Object>(); |
| 148 | - Map<String, Object> parametersSubReport = new HashMap<String, Object>(); | |
| 149 | 147 | parameters.put("TITULO", titulo); |
| 150 | 148 | parameters.put("SUBREPORT_DIR", jasperReportSub); |
| 151 | 149 | |
| ... | ... | @@ -158,23 +156,23 @@ public class ReportGuiaRemessaAtendimentoConsumoController extends GenericContro |
| 158 | 156 | |
| 159 | 157 | List<BeanRequisicaoSubReport> beanReqSubList = new ArrayList<BeanRequisicaoSubReport>(); |
| 160 | 158 | |
| 161 | - BeanRequisicaoSubReport beanSubReport = new BeanRequisicaoSubReport(requisicaoConsumoService.getRequisicaoForReport(requisicaoId)); | |
| 162 | - beanSubReport.setMateriais(getMateriais(requisicaoId)); | |
| 163 | - beanReqSubList.add(beanSubReport); | |
| 159 | + for(Long reqId : requisicaoIds){ | |
| 160 | + boolean isFinalizada = requisicaoConsumoService.findtipoStatusRequisicaoPorMaterial(reqId).equals("FINALIZADA"); | |
| 161 | + | |
| 162 | + BeanRequisicaoSubReport beanSubReport = new BeanRequisicaoSubReport(requisicaoConsumoService.getRequisicaoForReport(reqId)); | |
| 163 | + beanSubReport.setMateriais(getMateriais(reqId)); | |
| 164 | + if(isFinalizada) | |
| 165 | + beanSubReport.setResumoContabil(getResumoContabil(reqId)); | |
| 166 | + | |
| 167 | + beanSubReport.setIsAsterisco(!isFinalizada); | |
| 168 | + | |
| 169 | + beanReqSubList.add(beanSubReport); | |
| 170 | + } | |
| 164 | 171 | |
| 165 | 172 | parameters.put("BEAN_SUB_REPORT",new JRBeanCollectionDataSource(beanReqSubList)); |
| 166 | 173 | |
| 167 | - if(isFinalizada) | |
| 168 | - parametersSubReport.put("REQ_CONSUMO", getResumoContabil(requisicaoId)); | |
| 169 | - | |
| 170 | - parametersSubReport.put("is_asterisco",!isFinalizada); | |
| 171 | - | |
| 172 | - parameters.put("SUBREPORT_PARAMETERS_MAP",parametersSubReport); | |
| 173 | - | |
| 174 | - | |
| 175 | 174 | List<BeanReportVH> beans = new ArrayList<BeanReportVH>(); |
| 176 | 175 | beans.add(bean); |
| 177 | - | |
| 178 | 176 | JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JRBeanCollectionDataSource(beans)); |
| 179 | 177 | |
| 180 | 178 | // Responsavel por verificar a presenca de dados no relatorio | ... | ... |
cit-almoxarifado-web/src/main/resources/reports/guiaRemessaAtendimentoConsumoMaterial.jrxml
| ... | ... | @@ -75,7 +75,7 @@ |
| 75 | 75 | <field name="valorTotal" class="java.lang.String"/> |
| 76 | 76 | <field name="valorUnitario" class="java.lang.String"/> |
| 77 | 77 | </subDataset> |
| 78 | - <subDataset name="requiConsumo" uuid="19bcb161-6822-4c00-aef7-cd1b122f60ba"> | |
| 78 | + <subDataset name="resumoContabil" uuid="19bcb161-6822-4c00-aef7-cd1b122f60ba"> | |
| 79 | 79 | <field name="conta" class="java.lang.String"/> |
| 80 | 80 | <field name="qtde" class="java.lang.Integer"/> |
| 81 | 81 | <field name="valorTotal" class="java.math.BigDecimal"/> |
| ... | ... | @@ -85,7 +85,7 @@ |
| 85 | 85 | </variable> |
| 86 | 86 | <variable name="total" class="java.math.BigDecimal" calculation="Sum"> |
| 87 | 87 | <variableExpression><![CDATA[$V{total}.add($F{valorTotal})]]></variableExpression> |
| 88 | - <initialValueExpression><![CDATA[0]]></initialValueExpression> | |
| 88 | + <initialValueExpression><![CDATA[new BigDecimal(0)]]></initialValueExpression> | |
| 89 | 89 | </variable> |
| 90 | 90 | </subDataset> |
| 91 | 91 | <parameter name="idContaContabil" class="java.lang.Long" isForPrompting="false"/> |
| ... | ... | @@ -98,8 +98,6 @@ |
| 98 | 98 | <parameter name="siglaOrganizacao" class="java.lang.String"/> |
| 99 | 99 | <parameter name="codigoOrganizacao" class="java.lang.String"/> |
| 100 | 100 | <parameter name="SUBREPORT_GUIA_REMESSA_DIR" class="java.lang.Object"/> |
| 101 | - <parameter name="REQ_CONSUMO" class="java.lang.Object" isForPrompting="false"/> | |
| 102 | - <parameter name="is_asterisco" class="java.lang.Boolean"/> | |
| 103 | 101 | <queryString language="SQL"> |
| 104 | 102 | <![CDATA[]]> |
| 105 | 103 | </queryString> |
| ... | ... | @@ -113,11 +111,13 @@ |
| 113 | 111 | <field name="cadEm" class="java.lang.String"/> |
| 114 | 112 | <field name="centroCustos" class="java.lang.String"/> |
| 115 | 113 | <field name="materiais" class="java.lang.Object"/> |
| 114 | + <field name="isAsterisco" class="java.lang.Boolean"/> | |
| 115 | + <field name="resumoContabil" class="java.lang.Object"/> | |
| 116 | 116 | <variable name="conta_COUNT" class="java.lang.Integer"> |
| 117 | 117 | <initialValueExpression><![CDATA[1]]></initialValueExpression> |
| 118 | 118 | </variable> |
| 119 | 119 | <group name="materiais"> |
| 120 | - <groupExpression><![CDATA[$P{REQ_CONSUMO}]]></groupExpression> | |
| 120 | + <groupExpression><![CDATA[$F{resumoContabil}]]></groupExpression> | |
| 121 | 121 | <groupHeader> |
| 122 | 122 | <band height="36"> |
| 123 | 123 | <componentElement> |
| ... | ... | @@ -125,7 +125,7 @@ |
| 125 | 125 | <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> |
| 126 | 126 | <datasetRun subDataset="materiais" uuid="4dc261e1-e4b1-4d0b-87fd-854cc68a637f"> |
| 127 | 127 | <datasetParameter name="is_asterisco"> |
| 128 | - <datasetParameterExpression><![CDATA[$P{is_asterisco}]]></datasetParameterExpression> | |
| 128 | + <datasetParameterExpression><![CDATA[$F{isAsterisco}]]></datasetParameterExpression> | |
| 129 | 129 | </datasetParameter> |
| 130 | 130 | <dataSourceExpression><![CDATA[$F{materiais}]]></dataSourceExpression> |
| 131 | 131 | </datasetRun> |
| ... | ... | @@ -320,7 +320,7 @@ |
| 320 | 320 | <textElement textAlignment="Center" verticalAlignment="Middle"> |
| 321 | 321 | <font size="7" isBold="true"/> |
| 322 | 322 | </textElement> |
| 323 | - <textFieldExpression><![CDATA[($P{is_asterisco} ? "* " : "")+"Preço Unitário" ]]></textFieldExpression> | |
| 323 | + <textFieldExpression><![CDATA[($P{is_asterisco} ? "* " : "")+"Preço Unitário"]]></textFieldExpression> | |
| 324 | 324 | </textField> |
| 325 | 325 | </jr:columnHeader> |
| 326 | 326 | <jr:detailCell style="table 1" height="15" rowSpan="1"> |
| ... | ... | @@ -340,7 +340,7 @@ |
| 340 | 340 | <textElement textAlignment="Center" verticalAlignment="Middle"> |
| 341 | 341 | <font size="7" isBold="true"/> |
| 342 | 342 | </textElement> |
| 343 | - <textFieldExpression><![CDATA[($P{is_asterisco} ? "* " : "")+"Preço Total" ]]></textFieldExpression> | |
| 343 | + <textFieldExpression><![CDATA[($P{is_asterisco} ? "* " : "")+"Preço Total"]]></textFieldExpression> | |
| 344 | 344 | </textField> |
| 345 | 345 | </jr:columnHeader> |
| 346 | 346 | <jr:detailCell style="table 1" height="15" rowSpan="1"> |
| ... | ... | @@ -363,7 +363,7 @@ |
| 363 | 363 | <band height="33"> |
| 364 | 364 | <staticText> |
| 365 | 365 | <reportElement x="0" y="10" width="792" height="20" uuid="044fb4cf-5b85-485e-9a98-20bcd9832b67"> |
| 366 | - <printWhenExpression><![CDATA[$P{is_asterisco}]]></printWhenExpression> | |
| 366 | + <printWhenExpression><![CDATA[$F{isAsterisco}]]></printWhenExpression> | |
| 367 | 367 | </reportElement> |
| 368 | 368 | <textElement textAlignment="Left" verticalAlignment="Middle"> |
| 369 | 369 | <font size="8" isBold="true"/> |
| ... | ... | @@ -507,11 +507,11 @@ |
| 507 | 507 | <band height="35"> |
| 508 | 508 | <componentElement> |
| 509 | 509 | <reportElement key="tableReqConsumo" x="0" y="0" width="792" height="35" uuid="65880be5-7337-44c9-a237-b2e3763d6486"> |
| 510 | - <printWhenExpression><![CDATA[$P{REQ_CONSUMO} != null]]></printWhenExpression> | |
| 510 | + <printWhenExpression><![CDATA[$F{resumoContabil} != null]]></printWhenExpression> | |
| 511 | 511 | </reportElement> |
| 512 | 512 | <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> |
| 513 | - <datasetRun subDataset="requiConsumo" uuid="e8bc1559-838c-4bc5-815e-07310748e682"> | |
| 514 | - <dataSourceExpression><![CDATA[$P{REQ_CONSUMO}]]></dataSourceExpression> | |
| 513 | + <datasetRun subDataset="resumoContabil" uuid="dd0fb9e3-744d-4899-b809-621ff05e9a14"> | |
| 514 | + <dataSourceExpression><![CDATA[$F{resumoContabil}]]></dataSourceExpression> | |
| 515 | 515 | </datasetRun> |
| 516 | 516 | <jr:column width="620" uuid="cce1ea6a-ea5e-43d0-84a3-37aff9de55dc"> |
| 517 | 517 | <jr:tableHeader height="20" rowSpan="1"> |
| ... | ... | @@ -593,7 +593,7 @@ |
| 593 | 593 | <font size="7" isBold="true"/> |
| 594 | 594 | <paragraph leftIndent="2" rightIndent="2" spacingBefore="2"/> |
| 595 | 595 | </textElement> |
| 596 | - <textFieldExpression><![CDATA[$V{total}]]></textFieldExpression> | |
| 596 | + <textFieldExpression><![CDATA[$V{total}.add( $F{valorTotal} )]]></textFieldExpression> | |
| 597 | 597 | </textField> |
| 598 | 598 | </jr:tableFooter> |
| 599 | 599 | <jr:columnHeader style="table 1" height="20" rowSpan="1"> | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/AtendimentoRequisicaoConsumoListController.js
| ... | ... | @@ -87,5 +87,27 @@ citApp.controller('AtendimentoRequisicaoConsumoListController', ['$scope', 'Aten |
| 87 | 87 | $scope.iniciarAtendimento = function(){ |
| 88 | 88 | angular.element('#editAtendimentoRequisicaoConsumo').scope().prepararAtendimentoRequisicoes($scope.listaSelecionados); |
| 89 | 89 | }; |
| 90 | + | |
| 91 | + //METODO REFERENTE AO RELATORIO | |
| 92 | + $scope.gerar = function() { | |
| 93 | + | |
| 94 | + if($scope.listaSelecionados.length == 0 || $scope.listaSelecionados.length > 1) | |
| 95 | + $scope.showAlert("warning", $translate.instant("MSG.SELECIONE_UM_ITEM_PARA_RELATORIO") + " ", false ); | |
| 96 | + else{ | |
| 97 | + var ids = ''; | |
| 98 | + for(var i=0 ; i < $scope.listaSelecionados.length ; i++){ | |
| 99 | + ids += $scope.listaSelecionados[i].id; | |
| 100 | + if(i < ($scope.listaSelecionados.length -1)) | |
| 101 | + ids +=','; | |
| 102 | + } | |
| 103 | + | |
| 104 | + | |
| 105 | + ids = ids.split(','); | |
| 106 | + | |
| 107 | + $scope.url = '/cit-almoxarifado-web/rest/guiaRemessa/imprimirRelatorio?requisicaoIds='+ ids; | |
| 108 | + | |
| 109 | + $scope.visualizarRelatorio($scope.url, $translate.instant("ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA")); | |
| 110 | + } | |
| 111 | + }; | |
| 90 | 112 | |
| 91 | 113 | }]); |
| 92 | 114 | \ No newline at end of file | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/RequisicaoConsumoListController.js
| ... | ... | @@ -84,17 +84,17 @@ citApp.controller('RequisicaoConsumoListController', ['$scope', 'RequisicaoConsu |
| 84 | 84 | //METODO REFERENTE AO RELATORIO |
| 85 | 85 | $scope.gerar = function() { |
| 86 | 86 | |
| 87 | - if(!$scope.requisicaoConsumoChecked){ | |
| 87 | + if(!$scope.requisicaoConsumoChecked){ | |
| 88 | 88 | |
| 89 | - $scope.showAlert("warning", $translate.instant("MSG.SELECIONE_UM_ITEM_PARA_RELATORIO") + " ", false ); | |
| 89 | + $scope.showAlert("warning", $translate.instant("MSG.SELECIONE_UM_ITEM_PARA_RELATORIO") + " ", false ); | |
| 90 | 90 | |
| 91 | - } else{ | |
| 91 | + } else{ | |
| 92 | + | |
| 93 | + $scope.url = '/cit-almoxarifado-web/rest/guiaRemessa/imprimirRelatorio?requisicaoIds='+ $scope.requisicaoConsumoChecked.id; | |
| 92 | 94 | |
| 93 | - $scope.url = '/cit-almoxarifado-web/rest/guiaRemessa/imprimirRelatorio?idsRequisicao='+ $scope.requisicaoConsumoChecked.id; | |
| 95 | + $scope.visualizarRelatorio($scope.url, $translate.instant("ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA")); | |
| 94 | 96 | |
| 95 | - $scope.visualizarRelatorio($scope.url, $translate.instant("ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA")); | |
| 96 | - | |
| 97 | - } | |
| 97 | + } | |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | 100 | }]); |
| 101 | 101 | \ No newline at end of file | ... | ... |
cit-almoxarifado-web/src/main/webapp/html/atendimentoRequisicaoConsumo/atendimentoRequisicaoConsumoList.html
| ... | ... | @@ -8,6 +8,14 @@ |
| 8 | 8 | <translate>ALMOXARIFADO.LABEL.INICIAR_ATENDIMENTO</translate> |
| 9 | 9 | </button> |
| 10 | 10 | |
| 11 | + <button title="{{$translate.instant('ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA')}}" | |
| 12 | + alt="{{$translate.instant('ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA')}}" | |
| 13 | + class="btn btn-clear" type="button" ng-disabled="false" | |
| 14 | + ng-click="gerar();"> | |
| 15 | + <i class="fa fa-print"></i> | |
| 16 | + <translate>ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA</translate> | |
| 17 | + </button> | |
| 18 | + | |
| 11 | 19 | <button ng-show="listaSelecionados.length == 1" class="btn btn-clear" ng-click="abrirVisualizar(false);"> |
| 12 | 20 | <i class="fa fa-search blue"></i> |
| 13 | 21 | <translate>LABEL.VISUALIZAR</translate> | ... | ... |
cit-almoxarifado-web/src/main/webapp/html/requisicaoConsumo/requisicaoConsumoList.html
| ... | ... | @@ -23,8 +23,8 @@ |
| 23 | 23 | <translate>LABEL.REMOVER</translate> |
| 24 | 24 | </button> |
| 25 | 25 | |
| 26 | - <button title="{{$translate.instant('PATRIMONIO.LABEL.RELATORIO_ANALITICO')}}" | |
| 27 | - alt="{{$translate.instant('PATRIMONIO.LABEL.RELATORIO_ANALITICO')}}" | |
| 26 | + <button title="{{$translate.instant('ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA')}}" | |
| 27 | + alt="{{$translate.instant('ALMOXARIFADO.LABEL.RELATORIO_GUIA_REMESSA')}}" | |
| 28 | 28 | class="btn btn-clear" type="button" ng-disabled="false" |
| 29 | 29 | ng-click="gerar();"> |
| 30 | 30 | <i class="fa fa-print"></i> | ... | ... |