Search in sources :

Example 6 with CheckReconciliation

use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.

the class CheckReconciliationImportStep method updateCanceledChecks.

/**
 * Method to update canceled check records.
 */
private void updateCanceledChecks() {
    Collection<Integer> col = glTransactionService.getCanceledChecks();
    for (Integer i : col) {
        CheckReconciliation cr = businessObjectService.findBySinglePrimaryKey(CheckReconciliation.class, i);
        cr.setLastUpdate(new Timestamp(new java.util.Date().getTime()));
        cr.setStatus(CRConstants.CANCELLED);
        cr.setGlTransIndicator(Boolean.TRUE);
        businessObjectService.save(cr);
    }
    LOG.info("Found (" + col.size() + ") canceled PDP payments for update.");
}
Also used : KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) Date(java.util.Date) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation) Timestamp(java.sql.Timestamp)

Example 7 with CheckReconciliation

use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.

the class GlTransactionStep method execute.

/**
 * Execute
 *
 * @param jobName Job Name
 * @param jobRunDate Job Date
 * @see org.kuali.kfs.kns.bo.Step#execute(java.lang.String, java.util.Date)
 */
public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
    LOG.info("Started GlTransactionStep @ " + (new Date()).toString());
    LOG.info("Get Bank List");
    Collection<Bank> banks = businessObjectService.findAll(Bank.class);
    List<String> bankCodes = null;
    Collection<PaymentGroup> paymentGroups = null;
    Map<String, Object> fieldValues = null;
    Collection<CheckReconciliation> records = null;
    // Stop payments
    fieldValues = new HashMap<String, Object>();
    fieldValues.put("glTransIndicator", "N");
    fieldValues.put("status", CRConstants.STOP);
    fieldValues.put("sourceCode", CRConstants.PDP_SRC);
    records = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
    for (CheckReconciliation cr : records) {
        bankCodes = new ArrayList<String>();
        // Generate list of valid bank codes
        setBankCodes(banks, cr, bankCodes);
        if (bankCodes.size() > 0) {
            paymentGroups = glTransactionService.getAllPaymentGroupForSearchCriteria(cr.getCheckNumber(), bankCodes);
            if (paymentGroups.isEmpty()) {
                LOG.warn("No payment group found id : " + cr.getId());
            } else {
                for (PaymentGroup paymentGroup : paymentGroups) {
                    // KFSUPGRADE-636
                    // Create cancellation offsets for STOPed checks. KFSPTS-1741
                    glPendingTransactionService.generateStopGeneralLedgerPendingEntry(paymentGroup);
                    // glTransactionService.generateGlPendingTransactionStop(paymentGroup);
                    KualiCode code = businessObjectService.findBySinglePrimaryKey(PaymentStatus.class, cr.getStatus());
                    if (paymentGroup.getPaymentStatus() != ((PaymentStatus) code)) {
                        paymentGroup.setPaymentStatus((PaymentStatus) code);
                    }
                    Date lastUpdate = cr.getStatusChangeDate();
                    if (ObjectUtils.isNull(lastUpdate)) {
                        lastUpdate = new Date();
                    }
                    paymentGroup.setLastUpdatedTimestamp(new Timestamp(lastUpdate.getTime()));
                    businessObjectService.save(paymentGroup);
                    // Update status
                    cr.setGlTransIndicator(Boolean.TRUE);
                    businessObjectService.save(cr);
                    LOG.info("Generated Stop GL Pending Transacation");
                }
            }
        }
    }
    // Canceled payments
    fieldValues = new HashMap<String, Object>();
    fieldValues.put("glTransIndicator", "N");
    fieldValues.put("status", CRConstants.CANCELLED);
    fieldValues.put("sourceCode", CRConstants.PDP_SRC);
    records = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
    for (CheckReconciliation cr : records) {
        bankCodes = new ArrayList<String>();
        // Generate list of valid bank codes
        setBankCodes(banks, cr, bankCodes);
        if (bankCodes.size() > 0) {
            paymentGroups = glTransactionService.getAllPaymentGroupForSearchCriteria(cr.getCheckNumber(), bankCodes);
            if (paymentGroups.isEmpty()) {
                LOG.warn("No payment group found id : " + cr.getId());
            } else {
                for (PaymentGroup paymentGroup : paymentGroups) {
                    // KFSPTS-2260
                    glPendingTransactionService.generateCRCancellationGeneralLedgerPendingEntry(paymentGroup);
                    // glTransactionService.generateGlPendingTransactionCancel(paymentGroup);
                    KualiCode code = businessObjectService.findBySinglePrimaryKey(PaymentStatus.class, cr.getStatus());
                    if (paymentGroup.getPaymentStatus() != ((PaymentStatus) code)) {
                        paymentGroup.setPaymentStatus((PaymentStatus) code);
                    }
                    Date lastUpdate = cr.getStatusChangeDate();
                    if (ObjectUtils.isNull(lastUpdate)) {
                        lastUpdate = new Date();
                    }
                    paymentGroup.setLastUpdatedTimestamp(new Timestamp(lastUpdate.getTime()));
                    businessObjectService.save(paymentGroup);
                    // update cancel flag on payment details
                    for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
                        // paymentDetail.refreshReferenceObject("extension");
                        PaymentDetailExtendedAttribute extendedAttribute = (PaymentDetailExtendedAttribute) paymentDetail.getExtension();
                        extendedAttribute.setCrCancelledPayment(Boolean.TRUE);
                        businessObjectService.save(paymentDetail);
                    }
                    // Update status
                    cr.setGlTransIndicator(Boolean.TRUE);
                    businessObjectService.save(cr);
                    LOG.info("Generated Cancelled GL Pending Transacation");
                }
            }
        }
    }
    // VOID payments
    fieldValues = new HashMap<String, Object>();
    fieldValues.put("glTransIndicator", "N");
    fieldValues.put("status", CRConstants.VOIDED);
    fieldValues.put("sourceCode", CRConstants.PDP_SRC);
    records = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
    for (CheckReconciliation cr : records) {
        bankCodes = new ArrayList<String>();
        // Generate list of valid bank codes
        setBankCodes(banks, cr, bankCodes);
        if (bankCodes.size() > 0) {
            paymentGroups = glTransactionService.getAllPaymentGroupForSearchCriteria(cr.getCheckNumber(), bankCodes);
            if (paymentGroups.isEmpty()) {
                LOG.warn("No payment group found id : " + cr.getId());
            } else {
                for (PaymentGroup paymentGroup : paymentGroups) {
                    // Do not generate GL tarsactions for VIODED trasactions
                    // glTransactionService.generateGlPendingTransactionStop(paymentGroup);
                    KualiCode code = businessObjectService.findBySinglePrimaryKey(PaymentStatus.class, cr.getStatus());
                    if (paymentGroup.getPaymentStatus() != ((PaymentStatus) code)) {
                        paymentGroup.setPaymentStatus((PaymentStatus) code);
                    }
                    Date lastUpdate = cr.getStatusChangeDate();
                    if (ObjectUtils.isNull(lastUpdate)) {
                        lastUpdate = new Date();
                    }
                    paymentGroup.setLastUpdatedTimestamp(new Timestamp(lastUpdate.getTime()));
                    businessObjectService.save(paymentGroup);
                    // Update status
                    cr.setGlTransIndicator(Boolean.TRUE);
                    businessObjectService.save(cr);
                    LOG.info("Generated VOID GL Pending Transacation");
                }
            }
        }
    }
    // Stale payments
    fieldValues = new HashMap<String, Object>();
    fieldValues.put("glTransIndicator", "N");
    fieldValues.put("status", CRConstants.STALE);
    fieldValues.put("sourceCode", CRConstants.PDP_SRC);
    records = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
    for (CheckReconciliation cr : records) {
        bankCodes = new ArrayList<String>();
        // Generate list of valid bank codes
        setBankCodes(banks, cr, bankCodes);
        if (bankCodes.size() > 0) {
            paymentGroups = glTransactionService.getAllPaymentGroupForSearchCriteria(cr.getCheckNumber(), bankCodes);
            if (paymentGroups.isEmpty()) {
                LOG.warn("No payment group found id : " + cr.getId());
            } else {
                for (PaymentGroup paymentGroup : paymentGroups) {
                    // KFSPTS-2246
                    glPendingTransactionService.generateStaleGeneralLedgerPendingEntry(paymentGroup);
                    // glPendingTransactionService.g .generateStaleGeneralLedgerPendingEntry(paymentGroup);
                    KualiCode code = businessObjectService.findBySinglePrimaryKey(PaymentStatus.class, cr.getStatus());
                    if (paymentGroup.getPaymentStatus() != ((PaymentStatus) code)) {
                        paymentGroup.setPaymentStatus((PaymentStatus) code);
                    }
                    Date lastUpdate = cr.getStatusChangeDate();
                    if (ObjectUtils.isNull(lastUpdate)) {
                        lastUpdate = new Date();
                    }
                    paymentGroup.setLastUpdatedTimestamp(new Timestamp(lastUpdate.getTime()));
                    businessObjectService.save(paymentGroup);
                    // Update status
                    cr.setGlTransIndicator(Boolean.TRUE);
                    businessObjectService.save(cr);
                    LOG.info("Generated Stale GL Pending Transacation");
                }
            }
        }
    }
    LOG.info("Completed GlTransactionStep @ " + (new Date()).toString());
    return true;
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) Bank(org.kuali.kfs.sys.businessobject.Bank) KualiCode(org.kuali.kfs.krad.bo.KualiCode) PaymentDetailExtendedAttribute(edu.cornell.kfs.pdp.businessobject.PaymentDetailExtendedAttribute) Timestamp(java.sql.Timestamp) Date(java.util.Date) PaymentDetail(org.kuali.kfs.pdp.businessobject.PaymentDetail) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation) PaymentStatus(org.kuali.kfs.pdp.businessobject.PaymentStatus)

