|
|
|
@ -34,7 +34,9 @@ import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import org.jboss.util.Strings;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
@ -82,7 +84,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderClaseServicio;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaModificacionMassivaTarifa;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMarca;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMoneda;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderOrgaoConcedente;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderOrgaoConcedenteModifMassPreco;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta;
|
|
|
|
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderVigenciaTarifaModificacionMassivaTarifa;
|
|
|
|
@ -158,6 +159,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
|
|
|
|
private MyListbox vigenciaTarifaList;
|
|
|
|
|
private Textbox txtPorcentagem;
|
|
|
|
|
private Radio radIncremento;
|
|
|
|
|
private Radio radAgrupamentoLinhasSim;
|
|
|
|
|
private Button btnGerarTarifas;
|
|
|
|
|
private Tab tabTipoPuntoVenta;
|
|
|
|
|
private Tab tabCategoria;
|
|
|
|
@ -307,7 +309,6 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onClick$btnGerarExcelLinear(Event ev) {
|
|
|
|
|
txtPorcentagem.getValue();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (lsAddRmvVigenciaTarifa.isEmpty()) {
|
|
|
|
@ -341,6 +342,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Estilo padrão para os dois tipos de relatórios
|
|
|
|
|
HSSFWorkbook wb = new HSSFWorkbook();
|
|
|
|
|
|
|
|
|
|
// fonte em negrito:
|
|
|
|
@ -349,175 +351,17 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
|
|
|
|
HSSFCellStyle estilo = wb.createCellStyle();
|
|
|
|
|
estilo.setFont(fonte);
|
|
|
|
|
|
|
|
|
|
// TESTE:
|
|
|
|
|
List<Object> lsRutaCombinacion = rutaCombinacionService.pesquisaTarifaObj(lsAddRmvMonedas, lsAddRmvMarcas,
|
|
|
|
|
lsAddRmvClaseServico, lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas,
|
|
|
|
|
lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa, lsAddRmvOrgaoConcedente);
|
|
|
|
|
|
|
|
|
|
HSSFSheet sheet1 = null;
|
|
|
|
|
String ruta = "";
|
|
|
|
|
int contRow = 0;
|
|
|
|
|
|
|
|
|
|
if (!lsRutaCombinacion.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < lsRutaCombinacion.size(); i++) {
|
|
|
|
|
Object[] obj = (Object[]) lsRutaCombinacion.get(i);
|
|
|
|
|
|
|
|
|
|
if (!ruta.equals(obj[4].toString().concat(obj[12].toString()))) {
|
|
|
|
|
|
|
|
|
|
ruta = obj[4].toString().concat(obj[12].toString());
|
|
|
|
|
String sheetName = "";
|
|
|
|
|
if (obj[4].toString().length() > 26) {
|
|
|
|
|
sheetName = (obj[12].toString().concat("-").concat(obj[4].toString().substring(0, 26)));
|
|
|
|
|
} else {
|
|
|
|
|
sheetName = (obj[12].toString().concat("-").concat(obj[4].toString()));
|
|
|
|
|
}
|
|
|
|
|
sheetName = sheetName.replaceAll("/", "-");
|
|
|
|
|
log.debug("Aba: " + sheetName);
|
|
|
|
|
|
|
|
|
|
sheet1 = wb.createSheet(sheetName);
|
|
|
|
|
contRow = 1;
|
|
|
|
|
|
|
|
|
|
HSSFRow rowCabecalho = sheet1.createRow(0);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell = rowCabecalho.createCell(0);
|
|
|
|
|
cell.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhId.label"));
|
|
|
|
|
cell.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell0 = rowCabecalho.createCell(1);
|
|
|
|
|
cell0.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhTramo.label"));
|
|
|
|
|
cell0.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell1 = rowCabecalho.createCell(2);
|
|
|
|
|
cell1.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
|
|
|
|
|
cell1.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell2 = rowCabecalho.createCell(3);
|
|
|
|
|
cell2.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhDestino.label"));
|
|
|
|
|
cell2.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell3 = rowCabecalho.createCell(4);
|
|
|
|
|
cell3.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhRuta.label"));
|
|
|
|
|
cell3.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell4 = rowCabecalho.createCell(5);
|
|
|
|
|
cell4.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhMarca.label"));
|
|
|
|
|
cell4.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// Preco original I - 6
|
|
|
|
|
HSSFCell cell5 = rowCabecalho.createCell(6);
|
|
|
|
|
cell5.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
|
|
|
|
|
cell5.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// H - 6
|
|
|
|
|
HSSFCell cell6 = rowCabecalho.createCell(7);
|
|
|
|
|
cell6.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
|
|
|
|
|
cell6.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// I - 8
|
|
|
|
|
HSSFCell cell7 = rowCabecalho.createCell(8);
|
|
|
|
|
cell7.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
|
|
|
|
|
cell7.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// J - 9
|
|
|
|
|
HSSFCell cell8 = rowCabecalho.createCell(9);
|
|
|
|
|
cell8.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
|
|
|
|
|
cell8.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// J - 9
|
|
|
|
|
HSSFCell cell9 = rowCabecalho.createCell(10);
|
|
|
|
|
cell9.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
|
|
|
|
|
cell9.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// h - 10
|
|
|
|
|
HSSFCell cell10 = rowCabecalho.createCell(11);
|
|
|
|
|
cell10.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
|
|
|
|
|
cell10.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell12 = rowCabecalho.createCell(12);
|
|
|
|
|
cell12.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
|
|
|
|
|
cell12.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell13 = rowCabecalho.createCell(13);
|
|
|
|
|
cell13.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
|
|
|
|
|
cell13.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell14 = rowCabecalho.createCell(14);
|
|
|
|
|
cell14.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
|
|
|
|
|
cell14.setCellStyle(estilo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HSSFRow row = sheet1.createRow(contRow++);
|
|
|
|
|
|
|
|
|
|
row.createCell(0).setCellValue(Integer.parseInt(obj[0].toString()));
|
|
|
|
|
row.createCell(1).setCellValue(obj[1].toString());
|
|
|
|
|
row.createCell(2).setCellValue(obj[2].toString());
|
|
|
|
|
row.createCell(3).setCellValue(obj[3].toString());
|
|
|
|
|
row.createCell(4).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
|
|
|
|
|
row.createCell(5).setCellValue(obj[5].toString());
|
|
|
|
|
row.createCell(6).setCellValue(obj[6].toString());
|
|
|
|
|
|
|
|
|
|
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
|
|
|
|
|
|
|
Date dataIni = (Date) obj[7];
|
|
|
|
|
Date dataFim = (Date) obj[8];
|
|
|
|
|
|
|
|
|
|
row.createCell(7).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
|
|
|
|
|
row.createCell(8).setCellValue(obj[9].toString());
|
|
|
|
|
|
|
|
|
|
String ori = getStringImporteSafe(obj[10]);
|
|
|
|
|
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
|
|
|
|
|
|
|
|
|
|
String atu = getStringImporteSafe(obj[11]);
|
|
|
|
|
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
|
|
|
|
|
|
|
|
|
|
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
|
|
|
|
|
row.createCell(10).setCellValue(atual.setScale(2).doubleValue());
|
|
|
|
|
|
|
|
|
|
String ped = getStringImporteSafe(obj[16]);
|
|
|
|
|
BigDecimal pedVal = BigDecimal.valueOf(Double.valueOf(ped));
|
|
|
|
|
row.createCell(12).setCellValue(pedVal.setScale(2).doubleValue());
|
|
|
|
|
|
|
|
|
|
row.createCell(14).setCellValue(obj[17].toString());
|
|
|
|
|
|
|
|
|
|
// novo preco:
|
|
|
|
|
BigDecimal novoPrecio = null;
|
|
|
|
|
int celulaAlterada = 0;
|
|
|
|
|
|
|
|
|
|
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TARIFA.getDescricao())){
|
|
|
|
|
novoPrecio = atual;
|
|
|
|
|
celulaAlterada = 11;
|
|
|
|
|
} else{
|
|
|
|
|
if (obj[16]==null){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[16])));
|
|
|
|
|
celulaAlterada = 13;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
|
|
HSSFCell cellNovoPrecio = row.createCell(celulaAlterada);
|
|
|
|
|
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
|
|
|
|
|
cellNovoPrecio.setCellStyle(estilo);
|
|
|
|
|
if (radAgrupamentoLinhasSim.isChecked()){
|
|
|
|
|
gerarExcelComAgrupamento(lsRutaCombinacion,wb,estilo,coeficiente);
|
|
|
|
|
} else {
|
|
|
|
|
gerarExcelSemAgrupamento(lsRutaCombinacion,wb,estilo,coeficiente);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String nomeArquivo =
|
|
|
|
|
UsuarioLogado.getUsuarioLogado().getNombusuario()
|
|
|
|
|
+ "_" + Calendar.getInstance().getTime().getTime()
|
|
|
|
@ -785,5 +629,349 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
|
|
|
|
this.lsOrgaoConcedente = lsOrgaoConcedente;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void gerarExcelSemAgrupamento(List<Object> lsRutaCombinacion, HSSFWorkbook wb, HSSFCellStyle estilo, BigDecimal coeficiente){
|
|
|
|
|
HSSFSheet sheet1 = null;
|
|
|
|
|
String ruta = "";
|
|
|
|
|
int contRow = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < lsRutaCombinacion.size(); i++) {
|
|
|
|
|
Object[] obj = (Object[]) lsRutaCombinacion.get(i);
|
|
|
|
|
|
|
|
|
|
if (!ruta.equals(obj[4].toString().concat(obj[12].toString()))) {
|
|
|
|
|
|
|
|
|
|
ruta = obj[4].toString().concat(obj[12].toString());
|
|
|
|
|
String sheetName = "";
|
|
|
|
|
if (obj[4].toString().length() > 26) {
|
|
|
|
|
sheetName = (obj[12].toString().concat("-").concat(obj[4].toString().substring(0, 26)));
|
|
|
|
|
} else {
|
|
|
|
|
sheetName = (obj[12].toString().concat("-").concat(obj[4].toString()));
|
|
|
|
|
}
|
|
|
|
|
sheetName = sheetName.replaceAll("/", "-");
|
|
|
|
|
log.debug("Aba: " + sheetName);
|
|
|
|
|
|
|
|
|
|
sheet1 = wb.createSheet(sheetName);
|
|
|
|
|
contRow = 1;
|
|
|
|
|
|
|
|
|
|
HSSFRow rowCabecalho = sheet1.createRow(0);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell = rowCabecalho.createCell(0);
|
|
|
|
|
cell.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhId.label"));
|
|
|
|
|
cell.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell0 = rowCabecalho.createCell(1);
|
|
|
|
|
cell0.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhTramo.label"));
|
|
|
|
|
cell0.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell1 = rowCabecalho.createCell(2);
|
|
|
|
|
cell1.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
|
|
|
|
|
cell1.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell2 = rowCabecalho.createCell(3);
|
|
|
|
|
cell2.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhDestino.label"));
|
|
|
|
|
cell2.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell3 = rowCabecalho.createCell(4);
|
|
|
|
|
cell3.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhRuta.label"));
|
|
|
|
|
cell3.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell4 = rowCabecalho.createCell(5);
|
|
|
|
|
cell4.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhMarca.label"));
|
|
|
|
|
cell4.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// Preco original I - 6
|
|
|
|
|
HSSFCell cell5 = rowCabecalho.createCell(6);
|
|
|
|
|
cell5.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
|
|
|
|
|
cell5.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// H - 6
|
|
|
|
|
HSSFCell cell6 = rowCabecalho.createCell(7);
|
|
|
|
|
cell6.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
|
|
|
|
|
cell6.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// I - 8
|
|
|
|
|
HSSFCell cell7 = rowCabecalho.createCell(8);
|
|
|
|
|
cell7.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
|
|
|
|
|
cell7.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// J - 9
|
|
|
|
|
HSSFCell cell8 = rowCabecalho.createCell(9);
|
|
|
|
|
cell8.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
|
|
|
|
|
cell8.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// J - 9
|
|
|
|
|
HSSFCell cell9 = rowCabecalho.createCell(10);
|
|
|
|
|
cell9.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
|
|
|
|
|
cell9.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// h - 10
|
|
|
|
|
HSSFCell cell10 = rowCabecalho.createCell(11);
|
|
|
|
|
cell10.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
|
|
|
|
|
cell10.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell12 = rowCabecalho.createCell(12);
|
|
|
|
|
cell12.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
|
|
|
|
|
cell12.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell13 = rowCabecalho.createCell(13);
|
|
|
|
|
cell13.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
|
|
|
|
|
cell13.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell14 = rowCabecalho.createCell(14);
|
|
|
|
|
cell14.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
|
|
|
|
|
cell14.setCellStyle(estilo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HSSFRow row = sheet1.createRow(contRow++);
|
|
|
|
|
|
|
|
|
|
row.createCell(0).setCellValue(Integer.parseInt(obj[0].toString()));
|
|
|
|
|
row.createCell(1).setCellValue(obj[1].toString());
|
|
|
|
|
row.createCell(2).setCellValue(obj[2].toString());
|
|
|
|
|
row.createCell(3).setCellValue(obj[3].toString());
|
|
|
|
|
row.createCell(4).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
|
|
|
|
|
row.createCell(5).setCellValue(obj[5].toString());
|
|
|
|
|
row.createCell(6).setCellValue(obj[6].toString());
|
|
|
|
|
|
|
|
|
|
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
|
|
|
|
|
|
|
Date dataIni = (Date) obj[7];
|
|
|
|
|
Date dataFim = (Date) obj[8];
|
|
|
|
|
|
|
|
|
|
row.createCell(7).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
|
|
|
|
|
row.createCell(8).setCellValue(obj[9].toString());
|
|
|
|
|
|
|
|
|
|
String ori = getStringImporteSafe(obj[10]);
|
|
|
|
|
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
|
|
|
|
|
|
|
|
|
|
String atu = getStringImporteSafe(obj[11]);
|
|
|
|
|
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
|
|
|
|
|
|
|
|
|
|
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
|
|
|
|
|
row.createCell(10).setCellValue(atual.setScale(2).doubleValue());
|
|
|
|
|
|
|
|
|
|
String ped = getStringImporteSafe(obj[16]);
|
|
|
|
|
BigDecimal pedVal = BigDecimal.valueOf(Double.valueOf(ped));
|
|
|
|
|
row.createCell(12).setCellValue(pedVal.setScale(2).doubleValue());
|
|
|
|
|
|
|
|
|
|
row.createCell(14).setCellValue(obj[17].toString());
|
|
|
|
|
|
|
|
|
|
// novo preco:
|
|
|
|
|
BigDecimal novoPrecio = null;
|
|
|
|
|
int celulaAlterada = 0;
|
|
|
|
|
|
|
|
|
|
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TARIFA.getDescricao())){
|
|
|
|
|
novoPrecio = atual;
|
|
|
|
|
celulaAlterada = 11;
|
|
|
|
|
} else{
|
|
|
|
|
if (obj[16]==null){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[16])));
|
|
|
|
|
celulaAlterada = 13;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
|
|
HSSFCell cellNovoPrecio = row.createCell(celulaAlterada);
|
|
|
|
|
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
|
|
|
|
|
cellNovoPrecio.setCellStyle(estilo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void gerarExcelComAgrupamento(List<Object> lsRutaCombinacion, HSSFWorkbook wb, HSSFCellStyle estilo, BigDecimal coeficiente){
|
|
|
|
|
HSSFSheet sheet1 = null;
|
|
|
|
|
String ruta = "";
|
|
|
|
|
int contRow = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < lsRutaCombinacion.size(); i++) {
|
|
|
|
|
Object[] obj = (Object[]) lsRutaCombinacion.get(i);
|
|
|
|
|
|
|
|
|
|
if (!ruta.equals(obj[4].toString().concat(obj[12].toString()))) {
|
|
|
|
|
int contCell = 0;
|
|
|
|
|
|
|
|
|
|
ruta = obj[4].toString().concat(obj[12].toString());
|
|
|
|
|
String linha = "";
|
|
|
|
|
if (obj[4].toString().length() > 26) {
|
|
|
|
|
linha = (obj[12].toString().concat("-").concat(obj[4].toString().substring(0, 26)));
|
|
|
|
|
} else {
|
|
|
|
|
linha = (obj[12].toString().concat("-").concat(obj[4].toString()));
|
|
|
|
|
}
|
|
|
|
|
linha = "Linha: ".concat(linha.replaceAll("/", "-"));
|
|
|
|
|
log.debug("Linha: " + linha);
|
|
|
|
|
|
|
|
|
|
if (sheet1 == null){
|
|
|
|
|
sheet1 = wb.createSheet("Agrupado por Linha");
|
|
|
|
|
contRow = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (contRow > 0){
|
|
|
|
|
HSSFRow rowLinhaBranco = sheet1.createRow(contRow++);
|
|
|
|
|
HSSFCell cellLinhaBranco = rowLinhaBranco.createCell(0);
|
|
|
|
|
sheet1.addMergedRegion(new CellRangeAddress(rowLinhaBranco.getRowNum(), rowLinhaBranco.getRowNum(), 0, 16));
|
|
|
|
|
cellLinhaBranco.setCellValue(Strings.EMPTY);
|
|
|
|
|
cellLinhaBranco.setCellStyle(estilo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HSSFRow rowTituloLinha = sheet1.createRow(contRow++);
|
|
|
|
|
HSSFCell cellTituloLinha = rowTituloLinha.createCell(0);
|
|
|
|
|
sheet1.addMergedRegion(new CellRangeAddress(rowTituloLinha.getRowNum(), rowTituloLinha.getRowNum(), 0, 16));
|
|
|
|
|
cellTituloLinha.setCellValue(linha);
|
|
|
|
|
//estilo.setAlignment(org.apache.poi.ss.usermodel.CellStyle.ALIGN_CENTER);
|
|
|
|
|
cellTituloLinha.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFRow rowCabecalho = sheet1.createRow(contRow++);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhId.label"));
|
|
|
|
|
cell.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell0 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell0.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhTramo.label"));
|
|
|
|
|
cell0.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell1 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell1.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
|
|
|
|
|
cell1.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell2 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell2.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhDestino.label"));
|
|
|
|
|
cell2.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell3 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell3.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhRuta.label"));
|
|
|
|
|
cell3.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell4 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell4.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhMarca.label"));
|
|
|
|
|
cell4.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// Preco original I - 6
|
|
|
|
|
HSSFCell cell5 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell5.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
|
|
|
|
|
cell5.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// H - 6
|
|
|
|
|
HSSFCell cell6 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell6.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
|
|
|
|
|
cell6.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// I - 8
|
|
|
|
|
HSSFCell cell7 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell7.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
|
|
|
|
|
cell7.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// J - 9
|
|
|
|
|
HSSFCell cell8 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell8.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
|
|
|
|
|
cell8.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// J - 9
|
|
|
|
|
HSSFCell cell9 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell9.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
|
|
|
|
|
cell9.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
// h - 10
|
|
|
|
|
HSSFCell cell10 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell10.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
|
|
|
|
|
cell10.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell12 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell12.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
|
|
|
|
|
cell12.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell13 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell13.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
|
|
|
|
|
cell13.setCellStyle(estilo);
|
|
|
|
|
|
|
|
|
|
HSSFCell cell14 = rowCabecalho.createCell(contCell++);
|
|
|
|
|
cell14.setCellValue(
|
|
|
|
|
Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
|
|
|
|
|
cell14.setCellStyle(estilo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HSSFRow row = sheet1.createRow(contRow++);
|
|
|
|
|
|
|
|
|
|
row.createCell(0).setCellValue(Integer.parseInt(obj[0].toString()));
|
|
|
|
|
row.createCell(1).setCellValue(obj[1].toString());
|
|
|
|
|
row.createCell(2).setCellValue(obj[2].toString());
|
|
|
|
|
row.createCell(3).setCellValue(obj[3].toString());
|
|
|
|
|
row.createCell(4).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
|
|
|
|
|
row.createCell(5).setCellValue(obj[5].toString());
|
|
|
|
|
row.createCell(6).setCellValue(obj[6].toString());
|
|
|
|
|
|
|
|
|
|
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
|
|
|
|
|
|
|
Date dataIni = (Date) obj[7];
|
|
|
|
|
Date dataFim = (Date) obj[8];
|
|
|
|
|
|
|
|
|
|
row.createCell(7).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
|
|
|
|
|
row.createCell(8).setCellValue(obj[9].toString());
|
|
|
|
|
|
|
|
|
|
String ori = getStringImporteSafe(obj[10]);
|
|
|
|
|
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
|
|
|
|
|
|
|
|
|
|
String atu = getStringImporteSafe(obj[11]);
|
|
|
|
|
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
|
|
|
|
|
|
|
|
|
|
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
|
|
|
|
|
row.createCell(10).setCellValue(atual.setScale(2).doubleValue());
|
|
|
|
|
|
|
|
|
|
String ped = getStringImporteSafe(obj[16]);
|
|
|
|
|
BigDecimal pedVal = BigDecimal.valueOf(Double.valueOf(ped));
|
|
|
|
|
row.createCell(12).setCellValue(pedVal.setScale(2).doubleValue());
|
|
|
|
|
|
|
|
|
|
row.createCell(14).setCellValue(obj[17].toString());
|
|
|
|
|
|
|
|
|
|
// novo preco:
|
|
|
|
|
BigDecimal novoPrecio = null;
|
|
|
|
|
int celulaAlterada = 0;
|
|
|
|
|
|
|
|
|
|
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TARIFA.getDescricao())){
|
|
|
|
|
novoPrecio = atual;
|
|
|
|
|
celulaAlterada = 11;
|
|
|
|
|
} else{
|
|
|
|
|
if (obj[16]==null){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[16])));
|
|
|
|
|
celulaAlterada = 13;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
|
|
HSSFCell cellNovoPrecio = row.createCell(celulaAlterada);
|
|
|
|
|
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
|
|
|
|
|
cellNovoPrecio.setCellStyle(estilo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|