use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method clearCapitalAssetModify.
/**
* clear up the modify capital asset information. The amount field is reset to 0
* Processes any remaining capital assets so that it recalculates the system control
* and system control remaining amounts.
*
* @param mapping
* @param form
* @param request
* @param response
* @return action forward string
* @throws Exception
*/
public ActionForward clearCapitalAssetModify(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("clearCapitalAssetModify() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int clearIndex = getSelectedLine(request);
capitalAssetInformation.get(clearIndex).setCapitalAssetLineAmount(KualiDecimal.ZERO);
// zero out the amount distribute on the accounting lines...
for (CapitalAssetAccountsGroupDetails groupAccountLine : capitalAssetInformation.get(clearIndex).getCapitalAssetAccountsGroupDetails()) {
groupAccountLine.setAmount(KualiDecimal.ZERO);
}
// 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 clearCapitalAssetInfo.
/**
* Clear the capital asset information that the user has entered
*
* @param mapping
* @param form
* @param request
* @param response
* @return action forward string
* @throws Exception
*/
public ActionForward clearCapitalAssetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("clearCapitalAssetInfo() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int clearIndex = getSelectedLine(request);
this.resetCapitalAssetInfo(capitalAssetInformation.get(clearIndex));
// 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 copy.
/**
* Overridden to guarantee that form of copied document is set to whatever the entry mode of the document is
*
* @see org.kuali.rice.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
;
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
List<CapitalAccountingLines> copiedCapitalAccountingLines = new ArrayList<>();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
copiedCapitalAccountingLines.add(capitalAccountingLine);
}
capitalAccountingLines.clear();
ActionForward forward = super.copy(mapping, form, request, response);
caldb.setCapitalAccountingLines(copiedCapitalAccountingLines);
// if the copied document has capital asset collection, remove the collection
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
AccountingDocument document = kualiAccountingDocumentFormBase.getFinancialDocument();
if (document instanceof CapitalAssetEditable) {
CapitalAssetEditable capitalAssetEditable = (CapitalAssetEditable) document;
List<CapitalAssetInformation> capitalAssets = capitalAssetEditable.getCapitalAssetInformation();
for (CapitalAssetInformation capitalAsset : capitalAssets) {
Long capitalAssetNumber = capitalAsset.getCapitalAssetNumber();
resetCapitalAssetInfo(capitalAsset);
// because resetCapitalAssetInfo cleared the value.
if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equalsIgnoreCase(capitalAsset.getCapitalAssetActionIndicator())) {
capitalAsset.setCapitalAssetNumber(capitalAssetNumber);
}
capitalAsset.setCapitalAssetProcessedIndicator(false);
}
}
// setup the initial next sequence number column..
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
setupIntialNextCapitalAssetLineNumber(kualiDocumentFormBase);
checkCapitalAccountingLinesSelected(capitalAccountingLinesFormBase);
return forward;
}
use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method addCapitalAssetTagLocationInfo.
/**
* inserts capital asset information into capital assets list.
* Also recalculates the system control and system control remaining amounts.
* Puts a global error message if the user does not enter capital asset quantity.
* If the quantity is > 1, it will insert that many tag/location detail records for this
* capital asset item.
*
* @param mapping
* @param form
* @param request
* @param response
* @return action forward string
* @throws Exception
*/
public ActionForward addCapitalAssetTagLocationInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("addCapitalAssetTagLocationInfo() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int addIndex = getSelectedLine(request);
if (capitalAssetInformation.get(addIndex).getCapitalAssetQuantity() == null || capitalAssetInformation.get(addIndex).getCapitalAssetQuantity() <= 0) {
GlobalVariables.getMessageMap().putError(KFSConstants.EDIT_CAPITAL_ASSET_INFORMATION_ERRORS, KFSKeyConstants.ERROR_DOCUMENT_CAPITAL_ASSET_QUANTITY_REQUIRED);
} else {
this.addCapitalAssetInfoDetailLines(capitalAssetInformation.get(addIndex));
}
// 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 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);
}
}
}
Aggregations