Merge pull request 'fixes bug#AL-3977' (!435) from AL-AL-3977 into master
Reviewed-on: adm/VentaBoletosAdm#435 Reviewed-by: fabio <fabio.faria@rjconsultores.com.br>master
commit
8a2694b035
|
@ -7,7 +7,6 @@ import java.math.BigDecimal;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -216,73 +215,6 @@ public class RelatorioBilhetesVendidosEstoqueAgenciaNovoLayout extends Relatorio
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<RelatorioBilhetesVendidosEstoqueAgenciaBean> agruparSequenciasBilhetes(List<RelatorioBilhetesVendidosEstoqueAgenciaBean> lista) {
|
|
||||||
|
|
||||||
|
|
||||||
int[] bilhetesInt = new int[lista.size()];
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for (RelatorioBilhetesVendidosEstoqueAgenciaBean relatorioBilhetesVendidosEstoqueAgenciaBean : lista) {
|
|
||||||
bilhetesInt[i] = Integer.parseInt(relatorioBilhetesVendidosEstoqueAgenciaBean.getFolio());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
Arrays.sort(bilhetesInt);
|
|
||||||
List<RelatorioBilhetesVendidosEstoqueAgenciaBean> listaAgrupada = new ArrayList<>();
|
|
||||||
|
|
||||||
RelatorioBilhetesVendidosEstoqueAgenciaBean bean = lista.get(0);
|
|
||||||
|
|
||||||
bilhetesInt = reajustarPosicaoArray(bilhetesInt.length, bilhetesInt, bilhetesInt[0], 1);
|
|
||||||
int inicio = bilhetesInt[0];
|
|
||||||
int fim = bilhetesInt.length == 1 ? bilhetesInt[0] : bilhetesInt[1];
|
|
||||||
BigDecimal valorContabil = BigDecimal.ZERO;
|
|
||||||
for (int j = 2; j < bilhetesInt.length; ++j) {
|
|
||||||
if (fim + 1 == bilhetesInt[j]) {
|
|
||||||
fim++;
|
|
||||||
} else {
|
|
||||||
listaAgrupada.add(gerarAgrupamento(inicio, fim, new RelatorioBilhetesVendidosEstoqueAgenciaBean(bean)));
|
|
||||||
inicio = bilhetesInt[j];
|
|
||||||
fim = bilhetesInt[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
listaAgrupada.add(gerarAgrupamento(inicio, fim, bean));
|
|
||||||
|
|
||||||
return listaAgrupada;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private RelatorioBilhetesVendidosEstoqueAgenciaBean gerarAgrupamento(int inicio, int fim, RelatorioBilhetesVendidosEstoqueAgenciaBean bean) {
|
|
||||||
|
|
||||||
RelatorioBilhetesVendidosEstoqueAgenciaBean object = new RelatorioBilhetesVendidosEstoqueAgenciaBean(bean);
|
|
||||||
|
|
||||||
|
|
||||||
if (inicio != fim) {
|
|
||||||
object.setQuantidade((fim-inicio+1));
|
|
||||||
object.setFolioInicial(inicio);
|
|
||||||
object.setFolioFinal(fim);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
object.setQuantidade(1);
|
|
||||||
object.setFolioInicial(inicio);
|
|
||||||
object.setFolioFinal(inicio);
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
private int[] reajustarPosicaoArray(int numero, int arr[],int x, int posicao)
|
|
||||||
{
|
|
||||||
int novoArray[] = new int[numero + 1];
|
|
||||||
|
|
||||||
for (int i = 0; i < numero + 1; i++) {
|
|
||||||
if (i < posicao - 1)
|
|
||||||
novoArray[i] = arr[i];
|
|
||||||
else if (i == posicao - 1)
|
|
||||||
novoArray[i] = x;
|
|
||||||
else
|
|
||||||
novoArray[i] = arr[i - 1];
|
|
||||||
}
|
|
||||||
return novoArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processaParametros() throws Exception {
|
protected void processaParametros() throws Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue