Commit c40005e39f26bce92eff2ec55cbfb276c44f0338

Authored by Ronan Tavares Camargo
1 parent 0927fb8f
Exists in master

Redmine #4832

citgrp-patrimonio-web/src/main/java/br/com/centralit/listener/StartupListenerPatrimonio.java
@@ -745,6 +745,8 @@ public class StartupListenerPatrimonio extends UtilStartup implements Applicatio @@ -745,6 +745,8 @@ public class StartupListenerPatrimonio extends UtilStartup implements Applicatio
745 internacionalizacaoList.add(new Internacionalizacao("VALIDACAO.EXCLUSAO_TRANSFERENCIA_IMPOSSIVEL" , "Não é possível excluir a transferência, pois houve movimentação após a transferência!", dominio, modulo)); 745 internacionalizacaoList.add(new Internacionalizacao("VALIDACAO.EXCLUSAO_TRANSFERENCIA_IMPOSSIVEL" , "Não é possível excluir a transferência, pois houve movimentação após a transferência!", dominio, modulo));
746 internacionalizacaoList.add(new Internacionalizacao("PATRIMONIO.MSG.ACAO_ALTERAR_STATUS", "Esta ação irá realizar uma alteração de status do bem patrimonial", dominio, modulo)); 746 internacionalizacaoList.add(new Internacionalizacao("PATRIMONIO.MSG.ACAO_ALTERAR_STATUS", "Esta ação irá realizar uma alteração de status do bem patrimonial", dominio, modulo));
747 internacionalizacaoList.add(new Internacionalizacao("PATRIMONIO.MSG.SELECIONE_ALTERAR_STATUS", "Selecione um status para realizar a alteração.", dominio, modulo)); 747 internacionalizacaoList.add(new Internacionalizacao("PATRIMONIO.MSG.SELECIONE_ALTERAR_STATUS", "Selecione um status para realizar a alteração.", dominio, modulo));
  748 + internacionalizacaoList.add(new Internacionalizacao("PATRIMONIO.MSG.CARREGAR_VIDA_UTIL_CONTA_CONTABIL", "Carregar vida útil configurada na conta contábil do material", dominio, modulo));
  749 + internacionalizacaoList.add(new Internacionalizacao("PATRIMONIO.MSG.CARREGAR_TAXA_RESIDUAL_CONTA_CONTABIL", "Carregar taxa residual configurada na conta contábil do material", dominio, modulo));
748 } 750 }
749 751
750 } 752 }
citgrp-patrimonio-web/src/main/webapp/assets/js/angular/custom/controller/EntradaController.js
@@ -1211,6 +1211,18 @@ citApp.controller('EntradaController', ['$scope', '$timeout', 'FileUploader', 'E @@ -1211,6 +1211,18 @@ citApp.controller('EntradaController', ['$scope', '$timeout', 'FileUploader', 'E
1211 $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS')); 1211 $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'));
1212 } 1212 }
1213 }; 1213 };
  1214 +
  1215 + $scope.loadTaxaResidual = function(){
  1216 + ContaContabilRepository.findContaContabilPorMaterial($scope.entradaItem.material.id).then(function(result) {
  1217 + $scope.bemPatrimonial.percentualNaoDepreciavel = result.percentualNaoDepreciavel;
  1218 + });
  1219 + }
  1220 +
  1221 + $scope.loadVidaUtil = function(){
  1222 + ContaContabilRepository.findContaContabilPorMaterial($scope.entradaItem.material.id).then(function(result) {
  1223 + $scope.bemPatrimonial.vidaUtilOriginal = result.vidaUtil;
  1224 + });
  1225 + }
