package br.com.ec.domain.dto;
import java.util.ArrayList;
import java.util.List;
public class AlertasComprasDTO
{
private List<AlertasComprasGeralDTO
> alertasComprasGeralDTO
;
public AlertasComprasDTO
() {
alertasComprasGeralDTO =
new ArrayList<AlertasComprasGeralDTO
>();
}
public List<AlertasComprasGeralDTO
> getAlertasComprasGeralDTO
() {
return alertasComprasGeralDTO
;
}
public void setAlertasComprasGeralDTO
(List<AlertasComprasGeralDTO
> alertasComprasGeralDTO
) {
this.
alertasComprasGeralDTO = alertasComprasGeralDTO
;
}
/****************************************************************/
public Integer getQuantidadeTotalAlertasComprasGeral
() {
Integer quantidadeTotalAlertas =
0;
for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO
()) {
quantidadeTotalAlertas += alertasComprasGeralDTO.
getQuantidadeTotalAlertas();
}
return quantidadeTotalAlertas
;
}
public Integer getQuantidadeTotalAlertasPossiveisComprasGeral
() {
Integer quantidadeTotalAlertasPossiveis =
0;
for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO
()) {
quantidadeTotalAlertasPossiveis += alertasComprasGeralDTO.
getQuantidadeTotalAlertasPossiveis();
}
return quantidadeTotalAlertasPossiveis
;
}
public Integer getQuantidadeTotalAlertasCriticos
() {
Integer quantidadeTotalAlertasCriticos =
0;
for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO
()) {
quantidadeTotalAlertasCriticos += alertasComprasGeralDTO.
getQuantidadeAlertasCriticos();
}
return quantidadeTotalAlertasCriticos
;
}
public Integer getQuantidadeTotalAlertasSemPedidoCompra
() {
Integer quantidadeTotalAlertasSemPedidoCompra =
0;
for (AlertasComprasGeralDTO alertasComprasGeralDTO : getAlertasComprasGeralDTO
()) {
quantidadeTotalAlertasSemPedidoCompra += alertasComprasGeralDTO.
getQuantidadeAlertasSemPedidoCompra();
}
return quantidadeTotalAlertasSemPedidoCompra
;
}
public Double percentualAlertasComprasGeral
() {
Double percentual =
new Double(getQuantidadeTotalAlertasComprasGeral
())/
new Double(getQuantidadeTotalAlertasPossiveisComprasGeral
());
return 100 -
(percentual
* 100.0);
}
public String corPercentualAlertaComprasGeral
() {
Double percentual = percentualAlertasComprasGeral
();
if (percentual
> 90.0) {
return "green-haze";
}
if (percentual
> 50.0) {
return "orange";
}
return "red";
}
}