Search in sources :

Example 21 with GeneralLedgerPendingEntry

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDocument method generateDocumentGeneralLedgerPendingEntries.

@Override
public boolean generateDocumentGeneralLedgerPendingEntries(GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
    if (getGeneralLedgerPendingEntries() == null || getGeneralLedgerPendingEntries().size() < 2) {
        LOG.warn("No gl entries for accounting lines.");
        return true;
    }
    /*
         * only generate additional charge entries for payment method wire charge, and if the fee has not been waived
         */
    if (KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_WIRE.equals(getDisbVchrPaymentMethodCode()) && !getWireTransfer().isWireTransferFeeWaiverIndicator()) {
        LOG.debug("generating wire charge gl pending entries.");
        // retrieve wire charge
        WireCharge wireCharge = getPaymentSourceHelperService().retrieveCurrentYearWireCharge();
        // KFSPTS-764: Added if check to eliminate zero dollar wire charge generating zero dollar accounting entries
        if (!isZeroDollarWireCharge(wireCharge)) {
            // KFSPTS-764: only generate GLPE entries when wire charges are NOT zero dollars.
            // generate debits
            GeneralLedgerPendingEntry chargeEntry = getPaymentSourceHelperService().processWireChargeDebitEntries(this, sequenceHelper, wireCharge);
            // generate credits
            getPaymentSourceHelperService().processWireChargeCreditEntries(this, sequenceHelper, wireCharge, chargeEntry);
        }
    }
    // for wire or drafts generate bank offset entry (if enabled), for ACH and checks offset will be generated by PDP
    if (KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_WIRE.equals(getDisbVchrPaymentMethodCode()) || KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_DRAFT.equals(getDisbVchrPaymentMethodCode())) {
        getPaymentSourceHelperService().generateDocumentBankOffsetEntries(this, sequenceHelper, DisbursementVoucherConstants.DOCUMENT_TYPE_WTFD);
    }
    return true;
}
Also used : GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) WireCharge(org.kuali.kfs.sys.businessobject.WireCharge)

Example 22 with GeneralLedgerPendingEntry

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry in project cu-kfs by CU-CommunityApps.

the class PreEncumbranceDocument method generateGeneralLedgerPendingEntries.

@Override
public boolean generateGeneralLedgerPendingEntries(GeneralLedgerPendingEntrySourceDetail glpeSourceDetail, GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
    // handle the explicit entry
    // create a reference to the explicitEntry to be populated, so we can pass to the offset method later
    GeneralLedgerPendingEntry explicitEntry = new GeneralLedgerPendingEntry();
    processExplicitGeneralLedgerPendingEntry(sequenceHelper, glpeSourceDetail, explicitEntry);
    // increment the sequence counter
    sequenceHelper.increment();
    return true;
}
Also used : GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)

Example 23 with GeneralLedgerPendingEntry

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry in project cu-kfs by CU-CommunityApps.

the class CuPendingTransactionServiceImpl method generateDisbursementVoucherReversalEntries.

/**
 * Generates the reversal entries for the given input DisbursementVoucherDocument.
 *
 * @param doc
 *            the DisbursementVoucherDocument for which we generate the reversal entries
 * @param sequenceHelper
 */
protected void generateDisbursementVoucherReversalEntries(DisbursementVoucherDocument doc, GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
    // generate all the pending entries for the document
    SpringContext.getBean(GeneralLedgerPendingEntryService.class).generateGeneralLedgerPendingEntries(doc);
    // for each pending entry, opposite-ify it and reattach it to the document
    List<GeneralLedgerPendingEntry> glpes = doc.getGeneralLedgerPendingEntries();
    if (glpes != null && glpes.size() > 0) {
        for (GeneralLedgerPendingEntry glpe : glpes) {
            if (KFSConstants.GL_CREDIT_CODE.equalsIgnoreCase(glpe.getTransactionDebitCreditCode())) {
                glpe.setTransactionDebitCreditCode(KFSConstants.GL_DEBIT_CODE);
            } else if (KFSConstants.GL_DEBIT_CODE.equalsIgnoreCase(glpe.getTransactionDebitCreditCode())) {
                glpe.setTransactionDebitCreditCode(KFSConstants.GL_CREDIT_CODE);
            }
            glpe.setTransactionLedgerEntrySequenceNumber(sequenceHelper.getSequenceCounter());
            sequenceHelper.increment();
            Date transactionTimestamp = new Date(dateTimeService.getCurrentDate().getTime());
            AccountingPeriod fiscalPeriod = accountingPeriodService.getByDate(new java.sql.Date(transactionTimestamp.getTime()));
            glpe.setFinancialDocumentApprovedCode(KFSConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.APPROVED);
            glpe.setUniversityFiscalYear(fiscalPeriod.getUniversityFiscalYear());
            glpe.setUniversityFiscalPeriodCode(fiscalPeriod.getUniversityFiscalPeriodCode());
            businessObjectService.save(glpe);
        }
    }
}
Also used : GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) AccountingPeriod(org.kuali.kfs.coa.businessobject.AccountingPeriod) GeneralLedgerPendingEntryService(org.kuali.kfs.sys.service.GeneralLedgerPendingEntryService) Date(java.sql.Date) Date(java.sql.Date)

