Search in sources :

Example 6 with TargetAccountingLine

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

the class CuAutoDisapproveDocumentsServiceImpl method buildSuccessMessage.

private String buildSuccessMessage(Document document) throws Exception {
    StringBuilder headerBuilder = new StringBuilder();
    headerBuilder.append(document.getDocumentNumber());
    headerBuilder.append(TAB);
    headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
    headerBuilder.append(TAB);
    headerBuilder.append(document.getDocumentHeader().getDocumentDescription());
    headerBuilder.append(TAB);
    headerBuilder.append(personService.getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getPrincipalName());
    headerBuilder.append(TAB);
    headerBuilder.append(personService.getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getName());
    headerBuilder.append(TAB);
    headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDateCreated());
    headerBuilder.append(TAB);
    ConfigurationService k = KRADServiceLocator.getKualiConfigurationService();
    StringBuilder routeBuilder = new StringBuilder();
    String url = k.getPropertyValueAsString("workflow.url");
    routeBuilder.append(url);
    routeBuilder.append("/RouteLog.do?routeHeaderId=");
    routeBuilder.append(document.getDocumentNumber());
    routeBuilder.append(TAB);
    headerBuilder.append(routeBuilder);
    List<ActionTaken> actions;
    // try {
    // actions = KEWServiceLocator.getActionTakenService().findByDocumentId(document.getDocumentHeader().getWorkflowDocument().getDocumentId());
    actions = KewApiServiceLocator.getWorkflowDocumentService().getAllActionsTaken(document.getDocumentNumber());
    ActionTaken max = null;
    for (ActionTaken at : actions) {
        if (ObjectUtils.isNull(max)) {
            max = at;
        } else if (at.getActionDate().compareTo(max.getActionDate()) > 0) {
            max = at;
        }
    }
    headerBuilder.append(personService.getPerson(max.getPrincipalId()).getPrincipalName());
    headerBuilder.append(TAB);
    headerBuilder.append(personService.getPerson(max.getPrincipalId()).getName());
    headerBuilder.append(TAB);
    headerBuilder.append(max.getActionDate());
    headerBuilder.append(TAB);
    headerBuilder.append(max.getActionTaken().getLabel());
    headerBuilder.append(TAB);
    // } catch (WorkflowException e) {
    // e.printStackTrace();
    // }
    String headerString = headerBuilder.toString();
    StringBuilder builder = new StringBuilder();
    if (document instanceof AccountingDocumentBase) {
        for (Object o : ((AccountingDocumentBase) document).getSourceAccountingLines()) {
            SourceAccountingLine sal = (SourceAccountingLine) o;
            builder.append(headerString);
            builder.append(sal.getChartOfAccountsCode());
            builder.append(TAB);
            builder.append(sal.getAccountNumber());
            builder.append(TAB);
            builder.append(sal.getAmount());
            builder.append(TAB);
            builder.append(sal.getAccount().getOrganizationCode());
            builder.append(TAB);
            builder.append(KFSConstants.NEWLINE);
        }
        for (Object o : ((AccountingDocumentBase) document).getTargetAccountingLines()) {
            TargetAccountingLine tal = (TargetAccountingLine) o;
            builder.append(headerString);
            builder.append(tal.getChartOfAccountsCode());
            builder.append(TAB);
            builder.append(tal.getAccountNumber());
            builder.append(TAB);
            builder.append(tal.getAmount());
            builder.append(TAB);
            builder.append(tal.getAccount().getOrganizationCode());
            builder.append(TAB);
            builder.append(KFSConstants.NEWLINE);
        }
    }
    return builder.toString();
}
Also used : TargetAccountingLine(org.kuali.kfs.sys.businessobject.TargetAccountingLine) ConfigurationService(org.kuali.rice.core.api.config.property.ConfigurationService) AccountingDocumentBase(org.kuali.kfs.sys.document.AccountingDocumentBase) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) ActionTaken(org.kuali.rice.kew.api.action.ActionTaken)

Example 7 with TargetAccountingLine

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

