/*
 * Copyright 2010 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kfs.module.endow.document;

import org.kuali.kfs.sys.document.AmountTotaling;
import org.kuali.kfs.sys.document.Correctable;
import org.kuali.rice.kns.util.KualiDecimal;

public class CashIncreaseDocument extends EndowmentSecurityDetailsDocumentBase implements Correctable, AmountTotaling {

    public CashIncreaseDocument() {
        super();
        setTransactionSourceTypeCode("M");
    }
    
    @Override
    public void prepareForSave() 
    {
        super.prepareForSave();
    }
    
    /**
     * @see org.kuali.kfs.module.endow.document.IncomePrincipalAmountTotaling#getTotalIncomeAmount()
     */
    public KualiDecimal getTotalIncomeAmount() {

        return this.getTargetIncomeTotal();
    }

    /**
     * @see org.kuali.kfs.module.endow.document.IncomePrincipalAmountTotaling#getTotalPrincipalAmount()
     */
    public KualiDecimal getTotalPrincipalAmount() {

        return this.getTargetPrincipalTotal();
    }

    /**
     * @see org.kuali.kfs.sys.document.AmountTotaling#getTotalDollarAmount()
     */
    public KualiDecimal getTotalDollarAmount() {
        KualiDecimal totalAmount = KualiDecimal.ZERO;

        // totalAmount = TotalIncomeAmount + TotalPrincipalAmount
        totalAmount = totalAmount.add(getTotalIncomeUnits());
        totalAmount = totalAmount.add(getTotalPrincipalUnits());

        return totalAmount;
    }

    /**
     * @see org.kuali.kfs.module.endow.document.IncomePrincipalUnitsTotaling#getTotalIncomeUnits()
     */
    public KualiDecimal getTotalIncomeUnits() {

        return this.getTargetIncomeTotalUnits();
    }

    /**
     * @see org.kuali.kfs.module.endow.document.IncomePrincipalUnitsTotaling#getTotalPrincipalUnits()
     */
    public KualiDecimal getTotalPrincipalUnits() {

        return this.getTargetPrincipalTotalUnits();
    }

    /**
     * @see org.kuali.kfs.module.endow.document.UnitsTotaling#getTotalUnits()
     */
    public KualiDecimal getTotalUnits() {
        KualiDecimal totalUnits = new KualiDecimal();
        // totalUnits = TotalIncomeUnits + TotalPrincipalUnits
        totalUnits = totalUnits.add(getTotalIncomeUnits());
        totalUnits = totalUnits.add(getTotalPrincipalUnits());

        return totalUnits;
    }

}

@@ -1041,31 +1041,72 @@
 Code(%22M%22);%0D%0A
+        setTransactionSubTypeCode(%22C%22);%0D%0A
     %7D%0D%0A
-
     %0D%0A    @O
@@ -1198,1800 +1198,12 @@
    %7D
-%0D%0A    %0D%0A    /**%0D%0A     * @see org.kuali.kfs.module.endow.document.IncomePrincipalAmountTotaling#getTotalIncomeAmount()%0D%0A     */%0D%0A    public KualiDecimal getTotalIncomeAmount() %7B%0D%0A%0D%0A        return this.getTargetIncomeTotal();%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @see org.kuali.kfs.module.endow.document.IncomePrincipalAmountTotaling#getTotalPrincipalAmount()%0D%0A     */%0D%0A    public KualiDecimal getTotalPrincipalAmount() %7B%0D%0A%0D%0A        return this.getTargetPrincipalTotal();%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @see org.kuali.kfs.sys.document.AmountTotaling#getTotalDollarAmount()%0D%0A     */%0D%0A    public KualiDecimal getTotalDollarAmount() %7B%0D%0A        KualiDecimal totalAmount = KualiDecimal.ZERO;%0D%0A%0D%0A        // totalAmount = TotalIncomeAmount + TotalPrincipalAmount%0D%0A        totalAmount = totalAmount.add(getTotalIncomeUnits());%0D%0A        totalAmount = totalAmount.add(getTotalPrincipalUnits());%0D%0A%0D%0A        return totalAmount;%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @see org.kuali.kfs.module.endow.document.IncomePrincipalUnitsTotaling#getTotalIncomeUnits()%0D%0A     */%0D%0A    public KualiDecimal getTotalIncomeUnits() %7B%0D%0A%0D%0A        return this.getTargetIncomeTotalUnits();%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @see org.kuali.kfs.module.endow.document.IncomePrincipalUnitsTotaling#getTotalPrincipalUnits()%0D%0A     */%0D%0A    public KualiDecimal getTotalPrincipalUnits() %7B%0D%0A%0D%0A        return this.getTargetPrincipalTotalUnits();%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @see org.kuali.kfs.module.endow.document.UnitsTotaling#getTotalUnits()%0D%0A     */%0D%0A    public KualiDecimal getTotalUnits() %7B%0D%0A        KualiDecimal totalUnits = new KualiDecimal();%0D%0A        // totalUnits = TotalIncomeUnits + TotalPrincipalUnits%0D%0A        totalUnits = totalUnits.add(getTotalIncomeUnits());%0D%0A        totalUnits = totalUnits.add(getTotalPrincipalUnits());%0D%0A%0D%0A        return totalUnits;%0D%0A    %7D
+    
 %0D%0A%0D%0A

clean up the code