/* * The Kuali Financial System, a comprehensive financial management system for higher education. * * Copyright 2005-2014 The Kuali Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.kuali.kfs.fp.document; import org.kuali.kfs.coa.businessobject.AccountingPeriod; import org.kuali.kfs.fp.document.service.YearEndPendingEntryService; import org.kuali.kfs.sys.businessobject.AccountingLine; import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry; import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail; import org.kuali.kfs.sys.context.SpringContext; import org.kuali.kfs.sys.document.AccountingDocument; import org.kuali.kfs.sys.document.AmountTotaling; import org.kuali.kfs.sys.document.ElectronicPaymentClaiming; /** * Year End version of the <code>DistributionOfIncomeAndExpenseDocument</code> the only functional difference between the YearEnd * version and the non-yearEnd version of a document is the glpe's generation. */ public class YearEndDistributionOfIncomeAndExpenseDocument extends DistributionOfIncomeAndExpenseDocument implements YearEndDocument, AmountTotaling, ElectronicPaymentClaiming, CapitalAssetEditable { /** * Constructs a YearEndDistributionOfIncomeAndExpenseDocument.java. */ public YearEndDistributionOfIncomeAndExpenseDocument() { super(); } /** * This method calls the super class's overridden method to perform the general customization actions, then calls the * YearEndDocumentUtil matching method to perform year end specific customization activities. * * @param accountingDocument The accounting document containing the general ledger pending entries being customized. * @param accountingLine The accounting line the explicit general ledger pending entry was generated from. * @param explicitEntry The explicit general ledger pending entry to be customized. * * @see org.kuali.module.financial.rules.DistributeOfIncomeAndExpenseDocumentRule#customizeExplicitGeneralLedgerPendingEntry(org.kuali.kfs.sys.document.AccountingDocument, * org.kuali.kfs.sys.businessobject.AccountingLine, org.kuali.module.gl.bo.GeneralLedgerPendingEntry) * @see YearEndDocumentUtil#customizeExplicitGeneralLedgerPendingEntry(TransactionalDocument, AccountingLine, * GeneralLedgerPendingEntry) */ @Override public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry) { super.customizeExplicitGeneralLedgerPendingEntry(postable, explicitEntry); AccountingLine accountingLine = (AccountingLine)postable; SpringContext.getBean(YearEndPendingEntryService.class).customizeExplicitGeneralLedgerPendingEntry(this, accountingLine, explicitEntry); } /** * Overridden to populate object code from last year's offset definition * @see org.kuali.kfs.sys.document.AccountingDocumentBase#customizeOffsetGeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) */ @Override public boolean customizeOffsetGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail accountingLine, GeneralLedgerPendingEntry explicitEntry, GeneralLedgerPendingEntry offsetEntry) { boolean success = super.customizeOffsetGeneralLedgerPendingEntry(accountingLine, explicitEntry, offsetEntry); success &= SpringContext.getBean(YearEndPendingEntryService.class).customizeOffsetGeneralLedgerPendingEntry(this, accountingLine, explicitEntry, offsetEntry); return success; } @Override public Class<? extends AccountingDocument> getDocumentClassForAccountingLineValueAllowedValidation() { return DistributionOfIncomeAndExpenseDocument.class; } @Override public void setAccountingPeriod(AccountingPeriod accountingPeriod) { //Need to override this method to set the posting year and //posting period code so that we can have period 13 in the document's //table in the database so that it's consistent with the GL Entry's //posting year and posting period. YearEndPendingEntryService yearEndPendingEntryService = SpringContext.getBean(YearEndPendingEntryService.class); setPostingYear(yearEndPendingEntryService.getPreviousFiscalYear()); this.setPostingPeriodCode(yearEndPendingEntryService.getFinalAccountingPeriod()); } }