Search in sources :

Example 6 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method createCapitalAssetAccountingLinesDetails.

/**
 * @param capitalAccountingLine
 * @param capitalAsset
 */
protected void createCapitalAssetAccountingLinesDetails(CapitalAccountingLines capitalAccountingLine, CapitalAssetInformation capitalAsset) {
    // now setup the account line information associated with this capital asset
    CapitalAssetAccountsGroupDetails capitalAssetAccountLine = new CapitalAssetAccountsGroupDetails();
    capitalAssetAccountLine.setDocumentNumber(capitalAsset.getDocumentNumber());
    capitalAssetAccountLine.setChartOfAccountsCode(capitalAccountingLine.getChartOfAccountsCode());
    capitalAssetAccountLine.setAccountNumber(capitalAccountingLine.getAccountNumber());
    capitalAssetAccountLine.setSubAccountNumber(capitalAccountingLine.getSubAccountNumber());
    capitalAssetAccountLine.setFinancialDocumentLineTypeCode(KFSConstants.SOURCE.equals(capitalAccountingLine.getLineType()) ? KFSConstants.SOURCE_ACCT_LINE_TYPE_CODE : KFSConstants.TARGET_ACCT_LINE_TYPE_CODE);
    capitalAssetAccountLine.setCapitalAssetAccountLineNumber(getNextAccountingLineNumber(capitalAccountingLine, capitalAsset));
    capitalAssetAccountLine.setCapitalAssetLineNumber(capitalAsset.getCapitalAssetLineNumber());
    capitalAssetAccountLine.setFinancialObjectCode(capitalAccountingLine.getFinancialObjectCode());
    capitalAssetAccountLine.setFinancialSubObjectCode(capitalAccountingLine.getFinancialSubObjectCode());
    capitalAssetAccountLine.setProjectCode(capitalAccountingLine.getProjectCode());
    capitalAssetAccountLine.setOrganizationReferenceId(capitalAccountingLine.getOrganizationReferenceId());
    capitalAssetAccountLine.setSequenceNumber(capitalAccountingLine.getSequenceNumber());
    capitalAssetAccountLine.setAmount(KualiDecimal.ZERO);
    capitalAsset.getCapitalAssetAccountsGroupDetails().add(capitalAssetAccountLine);
}
Also used : CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 7 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method resetCapitalAssetInfo.

/**
 * reset the nonkey fields of the given capital asset information
 * removes the corresponding capital asset information detail record from the list.
 *
 * @param capitalAssetInformation the given capital asset information
 */
protected void resetCapitalAssetInfo(CapitalAssetInformation capitalAssetInformation) {
    if (capitalAssetInformation != null) {
        capitalAssetInformation.setCapitalAssetDescription(null);
        capitalAssetInformation.setCapitalAssetManufacturerModelNumber(null);
        capitalAssetInformation.setCapitalAssetManufacturerName(null);
        capitalAssetInformation.setCapitalAssetNumber(null);
        capitalAssetInformation.setCapitalAssetTypeCode(null);
        capitalAssetInformation.setCapitalAssetQuantity(null);
        capitalAssetInformation.setVendorDetailAssignedIdentifier(null);
        capitalAssetInformation.setVendorHeaderGeneratedIdentifier(null);
        // Set the BO to null cause it won't be updated automatically when vendorDetailAssetIdentifier and
        // VendorHeanderGeneratedIndentifier set to null.
        capitalAssetInformation.setVendorDetail(null);
        capitalAssetInformation.setVendorName(null);
        capitalAssetInformation.setCapitalAssetLineAmount(KualiDecimal.ZERO);
        capitalAssetInformation.getCapitalAssetInformationDetails().clear();
        // zero out the amount distribute on the accounting lines...
        for (CapitalAssetAccountsGroupDetails groupAccountLine : capitalAssetInformation.getCapitalAssetAccountsGroupDetails()) {
            groupAccountLine.setAmount(KualiDecimal.ZERO);
        }
    }
}
Also used : CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 8 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method capitalAssetExists.

/**
 * checks if the selected capital accounting lines have a capital asset created by checking the
 * accounts associated with the capital asset information.
 *
 * @param capitalAccountingLines
 * @param capitalAsset
 * @return true if capital accounting line has a capital asset else return false.
 */
protected boolean capitalAssetExists(List<CapitalAccountingLines> capitalAccountingLines, CapitalAssetInformation capitalAsset, String actionTypeCode) {
    boolean exists = true;
    List<CapitalAssetAccountsGroupDetails> groupAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
    for (CapitalAccountingLines capitalAccountLine : capitalAccountingLines) {
        for (CapitalAssetAccountsGroupDetails groupAccountLine : groupAccountLines) {
            if (groupAccountLine.getCapitalAssetLineNumber().compareTo(capitalAsset.getCapitalAssetLineNumber()) == 0 && groupAccountLine.getSequenceNumber().compareTo(capitalAccountLine.getSequenceNumber()) == 0 && groupAccountLine.getFinancialDocumentLineTypeCode().equals(KFSConstants.SOURCE.equals(capitalAccountLine.getLineType()) ? KFSConstants.SOURCE_ACCT_LINE_TYPE_CODE : KFSConstants.TARGET_ACCT_LINE_TYPE_CODE) && groupAccountLine.getChartOfAccountsCode().equals(capitalAccountLine.getChartOfAccountsCode()) && groupAccountLine.getAccountNumber().equals(capitalAccountLine.getAccountNumber()) && groupAccountLine.getFinancialObjectCode().equals(capitalAccountLine.getFinancialObjectCode())) {
                return exists;
            }
        }
    }
    return false;
}
Also used : CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 9 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method getAccountingLinesTotalAmount.

/**
 * gets the total of all accounting lines from that capital asset.
 *
 * @param capitalAssetInformation
 * @return accountingLinesTotalAmount
 */
protected KualiDecimal getAccountingLinesTotalAmount(CapitalAssetInformation capitalAssetInformation) {
    KualiDecimal accountingLinesTotalAmount = KualiDecimal.ZERO;
    List<CapitalAssetAccountsGroupDetails> groupAccountLines = capitalAssetInformation.getCapitalAssetAccountsGroupDetails();
    for (CapitalAssetAccountsGroupDetails groupAccountLine : groupAccountLines) {
        accountingLinesTotalAmount = accountingLinesTotalAmount.add(groupAccountLine.getAmount());
    }
    return accountingLinesTotalAmount;
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 10 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method getNextAccountingLineNumber.

/**
 * calculates the next accounting line number for accounts details for each capital asset.
 * Goes through the current records and gets the last accounting line number.
 *
 * @param capitalAsset
 * @return nextAccountingLineNumber
 */
protected Integer getNextAccountingLineNumber(CapitalAccountingLines capitalAccountingLine, CapitalAssetInformation capitalAsset) {
    Integer nextAccountingLineNumber = 0;
    List<CapitalAssetAccountsGroupDetails> capitalAssetAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
    for (CapitalAssetAccountsGroupDetails capitalAssetAccountLine : capitalAssetAccountLines) {
        nextAccountingLineNumber = capitalAssetAccountLine.getCapitalAssetAccountLineNumber();
    }
    return ++nextAccountingLineNumber;
}
Also used : CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Aggregations

CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)18 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)8 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)4 BigDecimal (java.math.BigDecimal)2 GeneralLedgerEntry (org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)2 ArrayList (java.util.ArrayList)1 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)1 AssetPaymentDetail (org.kuali.kfs.module.cam.businessobject.AssetPaymentDetail)1 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)1