Example 24 with GeneralLedgerPendingEntry

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry in project cu-kfs by CU-CommunityApps.

the class CuGeneralLedgerPendingEntryServiceImplTest method testNotFillinFiscalYrPeriodForNonPCDODoc.

public void testNotFillinFiscalYrPeriodForNonPCDODoc() {
    GeneralLedgerPendingEntry glpe = new GeneralLedgerPendingEntry();
    glpe.setFinancialDocumentTypeCode(KFSConstants.FinancialDocumentTypeCodes.ADVANCE_DEPOSIT);
    glpe.setUniversityFiscalYear(2012);
    glpe.setUniversityFiscalPeriodCode("01");
    cuGeneralLedgerPendingEntryService.fillInFiscalPeriodYear(glpe);
    // 2012/01 is an inactive period;  it should not be set to current fiscal yr/period for AD
    assertTrue("should not fill in fiscal year", 2012 == glpe.getUniversityFiscalYear());
    assertTrue("should not fill in fiscal period code", StringUtils.equals("01", glpe.getUniversityFiscalPeriodCode()));
}
Also used : GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)

Example 25 with GeneralLedgerPendingEntry

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry in project cu-kfs by CU-CommunityApps.

the class CuPurapGeneralLedgerServiceImplTest method testGenerateEntriesPaymentRequest.

public void testGenerateEntriesPaymentRequest() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.refreshNonUpdateableReferences();
    changeCurrentUser(UserNameFixture.mo14);
    CuPaymentRequestDocument preq = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    preq.initiateDocument();
    preq.populatePaymentRequestFromPurchaseOrder(po);
    preq.setPaymentMethodCode("F");
    preq.setApplicationDocumentStatus(PurapConstants.PaymentRequestStatuses.APPDOC_AWAITING_ACCOUNTS_PAYABLE_REVIEW);
    ((PaymentRequestItem) (preq.getItems().get(0))).setExtendedPrice(new KualiDecimal(1));
    AccountingDocumentTestUtils.saveDocument(preq, SpringContext.getBean(DocumentService.class));
    List<SummaryAccount> summaryAccounts = purapAccountingService.generateSummaryAccountsWithNoZeroTotalsNoUseTax(preq);
    cuPurapGeneralLedgerServiceImpl.generateEntriesPaymentRequest(preq, null, summaryAccounts, "create");
    boolean noBankOffsetGenerated = true;
    for (GeneralLedgerPendingEntry pe : preq.getGeneralLedgerPendingEntries()) {
        if (KFSKeyConstants.Bank.DESCRIPTION_GLPE_BANK_OFFSET.equalsIgnoreCase(pe.getTransactionLedgerEntryDescription())) {
            noBankOffsetGenerated = false;
            break;
        }
    }
    assertEquals(2, preq.getGeneralLedgerPendingEntries().size());
    assertTrue(noBankOffsetGenerated);
}
Also used : SummaryAccount(org.kuali.kfs.module.purap.util.SummaryAccount) PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Aggregations

GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)25 Timestamp (java.sql.Timestamp)6 ArrayList (java.util.ArrayList)6 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)6 HashMap (java.util.HashMap)4 List (java.util.List)3 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)3 SystemOptions (org.kuali.kfs.sys.businessobject.SystemOptions)3 PaymentMethodChart (edu.cornell.kfs.fp.businessobject.PaymentMethodChart)2 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)2 Date (java.sql.Date)2 Map (java.util.Map)2 Account (org.kuali.kfs.coa.businessobject.Account)2 AccountingPeriod (org.kuali.kfs.coa.businessobject.AccountingPeriod)2 OffsetDefinition (org.kuali.kfs.coa.businessobject.OffsetDefinition)2 AccountingLine (org.kuali.kfs.sys.businessobject.AccountingLine)2 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)2 GeneralLedgerPostingDocument (org.kuali.kfs.sys.document.GeneralLedgerPostingDocument)2 GeneralLedgerPendingEntryService (org.kuali.kfs.sys.service.GeneralLedgerPendingEntryService)2 KfsParameterConstants (org.kuali.kfs.sys.service.impl.KfsParameterConstants)2