1214 1226
1215 $scope.salvaBensTemp = function(entradaItemId) { 1227 $scope.salvaBensTemp = function(entradaItemId) {
1216 if ($scope.entradaItemSelect.bensPatrimoniaisMaterial && $scope.entradaItemSelect.bensPatrimoniaisMaterial.length > 0) { 1228 if ($scope.entradaItemSelect.bensPatrimoniaisMaterial && $scope.entradaItemSelect.bensPatrimoniaisMaterial.length > 0) {
@@ -1732,22 +1744,6 @@ citApp.controller('EntradaController', ['$scope', '$timeout', 'FileUploader', 'E @@ -1732,22 +1744,6 @@ citApp.controller('EntradaController', ['$scope', '$timeout', 'FileUploader', 'E
1732 }); 1744 });
1733 1745
1734 //Watch para calcular valor unitario 1746 //Watch para calcular valor unitario
1735 - $scope.$watch('entradaItem.material', function() {  
1736 - $timeout(function() {  
1737 - if ($scope.step == 1 && $scope.entrada.dominioTipoRecebimento.codigo == 3 && ($scope.entradaItem && ($scope.entradaItem.material &&  
1738 - $scope.entradaItem.material.id))) {  
1739 - ContaContabilRepository.findContaContabilPorMaterial($scope.entradaItem.material.id).then(function(result) {  
1740 - $scope.bemPatrimonial.percentualNaoDepreciavel = result.percentualNaoDepreciavel;  
1741 - });  
1742 - } else {  
1743 - if ($scope.bemPatrimonial) {  
1744 - $scope.bemPatrimonial.percentualNaoDepreciavel = null;  
1745 - }  
1746 - }  
1747 - });  
1748 - });  
1749 -  
1750 - //Watch para calcular valor unitario  
1751 $scope.$watch('entradaItemSelect.entradaItem', function() { 1747 $scope.$watch('entradaItemSelect.entradaItem', function() {
1752 1748
1753 if($scope.step == 2) { 1749 if($scope.step == 2) {
citgrp-patrimonio-web/src/main/webapp/html/entrada/dialog_entrada_item.html
@@ -2,8 +2,7 @@ @@ -2,8 +2,7 @@
2 <div class="modal-header"> 2 <div class="modal-header">
3 <button class="btn btn-clear" type="button" ng-hide="!editaInfoEntrada" ng-click="addEntradaItem(formEntradaItem, numeroPatrimonialInicial)"> 3 <button class="btn btn-clear" type="button" ng-hide="!editaInfoEntrada" ng-click="addEntradaItem(formEntradaItem, numeroPatrimonialInicial)">
4 <i class="fa fa-save green"></i> 4 <i class="fa fa-save green"></i>
5 - <translate ng-show="!entradaItem.id">LABEL.SALVAR</translate>  
6 - <translate ng-show="entradaItem.id">LABEL.SALVAR_ALTERACAO_ITEM</translate> 5 + <translate>LABEL.SALVAR</translate>
7 </button> 6 </button>
8 7
9 <button title="{{$translate.instant('LABEL.CANCELAR')}}" alt="{{$translate.instant('LABEL.CANCELAR')}}" ng-click="$dismiss('cancel');" class="btn btn-clear" ng-if="editaInfoEntrada" type="button"> 8 <button title="{{$translate.instant('LABEL.CANCELAR')}}" alt="{{$translate.instant('LABEL.CANCELAR')}}" ng-click="$dismiss('cancel');" class="btn btn-clear" ng-if="editaInfoEntrada" type="button">
@@ -92,14 +91,31 @@ @@ -92,14 +91,31 @@
92 </div> 91 </div>
93 92
94 <div class="col-sm-2" ng-if="entrada.dominioTipoRecebimento.codigo == 3"> 93 <div class="col-sm-2" ng-if="entrada.dominioTipoRecebimento.codigo == 3">
95 - <label-input-number ng-max-number="10000" ng-min-number="0" ng-type="text"  
96 - ng-id="bemPatrimonial.vidaUtil" ng-obrigatorio="entrada.dominioTipoRecebimento.codigo == 3"  
97 - ng-label="LABEL.VIDA_UTIL_EM_MESES" ng-disabled="!edit" ng-model="bemPatrimonial.vidaUtilOriginal" ng-custom-maxlength="5"/> 94 + <label for="bemPatrimonial.vidaUtil"
  95 + ng-class="{'has-error': formEntradaItem['bemPatrimonial.vidaUtil'].$error.required && (!formEntradaItem['bemPatrimonial.vidaUtil'].$pristine || formEntradaItem.$submitted)}">
  96 + <translate>LABEL.VIDA_UTIL_EM_MESES</translate>
  97 + <span class='red'>*</span>
  98 + <i ng-if="formEntradaItem['bemPatrimonial.vidaUtil'].$error.required && (!formEntradaItem['bemPatrimonial.vidaUtil'].$pristine || formEntradaItem.$submitted)" class='fa fa-warning red' tooltip="{{$translate.instant('LABEL.VIDA_UTIL_EM_MESES')}} {{$translate.instant('LABEL.CAMPO_OBRIGATORIO')}}"></i>
  99 + <i class="fa fa-download black" style="cursor: pointer;" ng-click="loadVidaUtil()"
  100 + tooltip="{{$translate.instant('PATRIMONIO.MSG.CARREGAR_VIDA_UTIL_CONTA_CONTABIL')}}" ng-if="entradaItem.material.id"></i>
  101 + </label>
  102 + <label-input-number ng-max-number="10000" ng-min-number="0" ng-type="text"
  103 + ng-id="bemPatrimonial.vidaUtil" ng-obrigatorio="true" form="formEntradaItem"
  104 + ng-disabled="!edit" ng-model="bemPatrimonial.vidaUtilOriginal" ng-custom-maxlength="5"/>
98 </label-input-number> 105 </label-input-number>
99 - </div> 106 + </div>
  107 +
100 <div class="col-sm-2" ng-if="entrada.dominioTipoRecebimento.codigo == 3"> 108 <div class="col-sm-2" ng-if="entrada.dominioTipoRecebimento.codigo == 3">
101 - <label-input-percent ng-type="text" only-number ng-max-number="100" ng-min-number="0" ng-precision-number="2" ng-id="bemPatrimonial.percentualNaoDepreciavel" ng-obrigatorio="entrada.dominioTipoRecebimento.codigo == 3"  
102 - ng-label="PATRIMONIO.LABEL.TAXA_RESIDUAL" ng-disabled="!edit" ng-model="bemPatrimonial.percentualNaoDepreciavel"/> 109 + <label for="bemPatrimonial.percentualNaoDepreciavel"
  110 + ng-class="{'has-error': formEntradaItem['bemPatrimonial.percentualNaoDepreciavel'].$error.required && (!formEntradaItem['bemPatrimonial.percentualNaoDepreciavel'].$pristine || formEntradaItem.$submitted)}">
  111 + <translate>PATRIMONIO.LABEL.TAXA_RESIDUAL</translate>
  112 + <span class='red'>*</span>
  113 + <i ng-if="formEntradaItem['bemPatrimonial.percentualNaoDepreciavel'].$error.required && (!formEntradaItem['bemPatrimonial.percentualNaoDepreciavel'].$pristine || formEntradaItem.$submitted)" class='fa fa-warning red' tooltip="{{$translate.instant('PATRIMONIO.LABEL.TAXA_RESIDUAL')}} {{$translate.instant('LABEL.CAMPO_OBRIGATORIO')}}"></i>
  114 + <i class="fa fa-download black" style="cursor: pointer;" ng-click="loadTaxaResidual()"
  115 + tooltip="{{$translate.instant('PATRIMONIO.MSG.CARREGAR_TAXA_RESIDUAL_CONTA_CONTABIL')}}" ng-if="entradaItem.material.id"></i>
  116 + </label>
  117 + <label-input-percent ng-type="text" only-number ng-max-number="100" ng-min-number="0" ng-precision-number="2" ng-id="bemPatrimonial.percentualNaoDepreciavel" ng-obrigatorio="true"
  118 + ng-disabled="!edit" ng-model="bemPatrimonial.percentualNaoDepreciavel" form="formEntradaItem"/>
103 </div> 119 </div>
104 </div> <!-- .row --> 120 </div> <!-- .row -->
105 </fieldset> 121 </fieldset>