Search in sources :

Example 6 with GeneralLedgerEntry

use of org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry 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 7 with GeneralLedgerEntry

use of org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationAction method process.

/**
 * Action "process" from CAB GL Lookup screen is processed by this method
 *
 * @param mapping {@link ActionMapping}
 * @param form {@link ActionForm}
 * @param request {@link HttpServletRequest}
 * @param response {@link HttpServletResponse}
 * @return {@link ActionForward}
 * @throws Exception
 */
public ActionForward process(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    CapitalAssetInformationForm capitalAssetForm = (CapitalAssetInformationForm) form;
    String glAcctId = request.getParameter(CamsPropertyConstants.GeneralLedgerEntry.GENERAL_LEDGER_ACCOUNT_IDENTIFIER);
    Long cabGlEntryId = Long.valueOf(glAcctId);
    capitalAssetForm.setGeneralLedgerAccountIdentifier(cabGlEntryId);
    GeneralLedgerEntry entry = findGeneralLedgerEntry(request);
    if (ObjectUtils.isNotNull(entry)) {
        prepareRecordsForDisplay(capitalAssetForm, entry);
    }
    // }
    return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
Also used : GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)

Example 8 with GeneralLedgerEntry

use of org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry 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)

Example 9 with GeneralLedgerEntry

use of org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationAction method findGeneralLedgerEntry.

/**
 * Retrieves the CAB General Ledger Entry from DB
 *
 * @param generalLedgerEntryId Entry Id
 * @return GeneralLedgerEntry
 */
protected GeneralLedgerEntry findGeneralLedgerEntry(Long generalLedgerEntryId, boolean requireNew) {
    BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
    Map<String, Object> pkeys = new HashMap<String, Object>();
    pkeys.put(CamsPropertyConstants.GeneralLedgerEntry.GENERAL_LEDGER_ACCOUNT_IDENTIFIER, generalLedgerEntryId);
    if (requireNew) {
        pkeys.put(CamsPropertyConstants.GeneralLedgerEntry.ACTIVITY_STATUS_CODE, CamsConstants.ActivityStatusCode.NEW);
    }
    GeneralLedgerEntry entry = boService.findByPrimaryKey(GeneralLedgerEntry.class, pkeys);
    return entry;
}
Also used : HashMap(java.util.HashMap) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

GeneralLedgerEntry (org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)9 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)4 HashMap (java.util.HashMap)2 CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)2 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)1 Entry (org.kuali.kfs.gl.businessobject.Entry)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 AssetPaymentDetail (org.kuali.kfs.module.cam.businessobject.AssetPaymentDetail)1 GlAccountLineGroup (org.kuali.kfs.module.cam.businessobject.GlAccountLineGroup)1 PurchasingAccountsPayableDocument (org.kuali.kfs.module.cam.businessobject.PurchasingAccountsPayableDocument)1 PurchasingAccountsPayableItemAsset (org.kuali.kfs.module.cam.businessobject.PurchasingAccountsPayableItemAsset)1 PurchasingAccountsPayableLineAssetAccount (org.kuali.kfs.module.cam.businessobject.PurchasingAccountsPayableLineAssetAccount)1 GlLineService (org.kuali.kfs.module.cam.document.service.GlLineService)1 PurApAccountingLineBase (org.kuali.kfs.module.purap.businessobject.PurApAccountingLineBase)1 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)1 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)1