Пример #1
0
  public void getBudgetFMAReportPrintWriter(ReportModel psm, String filePath) {
    //        System.out.println("***************** Abstract class getSalaryAbstractPrintWriter
    // method is calling *******************");
    try {
      PrintWriter pw = null;
      File file = new File(filePath);
      try {
        pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
      } catch (IOException ex) {
        ex.printStackTrace();
      }

      if (psm.getSlipno() == 1) {
        budgetReportHeader(pw, psm);
        groupname = psm.getLedgergroupname();
        pw.printf("%6s%s", "", psm.getLedgergroupname());
        pw.println();
        lineno++;
        pw.printf("%6s%s", "", "~~~~~~~~~~~~~~~~~~~~~~~~~~");
        pw.println();
        lineno++;
      }

      if (!groupname.equals(psm.getLedgergroupname())) {
        budgetReportGroupTotal(pw);
        pw.printf("%6s%s", "", psm.getLedgergroupname());
        pw.println();
        lineno++;
        pw.printf("%6s%s", "", "~~~~~~~~~~~~~~~~~~~~~~~~~~");
        pw.println();
        lineno++;

        if (lineno >= 61) {
          pw.println();
          pw.print(FORM_FEED);
          lineno = 1;
          budgetReportHeader(pw, psm);
        }

        groupname = psm.getLedgergroupname();
      }

      if (lineno >= 61) {
        pw.println();
        pw.print(FORM_FEED);
        lineno = 1;
        budgetReportHeader(pw, psm);
      }

      pw.printf(
          "%4s%-2s%-30s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s",
          psm.getSlipno(),
          ". ",
          psm.getLedgername(),
          " ",
          psm.getFirstactual(),
          " ",
          psm.getSecondactual(),
          " ",
          psm.getThirdactual(),
          " ",
          psm.getAverage(),
          " ",
          psm.getBudgetestimate(),
          " ",
          psm.getActualfirsthalf(),
          " ",
          psm.getProbablesecondhalf(),
          " ",
          psm.getRevisedestimate(),
          " ",
          psm.getBudgetestimatenext(),
          " ",
          psm.getFma(),
          " ",
          psm.getHofma(),
          " ",
          psm.getHorevisedestimate(),
          " ",
          psm.getHobudgetestimate());
      pw.println();
      lineno++;

      if (lineno >= 61) {
        pw.println();
        pw.print(FORM_FEED);
        lineno = 1;
        budgetReportHeader(pw, psm);
      }

      pw.print(horizontalline);
      pw.println();
      lineno++;

      if (lineno >= 61) {
        pw.println();
        pw.print(FORM_FEED);
        lineno = 1;
        budgetReportHeader(pw, psm);
      }

      groupFirstactual += Double.valueOf(psm.getFirstactual());
      groupSecondactual += Double.valueOf(psm.getSecondactual());
      groupThirdactual += Double.valueOf(psm.getThirdactual());
      groupAverage += Double.valueOf(psm.getAverage());
      groupBudgetestimate += Double.valueOf(psm.getBudgetestimate());
      groupActualfirsthalf += Double.valueOf(psm.getActualfirsthalf());
      groupProbablesecondhalf += Double.valueOf(psm.getProbablesecondhalf());
      groupRevisedestimate += Double.valueOf(psm.getRevisedestimate());
      groupBudgetestimatenext += Double.valueOf(psm.getBudgetestimatenext());

      if (psm.getHorevisedestimate() != null || psm.getHorevisedestimate().length() > 0) {
        groupHorevisedestimate += Double.valueOf(psm.getHorevisedestimate());
      } else {
        groupHorevisedestimate += 0;
      }

      if (psm.getHobudgetestimate() != null || psm.getHobudgetestimate().length() > 0) {
        groupHobudgetestimate += Double.valueOf(psm.getHobudgetestimate());
      } else {
        groupHobudgetestimate += 0;
      }

      if (psm.getFma() != null || psm.getFma().length() > 0) {
        groupFma += Double.valueOf(psm.getFma());
      } else {
        groupFma += 0;
      }

      if (psm.getHofma() != null || psm.getHofma().length() > 0) {
        groupHOFma += Double.valueOf(psm.getHofma());
      } else {
        groupHOFma += 0;
      }

      grandFirstactual += Double.valueOf(psm.getFirstactual());
      grandSecondactual += Double.valueOf(psm.getSecondactual());
      grandThirdactual += Double.valueOf(psm.getThirdactual());
      grandAverage += Double.valueOf(psm.getAverage());
      grandBudgetestimate += Double.valueOf(psm.getBudgetestimate());
      grandActualfirsthalf += Double.valueOf(psm.getActualfirsthalf());
      grandProbablesecondhalf += Double.valueOf(psm.getProbablesecondhalf());
      grandRevisedestimate += Double.valueOf(psm.getRevisedestimate());
      grandBudgetestimatenext += Double.valueOf(psm.getBudgetestimatenext());

      if (psm.getHorevisedestimate() != null || psm.getHorevisedestimate().length() > 0) {
        grandHorevisedestimate += Double.valueOf(psm.getHorevisedestimate());
      } else {
        grandHorevisedestimate += 0;
      }

      if (psm.getHobudgetestimate() != null || psm.getHobudgetestimate().length() > 0) {
        grandHobudgetestimate += Double.valueOf(psm.getHobudgetestimate());
      } else {
        grandHobudgetestimate += 0;
      }

      if (psm.getFma() != null || psm.getFma().length() > 0) {
        grandFma += Double.valueOf(psm.getFma());
      } else {
        grandFma += 0;
      }

      if (psm.getHofma() != null || psm.getHofma().length() > 0) {
        grandHoFma += Double.valueOf(psm.getHofma());
      } else {
        grandHoFma += 0;
      }

      //
      // pw.printf("%36s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s", "
      //        GROUP TOTAL           ", " ", "       0.00", " ", "       0.00", " ", "       0.00",
      // " ", "       0.00", " ", "       0.00", " ", "       0.00", " ", "       0.00", " ", "
      //  0.00", " ", "       0.00", " ", "       0.00", " ", "       0.00");
      //            pw.println();
      //
      // pw.printf("%36s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s%s%11s", "
      //        GRAND TOTAL           ", " ", "       0.00", " ", "       0.00", " ", "       0.00",
      // " ", "       0.00", " ", "       0.00", " ", "       0.00", " ", "       0.00", " ", "
      //  0.00", " ", "       0.00", " ", "       0.00", " ", "       0.00");
      //            pw.write(FORM_FEED);

      pw.flush();
      pw.close();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }