/**
   * builds report body
   *
   * @param BudgetConstructionAccountSummary bcas
   */
  protected void buildReportsBody(
      BudgetConstructionOrgAccountSummaryReport orgAccountSummaryReportEntry,
      BudgetConstructionAccountSummary accountSummary) {
    orgAccountSummaryReportEntry.setAccountNumber(accountSummary.getAccountNumber());
    orgAccountSummaryReportEntry.setSubAccountNumber(accountSummary.getSubAccountNumber());

    if (accountSummary.getSubAccountNumber().equals(BCConstants.Report.DASHES_SUB_ACCOUNT_CODE)) {
      if (accountSummary.getAccount().getAccountName() == null) {
        orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(
            kualiConfigurationService.getPropertyString(
                BCKeyConstants.ERROR_REPORT_GETTING_ACCOUNT_DESCRIPTION));
      } else
        orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(
            accountSummary.getAccount().getAccountName());
    } else {
      try {
        if (accountSummary.getSubAccount().getSubAccountName() == null) {
          orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(
              kualiConfigurationService.getPropertyString(
                  BCKeyConstants.ERROR_REPORT_GETTING_SUB_ACCOUNT_DESCRIPTION));
        } else
          orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(
              accountSummary.getSubAccount().getSubAccountName());
      } catch (PersistenceBrokerException e) {
        orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(
            kualiConfigurationService.getPropertyString(
                BCKeyConstants.ERROR_REPORT_GETTING_SUB_ACCOUNT_DESCRIPTION));
      }
    }

    // build income expense description
    if (accountSummary.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_A)) {
      orgAccountSummaryReportEntry.setIncExpDesc(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_REVENUE));
    } else if (accountSummary.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_E)) {
      orgAccountSummaryReportEntry.setIncExpDesc(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXP_GROSS));
    } else if (accountSummary.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_T)) {
      trExist = true;
      orgAccountSummaryReportEntry.setIncExpDesc(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_TRNFR_IN));
    } else {
      if (trExist) {
        trExist = false;
        orgAccountSummaryReportEntry.setIncExpDesc(
            kualiConfigurationService.getPropertyString(
                BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXP_NET_TRNFR));
      } else {
        orgAccountSummaryReportEntry.setIncExpDesc(
            kualiConfigurationService.getPropertyString(
                BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXPENDITURE));
      }
    }

    Integer beginingBalanceLineAmt = 0;
    Integer accountLineAnnualBalAmt = 0;
    if (accountSummary.getFinancialBeginningBalanceLineAmount() != null) {
      beginingBalanceLineAmt =
          BudgetConstructionReportHelper.convertKualiInteger(
              accountSummary.getFinancialBeginningBalanceLineAmount());
    }

    if (accountSummary.getFinancialBeginningBalanceLineAmount() != null) {
      accountLineAnnualBalAmt =
          BudgetConstructionReportHelper.convertKualiInteger(
              accountSummary.getAccountLineAnnualBalanceAmount());
    }

    orgAccountSummaryReportEntry.setBaseAmount(beginingBalanceLineAmt);
    orgAccountSummaryReportEntry.setReqAmount(accountLineAnnualBalAmt);
    orgAccountSummaryReportEntry.setAmountChange(accountLineAnnualBalAmt - beginingBalanceLineAmt);

    orgAccountSummaryReportEntry.setPercentChange(
        BudgetConstructionReportHelper.calculatePercent(
            orgAccountSummaryReportEntry.getAmountChange(), beginingBalanceLineAmt));
  }
  /**
   * builds report Header
   *
   * @param BudgetConstructionAccountSummary bcas
   */
  protected void buildReportsHeader(
      Integer universityFiscalYear,
      BudgetConstructionOrgAccountSummaryReport orgAccountSummaryReportEntry,
      BudgetConstructionAccountSummary accountSummary,
      boolean consolidated) {
    String orgChartDesc =
        accountSummary.getOrganizationChartOfAccounts().getFinChartOfAccountDescription();
    String chartDesc = accountSummary.getChartOfAccounts().getFinChartOfAccountDescription();
    String orgName = accountSummary.getOrganization().getOrganizationName();
    String reportChartDesc =
        accountSummary
            .getChartOfAccounts()
            .getReportsToChartOfAccounts()
            .getFinChartOfAccountDescription();
    String subFundGroupName = accountSummary.getFundGroup().getName();
    String subFundGroupDes = accountSummary.getSubFundGroup().getSubFundGroupDescription();
    Integer prevFiscalyear = universityFiscalYear - 1;
    orgAccountSummaryReportEntry.setFiscalYear(
        prevFiscalyear.toString() + "-" + universityFiscalYear.toString().substring(2, 4));
    orgAccountSummaryReportEntry.setOrgChartOfAccountsCode(
        accountSummary.getOrganizationChartOfAccountsCode());

    if (orgChartDesc == null) {
      orgAccountSummaryReportEntry.setOrgChartOfAccountDescription(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.ERROR_REPORT_GETTING_CHART_DESCRIPTION));
    } else {
      orgAccountSummaryReportEntry.setOrgChartOfAccountDescription(orgChartDesc);
    }

    orgAccountSummaryReportEntry.setOrganizationCode(accountSummary.getOrganizationCode());
    if (orgName == null) {
      orgAccountSummaryReportEntry.setOrganizationName(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.ERROR_REPORT_GETTING_ORGANIZATION_NAME));
    } else {
      orgAccountSummaryReportEntry.setOrganizationName(orgName);
    }

    orgAccountSummaryReportEntry.setChartOfAccountsCode(accountSummary.getChartOfAccountsCode());
    if (chartDesc == null) {
      orgAccountSummaryReportEntry.setChartOfAccountDescription(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.ERROR_REPORT_GETTING_CHART_DESCRIPTION));
    } else {
      orgAccountSummaryReportEntry.setChartOfAccountDescription(chartDesc);
    }

    orgAccountSummaryReportEntry.setFundGroupCode(accountSummary.getFundGroupCode());
    if (subFundGroupName == null) {
      orgAccountSummaryReportEntry.setFundGroupName(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.ERROR_REPORT_GETTING_FUNDGROUP_NAME));
    } else {
      orgAccountSummaryReportEntry.setFundGroupName(subFundGroupName);
    }

    orgAccountSummaryReportEntry.setSubFundGroupCode(accountSummary.getSubFundGroupCode());
    if (subFundGroupName == null) {
      orgAccountSummaryReportEntry.setSubFundGroupDescription(
          kualiConfigurationService.getPropertyString(
              BCKeyConstants.ERROR_REPORT_GETTING_SUBFUNDGROUP_DESCRIPTION));
    } else {
      orgAccountSummaryReportEntry.setSubFundGroupDescription(subFundGroupDes);
    }

    Integer prevPrevFiscalyear = prevFiscalyear - 1;
    orgAccountSummaryReportEntry.setBaseFy(
        prevPrevFiscalyear.toString() + "-" + prevFiscalyear.toString().substring(2, 4));
    orgAccountSummaryReportEntry.setReqFy(
        prevFiscalyear.toString() + "-" + universityFiscalYear.toString().substring(2, 4));
    orgAccountSummaryReportEntry.setHeader1(
        kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_ACCOUNT_SUB));
    orgAccountSummaryReportEntry.setHeader2(
        kualiConfigurationService.getPropertyString(
            BCKeyConstants.MSG_REPORT_HEADER_ACCOUNT_SUB_NAME));
    orgAccountSummaryReportEntry.setHeader3(
        kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_BASE_AMOUNT));
    orgAccountSummaryReportEntry.setHeader4(
        kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_REQ_AMOUNT));
    orgAccountSummaryReportEntry.setHeader5(
        kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_CHANGE));
    orgAccountSummaryReportEntry.setHeader6(
        kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_CHANGE));
    if (consolidated) {
      orgAccountSummaryReportEntry.setConsHdr(BCConstants.Report.CONSOLIIDATED);
    } else {
      orgAccountSummaryReportEntry.setConsHdr(BCConstants.Report.BLANK);
    }
  }