the class CuProcurementCardDocument method getAccountNumberForSearching.

public String getAccountNumberForSearching() {
    ProcurementCardTransactionDetail transaction = (ProcurementCardTransactionDetail) transactionEntries.get(0);
    TargetAccountingLine tal = (TargetAccountingLine) transaction.getTargetAccountingLines().get(0);
    String acctNbr = tal.getAccountNumber();
    return acctNbr;
}
Also used : ProcurementCardTargetAccountingLine(org.kuali.kfs.fp.businessobject.ProcurementCardTargetAccountingLine) TargetAccountingLine(org.kuali.kfs.sys.businessobject.TargetAccountingLine) ProcurementCardTransactionDetail(org.kuali.kfs.fp.businessobject.ProcurementCardTransactionDetail)

Example 8 with TargetAccountingLine

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

the class AccountingLineAccessibleValidation method onlyObjectCodeChanged.

/**
 * Checks to see if the object code is the only difference between the original accounting line and the updated accounting line.
 *
 * @param accountingLine
 * @param updatedAccountingLine
 * @return true if only the object code has changed on the accounting line, false otherwise
 */
protected boolean onlyObjectCodeChanged(AccountingLine accountingLine, AccountingLine updatedAccountingLine) {
    // no changes, return false
    if (accountingLine.isLike(updatedAccountingLine)) {
        return false;
    }
    // copy the updatedAccountLine so we can set the object code on the copy of the updated accounting line
    // to be the original value for comparison purposes
    AccountingLine updatedLine = null;
    if (updatedAccountingLine.isSourceAccountingLine()) {
        updatedLine = new SourceAccountingLine();
    } else {
        updatedLine = new TargetAccountingLine();
    }
    updatedLine.copyFrom(updatedAccountingLine);
    updatedLine.setFinancialObjectCode(accountingLine.getFinancialObjectCode());
    // if they're the same, the only change was the object code
    return (accountingLine.isLike(updatedLine));
}
Also used : SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) TargetAccountingLine(org.kuali.kfs.sys.businessobject.TargetAccountingLine) AccountingLine(org.kuali.kfs.sys.businessobject.AccountingLine) TargetAccountingLine(org.kuali.kfs.sys.businessobject.TargetAccountingLine) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine)

Example 9 with TargetAccountingLine

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

the class KualiAccountingDocumentActionBase method getTargetAccountingLine.

protected TargetAccountingLine getTargetAccountingLine(ActionForm form, HttpServletRequest request) {
    int lineIndex = getSelectedLine(request);
    TargetAccountingLine line = (TargetAccountingLine) ((KualiAccountingDocumentFormBase) form).getFinancialDocument().getTargetAccountingLine(lineIndex);
    return line;
}
Also used : TargetAccountingLine(org.kuali.kfs.sys.businessobject.TargetAccountingLine)

Aggregations

TargetAccountingLine (org.kuali.kfs.sys.businessobject.TargetAccountingLine)9 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)4 ProcurementCardTargetAccountingLine (org.kuali.kfs.fp.businessobject.ProcurementCardTargetAccountingLine)2 Date (java.sql.Date)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 ProcurementCardSourceAccountingLine (org.kuali.kfs.fp.businessobject.ProcurementCardSourceAccountingLine)1 ProcurementCardTransactionDetail (org.kuali.kfs.fp.businessobject.ProcurementCardTransactionDetail)1 PersistenceService (org.kuali.kfs.krad.service.PersistenceService)1 AccountingLine (org.kuali.kfs.sys.businessobject.AccountingLine)1 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)1 AccountingDocumentBase (org.kuali.kfs.sys.document.AccountingDocumentBase)1 AddAccountingLineEvent (org.kuali.kfs.sys.document.validation.event.AddAccountingLineEvent)1 KfsParameterConstants (org.kuali.kfs.sys.service.impl.KfsParameterConstants)1 ConfigurationService (org.kuali.rice.core.api.config.property.ConfigurationService)1 ActionTaken (org.kuali.rice.kew.api.action.ActionTaken)1