Example 8 with CheckReconciliation

use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.

the class CheckReconciliationDaoOjb method getNewCheckReconciliations.

/**
 * @see com.rsmart.kuali.kfs.cr.dataaccess.CheckReconciliationDao#getNewCheckReconciliations(java.util.Collection)
 */
public Collection<CheckReconciliation> getNewCheckReconciliations(Collection<Bank> banks) {
    Collection<CheckReconciliation> data = new ArrayList<CheckReconciliation>();
    CheckReconciliation cr = null;
    // String sql = "SELECT p.disb_nbr, p.disb_ts, SUM(d.net_pmt_amt), b.bnk_cd,p.pmt_payee_nm, p.payee_id_typ_cd,p.payee_id FROM pdp_pmt_grp_t p, pdp_pmt_dtl_t d, fp_bank_t b WHERE p.bnk_cd = b.bnk_cd AND p.pmt_grp_id = d.pmt_grp_id AND p.disb_typ_cd = 'CHCK' AND NOT EXISTS ( SELECT 'x' from cu_cr_check_recon_t cr WHERE cr.check_nbr = p.disb_nbr AND cr.bank_account_nbr = b.bnk_acct_nbr) GROUP BY p.disb_nbr, p.disb_ts, b.bnk_cd";
    String sql = "SELECT p.disb_nbr, p.disb_ts, SUM(d.net_pmt_amt), b.bnk_cd,p.pmt_payee_nm, p.payee_id_typ_cd,p.payee_id  FROM pdp_pmt_grp_t p, pdp_pmt_dtl_t d, fp_bank_t b WHERE p.bnk_cd = b.bnk_cd AND p.pmt_grp_id = d.pmt_grp_id AND p.disb_ts is not null AND p.disb_typ_cd = 'CHCK' AND NOT EXISTS ( SELECT 'x' from cu_cr_check_recon_t cr WHERE cr.check_nbr = p.disb_nbr AND cr.bank_account_nbr = b.bnk_acct_nbr) group by p.disb_nbr, p.disb_ts, b.bnk_cd, p.pmt_payee_nm, p.payee_id_typ_cd, p.payee_id";
    try {
        Connection c = getPersistenceBroker(true).serviceConnectionManager().getConnection();
        Statement s = c.createStatement();
        ResultSet rs = s.executeQuery(sql);
        String bnkCd = null;
        while (rs.next()) {
            cr = new CheckReconciliation();
            cr.setCheckNumber(new KualiInteger(rs.getInt(1)));
            // This is last status change date.
            cr.setCheckDate(new java.sql.Date(rs.getDate(2).getTime()));
            cr.setAmount(new KualiDecimal(rs.getDouble(3)));
            bnkCd = rs.getString(4);
            cr.setPayeeName(rs.getString(5));
            cr.setPayeeType(rs.getString(6));
            cr.setPayeeId(rs.getString(7));
            for (Bank bank : banks) {
                if (bank.getBankCode().equals(bnkCd)) {
                    cr.setBankAccountNumber(bank.getBankAccountNumber());
                }
            }
            cr.setGlTransIndicator(Boolean.FALSE);
            if (cr.getAmount().isZero()) {
                cr.setStatus(CRConstants.EXCP);
            } else {
                cr.setStatus(CRConstants.ISSUED);
            }
            cr.setSourceCode(CRConstants.PDP_SRC);
            cr.setBankCode(bnkCd);
            cr.setLastUpdate(new Timestamp(new java.util.Date().getTime()));
            data.add(cr);
        }
        s.close();
    } catch (Exception e) {
        LOG.error("getNewCheckReconciliations", e);
    }
    return data;
}
Also used : Bank(org.kuali.kfs.sys.businessobject.Bank) Statement(java.sql.Statement) KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) ArrayList(java.util.ArrayList) Connection(java.sql.Connection) Timestamp(java.sql.Timestamp) Date(java.sql.Date) ResultSet(java.sql.ResultSet) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 9 with CheckReconciliation

