Tarifas
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@21031 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
901f0cc92f
commit
e8197b170b
|
@ -22,12 +22,9 @@ import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.Predicate;
|
import org.apache.commons.collections.Predicate;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
|
||||||
import org.apache.poi.ss.usermodel.Font;
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
@ -59,12 +56,10 @@ import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||||
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
import com.rjconsultores.ventaboletos.service.MarcaService;
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
import com.rjconsultores.ventaboletos.service.MercadoCompetidoService;
|
|
||||||
import com.rjconsultores.ventaboletos.service.MonedaService;
|
import com.rjconsultores.ventaboletos.service.MonedaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RutaCombinacionService;
|
||||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||||
import com.rjconsultores.ventaboletos.service.TarifaCategoriaService;
|
|
||||||
import com.rjconsultores.ventaboletos.service.TarifaService;
|
import com.rjconsultores.ventaboletos.service.TarifaService;
|
||||||
import com.rjconsultores.ventaboletos.service.TarifaTipoptovtaService;
|
|
||||||
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
|
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
|
||||||
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
|
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
@ -79,6 +74,15 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMarca;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMoneda;
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMoneda;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta;
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderVigenciaTarifaModificacionMassivaTarifa;
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderVigenciaTarifaModificacionMassivaTarifa;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFFont;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -89,17 +93,10 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderVigenciaTarifaM
|
||||||
public class ModificacionMasivaTarifasController extends MyGenericForwardComposer {
|
public class ModificacionMasivaTarifasController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
private final Integer CELL_ID_TARIFA = 0;
|
private final Integer CELL_ID_TARIFA = 0;
|
||||||
private final Integer CELL_NOVO_PRECIO = 8;
|
|
||||||
private final Integer CELL_ID_CATEGORIA = 10;
|
|
||||||
private final Integer CELL_NOVO_PRECIO_CATEGORIA = 12;
|
|
||||||
private final Integer CELL_ID_TIPO_PUNTO = 14;
|
|
||||||
private final Integer CELL_NOVO_PRECIO_TIPO_PUNTO = 16;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TarifaService tarifaService;
|
private TarifaService tarifaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TarifaCategoriaService tarifaCategoriaService;
|
private RutaCombinacionService rutaCombinacionService;
|
||||||
@Autowired
|
|
||||||
private TarifaTipoptovtaService tarifaTipoptovtaService;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MarcaService marcaService;
|
private MarcaService marcaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -107,8 +104,6 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonedaService monedaService;
|
private MonedaService monedaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MercadoCompetidoService mercadoCompetidoService;
|
|
||||||
@Autowired
|
|
||||||
private EmpresaService empresaService;
|
private EmpresaService empresaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RutaService rutaService;
|
private RutaService rutaService;
|
||||||
|
@ -156,6 +151,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
private Button btnGerarTarifas;
|
private Button btnGerarTarifas;
|
||||||
private Tab tabTipoPuntoVenta;
|
private Tab tabTipoPuntoVenta;
|
||||||
private Tab tabCategoria;
|
private Tab tabCategoria;
|
||||||
|
private Radio rdLinear;
|
||||||
private static Logger log = Logger.getLogger(ModificacionMasivaTarifasController.class);
|
private static Logger log = Logger.getLogger(ModificacionMasivaTarifasController.class);
|
||||||
|
|
||||||
public List<ClaseServicio> getLsClaseServico() {
|
public List<ClaseServicio> getLsClaseServico() {
|
||||||
|
@ -345,18 +341,18 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
// eliminando a opcao TODOS de tipo servicio:
|
// eliminando a opcao TODOS de tipo servicio:
|
||||||
CollectionUtils.filter(lsClaseServico, new Predicate() {
|
CollectionUtils.filter(lsClaseServico, new Predicate() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(Object obj) {
|
public boolean evaluate(Object obj) {
|
||||||
return !( ((ClaseServicio)obj).getClaseservicioId().equals(ClaseServicio.TODOS));
|
return !(((ClaseServicio) obj).getClaseservicioId().equals(ClaseServicio.TODOS));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// eliminando a opcao TODOS da marca:
|
// eliminando a opcao TODOS da marca:
|
||||||
CollectionUtils.filter(lsMarcas, new Predicate() {
|
CollectionUtils.filter(lsMarcas, new Predicate() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(Object obj) {
|
public boolean evaluate(Object obj) {
|
||||||
return !( ((Marca)obj).getMarcaId().equals(Marca.TODOS));
|
return !(((Marca) obj).getMarcaId().equals(Marca.TODOS));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Exibir botão para gerar tarifas automaticas
|
//Exibir botão para gerar tarifas automaticas
|
||||||
|
@ -369,6 +365,14 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnGerarExcel(Event ev) {
|
public void onClick$btnGerarExcel(Event ev) {
|
||||||
|
if (rdLinear.isChecked()) {
|
||||||
|
onClick$btnGerarExcelLinear(null);
|
||||||
|
} else {
|
||||||
|
onClick$btnGerarExcelEscala(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnGerarExcelLinear(Event ev) {
|
||||||
txtPorcentagem.getValue();
|
txtPorcentagem.getValue();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -395,6 +399,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(e);
|
||||||
log.debug("Porcentagem Zero");
|
log.debug("Porcentagem Zero");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,113 +407,151 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Tarifa> lsTarifa = tarifaService.pesquisar(lsAddRmvMonedas, lsAddRmvMarcas,
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
|
// fonte em negrito:
|
||||||
|
HSSFFont fonte = wb.createFont();
|
||||||
|
fonte.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||||
|
HSSFCellStyle estilo = wb.createCellStyle();
|
||||||
|
estilo.setFont(fonte);
|
||||||
|
|
||||||
|
//TESTE:
|
||||||
|
List<Object> lsRutaCombinacion = rutaCombinacionService.pesquisaTarifaObj(lsAddRmvMonedas, lsAddRmvMarcas,
|
||||||
lsAddRmvClaseServico, lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas,
|
lsAddRmvClaseServico, lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas,
|
||||||
lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa);
|
lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa);
|
||||||
|
|
||||||
Workbook wb = new SXSSFWorkbook(500);
|
HSSFSheet sheet1 = null;
|
||||||
|
String ruta = "";
|
||||||
|
int contRow = 0;
|
||||||
|
|
||||||
// fonte em negrito:
|
for (int i = 0; i < lsRutaCombinacion.size(); i++) {
|
||||||
Font fonte = wb.createFont();
|
Object[] obj = (Object[]) lsRutaCombinacion.get(i);
|
||||||
fonte.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
|
||||||
CellStyle estilo = wb.createCellStyle();
|
|
||||||
estilo.setFont(fonte);
|
|
||||||
|
|
||||||
Sheet sheet1 = wb.createSheet(
|
if (!ruta.equals(obj[4].toString().concat(obj[12].toString()))) {
|
||||||
Labels.getLabel("modificacionMasivaTarifasController.window.title"));
|
|
||||||
|
|
||||||
Row rowCabecalho = sheet1.createRow(0);
|
ruta = obj[4].toString().concat(obj[12].toString());
|
||||||
|
String sheetName = "";
|
||||||
|
if (obj[4].toString().length() > 26) {
|
||||||
|
sheetName = (obj[4].toString().substring(0, 26).concat(" (").concat(obj[12].toString()).concat(")"));
|
||||||
|
} else {
|
||||||
|
sheetName = (obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
|
||||||
|
}
|
||||||
|
log.debug("Aba: " + sheetName);
|
||||||
|
sheet1 = wb.createSheet(sheetName);
|
||||||
|
contRow = 1;
|
||||||
|
|
||||||
Cell cell = rowCabecalho.createCell(0);
|
HSSFRow rowCabecalho = sheet1.createRow(0);
|
||||||
cell.setCellValue(
|
|
||||||
Labels.getLabel("busquedaTarifaController.lhId.label"));
|
|
||||||
cell.setCellStyle(estilo);
|
|
||||||
|
|
||||||
Cell cell0 = rowCabecalho.createCell(1);
|
HSSFCell cell = rowCabecalho.createCell(0);
|
||||||
cell0.setCellValue(
|
cell.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhTramo.label"));
|
Labels.getLabel("busquedaTarifaController.lhId.label"));
|
||||||
cell0.setCellStyle(estilo);
|
cell.setCellStyle(estilo);
|
||||||
|
|
||||||
Cell cell1 = rowCabecalho.createCell(2);
|
HSSFCell cell0 = rowCabecalho.createCell(1);
|
||||||
cell1.setCellValue(
|
cell0.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhMarca.label"));
|
Labels.getLabel("busquedaTarifaController.lhTramo.label"));
|
||||||
cell1.setCellStyle(estilo);
|
cell0.setCellStyle(estilo);
|
||||||
|
|
||||||
Cell cell2 = rowCabecalho.createCell(3);
|
HSSFCell cell1 = rowCabecalho.createCell(2);
|
||||||
cell2.setCellValue(
|
cell1.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
|
Labels.getLabel("busquedaTarifaController.lhOrigem.label"));
|
||||||
cell2.setCellStyle(estilo);
|
cell1.setCellStyle(estilo);
|
||||||
|
|
||||||
Cell cell3 = rowCabecalho.createCell(4);
|
HSSFCell cell2 = rowCabecalho.createCell(3);
|
||||||
cell3.setCellValue(
|
cell2.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
|
Labels.getLabel("busquedaTarifaController.lhDestino.label"));
|
||||||
cell3.setCellStyle(estilo);
|
cell2.setCellStyle(estilo);
|
||||||
|
|
||||||
Cell cell4 = rowCabecalho.createCell(5);
|
HSSFCell cell3 = rowCabecalho.createCell(4);
|
||||||
cell4.setCellValue(
|
cell3.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
|
Labels.getLabel("busquedaTarifaController.lhRuta.label"));
|
||||||
cell4.setCellStyle(estilo);
|
cell3.setCellStyle(estilo);
|
||||||
|
|
||||||
//Preco original I - 6
|
HSSFCell cell4 = rowCabecalho.createCell(5);
|
||||||
Cell cell5 = rowCabecalho.createCell(6);
|
cell4.setCellValue(
|
||||||
cell5.setCellValue(
|
Labels.getLabel("busquedaTarifaController.lhMarca.label"));
|
||||||
Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
|
cell4.setCellStyle(estilo);
|
||||||
cell5.setCellStyle(estilo);
|
|
||||||
|
|
||||||
// j - 6
|
//Preco original I - 6
|
||||||
Cell cell6 = rowCabecalho.createCell(7);
|
HSSFCell cell5 = rowCabecalho.createCell(6);
|
||||||
cell6.setCellValue(
|
cell5.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
|
Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
|
||||||
cell6.setCellStyle(estilo);
|
cell5.setCellStyle(estilo);
|
||||||
|
|
||||||
//I - 8
|
// H - 6
|
||||||
Cell cell7 = rowCabecalho.createCell(8);
|
HSSFCell cell6 = rowCabecalho.createCell(7);
|
||||||
cell7.setCellValue(
|
cell6.setCellValue(
|
||||||
Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
|
Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
|
||||||
cell7.setCellStyle(estilo);
|
cell6.setCellStyle(estilo);
|
||||||
|
|
||||||
|
//I - 8
|
||||||
|
HSSFCell cell7 = rowCabecalho.createCell(8);
|
||||||
|
cell7.setCellValue(
|
||||||
|
Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
|
||||||
|
cell7.setCellStyle(estilo);
|
||||||
|
|
||||||
for (int i = 0; i < lsTarifa.size(); i++) {
|
//J - 9
|
||||||
|
HSSFCell cell8 = rowCabecalho.createCell(9);
|
||||||
|
cell8.setCellValue(
|
||||||
|
Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
|
||||||
|
cell8.setCellStyle(estilo);
|
||||||
|
|
||||||
Tarifa tarifa = lsTarifa.get(i);
|
//J - 9
|
||||||
|
HSSFCell cell9 = rowCabecalho.createCell(10);
|
||||||
|
cell9.setCellValue(
|
||||||
|
Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
|
||||||
|
cell9.setCellStyle(estilo);
|
||||||
|
|
||||||
Row row = sheet1.createRow(i + 1);
|
//h - 10
|
||||||
|
HSSFCell cell10 = rowCabecalho.createCell(11);
|
||||||
|
cell10.setCellValue(
|
||||||
|
Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
|
||||||
|
cell10.setCellStyle(estilo);
|
||||||
|
}
|
||||||
|
|
||||||
row.createCell(0).setCellValue(tarifa.getTarifaId());
|
HSSFRow row = sheet1.createRow(contRow++);
|
||||||
row.createCell(1).setCellValue(tarifa.getTramo().getDesctramo());
|
|
||||||
row.createCell(2).setCellValue(tarifa.getMarca().getDescmarca());
|
row.createCell(0).setCellValue(Integer.parseInt(obj[0].toString()));
|
||||||
row.createCell(3).setCellValue(tarifa.getClaseServicio().getDescclase());
|
row.createCell(1).setCellValue(obj[1].toString());
|
||||||
row.createCell(4).setCellValue(tarifa.getVigenciaTarifa().toString());
|
row.createCell(2).setCellValue(obj[2].toString());
|
||||||
row.createCell(5).setCellValue(tarifa.getMoneda().getDescmoneda());
|
row.createCell(3).setCellValue(obj[3].toString());
|
||||||
row.createCell(6).setCellValue(tarifa.getPreciooriginal().setScale(2).doubleValue());
|
row.createCell(4).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
|
||||||
row.createCell(7).setCellValue(tarifa.getPrecio().setScale(2).doubleValue());
|
row.createCell(5).setCellValue(obj[5].toString());
|
||||||
|
row.createCell(6).setCellValue(obj[6].toString());
|
||||||
|
|
||||||
|
DateFormat sfData = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
Date dataIni = sfData.parse(obj[7].toString());
|
||||||
|
Date dataFim = sfData.parse(obj[8].toString());
|
||||||
|
|
||||||
|
row.createCell(7).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
|
||||||
|
row.createCell(8).setCellValue(obj[9].toString());
|
||||||
|
|
||||||
|
String ori = obj[10].toString();
|
||||||
|
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
|
||||||
|
|
||||||
|
String atu = obj[11].toString();
|
||||||
|
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
|
||||||
|
|
||||||
|
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
|
||||||
|
row.createCell(10).setCellValue(atual.setScale(2).doubleValue());
|
||||||
|
|
||||||
// novo preco:
|
// novo preco:
|
||||||
BigDecimal novoPrecio = tarifa.getPrecio();
|
BigDecimal novoPrecio = atual;
|
||||||
|
|
||||||
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
|
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
Cell cellNovoPrecio = row.createCell(8);
|
HSSFCell cellNovoPrecio = row.createCell(11);
|
||||||
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
|
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
|
||||||
cellNovoPrecio.setCellStyle(estilo);
|
cellNovoPrecio.setCellStyle(estilo);
|
||||||
|
|
||||||
//Tipo de Pasajero
|
|
||||||
row.createCell(9).setCellValue("");
|
|
||||||
row.createCell(10).setCellValue("");
|
|
||||||
row.createCell(11).setCellValue("");
|
|
||||||
row.createCell(12).setCellValue("");
|
|
||||||
|
|
||||||
// novo preco CANAL VENTA:
|
|
||||||
row.createCell(13).setCellValue("");
|
|
||||||
row.createCell(14).setCellValue("");
|
|
||||||
row.createCell(15).setCellValue("");
|
|
||||||
row.createCell(16).setCellValue("");
|
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
String nomeArquivo =
|
String nomeArquivo =
|
||||||
UsuarioLogado.getUsuarioLogado().getNombusuario()
|
UsuarioLogado.getUsuarioLogado().getNombusuario()
|
||||||
+ "_" + Calendar.getInstance().getTime().getTime()
|
+ "_" + Calendar.getInstance().getTime().getTime()
|
||||||
+ "_" + "modMassivaT.xlsx";
|
+ "_" + "modMassivaT.xls";
|
||||||
|
|
||||||
FileOutputStream stream = new FileOutputStream(nomeArquivo);
|
FileOutputStream stream = new FileOutputStream(nomeArquivo);
|
||||||
stream.flush();
|
stream.flush();
|
||||||
|
@ -517,11 +560,73 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
is = new FileInputStream(nomeArquivo);
|
is = new FileInputStream(nomeArquivo);
|
||||||
Filedownload.save(is, "application/xlsx", "modificacionMasivaTarifa.xlsx");
|
Filedownload.save(is, "application/xls", "modificacionMasivaTarifa.xls");
|
||||||
|
|
||||||
boolean success = (new File(nomeArquivo)).delete();
|
boolean success = (new File(nomeArquivo)).delete();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("Erro ao executar a exportação masiva",ex);
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Escala
|
||||||
|
|
||||||
|
public void onClick$btnGerarExcelEscala(Event ev) {
|
||||||
|
txtPorcentagem.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (lsAddRmvVigenciaTarifa.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("modificacionMasivaTarifasController.MSG.SemVigencia"),
|
||||||
|
Labels.getLabel("modificacionMasivaTarifasController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal coeficiente = new BigDecimal(BigInteger.ZERO);
|
||||||
|
try {
|
||||||
|
if (txtPorcentagem.getValue() != null) {
|
||||||
|
|
||||||
|
BigDecimal porcentage = BigDecimal.valueOf(Double.parseDouble(txtPorcentagem.getValue()));
|
||||||
|
|
||||||
|
coeficiente = porcentage.divide(new BigDecimal(100));
|
||||||
|
if (radIncremento.isChecked()) {
|
||||||
|
coeficiente = coeficiente.add(BigDecimal.ONE);
|
||||||
|
} else {
|
||||||
|
coeficiente = BigDecimal.ONE.subtract(coeficiente);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e);
|
||||||
|
log.debug("Porcentagem Zero");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (coeficiente == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HSSFWorkbook wb = rutaCombinacionService.gerarTarifaEscala(lsAddRmvMonedas, lsAddRmvMarcas,
|
||||||
|
lsAddRmvClaseServico, lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas,
|
||||||
|
lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String nomeArquivo =
|
||||||
|
UsuarioLogado.getUsuarioLogado().getNombusuario()
|
||||||
|
+ "_" + Calendar.getInstance().getTime().getTime()
|
||||||
|
+ "_" + "modMassivaEscala.xls";
|
||||||
|
|
||||||
|
FileOutputStream stream = new FileOutputStream(nomeArquivo);
|
||||||
|
stream.flush();
|
||||||
|
wb.write(stream);
|
||||||
|
stream.close();
|
||||||
|
|
||||||
|
InputStream is = null;
|
||||||
|
is = new FileInputStream(nomeArquivo);
|
||||||
|
Filedownload.save(is, "application/xls", "modificacionMasivaTarifa.xls");
|
||||||
|
|
||||||
|
boolean success = (new File(nomeArquivo)).delete();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Desenvolvimento
|
||||||
|
*/
|
||||||
|
public class RenderSeguroTarifa implements ListitemRenderer {
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
SeguroTarifa taxaTarifa = (SeguroTarifa) o;
|
||||||
|
|
||||||
|
Listcell lc = new Listcell(taxaTarifa.getSegurotarifaId()==null?"-":taxaTarifa.getSegurotarifaId().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(taxaTarifa.getOrgaoconcedente().getDescOrgao());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(taxaTarifa.getValortarifaate().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(taxaTarifa.getValortarifa().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lstm.setAttribute("data", taxaTarifa);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?page contentType="text/html;charset=UTF-8"?>
|
||||||
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
|
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winBusquedaSeguroTarifa"?>
|
||||||
|
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||||
|
|
||||||
|
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||||
|
<window id="winBusquedaSeguroTarifa" title="${c:l('busquedaSeguroTarifaController.window.title')}"
|
||||||
|
apply="${busquedaSeguroTarifaController}" contentStyle="overflow:auto"
|
||||||
|
height="500px" width="750px" border="normal" >
|
||||||
|
<toolbar>
|
||||||
|
<button id="btnRefresh" image="/gui/img/refresh.png" width="35px"
|
||||||
|
tooltiptext="${c:l('busquedaSeguroTarifaController.btnRefresh.tooltiptext')}" />
|
||||||
|
<separator orient="vertical" />
|
||||||
|
<button id="btnNovo" image="/gui/img/add.png" width="35px"
|
||||||
|
tooltiptext="${c:l('busquedaSeguroTarifaController.btnNovo.tooltiptext')}" />
|
||||||
|
<separator orient="vertical" />
|
||||||
|
<button id="btnCerrar" onClick="winBusquedaSeguroTarifa.detach()" image="/gui/img/exit.png" width="35px"
|
||||||
|
tooltiptext="${c:l('busquedaSeguroTarifaController.btnCerrar.tooltiptext')}"/>
|
||||||
|
</toolbar>
|
||||||
|
|
||||||
|
<grid fixedLayout="true">
|
||||||
|
<columns>
|
||||||
|
<column width="30%" />
|
||||||
|
<column width="70%" />
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<label value="${c:l('busquedaSeguroTarifaController.orgao')}"/>
|
||||||
|
<textbox id="txtOrgao" width="200px" use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
|
||||||
|
<toolbar>
|
||||||
|
<button id="btnPesquisa" image="/gui/img/find.png"
|
||||||
|
label="${c:l('tooltiptext.btnPesquisa')}"/>
|
||||||
|
</toolbar>
|
||||||
|
|
||||||
|
<paging id="pagingSeguroTarifa" pageSize="15"/>
|
||||||
|
<listbox id="seguroTarifaList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
|
multiple="false">
|
||||||
|
<listhead sizable="true">
|
||||||
|
<listheader width="50px" image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('lb.id')}"
|
||||||
|
sort="auto(taxaembarqueTarifaId)"/>
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('busquedaSeguroTarifaController.orgao')}"
|
||||||
|
sort="auto(descOrgao)"/>
|
||||||
|
</listhead>
|
||||||
|
</listbox>
|
||||||
|
</window>
|
||||||
|
</zk>
|
|
@ -45,6 +45,13 @@
|
||||||
<textbox id="txtPorcentagem" maxValue="100.00" constraint="no empty" value="0.00"
|
<textbox id="txtPorcentagem" maxValue="100.00" constraint="no empty" value="0.00"
|
||||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal"/>
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal"/>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<label value="${c:l('modificacionMasivaTarifasController.formato')}"/>
|
||||||
|
<radiogroup id="rdFormato" >
|
||||||
|
<radio id="rdLinear" label="${c:l('modificacionMasivaTarifasController.linear')}" checked="true"/>
|
||||||
|
<radio id="rdEscala" label="${c:l('modificacionMasivaTarifasController.escala')}"/>
|
||||||
|
</radiogroup>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue