Search in sources :

Example 16 with CapitalAccountingLines

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

the class CapitalAssetInformationActionBase method redistributeCreateCapitalAssetAmount.

/**
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return actionForward
 * @throws Exception
 */
public ActionForward redistributeCreateCapitalAssetAmount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("redistributeCreateCapitalAssetAmount() - start");
    KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
    CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
    String distributionCode = calfb.getCapitalAccountingLine().getDistributionCode();
    remainingAmountToDistribute = getRemainingAmounToDistribute(selectedCapitalAccountingLines, form);
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    // run the process to redistribute the accounting line amount to the capital assets.
    redistributeEqualAmountsForAccountingLineForCreateAssets(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
    redistributeIndividualAmountsForAccountingLinesForCreateAssets(selectedCapitalAccountingLines, capitalAssetInformation);
    // adjust any variance from capital accounting lines to the distributed accounting lines amounts....
    adjustCapitalAssetsAccountingLinesAmounts(selectedCapitalAccountingLines, capitalAssetInformation);
    // now perform calculations of adjusting variance when asset amounts are odd
    // ///    adjustVarianceOnCapitalAssets(capitalAssetInformation);
    checkCapitalAccountingLinesSelected(calfb);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 17 with CapitalAccountingLines

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

the class CapitalAssetInformationActionBase method checkSelectForCapitalAccountingLines.

/**
 * checks "select" check box on capital accounting lines if there are
 * corresponding capital asset records.
 *
 * @param calfb
 */
protected void checkSelectForCapitalAccountingLines(CapitalAccountingLinesFormBase calfb) {
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    KualiAccountingDocumentFormBase kadfb = calfb;
    List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (currentCapitalAssetInformation.size() <= 0) {
            capitalAccountingLine.setSelectLine(false);
        } else {
            CapitalAssetInformation existingCapitalAsset = getCapitalAssetCreated(capitalAccountingLine, currentCapitalAssetInformation);
            if (ObjectUtils.isNotNull(existingCapitalAsset)) {
                capitalAccountingLine.setSelectLine(true);
            } else {
                capitalAccountingLine.setSelectLine(false);
            }
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 18 with CapitalAccountingLines

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

the class CapitalAssetInformationActionBase method createNewCapitalAsset.

/**
 * helper method to add accounting details for this new capital asset record
 *
 * @param capitalAccountingLines
 * @param currentCapitalAssetInformation
 * @param documentNumber
 * @param actionType
 * @param nextCapitalAssetLineNumber
 */
protected void createNewCapitalAsset(List<CapitalAccountingLines> capitalAccountingLines, List<CapitalAssetInformation> currentCapitalAssetInformation, String documentNumber, String actionType, Integer nextCapitalAssetLineNumber) {
    CapitalAssetInformation capitalAsset = new CapitalAssetInformation();
    capitalAsset.setCapitalAssetLineAmount(KualiDecimal.ZERO);
    capitalAsset.setDocumentNumber(documentNumber);
    capitalAsset.setCapitalAssetLineNumber(nextCapitalAssetLineNumber);
    capitalAsset.setCapitalAssetActionIndicator(actionType);
    capitalAsset.setCapitalAssetProcessedIndicator(false);
    // now setup the account line information associated with this capital asset
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        capitalAsset.setDistributionAmountCode(capitalAccountingLine.getDistributionAmountCode());
        createCapitalAssetAccountingLinesDetails(capitalAccountingLine, capitalAsset);
    }
    currentCapitalAssetInformation.add(capitalAsset);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines)

Example 19 with CapitalAccountingLines

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

the class CapitalAssetInformationActionBase method calculatePercentsForSelectedCapitalAccountingLines.

/**
 * calculates the percents for the selected capital accounting lines only
 *
 * @param calfb
 */
protected void calculatePercentsForSelectedCapitalAccountingLines(CapitalAccountingLinesFormBase calfb) {
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    KualiDecimal totalCapitalLinesSelectedAmount = (calculateTotalCapitalLinesSelectedAmount(capitalAccountingLines)).abs();
    if (totalCapitalLinesSelectedAmount.isNonZero()) {
        for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
            if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
                capitalAccountingLine.setAccountLinePercent(capitalAccountingLine.getAmount().abs().divide(totalCapitalLinesSelectedAmount).multiply(new KualiDecimal(100), true));
            }
        }
    }
}
Also used : CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)

Example 20 with CapitalAccountingLines

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

the class GlLineServiceImpl method setupMissingCapitalAssetInformation.

/**
 * Setup shell Capital Asset Information where it doesn't already exist (for
 * example for a PRNC that is in Process and has already generated some
 * capital asset information in a previous processing)
 *
 * @param entry
 */
@Override
public void setupMissingCapitalAssetInformation(String documentNumber) {
    List<CapitalAccountingLines> capitalAccountingLines;
    // get all related entries and create capital asset record for each
    Collection<GeneralLedgerEntry> glEntries = findAllGeneralLedgerEntry(documentNumber);
    Collection<CapitalAssetInformation> allCapitalAssetInformation = findAllCapitalAssetInformation(documentNumber);
    int nextCapitalAssetLineNumber = findMaximumCapitalAssetLineNumber(allCapitalAssetInformation) + 1;
    for (GeneralLedgerEntry glEntry : glEntries) {
        // check if it has capital Asset Info
        List<CapitalAssetInformation> entryCapitalAssetInfo = findCapitalAssetInformationForGLLineMatchLineType(glEntry);
        if (entryCapitalAssetInfo.isEmpty()) {
            capitalAccountingLines = new ArrayList<CapitalAccountingLines>();
            createCapitalAccountingLine(capitalAccountingLines, glEntry, null);
            createNewCapitalAsset(capitalAccountingLines, documentNumber, null, nextCapitalAssetLineNumber);
            nextCapitalAssetLineNumber++;
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)

Aggregations

CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)21 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)15 CapitalAccountingLinesDocumentBase (org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)12 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)9 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)9 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 ActionForward (org.apache.struts.action.ActionForward)1 CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)1 CapitalAssetEditable (org.kuali.kfs.fp.document.CapitalAssetEditable)1 CapitalAssetInformationDocumentBase (org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)1 CapitalAssetManagementModuleService (org.kuali.kfs.integration.cam.CapitalAssetManagementModuleService)1 Asset (org.kuali.kfs.integration.cam.businessobject.Asset)1 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 GeneralLedgerEntry (org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)1 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)1 SegmentedLookupResultsService (org.kuali.kfs.sys.service.SegmentedLookupResultsService)1