Ejemplo n.º 1
0
  /**
   * Gets the fieldInfo attribute.
   *
   * @return Returns the fieldInfo.
   */
  protected List<Map<String, String>> getFieldInfo(List<EffortCertificationDetail> detailLines) {
    LOG.debug("getFieldInfo(List<EffortCertificationDetail>) start");

    List<Map<String, String>> fieldInfo = new ArrayList<Map<String, String>>();
    EffortCertificationDocument document = (EffortCertificationDocument) this.getDocument();
    KualiDecimal totalOriginalPayrollAmount = document.getTotalOriginalPayrollAmount();

    for (EffortCertificationDetail detailLine : detailLines) {
      detailLine.refreshNonUpdateableReferences();

      Map<String, String> fieldInfoForAttribute = new HashMap<String, String>();

      fieldInfoForAttribute.put(
          KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE,
          detailLine.getChartOfAccounts().getFinChartOfAccountDescription());

      String accountInfo = buildAccountInfo(detailLine.getAccount());
      fieldInfoForAttribute.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountInfo);

      SubAccount subAccount = detailLine.getSubAccount();
      if (ObjectUtils.isNotNull(subAccount)) {
        fieldInfoForAttribute.put(
            KFSPropertyConstants.SUB_ACCOUNT_NUMBER, subAccount.getSubAccountName());
      }

      ObjectCode objectCode = detailLine.getFinancialObject();
      if (ObjectUtils.isNotNull(objectCode)) {
        fieldInfoForAttribute.put(
            KFSPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode.getFinancialObjectCodeName());
      }

      Account sourceAccount = detailLine.getSourceAccount();
      if (ObjectUtils.isNotNull(sourceAccount)) {
        fieldInfoForAttribute.put(
            EffortPropertyConstants.SOURCE_ACCOUNT_NUMBER, sourceAccount.getAccountName());
      }

      Chart sourceChart = detailLine.getSourceChartOfAccounts();
      if (ObjectUtils.isNotNull(sourceChart)) {
        fieldInfoForAttribute.put(
            EffortPropertyConstants.SOURCE_CHART_OF_ACCOUNTS_CODE,
            sourceChart.getFinChartOfAccountDescription());
      }

      KualiDecimal originalPayrollAmount = detailLine.getEffortCertificationOriginalPayrollAmount();
      String actualOriginalPercent =
          PayrollAmountHolder.recalculateEffortPercentAsString(
              totalOriginalPayrollAmount, originalPayrollAmount);
      fieldInfoForAttribute.put(
          EffortPropertyConstants.EFFORT_CERTIFICATION_CALCULATED_OVERALL_PERCENT,
          actualOriginalPercent);

      fieldInfo.add(fieldInfoForAttribute);
    }

    return fieldInfo;
  }
Ejemplo n.º 2
0
 /**
  * recalculate the payroll amount of the current detail line
  *
  * @param totalPayrollAmount the total payroll amount of the hosting document
  */
 public void recalculatePayrollAmount(KualiDecimal totalPayrollAmount) {
   Integer effortPercent = this.getEffortCertificationUpdatedOverallPercent();
   KualiDecimal payrollAmount =
       PayrollAmountHolder.recalculatePayrollAmount(totalPayrollAmount, effortPercent);
   this.setEffortCertificationPayrollAmount(payrollAmount);
 }