Subversion Repositories Integrator Subversion

Rev

Rev 582 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
582 blopes 1
package br.com.ec.domain.dto;
2
 
3
import java.util.ArrayList;
4
import java.util.List;
5
 
6
public class AlertasComprasDTO {
7
 
588 blopes 8
        private List<AlertasComprasGeralDTO> alertasComprasGeralDTO;
9
 
582 blopes 10
        public AlertasComprasDTO() {
588 blopes 11
                alertasComprasGeralDTO = new ArrayList<AlertasComprasGeralDTO>();
582 blopes 12
        }
13
 
588 blopes 14
        public List<AlertasComprasGeralDTO> getAlertasComprasGeralDTO() {
15
                return alertasComprasGeralDTO;
582 blopes 16
        }
588 blopes 17
        public void setAlertasComprasGeralDTO(List<AlertasComprasGeralDTO> alertasComprasGeralDTO) {
18
                this.alertasComprasGeralDTO = alertasComprasGeralDTO;
582 blopes 19
        }
20
 
588 blopes 21
        /****************************************************************/
582 blopes 22
 
588 blopes 23
        public Integer getQuantidadeTotalAlertasComprasGeral() {
582 blopes 24
                Integer quantidadeTotalAlertas = 0;
588 blopes 25
                for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) {
26
                        quantidadeTotalAlertas += alertasComprasGeralDTO.getQuantidadeTotalAlertas();
582 blopes 27
                }
28
                return quantidadeTotalAlertas;
29
        }
30
 
588 blopes 31
        public Integer getQuantidadeTotalAlertasPossiveisComprasGeral() {
582 blopes 32
                Integer quantidadeTotalAlertasPossiveis = 0;
588 blopes 33
                for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) {
34
                        quantidadeTotalAlertasPossiveis += alertasComprasGeralDTO.getQuantidadeTotalAlertasPossiveis();
582 blopes 35
                }
588 blopes 36
                return quantidadeTotalAlertasPossiveis;
582 blopes 37
        }
38
 
588 blopes 39
        public Integer getQuantidadeTotalAlertasCriticos() {
40
                Integer quantidadeTotalAlertasCriticos = 0;
41
                for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) {
42
                        quantidadeTotalAlertasCriticos += alertasComprasGeralDTO.getQuantidadeAlertasCriticos();
43
                }
44
                return quantidadeTotalAlertasCriticos;
45
        }
46
 
47
        public Integer getQuantidadeTotalAlertasSemPedidoCompra() {
48
                Integer quantidadeTotalAlertasSemPedidoCompra = 0;
49
                for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO()) {
50
                        quantidadeTotalAlertasSemPedidoCompra += alertasComprasGeralDTO.getQuantidadeAlertasSemPedidoCompra();
51
                }
52
                return quantidadeTotalAlertasSemPedidoCompra;
53
        }
54
 
55
        public Double percentualAlertasComprasGeral() {
56
                Double percentual = new Double(getQuantidadeTotalAlertasComprasGeral())/new Double(getQuantidadeTotalAlertasPossiveisComprasGeral());
582 blopes 57
                return 100 - (percentual * 100.0);
58
        }
59
 
588 blopes 60
        public String corPercentualAlertaComprasGeral() {
61
                Double percentual = percentualAlertasComprasGeral();
582 blopes 62
                if (percentual > 90.0) {
63
                        return "green-haze";
64
                }
65
                if (percentual > 50.0) {
66
                        return "orange";
67
                }
68
                return "red";
69
        }
70
 
71
}