Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RelatorioExcel {
- public String caminho;
- public String geraExcell(UnimedPagamento listaPagamento, List<UnimedPagamentoLista> ListaGuiaPag, UnimedCabecalho listaCabecalho,
- String nomeArquivo, List<UnimedLote> listaContatoslt, List<GlosaLote> listaGlosa) {
- Date hoje = new Date();
- SimpleDateFormat df;
- df = new SimpleDateFormat("dd-MM-yyyy");
- String dataSistema = df.format(hoje);
- try {
- FileOutputStream out = new FileOutputStream("C:\\relatorios/"+dataSistema+"/" + nomeArquivo + ".xlsx");
- caminho = "C:\\relatorios/"+dataSistema+"/" + nomeArquivo + ".xls";
- XSSFWorkbook wb = new XSSFWorkbook();
- XSSFSheet sheet = wb.createSheet("Resumo");
- XSSFSheet sheet1 = wb.createSheet("Analítico");
- XSSFSheet sheet2 = wb.createSheet("Glosa");
- Font negrito = wb.createFont();
- Font f2 = wb.createFont();
- Font f = wb.createFont();
- //Linha de titulo
- XSSFRow title = sheet.createRow(0);
- for (int i = 0; i <= 2; i++) {
- title.createCell(i);
- }
- //Alinhamento do estilo
- XSSFCellStyle styleTitle = wb.createCellStyle();
- styleTitle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- negrito.setBoldweight(Font.BOLDWEIGHT_BOLD);
- styleTitle.setBorderBottom(HSSFCellStyle.BORDER_DOUBLE);
- styleTitle.setBorderTop(HSSFCellStyle.BORDER_DOUBLE);
- styleTitle.setBorderRight(HSSFCellStyle.BORDER_DOUBLE);
- styleTitle.setBorderLeft(HSSFCellStyle.BORDER_DOUBLE);
- //Deixa o titulo em Negrito
- styleTitle.setFont(negrito);
- CellStyle cs2 = wb.createCellStyle();
- CellStyle cs = wb.createCellStyle();
- //Deixa campos com o tipo moeda
- XSSFCellStyle estilo = wb.createCellStyle();
- XSSFDataFormat format = wb.createDataFormat();
- estilo.setDataFormat(format.getFormat("R$#,##0.00_);[Red](R$#,##0.00)"));
- estilo.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- estilo.setFont(negrito);
- estilo.setBorderBottom(HSSFCellStyle.BORDER_DOUBLE);
- estilo.setBorderTop(HSSFCellStyle.BORDER_DOUBLE);
- estilo.setBorderRight(HSSFCellStyle.BORDER_DOUBLE);
- estilo.setBorderLeft(HSSFCellStyle.BORDER_DOUBLE);
- //bordas
- XSSFCellStyle estilo1 = wb.createCellStyle();
- estilo1.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
- estilo1.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
- estilo1.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
- estilo1.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
- //Fonte vermelha com formatação Moeda
- f2.setColor((short) Font.COLOR_RED);
- f2.setBoldweight(Font.BOLDWEIGHT_BOLD);
- cs2.setDataFormat(format.getFormat("R$#,##0.00_);(R$#,##0.00)"));
- cs2.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- cs2.setBorderBottom(HSSFCellStyle.BORDER_DOUBLE);
- cs2.setBorderTop(HSSFCellStyle.BORDER_DOUBLE);
- cs2.setBorderRight(HSSFCellStyle.BORDER_DOUBLE);
- cs2.setBorderLeft(HSSFCellStyle.BORDER_DOUBLE);
- cs2.setFont(f2);
- CellStyle style = wb.createCellStyle();
- Font fonts = wb.createFont();
- fonts.setColor(HSSFColor.GREEN.index);
- fonts.setBoldweight(Font.BOLDWEIGHT_BOLD);
- style.setDataFormat(format.getFormat("R$#,##0.00_);(R$#,##0.00)"));
- style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- style.setBorderBottom(HSSFCellStyle.BORDER_DOUBLE);
- style.setBorderTop(HSSFCellStyle.BORDER_DOUBLE);
- style.setBorderRight(HSSFCellStyle.BORDER_DOUBLE);
- style.setBorderLeft(HSSFCellStyle.BORDER_DOUBLE);
- style.setFont(fonts);
- //Fonte vermelha com formatação Moeda
- //Mescla as celulas do titulo
- sheet.addMergedRegion(CellRangeAddress.valueOf("$A$1:$B$1"));
- XSSFCell titleCell = title.getCell(0);
- titleCell.setCellStyle(styleTitle);
- titleCell.setCellValue("Resumo");
- //1º Grupo de linhas
- XSSFRow cabRow = sheet.createRow(1);
- for (int i = 0; i <= 2; i++) {
- cabRow.createCell(i);
- }
- XSSFCell CellA2 = cabRow.getCell(0);
- CellA2.setCellValue("Nome: " + listaPagamento.getNomePrestador());
- CellA2.setCellStyle(estilo);
- sheet.setColumnWidth(0, 18000);
- XSSFCell cellB2 = cabRow.getCell(1);
- cellB2.setCellValue("Cod. Prestador: " + listaPagamento.getCodigoPrestador());
- cellB2.setCellStyle(estilo);
- sheet.setColumnWidth(1, 7000);
- //2º grupo de linhas
- XSSFRow cabRowLinha2 = sheet.createRow(2);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha2.createCell(i);
- }
- XSSFCell cellA3 = cabRowLinha2.getCell(0);
- cellA3.setCellValue("Unimed 117: " + listaPagamento.getNomeOperadora());
- cellA3.setCellStyle(estilo);
- XSSFCell cellB3 = cabRowLinha2.getCell(1);
- cellB3.setCellValue("Pagamento: " + listaPagamento.getDataCompetencia());
- cellB3.setCellStyle(estilo);
- //Linha 4
- XSSFRow cabRowLinha4 = sheet.createRow(4);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha4.createCell(i);
- }
- XSSFCell cellA4 = cabRowLinha4.getCell(0);
- cellA4.setCellValue("DESCRIÇÃO");
- cellA4.setCellStyle(styleTitle);
- XSSFCell cellB4 = cabRowLinha4.getCell(1);
- cellB4.setCellValue("VALOR");
- cellB4.setCellStyle(styleTitle);
- XSSFRow cabRowLinha5 = sheet.createRow(5);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha5.createCell(i);
- }
- //PEGAR VALOR DO CRÉDITO LINHA = 5
- XSSFCell cellA5 = cabRowLinha5.getCell(0);
- cellA5.setCellValue("TOTAL CRÉDITOS");
- cellA5.setCellStyle(styleTitle);
- XSSFCell cellB5 = cabRowLinha5.getCell(1);
- BigDecimal big = listaPagamento.getValorCredito();
- cellB5.setCellValue(big.floatValue());
- cellB5.setCellStyle(estilo);
- //For que pega lista e preenche campos LISTA LINHA = 7
- int cont = 0;
- for (int i = 0; i < ListaGuiaPag.size(); i++) {
- XSSFRow cabRow7 = sheet.createRow(7 + i);
- for (int x = 0; x <= 2; x++) {
- cabRow7.createCell(x);
- }
- XSSFCell cellA7 = cabRow7.getCell(0);
- cellA7.setCellValue(ListaGuiaPag.get(i).getDescricao());
- cellA7.setCellStyle(styleTitle);
- XSSFCell cellB7 = cabRow7.getCell(1);
- cellB7.setCellStyle(estilo);
- BigDecimal b = ListaGuiaPag.get(i).getValorDesconto();
- cellB7.setCellValue(b.floatValue());
- cont++;
- }
- //For que pega lista e preenche campos LISTA
- //Linha que pega a contagem + 8, vem logo após a lista
- XSSFRow cabRowLinha9 = sheet.createRow(cont + 8);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha9.createCell(i);
- }
- XSSFCell cellA9 = cabRowLinha9.getCell(0);
- cellA9.setCellValue("TOTAL DÉBITOS");
- cellA9.setCellStyle(styleTitle);
- XSSFCell cellB9 = cabRowLinha9.getCell(1);
- cellB9.setCellStyle(cs2);
- BigDecimal valorTotalDesconto = listaPagamento.getTotalDescontos();
- cellB9.setCellValue(valorTotalDesconto.floatValue());
- XSSFRow cabRowLinha10 = sheet.createRow(cont + 9);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha10.createCell(i);
- }
- //PEGAR VALOR DO CRÉDITO LINHA = 10
- XSSFCell cellA10 = cabRowLinha10.getCell(0);
- cellA10.setCellValue("TOTAL LÍQUIDO");
- cellA10.setCellStyle(estilo);
- XSSFCell cellB10 = cabRowLinha10.getCell(1);
- cellB10.setCellStyle(style);
- BigDecimal valorTotal = listaPagamento.getTotal();
- cellB10.setCellValue(valorTotal.floatValue());
- XSSFRow cabRowLinha11 = sheet.createRow(cont + 11);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha11.createCell(i);
- }
- //PEGAR VALOR DO CRÉDITO LINHA = 10
- XSSFCell cellA11 = cabRowLinha11.getCell(0);
- cellA11.setCellValue("INSS PESSOA JURÍDICA");
- cellA11.setCellStyle(estilo);
- XSSFCell cellB11 = cabRowLinha11.getCell(1);
- cellB11.setCellStyle(estilo);
- cellB11.setCellValue(listaPagamento.getInssPJ());
- XSSFRow cabRowLinha12 = sheet.createRow(cont + 12);
- for (int i = 0; i <= 2; i++) {
- cabRowLinha12.createCell(i);
- }
- //PEGAR VALOR DO CRÉDITO LINHA = 10
- XSSFCell cellA12 = cabRowLinha12.getCell(0);
- cellA12.setCellValue("INSS PESSOA JURÍDICA");
- cellA12.setCellStyle(estilo);
- XSSFCell cellB12 = cabRowLinha12.getCell(1);
- cellB12.setCellStyle(estilo);
- cellB12.setCellValue(listaPagamento.getInssPF());
- /*-----------------------GUIA ANALITICO*-----------------------*/
- /*-----------------------GUIA ANALITICO*-----------------------*/
- XSSFCellStyle estiloS1 = wb.createCellStyle();
- XSSFDataFormat format1 = wb.createDataFormat();
- estiloS1.setDataFormat(format1.getFormat("R$#,##0.00_);(R$#,##0.00)"));
- estiloS1.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- estiloS1.setFont(negrito);
- estiloS1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- estiloS1.setBorderTop(HSSFCellStyle.BORDER_THIN);
- estiloS1.setBorderRight(HSSFCellStyle.BORDER_THIN);
- estiloS1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- XSSFCellStyle estiloS3 = wb.createCellStyle();
- estiloS3.setDataFormat(format1.getFormat("R$#,##0.00_);(R$#,##0.00)"));
- estiloS3.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- estiloS3.setFont(negrito);
- estiloS3.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- estiloS3.setBorderTop(HSSFCellStyle.BORDER_THIN);
- estiloS3.setBorderRight(HSSFCellStyle.BORDER_THIN);
- estiloS3.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- XSSFCellStyle estiloS2 = wb.createCellStyle();
- estiloS2.setAlignment(XSSFCellStyle.ALIGN_CENTER);
- estiloS2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- estiloS2.setBorderTop(HSSFCellStyle.BORDER_THIN);
- estiloS2.setBorderRight(HSSFCellStyle.BORDER_THIN);
- estiloS2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- XSSFRow titulo = sheet1.createRow(0);
- for (int i = 0; i <= 12; i++) {
- titulo.createCell(i);
- }
- //Mescla as celulas do titulo
- sheet1.addMergedRegion(CellRangeAddress.valueOf("$A$1:$M$1"));
- XSSFCell tituloAnalitico = titulo.getCell(0);
- tituloAnalitico.setCellStyle(styleTitle);
- tituloAnalitico.setCellValue("Analítico");
- //1º Grupo de linhas Analitico
- XSSFRow cabRowAnalitico1 = sheet1.createRow(1);
- for (int i = 0; i <= 12; i++) {
- cabRowAnalitico1.createCell(i);
- }
- // XSSFCell AnaA2 = cabRowAnalitico1.getCell(0);
- // AnaA2.setCellStyle(estiloS1);
- // AnaA2.setCellValue("Numero do Lote");
- //
- // XSSFCell AnaB2 = cabRowAnalitico1.getCell(1);
- // AnaB2.setCellStyle(estiloS1);
- // AnaB2.setCellValue(listaLote.getNumeroLote());
- //2º Grupo de linhas analitico
- XSSFRow cabRowAnalitico2 = sheet1.createRow(2);
- for (int i = 0; i <= 12; i++) {
- cabRowAnalitico2.createCell(i);
- }
- XSSFCell AnaA3 = cabRowAnalitico2.getCell(0);
- AnaA3.setCellStyle(estiloS3);
- AnaA3.setCellValue("Prestador Executante: " + listaPagamento.getNomePrestador() + " " + listaPagamento.getCodigoPrestador());
- sheet1.addMergedRegion(CellRangeAddress.valueOf("$A$3:$M$3"));
- //3º Grupo de linhas analitico, cabeçalho
- XSSFRow cabRowAnalitico3 = sheet1.createRow(3);
- for (int i = 0; i <= 12; i++) {
- cabRowAnalitico3.createCell(i);
- }
- XSSFCell AnaA4 = cabRowAnalitico3.getCell(0);
- AnaA4.setCellStyle(estiloS1);
- AnaA4.setCellValue("Nº Doc");
- sheet1.setColumnWidth(0, 5300);
- XSSFCell AnaB4 = cabRowAnalitico3.getCell(1);
- AnaB4.setCellStyle(estiloS1);
- AnaB4.setCellValue("Código");
- sheet1.setColumnWidth(1, 4300);
- XSSFCell AnaC4 = cabRowAnalitico3.getCell(2);
- AnaC4.setCellStyle(estiloS1);
- AnaC4.setCellValue("Usuário");
- sheet1.setColumnWidth(2, 12000);
- XSSFCell AnaD4 = cabRowAnalitico3.getCell(3);
- AnaD4.setCellStyle(estiloS1);
- AnaD4.setCellValue("Data");
- sheet1.setColumnWidth(3, 2800);
- XSSFCell AnaE4 = cabRowAnalitico3.getCell(4);
- AnaE4.setCellStyle(estiloS1);
- AnaE4.setCellValue("Proced.");
- sheet1.setColumnWidth(4, 2500);
- XSSFCell AnaF4 = cabRowAnalitico3.getCell(5);
- AnaF4.setCellStyle(estiloS1);
- AnaF4.setCellValue("Tabela");
- sheet1.setColumnWidth(5, 3800);
- XSSFCell AnaG4 = cabRowAnalitico3.getCell(6);
- AnaG4.setCellStyle(estiloS1);
- AnaG4.setCellValue("Descrição do Proced.");
- sheet1.setColumnWidth(6, 10000);
- XSSFCell AnaH4 = cabRowAnalitico3.getCell(7);
- AnaH4.setCellStyle(estiloS1);
- AnaH4.setCellValue("Qtd.");
- sheet1.setColumnWidth(7, 1200);
- XSSFCell AnaI4 = cabRowAnalitico3.getCell(8);
- AnaI4.setCellStyle(estiloS1);
- AnaI4.setCellValue("Filme");
- sheet1.setColumnWidth(8, 2500);
- XSSFCell AnaJ4 = cabRowAnalitico3.getCell(9);
- AnaJ4.setCellStyle(estiloS1);
- AnaJ4.setCellValue("Custo");
- sheet1.setColumnWidth(9, 2500);
- XSSFCell AnaK4 = cabRowAnalitico3.getCell(10);
- AnaK4.setCellStyle(estiloS1);
- AnaK4.setCellValue("Hono");
- sheet1.setColumnWidth(10, 2500);
- XSSFCell AnaL4 = cabRowAnalitico3.getCell(11);
- AnaL4.setCellStyle(estiloS1);
- AnaL4.setCellValue("Valor");
- sheet1.setColumnWidth(11, 3000);
- XSSFCell AnaL5 = cabRowAnalitico3.getCell(12);
- AnaL5.setCellStyle(estiloS1);
- AnaL5.setCellValue("Numero do Lote");
- sheet1.setColumnWidth(12, 4200);
- //Percorre a lista e preenche as celulas
- int cont2 = 0;
- for (int i = 0; i < listaContatoslt.size(); i++) {
- XSSFRow cabRowAnalitico7 = sheet1.createRow(i + 4);
- for (int x = 0; x <= 12; x++) {
- cabRowAnalitico7.createCell(x);
- }
- XSSFCell cellAnaA5 = cabRowAnalitico7.getCell(0);
- cellAnaA5.setCellStyle(estiloS2);
- cellAnaA5.setCellValue(listaContatoslt.get(i).getNumeroDocumento());
- XSSFCell cellAnaB5 = cabRowAnalitico7.getCell(1);
- cellAnaB5.setCellStyle(estiloS2);
- cellAnaB5.setCellValue(listaContatoslt.get(i).getCodigo());
- XSSFCell cellAnaC5 = cabRowAnalitico7.getCell(2);
- cellAnaC5.setCellStyle(estiloS2);
- cellAnaC5.setCellValue(listaContatoslt.get(i).getNomeBeneficiario());
- XSSFCell cellAnaD5 = cabRowAnalitico7.getCell(3);
- cellAnaD5.setCellStyle(estiloS2);
- cellAnaD5.setCellValue(listaContatoslt.get(i).getData());
- XSSFCell cellAnaE5 = cabRowAnalitico7.getCell(4);
- cellAnaE5.setCellStyle(estiloS2);
- cellAnaE5.setCellValue(listaContatoslt.get(i).getProcedimento());
- XSSFCell cellAnaF5 = cabRowAnalitico7.getCell(5);
- cellAnaF5.setCellStyle(estiloS2);
- cellAnaF5.setCellValue("Outras Tabelas");
- XSSFCell cellAnaG5 = cabRowAnalitico7.getCell(6);
- cellAnaG5.setCellStyle(estiloS2);
- cellAnaG5.setCellValue(listaContatoslt.get(i).getDescricaoProced());
- XSSFCell cellAnaH5 = cabRowAnalitico7.getCell(7);
- cellAnaH5.setCellStyle(estiloS2);
- cellAnaH5.setCellValue(listaContatoslt.get(i).getQtdExecutada());
- XSSFCell cellAnaI5 = cabRowAnalitico7.getCell(8);
- cellAnaI5.setCellStyle(estiloS1);
- BigDecimal valorfilme = listaContatoslt.get(i).getCustoFilme();
- cellAnaI5.setCellValue(valorfilme.floatValue());
- XSSFCell cellAnaJ5 = cabRowAnalitico7.getCell(9);
- cellAnaJ5.setCellStyle(estiloS1);
- BigDecimal valorServ = listaContatoslt.get(i).getCustoServico();
- cellAnaJ5.setCellValue(valorServ.floatValue());
- XSSFCell cellAnaK5 = cabRowAnalitico7.getCell(10);
- cellAnaK5.setCellStyle(estiloS1);
- BigDecimal valorHono = listaContatoslt.get(i).getHonorario();
- cellAnaK5.setCellValue(valorHono.floatValue());
- // if (listaContatoslt.get(i).getTipoGlosa() != null) {
- // XSSFCell cellAnaL5 = cabRowAnalitico7.getCell(11);
- // cellAnaL5.setCellStyle(estiloS1);
- // float xxx = 0f;
- // cellAnaL5.setCellValue(xxx);
- // } else {
- XSSFCell cellAnaL5 = cabRowAnalitico7.getCell(11);
- cellAnaL5.setCellStyle(estiloS1);
- BigDecimal valort = listaContatoslt.get(i).getValorTotalInformado();
- cellAnaL5.setCellValue(valort.floatValue());
- // }
- XSSFCell cellAnaE12 = cabRowAnalitico7.getCell(12);
- cellAnaE12.setCellStyle(estiloS1);
- cellAnaE12.setCellValue(listaContatoslt.get(i).getNumLote());
- cont2++;
- }
- XSSFRow cabRowLinha8 = sheet1.createRow((cont2 * 1) + 8);
- for (int i = 0; i <= 12; i++) {
- cabRowLinha8.createCell(i);
- }
- XSSFCell cellAnaA8 = cabRowLinha8.getCell(0);
- cellAnaA8.setCellStyle(estiloS1);
- cellAnaA8.setCellValue("TOTAL DO PRESTADOR");
- XSSFCell cellAnaB8 = cabRowLinha8.getCell(12);
- BigDecimal valorLiberadoGeral = listaCabecalho.getValorLiberadoGeral();
- cellAnaB8.setCellStyle(estiloS1);
- cellAnaB8.setCellValue(valorLiberadoGeral.floatValue());
- XSSFRow cabRowLinha13 = sheet1.createRow((cont2 * 1) + 9);
- for (int i = 0; i <= 12; i++) {
- cabRowLinha13.createCell(i);
- }
- XSSFCell cellAnaA13 = cabRowLinha13.getCell(0);
- cellAnaA13.setCellStyle(estiloS1);
- cellAnaA13.setCellValue("TOTAL DO LOTE");
- XSSFCell cellAnaB13 = cabRowLinha13.getCell(12);
- BigDecimal valorProtocolo = listaCabecalho.getValorLiberadoGeral();
- cellAnaB13.setCellStyle(estiloS1);
- cellAnaB13.setCellValue(valorProtocolo.floatValue());
- /*-----------------------GUIA ANALITICO*-----------------------*/
- /*-----------------------GUIA ANALITICO*-----------------------*/
- /*-----------------------GUIA GLOSA*-----------------------*/
- /*-----------------------GUIA GLOSA*-----------------------*/
- //1º Grupo de linhas Glosa, cabeçalho
- XSSFRow cabRowGlosa00 = sheet2.createRow(0);
- for (int i = 0; i <= 10; i++) {
- cabRowGlosa00.createCell(i);
- }
- XSSFCell cellGlosaA0 = cabRowGlosa00.getCell(0);
- cellGlosaA0.setCellStyle(estiloS1);
- cellGlosaA0.setCellValue("Nº Doc");
- sheet2.setColumnWidth(0, 5300);
- XSSFCell cellGlosaB0 = cabRowGlosa00.getCell(1);
- cellGlosaB0.setCellStyle(estiloS1);
- cellGlosaB0.setCellValue("Código");
- sheet2.setColumnWidth(1, 4300);
- XSSFCell cellGlosaC0 = cabRowGlosa00.getCell(2);
- cellGlosaC0.setCellStyle(estiloS1);
- cellGlosaC0.setCellValue("USUÁRIO");
- sheet2.setColumnWidth(2, 10000);
- XSSFCell cellGlosaD0 = cabRowGlosa00.getCell(3);
- cellGlosaD0.setCellStyle(estiloS1);
- cellGlosaD0.setCellValue("DATA");
- sheet2.setColumnWidth(3, 3200);
- XSSFCell cellGlosaE0 = cabRowGlosa00.getCell(4);
- cellGlosaE0.setCellStyle(estiloS1);
- cellGlosaE0.setCellValue("PROCED.");
- sheet2.setColumnWidth(4, 3000);
- XSSFCell cellGlosaF0 = cabRowGlosa00.getCell(5);
- cellGlosaF0.setCellStyle(estiloS1);
- cellGlosaF0.setCellValue("TABELA");
- sheet2.setColumnWidth(5, 4300);
- XSSFCell cellGlosaG0 = cabRowGlosa00.getCell(6);
- cellGlosaG0.setCellStyle(estiloS1);
- cellGlosaG0.setCellValue("DESCRIÇÃO DO PROCED.");
- sheet2.setColumnWidth(6, 8000);
- XSSFCell cellGlosaH0 = cabRowGlosa00.getCell(7);
- cellGlosaH0.setCellStyle(estiloS1);
- cellGlosaH0.setCellValue("QTD.");
- sheet2.setColumnWidth(7, 2000);
- XSSFCell cellGlosaI0 = cabRowGlosa00.getCell(8);
- cellGlosaI0.setCellStyle(estiloS1);
- cellGlosaI0.setCellValue("TIPO");
- sheet2.setColumnWidth(8, 2000);
- XSSFCell cellGlosaJ0 = cabRowGlosa00.getCell(9);
- cellGlosaJ0.setCellStyle(estiloS1);
- cellGlosaJ0.setCellValue("MOTIVO");
- sheet2.setColumnWidth(9, 7300);
- XSSFCell cellGlosaK0 = cabRowGlosa00.getCell(10);
- cellGlosaK0.setCellStyle(estiloS1);
- cellGlosaK0.setCellValue("VALOR");
- sheet2.setColumnWidth(10, 3200);
- int contGlosa = 0;
- int contGlosa1 = 0;
- int tam = 0;
- for (int i = 0; i < listaGlosa.size(); i++) {
- XSSFRow cabRowGlosa = sheet2.createRow(1 + i);
- tam = 1 + i;
- for (int x = 0; x <= 10; x++) {
- cabRowGlosa.createCell(x);
- }
- XSSFCell cellGlosaA1 = cabRowGlosa.getCell(0);
- cellGlosaA1.setCellStyle(estiloS2);
- cellGlosaA1.setCellValue(listaGlosa.get(i).getCodigo());
- XSSFCell cellGlosaB2 = cabRowGlosa.getCell(1);
- cellGlosaB2.setCellStyle(estiloS2);
- cellGlosaB2.setCellValue(listaGlosa.get(i).getNumeroDocumento());
- XSSFCell cellGlosaC2 = cabRowGlosa.getCell(2);
- cellGlosaC2.setCellStyle(estiloS2);
- cellGlosaC2.setCellValue(listaGlosa.get(i).getNomeBeneficiario());
- XSSFCell cellGlosaD2 = cabRowGlosa.getCell(3);
- cellGlosaD2.setCellStyle(estiloS2);
- cellGlosaD2.setCellValue(listaGlosa.get(i).getData());
- XSSFCell cellGlosaE2 = cabRowGlosa.getCell(4);
- cellGlosaE2.setCellStyle(estiloS2);
- cellGlosaE2.setCellValue(listaGlosa.get(i).getProcedimento());
- XSSFCell cellGlosaG2 = cabRowGlosa.getCell(5);
- cellGlosaG2.setCellStyle(estiloS2);
- cellGlosaG2.setCellValue("Outras Tabelas");
- XSSFCell cellGlosaF2 = cabRowGlosa.getCell(6);
- cellGlosaF2.setCellStyle(estiloS2);
- cellGlosaF2.setCellValue(listaGlosa.get(i).getDescricaoProced());
- XSSFCell cellGlosaH2 = cabRowGlosa.getCell(7);
- cellGlosaH2.setCellStyle(estiloS2);
- cellGlosaH2.setCellValue(listaGlosa.get(i).getQtdExecutada());
- XSSFCell cellGlosaI2 = cabRowGlosa.getCell(8);
- cellGlosaI2.setCellStyle(estiloS2);
- cellGlosaI2.setCellValue(listaGlosa.get(i).getTipoGlosa());
- XSSFCell cellGlosaJ2 = cabRowGlosa.getCell(9);
- cellGlosaJ2.setCellStyle(estiloS2);
- cellGlosaJ2.setCellValue(listaGlosa.get(i).getDescGlosa());
- XSSFCell cellGlosaK2 = cabRowGlosa.getCell(10);
- BigDecimal valorGlosa = listaGlosa.get(i).getValorGlosa();
- cellGlosaK2.setCellStyle(estiloS1);
- cellGlosaK2.setCellValue(valorGlosa.floatValue());
- contGlosa++;
- contGlosa1++;
- }
- XSSFRow cabRowGlosa3 = sheet2.createRow(tam + 2);
- for (int i = 0; i <= 10; i++) {
- cabRowGlosa3.createCell(i);
- }
- XSSFCell cellGlosaL2 = cabRowGlosa3.getCell(0);
- cellGlosaL2.setCellStyle(estiloS1);
- cellGlosaL2.setCellValue("TOTAL:");
- XSSFCell cellAnaM8 = cabRowGlosa3.getCell(10);
- BigDecimal valorGlosaTotal = listaCabecalho.getValorGlosaGeral();
- cellAnaM8.setCellStyle(estiloS1);
- cellAnaM8.setCellValue(valorGlosaTotal.floatValue());
- /*-----------------------GUIA GLOSA*-----------------------*/
- /*-----------------------GUIA GLOSA*-----------------------*/
- wb.write(out);
- out.close();
- } catch (IOException ex) {
- Logger.getLogger(RelatorioExcel.class.getName()).log(Level.SEVERE, null, ex);
- }
- return caminho;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement