001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.gl.businessobject; 017 018 import java.util.LinkedHashMap; 019 020 import org.kuali.kfs.sys.KFSKeyConstants; 021 import org.kuali.kfs.sys.context.SpringContext; 022 import org.kuali.rice.kns.bo.TransientBusinessObjectBase; 023 import org.kuali.rice.kns.service.KualiConfigurationService; 024 import org.kuali.rice.kns.util.KualiDecimal; 025 026 /** 027 * Summarizes Pending Entry data for the GLPE pending entry report. 028 */ 029 public class LedgerSummaryTotalLine extends TransientBusinessObjectBase { 030 private KualiDecimal debitAmount = KualiDecimal.ZERO; 031 private int debitCount = 0; 032 private KualiDecimal creditAmount = KualiDecimal.ZERO; 033 private int creditCount = 0; 034 private KualiDecimal budgetAmount = KualiDecimal.ZERO; 035 private int budgetCount = 0; 036 /** 037 * Gets the recordCount attribute. 038 * @return Returns the recordCount. 039 */ 040 public int getRecordCount() { 041 return debitCount + creditCount + budgetCount; 042 } 043 /** 044 * Gets the debitAmount attribute. 045 * @return Returns the debitAmount. 046 */ 047 public KualiDecimal getDebitAmount() { 048 return debitAmount; 049 } 050 /** 051 * Gets the debitCount attribute. 052 * @return Returns the debitCount. 053 */ 054 public int getDebitCount() { 055 return debitCount; 056 } 057 /** 058 * Gets the creditAmount attribute. 059 * @return Returns the creditAmount. 060 */ 061 public KualiDecimal getCreditAmount() { 062 return creditAmount; 063 } 064 /** 065 * Gets the creditCount attribute. 066 * @return Returns the creditCount. 067 */ 068 public int getCreditCount() { 069 return creditCount; 070 } 071 /** 072 * Gets the budgetAmount attribute. 073 * @return Returns the budgetAmount. 074 */ 075 public KualiDecimal getBudgetAmount() { 076 return budgetAmount; 077 } 078 /** 079 * Gets the budgetCount attribute. 080 * @return Returns the budgetCount. 081 */ 082 public int getBudgetCount() { 083 return budgetCount; 084 } 085 086 /** 087 * Adds a debit amount to the current debit total 088 * @param debitAmount the debit amount to add to the debit total 089 */ 090 public void addDebitAmount(KualiDecimal debitAmount) { 091 this.debitAmount = this.debitAmount.add(debitAmount); 092 this.debitCount += 1; 093 } 094 095 /** 096 * Adds a credit amount to current credit total 097 * @param creditAmount the amount to add to the credit total 098 */ 099 public void addCreditAmount(KualiDecimal creditAmount) { 100 this.creditAmount = this.creditAmount.add(creditAmount); 101 this.creditCount += 1; 102 } 103 104 /** 105 * Adds a budget amount to current budget total 106 * @param budgetAmount the amount to add to the budget total 107 */ 108 public void addBudgetAmount(KualiDecimal budgetAmount) { 109 this.budgetAmount = this.budgetAmount.add(budgetAmount); 110 this.budgetCount += 1; 111 } 112 113 /** 114 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 115 */ 116 @Override 117 protected LinkedHashMap toStringMapper() { 118 return new LinkedHashMap(); 119 } 120 121 /** 122 * @return the summary for this summary total line 123 */ 124 public String getSummary() { 125 return SpringContext.getBean(KualiConfigurationService.class).getPropertyString(KFSKeyConstants.MESSAGE_REPORT_NIGHTLY_OUT_LEDGER_TOTAL); 126 } 127 }