Examples of JRBasePrintPage


Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

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

       
        JRPrintPage page = new JRBasePrintPage();
        posY = convert(10);
        int posX =convert(10);
       
        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 Alunos matriculados com", posX+65, posY+11, 385));
       
        posY += 35;
       
        page.addElement(insertTitle("�ltima parcela no per�odo", posX,posY,385));
       
        page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
       
        posY += 50;
       
        try {
                page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                page.addElement(insertTitle(boldStyle, "Alunos", posX+5, posY+5));
                page.addElement(insertTitle(boldStyle, "Parcela", posX+265, posY+5));
               
                posY += 25;
               
                int totalPerAttendant = 0;
               
                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                page.addElement(insertCenterBoldText("Nome", posX+5, posY, 215));
                page.addElement(divLine(posX+220));
                page.addElement(insertCenterBoldText("Matr.", posX+225, posY, 30));
                page.addElement(divLine(posX+255));
                page.addElement(insertCenterBoldText("Total", posX+260, posY, 40));
                page.addElement(divLine(posX+300));
                page.addElement(insertCenterBoldText("Pagas", posX+305, posY, 40));
                page.addElement(divLine(posX+345));
                page.addElement(insertCenterBoldText("Abertas", posX+350, posY, 55));
                page.addElement(divLine(posX+405));
                page.addElement(insertCenterBoldText("�lt. Data", posX+410, posY, 70));
                page.addElement(divLine(posX+480));
                page.addElement(insertCenterBoldText("Valor", posX+485, posY, 50));
   
                posY += 15;
                List<Registration> registrationList = new ArrayList<Registration>();
                Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
//                registrationList.clear();
                MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
               
                for (Registration registration : registrationMap.values()) {
                    List<Parcel> parcels = registration.getParcels();
                    if(parcels.size() > 1){
                      sortAlgorithm.sortParcelByDate(parcels);
                      GDDate dateParcel = new GDDate(parcels.get(parcels.size()-1).getDate());
                      if(registration.isActive() && ignoreDate ? true : (dateParcel.beforeOrEqualsDay(finishDate) && dateParcel.afterOrEqualsDay(startDate))) {
                        registrationList.add(registration);
                       
                      }
                    }
                }                 
                if(registrationList.size() > 0) {
                    sortAlgorithm.sortRegistrationByDateOfLastParcel(registrationList);
                }
               
                Money totalParcel = new Money(0);
                for (Registration registration : registrationList) {
                  if (registration.isActive()) {
                      int parcelsTotal = 0;
                      int parcelsPayed = 0;
                      List<Parcel> parcels = registration.getParcels();
                     
                      sortAlgorithm.sortParcelByDate(parcels);
                     
                      Parcel lastParcel = parcels.get(parcels.size()-1);
                      totalParcel.credit(lastParcel.isPayed()? lastParcel.getPayValue() : new GDDate(lastParcel.getDate()).beforeDay(new GDDate()) ? lastParcel.getValueAfterParcelDateExpiration() : lastParcel.getValueBeforeParcelDateExpiration());
                      for(Parcel parcel : parcels) {
                          parcelsTotal++;
                          if(parcel.isPayed())
                              parcelsPayed++;
                      }
                      page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                      page.addElement(insertText(bodyStyle, registration.getStudent().getName(), posX+5, 215));
                      page.addElement(divLine(posX+220));
                      page.addElement(insertText(bodyStyle, registration.getIdRegistration(), posX+225, 30));
                      page.addElement(divLine(posX+255));
                      page.addElement(insertText(bodyStyle, String.valueOf(parcelsTotal), posX+260, 40));
                      page.addElement(divLine(posX+300));
                      page.addElement(insertText(bodyStyle, String.valueOf(parcelsPayed), posX+305, 40));
                      page.addElement(divLine(posX+345));
                      page.addElement(insertText(bodyStyle, String.valueOf(parcelsTotal-parcelsPayed), posX+350, 55));
                      page.addElement(divLine(posX+405));
                      page.addElement(insertText(bodyStyle, new GDDate(lastParcel.getDate()).getFormatedDate(), posX+410, 70));
                      page.addElement(divLine(posX+480));
                      page.addElement(insertText(bodyStyle, new Money(lastParcel.isPayed()? lastParcel.getPayValue() : new GDDate(lastParcel.getDate()).beforeDay(new GDDate()) ? lastParcel.getValueAfterParcelDateExpiration() : lastParcel.getValueBeforeParcelDateExpiration()).getFormatedValue(), posX+485, 50));
                     
                      posY += 15;
                      totalPerAttendant++;
                     
                      if(posY > (convert(297)-20)){
                          jasperPrint.addPage(page);
                          page = new JRBasePrintPage();
                          posY = convert(10);
                      }
                  }
                }
               
                page.addElement(insertFooter("Total de Alunos: "+totalPerAttendant + "                Total R$: " + totalParcel.getFormatedValue(), posY));
               
                posY += 15;
           jasperPrint.addPage(page);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

      if(billets.size()>0){
        MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
        sortAlgorithm.sortBankBilletByDateAndName(billets);
      }
      int cont = 1;
      page = new JRBasePrintPage();
      posX = convert(10);
      posY = convert(10);
      page.addElement(drawHorizontalDottedLine(0, posY-4, convert(210)));
      for(Billet billet : billets){

        String valueDiscount = new Money(billet.getParcel().getValueAfterParcelDateExpiration()-billet.getParcel().getValueBeforeParcelDateExpiration()).getFormatedValue();
        String responsableName = "";
        String studentname = "";
        studentname = billet.getPerson().getName();
        if (ResponsableValidator.checkStudentUnderAge(new GDDate(billet.getPerson().getBirthDate()).getFormatedDate())) {
          Student student = (Student) billet.getPerson().getPersonType("student");
          responsableName = student.getResponsableName();
        } else {
          responsableName = billet.getPerson().getName();
        }

        page.addElement(drawRectangle(posX, posY, 145, 185, 0));
        page.addElement(printImage("corporateLogo.jpg", posX+10, posY+3, 35  , 15));
        page.addElement(drawVerticalLine(posX+70, posY+3, 14));
        page.addElement(insertCenterBoldText(billet.getRegistration().getIdRegistration() + "-" + billet.getParcelId(), posX+70, posY+5, 50));
        page.addElement(drawVerticalLine(posX+120, posY+3, 14));
        page.addElement(drawHorizontalLine(posX, posY+20, 145));
        page.addElement(insertNormalText("Parcela:", posX+5, posY+25, 90, 12));
        page.addElement(insertBoldRightText(( billet.getParcelId().length() > 1 ? billet.getParcelId() : "0"+billet.getParcelId() ) + " / " ( billet.getRegistration().getParcels().size() > 9 ? billet.getRegistration().getParcels().size() :"0"+billet.getRegistration().getParcels().size() ) , posX+40, posY+24, 100));
        page.addElement(drawHorizontalLine(posX, posY+35, 145));
        page.addElement(insertNormalText("Vencimento:", posX+5, posY+39, 90, 12));
        page.addElement(insertBoldRightText(billet.getParcel().getDate(), posX+55, posY+39, 85));
        page.addElement(drawHorizontalLine(posX, posY+50, 145));
        page.addElement(insertNormalText("Valor at� Vencimento:", posX+5, posY+55, 90, 12));
        page.addElement(insertBoldRightText(new Money(billet.getParcel().getValueBeforeParcelDateExpiration()).getFormatedValue(), posX+85, posY+54, 55));
        page.addElement(drawHorizontalLine(posX, posY+65, 145));
        page.addElement(insertNormalText("(+) Mora / Multa:", posX+5, posY+70, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+80, 145));
        page.addElement(insertNormalText("(+) Outros Acr�scimos:", posX+5, posY+85, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+95, 145));
        page.addElement(insertNormalText("(-) Desconto:", posX+5, posY+100, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+110, 145));
        page.addElement(insertNormalText("(-) Outros Abatimentos:", posX+5, posY+115, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+125, 145));
        page.addElement(insertNormalText("(=) Valor Cobrado:", posX+5, posY+130, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+140, 145));
        page.addElement(insertNormalText("Data Pagamento:", posX+5, posY+145, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+155, 145));
        page.addElement(insertNormalText("Sacado:", posX+5, posY+160, 90, 12));
        page.addElement(insertNormalText(responsableName, posX+35, posY+160, 90, 12));
        page.addElement(drawHorizontalLine(posX, posY+170, 145));
        page.addElement(insertCenterBoldText("Recibo do Sacado", posX, posY+174, 150));
        page.addElement(drawRectangle(posX+152, posY, 385, 185, 0));
        page.addElement(drawVerticalLine(posX+160, posY+3, 14));
        page.addElement(insertCenterBoldText(billet.getRegistration().getIdRegistration() + "-" + billet.getParcelId(), posX+160, posY+5, 50));
        page.addElement(drawVerticalLine(posX+210, posY+3, 14));

        page.addElement(drawVerticalDottedLine(posX+148, posY+1, 182));
       
        page.addElement(insertNormalText("Aluno", posX+220, posY+7, 50, 12));
        page.addElement(insertBoldText(studentname, posX+245, posY+6, 270));
        page.addElement(drawHorizontalLine(posX+152, posY+20, 385));
        page.addElement(insertNormalText("Local de Pagamento:", posX+155, posY+25, 90, 12));
        String address = (String) gd.get("street") + ", " + (String) gd.get("streetnumber");
        if (address.length()>35){
          page.addElement(insertBoldText("                                "+address.substring(0, 34), posX+160, posY+24, 240));
          page.addElement(insertBoldText(address.substring(34, address.length()), posX+160, posY+39, 270));
        }else{
          page.addElement(insertBoldText("                                "+address, posX+160, posY+24, 240));
        }
        page.addElement(insertNormalText("Parcela:", posX+410, posY+25, 40, 12));
        page.addElement(insertBoldRightText( ( billet.getParcelId().length() > 1 ? billet.getParcelId() : "0"+billet.getParcelId() ) + " / " ( billet.getRegistration().getParcels().size() > 9 ? billet.getRegistration().getParcels().size() :"0"+billet.getRegistration().getParcels().size() ), posX+445, posY+24, 87));
        page.addElement(drawHorizontalLine(posX+152, posY+35, 385));
        page.addElement(insertNormalText("Vencimento:", posX+410, posY+40, 70, 12));
        page.addElement(insertBoldRightText(billet.getParcel().getDate(), posX+460, posY+39, 72));
        page.addElement(drawHorizontalLine(posX+152, posY+50, 385));
        page.addElement(insertNormalText("At� Vencimento:", posX+155, posY+55, 70, 12));
        page.addElement(insertNormalText("Valor at� Vencimento R$:", posX+410, posY+55, 90, 12));
        page.addElement(insertBoldRightText(new Money(billet.getParcel().getValueBeforeParcelDateExpiration()).getFormatedValue(), posX+490, posY+54, 42));
        page.addElement(insertNormalText("(+) Mora / Multa:", posX+410, posY+70, 90, 12));
        page.addElement(drawHorizontalLine(posX+405, posY+80, 130));
        page.addElement(insertBoldText("Desconto de Pontualidade: "+valueDiscount, posX+230, posY+54, 155));
        page.addElement(drawHorizontalLine(posX+152, posY+65, 385));
        page.addElement(insertNormalText("Ap�s Vencimento:", posX+155, posY+70, 70, 12));
        page.addElement(insertBoldText("Multa de " + gd.get("fine") + "%", posX+230, posY+70, 145));
        page.addElement(insertBoldText("Juros de " + gd.get("interestDeferredPayment") + "% ao dia", posX+230, posY+83, 145));
        page.addElement(insertNormalText("(+) Outros Acr�scimos:", posX+410, posY+85, 90, 12));
        page.addElement(drawHorizontalLine(posX+152, posY+95, 385));
        page.addElement(insertNormalText("(-) Desconto:", posX+410, posY+100, 90, 12));
        page.addElement(drawHorizontalLine(posX+405, posY+110, 130));
        page.addElement(insertNormalText("(-) Outros Abatimentos:", posX+410, posY+115, 90, 12));
        page.addElement(insertNormalText("Esta cobran�a � emitida a todos os alunos devidamente matriculados conforme condi��es do contrato de presta��o de servi�os.", posX+155, posY+102, 255, 24));
        page.addElement(drawHorizontalLine(posX+152, posY+125, 385));
        page.addElement(insertNormalText("(=) Valor Cobrado:", posX+410, posY+130, 90, 12));
        String idRegistration = billet.getRegistration().getIdRegistration();
        for(int i=0; i<(5-billet.getRegistration().getIdRegistration().length()); i++)
          idRegistration = "0" + idRegistration;
        String idParcel = billet.getParcelId();
        for(int i=0; i<(5-billet.getParcelId().length()); i++)
          idParcel = "0" + idParcel;
        page.addElement(createBarcode("300002."+idRegistration+"."+idParcel, posX+163, posY+143, 230, 30));
        page.addElement(drawHorizontalLine(posX+405, posY+140, 130));
        page.addElement(insertNormalText("Data Pagamento:", posX+410, posY+145, 90, 12));
        page.addElement(drawHorizontalLine(posX+405, posY+155, 130));
       
        page.addElement(insertNormalText("Sacado:", posX+410, posY+160, 90, 12));
        page.addElement(insertNormalText(responsableName, posX+442, posY+160, 92, 12));
       
        page.addElement(insertNormalText("Obs.:", posX+410, posY+175, 90, 12));
        page.addElement(drawHorizontalLine(posX+405, posY+170, 130));
        page.addElement(drawVerticalLine(posX+405, posY+20, 165));
        page.addElement(drawHorizontalDottedLine(0, posY+188, convert(210)));

        if  (cont%4==0){
          jasperPrint.addPage(page);
          page.addElement(insertFooter());
          page = new JRBasePrintPage();
          posY=convert(10);
          posX=convert(10);
          page.addElement(drawHorizontalDottedLine(0, posY-4, convert(210)));
        }else{
          if ( cont == billets.size()) {
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

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

       
        page = new JRBasePrintPage();
        posY = convert(10);
        int posX = convert(10);
       
        page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
//        page.addElement(printImage("logoReport.gif", posX+11, posY, 65, 45));
        page.addElement(insertTitle(contTitle, posX+100, posY+11, 330));
       
        posY += 50;
       
        try {
//          String obs = " - (*) Referente a taxa de matr�cula.";
          Map<String, Registration> registrationMap = (Map<String, Registration>) system.query(new GetRegistration());
//          List<Registration> registrations = (List<Registration>) registrationMap.values();
//            int index = 0;
            for (Registration registration : registrationMap.values()) {
//                Person person = (Person) system.query(new GetPerson(registration.getIdPerson()));
//                int numberOfParcel = 1;
               
                for (Parcel parcel : registration.getParcels()) {
                    parcelDate = new GDDate(parcel.getDate());
                        if (parcelDate.afterOrEqualsDay(startDate) && parcelDate.beforeOrEqualsDay(finishDate) ) {
                          registrations.add(registration);
                        }
                }
            }
            Set<Registration> set = new HashSet<Registration>();
            set.addAll(registrations);
            if (set.size() < registrations.size()) {
              registrations.clear();
              registrations.addAll(set);
            }
           
            int totalOfStudents = 0;
            int index = 1;
           
            // Relat�rio apenas com os valores totalizados na 1a p�gina
            // Adicionado [Daniel] 08-11-2007 09h00
            ////////////////////////////////////////////
           
            // Total de alunos que n�o tem parcelas
            posY += 5;
            page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
            page.addElement(insertTitleBox("Alunos Matriculados que n�o t�m parcelas (desconsiderando o per�odo)"));

            posY += 25;

            for(Registration registration: registrationMap.values()){
              if (registration.isActive()) {
                if (registration.getParcels().isEmpty()) {
                  index ++;
                  totalOfStudents++;
                    }
              }
            }

            page.addElement(insertFooterLeft("Total de Estudantes: "+totalOfStudents));

            // Total de alunos que possuem parcela
            totalOfStudents = 0;
            posY += 25;

            page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
            page.addElement(insertTitleBox("Alunos matriculados que t�m parcelas no per�odo"));
           
            posY += 25;

            for (Registration registration : registrations) {
        if (registration.isActive()) {
          if (!registration.getParcels().isEmpty()) {
            totalOfStudents++;
          }
        }
      }
               
            page.addElement(insertFooterLeft("Total de Estudantes: "+totalOfStudents));

            // Total de alunos que possuem parcela igual a zero
            totalOfStudents = 0;
            posY += 25;
           
            page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
            page.addElement(insertTitleBox("Alunos matriculados que est�o com parcelas com valor zero no per�odo"));

            posY += 25;
           
            for (Registration registration : registrations) {
        if (registration.isActive()) {
          for(Parcel parcel : registration.getParcels()) {
            if (parcel.getValueBeforeParcelDateExpiration() == 0.0f) {
                totalOfStudents++;
            }
          }
        }
      }
            page.addElement(insertFooterLeft("Total de Estudantes: "+totalOfStudents));

            // cria nova p�gina
            jasperPrint.addPage(page);
            page = new JRBasePrintPage();
            posY = convert(10);
            page.addElement(insertTitle(contTitle, posX+100, posY+11, 330));
           
            posY += 50;
           

            /////////////////////////////////////////////
            // Parte que o Tiago fez com nomes dos alunos

            totalOfStudents = 0;

            posY += 5;
            page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
            page.addElement(insertTitleBox("Alunos Matriculados que n�o t�m parcelas (desconsiderando o per�odo)"));
           
            posY += 25;
           
            page.addElement(drawRectangle(posX, posY, 535, 15, 0));
            page.addElement(insertCenterBoldText("N�", posX, 170));
            page.addElement(divLine(posX+170));
            page.addElement(insertCenterBoldText("Nome", posX+170, 300));
            posY += 15;
               
               
                for(Registration registration: registrationMap.values()){
                  if (registration.isActive()) {
                    if (registration.getParcels().isEmpty()) {
                    page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                    page.addElement(insertText((String.valueOf(index)), posX+5, 165));
                    page.addElement(divLine(posX+170));
                    page.addElement(insertText(registration.getStudent().getName(), posX+175, 300));
                   
                    posY += 15;
                    index ++;
          totalOfStudents++;
                   
                    if(posY > (convert(290)-25)){
                        jasperPrint.addPage(page);
                        page = new JRBasePrintPage();
                        posY = convert(10);
                    }
                    }
                  }
                }
                page.addElement(insertFooterLeft("Total de Estudantes: "+totalOfStudents));
//                page.addElement(insertFooterRight("Valor Total: "+new Money(valueTotalOfParcels).getFormatedValue()));
               
                posY += 25;
               
                page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                page.addElement(insertTitleBox("Alunos matriculados que t�m parcelas no per�odo"));
               
                posY += 25;
               
                totalOfStudents = 0;
               
                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                page.addElement(insertCenterBoldText("Matricula", posX, 170));
                page.addElement(divLine(posX+170));
                page.addElement(insertCenterBoldText("Nome", posX+170, 300));
               
                posY += 15;
               
                for (Registration registration : registrations) {
        if (registration.isActive()) {
          if (!registration.getParcels().isEmpty()) {
            page.addElement(drawRectangle(posX, posY, 535, 15, 0));
            page.addElement(insertTextregistration.getStudent().getId(), posX + 5,165));
            page.addElement(divLine(posX + 170));
            page.addElement(insertText(registration.getStudent().getName(), posX + 175, 110));

            posY += 15;
            totalOfStudents++;

            if (posY > (convert(290) - 25)) {
              jasperPrint.addPage(page);
              page = new JRBasePrintPage();
              posY = convert(10);

              insertHorizontalLine();
            }
          }
        }
      }
               
                page.addElement(insertFooterLeft("Total de Estudantes: "+totalOfStudents));
               
                posY += 25;
               
                page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
                page.addElement(insertTitleBox("Alunos matriculados que est�o com parcelas com valor zero no per�odo"));
               
                posY += 25;
               
                totalOfStudents = 0;
               
                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                page.addElement(insertCenterBoldText("Matricula", posX, 170));
                page.addElement(divLine(posX+170));
                page.addElement(insertCenterBoldText("Nome", posX+170, 115));
               
                posY += 15;
               
//               
               
                for (Registration registration : registrations) {
            if (registration.isActive()) {
              for(Parcel parcel : registration.getParcels()) {
                if (parcel.getValueBeforeParcelDateExpiration() == 0.0f) {
                  page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                  page.addElement(insertTextregistration.getStudent().getId(), posX + 5,165));
                  page.addElement(divLine(posX + 170));
                  page.addElement(insertText(registration.getStudent().getName(), posX + 175, 300));
 
                  posY += 15;
                  totalOfStudents++;
 
                  if (posY > (convert(290) - 25)) {
                    jasperPrint.addPage(page);
                    page = new JRBasePrintPage();
                    posY = convert(10);
 
                    insertHorizontalLine();
                  }
                }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

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

       
        JRPrintPage page = new JRBasePrintPage();
        posY = convert(10);
        int posX =convert(10);
       
        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 Faltantes", posX+65, posY+11, 385));
        page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
       
        page.addElement(insertTitle("Data : "+startDate.getFormatedDate()+ " � " + endDate.getFormatedDate() , posX, posY+45, 260));
        page.addElement(insertTitle("Hor�rio : "+((startHour <= 9 ? "0"+startHour : startHour) + ":00")+ " �s " + ((endHour <= 9 ? "0"+endHour : endHour) + ":00") , posX-23, posY+65, 230));
        posY += 85;
       
        try {
                page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                page.addElement(insertCenterBoldText("Data", posX+5, posY, 70));
                page.addElement(divLine(posX+72));
                page.addElement(insertCenterBoldText("Hora", posX+75, posY, 35));
                page.addElement(divLine(posX+115));
                page.addElement(insertCenterBoldText("Aluno", posX+130, posY, 200));
                page.addElement(divLine(posX+370));
                page.addElement(insertCenterBoldText("Telefone", posX+410, posY, 50));
                page.addElement(divLine(posX+495));
                page.addElement(insertCenterBoldText("OK.", posX+500, posY, 35));
   
                posY += 15;
               
                Map<String,Registration> registrationMap = (Map<String,Registration>) system.query( new GetRegistration());
               
                List<Presence> presences = new ArrayList<Presence>();
                for (Registration registration : registrationMap.values()) {
                    for (RegistrationAppointment registrationAppointment : registration.getRegistrationAppointment()) {
                        if(!registrationAppointment.isReplacement()) {
                            for (Presence presence : registrationAppointment.getPresence()) {
                              GDDate presenceDate = new GDDate(presence.getDate());
                              int presenceHour = presence.getDate().getHourOfDay();
                              if( (presenceDate.afterOrEqualsDay(startDate) && presenceDate.beforeOrEqualsDay(endDate)) && (presenceHour >= startHour && presenceHour < endHour ) && !presence.isPresent()) {
                                  presences.add(presence);
                             
                            }
                        }
                    }
                }
                if(presences.size() > 0) {
                    MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
                    if (sortByStudent){
                      sortAlgorithm.sortPresencesByNameAndDateTime(presences);
                    }else{
                      sortAlgorithm.sortPresencesByDateAndTime(presences);
                    }
                }
                int numberOfMisses = 0;
               
                for (Presence presence : presences) {
                    if(!presence.isPresent()) {
                        numberOfMisses++;
                    }
       
                    page.addElement(drawRectangle(posX, posY, 535, 15, 0));
                    page.addElement(insertText(bodyStyle, new GDDate(presence.getDate()).getFormatedDate(), posX+5, 80));
                    page.addElement(divLine(posX+72));
                    int hour = presence.getDate().getHourOfDay();
                    page.addElement(insertText(bodyStyle, (hour <= 9 ? "0"+hour : hour) + ":00", posX+80, 35));
                    page.addElement(divLine(posX+115));
                    StringBuffer name = new StringBuffer(presence.getRegistrationAppointment().getRegistration().getStudent().getName());
                    page.addElement(insertText(bodyStyle, String.valueOf(name), posX+120, 245));
                    page.addElement(divLine(posX+370));
                    page.addElement(insertText(bodyStyle,( !presence.getRegistrationAppointment().getRegistration().getStudent().getPhone().equals("") ? "Res. "+presence.getRegistrationAppointment().getRegistration().getStudent().getPhone() : ( !presence.getRegistrationAppointment().getRegistration().getStudent().getCellPhone().equals("") ? "Cel. "+presence.getRegistrationAppointment().getRegistration().getStudent().getCellPhone() : "Sem Contato" )), posX+375, 150));
                    page.addElement(divLine(posX+495));
                    page.addElement(drawRectangle(posX+507, posY+2, 18, 11, 2));
                   
                    posY += 15;
                    if(posY > (convert(297)-20)){
                        jasperPrint.addPage(page);
                        page = new JRBasePrintPage();
                        posY = convert(10);
                    }
                }
                posY += 5;
               
                page.addElement(insertFooter("Total de Faltas: " + numberOfMisses, posY));
                posY += 15;
               
           jasperPrint.addPage(page);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

        footerStyle.setPdfFontName("Helvetica");
        footerStyle.setPdfEncoding("Cp1252");
        footerStyle.setPdfEmbedded(false);
        jasperPrint.addStyle(footerStyle);
       
        page = new JRBasePrintPage();
        int posY = convert(10);
        int posX = convert(10);
       
        page.addElement(printImage("titleReport.gif", convert(10), posY, 535, 45));
//        page.addElement(printImage("logoReport.gif", convert(10)+11, posY, 65, 45));
        page.addElement(insertTitle("EXTRATO DE CONTAS", convert(10)+200, posY+11, 250));
//        page.addElement(printImage("corporateLogo.jpg", convert(10)+456, posY, 77, 45));
       
        posY += 50;
       
        page.addElement(insertBoldText("Per�odo: de " + startDate.getFormatedDate() + " � " + finishDate.getFormatedDate(), posX+20, posY, 515));
        page.addElement(insertBoldText("Impresso em: " + new GDDate().getFormatedDate(), posX+20, posY+20, 200));
        page.addElement(insertBoldText("Impresso por: " + system.getLogged().getName(), posX+265, posY+20, 200));
       
        posY += 40;
       
        try {
            Money totalValueCredit = new Money(0);
            Money totalValueDebit = new Money(0);
            Money totalValue = new Money(0);
            for (Account account : accounts) {
                page.addElement(drawGrayRectangle(posX, posY, convert(190), 20, 3));
                page.addElement(insertBoldText("Conta: "+account.getName(), posX+10, posY+5, 160));
                page.addElement(insertRightText("Saldo Anterior: R$ "+getBalanceUntilLastDay(account.getId(), startDate).getFormatedValue(), posX+265, posY+5, 260));
               
                posY += 23;
               
                page.addElement(drawRectangle(posX, posY, convert(190), 15, 0));
                page.addElement(insertCenterBoldText("Num", posX+2, posY, 35));
                page.addElement(drawVerticalLine(posX+40, posY, 15));
                page.addElement(insertCenterBoldText("Data", posX+42, posY, 75));
                page.addElement(drawVerticalLine(posX+120, posY, 15));
                page.addElement(insertCenterBoldText("Descri��o", posX+122, posY, 210));
                page.addElement(drawVerticalLine(posX+335, posY, 15));
                page.addElement(insertCenterBoldText("Entrada", posX+337, posY, 60));
                page.addElement(drawVerticalLine(posX+400, posY, 15));
                page.addElement(insertCenterBoldText("Sa�da", posX+402, posY, 60));
                page.addElement(drawVerticalLine(posX+465, posY, 15));
                page.addElement(insertCenterBoldText("Balan�o", posX+467, posY, convert(190)-470));
               
                posY += 15;
                Map<String, Operation> operationsMap = (Map<String, Operation>) system.query(new GetOperationByAccountIdAndDate(account.getId(), startDate, finishDate));
               
                List<Operation> operations = new ArrayList<Operation>();
                for (Operation operation : operationsMap.values()) {
                    operations.add(operation);
                }
//                metodo original
//                if(operations.size() > 0) {
//                    MergeSortAlgorithm sortAlgorithm = new MergeSortAlgorithm();
//                    sortAlgorithm.sortOperationsById(operations);
//                }
//                metodo alterado
                Comparator<Operation> comparator = new Comparator<Operation>() {

          @Override
          public int compare(Operation o1, Operation o2) {
            int result = -1;
           
            Calendar calendar1 = Calendar.getInstance();
            calendar1.setTime(o1.getDateTime().getDate());
            Calendar calendar2 = Calendar.getInstance();
            calendar2.setTime(o2.getDateTime().getDate());
           
            result = calendar1.compareTo(calendar2);
           
            return result;
          }
                };
               
                Collections.sort(operations, comparator);
               
                Money balanceValueCredit = new Money(0);
                Money balanceValueDebit = new Money(0);
                Money balanceValueTotal = new Money(getBalanceUntilLastDay(account.getId(), startDate).getValue());
                for (Operation operation : operations) {
                    if(operation.isCredit()) {
                        balanceValueCredit.credit(operation.getValue());
                        balanceValueTotal.credit(operation.getValue());
                    } else {
                        balanceValueTotal.debit(operation.getValue());
                        balanceValueDebit.credit(operation.getValue());
                    }
                    page.addElement(drawRectangle(posX, posY, convert(190), 15, 0));
                    page.addElement(insertNormalText(operation.getId(), posX+2, posY, 35, 15));
                    page.addElement(drawVerticalLine(posX+40, posY, 15));
          page.addElement(insertNormalText(new SimpleDateFormat("dd/MM/yyyy HH:mm").format(operation.getDateTime().getDate()), posX+42, posY, 75, 15));
                    page.addElement(drawVerticalLine(posX+120, posY, 15));
                    BillCategory billCategory = (BillCategory) system.query(new GetBillCategory(operation.getCategoryId()));
                    page.addElement(insertNormalText( operation.getDescription().trim().equals("") ? billCategory.getDescription() : operation.getDescription() , posX+122, posY, 217, 15));
                    page.addElement(drawVerticalLine(posX+335, posY, 15));
                    page.addElement(insertRightText(operation.isCredit() ? new Money(operation.getValue()).getFormatedValue():"", posX+337, posY, 60));
                    page.addElement(drawVerticalLine(posX+400, posY, 15));
                    page.addElement(insertRightText(operation.isCredit() ? "" : new Money(operation.getValue()).getFormatedValue(), posX+402, posY, 60));
                    page.addElement(drawVerticalLine(posX+465, posY, 15));
                    page.addElement(insertRightText(balanceValueTotal.getFormatedValue(), posX+467, posY, convert(190)-470));
                   
                    posY += 15;
                   
                   
                    if(posY > (convert(283)-10)){
                        page.addElement(insertFooter());
                        jasperPrint.addPage(page);
                        page = new JRBasePrintPage();
                        posY = convert(10);
                    }
                   
                }
                page.addElement(insertBoldText("Sub-total", posX+10, posY, 100));
                page.addElement(drawRectangle(posX+335, posY, 65, 15, 0));
                page.addElement(insertRightText(balanceValueCredit.getFormatedValue(), posX+337, posY, 60));
                page.addElement(drawRectangle(posX+400, posY, 65, 15, 0));
                page.addElement(insertRightText(balanceValueDebit.getFormatedValue(), posX+402, posY, 60));
                page.addElement(drawRectangle(posX+465, posY, 65, 15, 0));
                page.addElement(insertRightText(balanceValueTotal.getFormatedValue(), posX+467, posY, convert(190)-470));
               
                posY += 18;
                totalValueCredit.credit(balanceValueCredit);
                totalValueDebit.credit(balanceValueDebit);
                totalValue.credit(balanceValueTotal);
               
                if(posY > (convert(283)-10)){
                  page.addElement(insertFooter());
                  jasperPrint.addPage(page);
                  page = new JRBasePrintPage();
                  posY = convert(10);
                }
            }
            posY += 10;
           
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

    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.base.JRBasePrintPage

        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.base.JRBasePrintPage

           
            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;
                            }
                        }
                    }
                    posY += (numberTotalComputers+1) * 14;
                   
                    if(((numberTotalComputers+2) * 14)+posY+10 > convert(297) || periods == 2){
                        jasperPrint.addPage(page);
                        page = new JRBasePrintPage();
                        posY = convert(10);
                    }
                   
                }
            }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

        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);
                   
            }else if(type == 7) {
              int registrationBalance = 0;
              int registrationActives = 0;
              int registrationDesistent = 0;
              int registrationEnded = 0;
              int registrationDeactivated = 0;
              int totalNumberOfRegistration = 0;
              int totalNumberOfStudents = 0;
              int numberOfStudents = 0;
              int numberOfStudentsWithoutRegistration = 0;
              List<String> listOfDeactivated = new ArrayList();
              listOfDeactivated.add("Inadimplente");
              listOfDeactivated.add("Ausente nas aulas");
              listOfDeactivated.add("Problemas internos");
              listOfDeactivated.add("Mudou-se");
              listOfDeactivated.add("Faleceu");
              listOfDeactivated.add("Falta de contato");

              Map<String, Person> personMap = (Map<String, Person>) system.query(new GetStudent());
              GDDate initialDate = new GDDate(startDate.getTimeInMillis());
              initialDate.setDayOfMonth(1);
              GDDate initialDateEndDayOfTheMonth = new GDDate(startDate.getTimeInMillis());
              finishDate.setLastDayOfMonth();
              startDate.setDayOfMonth(1);

              insertBalancetHeaderTable(page, posX);
              while (initialDate.beforeOrEqualsDay(finishDate)) {
                initialDate.setDayOfMonth(1);
                initialDateEndDayOfTheMonth.setLastDayOfMonth();
                registrationActives = 0;
                registrationDesistent = 0;
                registrationEnded = 0;
                registrationDeactivated = 0;
                totalNumberOfRegistration = 0;
                numberOfStudents = 0;
                registrationList.clear();
                boolean isUnique;
                for (Person person : personMap.values()) {
                  isUnique = true;
                  try{
                    registrationList = (List<Registration>) system.query(new GetRegistrationByPerson(person.getId()));
                    for (Registration registration : registrationList) {
                      GDDate registrationDate = new GDDate(registration.getRegistrationDate());
//                    if ( registration.isActive() && registrationDate.afterOrEqualsDay(startDate) && registrationDate.afterOrEqualsDay(initialDateEndDayOfTheMonth) && initialDate.getFormatedDate().equals(startDate.getFormatedDate()) ){
//                    numberOfStudents++;
//                    }
                      if (registration.getEndDate() == null ){
                        if ( registrationDate.beforeOrEqualsDay(initialDateEndDayOfTheMonth) ){
                          totalNumberOfRegistration++;
                        }
                      }else{
                        GDDate registrationEndDate = new GDDate(registration.getEndDate().getTimeInMillis());
                        if ( registrationEndDate.afterDay(initialDateEndDayOfTheMonth) && registrationDate.beforeOrEqualsDay(initialDateEndDayOfTheMonth)){
                          totalNumberOfRegistration++;
                        }
                      }
                      if ( registrationDate.afterOrEqualsDay(initialDate) && registrationDate.beforeOrEqualsDay(initialDateEndDayOfTheMonth) ){
                        registrationActives++;
//                        if (registration.getEndDate() != null ){
//                            GDDate registrationEndDate = new GDDate(registration.getEndDate().getTimeInMillis());
//                            if ( registrationEndDate.afterDay(initialDateEndDayOfTheMonth)){
//                              registrationActives++;
//                            }
//                          }else{
//                            registrationActives++;
//                          }
                      }
                      if (registration.getEndDate()!= null ){
                        GDDate registrationEndDate = new GDDate(registration.getEndDate().getTimeInMillis());
                        if ( registrationEndDate.afterOrEqualsDay(initialDate) && registrationEndDate.beforeOrEqualsDay(initialDateEndDayOfTheMonth)){
                          if (registration.getEndStatus().get(0).substring(0, 4).equals("Term")){
                            registrationEnded++;
                          }else{
                            boolean desistent = true;
                            for (String  deactivatedItem : listOfDeactivated){
                              if ( registration.getEndStatus().get(0).equals(deactivatedItem)) {
                                desistent = false;
                                registrationDeactivated++;
                                break;
                              }
                            }
                            if (desistent){
                              registrationDesistent++;  
                            }
                          }
                        }
                      }
                    }
                  }catch (RegistrationDoesNotExistsInPersistenceException rdne){
                    numberOfStudentsWithoutRegistration++;
                  }
                }
//              totalNumberOfRegistration+=registrationActives;
                registrationBalance = registrationActives - (registrationEnded + registrationDesistent + registrationDeactivated);
                insertBalancedDataTable(page, posX, initialDate.getYear(), initialDate.getMonth(),totalNumberOfRegistration, registrationActives, registrationEnded, registrationDesistent , registrationDeactivated, registrationBalance);
                initialDate.addMonth(1);
                initialDateEndDayOfTheMonth.addMonth(1);
              }
              if(posY > (convert(277)-20)){
                jasperPrint.addPage(page);
                page = new JRBasePrintPage();
                posY = convert(10);
              }
              jasperPrint.addPage(page);
            }
        } catch (Exception e) {
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintPage

            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
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.