Examples of JRPrintPage


Examples of net.sf.jasperreports.engine.JRPrintPage

    try {

      int posX = convert(10);
      posY = convert(7);

      JRPrintPage page = new JRBasePrintPage();

      page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
      page.addElement(printImage("corporateLogo.jpg", posX + 11, posY, 65, 45));
      page.addElement(insertTitle("Contrato de Presta��o de Servi�o", posX + 200, posY + 11, 330));

      createStudentIdentificationContractItem(posX, page);
      createScheduleContractItem(posX, page);
      if (idRegistration != null) {
        configureScheduleTable(posX, page);
      }
      createContractedCursesContractItem(posX, page);
      createDeadlineBeginAndHoursContractItem(posX, page);
      createValueContractItem(posX, page);
      createMonthlyAndPaymentConditionsContractItem(posX, page);
      createGuarantorIdentificationContractItem(posX, page);
      createEmployeeContractItem(posX, page);

      for (int i = 0; i < pages.size(); i++) {
        if (i == 0) {
          page.addElement(printNormalText(pages.get(i), posX + 2, posY + 20, 531, 737));
        } else {
          posY = convert(5);
          page = new JRBasePrintPage();
          page.addElement(printNormalText(pages.get(i), posX, posY, 531, convert(280)));
        }
        jasperPrint.addPage(page);
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of net.sf.jasperreports.engine.JRPrintPage

        try {
            int posX = convert(10);
            int posY = convert(10);
           
            JRPrintPage page = new JRBasePrintPage();
           
            page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
//            page.addElement(printImage("logoReport.gif", posX+11, posY, 65, 45));
            page.addElement(insertTitle("RELAT�RIO DE CHEQUES", posX+200, posY+11, 250));
            page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
           
            posY += 50;
           
            page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
            page.addElement(insertNormalText("Filtrado por: " + optionComboDate, posX+5, posY+5, 200));
            page.addElement(insertRightText((optionComboDate.equals("Todos") ? "" : "Per�odo: " + startDate + " � " + endDate), posX+250, posY+5, convert(190)-255));
           
            posY += 25;
           
            for(List<String> input: checkDataMap.values()){
                page.addElement(drawRectangle(posX, posY, convert(190), 60, 0));
                page.addElement(insertBoldText("Nome do Aluno:", posX+2, posY+2, 75));
                page.addElement(insertNormalText(input.get(2), posX+77, posY+2, convert(190)-77));
                page.addElement(insertBoldText("Titular:", posX+2, posY+17, 35));
                page.addElement(insertNormalText(input.get(7), posX+37, posY+17, 200));
                page.addElement(insertBoldText("Telefone:", posX+242, posY+17, 40));
                page.addElement(insertNormalText(input.get(8), posX+284, posY+17, 80));
                page.addElement(insertBoldText("Banco:", posX+2, posY+32, 35));
                page.addElement(insertNormalText(input.get(3), posX+37, posY+32, 30));
                page.addElement(insertBoldText("Ag�ncia:", posX+66, posY+32, 40));
                page.addElement(insertNormalText(input.get(4), posX+107, posY+32, 35));
                page.addElement(insertBoldText("Conta:", posX+142, posY+32, 35));
                page.addElement(insertNormalText(input.get(5), posX+180, posY+32, 35));
                page.addElement(insertBoldText("N� Ch.:", posX+220, posY+32, 45));
                page.addElement(insertNormalText(input.get(6), posX+260, posY+32, 35));
                page.addElement(insertBoldText("Emiss�o:", posX+310, posY+32, 45));
                page.addElement(insertNormalText(input.get(9), posX+357, posY+32, 50));
                page.addElement(insertBoldText("Vencimento:", posX+410, posY+32, 55));
                page.addElement(insertNormalText(input.get(10), posX+467, posY+32, 50));
                page.addElement(insertBoldText("Valor:", posX+2, posY+47, 30));
                page.addElement(insertNormalText(input.get(11), posX+35, posY+47, 60));
                page.addElement(insertBoldText("Observa��o:", posX+100, posY+47, 75));
                page.addElement(insertNormalText(input.get(12), posX+180, posY+47, 355));
               
                posY += 60;
               
                if(posY+70 > convert(290)){
                    page.addElement(insertFooter());
                    jasperPrint.addPage(page);
                    page = new JRBasePrintPage();
                    posY = convert(10);
                }
            }
           
            page.addElement(insertFooter());
            jasperPrint.addPage(page);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jasperPrint;
View Full Code Here

Examples of net.sf.jasperreports.engine.JRPrintPage

  }

  protected void createHyperlinks()
  {
    java.util.List pages = jasperPrint.getPages();
    JRPrintPage page = (JRPrintPage)pages.get(pageIndex);
    createHyperlinks(page.getElements(), 0, 0);
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.JRPrintPage

       
        try {
            int posX = convert(10);
            int posY = convert(7);
           
            JRPrintPage page = new JRBasePrintPage();
           
            page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
            page.addElement(printImage("corporateLogo.jpg", posX+11, posY, 65, 45));
           
            text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
            text.setText("FICHA DE CADASTRO");
            text.setX(posX+251);
            text.setY(posY+11);
            text.setWidth(200);
            text.setHeight(22);
            text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_RIGHT);
            text.setLineSpacingFactor(2.0f);
            text.setLeadingOffset(-4.0f);
            text.setStyle(titleStyle);
            page.addElement(text);
           
//            page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
           
            posY += 45;
           
            page.addElement(printTitleText("Dados Pessoais", posX+2, posY+3, 98));
            page.addElement(printNormalText("Nome:", posX+2, posY+19, 31));
            page.addElement(printRectangle(posX+36, posY+19, 412, 20, 3));
           
            rectangle = new JRBasePrintRectangle(jasperPrint.getDefaultStyleProvider());
            rectangle.setX(posX+478);
            rectangle.setY(posY+19);
            rectangle.setWidth(56);
            rectangle.setHeight(13);
            rectangle.setRadius(3);
            rectangle.setBackcolor(new Color(204, 204, 204));
            page.addElement(rectangle);
           
            page.addElement(printRectangle(posX+484, posY+21, 8, 8, 0));
            page.addElement(printRectangle(posX+511, posY+21, 8, 8, 0));
            page.addElement(printNormalText("Sexo:        M       F", posX+450, posY+19, 83));
            page.addElement(printRectangle(posX+36, posY+43, 96, 13, 3));
            page.addElement(printNormalText("Nasc.:          /        /", posX+2, posY+43, 88));
            page.addElement(printNormalText("Nacionalidade:", posX+136, posY+43, 65));
            page.addElement(printRectangle(posX+203, posY+43, 135, 13, 3));
            page.addElement(printNormalText("Estado Civil:", posX+341, posY+43, 56));
            page.addElement(printRectangle(posX+400, posY+43, 135, 13, 3));
           
            page.addElement(printNormalText("CPF:", posX+2, posY+60, 32));
            page.addElement(printRectangle(posX+36, posY+60, 132, 13, 3));
            page.addElement(printNormalText("RG:", posX+171, posY+60, 20));
            page.addElement(printRectangle(posX+193, posY+60, 132, 13, 3));
            page.addElement(printNormalText("E-mail:", posX+328, posY+60, 32));
            page.addElement(printRectangle(posX+362, posY+60, 172, 13, 3));

            page.addElement(printNormalText("Endere�o:", posX+2, posY+77, 47));
            page.addElement(printRectangle(posX+51, posY+77, 483, 13, 3));
           
            page.addElement(printNormalText("Compl.:", posX+2, posY+94, 36));
            page.addElement(printRectangle(posX+40, posY+94, 115, 13, 3));
            page.addElement(printNormalText("CEP:", posX+158, posY+94, 25));
            page.addElement(printRectangle(posX+184, posY+94, 96, 13, 3));
            page.addElement(printNormalText("Cidade:", posX+283, posY+94, 35));
            page.addElement(printRectangle(posX+320, posY+94, 166, 13, 3));
            page.addElement(printNormalText("UF:", posX+489, posY+94, 17));
            page.addElement(printRectangle(posX+508, posY+94, 26, 13, 3));
           
            page.addElement(printNormalText("Telefone Res.:", posX+2, posY+111, 68));
            page.addElement(printRectangle(posX+72, posY+111, 304, 13, 3));
            page.addElement(printNormalText("M�vel:", posX+379, posY+111, 31));
            page.addElement(printRectangle(posX+412, posY+111, 122, 13, 3));
           
            page.addElement(printTitleText("Dados Adicionais", posX+2, posY+128, 106));
           
            page.addElement(printRectangle(posX+2, posY+148, 6, 6, 0));
            page.addElement(printMiniText("Fund. Incompleto", posX+11, posY+146, 74));
            page.addElement(printRectangle(posX+2, posY+157, 6, 6, 0));
            page.addElement(printMiniText("M�dio Incompleto", posX+11, posY+155, 74));
            page.addElement(printRectangle(posX+2, posY+166, 6, 6, 0));
            page.addElement(printMiniText("Superior Imcompleto", posX+11, posY+164, 74));
            page.addElement(printRectangle(posX+92, posY+148, 6, 6, 0));
            page.addElement(printMiniText("Fund. Completo", posX+101, posY+146, 68));
            page.addElement(printRectangle(posX+92, posY+157, 6, 6, 0));
            page.addElement(printMiniText("M�dio Completo", posX+101, posY+155, 68));
            page.addElement(printRectangle(posX+92, posY+166, 6, 6, 0));
            page.addElement(printMiniText("Superior", posX+101, posY+164, 68));
           
            page.addElement(printNormalText("Escola:", posX+176, posY+146, 34));
            page.addElement(printRectangle(posX+212, posY+146, 322, 13, 3));
            page.addElement(printNormalText("Empresa:", posX+176, posY+163, 44));
            page.addElement(printRectangle(posX+222, posY+163, 208, 13, 3));
            page.addElement(printNormalText("Tel.:", posX+433, posY+163, 20));
            page.addElement(printRectangle(posX+455, posY+163, 79, 13, 3));
           
            page.addElement(printTitleText("Dados Respons�vel", posX+2, posY+177, 119));
           
            page.addElement(printNormalText("Nome:", posX+2, posY+194, 29));
            page.addElement(printRectangle(posX+33, posY+194, 397, 20, 3));
            page.addElement(printNormalText("Tel.:", posX+433, posY+194, 20));
            page.addElement(printRectangle(posX+455, posY+194, 79, 13, 3));
           
            page.addElement(printNormalText("Parentesco:", posX+2, posY+218, 54));
            page.addElement(printRectangle(posX+58, posY+218, 157, 13, 3));
            page.addElement(printNormalText("CPF:", posX+219, posY+218, 24));
            page.addElement(printRectangle(posX+245, posY+218, 132, 13, 3));
            page.addElement(printNormalText("RG:", posX+381, posY+218, 19));
            page.addElement(printRectangle(posX+402, posY+218, 132, 13, 3));
           
            page.addElement(printTitleText("Pesquisa", posX+2, posY+238, 58));
           
            page.addElement(printNormalText("Como Conheceu:", posX+2, posY+257, 77));
            page.addElement(printRectangle(posX+81, posY+257, 258, 13, 3));
            page.addElement(printNormalText("Motivo:", posX+342, posY+257, 33));
            page.addElement(printRectangle(posX+377, posY+257, 157, 13, 3));
           
            page.addElement(printNormalText("Atendido Por:", posX+2, posY+274, 77));
            page.addElement(printRectangle(posX+81, posY+274, 258, 13, 3));
            page.addElement(printRectangle(posX+440, posY+274, 94, 13, 3));
            page.addElement(printNormalText("Data do Atendimento:        /        /", posX+342, posY+274, 154));
           
            page.addElement(printTitleText("Cursos", posX+2, posY+292, 47));
           
            posY += 311;
           
            Map<String, Course> courses = (Map <String, Course>) system.query(new GetCourse(null));
            List<Course> coursesList = new ArrayList<Course>(courses.values());
            SortComparator comparator = new SortComparator();
            Collections.sort(coursesList, comparator);
            int cont=0;
            for (int i=0; i<coursesList.size(); i++) {
              if(coursesList.get(i).isActive()){
                page.addElement(printRectangle(posX+Math.round((535/3)*(cont%3))+6, posY+3, 6, 6, 0));
                page.addElement(printNormalText(coursesList.get(i).getDescription(), posX+Math.round((535/3)*(cont%3))+16, posY, 162));
                if(cont%3 == 2 || i == coursesList.size()-1){
                  posY +=13;
                }
                cont++ ;
              }
            }
           
            page.addElement(printRectangle(posX+2, posY+10, 188, 100, 5));
            page.addElement(printTitleText("  Financeiro:", posX+16, posY+2, 74));
           
            page.addElement(printNormalText("Valor da Mens.:", posX+8, posY+20, 90));
            page.addElement(printNormalText("R$ ________,____", posX+100, posY+20, 87));
            page.addElement(printNormalText("Desc. Pontualidade:", posX+8, posY+32, 90));
            page.addElement(printNormalText("R$ ________,____", posX+100, posY+32, 87));
            page.addElement(printNormalText("VALOR TOTAL:", posX+8, posY+52, 90));
            page.addElement(printNormalText("R$ ________,____", posX+100, posY+52, 87));
            page.addElement(printNormalText("N� de parcelas: ______", posX+78, posY+74, 106));
            page.addElement(printNormalText("Data da 1� parcela: ____/____/_______", posX+4, posY+91, 181));
           
            int totalOfHours = endWorkTime - startWorkTime - getHourVacancy(startWorkTime, endWorkTime);
            page.addElement(printRectangle(posX+195, posY+9, 337, 40+((totalOfHours+1)*10), 5));
            page.addElement(printTitleText("  Dia/Hor�rio:", posX+439, posY+2, 80));
           
            int width = Math.round(330/(workDays.size()+1));
            for(int i=0; i<workDays.size(); i++){
                page.addElement(printMiniText(workDays.get(i), posX+(width*(i%(workDays.size()+1)))+200+width, posY+19, width));
            }
            int posYTemp = 0;
            for(int i=0; i<workDays.size()+1; i++){
                posYTemp = posY+29;
                for(int j=0; j<25; j++){
                    if(!isHourVacancy(j)){
                        page.addElement(printRectangle(posX+(width*(i%(workDays.size()+1)))+199, posYTemp, width, 10, 0));
                        if(i==0){
                            page.addElement(printMiniText(j+":00", posX+(width*(i%(workDays.size()+1)))+205, posYTemp+1, width));
                        }
                        posYTemp+=10;
                    }
                }
            }
            posY = posYTemp;
           
            page.addElement(printNormalText("In�cio do Curso: ____/_____/________.", posX+346, posY+4, 181));
           
            JRPrintLine line = new JRBasePrintLine(jasperPrint.getDefaultStyleProvider());
            line.setX(posX+2);
            line.setY(convert(290)-40);
            line.setWidth(188);
            line.setHeight(0);
            page.addElement(line);
            page.addElement(printNormalText("Assinatura do Aluno / Respons�vel", posX+12, convert(290)-40, 169));

            page.addElement(printMiniText("Observa��es no verso.", posX+451, convert(290)-30, 90));
           
            page.addElement(printMiniText("Criado por Gerente Digital.", posX+190, convert(290)-10, 157));
           
            jasperPrint.addPage(page);
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of net.sf.jasperreports.engine.JRPrintPage

            for(Person person : employeeList){
                Employee employee = (Employee) person.getPersonType("employee");
                int posX = convert(10);
                int posY = convert(7);
               
                JRPrintPage page = new JRBasePrintPage();
               
                page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
//                page.addElement(printImage("logoReport.gif", posX+11, posY, 65, 45));
                page.addElement(insertTitle("HOLERITE", posX+200, posY+11, 250));
                page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
               
                posY += 50;
               
                page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                page.addElement(insertBoldText("Nome: ", posX+5, posY+3, 40));
                page.addElement(insertNormalText(person.getName(), posX+45, posY+3, convert(190)-40, 15));
               
                posY += 25;
               
                page.addElement(insertBoldText("CPF: ", posX+2, posY, 30));
                page.addElement(insertNormalText(person.getCpf(), posX+30, posY, 100, 15));
                page.addElement(insertBoldText("RG: ", posX+132, posY, 30));
                page.addElement(insertNormalText(person.getRg(), posX+160, posY, 100, 15));
                page.addElement(insertBoldText("Per�odo de                          �", posX+262, posY, convert(190)-262));
                page.addElement(drawHorizontalLine(posX, posY+15, convert(190)));
               
                posY += 15;
               
                createFinantialTableHeader(posX, posY, page);
               
                posY += 15;
               
                int cont = 1;
                Money totalCredit = new Money(0);
                Money totalDebit = new Money(0);
                for(FinancialInfo financialInfo : employee.getFinantialInfo()){
                    if(isDateIntoFinancialInfo(financialInfo, date)) {
                        page.addElement(drawRectangle(posX, posY, convert(190), 15, 0));
                        page.addElement(insertRightText(String.valueOf(cont), posX+2, posY, 36));
                        page.addElement(drawVerticalLine(posX+40, posY, 15));
                        page.addElement(insertRightText(String.valueOf(financialInfo.getDate().getMonth()), posX+42, posY, 66));
                        page.addElement(drawVerticalLine(posX+110, posY, 15));
                        page.addElement(insertNormalText(financialInfo.getDescription(), posX+112, posY, 271, 15));
                        page.addElement(drawVerticalLine(posX+385, posY, 15));
                        page.addElement(insertRightText(financialInfo.isCredit() ? financialInfo.getValue().getFormatedValue() : "", posX+387, posY, 67));
                        page.addElement(drawVerticalLine(posX+460, posY, 15));
                        page.addElement(insertRightText(financialInfo.isCredit() ? "" : financialInfo.getValue().getFormatedValue(), posX+462, posY, 67));
                       
                        posY += 15;
                        cont++;
                        if(financialInfo.isCredit())
                            totalCredit.credit(financialInfo.getValue());
                        else
                            totalDebit.credit(financialInfo.getValue());
                    }
                }
                page.addElement(drawRectangle(posX, posY, convert(190), 15, 0));
                page.addElement(insertBoldText("TOTAL", posX+2, posY, 381));
                page.addElement(drawVerticalLine(posX+385, posY, 15));
                page.addElement(insertRightText(totalCredit.getFormatedValue(), posX+387, posY, 67));
                page.addElement(drawVerticalLine(posX+460, posY, 15));
                page.addElement(insertRightText(totalDebit.getFormatedValue(), posX+462, posY, 67));
               
                posY += 20;
               
                Money total = new Money(totalCredit);
                total.debit(totalDebit);
                page.addElement(insertBoldText("Total L�quido: R$ " + total.getFormatedValue() , posX+370, posY, convert(190)-370));
               
                posY += 35;
                page.addElement(insertNormalText("Recebi a importancia de R$ " + total.getFormatedValue() + " dando plena, geral e irrevog�vel quita��o referente aos itens acima descritos:", posX, posY, convert(190), 30));
                posY += 35;
               
                page.addElement(drawHorizontalDottedLine(0, posY, convert(210)));
               
                page.addElement(drawGrayRectangle(posX+200, posY+10, 135, 20, 3));
                page.addElement(insertCenterBoldText("R E C I B O", posX+200, posY+15, 135));
               
                posY += 50;
                page.addElement(insertBoldText("Per�odo de                          �", posX+262, posY, convert(190)-262));
               
                posY += 15;
                page.addElement(drawRectangle(posX, posY, 535, 100, 5));
                page.addElement(insertNormalText("Referente �:", posX+5, posY+5, 530, 15));
               
                posY += 200;
               
                page.addElement(insertNormalText("Data: _____/_____/_________.", posX, posY-15, 200, 15));
                page.addElement(drawHorizontalLine(posX+convert(95), posY, convert(95)));
                page.addElement(insertCenterBoldText(person.getName(), posX+convert(95), posY, +convert(95)));
               
                page.addElement(insertFooter());
                jasperPrint.addPage(page);
            }
           
           
        } catch (Exception e) {
View Full Code Here

Examples of net.sf.jasperreports.engine.JRPrintPage

        boldStyle_8.setPdfEncoding("Cp1252");
        boldStyle_8.setPdfEmbedded(false);
        jasperPrint.addStyle(boldStyle_8);

       
        JRPrintPage page = new JRBasePrintPage();
        posY = convert(10);
        int posX = convert(10);
       
        try {
            page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
//            page.addElement(printImage("logoReport.gif", posX+11, posY, 65, 45));
           
            page.addElement(insertTitle(contTitle, posX+65, posY+11, 385));
            page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
           
            List<Registration> registrationList = new ArrayList<Registration>();
            int totalPerAttendant = 0;
           
            posY += 50;

            if(type == 1) {
              totalPerAttendant = 0;

              Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
              registrationList.clear();
              for (Registration registration : registrationMap.values()) {
                GDDate registrationDate = new GDDate(registration.getRegistrationDate());
                if(registration.isActive() && (ignoreDate ? true : (registrationDate.afterOrEqualsDay(startDate) && registrationDate.beforeOrEqualsDay(finishDate)))) {
                  registrationList.add(registration);
                }
              }      
              if(registrationList.size()>0){
                MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
               
                sortAlgorithm.sortRegistrationByDate(registrationList);
              }
              insertRegisteredtHeaderTable(page, posX);
              total = 0;

              for (Registration registration : registrationList) {
                insertRegisteredDataTable(page, posX, registration);
                totalPerAttendant++;
                if(posY > (convert(277)-20)){
                  jasperPrint.addPage(page);
                  page = new JRBasePrintPage();
                  posY = convert(10);
                }
                if(posY > (convert(277)-20)){
                  jasperPrint.addPage(page);
                  page = new JRBasePrintPage();
                  posY = convert(10);
                }
              }

              page.addElement(insertFooter(boldStyle, "Total de Alunos Ativos: "+totalPerAttendant+"         Total R$ "+new Money(total).getFormatedValue(), posY));
              int totalRegistrered = totalPerAttendant;
              float totalPayed = total;
              posY += 30;
              page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
            if(posY > (convert(277)-20)){
              jasperPrint.addPage(page);
              page = new JRBasePrintPage();
              posY = convert(10);
            }
              page.addElement(insertTitle("Alunos Matr�culados no per�odo, j� Finalizadas.", posX+35, posY+11, 410));
              page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
              posY += 55;
              totalPerAttendant = 0;
              total = (float) 0.0;
              registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
              registrationList.clear();
              for (Registration registration : registrationMap.values()) {
                GDDate registrationDate = new GDDate(registration.getRegistrationDate());
                if(!registration.isActive() && (ignoreDate ? true : (registrationDate.afterOrEqualsDay(startDate) && registrationDate.beforeOrEqualsDay(finishDate)))) {
                  registrationList.add(registration);
                }
              }      
              if(registrationList.size()>0){
                MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
                sortAlgorithm.sortRegistrationByDate(registrationList);
              }

              insertRegisteredtHeaderTable(page, posX);

              total = 0;

              for (Registration registration : registrationList) {
                insertRegisteredDataTable(page, posX, registration);
                totalPerAttendant++;
                if(posY > (convert(277)-20)){
                  jasperPrint.addPage(page);
                  page = new JRBasePrintPage();
                  posY = convert(10);
                }
              }
              page.addElement(insertFooter(boldStyle, "Total de Alunos Desativatos: "+totalPerAttendant+"         Total R$ "+new Money(total).getFormatedValue(), posY));
              posY += 30;
              page.addElement(insertFooter(boldStyle, "Total Geral de Alunos no Periodo: "+(totalRegistrered+totalPerAttendant)+"         Total R$ "+new Money(total+totalPayed).getFormatedValue(), posY));
              jasperPrint.addPage(page);
            }
            else if(type == 2){
              int totalStudents = 0;
              Money totalMoney = new Money(0.0);
              Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
              registrationList.clear();
              for (Registration registration : registrationMap.values()) {
                if(registration.isActive()) {
                  registrationList.add(registration);
                }
              }                 
              if(registrationList.size()>0){
                MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
                sortAlgorithm.sortRegistrationByDate(registrationList);
              }
              Map <String, Person> attendantMap = (Map<String, Person>) system.query(new GetEmployee());
              for (Person attendant : attendantMap.values()) {
                total = 0;
                int i = 0;
                totalPerAttendant = 0;
                for (Registration registration : registrationList) {
//                  String attendantName = ((Person) system.query(new GetEmployee(((Student) registration.getStudent().getPersonType("student")).getAttendanceResponsable()))).getName();
                  GDDate registrationDate = new GDDate(registration.getRegistrationDate());
                  if((registration.getEmployee().getName().equals(attendant.getName())) && (ignoreDate ? true : (registrationDate.afterOrEqualsDay(startDate) && registrationDate.beforeOrEqualsDay(finishDate)))) {
                    if(i == 0) {
                      page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                      page.addElement(insertTitle(boldStyle, attendant.getName(), posX+5, posY+5));
                      posY += 25;
                      insertRegisteredByAttendentHeaderTable(page, posX);
                    }
                    boolean addinfo = true;
                    String paidParcelsAndTotalParcels = ("00 / " + (registration.getParcels().size() > 9 ? registration.getParcels().size() :"0"+registration.getParcels().size()));;
                    String parcelDate = "___/___/___";
                    String parcelPayDate = "___/___/___";
                    String parcelValueBeforeParcelDateExpiration = "R$_________";
                    List<Parcel> parcels = registration.getParcels();
                    int parcelid = 1;
                    for (int p = 0; p < parcels.size(); p++ ){
                      Parcel parcel = parcels.get(p);
                      if (!parcel.isRegistrationTax()){
                        if ( parcelid==1 ){
                          totalPerAttendant++; 
                          total += new Money(parcel.getValueBeforeParcelDateExpiration()).getFloatValue();
                          totalStudents++;
                          totalMoney.credit(parcel.getValueBeforeParcelDateExpiration());
                        }
                        if ( parcel.getPayDate() != null){
                          paidParcelsAndTotalParcels = (parcelid > 9 ? parcelid : "0"+(parcelid) ) + " / " ( registration.getParcels().size() > 9 ? registration.getParcels().size() :"0"+registration.getParcels().size());
                        }
                       
                        GDDate parcelGDDate = new GDDate(parcel.getDate());
                        if ( parcelGDDate.afterOrEqualsDay(startDate) && parcelGDDate.beforeOrEqualsDay(finishDate)){
                          parcelDate = parcel.getDate();
                          parcelPayDate = (parcel.getPayDate() == null ? "___/___/___":parcel.getPayDate().getFormatedDate());
                          parcelValueBeforeParcelDateExpiration = "R$ " + new Money(parcel.getValueBeforeParcelDateExpiration()).getFormatedValue();
                          addinfo = false;
                        }

                        if (addinfo && parcelid == parcels.size()){
                          parcelDate = parcel.getDate();
                          parcelPayDate = (parcel.getPayDate() == null ? "___/___/___":parcel.getPayDate().getFormatedDate());
                          parcelValueBeforeParcelDateExpiration = "R$ " + new Money(parcel.getValueBeforeParcelDateExpiration()).getFormatedValue();
                        }
                        parcelid++;
                      }
                    }

                    page.addElement(divLine(posX));
                      page.addElement(insertText(bodyStyle, registration.getRegistrationDate(), posX+5, 50));
                      page.addElement(divLine(posX+55));
                      page.addElement(insertText(bodyStyle, registration.getStudent().getName(), posX+60, 300));
                      page.addElement(divLine(posX+257));
                      page.addElement(insertText(bodyStyle, registration.getDuration()+" meses", posX+262, 70));
                      page.addElement(divLine(posX+307));
                    page.addElement(insertText(bodyStyle, paidParcelsAndTotalParcels, posX+315, 60));
              page.addElement(divLine(posX+350));
              page.addElement(insertText(bodyStyle, parcelDate , posX+358, 80));
              page.addElement(divLine(posX+413));
              page.addElement(insertText(bodyStyle, parcelPayDate, posX+421, 80));
              page.addElement(divLine(posX+475));
              page.addElement(insertText(bodyStyle, parcelValueBeforeParcelDateExpiration, posX+480, 100));

              page.addElement(divLine(posX+534));
                    posY += 13;
                    page.addElement(drawHorizontalLine(posX, posY, 535));

                    if(posY > (convert(277)-20)){
                      jasperPrint.addPage(page);
                      page = new JRBasePrintPage();
                      posY = convert(10);
                      insertRegisteredByAttendentHeaderTable(page, posX);
                    }
                    i++;
                  }
                  else
                  {
                    if((!registration.getEmployee().getName().equals(attendant.getName())) && (ignoreDate ? true : (registrationDate.afterOrEqualsDay(startDate) && registrationDate.beforeOrEqualsDay(finishDate)))) {
//                      System.out.println(registration.getEmployee().getName());
                    }
                  }

                  if(posY > (convert(277)-20)){
                    jasperPrint.addPage(page);
                    page = new JRBasePrintPage();
                    posY = convert(10);
                  }
                }
                if(i > 0){
                  posY += 3;
//                  page.addElement(insertFooter(boldStyle, "Total de Alunos: "+totalPerAttendant+"         Total R$ "+new Money(total).getFormatedValue(), posY));
                  page.addElement(insertFooter(boldStyle, "Total de Alunos: "+totalPerAttendant, posY));
                  posY += 18;
                }
              }
              page.addElement(insertFooter(boldStyle, "Total Geral de Alunos: " + totalStudents/*+"     Total Geral R$ " + totalMoney.getFormatedValue()*/, posY));
              posY += 16;
              page.addElement(insertText(bodyStyle, "                     Obs: O campo Parcela exibe a Quantidade de Parcelas Pagas e o Total Geral de Parcelas (Pagas/Total)\n", posX+5, 510));
              posY += 10;
              page.addElement(insertText(bodyStyle, "O campo Pagamento exibe a Data de Pagamento, quando este n�o foi efetuado � exibido __/__/__ indicando que a parcela est� em aberto.", posX+79, 390,30));
              jasperPrint.addPage(page);
            } else if(type == 3){
              int totalhowDoYouKnowVisualmidia = 0;
                List <String> howDoYouKnowVisualmidiaList = (List<String>) system.query(new GetHowDoYouKnowVisualmidia());
                for (String howDoYouKnowVisualmidia : howDoYouKnowVisualmidiaList) {
                  int i = 0;
                   
                    Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
                   
                    registrationList.clear();
                    for (Registration registration : registrationMap.values()) {
                        registrationList.add(registration);
                    }                 
                    if(registrationList.size()>0){
                        MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
                        sortAlgorithm.sortRegistrationByDate(registrationList);
                    }
                   
                    for (Registration registration : registrationList) {
                        Student student = (Student) registration.getStudent().getPersonType("student");
                        GDDate registrationDate = new GDDate(registration.getRegistrationDate());
            if((student.getHowDoYouKnowVisualMidia().equals(howDoYouKnowVisualmidia)) &&  registration.isActive() && (ignoreDate ? true : (registrationDate.afterOrEqualsDay(startDate) && registrationDate.beforeOrEqualsDay(finishDate)))) {
                            if(i == 0) {
                              page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                                page.addElement(insertTitle(boldStyle, howDoYouKnowVisualmidia, posX+5, posY+5));
                               
                                posY += 25;
                                totalPerAttendant = 0;
                               
                                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                                page.addElement(insertCenterBoldText("Data", posX+5, posY, 70));
                                page.addElement(divLine(posX+75));
                                page.addElement(insertCenterBoldText("Nome", posX+80, posY, 300));
                                page.addElement(divLine(posX+380));
                                page.addElement(insertCenterBoldText("Dura��o", posX+385, posY, 70));
                                page.addElement(divLine(posX+455));
                                page.addElement(insertCenterBoldText("Valor", posX+460, posY, 75));
                               
                                posY += 15;
                            }
             
              page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                            page.addElement(insertText(bodyStyle, registration.getRegistrationDate(), posX+5, 70));
                            page.addElement(divLine(posX+75));
                            page.addElement(insertText(bodyStyle, registration.getStudent().getName(), posX+80, 300));
                            page.addElement(divLine(posX+380));
                            page.addElement(insertText(bodyStyle, registration.getDuration()+" meses", posX+385, 70));
                            page.addElement(divLine(posX+455));
                            Parcel parcel = registration.getParcel(0);
                            if(parcel != null){
                              page.addElement(insertText(bodyStyle, "R$ " + new Money(parcel.getValueBeforeParcelDateExpiration()).getFormatedValue(), posX+460, 75));
                            }else{
                              page.addElement(insertText(bodyStyle, "R$ ______", posX+460, 75));
                            }
                           
                            posY += 15;
                           
                            totalPerAttendant++;
                            if(posY > (convert(297)-20)){
                                jasperPrint.addPage(page);
                                page = new JRBasePrintPage();
                                posY = convert(10);
                            }
                            i++;
                        }
                    }
                    if(i > 0) {
                      page.addElement(insertFooter(boldStyle, "Total de Alunos: "+totalPerAttendant, posY+2));
                      posY += 15;
                      totalhowDoYouKnowVisualmidia += totalPerAttendant;
                    }
                   
                }
                posY += 7;
              page.addElement(insertFooter(boldStyle, "Total Geral de Alunos: "+totalhowDoYouKnowVisualmidia, posY+2));
                jasperPrint.addPage(page);
            } else if(type == 4) {
               
              totalPerAttendant = 0;
             
                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                page.addElement(insertCenterBoldText("Data", posX+5, posY, 70));
                page.addElement(divLine(posX+75));
                page.addElement(insertCenterBoldText("Nome", posX+80, posY, 230));
                page.addElement(divLine(posX+310));
                page.addElement(insertCenterBoldText("Telefone", posX+315, posY, 100));
                page.addElement(divLine(posX+415));
                page.addElement(insertCenterBoldText("Atendente", posX+420, posY, 115));
               
                posY += 15;
               
                Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
                registrationList.clear();
                for (Registration registration : registrationMap.values()) {
                    if(!registration.isActive()) {
                        registrationList.add(registration);
                    }
                }      
                if(registrationList.size()>0){
                    MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
                    sortAlgorithm.sortRegistrationByDate(registrationList);
                }
               
                total = 0;
               
                for (Registration registration : registrationList) {
                  if(!registration.isActive())   {
                   
                    page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                    page.addElement(insertText(bodyStyle, registration.getRegistrationDate(), posX+5, 70));
                    page.addElement(divLine(posX+75));
                    page.addElement(insertText(bodyStyle, registration.getStudent().getName(), posX+80, 230));
                    page.addElement(divLine(posX+310));
                    page.addElement(insertText(bodyStyle, registration.getStudent().getPhone(), posX+315, 100));
                    page.addElement(divLine(posX+415));
                    page.addElement(insertText(bodyStyle, registration.getEmployee().getName(), posX+420, 115));
                   
                    posY += 15;
                   
                    totalPerAttendant++;
                    if(posY > (convert(297)-20)){
                      jasperPrint.addPage(page);
                      page = new JRBasePrintPage();
                      posY = convert(10);
                    }
                  }
                }
               
                page.addElement(insertFooter(boldStyle, "Total de Alunos: "+totalPerAttendant, posY));
               
                posY += 15;
           jasperPrint.addPage(page);
            } else if(type == 5) {
              Money totalDesistent = new Money(0.0);
              int totalStudents = 0;
                for (String status : statusList) {
                  total = (float) 0.0;
                  int i = 0;
                    Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
                    registrationList.clear();
                    for (Registration registration : registrationMap.values()) {
                        if(!registration.isActive()) {
                            registrationList.add(registration);
                        }
                    }                 
//                    if(registrationList.size()>0){
//                        MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
//                        sortAlgorithm.sortRegistrationByDate(registrationList);
//                    }
                   
                    Comparator<Registration> comparator = new Comparator<Registration>() {
                      @Override
                      public int compare(Registration o1, Registration o2) {
                        int result = -1;
                        Calendar calendar1 = Calendar.getInstance();
                        calendar1.setTime(o1.getEndDate().getDate());
                        Calendar calendar2 = Calendar.getInstance();
                        calendar2.setTime(o2.getEndDate().getDate());        
                        result = calendar1.compareTo(calendar2);
                       
                        return result;
                      }
                     
                    };
                    Collections.sort(registrationList,comparator);
                for (Registration registration : registrationList) {
                       
                        GDDate registrationDate = new GDDate(registration.getEndDate());
            if(checkStatus(status, registration.getEndStatus()) && (ignoreDate ? true : (registrationDate.afterOrEqualsDay(startDate) && registrationDate.beforeOrEqualsDay(finishDate)))) {
              if (i == 0){
                page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                page.addElement(insertTitle(boldStyle, status, posX+5, posY+5));
               
                posY += 25;
                totalPerAttendant = 0;
               
                insertEndedRegistrationHeaderTable(page, posX);
                i++;
              }
             
//                            page.addElement(drawRectangle(posX, posY, 535, 13, 0));
              page.addElement(divLine(posX));
              page.addElement(insertText(bodyStyle, registrationDate.getFormatedDate(), posX+5, 48));
                            page.addElement(divLine(posX+58));
                            page.addElement(insertText(bodyStyle, registration.getStudent().getName(), posX+63, 152));
                            page.addElement(divLine(posX+206));
                            String paidParcelsAndTotalParcels = (getParcelsValue(registration) > 9 ? getParcelsValue(registration) : "0"+getParcelsValue(registration) ) + " / " ( registration.getParcels().size() > 9 ? registration.getParcels().size() :"0"+registration.getParcels().size());
//                            page.addElement(insertText(bodyStyle, (getParcelsValue(registration) == 0 ? "" : new Money(getParcelsValue(registration)).getFormatedValue()), posX+275, 70));
                            page.addElement(insertText(bodyStyle, paidParcelsAndTotalParcels, posX+217, 70));
                            page.addElement(divLine(posX+258));
                            Parcel parcel0 = (registration.getParcels().size()> 0 ? registration.getParcel(0).isRegistrationTax() ? registration.getParcel(1) : registration.getParcel(0) : null);
                        if(parcel0 != null){
                          page.addElement(insertText(bodyStyle, "R$ " + new Money(parcel0.getValueBeforeParcelDateExpiration()).getFormatedValue(), posX+265, 100));
                          total += new Money(parcel0.getValueBeforeParcelDateExpiration()).getFloatValue();
                        } else{
                          page.addElement(insertText(bodyStyle, "R$ ______", posX+265, 100));
                        }
                            page.addElement(divLine(posX+320));
                            page.addElement(insertText(bodyStyle, registration.getEndStatus().get(0), posX+325, 86));
                            page.addElement(divLine(posX+410));
                            page.addElement(insertText(bodyStyle, registration.getEndEmployee().getName(), posX+415, 120));
                            page.addElement(divLine(posX+534));
                            posY += 13;
                           
                            page.addElement(drawHorizontalLine(posX, posY, 535));
                           
                            totalPerAttendant++;
                            if(posY > (convert(297)-20)){
                                jasperPrint.addPage(page);
                                page = new JRBasePrintPage();
                                posY = convert(10);
                                insertEndedRegistrationHeaderTable(page, posX);
                            }
                        }
                        if(posY > (convert(297)-20)){
                            jasperPrint.addPage(page);
                            page = new JRBasePrintPage();
                            posY = convert(10);
//                            insertHeaderTable(page, posX);
                        }
                    }
                   
                    if(i > 0){
                      totalDesistent.credit(total);
                      totalStudents+=totalPerAttendant;
                      page.addElement(insertFooter(boldStyle, "Total de Alunos: " +  totalPerAttendant + "          Total R$ " + new Money(total).getFormatedValue(), posY));
                      posY += 18;
                    }
                    if (status.equals(statusList.get(statusList.size()-1)) ){
                      page.addElement(insertFooter(boldStyle, "Total Geral de Alunos: " + totalStudents+"     Total Geral R$ " + totalDesistent.getFormatedValue(), posY));
                      posY += 16;
                      page.addElement(insertText(bodyStyle, "                     Obs: O campo Parcela exibe a Quantidade de Parcelas Pagas e o Total Geral de Parcelas (Pagas/Total)", posX+5, 510));
                    }
                }
               jasperPrint.addPage(page);
               //relatorio de alunos que nao estao no registration appoitment map
            } else if (type == 6) {
              List<RegistrationAppointment> registrationAppointmentList = new ArrayList<RegistrationAppointment>();
              Map<String, List <RegistrationAppointment>> registrationAppoitmentMap = (Map<String, List <RegistrationAppointment>>system.query(new GetAllAppointmentMap());
              for (String idMap : registrationAppoitmentMap.keySet()) {
            for (RegistrationAppointment registrationAppointment : registrationAppoitmentMap.get(idMap)) {
                registrationAppointmentList.add(registrationAppointment);
            }
          }
              Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
              List<Registration> registrations = new ArrayList<Registration>();
              for (Registration registration : registrationMap.values()) {
                if ( registration.isActive() )
                registrations.add(registration); //adiciona no relat�rio apenas os Registrations ativos
              }
             
              for(int i=0; i<registrationAppointmentList.size(); i++) {
                if (registrations.contains(registrationAppointmentList.get(i).getRegistration())) {
                  registrations.remove(registrationAppointmentList.get(i).getRegistration());
                }
              }
            
            
             int i = 0;
            
                    for (Registration registration: registrations) {
                      Comparator<Registration> comparator = new Comparator<Registration>() {
                        @Override
                        public int compare(Registration o1, Registration o2) {
                          int result = -1;
                          Calendar calendar1 = Calendar.getInstance();
                          Calendar calendar2 = Calendar.getInstance();
                         
                          calendar1.set(Integer.parseInt(o1.getRegistrationDate().substring(6, o1.getRegistrationDate().length())), Integer.parseInt(o1.getRegistrationDate().substring(3, 5)), Integer.parseInt(o1.getRegistrationDate().substring(0, 2)));
                          calendar2.set(Integer.parseInt(o2.getRegistrationDate().substring(6, o1.getRegistrationDate().length())), Integer.parseInt(o2.getRegistrationDate().substring(3, 5)), Integer.parseInt(o2.getRegistrationDate().substring(0, 2)));
                         
                          result = calendar1.compareTo(calendar2);
                         
                          return result;
                        }
                       
                      };
                      Collections.sort(registrations,comparator);
              if (i == 0){
                page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                page.addElement(insertTitle(boldStyle, "Relat�rio de todos Alunos sem agendamento de aula", posX+5, posY+5));
               
                posY += 25;
                totalPerAttendant = 0;
               
                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                page.addElement(insertCenterBoldText("Data matr�cula", posX+5, posY, 100));
                page.addElement(divLine(posX+110));
                page.addElement(insertCenterBoldText("Nome", posX+115, posY, 70));
//                page.addElement(divLine(posX+450));
//                page.addElement(insertCenterBoldText("Status", posX+450, posY, 70));
               
                posY += 15;
                i++;
              }
             
                            page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                            page.addElement(insertText(bodyStyle, registration.getRegistrationDate(), posX+20, 100));
                            page.addElement(divLine(posX+110));
                            page.addElement(insertText(bodyStyle, registration.getStudent().getName(), posX+115, 530));
//                            page.addElement(divLine(posX+450));
//                            page.addElement(insertText(bodyStyle, (registration.isActive() ? "Ativo" : "Desativo"), posX+455, 70));
                           
                            posY += 15;
                           
                            page.addElement(drawHorizontalLine(posX, posY, 535));
                           
                            totalPerAttendant++;
                            if(posY > (convert(297)-20)){
                                jasperPrint.addPage(page);
                                page = new JRBasePrintPage();
                                posY = convert(10);
                            }
                        if(posY > (convert(297)-20)){
                            jasperPrint.addPage(page);
                            page = new JRBasePrintPage();
                            posY = convert(10);
                        }
                }
                    if(i > 0){
                      page.addElement(insertFooter(boldStyle, "Total de Alunos: " +  totalPerAttendant, posY));
                     
                      posY += 15;
                    }
               jasperPrint.addPage(page);
                   
View Full Code Here

Examples of net.sf.jasperreports.engine.JRPrintPage

           
            for (ClassRoom classRoom : classRoomMap.values()) {
              numberTotalComputers += classRoom.getComputers().size();
            }
           
            JRPrintPage page = new JRBasePrintPage();
           
            List<String> listDate = new ArrayList<String>();
            if (inicialDateText == null) {
                listDate = createListDate();
            } else {
                listDate = createListDate(inicialDateText, endDateText);
            }
           
            int posY = convert(10);
            int posX = convert(10);
           
            JRPrintImage imageBkg = printImage("titleReport.gif", posX, posY, 535, 45);
            JRPrintImage logoImage = printImage("corporateLogo.jpg", posX+11, posY, 65, 45);
            JRPrintText titleText = insertTitle("Quadro de Hor�rios", posX+200, posY+11, 330);
           
            for (String date : listDate) {
                posX = convert(10);
               
                GDDate actualDate = new GDDate(date);
                RegistrationMap registrationMap = system.getRegistratioMap();
                page.addElement(imageBkg);
                page.addElement(logoImage);
                page.addElement(titleText);
               
                posY += 50;
               
                JRPrintText text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                text.setText("Data: "+date);
                text.setX(posX);
                text.setY(posY);
                text.setWidth(150);
                text.setHeight(12);
                text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                text.setLineSpacingFactor(2.0f);
                text.setLeadingOffset(-4.0f);
                text.setStyle(normalStyle);
                page.addElement(text);
               
                text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                text.setText("Dia da Semana: "+new SimpleDateFormat("EEEEE").format(new GDDate(date).getDate()));
                text.setX(posX+300);
                text.setY(posY);
                text.setWidth(220);
                text.setHeight(12);
                text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                text.setLineSpacingFactor(2.0f);
                text.setLeadingOffset(-4.0f);
                text.setStyle(normalStyle);
                page.addElement(text);
               
                posY += 17;
               
                text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                text.setText("Funcionamento: das " + startWorkTime + ":00 �s " + endWorkTime + ":00");
                text.setX(posX);
                text.setY(posY);
                text.setWidth(290);
                text.setHeight(12);
                text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                text.setLineSpacingFactor(2.0f);
                text.setLeadingOffset(-4.0f);
                text.setStyle(normalStyle);
                page.addElement(text);
               
                text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                text.setText("Impresso em: "+new GDDate().getFormatedDate());
                text.setX(posX+300);
                text.setY(posY);
                text.setWidth(220);
                text.setHeight(12);
                text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                text.setLineSpacingFactor(2.0f);
                text.setLeadingOffset(-4.0f);
                text.setStyle(normalStyle);
                page.addElement(text);
               
                posY += 16;
               
                text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                text.setText("Obs. Marque com \"X\" os alunos faltantes.\n* Aluno de Reposi��o");
                text.setX(posX);
                text.setY(posY);
                text.setWidth(530);
                text.setHeight(26);
                text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                text.setLineSpacingFactor(2.0f);
                text.setLeadingOffset(-4.0f);
                text.setStyle(normalStyle);
                page.addElement(text);
               
                posY += 23;
                for(int periods=0; periods<3; periods++){
                    String weekDay = new SimpleDateFormat("EEEEE").format(new GDDate(date).getDate()).replace("-feira", "");
                    if(getHourVacancy(weekDay, ((periods+1)*6)+1, ((2+periods)*6))>0){
                        posX = convert(10);
                       
                        JRPrintRectangle rectangle = new JRBasePrintRectangle(jasperPrint.getDefaultStyleProvider());
                        rectangle.setX(posX);
                        rectangle.setY(posY);
                        rectangle.setWidth(535);
                        rectangle.setHeight(14);
                        rectangle.setBackcolor(new Color(153, 153, 153));
                        page.addElement(rectangle);
                       
                        text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                        text.setText(period.get(periods));
                        text.setX(posX);
                        text.setY(posY);
                        text.setWidth(535);
                        text.setHeight(14);
                        text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);
                        text.setLineSpacingFactor(2.0f);
                        text.setLeadingOffset(-4.0f);
                        text.setStyle(boldStyle);
                        page.addElement(text);
                       
                        posY += 14;
                        int posYTemp = 0;
                       
                        for(int hour=(((periods+1)*6)+1); hour<=((2+periods)*6); hour++){
                            if(getMaxVacancy(weekDay, hour)>0){
    //                      if(!isHourVacancy(j)){
                                int numberOfColumns = getHourVacancy(weekDay, ((periods+1)*6)+1, ((2+periods)*6));
                                int width = Math.round(535/numberOfColumns);
                               
                                rectangle = new JRBasePrintRectangle(jasperPrint.getDefaultStyleProvider());
                                rectangle.setX(posX);
                                rectangle.setY(posY);
                                rectangle.setWidth(width);
                                rectangle.setHeight(14);
                                rectangle.setBackcolor(new Color(204, 204, 204));
                                page.addElement(rectangle);
                               
                                text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                                text.setText(String.valueOf(hour));
                                text.setX(posX);
                                text.setY(posY);
                                text.setWidth(width);
                                text.setHeight(14);
                                text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);
                                text.setLineSpacingFactor(2.0f);
                                text.setLeadingOffset(-4.0f);
                                text.setStyle(boldStyle);
                                page.addElement(text);
                               
                                posYTemp =posY;
                                for (int box = 0; box < numberTotalComputers; box++) {
                                    posYTemp +=14;
                                    rectangle = new JRBasePrintRectangle(jasperPrint.getDefaultStyleProvider());
                                    rectangle.setX(posX);
                                    rectangle.setY(posYTemp);
                                    rectangle.setWidth(width);
                                    rectangle.setHeight(14);
                                    page.addElement(rectangle);
                                   
                                    JRPrintLine line = new JRBasePrintLine(jasperPrint.getDefaultStyleProvider());
                                    line.setX(posX+14);
                                    line.setY(posYTemp);
                                    line.setWidth(0);
                                    line.setHeight(14);
                                    page.addElement(line);
                                   
                                }
                               
                                actualDate.setHourOfDay(hour);
                               
                                MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
                               
                                List<RegistrationAppointment> registrationList = registrationMap.getAppointmentsOnThatWeekDay(actualDate);
                                if(registrationList.size() > 1)
                                    sortAlgorithm.sortRegistrationAppointmentByName(registrationList);
                               
                                posYTemp =posY+2;
                                for (int studentIndex = 0; studentIndex < registrationList.size(); studentIndex++) {
                                    posYTemp +=14;
                                    text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                                    text.setText(registrationList.get(studentIndex).getRegistration().getStudent().getName());
                                    text.setX(posX+16);
                                    text.setY(posYTemp);
                                    text.setWidth(width-16);
                                    text.setHeight(12);
                                    text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                                    text.setLineSpacingFactor(2.0f);
                                    text.setLeadingOffset(-4.0f);
                                    text.setStyle(studentNameStyle);
                                    page.addElement(text);
                                }
                               
                                List<RegistrationAppointment> replacementList = registrationMap.getReplacementsOnThatDay(actualDate);
                                if(replacementList.size() > 1)
                                    sortAlgorithm.sortRegistrationAppointmentByName(replacementList);
                               
                                for (int studentIndex = 0; studentIndex < replacementList.size(); studentIndex++) {
                                    posYTemp +=14;
                                    text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
                                    text.setText("* "+replacementList.get(studentIndex).getRegistration().getStudent().getName());
                                    text.setX(posX+16);
                                    text.setY(posYTemp);
                                    text.setWidth(width-16);
                                    text.setHeight(12);
                                    text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT);
                                    text.setLineSpacingFactor(2.0f);
                                    text.setLeadingOffset(-4.0f);
                                    text.setStyle(studentNameStyle);
                                    page.addElement(text);
                                }
                               
                                posX += width;
                            }
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.