use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method processRemainingCapitalAssetInfo.
/**
* process any remaining capital asset info in the list to check and calculate the
* remaining distributed amount. Also checks to make sure if "select Lines" is to be
* checked on/off
*
* @param form
* @param capitalAssetInformation
*/
protected void processRemainingCapitalAssetInfo(ActionForm form, List<CapitalAssetInformation> capitalAssetInformation) {
CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
// recalculate the amount remaining to be distributed and save the value on the form
calculateRemainingDistributedAmount(calfb, capitalAssetInformation);
// set the amountDistributed property to true if the total amount of all the capital assets
// for a given capital accounting line is greater or equal to the line amount.
checkCapitalAccountingLinesSelected(calfb);
// redistribute each capital asset amount to its group accounting lines...
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
DistributeCapitalAssetAmountToGroupAccountingLines(kualiAccountingDocumentFormBase);
setTabStatesForCapitalAssets(form);
}
use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase 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.sys.web.struts.KualiAccountingDocumentFormBase 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.sys.web.struts.KualiAccountingDocumentFormBase 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.sys.web.struts.KualiAccountingDocumentFormBase 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