use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class PaymentSourceExtractionServiceImpl method getListByDocumentStatusCodeCampus.
/**
* This method retrieves a list of disbursement voucher documents that are in the status provided for the campus code given.
*
* @param statusCode The status of the disbursement vouchers to be retrieved.
* @param campusCode The campus code that the disbursement vouchers will be associated with.
* @param immediatesOnly only retrieve Disbursement Vouchers marked for immediate payment
* @return A collection of disbursement voucher objects that meet the search criteria given.
*/
protected Collection<DisbursementVoucherDocument> getListByDocumentStatusCodeCampus(String statusCode, String campusCode, boolean immediatesOnly) {
LOG.info("getListByDocumentStatusCodeCampus(statusCode=" + statusCode + ", campusCode=" + campusCode + ", immediatesOnly=" + immediatesOnly + ") started");
Collection<DisbursementVoucherDocument> list = new ArrayList<DisbursementVoucherDocument>();
try {
Collection<DisbursementVoucherDocument> docs = SpringContext.getBean(FinancialSystemDocumentService.class).findByDocumentHeaderStatusCode(DisbursementVoucherDocument.class, statusCode);
for (DisbursementVoucherDocument element : docs) {
String dvdCampusCode = element.getCampusCode();
if (dvdCampusCode.equals(campusCode) && KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_CHECK.equals(element.getDisbVchrPaymentMethodCode())) {
if ((immediatesOnly && element.isImmediatePaymentIndicator()) || !immediatesOnly) {
list.add(element);
}
}
}
} catch (WorkflowException we) {
LOG.error("Could not load Disbursement Voucher Documents with status code = " + statusCode + ": " + we);
throw new RuntimeException(we);
}
return list;
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method insertSourceLine.
/**
* This action executes an insert of a SourceAccountingLine into a document only after validating the accounting line and
* checking any appropriate business rules.
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws Exception
*/
public ActionForward insertSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;
SourceAccountingLine line = financialDocumentForm.getNewSourceLine();
// populate chartOfAccountsCode from account number if accounts cant cross chart and Javascript is turned off
// SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(line);
boolean rulePassed = true;
// DV acct line amount got error during form populate; should not insert this line. KFSUPGRADE-847
MessageMap msgMap = GlobalVariables.getMessageMap();
if (msgMap.hasErrors() && msgMap.getErrorMessages().keySet().contains("newSourceLine.amount") && financialDocumentForm.getDocument() instanceof DisbursementVoucherDocument) {
rulePassed = false;
}
// before we check the regular rules we need to check the sales tax rules
// TODO: Refactor rules so we no longer have to call this before a copy of the
// accountingLine
rulePassed &= checkSalesTax((AccountingDocument) financialDocumentForm.getDocument(), line, true, true, 0);
// check any business rules
rulePassed &= SpringContext.getBean(KualiRuleService.class).applyRules(new AddAccountingLineEvent(KFSConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME, financialDocumentForm.getDocument(), line));
if (rulePassed) {
// add accountingLine
SpringContext.getBean(PersistenceService.class).refreshAllNonUpdatingReferences(line);
insertAccountingLine(true, financialDocumentForm, line);
// clear the used newTargetLine
financialDocumentForm.setNewSourceLine(null);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherExtractionHelperServiceImpl method getCampusListByDocumentStatusCode.
// KFSPTS-1891 : calling PaymentMethodGeneralLedgerPendingEntryService().isPaymentMethodProcessedUsingPdp
// TODO : this method does not seem to be referenced.
// @Override
protected Set<String> getCampusListByDocumentStatusCode(String statusCode) {
LOG.debug("getCampusListByDocumentStatusCode() started");
Set<String> campusSet = new HashSet<String>();
Collection<DisbursementVoucherDocument> docs = disbursementVoucherDao.getDocumentsByHeaderStatus(statusCode, false);
for (DisbursementVoucherDocument doc : docs) {
if (getPaymentMethodGeneralLedgerPendingEntryService().isPaymentMethodProcessedUsingPdp(doc.getDisbVchrPaymentMethodCode())) {
campusSet.add(doc.getCampusCode());
}
}
return campusSet;
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherAccountingLineTotalsValidation method validate.
@Override
public boolean validate(AttributedDocumentEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("validate start");
}
DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) event.getDocument();
Person financialSystemUser = GlobalVariables.getUserSession().getPerson();
final Set<String> currentEditModes = getEditModesFromDocument(dvDocument, financialSystemUser);
// amounts can only decrease
List<String> candidateEditModes = this.getCandidateEditModes();
if (this.hasRequiredEditMode(currentEditModes, candidateEditModes)) {
// users in foreign or wire workgroup can increase or decrease amounts because of currency conversion
List<String> foreignDraftAndWireTransferEditModes = this.getForeignDraftAndWireTransferEditModes(dvDocument);
if (!this.hasRequiredEditMode(currentEditModes, foreignDraftAndWireTransferEditModes)) {
DisbursementVoucherDocument persistedDocument = (DisbursementVoucherDocument) retrievePersistedDocument(dvDocument);
if (persistedDocument == null) {
handleNonExistentDocumentWhenApproving(dvDocument);
return true;
}
// KFSMI- 5183
if (persistedDocument.getDocumentHeader().getWorkflowDocument().isSaved() && persistedDocument.getDisbVchrCheckTotalAmount().isZero()) {
return true;
}
// check total cannot decrease
if (!persistedDocument.getDocumentHeader().getWorkflowDocument().isCompletionRequested() && (!persistedDocument.getDisbVchrCheckTotalAmount().equals(dvDocument.getDisbVchrCheckTotalAmount()))) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.DISB_VCHR_CHECK_TOTAL_AMOUNT, CUKFSKeyConstants.ERROR_DV_CHECK_TOTAL_NO_CHANGE);
return false;
}
}
return true;
}
// KFSUPGRADE-848 : skip total check here for FO
final WorkflowDocument workflowDocument = dvDocument.getDocumentHeader().getWorkflowDocument();
final Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
if (CollectionUtils.isNotEmpty(currentRouteLevels)) {
if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.ACCOUNT)) {
return true;
}
}
if (dvDocument instanceof RecurringDisbursementVoucherDocument) {
RecurringDisbursementVoucherDocument recurringDV = (RecurringDisbursementVoucherDocument) dvDocument;
if (!doesAccountingLineTotalEqualDVTotalDollarAmount(recurringDV)) {
String propertyName = KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.DISB_VCHR_CHECK_TOTAL_AMOUNT;
GlobalVariables.getMessageMap().putError(propertyName, CUKFSKeyConstants.ERROR_DV_CHECK_TOTAL_MUST_EQUAL_ACCOUNTING_LINE_TOTAL);
return false;
}
if (StringUtils.isEmpty(recurringDV.getDisbVchrCheckStubText()) && !recurringDV.getSourceAccountingLines().isEmpty()) {
String propertyName = KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.DISB_VCHR_CHECK_STUB_TEXT;
GlobalVariables.getMessageMap().putError(propertyName, CUKFSKeyConstants.ERROR_DV_CHECK_STUB_REQUIRED);
return false;
}
if (!isAccountingLineEndDateValid(recurringDV)) {
return false;
}
}
return super.validate(event);
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocumentPreRules method setIncomeClassNonReportableForForeignVendorWithNoTaxReviewRequired.
private void setIncomeClassNonReportableForForeignVendorWithNoTaxReviewRequired(Document document) {
DisbursementVoucherDocument dvDoc = (DisbursementVoucherDocument) document;
DisbursementVoucherPayeeDetail dvPayeeDetail = dvDoc.getDvPayeeDetail();
String payeeTypeCode = dvPayeeDetail.getDisbursementVoucherPayeeTypeCode();
String paymentReasonCode = dvPayeeDetail.getDisbVchrPaymentReasonCode();
Integer vendorHeaderId = dvPayeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger();
if (getCuDisbursementVoucherTaxService().isForeignVendorAndTaxReviewNotRequired(payeeTypeCode, paymentReasonCode, vendorHeaderId)) {
dvDoc.getDvNonResidentAlienTax().setIncomeClassCode(DisbursementVoucherConstants.NRA_TAX_INCOME_CLASS_NON_REPORTABLE);
}
}
Aggregations