use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method uncheckCapitalAccountingLinesSelected.
/**
* unchecks the capital accounting lines select when there are no capital assets created yet.
*
* @param calfb
*/
protected void uncheckCapitalAccountingLinesSelected(CapitalAccountingLinesFormBase calfb) {
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
KualiAccountingDocumentFormBase kadfb = calfb;
List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
calfb.setSystemControlAmount(calfb.getSystemControlAmount().add(capitalAccountingLine.getAmount()));
selectedCapitalAccountingLines.add(capitalAccountingLine);
}
}
CapitalAssetInformation existingCapitalAsset = capitalAssetCreated(selectedCapitalAccountingLines, currentCapitalAssetInformation);
for (CapitalAccountingLines capitalAccountingLine : selectedCapitalAccountingLines) {
if (ObjectUtils.isNull(existingCapitalAsset)) {
capitalAccountingLine.setSelectLine(false);
}
}
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method getRemainingAmounToDistribute.
/**
* Calculates the remaining amount to distribute by taking selecte capital accounting lines
* and subtracting the allocated capital asset accounting lines amounts totals.
*
* @param selectedCapitalAccountingLines
* @param form
* @return remainingAmountToDistribute
*/
protected KualiDecimal getRemainingAmounToDistribute(List<CapitalAccountingLines> selectedCapitalAccountingLines, ActionForm form) {
KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
KualiDecimal capitalAccountsAmountToDistribute = KualiDecimal.ZERO;
KualiDecimal capitalAssetsAllocatedAmount = KualiDecimal.ZERO;
CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) calfb.getFinancialDocument();
List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
selectedCapitalAccountingLines.add(capitalAccountingLine);
capitalAccountsAmountToDistribute = capitalAccountsAmountToDistribute.add(capitalAccountingLine.getAmount());
capitalAssetsAllocatedAmount = capitalAssetsAllocatedAmount.add(getCapitalAssetsAmountAllocated(capitalAssets, capitalAccountingLine));
}
}
remainingAmountToDistribute = capitalAccountsAmountToDistribute.subtract(capitalAssetsAllocatedAmount);
return remainingAmountToDistribute;
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method redistributeModifyCapitalAssetAmount.
/**
* redistributes the capital asset amount for the modify capital asset lines.
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws Exception
*/
public ActionForward redistributeModifyCapitalAssetAmount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("redistributeModifyCapitalAssetAmount() - 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.
redistributeAmountsForAccountingsLineForModifyAssets(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
redistributeIndividualAmountsForAccountingLinesForModifyAssets(selectedCapitalAccountingLines, capitalAssetInformation);
// now process any capital assets that has distribution set to "by amount"
redistributeAmountsForAccountingsLineForModifyAssetsByAmounts(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
// adjust any variance from capital accounting lines to the distributed accounting lines amounts....
adjustCapitalAssetsAccountingLinesAmounts(selectedCapitalAccountingLines, capitalAssetInformation);
processRemainingCapitalAssetInfo(form, capitalAssetInformation);
// redistribute capital asset amount to its group accounting lines on refresh
DistributeCapitalAssetAmountToGroupAccountingLines((KualiAccountingDocumentFormBase) form);
checkCapitalAccountingLinesSelected(calfb);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines 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;
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method checkCapitalAccountingLinesSelected.
/**
* sets the capital accounting lines select and amount distributed values to true if
* there are capital asset records for a given capital accounting line. The system control
* amount and system control remaining amounts are calculated here.
*
* @param calfb
*/
protected void checkCapitalAccountingLinesSelected(CapitalAccountingLinesFormBase calfb) {
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
KualiAccountingDocumentFormBase kadfb = calfb;
List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
SpringContext.getBean(CapitalAssetManagementModuleService.class).filterNonCapitalAssets(currentCapitalAssetInformation);
calfb.setCreatedAssetsControlAmount(KualiDecimal.ZERO);
calfb.setSystemControlAmount(KualiDecimal.ZERO);
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine()) {
calfb.setSystemControlAmount(calfb.getSystemControlAmount().add(capitalAccountingLine.getAmount()));
}
if (currentCapitalAssetInformation.size() <= 0) {
capitalAccountingLine.setAccountLinePercent(null);
capitalAccountingLine.setAmountDistributed(false);
capitalAccountingLine.setSelectLine(false);
} else {
CapitalAssetInformation existingCapitalAsset = getCapitalAssetCreated(capitalAccountingLine, currentCapitalAssetInformation);
if (ObjectUtils.isNotNull(existingCapitalAsset)) {
// There is a CapitalAssetInformation matching the current accounting line.
capitalAccountingLine.setSelectLine(true);
} else {
capitalAccountingLine.setAccountLinePercent(null);
capitalAccountingLine.setSelectLine(false);
}
}
if (capitalAccountingLineAmountDistributed(capitalAccountingLine, currentCapitalAssetInformation)) {
// all the money from this accounting line is distributed among the assets
capitalAccountingLine.setAmountDistributed(true);
} else {
capitalAccountingLine.setAmountDistributed(false);
}
}
KualiDecimal capitalAssetsTotal = KualiDecimal.ZERO;
// get amount allocated so far....or the system control remainder amount field.
for (CapitalAssetInformation capitalAsset : currentCapitalAssetInformation) {
capitalAssetsTotal = capitalAssetsTotal.add(capitalAsset.getCapitalAssetLineAmount());
}
calfb.setCreatedAssetsControlAmount(calfb.getSystemControlAmount().subtract(capitalAssetsTotal));
}
Aggregations