Search in sources :

Example 41 with CapitalAssetInformation

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

the class GlLineServiceImpl method updatePreTagInformation.

/**
 * Updates pre tag information received from FP document
 *
 * @param entry GeneralLedgerEntry
 * @param document AssetPaymentDocument
 */
protected void updatePreTagInformation(GeneralLedgerEntry entry, AssetPaymentDocument document, Integer capitalAssetLineNumber) {
    CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(entry.getDocumentNumber(), capitalAssetLineNumber);
    if (ObjectUtils.isNotNull(capitalAssetInformation)) {
        // if it is modify asset...
        if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equals(capitalAssetInformation.getCapitalAssetActionIndicator())) {
            AssetPaymentAssetDetail assetPaymentAssetDetail = new AssetPaymentAssetDetail();
            assetPaymentAssetDetail.setDocumentNumber(document.getDocumentNumber());
            // get the allocated amount for the capital asset....
            assetPaymentAssetDetail.setCapitalAssetNumber(capitalAssetInformation.getCapitalAssetNumber());
            assetPaymentAssetDetail.setAllocatedAmount(KualiDecimal.ZERO);
            assetPaymentAssetDetail.setAllocatedUserValue(assetPaymentAssetDetail.getAllocatedAmount());
            assetPaymentAssetDetail.refreshReferenceObject(CamsPropertyConstants.AssetPaymentAssetDetail.ASSET);
            Asset asset = assetPaymentAssetDetail.getAsset();
            if (ObjectUtils.isNotNull(asset)) {
                assetPaymentAssetDetail.setPreviousTotalCostAmount(asset.getTotalCostAmount() != null ? asset.getTotalCostAmount() : KualiDecimal.ZERO);
                document.getAssetPaymentAssetDetail().add(assetPaymentAssetDetail);
            }
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) AssetPaymentAssetDetail(org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail) GeneralLedgerEntryAsset(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntryAsset) Asset(org.kuali.kfs.module.cam.businessobject.Asset)

Example 42 with CapitalAssetInformation

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

the class GlLineServiceImpl method markCapitalAssetProcessed.

protected void markCapitalAssetProcessed(GeneralLedgerEntry primary, Integer capitalAssetLineNumber) {
    CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(primary.getDocumentNumber(), capitalAssetLineNumber);
    // if it is create asset...
    if (ObjectUtils.isNotNull(capitalAssetInformation)) {
        capitalAssetInformation.setCapitalAssetProcessedIndicator(true);
        businessObjectService.save(capitalAssetInformation);
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation)

Example 43 with CapitalAssetInformation

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

the class GlLineServiceImpl method updatePreTagInformation.

/**
 * This method reads the pre-tag information and creates objects for asset global document
 *
 * @param entry GL Line
 * @param document Asset Global Maintenance Document
 * @param assetGlobal Asset Global Object
 */
protected void updatePreTagInformation(GeneralLedgerEntry entry, MaintenanceDocument document, AssetGlobal assetGlobal, Integer capitalAssetLineNumber) {
    CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(entry.getDocumentNumber(), capitalAssetLineNumber);
    // if it is create asset...
    if (ObjectUtils.isNotNull(capitalAssetInformation)) {
        if (KFSConstants.CapitalAssets.CAPITAL_ASSET_CREATE_ACTION_INDICATOR.equals(capitalAssetInformation.getCapitalAssetActionIndicator())) {
            List<CapitalAssetInformationDetail> capitalAssetInformationDetails = capitalAssetInformation.getCapitalAssetInformationDetails();
            for (CapitalAssetInformationDetail capitalAssetInformationDetail : capitalAssetInformationDetails) {
                // This is not added to constructor in CAMS to provide module isolation from CAMS
                AssetGlobalDetail assetGlobalDetail = new AssetGlobalDetail();
                assetGlobalDetail.setDocumentNumber(document.getDocumentNumber());
                assetGlobalDetail.setCampusCode(capitalAssetInformationDetail.getCampusCode());
                assetGlobalDetail.setBuildingCode(capitalAssetInformationDetail.getBuildingCode());
                assetGlobalDetail.setBuildingRoomNumber(capitalAssetInformationDetail.getBuildingRoomNumber());
                assetGlobalDetail.setBuildingSubRoomNumber(capitalAssetInformationDetail.getBuildingSubRoomNumber());
                assetGlobalDetail.setSerialNumber(capitalAssetInformationDetail.getCapitalAssetSerialNumber());
                assetGlobalDetail.setCapitalAssetNumber(NextAssetNumberFinder.getLongValue());
                assetGlobalDetail.setCampusTagNumber(capitalAssetInformationDetail.getCapitalAssetTagNumber());
                // KFSPTS-3597 add off campus information
                CapitalAssetInformationDetailExtendedAttribute extendedAttribute = (CapitalAssetInformationDetailExtendedAttribute) capitalAssetInformationDetail.getExtension();
                assetGlobalDetail.setOffCampusAddress(extendedAttribute.getAssetLocationStreetAddress());
                assetGlobalDetail.setOffCampusCityName(extendedAttribute.getAssetLocationCityName());
                assetGlobalDetail.setOffCampusCountryCode(extendedAttribute.getAssetLocationCountryCode());
                assetGlobalDetail.setOffCampusStateCode(extendedAttribute.getAssetLocationStateCode());
                assetGlobalDetail.setOffCampusZipCode(extendedAttribute.getAssetLocationZipCode());
                AssetGlobalDetail uniqueAsset = new AssetGlobalDetail();
                ObjectValueUtils.copySimpleProperties(assetGlobalDetail, uniqueAsset);
                assetGlobalDetail.getAssetGlobalUniqueDetails().add(uniqueAsset);
                assetGlobal.getAssetSharedDetails().add(assetGlobalDetail);
            }
            assetGlobal.setVendorName(capitalAssetInformation.getVendorName());
            assetGlobal.setInventoryStatusCode(CamsConstants.InventoryStatusCode.CAPITAL_ASSET_ACTIVE_IDENTIFIABLE);
            assetGlobal.setCapitalAssetTypeCode(capitalAssetInformation.getCapitalAssetTypeCode());
            assetGlobal.setManufacturerName(capitalAssetInformation.getCapitalAssetManufacturerName());
            assetGlobal.setManufacturerModelNumber(capitalAssetInformation.getCapitalAssetManufacturerModelNumber());
            assetGlobal.setCapitalAssetDescription(capitalAssetInformation.getCapitalAssetDescription());
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) AssetGlobalDetail(org.kuali.kfs.module.cam.businessobject.AssetGlobalDetail) CapitalAssetInformationDetailExtendedAttribute(edu.cornell.kfs.fp.businessobject.CapitalAssetInformationDetailExtendedAttribute) CapitalAssetInformationDetail(org.kuali.kfs.fp.businessobject.CapitalAssetInformationDetail)

Example 44 with CapitalAssetInformation

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

the class GlLineServiceImpl method deactivateGLEntries.

protected void deactivateGLEntries(GeneralLedgerEntry entry, Document document, Integer capitalAssetLineNumber) {
    // now deactivate the gl line..
    CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(entry.getDocumentNumber(), capitalAssetLineNumber);
    if (ObjectUtils.isNotNull(capitalAssetInformation)) {
        List<CapitalAssetAccountsGroupDetails> groupAccountingLines = capitalAssetInformation.getCapitalAssetAccountsGroupDetails();
        Collection<GeneralLedgerEntry> documentGlEntries = findAllGeneralLedgerEntry(entry.getDocumentNumber());
        for (CapitalAssetAccountsGroupDetails accountingLine : groupAccountingLines) {
            // find the matching GL entry for this accounting line.
            Collection<GeneralLedgerEntry> glEntries = findMatchingGeneralLedgerEntries(documentGlEntries, accountingLine);
            for (GeneralLedgerEntry glEntry : glEntries) {
                KualiDecimal lineAmount = accountingLine.getAmount();
                // update submitted amount on the gl entry and save the results.
                createGeneralLedgerEntryAsset(glEntry, document, capitalAssetLineNumber);
                updateTransactionSumbitGlEntryAmount(glEntry, lineAmount);
            }
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 45 with CapitalAssetInformation

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

the class CapitalAssetInformationAction method prepareRecordsForDisplay.

protected void prepareRecordsForDisplay(CapitalAssetInformationForm capitalAssetForm, GeneralLedgerEntry entry) {
    GlLineService glLineService = SpringContext.getBean(GlLineService.class);
    entry.setSelected(true);
    capitalAssetForm.setGeneralLedgerEntry(entry);
    capitalAssetForm.setPrimaryGlAccountId(entry.getGeneralLedgerAccountIdentifier());
    List<CapitalAssetInformation> capitalAssetInformations = glLineService.findAllCapitalAssetInformation(entry.getDocumentNumber());
    Collection<GeneralLedgerEntry> glEntries = glLineService.findAllGeneralLedgerEntry(entry.getDocumentNumber());
    if (!capitalAssetInformations.isEmpty() && capitalAssetInformations.size() != glEntries.size()) {
        // we need to generate missing capital asset info
        glLineService.setupMissingCapitalAssetInformation(entry.getDocumentNumber());
    }
    List<CapitalAssetInformation> capitalAssetInformation = glLineService.findCapitalAssetInformationForGLLine(entry);
    // to render and subsequent processing to occur successfully.
    if (capitalAssetInformation.isEmpty()) {
        glLineService.setupCapitalAssetInformation(entry);
        capitalAssetInformation = glLineService.findCapitalAssetInformationForGLLine(entry);
    }
    capitalAssetForm.setCapitalAssetInformation(capitalAssetInformation);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry) GlLineService(org.kuali.kfs.module.cam.document.service.GlLineService)

Aggregations

CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)46 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)18 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)15 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)14 ArrayList (java.util.ArrayList)12 CapitalAccountingLinesDocumentBase (org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)11 CapitalAssetInformationDocumentBase (org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)6 HashMap (java.util.HashMap)4 CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)4 GeneralLedgerEntry (org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)4 CapitalAssetEditable (org.kuali.kfs.fp.document.CapitalAssetEditable)3 NonTransactional (org.kuali.kfs.sys.service.NonTransactional)3 CapitalAssetInformationDetailExtendedAttribute (edu.cornell.kfs.fp.businessobject.CapitalAssetInformationDetailExtendedAttribute)2 List (java.util.List)2 CapitalAssetInformationDetail (org.kuali.kfs.fp.businessobject.CapitalAssetInformationDetail)2 AssetPaymentAssetDetail (org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail)2 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)2 ProcurementCardTransactionExtendedAttribute (edu.cornell.kfs.fp.businessobject.ProcurementCardTransactionExtendedAttribute)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1