001/*
002 * Copyright 2006 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
017package org.kuali.ole.module.purap.businessobject;
018
019import org.kuali.ole.module.purap.util.PurApObjectUtils;
020import org.kuali.ole.sys.businessobject.AccountingLineBase;
021import org.kuali.rice.core.api.util.type.KualiDecimal;
022
023/**
024 * Payment Request Account Business Object.
025 */
026public class PaymentRequestAccount extends PurApAccountingLineBase {
027
028    private KualiDecimal disencumberedAmount = KualiDecimal.ZERO;
029    private KualiDecimal existingAmount;
030    /**
031     * Default constructor.
032     */
033    public PaymentRequestAccount() {
034        this.setAmount(null);
035        this.setAccountLinePercent(null);
036        this.setSequenceNumber(0);
037    }
038
039    /**
040     * Constructor.
041     *
042     * @param item - payment request item
043     * @param poa  - purchase order account
044     */
045    public PaymentRequestAccount(PaymentRequestItem item, PurchaseOrderAccount poa) {
046        this();
047        // copy base attributes
048        PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, poa, this);
049        // copy percent
050        this.setSequenceNumber(poa.getSequenceNumber());
051        this.setAccountLinePercent(poa.getAccountLinePercent());
052        setItemIdentifier(item.getItemIdentifier());
053        setPaymentRequestItem(item);
054    }
055
056    /**
057     * Constructor.
058     *
059     * @param item - payment request item
060     * @param poa  - purchase order account
061     */
062    public PaymentRequestAccount(PaymentRequestItem item, InvoiceAccount poa) {
063        this();
064        // copy base attributes
065        PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, poa, this);
066        // copy percent
067        this.setSequenceNumber(poa.getSequenceNumber());
068        this.setAccountLinePercent(poa.getAccountLinePercent());
069        setItemIdentifier(item.getItemIdentifier());
070        setPaymentRequestItem(item);
071    }
072
073    public KualiDecimal getExistingAmount() {
074        return existingAmount;
075    }
076
077    public void setExistingAmount(KualiDecimal existingAmount) {
078        this.existingAmount = existingAmount;
079    }
080    public KualiDecimal getDisencumberedAmount() {
081        return disencumberedAmount;
082    }
083
084    public void setDisencumberedAmount(KualiDecimal disencumberedAmount) {
085        this.disencumberedAmount = disencumberedAmount;
086    }
087
088    public PaymentRequestItem getPaymentRequestItem() {
089        return super.getPurapItem();
090    }
091
092    public void setPaymentRequestItem(PaymentRequestItem paymentRequestItem) {
093        super.setPurapItem(paymentRequestItem);
094    }
095
096    /**
097     * Caller of this method should take care of creating PaymentRequestItems
098     */
099    public void copyFrom(PaymentRequestAccount other) {
100        super.copyFrom(other);
101        setDisencumberedAmount(other.getDisencumberedAmount());
102    }
103
104}