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
017 package org.kuali.kfs.module.purap.businessobject;
018
019 import org.kuali.rice.kns.util.KualiDecimal;
020 import org.kuali.rice.kns.util.ObjectUtils;
021
022 /**
023 * Purchase Order Account Business Object.
024 */
025 public class PurchaseOrderAccount extends PurApAccountingLineBase {
026
027 /**
028 * NOTE FOR POTENTIAL ACCOUNTING LINE REFACTORING documentNumber is needed for PO accounts and not for other PURAP docs, however
029 * it is already defined in AccountingLineBase so we don't need to add it here
030 */
031 // private String documentNumber;
032 private KualiDecimal itemAccountOutstandingEncumbranceAmount;
033
034 /**
035 * Default constructor.
036 */
037 public PurchaseOrderAccount() {
038
039 }
040
041 public PurchaseOrderAccount(PurApAccountingLine ra) {
042 this.setAccountLinePercent(ra.getAccountLinePercent());
043 this.setAccountNumber(ra.getAccountNumber());
044 this.setChartOfAccountsCode(ra.getChartOfAccountsCode());
045 this.setFinancialObjectCode(ra.getFinancialObjectCode());
046 this.setFinancialSubObjectCode(ra.getFinancialSubObjectCode());
047 this.setOrganizationReferenceId(ra.getOrganizationReferenceId());
048 this.setProjectCode(ra.getProjectCode());
049 this.setSubAccountNumber(ra.getSubAccountNumber());
050 }
051
052 /**
053 * @see org.kuali.kfs.module.purap.businessobject.PurApAccountingLine#getAlternateAmountForGLEntryCreation()
054 */
055 public KualiDecimal getAlternateAmountForGLEntryCreation() {
056 if (ObjectUtils.isNull(super.getAlternateAmountForGLEntryCreation())) {
057 return getItemAccountOutstandingEncumbranceAmount();
058 }
059 return super.getAlternateAmountForGLEntryCreation();
060 }
061
062 public KualiDecimal getItemAccountOutstandingEncumbranceAmount() {
063 return itemAccountOutstandingEncumbranceAmount;
064 }
065
066 public void setItemAccountOutstandingEncumbranceAmount(KualiDecimal itemAccountOutstandingEncumbranceAmount) {
067 this.itemAccountOutstandingEncumbranceAmount = itemAccountOutstandingEncumbranceAmount;
068 }
069
070 public PurchaseOrderItem getPurchaseOrderItem() {
071 return super.getPurapItem();
072 }
073
074 /**
075 * Sets the purchaseOrderItem attribute value.
076 *
077 * @param purchaseOrderItem The purchaseOrderItem to set.
078 * @deprecated
079 */
080 public void setPurchaseOrderItem(PurchaseOrderItem purchaseOrderItem) {
081 super.setPurapItem(purchaseOrderItem);
082 }
083
084 /**
085 * Caller of this method should take care of creating PurchaseOrderItems
086 *
087 */
088 public void copyFrom(PurchaseOrderAccount other) {
089 super.copyFrom(other);
090 setItemAccountOutstandingEncumbranceAmount(other.getItemAccountOutstandingEncumbranceAmount());
091 }
092 }