Search in sources :

Example 1 with SourceAccountingLine

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

the class AdvanceDepositServiceImpl method setupSourceAccountingLine.

protected void setupSourceAccountingLine(AchIncomeTransaction transaction, AdvanceDepositDocument advanceDepositDocument, String chart, String objectCode, String account) {
    SourceAccountingLine sourceAccountingLine = new SourceAccountingLine();
    sourceAccountingLine.setSequenceNumber(advanceDepositDocument.getNextSourceLineNumber());
    sourceAccountingLine.setChartOfAccountsCode(chart);
    sourceAccountingLine.setPostingYear(getSourceAccountingLinePostingYear(sourceAccountingLine));
    sourceAccountingLine.setFinancialObjectCode(objectCode);
    setSourceAccountingLineAccountNumber(account, sourceAccountingLine);
    sourceAccountingLine.setFinancialDocumentLineDescription(transaction.getPayerName());
    setSourceAccountingLineAmount(transaction, sourceAccountingLine, chart, objectCode);
    sourceAccountingLine.setOverrideCode(AccountingLineOverride.CODE.NONE);
    sourceAccountingLine.setPostingYear(advanceDepositDocument.getPostingYear());
    sourceAccountingLine.setDocumentNumber(advanceDepositDocument.getDocumentNumber());
    List<SourceAccountingLine> sourceLines = new ArrayList<>();
    sourceLines.add(sourceAccountingLine);
    advanceDepositDocument.setSourceAccountingLines(sourceLines);
}
Also used : ArrayList(java.util.ArrayList) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine)

Example 2 with SourceAccountingLine

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

the class PurchasingAccountsPayableDocumentBase method populateAccountsForRouting.

/**
 * Makes sure that accounts for routing has been generated, so that other information can be retrieved from that
 */
protected void populateAccountsForRouting() {
    SpringContext.getBean(PurapAccountingService.class).updateAccountAmounts(this);
    setAccountsForRouting(SpringContext.getBean(PurapAccountingService.class).generateSummary(getItems()));
    // need to refresh to get the references for the searchable attributes (ie status) and for invoking route levels (ie account
    // objects) -hjs
    refreshNonUpdateableReferences();
    for (SourceAccountingLine sourceLine : getAccountsForRouting()) {
        sourceLine.refreshNonUpdateableReferences();
    }
}
Also used : SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) PurapAccountingService(org.kuali.kfs.module.purap.service.PurapAccountingService)

Example 3 with SourceAccountingLine

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

the class KualiAccountingDocumentActionBase method insertSourceLine.

/**
 * This action executes an insert of a SourceAccountingLine into a document only after validating the accounting line and
 * checking any appropriate business rules.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception
 */
public ActionForward insertSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;
    SourceAccountingLine line = financialDocumentForm.getNewSourceLine();
    // populate chartOfAccountsCode from account number if accounts cant cross chart and Javascript is turned off
    // SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(line);
    boolean rulePassed = true;
    // DV acct line amount got error during form populate; should not insert this line.  KFSUPGRADE-847
    MessageMap msgMap = GlobalVariables.getMessageMap();
    if (msgMap.hasErrors() && msgMap.getErrorMessages().keySet().contains("newSourceLine.amount") && financialDocumentForm.getDocument() instanceof DisbursementVoucherDocument) {
        rulePassed = false;
    }
    // before we check the regular rules we need to check the sales tax rules
    // TODO: Refactor rules so we no longer have to call this before a copy of the
    // accountingLine
    rulePassed &= checkSalesTax((AccountingDocument) financialDocumentForm.getDocument(), line, true, true, 0);
    // check any business rules
    rulePassed &= SpringContext.getBean(KualiRuleService.class).applyRules(new AddAccountingLineEvent(KFSConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME, financialDocumentForm.getDocument(), line));
    if (rulePassed) {
        // add accountingLine
        SpringContext.getBean(PersistenceService.class).refreshAllNonUpdatingReferences(line);
        insertAccountingLine(true, financialDocumentForm, line);
        // clear the used newTargetLine
        financialDocumentForm.setNewSourceLine(null);
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PersistenceService(org.kuali.kfs.krad.service.PersistenceService) AddAccountingLineEvent(org.kuali.kfs.sys.document.validation.event.AddAccountingLineEvent) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) MessageMap(org.kuali.kfs.krad.util.MessageMap) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 4 with SourceAccountingLine

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

the class KualiAccountingDocumentActionBase method getSourceAccountingLine.

/**
 * This method is a helper method that will return a source accounting line. The reason we're making it protected in here is so
 * that we can override this method in some of the modules. PurchasingActionBase is one of the subclasses that will be
 * overriding this, because in PurchasingActionBase, we'll need to get the source accounting line using both an item index and
 * an account index.
 *
 * @param form
 * @param request
 * @param isSource
 * @return
 */
protected SourceAccountingLine getSourceAccountingLine(ActionForm form, HttpServletRequest request) {
    int lineIndex = getSelectedLine(request);
    SourceAccountingLine line = (SourceAccountingLine) ObjectUtils.deepCopy(((KualiAccountingDocumentFormBase) form).getFinancialDocument().getSourceAccountingLine(lineIndex));
    return line;
}
Also used : SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine)

Example 5 with SourceAccountingLine

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

the class CuProcurementCardDocument method customizeExplicitGeneralLedgerPendingEntry.

@Override
public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry) {
    Date temp = getProcurementCardTransactionPostingDetailDate();
    if (temp != null && allowBackpost(temp)) {
        Integer prevFiscYr = getPreviousFiscalYear();
        explicitEntry.setUniversityFiscalPeriodCode(FINAL_ACCOUNTING_PERIOD);
        explicitEntry.setUniversityFiscalYear(prevFiscYr);
        List<SourceAccountingLine> srcLines = getSourceAccountingLines();
        for (SourceAccountingLine src : srcLines) {
            src.setPostingYear(prevFiscYr);
        }
        List<TargetAccountingLine> trgLines = getTargetAccountingLines();
        for (TargetAccountingLine trg : trgLines) {
            trg.setPostingYear(prevFiscYr);
        }
    }
}
Also used : ProcurementCardTargetAccountingLine(org.kuali.kfs.fp.businessobject.ProcurementCardTargetAccountingLine) TargetAccountingLine(org.kuali.kfs.sys.businessobject.TargetAccountingLine) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) ProcurementCardSourceAccountingLine(org.kuali.kfs.fp.businessobject.ProcurementCardSourceAccountingLine) Date(java.sql.Date)

Aggregations

SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)33 ArrayList (java.util.ArrayList)14 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)14 HashMap (java.util.HashMap)7 Iterator (java.util.Iterator)7 Map (java.util.Map)5 AccountingLine (org.kuali.kfs.sys.businessobject.AccountingLine)5 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)4 Date (java.sql.Date)4 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)4 PurchaseOrderAccount (org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount)4 PurapAccountingService (org.kuali.kfs.module.purap.service.PurapAccountingService)4 List (java.util.List)3 Test (org.junit.Test)3 PurApItemUseTax (org.kuali.kfs.module.purap.businessobject.PurApItemUseTax)3 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)3 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)3 SummaryAccount (org.kuali.kfs.module.purap.util.SummaryAccount)3 UseTaxContainer (org.kuali.kfs.module.purap.util.UseTaxContainer)3 TargetAccountingLine (org.kuali.kfs.sys.businessobject.TargetAccountingLine)3