use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.
the class CheckReconciliationMaintainableImpl method doRouteStatusChange.
/**
* @see org.kuali.kfs.kns.maintenance.KualiMaintainableImpl#doRouteStatusChange(org.kuali.kfs.kns.bo.DocumentHeader)
*/
public void doRouteStatusChange(DocumentHeader documentHeader) {
WorkflowDocument workflowDocument = documentHeader.getWorkflowDocument();
if (workflowDocument.isProcessed() && !KFSConstants.MAINTENANCE_NEW_ACTION.equalsIgnoreCase(getMaintenanceAction())) {
DocumentService documentService = SpringContext.getBean(DocumentService.class);
MaintenanceDocument document;
try {
document = (MaintenanceDocument) documentService.getByDocumentHeaderId(documentHeader.getDocumentNumber());
CheckReconciliation oldCr = (CheckReconciliation) document.getOldMaintainableObject().getBusinessObject();
CheckReconciliation newCr = (CheckReconciliation) document.getNewMaintainableObject().getBusinessObject();
if (ObjectUtils.isNotNull(oldCr) && !oldCr.getStatus().equalsIgnoreCase(newCr.getStatus())) {
Date currentDate = SpringContext.getBean(DateTimeService.class).getCurrentSqlDate();
newCr.setStatusChangeDate(currentDate);
// KFSUPGRADE-377
if (CRConstants.CANCELLED.equalsIgnoreCase(newCr.getStatus())) {
newCr.setCancelDocHdrId(documentHeader.getDocumentNumber());
}
}
} catch (WorkflowException e) {
throw new RuntimeCacheException(e);
}
}
}
use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.
the class CheckReconciliationRule method processCustomRouteDocumentBusinessRules.
/**
* @see org.kuali.core.maintenance.rules.MaintenanceDocumentRuleBase#processCustomRouteDocumentBusinessRules(org.kuali.core.document.MaintenanceDocument)
*/
protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) {
LOG.info("processCustomRouteDocumentBusinessRules called");
setupConvenienceObjects();
boolean valid = true;
if (newCheckReconciliation.getAmount() == null) {
putFieldError("amount", CRKeyConstants.ERROR_CR_INVALID_AMOUNT);
valid = false;
} else if (newCheckReconciliation.getAmount().isZero()) {
if (oldCheckReconciliation != null && CRConstants.EXCP.equalsIgnoreCase(oldCheckReconciliation.getStatus()) && CRConstants.VOIDED.equalsIgnoreCase(newCheckReconciliation.getStatus())) {
valid = true;
} else {
putFieldError("amount", CRKeyConstants.ERROR_CR_INVALID_AMOUNT);
valid = false;
}
} else if (newCheckReconciliation.getAmount().isNegative()) {
putFieldError("amount", CRKeyConstants.ERROR_CR_INVALID_AMOUNT);
valid = false;
}
BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
Map<String, Object> fieldValues = new HashMap<String, Object>();
fieldValues.put("checkNumber", newCheckReconciliation.getCheckNumber());
fieldValues.put("bankAccountNumber", newCheckReconciliation.getBankAccountNumber());
Collection<CheckReconciliation> checks = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
boolean isEdit = document.isEdit();
if (checks.size() > 0 && !isEdit) {
valid = false;
putFieldError("checkNumber", "error.checkexists");
}
return valid;
}
use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.
the class CheckReconciliationImportStep method setCheckReconciliationAttributes.
/**
* Set CheckReconciliation Attributes
*
* @param hash
* @return
* @throws ParseException
*/
private CheckReconciliation setCheckReconciliationAttributes(Map<Integer, String> hash) throws ParseException {
String checkNumber = null;
Date checkDate = null;
KualiDecimal amount = null;
String accountNumber = null;
String status = null;
Date issueDate = null;
String payeeName = "";
String payeeID = "";
// Cornell Columns
Integer payeeNameCol = Integer.parseInt("12");
Integer issueDateCol = Integer.parseInt("7");
Integer payeeIDCol = Integer.parseInt("6");
checkNumber = hash.get(checkNumCol);
String rawCheckDate = hash.get(checkDateCol);
if (rawCheckDate == null || rawCheckDate.equals("") || rawCheckDate.equals("000000"))
rawCheckDate = "991231";
checkDate = getGregorianCalendar(rawCheckDate).getTime();
// checkDate = dateformat.parse(rawCheckDate); //Date Paid
amount = isAmountDecimalValue ? new KualiDecimal(addDecimalPoint(hash.get(amountCol))) : new KualiDecimal(hash.get(amountCol));
if (accountNumCol > 0)
accountNumber = isAccountNumHeaderValue ? getHeaderValue(accountNumCol) : hash.get(accountNumCol);
else
accountNumber = getParameterService().getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.ACCOUNT_NUM);
status = hash.get(statusCol);
String issueDateRawValue = hash.get(issueDateCol);
payeeName = hash.get(payeeNameCol);
payeeID = hash.get(payeeIDCol);
if (issueDateRawValue == null || issueDateRawValue.equals("") || issueDateRawValue.equals("000000"))
issueDateRawValue = "991231";
// issueDate = dateformat.parse(issueDateRawValue);
issueDate = getGregorianCalendar(issueDateRawValue).getTime();
CheckReconciliation cr = new CheckReconciliation();
cr.setAmount(amount);
cr.setCheckDate(new java.sql.Date(issueDate.getTime()));
cr.setCheckNumber(new KualiInteger(checkNumber));
cr.setBankAccountNumber(accountNumber);
cr.setStatus(status);
cr.setStatusChangeDate(new java.sql.Date(checkDate.getTime()));
cr.setGlTransIndicator(false);
cr.setPayeeName(payeeName);
cr.setPayeeId(payeeID);
return cr;
}
use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.
the class CheckReconciliationImportStep method parseTextFile.
/**
* Parse File
*
* @param checkFile Check File Path
* @throws Exception
*/
private void parseTextFile(String checkFile, List<CheckReconError> records) throws Exception {
LOG.info("Parsing File : " + checkFile);
File file = new File(checkFile);
BufferedReader br = new BufferedReader(new FileReader(file));
String line = null;
int totalLinesProcessed = 0;
Timestamp ts = new Timestamp(new java.util.Date().getTime());
Collection<Bank> banks = businessObjectService.findAll(Bank.class);
while ((line = br.readLine()) != null) {
if (header && totalLinesProcessed == 0) {
headerLine = line;
headerMap = parseHeaderLine();
totalLinesProcessed++;
} else if (footer && !br.ready()) {
footerLine = line;
footerMap = parseFooterLine();
totalLinesProcessed++;
} else {
CheckReconciliation cr = null;
if (CRConstants.DELIMITED.equals(fileType)) {
cr = parseDelimitedLine(line);
} else if (CRConstants.FIXED.equals(fileType)) {
cr = parseFixedLine(line);
}
// Find existing check record
CheckReconciliation existingRecord = getCheckReconciliation(cr.getCheckNumber(), cr.getBankAccountNumber());
if (existingRecord == null) {
// Update update ts
cr.setLastUpdate(ts);
// Set Status to Exception
cr.setStatus(CRConstants.EXCP);
// Set GL Trans False
cr.setGlTransIndicator(Boolean.FALSE);
String notFoundSrc = getParameterService().getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.SRC_NOT_FOUND);
String notFoundBankCd = getParameterService().getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.BNK_CD_NOT_FOUND);
cr.setSourceCode(notFoundSrc);
cr.setBankCode(notFoundBankCd);
businessObjectService.save(cr);
records.add(getCheckReconError(cr, "The bank record does not exist in reconciliation table. " + cr.getCheckNumber()));
LOG.error("Check Record Not Found");
} else {
if (CRConstants.PDP_SRC.equals(existingRecord.getSourceCode())) {
// update pdp records if checkstatus id cleared
String checkStatus = updateCheckStatus(cr, banks, records);
// update CheckRecon record if checkstatus is cleared
if (checkStatus.equals(CRConstants.CLEARED)) {
// ==== CU Customization: Only update when previous check status is Issued. ====
if (CRConstants.ISSUED.equals(existingRecord.getStatus())) {
cr.setStatus(checkStatus);
existingRecord.setStatus(checkStatus);
existingRecord.setStatusChangeDate(cr.getStatusChangeDate());
existingRecord.setLastUpdate(ts);
businessObjectService.save(existingRecord);
LOG.info("Updated Check Recon Record : " + existingRecord.getId());
} else {
LOG.warn("Could not update PDP-sourced Check Recon Record status to " + CRConstants.CLEARED + " because the existing status is " + existingRecord.getStatus() + " for this PDP-sourced record : " + existingRecord.getId());
}
} else if (checkStatus.equals(CRConstants.STOP)) {
if (!existingRecord.getStatus().equalsIgnoreCase(CRConstants.STOP)) {
records.add(getCheckReconError(cr, "Bank file status shows STOP and Check Recon table status is not STOP"));
LOG.error("Bank file status is STOP and Check Recon table status is not STOP for check " + cr.getCheckNumber());
}
} else if (checkStatus.equals(CRConstants.VOIDED)) {
if (!existingRecord.getStatus().equalsIgnoreCase(CRConstants.VOIDED)) {
records.add(getCheckReconError(cr, "Bank file status is VOIDED and Check Recon table status is not VOIDED"));
LOG.error("Bank file status is VOIDED and Check Recon table status is not VOID for check " + cr.getCheckNumber());
}
}
} else {
String checkStatus = getCheckStatus(cr);
if (checkStatus.equals(CRConstants.CLEARED)) {
// ==== CU Customization: Only update when previous check status is Issued. ====
if (CRConstants.ISSUED.equals(existingRecord.getStatus())) {
cr.setStatus(checkStatus);
existingRecord.setStatus(checkStatus);
existingRecord.setStatusChangeDate(cr.getStatusChangeDate());
existingRecord.setLastUpdate(ts);
businessObjectService.save(existingRecord);
LOG.info("Updated Check Recon Record : " + existingRecord.getId());
} else {
LOG.warn("Could not update Check Recon Record status to " + CRConstants.CLEARED + " because the current status is " + existingRecord.getStatus() + " for this record : " + existingRecord.getId());
}
} else if (checkStatus.equals(CRConstants.STOP)) {
if (!existingRecord.getStatus().equalsIgnoreCase(CRConstants.STOP)) {
records.add(getCheckReconError(cr, "Bank file status is STOP and Check Recon table status is not STOP"));
LOG.error("Bank file status is STOP and Check Recon table status is not STOP for check " + cr.getCheckNumber());
}
} else if (checkStatus.equals(CRConstants.VOIDED)) {
if (!existingRecord.getStatus().equalsIgnoreCase(CRConstants.VOIDED)) {
records.add(getCheckReconError(cr, "Bank file status is VOID and Check Recon table status is not VOID"));
LOG.error("Bank file status is VOIDED and Check Recon table status is not VOID for check " + cr.getCheckNumber());
}
}
}
}
totalLinesProcessed++;
}
}
LOG.info("Processed Records : " + totalLinesProcessed);
br.close();
}
use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.
the class CheckReconciliationImportStep method importPdpPayments.
/**
* Import PDP Payments
*/
private void importPdpPayments() {
Collection<Bank> banks = businessObjectService.findAll(Bank.class);
Collection<CheckReconciliation> payments = glTransactionService.getNewCheckReconciliations(banks);
for (CheckReconciliation temp : payments) {
businessObjectService.save(temp);
}
LOG.info("Found (" + payments.size() + ") New PDP payments.");
}
Aggregations