use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method deleteCapitalAssetInfoDetailLine.
/**
* delete a detail line from the capital asset information
*/
public ActionForward deleteCapitalAssetInfoDetailLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("deleteCapitalAssetInfoDetailLine() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int lineIndexForCapitalAssetInfo = this.getLineToDelete(request);
capitalAssetInformation.get(0).getCapitalAssetInformationDetails().remove(lineIndexForCapitalAssetInfo - 1);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method deleteCapitalAssetModify.
/**
* deletes the capital asset information
*/
public ActionForward deleteCapitalAssetModify(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("deleteCapitalAssetModify() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int lineIndexForCapitalAssetInfo = this.getLineToDelete(request);
capitalAssetInformation.remove(lineIndexForCapitalAssetInfo);
// now process the remaining capital asset records
processRemainingCapitalAssetInfo(form, capitalAssetInformation);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method setupIntialNextCapitalAssetLineNumber.
/**
* setups the next capital asset line number
*
* @param kualiDocumentFormBase
*/
protected void setupIntialNextCapitalAssetLineNumber(KualiDocumentFormBase kualiDocumentFormBase) {
KualiAccountingDocumentFormBase kadfb = (KualiAccountingDocumentFormBase) kualiDocumentFormBase;
CapitalAssetInformationDocumentBase caidb = (CapitalAssetInformationDocumentBase) kadfb.getFinancialDocument();
List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
for (CapitalAssetInformation capitalAsset : currentCapitalAssetInformation) {
if (capitalAsset.getCapitalAssetLineNumber() > caidb.getNextCapitalAssetLineNumber()) {
caidb.setNextCapitalAssetLineNumber(capitalAsset.getCapitalAssetLineNumber());
}
}
caidb.setNextCapitalAssetLineNumber(caidb.getNextCapitalAssetLineNumber() + 1);
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation 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));
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method redistributeCostEquallyForModifiedAssets.
/**
* @param form
*/
protected void redistributeCostEquallyForModifiedAssets(ActionForm form) {
KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
String distributionCode = calfb.getCapitalAccountingLine().getDistributionCode();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<>();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
selectedCapitalAccountingLines.add(capitalAccountingLine);
remainingAmountToDistribute = remainingAmountToDistribute.add(capitalAccountingLine.getAmount());
}
}
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
redistributeAmountsForAccountingsLineForModifyAssets(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
// now process any capital assets that has distribution set to "by amount"
redistributeAmountsForAccountingsLineForModifyAssetsByAmounts(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
}
Aggregations