Search in sources :

Example 6 with NonTransactional

use of org.kuali.kfs.sys.service.NonTransactional in project cu-kfs by CU-CommunityApps.

the class GlLineServiceImpl method findCapitalAssetInformation.

/**
 * @see GlLineService#findCapitalAssetInformation(GeneralLedgerEntry)
 */
@Override
@NonTransactional
public CapitalAssetInformation findCapitalAssetInformation(String documentNumber, Integer capitalAssetLineNumber) {
    Map<String, String> primaryKeys = new HashMap<String, String>(2);
    primaryKeys.put(CamsPropertyConstants.CapitalAssetInformation.DOCUMENT_NUMBER, documentNumber);
    primaryKeys.put(CamsPropertyConstants.CapitalAssetInformation.ASSET_LINE_NUMBER, capitalAssetLineNumber.toString());
    CapitalAssetInformation assetInformation = businessObjectService.findByPrimaryKey(CapitalAssetInformation.class, primaryKeys);
    return assetInformation;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) HashMap(java.util.HashMap) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Example 7 with NonTransactional

use of org.kuali.kfs.sys.service.NonTransactional in project cu-kfs by CU-CommunityApps.

the class GlLineServiceImpl method createAssetPaymentDocument.

/**
 * @see GlLineService#createAssetPaymentDocument(GeneralLedgerEntry, Integer)
 */
