Commit 63d6a8cccbf551eb7876328e3dfe1168b781f810
1 parent
d72e2600
Exists in
master
redmine #3854 Liberada a edicao de bens patrimoniais que tem sua entrada contabi…
…lizada na referência vigente
Showing
1 changed file
with
27 additions
and
1 deletions
Show diff stats
citgrp-patrimonio-web/src/main/webapp/assets/js/angular/custom/controller/BemPatrimonialListController.js
@@ -113,7 +113,7 @@ citApp.controller('BemPatrimonialListController', ['$scope', 'BemPatrimonialRepo | @@ -113,7 +113,7 @@ citApp.controller('BemPatrimonialListController', ['$scope', 'BemPatrimonialRepo | ||
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | 115 | ||
116 | - if (edit && (bemPatrimonial['dataContabil'] == null || $scope.isDataUSMaiorOuIgualReferenciaVigente(bemPatrimonial['dataContabil']))) { | 116 | + if (edit && (bemPatrimonial['dataContabil'] == null || isDataUSMaiorOuIgualReferenciaVigente(bemPatrimonial['dataContabil']))) { |
117 | $scope.showAlert('warning', $translate.instant('PATRIMONIO.VALIDACAO.EDICAO_BEM_NAO_CONTABILIZADO')); | 117 | $scope.showAlert('warning', $translate.instant('PATRIMONIO.VALIDACAO.EDICAO_BEM_NAO_CONTABILIZADO')); |
118 | 118 | ||
119 | return; | 119 | return; |
@@ -329,4 +329,30 @@ citApp.controller('BemPatrimonialListController', ['$scope', 'BemPatrimonialRepo | @@ -329,4 +329,30 @@ citApp.controller('BemPatrimonialListController', ['$scope', 'BemPatrimonialRepo | ||
329 | 329 | ||
330 | }; | 330 | }; |
331 | 331 | ||
332 | + // Verifica se a data em formato BR da referencia é maior ou igual a data da referencia vigente | ||
333 | + function isDataUSMaiorOuIgualReferenciaVigente(data) { | ||
334 | + | ||
335 | + if(data !== undefined){ | ||
336 | + var dataComparacao = null; | ||
337 | + try { | ||
338 | + dataComparacao = angular.copy(converterStringUSemDate(data)); | ||
339 | + } catch(err) { | ||
340 | + dataComparacao = angular.copy(data); | ||
341 | + } | ||
342 | + var dataVigencia = converterStringEmDate($scope.usuarioLogado.organizacao.dataReferenciaVigente); | ||
343 | + | ||
344 | + try { | ||
345 | + var retorno = false; | ||
346 | + if (dataComparacao.getFullYear() > dataVigencia.getFullYear()) { | ||
347 | + retorno = true; | ||
348 | + } else if ((dataComparacao.getFullYear() == dataVigencia.getFullYear()) && (dataComparacao.getMonth() > dataVigencia.getMonth())) { | ||
349 | + retorno = true; | ||
350 | + } | ||
351 | + return retorno; | ||
352 | + } catch(err) { | ||
353 | + return false; | ||
354 | + } | ||
355 | + } | ||
356 | + } | ||
357 | + | ||
332 | }]); | 358 | }]); |
333 | \ No newline at end of file | 359 | \ No newline at end of file |