use of org.kuali.kfs.pdp.businessobject.PaymentAccountDetail in project cu-kfs by CU-CommunityApps.
the class PendingTransactionServiceImpl method populatePaymentGeneralLedgerPendingEntry.
/**
* Populates and stores a new GLPE for each account detail in the payment group.
*
* @param paymentGroup payment group to generate entries for
* @param achFdocTypeCode doc type for ach disbursements
* @param checkFdocTypeCod doc type for check disbursements
* @param reversal boolean indicating if this is a reversal
*/
protected void populatePaymentGeneralLedgerPendingEntry(PaymentGroup paymentGroup, String achFdocTypeCode, String checkFdocTypeCod, boolean reversal) {
List<PaymentAccountDetail> accountListings = new ArrayList<PaymentAccountDetail>();
for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
accountListings.addAll(paymentDetail.getAccountDetail());
}
BusinessObjectEntry businessObjectEntry = dataDictionaryService.getDataDictionary().getBusinessObjectEntry(PaymentDetail.class.getName());
AttributeDefinition attributeDefinition = businessObjectEntry.getAttributeDefinition("paymentGroup.payeeName");
AttributeSecurity originalPayeeNameAttributeSecurity = attributeDefinition.getAttributeSecurity();
String maskLiteral = ((MaskFormatterLiteral) originalPayeeNameAttributeSecurity.getMaskFormatter()).getLiteral();
GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();
for (PaymentAccountDetail paymentAccountDetail : accountListings) {
GlPendingTransaction glPendingTransaction = new GlPendingTransaction();
glPendingTransaction.setSequenceNbr(new KualiInteger(sequenceHelper.getSequenceCounter()));
if (StringUtils.isNotBlank(paymentAccountDetail.getPaymentDetail().getFinancialSystemOriginCode()) && StringUtils.isNotBlank(paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode())) {
glPendingTransaction.setFdocRefTypCd(paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode());
glPendingTransaction.setFsRefOriginCd(paymentAccountDetail.getPaymentDetail().getFinancialSystemOriginCode());
} else {
glPendingTransaction.setFdocRefTypCd(PdpConstants.PDP_FDOC_TYPE_CODE);
glPendingTransaction.setFsRefOriginCd(PdpConstants.PDP_FDOC_ORIGIN_CODE);
}
glPendingTransaction.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_ACTUAL);
Date transactionTimestamp = new Date(dateTimeService.getCurrentDate().getTime());
glPendingTransaction.setTransactionDt(transactionTimestamp);
AccountingPeriod fiscalPeriod = accountingPeriodService.getByDate(new java.sql.Date(transactionTimestamp.getTime()));
glPendingTransaction.setUniversityFiscalYear(fiscalPeriod.getUniversityFiscalYear());
glPendingTransaction.setUnivFiscalPrdCd(fiscalPeriod.getUniversityFiscalPeriodCode());
glPendingTransaction.setAccountNumber(paymentAccountDetail.getAccountNbr());
glPendingTransaction.setSubAccountNumber(paymentAccountDetail.getSubAccountNbr());
glPendingTransaction.setChartOfAccountsCode(paymentAccountDetail.getFinChartCode());
if (paymentGroup.getDisbursementType().getCode().equals(PdpConstants.DisbursementTypeCodes.ACH)) {
glPendingTransaction.setFinancialDocumentTypeCode(achFdocTypeCode);
} else if (paymentGroup.getDisbursementType().getCode().equals(PdpConstants.DisbursementTypeCodes.CHECK)) {
glPendingTransaction.setFinancialDocumentTypeCode(checkFdocTypeCod);
}
glPendingTransaction.setFsOriginCd(PdpConstants.PDP_FDOC_ORIGIN_CODE);
glPendingTransaction.setFdocNbr(paymentGroup.getDisbursementNbr().toString());
Boolean relieveLiabilities = paymentGroup.getBatch().getCustomerProfile().getRelieveLiabilities();
if ((relieveLiabilities != null) && (relieveLiabilities.booleanValue()) && paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode() != null) {
OffsetDefinition offsetDefinition = SpringContext.getBean(OffsetDefinitionService.class).getByPrimaryId(glPendingTransaction.getUniversityFiscalYear(), glPendingTransaction.getChartOfAccountsCode(), paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode(), glPendingTransaction.getFinancialBalanceTypeCode());
glPendingTransaction.setFinancialObjectCode(offsetDefinition != null ? offsetDefinition.getFinancialObjectCode() : paymentAccountDetail.getFinObjectCode());
glPendingTransaction.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
} else {
glPendingTransaction.setFinancialObjectCode(paymentAccountDetail.getFinObjectCode());
glPendingTransaction.setFinancialSubObjectCode(paymentAccountDetail.getFinSubObjectCode());
}
glPendingTransaction.setProjectCd(paymentAccountDetail.getProjectCode());
glPendingTransaction.setDebitCrdtCd(pdpUtilService.isDebit(paymentAccountDetail, reversal) ? KFSConstants.GL_DEBIT_CODE : KFSConstants.GL_CREDIT_CODE);
glPendingTransaction.setAmount(paymentAccountDetail.getAccountNetAmount().abs());
// Changes for Research Participant Upload
String trnDesc = StringUtils.EMPTY;
CustomerProfile customerProfile = paymentGroup.getBatch().getCustomerProfile();
if (researchParticipantPaymentValidationService.isResearchParticipantPayment(customerProfile)) {
trnDesc = maskLiteral;
} else {
String payeeName = paymentGroup.getPayeeName();
if (StringUtils.isNotBlank(payeeName)) {
trnDesc = payeeName.length() > 40 ? payeeName.substring(0, 40) : StringUtils.rightPad(payeeName, 40);
}
if (reversal) {
String poNbr = paymentAccountDetail.getPaymentDetail().getPurchaseOrderNbr();
if (StringUtils.isNotBlank(poNbr)) {
trnDesc += " " + (poNbr.length() > 9 ? poNbr.substring(0, 9) : StringUtils.rightPad(poNbr, 9));
}
String invoiceNbr = paymentAccountDetail.getPaymentDetail().getInvoiceNbr();
if (StringUtils.isNotBlank(invoiceNbr)) {
trnDesc += " " + (invoiceNbr.length() > 14 ? invoiceNbr.substring(0, 14) : StringUtils.rightPad(invoiceNbr, 14));
}
if (trnDesc.length() > 40) {
trnDesc = trnDesc.substring(0, 40);
}
}
}
glPendingTransaction.setDescription(trnDesc);
glPendingTransaction.setOrgDocNbr(paymentAccountDetail.getPaymentDetail().getOrganizationDocNbr());
glPendingTransaction.setOrgReferenceId(paymentAccountDetail.getOrgReferenceId());
glPendingTransaction.setFdocRefNbr(paymentAccountDetail.getPaymentDetail().getCustPaymentDocNbr());
// update the offset account if necessary
SpringContext.getBean(FlexibleOffsetAccountService.class).updateOffset(glPendingTransaction);
this.businessObjectService.save(glPendingTransaction);
sequenceHelper.increment();
if (bankService.isBankSpecificationEnabled()) {
this.populateBankOffsetEntry(paymentGroup, glPendingTransaction, sequenceHelper);
}
}
}
use of org.kuali.kfs.pdp.businessobject.PaymentAccountDetail in project cu-kfs by CU-CommunityApps.
the class GlTransactionServiceImpl method generateGlPendingTransaction.
/**
* Generate GlPendingTransaction
*
* @param paymentGroup
* @param financialDocumentTypeCode
* @param stale
*/
private void generateGlPendingTransaction(PaymentGroup paymentGroup, String financialDocumentTypeCode, boolean stale) {
List<PaymentAccountDetail> accountListings = new ArrayList<PaymentAccountDetail>();
for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
accountListings.addAll(paymentDetail.getAccountDetail());
}
GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();
for (PaymentAccountDetail paymentAccountDetail : accountListings) {
GlPendingTransaction glPendingTransaction = new GlPendingTransaction();
glPendingTransaction.setSequenceNbr(new KualiInteger(sequenceHelper.getSequenceCounter()));
glPendingTransaction.setFdocRefTypCd(paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode());
glPendingTransaction.setFsRefOriginCd(paymentAccountDetail.getPaymentDetail().getFinancialSystemOriginCode());
glPendingTransaction.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_ACTUAL);
Date transactionTimestamp = new Date(dateTimeService.getCurrentDate().getTime());
glPendingTransaction.setTransactionDt(transactionTimestamp);
AccountingPeriod fiscalPeriod = accountingPeriodService.getByDate(new java.sql.Date(transactionTimestamp.getTime()));
glPendingTransaction.setUniversityFiscalYear(fiscalPeriod.getUniversityFiscalYear());
glPendingTransaction.setUnivFiscalPrdCd(fiscalPeriod.getUniversityFiscalPeriodCode());
glPendingTransaction.setSubAccountNumber(paymentAccountDetail.getSubAccountNbr());
glPendingTransaction.setChartOfAccountsCode(paymentAccountDetail.getFinChartCode());
glPendingTransaction.setFdocNbr(paymentGroup.getDisbursementNbr().toString());
// Set doc type and origin code
glPendingTransaction.setFinancialDocumentTypeCode(financialDocumentTypeCode);
glPendingTransaction.setFsOriginCd(CRConstants.CR_FDOC_ORIGIN_CODE);
String clAcct = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.CLEARING_ACCOUNT);
String obCode = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.CLEARING_OBJECT_CODE);
String coaCode = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.CLEARING_COA);
// Use clearing parameters if stale
String accountNbr = stale ? clAcct : paymentAccountDetail.getAccountNbr();
String finObjectCode = stale ? obCode : paymentAccountDetail.getFinObjectCode();
String finCoaCd = stale ? coaCode : paymentAccountDetail.getFinChartCode();
Boolean relieveLiabilities = paymentGroup.getBatch().getCustomerProfile().getRelieveLiabilities();
if ((relieveLiabilities != null) && (relieveLiabilities.booleanValue()) && paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode() != null) {
OffsetDefinition offsetDefinition = SpringContext.getBean(OffsetDefinitionService.class).getByPrimaryId(glPendingTransaction.getUniversityFiscalYear(), glPendingTransaction.getChartOfAccountsCode(), paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode(), glPendingTransaction.getFinancialBalanceTypeCode());
glPendingTransaction.setAccountNumber(accountNbr);
glPendingTransaction.setChartOfAccountsCode(finCoaCd);
glPendingTransaction.setFinancialObjectCode(offsetDefinition != null ? offsetDefinition.getFinancialObjectCode() : finObjectCode);
glPendingTransaction.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
} else {
glPendingTransaction.setAccountNumber(accountNbr);
glPendingTransaction.setChartOfAccountsCode(finCoaCd);
glPendingTransaction.setFinancialObjectCode(finObjectCode);
glPendingTransaction.setFinancialSubObjectCode(paymentAccountDetail.getFinSubObjectCode());
}
glPendingTransaction.setProjectCd(paymentAccountDetail.getProjectCode());
if (paymentAccountDetail.getAccountNetAmount().bigDecimalValue().signum() >= 0) {
glPendingTransaction.setDebitCrdtCd(KFSConstants.GL_CREDIT_CODE);
} else {
glPendingTransaction.setDebitCrdtCd(KFSConstants.GL_DEBIT_CODE);
}
glPendingTransaction.setAmount(paymentAccountDetail.getAccountNetAmount().abs());
String trnDesc;
String payeeName = paymentGroup.getPayeeName();
trnDesc = payeeName.length() > 40 ? payeeName.substring(0, 40) : StringUtils.rightPad(payeeName, 40);
String poNbr = paymentAccountDetail.getPaymentDetail().getPurchaseOrderNbr();
if (StringUtils.isNotBlank(poNbr)) {
trnDesc += " " + (poNbr.length() > 9 ? poNbr.substring(0, 9) : StringUtils.rightPad(poNbr, 9));
}
String invoiceNbr = paymentAccountDetail.getPaymentDetail().getInvoiceNbr();
if (StringUtils.isNotBlank(invoiceNbr)) {
trnDesc += " " + (invoiceNbr.length() > 14 ? invoiceNbr.substring(0, 14) : StringUtils.rightPad(invoiceNbr, 14));
}
if (trnDesc.length() > 40) {
trnDesc = trnDesc.substring(0, 40);
}
glPendingTransaction.setDescription(trnDesc);
glPendingTransaction.setOrgDocNbr(paymentAccountDetail.getPaymentDetail().getOrganizationDocNbr());
glPendingTransaction.setOrgReferenceId(paymentAccountDetail.getOrgReferenceId());
glPendingTransaction.setFdocRefNbr(paymentAccountDetail.getPaymentDetail().getCustPaymentDocNbr());
// update the offset account if necessary
SpringContext.getBean(FlexibleOffsetAccountService.class).updateOffset(glPendingTransaction);
this.businessObjectService.save(glPendingTransaction);
sequenceHelper.increment();
}
}
use of org.kuali.kfs.pdp.businessobject.PaymentAccountDetail in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherExtractionHelperServiceImpl method buildPaymentDetail.
protected PaymentDetail buildPaymentDetail(DisbursementVoucherDocument document, Date processRunDate) {
if (LOG.isDebugEnabled()) {
LOG.debug("buildPaymentDetail() started");
}
final String maxNoteLinesParam = getParameterService().getParameterValueAsString(KfsParameterConstants.PRE_DISBURSEMENT_ALL.class, PdpParameterConstants.MAX_NOTE_LINES);
int maxNoteLines;
try {
maxNoteLines = Integer.parseInt(maxNoteLinesParam);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Invalid Max Notes Lines parameter, value: " + maxNoteLinesParam + " cannot be converted to an integer");
}
PaymentDetail pd = new PaymentDetail();
if (StringUtils.isNotEmpty(document.getDocumentHeader().getOrganizationDocumentNumber())) {
pd.setOrganizationDocNbr(document.getDocumentHeader().getOrganizationDocumentNumber());
}
pd.setCustPaymentDocNbr(document.getDocumentNumber());
pd.setInvoiceDate(new java.sql.Date(processRunDate.getTime()));
pd.setOrigInvoiceAmount(document.getDisbVchrCheckTotalAmount());
pd.setInvTotDiscountAmount(KualiDecimal.ZERO);
pd.setInvTotOtherCreditAmount(KualiDecimal.ZERO);
pd.setInvTotOtherDebitAmount(KualiDecimal.ZERO);
pd.setInvTotShipAmount(KualiDecimal.ZERO);
pd.setNetPaymentAmount(document.getDisbVchrCheckTotalAmount());
pd.setPrimaryCancelledPayment(Boolean.FALSE);
pd.setFinancialDocumentTypeCode(DisbursementVoucherConstants.DOCUMENT_TYPE_CHECKACH);
pd.setFinancialSystemOriginCode(KFSConstants.ORIGIN_CODE_KUALI);
// Handle accounts
for (SourceAccountingLine sal : (List<? extends SourceAccountingLine>) document.getSourceAccountingLines()) {
PaymentAccountDetail pad = new PaymentAccountDetail();
pad.setFinChartCode(sal.getChartOfAccountsCode());
pad.setAccountNbr(sal.getAccountNumber());
if (StringUtils.isNotEmpty(sal.getSubAccountNumber())) {
pad.setSubAccountNbr(sal.getSubAccountNumber());
} else {
pad.setSubAccountNbr(KFSConstants.getDashSubAccountNumber());
}
pad.setFinObjectCode(sal.getFinancialObjectCode());
if (StringUtils.isNotEmpty(sal.getFinancialSubObjectCode())) {
pad.setFinSubObjectCode(sal.getFinancialSubObjectCode());
} else {
pad.setFinSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
}
if (StringUtils.isNotEmpty(sal.getOrganizationReferenceId())) {
pad.setOrgReferenceId(sal.getOrganizationReferenceId());
}
if (StringUtils.isNotEmpty(sal.getProjectCode())) {
pad.setProjectCode(sal.getProjectCode());
} else {
pad.setProjectCode(KFSConstants.getDashProjectCode());
}
pad.setAccountNetAmount(sal.getAmount());
pd.addAccountDetail(pad);
}
// Handle notes
DisbursementVoucherPayeeDetail dvpd = document.getDvPayeeDetail();
int line = 0;
PaymentNoteText pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_PREPARER + document.getDisbVchrContactPersonName() + " " + document.getDisbVchrContactPhoneNumber());
pd.addNote(pnt);
String dvSpecialHandlingPersonName = null;
String dvSpecialHandlingLine1Address = null;
String dvSpecialHandlingLine2Address = null;
String dvSpecialHandlingCity = null;
String dvSpecialHandlingState = null;
String dvSpecialHandlingZip = null;
dvSpecialHandlingPersonName = dvpd.getDisbVchrSpecialHandlingPersonName();
dvSpecialHandlingLine1Address = dvpd.getDisbVchrSpecialHandlingLine1Addr();
dvSpecialHandlingLine2Address = dvpd.getDisbVchrSpecialHandlingLine2Addr();
dvSpecialHandlingCity = dvpd.getDisbVchrSpecialHandlingCityName();
dvSpecialHandlingState = dvpd.getDisbVchrSpecialHandlingStateCode();
dvSpecialHandlingZip = dvpd.getDisbVchrSpecialHandlingZipCode();
if (StringUtils.isNotEmpty(dvSpecialHandlingPersonName)) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText("Send Check To: " + dvSpecialHandlingPersonName);
if (LOG.isDebugEnabled()) {
LOG.debug("Creating special handling person name note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
if (StringUtils.isNotEmpty(dvSpecialHandlingLine1Address)) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_SPECIAL_HANDLING_ADDRESS1 + dvSpecialHandlingLine1Address);
if (LOG.isDebugEnabled()) {
LOG.debug("Creating special handling address 1 note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
if (StringUtils.isNotEmpty(dvSpecialHandlingLine2Address)) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_SPECIAL_HANDLING_ADDRESS2 + dvSpecialHandlingLine2Address);
if (LOG.isDebugEnabled()) {
LOG.debug("Creating special handling address 2 note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
if (StringUtils.isNotEmpty(dvSpecialHandlingCity)) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_SPECIAL_HANDLING_ADDRESS3 + dvSpecialHandlingCity + ", " + dvSpecialHandlingState + " " + dvSpecialHandlingZip);
if (LOG.isDebugEnabled()) {
LOG.debug("Creating special handling city note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
if (document.isDisbVchrAttachmentCode()) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText("Attachment Included");
if (LOG.isDebugEnabled()) {
LOG.debug("create attachment note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
String paymentReasonCode = dvpd.getDisbVchrPaymentReasonCode();
if (/*REFACTORME*/
getParameterEvaluatorService().getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.NONEMPLOYEE_TRAVEL_PAY_REASONS_PARM_NM, paymentReasonCode).evaluationSucceeds()) {
DisbursementVoucherNonEmployeeTravel dvnet = document.getDvNonEmployeeTravel();
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText("Reimbursement associated with " + dvnet.getDisbVchrServicePerformedDesc());
if (LOG.isDebugEnabled()) {
LOG.debug("Creating non employee travel notes: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText("The total per diem amount for your daily expenses is " + dvnet.getDisbVchrPerdiemActualAmount());
if (LOG.isDebugEnabled()) {
LOG.debug("Creating non employee travel notes: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
if (dvnet.getDisbVchrPersonalCarAmount() != null && dvnet.getDisbVchrPersonalCarAmount().compareTo(KualiDecimal.ZERO) != 0) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText("The total dollar amount for your vehicle mileage is " + dvnet.getDisbVchrPersonalCarAmount());
if (LOG.isDebugEnabled()) {
LOG.debug("Creating non employee travel vehicle note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
for (DisbursementVoucherNonEmployeeExpense exp : (List<DisbursementVoucherNonEmployeeExpense>) dvnet.getDvNonEmployeeExpenses()) {
if (line < (maxNoteLines - 8)) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText(exp.getDisbVchrExpenseCompanyName() + " " + exp.getDisbVchrExpenseAmount());
if (LOG.isDebugEnabled()) {
LOG.debug("Creating non employee travel expense note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
}
}
} else if (/*REFACTORME*/
getParameterEvaluatorService().getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.PREPAID_TRAVEL_PAYMENT_REASONS_PARM_NM, paymentReasonCode).evaluationSucceeds()) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText("Payment is for the following individuals/charges:");
pd.addNote(pnt);
if (LOG.isDebugEnabled()) {
LOG.info("Creating prepaid travel note note: " + pnt.getCustomerNoteText());
}
DisbursementVoucherPreConferenceDetail dvpcd = document.getDvPreConferenceDetail();
for (DisbursementVoucherPreConferenceRegistrant dvpcr : (List<DisbursementVoucherPreConferenceRegistrant>) dvpcd.getDvPreConferenceRegistrants()) {
if (line < (maxNoteLines - 8)) {
pnt = new PaymentNoteText();
pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
pnt.setCustomerNoteText(dvpcr.getDvConferenceRegistrantName() + " " + dvpcr.getDisbVchrExpenseAmount());
if (LOG.isDebugEnabled()) {
LOG.debug("Creating pre-paid conference registrants note: " + pnt.getCustomerNoteText());
}
pd.addNote(pnt);
}
}
}
// Get the original, raw form, note text from the DV document.
final String text = document.getDisbVchrCheckStubText();
if (!StringUtils.isBlank(text)) {
pd.addNotes(getPaymentSourceHelperService().buildNotesForCheckStubText(text, line));
}
return pd;
}
use of org.kuali.kfs.pdp.businessobject.PaymentAccountDetail in project cu-kfs by CU-CommunityApps.
the class CuPendingTransactionServiceImpl method populatePaymentGeneralLedgerPendingEntry.
/**
* Populates and stores a new GLPE for each account detail in the payment group.
*
* @param paymentGroup payment group to generate entries for
* @param achFdocTypeCode doc type for ach disbursements
* @param checkFdocTypeCod doc type for check disbursements
* @param reversal boolean indicating if this is a reversal
*/
protected void populatePaymentGeneralLedgerPendingEntry(PaymentGroup paymentGroup, String achFdocTypeCode, String checkFdocTypeCod, boolean reversal) {
List<PaymentAccountDetail> accountListings = new ArrayList<PaymentAccountDetail>();
GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();
for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
accountListings.addAll(paymentDetail.getAccountDetail());
}
// GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();
for (PaymentAccountDetail paymentAccountDetail : accountListings) {
GlPendingTransaction glPendingTransaction = new GlPendingTransaction();
glPendingTransaction.setSequenceNbr(new KualiInteger(sequenceHelper.getSequenceCounter()));
if (StringUtils.isNotBlank(paymentAccountDetail.getPaymentDetail().getFinancialSystemOriginCode()) && StringUtils.isNotBlank(paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode())) {
glPendingTransaction.setFdocRefTypCd(paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode());
glPendingTransaction.setFsRefOriginCd(paymentAccountDetail.getPaymentDetail().getFinancialSystemOriginCode());
} else {
glPendingTransaction.setFdocRefTypCd(PdpConstants.PDP_FDOC_TYPE_CODE);
glPendingTransaction.setFsRefOriginCd(PdpConstants.PDP_FDOC_ORIGIN_CODE);
}
glPendingTransaction.setFinancialBalanceTypeCode(org.kuali.kfs.sys.KFSConstants.BALANCE_TYPE_ACTUAL);
Date transactionTimestamp = new Date(dateTimeService.getCurrentDate().getTime());
glPendingTransaction.setTransactionDt(transactionTimestamp);
AccountingPeriod fiscalPeriod = accountingPeriodService.getByDate(new java.sql.Date(transactionTimestamp.getTime()));
glPendingTransaction.setUniversityFiscalYear(fiscalPeriod.getUniversityFiscalYear());
glPendingTransaction.setUnivFiscalPrdCd(fiscalPeriod.getUniversityFiscalPeriodCode());
glPendingTransaction.setAccountNumber(paymentAccountDetail.getAccountNbr());
glPendingTransaction.setSubAccountNumber(paymentAccountDetail.getSubAccountNbr());
glPendingTransaction.setChartOfAccountsCode(paymentAccountDetail.getFinChartCode());
if (paymentGroup.getDisbursementType().getCode().equals(PdpConstants.DisbursementTypeCodes.ACH)) {
glPendingTransaction.setFinancialDocumentTypeCode(achFdocTypeCode);
} else if (paymentGroup.getDisbursementType().getCode().equals(PdpConstants.DisbursementTypeCodes.CHECK)) {
glPendingTransaction.setFinancialDocumentTypeCode(checkFdocTypeCod);
}
glPendingTransaction.setFsOriginCd(PdpConstants.PDP_FDOC_ORIGIN_CODE);
glPendingTransaction.setFdocNbr(paymentGroup.getDisbursementNbr().toString());
// if stale
if (StringUtils.equals(FDOC_TYP_CD_STALE_CHECK, checkFdocTypeCod)) {
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
String clAcct = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.CLEARING_ACCOUNT);
String obCode = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.CLEARING_OBJECT_CODE);
String coaCode = parameterService.getParameterValueAsString(CheckReconciliationImportStep.class, CRConstants.CLEARING_COA);
// Use clearing parameters if stale
glPendingTransaction.setAccountNumber(clAcct);
glPendingTransaction.setFinancialObjectCode(obCode);
glPendingTransaction.setChartOfAccountsCode(coaCode);
glPendingTransaction.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
// KFSUPGRADE-943
glPendingTransaction.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
} else {
Boolean relieveLiabilities = paymentGroup.getBatch().getCustomerProfile().getRelieveLiabilities();
if ((relieveLiabilities != null) && (relieveLiabilities.booleanValue()) && paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode() != null) {
OffsetDefinition offsetDefinition = SpringContext.getBean(OffsetDefinitionService.class).getByPrimaryId(glPendingTransaction.getUniversityFiscalYear(), glPendingTransaction.getChartOfAccountsCode(), paymentAccountDetail.getPaymentDetail().getFinancialDocumentTypeCode(), glPendingTransaction.getFinancialBalanceTypeCode());
glPendingTransaction.setFinancialObjectCode(offsetDefinition != null ? offsetDefinition.getFinancialObjectCode() : paymentAccountDetail.getFinObjectCode());
glPendingTransaction.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
} else {
glPendingTransaction.setFinancialObjectCode(paymentAccountDetail.getFinObjectCode());
glPendingTransaction.setFinancialSubObjectCode(paymentAccountDetail.getFinSubObjectCode());
}
}
glPendingTransaction.setProjectCd(paymentAccountDetail.getProjectCode());
glPendingTransaction.setDebitCrdtCd(pdpUtilService.isDebit(paymentAccountDetail, reversal) ? KFSConstants.GL_DEBIT_CODE : KFSConstants.GL_CREDIT_CODE);
glPendingTransaction.setAmount(paymentAccountDetail.getAccountNetAmount().abs());
// Changes for Research Participant Upload
String trnDesc = StringUtils.EMPTY;
CustomerProfile customerProfile = paymentGroup.getBatch().getCustomerProfile();
// KFSUPGRADE-973
if (researchParticipantPaymentValidationService.isResearchParticipantPayment(customerProfile)) {
BusinessObjectEntry businessObjectEntry = dataDictionaryService.getDataDictionary().getBusinessObjectEntry(PaymentDetail.class.getName());
AttributeDefinition attributeDefinition = businessObjectEntry.getAttributeDefinition("paymentGroup.payeeName");
AttributeSecurity originalPayeeNameAttributeSecurity = attributeDefinition.getAttributeSecurity();
// This is a temporary work around for an issue introduced with KFSCNTRB-705.
if (ObjectUtils.isNotNull(originalPayeeNameAttributeSecurity)) {
String maskLiteral = ((MaskFormatterLiteral) originalPayeeNameAttributeSecurity.getMaskFormatter()).getLiteral();
trnDesc = maskLiteral;
}
} else {
String payeeName = paymentGroup.getPayeeName();
if (StringUtils.isNotBlank(payeeName)) {
trnDesc = payeeName.length() > 40 ? payeeName.substring(0, 40) : StringUtils.rightPad(payeeName, 40);
}
if (reversal) {
String poNbr = paymentAccountDetail.getPaymentDetail().getPurchaseOrderNbr();
if (StringUtils.isNotBlank(poNbr)) {
trnDesc += " " + (poNbr.length() > 9 ? poNbr.substring(0, 9) : StringUtils.rightPad(poNbr, 9));
}
String invoiceNbr = paymentAccountDetail.getPaymentDetail().getInvoiceNbr();
if (StringUtils.isNotBlank(invoiceNbr)) {
trnDesc += " " + (invoiceNbr.length() > 14 ? invoiceNbr.substring(0, 14) : StringUtils.rightPad(invoiceNbr, 14));
}
if (trnDesc.length() > 40) {
trnDesc = trnDesc.substring(0, 40);
}
}
}
glPendingTransaction.setDescription(trnDesc);
glPendingTransaction.setOrgDocNbr(paymentAccountDetail.getPaymentDetail().getOrganizationDocNbr());
glPendingTransaction.setOrgReferenceId(paymentAccountDetail.getOrgReferenceId());
glPendingTransaction.setFdocRefNbr(paymentAccountDetail.getPaymentDetail().getCustPaymentDocNbr());
// update the offset account if necessary
SpringContext.getBean(FlexibleOffsetAccountService.class).updateOffset(glPendingTransaction);
this.businessObjectService.save(glPendingTransaction);
sequenceHelper.increment();
if (bankService.isBankSpecificationEnabled()) {
this.populateBankOffsetEntry(paymentGroup, glPendingTransaction, sequenceHelper);
}
}
}
Aggregations