use of org.kuali.kfs.sys.businessobject.AccountingLine in project cu-kfs by CU-CommunityApps.
the class PreEncumbranceDocument method customizeExplicitGeneralLedgerPendingEntry.
@Override
public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry) {
explicitEntry.setFinancialBalanceTypeCode(BALANCE_TYPE_PRE_ENCUMBRANCE);
AccountingLine accountingLine = (AccountingLine) postable;
// set the reversal date to what was chosen by the user in the interface
if (ObjectUtils.isNotNull(getReversalDate()) && ObjectUtils.isNull(explicitEntry.getFinancialDocumentReversalDate())) {
explicitEntry.setFinancialDocumentReversalDate(getReversalDate());
}
explicitEntry.setTransactionEntryProcessedTs(null);
if (accountingLine.isSourceAccountingLine()) {
explicitEntry.setTransactionEncumbranceUpdateCode(KFSConstants.ENCUMB_UPDT_DOCUMENT_CD);
explicitEntry.setReferenceFinancialSystemOriginationCode(SpringContext.getBean(HomeOriginationService.class).getHomeOrigination().getFinSystemHomeOriginationCode());
explicitEntry.setReferenceFinancialDocumentNumber(accountingLine.getReferenceNumber());
explicitEntry.setReferenceFinancialDocumentTypeCode(explicitEntry.getFinancialDocumentTypeCode());
// "PE"
} else if (accountingLine.isTargetAccountingLine()) {
explicitEntry.setTransactionEncumbranceUpdateCode(KFSConstants.ENCUMB_UPDT_REFERENCE_DOCUMENT_CD);
explicitEntry.setReferenceFinancialSystemOriginationCode(SpringContext.getBean(HomeOriginationService.class).getHomeOrigination().getFinSystemHomeOriginationCode());
explicitEntry.setReferenceFinancialDocumentNumber(accountingLine.getReferenceNumber());
// "PE"
explicitEntry.setReferenceFinancialDocumentTypeCode(explicitEntry.getFinancialDocumentTypeCode());
}
}
use of org.kuali.kfs.sys.businessobject.AccountingLine in project cu-kfs by CU-CommunityApps.
the class CuPendingTransactionServiceImpl method generateCreditMemoReversalEntries.
/**
* Generates the reversal entries for the given input VendorCreditMemoDocument.
*
* @param doc
* the VendorCreditMemoDocument for which we generate the reversal entries
* @param sequenceHelper
*/
protected void generateCreditMemoReversalEntries(VendorCreditMemoDocument cm) {
cm.setGeneralLedgerPendingEntries(new ArrayList());
boolean success = true;
GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper(getNextAvailableSequence(cm.getDocumentNumber()));
if (!cm.isSourceVendor()) {
LOG.debug("generateEntriesCreditMemo() create encumbrance entries for CM against a PO or PREQ (not vendor)");
PurchaseOrderDocument po = null;
if (cm.isSourceDocumentPurchaseOrder()) {
LOG.debug("generateEntriesCreditMemo() PO type");
po = SpringContext.getBean(PurchaseOrderService.class).getCurrentPurchaseOrder(cm.getPurchaseOrderIdentifier());
} else if (cm.isSourceDocumentPaymentRequest()) {
LOG.debug("generateEntriesCreditMemo() PREQ type");
po = SpringContext.getBean(PurchaseOrderService.class).getCurrentPurchaseOrder(cm.getPaymentRequestDocument().getPurchaseOrderIdentifier());
}
// for CM cancel or create, do not book encumbrances if PO is CLOSED, but do update the amounts on the PO
List encumbrances = getCreditMemoEncumbrance(cm, po);
if (!(PurchaseOrderStatuses.APPDOC_CLOSED.equals(po.getApplicationDocumentStatus()))) {
if (encumbrances != null) {
cm.setGenerateEncumbranceEntries(true);
// even if generating encumbrance entries on cancel, call is the same because the method gets negative amounts
// from
// the map so Debits on negatives = a credit
cm.setDebitCreditCodeForGLEntries(GL_DEBIT_CODE);
for (Iterator iter = encumbrances.iterator(); iter.hasNext(); ) {
AccountingLine accountingLine = (AccountingLine) iter.next();
if (accountingLine.getAmount().compareTo(ZERO) != 0) {
cm.generateGeneralLedgerPendingEntries(accountingLine, sequenceHelper);
// increment for the next line
sequenceHelper.increment();
}
}
}
}
}
List<SummaryAccount> summaryAccounts = SpringContext.getBean(PurapAccountingService.class).generateSummaryAccountsWithNoZeroTotalsNoUseTax(cm);
if (summaryAccounts != null) {
LOG.debug("generateEntriesCreditMemo() now book the actuals");
cm.setGenerateEncumbranceEntries(false);
for (Iterator iter = summaryAccounts.iterator(); iter.hasNext(); ) {
SummaryAccount summaryAccount = (SummaryAccount) iter.next();
cm.generateGeneralLedgerPendingEntries(summaryAccount.getAccount(), sequenceHelper);
// increment for the next line
sequenceHelper.increment();
}
// generate offset accounts for use tax if it exists (useTaxContainers will be empty if not a use tax document)
List<UseTaxContainer> useTaxContainers = SpringContext.getBean(PurapAccountingService.class).generateUseTaxAccount(cm);
for (UseTaxContainer useTaxContainer : useTaxContainers) {
PurApItemUseTax offset = useTaxContainer.getUseTax();
List<SourceAccountingLine> accounts = useTaxContainer.getAccounts();
for (SourceAccountingLine sourceAccountingLine : accounts) {
cm.generateGeneralLedgerPendingEntries(sourceAccountingLine, sequenceHelper, useTaxContainer.getUseTax());
// increment for the next line
sequenceHelper.increment();
}
}
// manually save cm account change tables (CAMS needs this)
purapAccountRevisionService.cancelCreditMemoAccountRevisions(cm.getItems(), cm.getPostingYearFromPendingGLEntries(), cm.getPostingPeriodCodeFromPendingGLEntries());
}
getBusinessObjectService().save(cm.getGeneralLedgerPendingEntries());
}
use of org.kuali.kfs.sys.businessobject.AccountingLine in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method processAccountingLines.
/**
* @param transDoc
* @param transForm
* @param lineSet
*/
protected void processAccountingLines(AccountingDocument transDoc, KualiAccountingDocumentFormBase transForm, String lineSet) {
// figure out which set of lines we're looking at
List formLines;
boolean source;
if (lineSet.equals(KFSConstants.SOURCE)) {
formLines = transDoc.getSourceAccountingLines();
source = true;
} else {
formLines = transDoc.getTargetAccountingLines();
source = false;
}
// find and process corresponding form and baselines
int index = 0;
for (Iterator i = formLines.iterator(); i.hasNext(); index++) {
AccountingLine formLine = (AccountingLine) i.next();
// update sales tax required attribute for view
checkSalesTax(transDoc, formLine, source, false, index);
}
}
use of org.kuali.kfs.sys.businessobject.AccountingLine in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method refreshSalesTaxInfo.
/**
* This method refreshes the sales tax fields on a refresh or tab toggle so that all the information that was
* there before is still there after a state change
*
* @param form
*/
protected void refreshSalesTaxInfo(ActionForm form) {
KualiAccountingDocumentFormBase accountingForm = (KualiAccountingDocumentFormBase) form;
AccountingDocument document = (AccountingDocument) accountingForm.getDocument();
List sourceLines = document.getSourceAccountingLines();
List targetLines = document.getTargetAccountingLines();
handleSalesTaxRequiredAllLines(accountingForm, sourceLines);
handleSalesTaxRequiredAllLines(accountingForm, targetLines);
AccountingLine newTargetLine = accountingForm.getNewTargetLine();
AccountingLine newSourceLine = accountingForm.getNewSourceLine();
if (newTargetLine != null) {
handleSalesTaxRequired(document, newTargetLine, false, true, 0);
}
if (newSourceLine != null) {
handleSalesTaxRequired(document, newSourceLine, true, true, 0);
}
}
use of org.kuali.kfs.sys.businessobject.AccountingLine in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method uploadAccountingLines.
/**
* This method determines whether we are uploading source or target lines, and then calls uploadAccountingLines
* directly on the document object. This method handles retrieving the actual upload file as an input stream into
* the document.
*
* @param isSource
* @param form
* @throws FileNotFoundException
* @throws IOException
*/
protected void uploadAccountingLines(boolean isSource, ActionForm form) throws FileNotFoundException, IOException {
KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
List importedLines = null;
AccountingDocument financialDocument = tmpForm.getFinancialDocument();
AccountingLineParser accountingLineParser = financialDocument.getAccountingLineParser();
// import the lines
String errorPathPrefix = null;
try {
if (isSource) {
errorPathPrefix = KFSConstants.DOCUMENT_PROPERTY_NAME + "." + KFSConstants.SOURCE_ACCOUNTING_LINE_ERRORS;
FormFile sourceFile = tmpForm.getSourceFile();
checkUploadFile(sourceFile);
importedLines = accountingLineParser.importSourceAccountingLines(sourceFile.getFileName(), sourceFile.getInputStream(), financialDocument);
} else {
errorPathPrefix = KFSConstants.DOCUMENT_PROPERTY_NAME + "." + KFSConstants.TARGET_ACCOUNTING_LINE_ERRORS;
FormFile targetFile = tmpForm.getTargetFile();
checkUploadFile(targetFile);
importedLines = accountingLineParser.importTargetAccountingLines(targetFile.getFileName(), targetFile.getInputStream(), financialDocument);
}
} catch (AccountingLineParserException e) {
GlobalVariables.getMessageMap().putError(errorPathPrefix, e.getErrorKey(), e.getErrorParameters());
}
// add line to list for those lines which were successfully imported
if (importedLines != null) {
for (Object importedLineObject : importedLines) {
AccountingLine importedLine = (AccountingLine) importedLineObject;
insertAccountingLine(isSource, tmpForm, importedLine);
}
}
}
Aggregations