Merge pull request 'fixes bug #AL-2518' (!186) from AL-2518 into master

Reviewed-on: adm/VentaBoletosAdm#186
Reviewed-by: fabio <fabio.faria@rjconsultores.com.br>
master
pinheiro 2023-06-05 14:56:25 +00:00
commit 03b043b431
1 changed files with 22 additions and 10 deletions

View File

@ -18,6 +18,8 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.negocio.CalculoImposto; import com.rjconsultores.ventaboletos.relatorios.negocio.CalculoImposto;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
@ -33,13 +35,17 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioComissaoSintetico extends Relatorio { public class RelatorioComissaoSintetico extends Relatorio {
private Logger log;
private List<RelatorioComissaoSinteticoBean> lsDadosRelatorio; private List<RelatorioComissaoSinteticoBean> lsDadosRelatorio;
private LinkedHashMap<String, LinkedHashMap<String, Object>> mapCacheConfigComissao; private LinkedHashMap<String, LinkedHashMap<String, Object>> mapCacheConfigComissao;
private Set<PuntoVenta> pontoVendaConfiguracao; private Set<PuntoVenta> pontoVendaConfiguracao;
public RelatorioComissaoSintetico(Map<String, Object> parametros, Connection conexao) throws Exception { public RelatorioComissaoSintetico(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao); super(parametros, conexao);
log = Logger.getLogger(RelatorioComissaoSintetico.class);
CalculoImposto.limpaCache(); CalculoImposto.limpaCache();
this.mapCacheConfigComissao = new LinkedHashMap<String, LinkedHashMap<String, Object>>(); this.mapCacheConfigComissao = new LinkedHashMap<String, LinkedHashMap<String, Object>>();
@ -269,6 +275,8 @@ private Set<PuntoVenta> pontoVendaConfiguracao;
} }
public void setLsDadosRelatorio(List<RelatorioComissaoSinteticoBean> lsDadosRelatorio) { public void setLsDadosRelatorio(List<RelatorioComissaoSinteticoBean> lsDadosRelatorio) {
if(lsDadosRelatorio!=null && !lsDadosRelatorio.isEmpty()) {
try {
lsDadosRelatorio.forEach(bean -> { lsDadosRelatorio.forEach(bean -> {
BigDecimal totalComissoes = bean.getComissaoTarifa() BigDecimal totalComissoes = bean.getComissaoTarifa()
.add(bean.getComissaoImpPosterior()) .add(bean.getComissaoImpPosterior())
@ -279,6 +287,10 @@ private Set<PuntoVenta> pontoVendaConfiguracao;
}); });
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
this.lsDadosRelatorio = lsDadosRelatorio; this.lsDadosRelatorio = lsDadosRelatorio;
}catch(ArrayIndexOutOfBoundsException e) {
log.error("Erro a gerar relatorio Comissao sintetico", e);
}
}
} }
public HashMap<String, Object> getConfigImposto(Integer empresaId, Integer estadoId) throws Exception { public HashMap<String, Object> getConfigImposto(Integer empresaId, Integer estadoId) throws Exception {