use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.

the class CheckReconciliationReportServiceImpl method buildReports.

/**
 * Build Reports
 *
 * @see com.rsmart.kuali.kfs.cr.document.service.CheckReconciliationReportService#buildReports(com.rsmart.kuali.kfs.cr.document.web.struts.CheckReconciliationForm)
 */
public List<CheckReconciliationReport> buildReports(Date startDate, Date endDate) {
    List<CheckReconciliationReport> data = new ArrayList<CheckReconciliationReport>();
    List list = checkReconciliationDao.getAllCheckReconciliationForSearchCriteria(startDate, endDate);
    for (int i = 0; i < list.size(); i++) {
        data.add(new CheckReconciliationReport((CheckReconciliation) list.get(i)));
    }
    return data;
}
Also used : ArrayList(java.util.ArrayList) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation) List(java.util.List) ArrayList(java.util.ArrayList) CheckReconciliationReport(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliationReport)

Example 10 with CheckReconciliation

use of com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation in project cu-kfs by CU-CommunityApps.

the class CuPendingTransactionServiceImpl method getCrCancelMaintenancedocumentNumber.

private String getCrCancelMaintenancedocumentNumber(PaymentDetail paymentDetail) {
    String crCancelMaintDocNbr = KFSConstants.EMPTY_STRING;
    KualiInteger crCheckNbr = paymentDetail.getPaymentGroup().getDisbursementNbr();
    Map<String, KualiInteger> fieldValues = new HashMap<String, KualiInteger>();
    fieldValues.put("checkNumber", crCheckNbr);
    Collection<CheckReconciliation> crEntries = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
    if (crEntries != null && crEntries.size() > 0) {
        CheckReconciliation crEntry = crEntries.iterator().next();
        crCancelMaintDocNbr = crEntry.getCancelDocHdrId();
    }
    return crCancelMaintDocNbr;
}
Also used : HashMap(java.util.HashMap) KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)

Aggregations

CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)10 Timestamp (java.sql.Timestamp)4 Date (java.util.Date)4 Bank (org.kuali.kfs.sys.businessobject.Bank)4 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)4 Date (java.sql.Date)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 CheckReconciliationReport (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliationReport)1 PaymentDetailExtendedAttribute (edu.cornell.kfs.pdp.businessobject.PaymentDetailExtendedAttribute)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 List (java.util.List)1 RuntimeCacheException (org.apache.ojb.broker.cache.RuntimeCacheException)1 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)1