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 org.kuali.rice.kns.util.KualiDecimal; 019 020 /** 021 * This class represents a G/L Summary object which contains monthly amounts 022 */ 023 public class GlSummary extends Balance{ 024 025 /** 026 * Constructs a GlSummary.java. 027 */ 028 public GlSummary() { 029 super(); 030 } 031 032 /** 033 * Constructs a GlSummary.java. 034 * @param data 035 */ 036 public GlSummary(Object[] data) { 037 this.setFundGroup((String) data[0]); 038 039 this.setAccountLineAnnualBalanceAmount((KualiDecimal) data[1]); 040 this.setBeginningBalanceLineAmount((KualiDecimal) data[2]); 041 this.setContractsGrantsBeginningBalanceAmount((KualiDecimal) data[3]); 042 this.setMonth1Amount((KualiDecimal) data[4]); 043 this.setMonth2Amount((KualiDecimal) data[5]); 044 this.setMonth3Amount((KualiDecimal) data[6]); 045 this.setMonth4Amount((KualiDecimal) data[7]); 046 this.setMonth5Amount((KualiDecimal) data[8]); 047 this.setMonth6Amount((KualiDecimal) data[9]); 048 this.setMonth7Amount((KualiDecimal) data[10]); 049 this.setMonth8Amount((KualiDecimal) data[11]); 050 this.setMonth9Amount((KualiDecimal) data[12]); 051 this.setMonth10Amount((KualiDecimal) data[13]); 052 this.setMonth11Amount((KualiDecimal) data[14]); 053 this.setMonth12Amount((KualiDecimal) data[15]); 054 this.setMonth13Amount((KualiDecimal) data[16]); 055 } 056 057 /** 058 * @param anotherSummary 059 */ 060 public void add(GlSummary anotherSummary) { 061 setBeginningBalanceLineAmount(getBeginningBalanceLineAmount().add(anotherSummary.getBeginningBalanceLineAmount())); 062 setContractsGrantsBeginningBalanceAmount(getContractsGrantsBeginningBalanceAmount().add(anotherSummary.getContractsGrantsBeginningBalanceAmount())); 063 setAccountLineAnnualBalanceAmount(getAccountLineAnnualBalanceAmount().add(anotherSummary.getAccountLineAnnualBalanceAmount())); 064 setMonth1Amount(getMonth1Amount().add(anotherSummary.getMonth1Amount())); 065 setMonth2Amount(getMonth2Amount().add(anotherSummary.getMonth2Amount())); 066 setMonth3Amount(getMonth3Amount().add(anotherSummary.getMonth3Amount())); 067 setMonth4Amount(getMonth4Amount().add(anotherSummary.getMonth4Amount())); 068 setMonth5Amount(getMonth5Amount().add(anotherSummary.getMonth5Amount())); 069 setMonth6Amount(getMonth6Amount().add(anotherSummary.getMonth6Amount())); 070 setMonth7Amount(getMonth7Amount().add(anotherSummary.getMonth7Amount())); 071 setMonth8Amount(getMonth8Amount().add(anotherSummary.getMonth8Amount())); 072 setMonth9Amount(getMonth9Amount().add(anotherSummary.getMonth9Amount())); 073 setMonth10Amount(getMonth10Amount().add(anotherSummary.getMonth10Amount())); 074 setMonth11Amount(getMonth11Amount().add(anotherSummary.getMonth11Amount())); 075 setMonth12Amount(getMonth12Amount().add(anotherSummary.getMonth12Amount())); 076 setMonth13Amount(getMonth13Amount().add(anotherSummary.getMonth13Amount())); 077 } 078 079 /** 080 * @see org.kuali.kfs.gl.businessobject.Balance#getYearBalance() 081 */ 082 @Override 083 public KualiDecimal getYearBalance() { 084 KualiDecimal yearbalance = KualiDecimal.ZERO; 085 086 yearbalance = yearbalance.add(this.getMonth1Amount()); 087 yearbalance = yearbalance.add(this.getMonth2Amount()); 088 yearbalance = yearbalance.add(this.getMonth3Amount()); 089 yearbalance = yearbalance.add(this.getMonth4Amount()); 090 yearbalance = yearbalance.add(this.getMonth5Amount()); 091 yearbalance = yearbalance.add(this.getMonth6Amount()); 092 yearbalance = yearbalance.add(this.getMonth7Amount()); 093 yearbalance = yearbalance.add(this.getMonth8Amount()); 094 yearbalance = yearbalance.add(this.getMonth9Amount()); 095 yearbalance = yearbalance.add(this.getMonth10Amount()); 096 yearbalance = yearbalance.add(this.getMonth11Amount()); 097 yearbalance = yearbalance.add(this.getMonth12Amount()); 098 yearbalance = yearbalance.add(this.getMonth13Amount()); 099 100 return yearbalance; 101 } 102 103 /** 104 * @see org.kuali.kfs.gl.businessobject.Balance#getYearToDayBalance() 105 */ 106 @Override 107 public KualiDecimal getYearToDayBalance() { 108 KualiDecimal yearToDayBalance = KualiDecimal.ZERO; 109 110 yearToDayBalance = yearToDayBalance.add(this.getAccountLineAnnualBalanceAmount()); 111 yearToDayBalance = yearToDayBalance.add(this.getBeginningBalanceLineAmount()); 112 yearToDayBalance = yearToDayBalance.add(this.getContractsGrantsBeginningBalanceAmount()); 113 114 return yearToDayBalance; 115 } 116 117 118 }