@Override
@NonTransactional
public Document createAssetPaymentDocument(GeneralLedgerEntry primaryGlEntry, Integer capitalAssetLineNumber) throws WorkflowException {
    // Find out the GL Entry
    // initiate a new document
    AssetPaymentDocument document = (AssetPaymentDocument) documentService.getNewDocument(DocumentTypeName.ASSET_PAYMENT);
    document.setCapitalAssetBuilderOriginIndicator(true);
    // populate the capital asset line distribution amount code to the payment document.
    CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(primaryGlEntry.getDocumentNumber(), capitalAssetLineNumber);
    if (ObjectUtils.isNotNull(capitalAssetInformation)) {
        // setup asset allocation info accordingly so it can be changed on Asset Payment Document
        if (ObjectUtils.isNull(capitalAssetInformation.getDistributionAmountCode())) {
            document.setAssetPaymentAllocationTypeCode(KFSConstants.CapitalAssets.DISTRIBUTE_COST_EQUALLY_CODE);
            document.setAllocationFromFPDocuments(false);
        } else {
            document.setAssetPaymentAllocationTypeCode(capitalAssetInformation.getDistributionAmountCode());
            document.setAllocationFromFPDocuments(true);
        }
    }
    document.getDocumentHeader().setDocumentDescription(CAB_DESC_PREFIX + primaryGlEntry.getDocumentNumber());
    updatePreTagInformation(primaryGlEntry, document, capitalAssetLineNumber);
    // Asset Payment Detail - sourceAccountingLines on the document....
    document.getSourceAccountingLines().addAll(createAssetPaymentDetails(primaryGlEntry, document, 0, capitalAssetLineNumber));
    KualiDecimal assetAmount = KualiDecimal.ZERO;
    List<SourceAccountingLine> sourceAccountingLines = document.getSourceAccountingLines();
    for (SourceAccountingLine sourceAccountingLine : sourceAccountingLines) {
        assetAmount = assetAmount.add(sourceAccountingLine.getAmount());
    }
    List<AssetPaymentAssetDetail> assetPaymentDetails = document.getAssetPaymentAssetDetail();
    for (AssetPaymentAssetDetail assetPaymentDetail : assetPaymentDetails) {
        assetPaymentDetail.setAllocatedAmount(assetAmount);
    }
    // Asset payment asset detail
    // save the document
    documentService.saveDocument(document);
    markCapitalAssetProcessed(primaryGlEntry, capitalAssetLineNumber);
    deactivateGLEntries(primaryGlEntry, document, capitalAssetLineNumber);
    return document;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) AssetPaymentDocument(org.kuali.kfs.module.cam.document.AssetPaymentDocument) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) AssetPaymentAssetDetail(org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Example 8 with NonTransactional

use of org.kuali.kfs.sys.service.NonTransactional in project cu-kfs by CU-CommunityApps.

the class GlLineServiceImpl method findCapitalAssetInformationForGLLine.

/**
 * @see GlLineService#findCapitalAssetInformationForGLLine(GeneralLedgerEntry)
 */
@Override
@NonTransactional
public List<CapitalAssetInformation> findCapitalAssetInformationForGLLine(GeneralLedgerEntry entry) {
    Map<String, String> fields = new HashMap<String, String>();
    fields.put(CamsPropertyConstants.CapitalAssetInformation.DOCUMENT_NUMBER, entry.getDocumentNumber());
    fields.put(CamsPropertyConstants.CapitalAssetInformation.ASSET_PROCESSED_IND, "N");
    List<CapitalAssetInformation> assetInformation = (List<CapitalAssetInformation>) businessObjectService.findMatchingOrderBy(CapitalAssetInformation.class, fields, CamsPropertyConstants.CapitalAssetInformation.ACTION_INDICATOR, true);
    List<CapitalAssetInformation> matchingAssets = new ArrayList<CapitalAssetInformation>();
    for (CapitalAssetInformation capitalAsset : assetInformation) {
        addToCapitalAssets(matchingAssets, capitalAsset, entry);
    }
    return matchingAssets;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Example 9 with NonTransactional

use of org.kuali.kfs.sys.service.NonTransactional in project cu-kfs by CU-CommunityApps.

the class CuAchAdviceNotificationServiceImpl method sendAdviceNotifications.

/**
 * Set to NonTransactional so the payment advice email sent date will be updated and saved after the email is sent
 *
 * @see org.kuali.kfs.pdp.batch.service.AchAdviceNotificationService#sendAdviceNotifications()
 */
@NonTransactional
public void sendAdviceNotifications() {
    if (achBundlerHelperService.shouldBundleAchPayments()) {
        // ACH payments were bundled so the corresponding advice email notifications should also be bundled
        HashSet<Integer> disbNbrs = achBundlerAdviceDao.getDistinctDisbursementNumbersForAchPaymentsNeedingAdviceNotification();
        for (Iterator<Integer> disbIter = disbNbrs.iterator(); disbIter.hasNext(); ) {
            Integer disbursementNbr = disbIter.next();
            // get all payment details to include in the advice based on disbursement number which is associated to a single vendor
            List<PaymentDetail> paymentDetails = achBundlerAdviceDao.getAchPaymentDetailsNeedingAdviceNotificationByDisbursementNumber(disbursementNbr);
            // get one payment detail record so that we can get the needed payment group record, since all payment details are for the same vendor, all payment group records should match
            Iterator<PaymentDetail> paymentDetailsIter = paymentDetails.iterator();
            PaymentDetail payDetail = paymentDetailsIter.next();
            PaymentGroup payGroup = payDetail.getPaymentGroup();
            CustomerProfile customer = payGroup.getBatch().getCustomerProfile();
            // verify the customer profile is setup to create advices
            if (customer.getAdviceCreate()) {
                pdpEmailService.sendAchAdviceEmail(payGroup, paymentDetails, customer);
            }
            // update sent date on the payment, must loop through all payment details because payment groups could be unique.
            for (Iterator<PaymentDetail> paymentDetailsIter2 = paymentDetails.iterator(); paymentDetailsIter2.hasNext(); ) {
                PaymentDetail pd = paymentDetailsIter2.next();
                PaymentGroup pg = pd.getPaymentGroup();
                pg.setAdviceEmailSentDate(dateTimeService.getCurrentTimestamp());
                businessObjectService.save(pg);
            }
        }
    // for each disb number
    } else {
        // Execute the original KFS code to send unbundled ACH advice email notifications with a
        // change to the looping on the payment detail records as noted below with notation KFSPTS-1460
        // get list of payments to send notification for
        List<PaymentGroup> paymentGroups = paymentGroupService.getAchPaymentsNeedingAdviceNotification();
        for (PaymentGroup paymentGroup : paymentGroups) {
            CustomerProfile customer = paymentGroup.getBatch().getCustomerProfile();
            // verify the customer profile is setup to create advices
            if (customer.getAdviceCreate()) {
                // KFSPTS-1460 - for loop removed
                // for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
                // pdpEmailService.sendAchAdviceEmail(paymentGroup, paymentDetail, customer);
                // }
                List<PaymentDetail> paymentDetails = paymentGroup.getPaymentDetails();
                pdpEmailService.sendAchAdviceEmail(paymentGroup, paymentDetails, customer);
            }
            // update advice sent date on payment
            paymentGroup.setAdviceEmailSentDate(dateTimeService.getCurrentTimestamp());
            businessObjectService.save(paymentGroup);
        }
    }
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) PaymentDetail(org.kuali.kfs.pdp.businessobject.PaymentDetail) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Example 10 with NonTransactional

use of org.kuali.kfs.sys.service.NonTransactional in project cu-kfs by CU-CommunityApps.

the class CuElectronicInvoiceHelperServiceImpl method createPaymentRequest.

@Override
@NonTransactional
public boolean createPaymentRequest(ElectronicInvoiceRejectDocument rejectDocument) {
    if (rejectDocument.getInvoiceRejectReasons().size() > 0) {
        throw new RuntimeException("Not possible to create payment request since the reject document contains " + rejectDocument.getInvoiceRejectReasons().size() + " rejects");
    }
    Map itemTypeMappings = getItemTypeMappings(rejectDocument.getVendorHeaderGeneratedIdentifier(), rejectDocument.getVendorDetailAssignedIdentifier());
    Map kualiItemTypes = getKualiItemTypes();
    CuElectronicInvoiceOrderHolder rejectDocHolder = new CuElectronicInvoiceOrderHolder(rejectDocument, itemTypeMappings, kualiItemTypes);
    // KFSPTS-1719 : restore the nomatchingitems found during matching process.  so, preq items can be created
    rejectDocHolder.setNonMatchItems(((CuElectronicInvoiceRejectDocument) rejectDocument).getNonMatchItems());
    /**
     * First, create a new payment request document.  Once this document is created, then update the reject document's PREQ_ID field
     * with the payment request document identifier.  This identifier is used to associate the reject document with the payment request.
     */
    PaymentRequestDocument preqDocument = createPaymentRequest(rejectDocHolder);
    if (ObjectUtils.isNotNull(preqDocument)) {
        rejectDocument.setPaymentRequestIdentifier(preqDocument.getPurapDocumentIdentifier());
    }
    return !rejectDocHolder.isInvoiceRejected();
}
Also used : CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) Map(java.util.Map) HashMap(java.util.HashMap) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Aggregations

NonTransactional (org.kuali.kfs.sys.service.NonTransactional)16 Note (org.kuali.kfs.krad.bo.Note)6 HashMap (java.util.HashMap)4 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)3 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 CuElectronicInvoiceRejectDocument (edu.cornell.kfs.module.purap.document.CuElectronicInvoiceRejectDocument)1 CUBankService (edu.cornell.kfs.sys.service.CUBankService)1 Timestamp (java.sql.Timestamp)1 Calendar (java.util.Calendar)1 List (java.util.List)1 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)1 AssetGlobal (org.kuali.kfs.module.cam.businessobject.AssetGlobal)1 AssetPaymentAssetDetail (org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail)1 AssetPaymentDocument (org.kuali.kfs.module.cam.document.AssetPaymentDocument)1 ElectronicInvoiceRejectReason (org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceRejectReason)1 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)1 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)1 PaymentDetail (org.kuali.kfs.pdp.businessobject.PaymentDetail)1