Example usage for org.apache.commons.lang StringUtils upperCase

List of usage examples for org.apache.commons.lang StringUtils upperCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils upperCase.

Prototype

public static String upperCase(String str) 

Source Link

Document

Converts a String to upper case as per String#toUpperCase() .

Usage

From source file:org.jboss.tools.openshift.reddeer.enums.AuthenticationMethod.java

public static AuthenticationMethod valueOfIgnoreCase(String value) {
    return valueOf(StringUtils.upperCase(value));
}

From source file:org.jspringbot.keyword.string.ToUpperCase.java

public Object execute(Object[] params) {
    return StringUtils.upperCase(String.valueOf(params[0]));
}

From source file:org.jumpmind.metl.core.runtime.component.ModelAttributeScriptHelper.java

public String upper() {
    String text = value != null ? value.toString() : "";
    return StringUtils.upperCase(text);
}

From source file:org.kuali.kfs.module.ar.businessobject.AccountsReceivableDocumentHeader.java

/**
 * Gets the customerNumber attribute.//from  w  w w .j  a  v  a  2s. com
 *
 * @return Returns the customerNumber
 *
 */
@Override
public String getCustomerNumber() {
    return StringUtils.upperCase(customerNumber);
}

From source file:org.kuali.kfs.module.ar.document.CustomerInvoiceDocument.java

/**
 * If this invoice is a reversal, set the open indicator to false
 *
 * @see org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase#prepareForSave()
 *///from   w w w .  j  a  v  a 2s  . c  o  m
@Override
public void prepareForSave() {
    if (this.isInvoiceReversal()) {
        setOpenInvoiceIndicator(false);
    }

    //  make sure the docHeader gets its doc total right.  This is here because there's an ordering
    // bug in the struts classes for invoice that is preventing this from being set right.  There is
    // probably a better way to fix this that can be pursued later.
    getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(getTotalDollarAmount());

    captureWorkflowHeaderInformation();

    //  invoice recurrence stuff, if there is a recurrence object
    if (ObjectUtils.isNotNull(this.getCustomerInvoiceRecurrenceDetails()) && getProcessRecurrenceFlag()) {

        //  wire up the recurrence customer number if one exists
        if (ObjectUtils.isNull(this.getCustomerInvoiceRecurrenceDetails().getCustomerNumber())) {
            this.getCustomerInvoiceRecurrenceDetails()
                    .setCustomerNumber(this.getAccountsReceivableDocumentHeader().getCustomerNumber());
        }

        customerInvoiceRecurrenceDetails.setInvoiceNumber(getDocumentNumber());

        // calc recurrence number if only end-date specified
        if (ObjectUtils.isNull(this.getCustomerInvoiceRecurrenceDetails().getDocumentTotalRecurrenceNumber())
                && ObjectUtils
                        .isNotNull(this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceEndDate())) {

            Calendar beginCalendar = Calendar.getInstance();
            beginCalendar.setTime(this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceBeginDate());
            Date beginDate = this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceBeginDate();
            Calendar endCalendar = Calendar.getInstance();

            endCalendar.setTime(this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceEndDate());
            Date endDate = this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceEndDate();
            Calendar nextCalendar = Calendar.getInstance();
            Date nextDate = beginDate;

            int totalRecurrences = 0;
            int addCounter = 0;
            String intervalCode = this.getCustomerInvoiceRecurrenceDetails()
                    .getDocumentRecurrenceIntervalCode();
            if (intervalCode.equals("M")) {
                addCounter = 1;
            }
            if (intervalCode.equals("Q")) {
                addCounter = 3;
            }
            /* perform this loop while begin_date is less than or equal to end_date */
            while (!(beginDate.after(endDate))) {
                beginCalendar.setTime(beginDate);
                beginCalendar.add(Calendar.MONTH, addCounter);
                beginDate = KfsDateUtils.convertToSqlDate(beginCalendar.getTime());
                totalRecurrences++;

                nextDate = beginDate;
                nextCalendar.setTime(nextDate);
                nextCalendar.add(Calendar.MONTH, addCounter);
                nextDate = KfsDateUtils.convertToSqlDate(nextCalendar.getTime());
                if (endDate.after(beginDate) && endDate.before(nextDate)) {
                    totalRecurrences++;
                    break;
                }
            }
            if (totalRecurrences > 0) {
                this.getCustomerInvoiceRecurrenceDetails().setDocumentTotalRecurrenceNumber(totalRecurrences);
            }
        }

        //  calc end-date if only recurrence-number is specified
        if (ObjectUtils.isNotNull(this.getCustomerInvoiceRecurrenceDetails().getDocumentTotalRecurrenceNumber())
                && ObjectUtils
                        .isNull(this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceEndDate())) {

            Calendar beginCalendar = Calendar.getInstance();
            beginCalendar.setTime(new Timestamp(
                    this.getCustomerInvoiceRecurrenceDetails().getDocumentRecurrenceBeginDate().getTime()));
            Calendar endCalendar = Calendar.getInstance();
            endCalendar = beginCalendar;

            int addCounter = 0;
            Integer documentTotalRecurrenceNumber = this.getCustomerInvoiceRecurrenceDetails()
                    .getDocumentTotalRecurrenceNumber();
            String intervalCode = this.getCustomerInvoiceRecurrenceDetails()
                    .getDocumentRecurrenceIntervalCode();
            if (intervalCode.equals("M")) {
                addCounter = -1;
                addCounter += documentTotalRecurrenceNumber * 1;
            }
            if (intervalCode.equals("Q")) {
                addCounter = -3;
                addCounter += documentTotalRecurrenceNumber * 3;
            }
            endCalendar.add(Calendar.MONTH, addCounter);
            this.getCustomerInvoiceRecurrenceDetails()
                    .setDocumentRecurrenceEndDate(KfsDateUtils.convertToSqlDate(endCalendar.getTime()));
        }
    }

    // Force upper case
    //TODO Force to upper case here since DD forceUpperCase doesn't work. Revert this temp fix after Rice fix.
    setBilledByOrganizationCode(StringUtils.upperCase(billedByOrganizationCode));
    accountsReceivableDocumentHeader.setProcessingOrganizationCode(
            StringUtils.upperCase(accountsReceivableDocumentHeader.getProcessingOrganizationCode()));
    accountsReceivableDocumentHeader
            .setCustomerNumber(StringUtils.upperCase(accountsReceivableDocumentHeader.getCustomerNumber()));

    if (ObjectUtils.isNull(getCustomerShipToAddressIdentifier())) {
        setCustomerShipToAddress(null);
        setCustomerShipToAddressOnInvoice(null);
    }

}

From source file:org.kuali.kfs.module.ar.report.service.impl.AccountsReceivableReportServiceImpl.java

/**
 * @see org.kuali.kfs.module.ar.report.service.AccountsReceivableReportService#generateCreditMemo(org.kuali.kfs.module.ar.document.CustomerCreditMemoDocument)
 *//*from  w w w.ja v  a 2  s . c o m*/
@Override
public File generateCreditMemo(CustomerCreditMemoDocument creditMemo) throws WorkflowException {
    CustomerCreditMemoReportDataHolder reportDataHolder = new CustomerCreditMemoReportDataHolder();
    String invoiceNumber = creditMemo.getFinancialDocumentReferenceInvoiceNumber();
    CustomerInvoiceDocument invoice = (CustomerInvoiceDocument) documentService
            .getByDocumentHeaderId(invoiceNumber);
    String custID = invoice.getAccountsReceivableDocumentHeader().getCustomerNumber();

    Map<String, String> creditMemoMap = new HashMap<String, String>();
    creditMemoMap.put("docNumber", creditMemo.getDocumentNumber());
    creditMemoMap.put("refDocNumber", invoice.getDocumentNumber());
    Date date = creditMemo.getFinancialSystemDocumentHeader().getDocumentFinalDate();
    if (ObjectUtils.isNotNull(date)) {
        creditMemoMap.put("createDate", dateTimeService.toDateString(date));
    }
    reportDataHolder.setCreditmemo(creditMemoMap);
    Map<String, String> customerMap = new HashMap<String, String>();
    customerMap.put("id", custID);
    customerMap.put("billToName", invoice.getBillingAddressName());
    customerMap.put("billToStreetAddressLine1", invoice.getBillingLine1StreetAddress());
    customerMap.put("billToStreetAddressLine2", invoice.getBillingLine2StreetAddress());
    String billCityStateZip = "";

    if (KFSConstants.COUNTRY_CODE_UNITED_STATES.equals(invoice.getBillingCountryCode())) {
        billCityStateZip = generateCityStateZipLine(invoice.getBillingCityName(), invoice.getBillingStateCode(),
                invoice.getBillingZipCode());
    } else {
        billCityStateZip = generateCityStateZipLine(invoice.getBillingCityName(),
                invoice.getBillingAddressInternationalProvinceName(),
                invoice.getBillingInternationalMailCode());
        if (StringUtils.isNotBlank(invoice.getBillingCountryCode())) {
            Country country = countryService.getCountry(invoice.getBillingCountryCode());
            if (ObjectUtils.isNotNull(country)) {
                customerMap.put("billToCountry", country.getName());
            }
        }
    }
    customerMap.put("billToCityStateZip", billCityStateZip);

    reportDataHolder.setCustomer(customerMap);

    Map<String, String> invoiceMap = new HashMap<String, String>();
    if (ObjectUtils.isNotNull(invoice.getCustomerPurchaseOrderNumber())) {
        invoiceMap.put("poNumber", invoice.getCustomerPurchaseOrderNumber());
    }
    if (invoice.getCustomerPurchaseOrderDate() != null) {
        invoiceMap.put("poDate", dateTimeService.toDateString(invoice.getCustomerPurchaseOrderDate()));
    }

    String initiatorID = invoice.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
    Entity user = KimApiServiceLocator.getIdentityService().getEntityByPrincipalId(initiatorID);

    if (user == null) {
        throw new RuntimeException("User '" + initiatorID + "' could not be retrieved.");
    }

    invoiceMap.put("invoicePreparer",
            user.getDefaultName().getFirstName() + " " + user.getDefaultName().getLastName());
    invoiceMap.put("headerField",
            (ObjectUtils.isNull(invoice.getInvoiceHeaderText()) ? "" : invoice.getInvoiceHeaderText()));
    invoiceMap.put("billingOrgName", invoice.getBilledByOrganization().getOrganizationName());
    invoiceMap.put("pretaxAmount", invoice.getInvoiceItemPreTaxAmountTotal().toString());
    boolean salesTaxInd = parameterService.getParameterValueAsBoolean("KFS-AR", "Document",
            ArConstants.ENABLE_SALES_TAX_IND);
    if (salesTaxInd) {
        invoiceMap.put("taxAmount", invoice.getInvoiceItemTaxAmountTotal().toString());
        // KualiDecimal taxPercentage = invoice.getStateTaxPercent().add(invoice.getLocalTaxPercent());
        KualiDecimal taxPercentage = new KualiDecimal(6.85);
        invoiceMap.put("taxPercentage", "*** " + taxPercentage.toString() + "%");
    }
    invoiceMap.put("invoiceAmountDue", invoice.getSourceTotal().toString());
    invoiceMap.put("ocrLine", "");
    reportDataHolder.setInvoice(invoiceMap);

    Map<String, String> sysinfoMap = new HashMap<String, String>();
    InstitutionNameValueFinder finder = new InstitutionNameValueFinder();

    Organization billingOrg = invoice.getBilledByOrganization();
    String chart = billingOrg.getChartOfAccountsCode();
    String org = billingOrg.getOrganizationCode();
    Map<String, String> criteria = new HashMap<String, String>();
    criteria.put("chartOfAccountsCode", chart);
    criteria.put("organizationCode", org);
    OrganizationOptions orgOptions = businessObjectService.findByPrimaryKey(OrganizationOptions.class,
            criteria);

    String fiscalYear = universityDateService.getCurrentFiscalYear().toString();
    criteria = new HashMap<String, String>();

    Organization processingOrg = invoice.getAccountsReceivableDocumentHeader().getProcessingOrganization();

    criteria.put("universityFiscalYear", fiscalYear);
    criteria.put("processingChartOfAccountCode", processingOrg.getChartOfAccountsCode());
    criteria.put("processingOrganizationCode", processingOrg.getOrganizationCode());
    SystemInformation sysinfo = businessObjectService.findByPrimaryKey(SystemInformation.class, criteria);

    sysinfoMap.put("univName", StringUtils.upperCase(finder.getValue()));
    String univAddr = processingOrg.getOrganizationCityName() + ", " + processingOrg.getOrganizationStateCode()
            + " " + processingOrg.getOrganizationZipCode();
    sysinfoMap.put("univAddr", univAddr);
    if (sysinfo != null) {
        sysinfoMap.put("FEIN", "FED ID #" + sysinfo.getUniversityFederalEmployerIdentificationNumber());
    }

    reportDataHolder.setSysinfo(sysinfoMap);

    invoiceMap.put("billingOrgFax", (String) phoneNumberFormatter
            .format(phoneNumberFormatter.convertFromPresentationFormat(orgOptions.getOrganizationFaxNumber())));
    invoiceMap.put("billingOrgPhone", (String) phoneNumberFormatter.format(
            phoneNumberFormatter.convertFromPresentationFormat(orgOptions.getOrganizationPhoneNumber())));

    creditMemo.populateCustomerCreditMemoDetailsAfterLoad();
    List<CustomerCreditMemoDetail> detailsList = creditMemo.getCreditMemoDetails();
    List<CustomerCreditMemoDetailReportDataHolder> details = new ArrayList<CustomerCreditMemoDetailReportDataHolder>();
    CustomerCreditMemoDetailReportDataHolder detailDataHolder;
    for (CustomerCreditMemoDetail detail : detailsList) {
        if (detail.getCreditMemoLineTotalAmount().isGreaterThan(KualiDecimal.ZERO)) {
            detailDataHolder = new CustomerCreditMemoDetailReportDataHolder(detail,
                    detail.getCustomerInvoiceDetail());
            details.add(detailDataHolder);
        }
    }

    reportDataHolder.setDetails(details);

    Date runDate = dateTimeService.getCurrentSqlDate();
    File report = customerCreditMemoReportService.generateReport(reportDataHolder, runDate);

    return report;
}

From source file:org.kuali.kfs.module.ar.report.service.impl.AccountsReceivableReportServiceImpl.java

/**
 * @see org.kuali.kfs.module.ar.report.service.AccountsReceivableReportService#generateInvoice(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument)
 *//*from w w  w  .  j a  v a  2  s .c o m*/
@Override
public File generateInvoice(CustomerInvoiceDocument invoice) {

    CustomerInvoiceReportDataHolder reportDataHolder = new CustomerInvoiceReportDataHolder();
    String custID = invoice.getAccountsReceivableDocumentHeader().getCustomerNumber();
    Customer cust = customerService.getByPrimaryKey(custID);
    Integer customerBillToAddressIdentifier = invoice.getCustomerBillToAddressIdentifier();
    Integer customerShipToAddressIdentifier = invoice.getCustomerShipToAddressIdentifier();
    CustomerAddress billToAddr = customerAddressService.getByPrimaryKey(custID,
            customerBillToAddressIdentifier);
    CustomerAddress shipToAddr = customerAddressService.getByPrimaryKey(custID,
            customerShipToAddressIdentifier);

    Map<String, String> customerMap = new HashMap<String, String>();
    customerMap.put("id", custID);
    if (billToAddr != null) {
        customerMap.put("billToName", billToAddr.getCustomerAddressName());
        customerMap.put("billToStreetAddressLine1", billToAddr.getCustomerLine1StreetAddress());
        customerMap.put("billToStreetAddressLine2", billToAddr.getCustomerLine2StreetAddress());
        String billCityStateZip = "";
        if (billToAddr.getCustomerCountryCode().equals("US")) {
            billCityStateZip = generateCityStateZipLine(billToAddr.getCustomerCityName(),
                    billToAddr.getCustomerStateCode(), billToAddr.getCustomerZipCode());
        } else {
            billCityStateZip = generateCityStateZipLine(billToAddr.getCustomerCityName(),
                    billToAddr.getCustomerAddressInternationalProvinceName(),
                    billToAddr.getCustomerInternationalMailCode());
            customerMap.put("billToCountry", billToAddr.getCustomerCountry().getName());
        }
        customerMap.put("billToCityStateZip", billCityStateZip);
    }
    if (shipToAddr != null) {
        customerMap.put("shipToName", shipToAddr.getCustomerAddressName());
        customerMap.put("shipToStreetAddressLine1", shipToAddr.getCustomerLine1StreetAddress());
        customerMap.put("shipToStreetAddressLine2", shipToAddr.getCustomerLine2StreetAddress());
        String shipCityStateZip = "";
        if (shipToAddr.getCustomerCountryCode().equals("US")) {
            shipCityStateZip = generateCityStateZipLine(shipToAddr.getCustomerCityName(),
                    shipToAddr.getCustomerStateCode(), shipToAddr.getCustomerZipCode());
        } else {
            shipCityStateZip = generateCityStateZipLine(shipToAddr.getCustomerCityName(),
                    shipToAddr.getCustomerAddressInternationalProvinceName(),
                    shipToAddr.getCustomerInternationalMailCode());
            customerMap.put("shipToCountry", shipToAddr.getCustomerCountry().getName());
        }
        customerMap.put("shipToCityStateZip", shipCityStateZip);
    }
    reportDataHolder.setCustomer(customerMap);

    Map<String, String> invoiceMap = new HashMap<String, String>();
    invoiceMap.put("poNumber", invoice.getCustomerPurchaseOrderNumber());
    if (invoice.getCustomerPurchaseOrderDate() != null) {
        invoiceMap.put("poDate", dateTimeService.toDateString(invoice.getCustomerPurchaseOrderDate()));
    }

    String initiatorID = invoice.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
    Entity user = KimApiServiceLocator.getIdentityService().getEntityByPrincipalId(initiatorID);

    if (user == null) {
        throw new RuntimeException("User '" + initiatorID + "' could not be retrieved.");
    }

    invoiceMap.put("invoicePreparer",
            user.getDefaultName().getFirstName() + " " + user.getDefaultName().getLastName());
    invoiceMap.put("headerField", invoice.getInvoiceHeaderText());
    invoiceMap.put("customerOrg", invoice.getBilledByOrganizationCode());
    invoiceMap.put("docNumber", invoice.getDocumentNumber());
    invoiceMap.put("invoiceDueDate", dateTimeService.toDateString(invoice.getInvoiceDueDate()));
    invoiceMap.put("createDate", dateTimeService
            .toDateString(invoice.getDocumentHeader().getWorkflowDocument().getDateCreated().toDate()));
    invoiceMap.put("invoiceAttentionLineText", StringUtils.upperCase(invoice.getInvoiceAttentionLineText()));
    invoiceMap.put("billingOrgName", invoice.getBilledByOrganization().getOrganizationName());
    invoiceMap.put("pretaxAmount",
            currencyFormatter.format(invoice.getInvoiceItemPreTaxAmountTotal()).toString());
    boolean salesTaxInd = parameterService.getParameterValueAsBoolean("KFS-AR", "Document",
            ArConstants.ENABLE_SALES_TAX_IND);
    if (salesTaxInd) {
        invoiceMap.put("taxAmount",
                currencyFormatter.format(invoice.getInvoiceItemTaxAmountTotal()).toString());
        invoiceMap.put("taxPercentage", ""); // suppressing this as its useless ... see KULAR-415
    }
    invoiceMap.put("invoiceAmountDue", currencyFormatter.format(invoice.getSourceTotal()).toString());
    invoiceMap.put("invoiceTermsText", invoice.getInvoiceTermsText());

    String ocrLine = ocrLineService.generateOCRLine(invoice.getSourceTotal(), custID,
            invoice.getDocumentNumber());
    invoiceMap.put("ocrLine", ocrLine);
    List<CustomerInvoiceDetail> detailsList = (List<CustomerInvoiceDetail>) customerInvoiceDetailService
            .getCustomerInvoiceDetailsForInvoice(invoice);
    CustomerInvoiceDetail firstDetail = detailsList.get(0);
    String firstChartCode = firstDetail.getChartOfAccountsCode();
    String firstAccount = firstDetail.getAccountNumber();
    invoiceMap.put("chartAndAccountOfFirstItem", firstChartCode + firstAccount);

    Map<String, String> sysinfoMap = new HashMap<String, String>();

    Organization billingOrg = invoice.getBilledByOrganization();
    String chart = billingOrg.getChartOfAccountsCode();
    String org = billingOrg.getOrganizationCode();
    Map<String, String> criteria = new HashMap<String, String>();
    criteria.put("chartOfAccountsCode", chart);
    criteria.put("organizationCode", org);
    OrganizationOptions orgOptions = businessObjectService.findByPrimaryKey(OrganizationOptions.class,
            criteria);

    String fiscalYear = universityDateService.getCurrentFiscalYear().toString();
    criteria = new HashMap<String, String>();

    Organization processingOrg = invoice.getAccountsReceivableDocumentHeader().getProcessingOrganization();

    criteria.put("universityFiscalYear", fiscalYear);
    criteria.put("processingChartOfAccountCode", processingOrg.getChartOfAccountsCode());
    criteria.put("processingOrganizationCode", processingOrg.getOrganizationCode());
    SystemInformation sysinfo = businessObjectService.findByPrimaryKey(SystemInformation.class, criteria);

    sysinfoMap.put("univName", StringUtils.upperCase(sysinfo.getOrganizationCheckPayableToName()));
    sysinfoMap.put("univAddr", generateCityStateZipLine(processingOrg.getOrganizationCityName(),
            processingOrg.getOrganizationStateCode(), processingOrg.getOrganizationZipCode()));
    if (sysinfo != null) {
        sysinfoMap.put("FEIN", "FED ID #" + sysinfo.getUniversityFederalEmployerIdentificationNumber());
    }
    sysinfoMap.put("checkPayableTo", orgOptions.getOrganizationCheckPayableToName());
    sysinfoMap.put("remitToName", orgOptions.getOrganizationRemitToAddressName());
    sysinfoMap.put("remitToAddressLine1", orgOptions.getOrganizationRemitToLine1StreetAddress());
    sysinfoMap.put("remitToAddressLine2", orgOptions.getOrganizationRemitToLine2StreetAddress());

    sysinfoMap.put("remitToCityStateZip", generateCityStateZipLine(orgOptions.getOrganizationRemitToCityName(),
            orgOptions.getOrganizationRemitToStateCode(), orgOptions.getOrganizationRemitToZipCode()));

    invoiceMap.put("billingOrgFax", (String) phoneNumberFormatter
            .format(phoneNumberFormatter.convertFromPresentationFormat(orgOptions.getOrganizationFaxNumber())));
    invoiceMap.put("billingOrgPhone", (String) phoneNumberFormatter.format(
            phoneNumberFormatter.convertFromPresentationFormat(orgOptions.getOrganizationPhoneNumber())));

    invoiceMap.put("orgOptionsMessageText", orgOptions.getOrganizationMessageText());

    reportDataHolder.setSysinfo(sysinfoMap);
    reportDataHolder.setDetails(detailsList);
    reportDataHolder.setInvoice(invoiceMap);

    Date runDate = dateTimeService.getCurrentSqlDate();
    File report = customerInvoiceReportService.generateReport(reportDataHolder, runDate);

    invoice.setPrintDate(runDate);
    documentService.updateDocument(invoice);
    return report;
}

From source file:org.kuali.kfs.module.ar.report.service.impl.AccountsReceivableReportServiceImpl.java

/**
 * Constructs the data holder to be used for
 *
 * @param billingChartCode//w w w . j  ava  2  s  . c  om
 * @param billingOrgCode
 * @param customerNumber
 * @param details
 * @return
 */
public File createStatement(String billingChartCode, String billingOrgCode, String customerNumber,
        Organization processingOrg, List<CustomerStatementDetailReportDataHolder> details,
        String statementFormat, String zeroBalance,
        CustomerStatementResultHolder customerStatementResultHolder) {

    CustomerStatementReportDataHolder reportDataHolder = new CustomerStatementReportDataHolder();
    CustomerAddress billToAddr = customerAddressService.getPrimaryAddress(customerNumber);

    Map<String, String> customerMap = new HashMap<String, String>();
    customerMap.put("id", customerNumber);
    if (billToAddr != null) {
        customerMap.put("billToName", billToAddr.getCustomerAddressName());
        customerMap.put("billToStreetAddressLine1", billToAddr.getCustomerLine1StreetAddress());
        customerMap.put("billToStreetAddressLine2", billToAddr.getCustomerLine2StreetAddress());
        String billCityStateZip = "";
        if (billToAddr.getCustomerCountryCode().equals("US")) {
            billCityStateZip = generateCityStateZipLine(billToAddr.getCustomerCityName(),
                    billToAddr.getCustomerStateCode(), billToAddr.getCustomerZipCode());
        } else {
            billCityStateZip = generateCityStateZipLine(billToAddr.getCustomerCityName(),
                    billToAddr.getCustomerAddressInternationalProvinceName(),
                    billToAddr.getCustomerInternationalMailCode());
            customerMap.put("billToCountry", billToAddr.getCustomerCountry().getName());
        }
        customerMap.put("billToCityStateZip", billCityStateZip);
    }

    reportDataHolder.setCustomer(customerMap);

    Map<String, String> invoiceMap = new HashMap<String, String>();
    invoiceMap.clear();
    invoiceMap.put("createDate", dateTimeService.toDateString(dateTimeService.getCurrentDate()));
    invoiceMap.put("customerOrg", billingOrgCode);
    Organization billingOrg = orgService.getByPrimaryId(billingChartCode, billingOrgCode);
    invoiceMap.put("billingOrgName", billingOrg.getOrganizationName());

    KualiDecimal amountDue = KualiDecimal.ZERO;
    KualiDecimal previousBalance = KualiDecimal.ZERO;
    String lastReportedDate = "";
    CustomerBillingStatement customerBillingStatement = getCustomerBillingStatement(customerNumber);
    if (ObjectUtils.isNotNull(customerBillingStatement)) {
        previousBalance = customerBillingStatement.getPreviouslyBilledAmount();
        if (statementFormat.equals(ArConstants.STATEMENT_FORMAT_DETAIL)) {
            amountDue = previousBalance;
            lastReportedDate = dateTimeService.toDateString(customerBillingStatement.getReportedDate());
        }
    }

    invoiceMap.put("previousBalance", currencyFormatter.format(previousBalance).toString());
    invoiceMap.put("lastReportedDate", lastReportedDate);

    for (CustomerStatementDetailReportDataHolder data : details) {
        if (data.getFinancialDocumentTotalAmountCharge() != null) {
            amountDue = amountDue.add(data.getFinancialDocumentTotalAmountCharge());
        }
        if (data.getFinancialDocumentTotalAmountCredit() != null) {
            amountDue = amountDue.subtract(data.getFinancialDocumentTotalAmountCredit());
        }
    }

    // This customer has a zero balance and so we do not need to generate the report if the include zero balance is "No."
    if (amountDue.equals(KualiDecimal.ZERO) && zeroBalance.equals(ArConstants.INCLUDE_ZERO_BALANCE_NO)) {
        return null;
    }

    customerStatementResultHolder.setCurrentBilledAmount(amountDue);

    invoiceMap.put("amountDue", currencyFormatter.format(amountDue).toString());
    invoiceMap.put("dueDate", calculateDueDate());

    String ocrLine = ocrLineService.generateOCRLine(amountDue, customerNumber, null);
    invoiceMap.put("ocrLine", ocrLine);

    Map<String, String> sysinfoMap = new HashMap<String, String>();
    Map<String, String> criteria = new HashMap<String, String>();
    criteria.put("chartOfAccountsCode", billingChartCode);
    criteria.put("organizationCode", billingOrgCode);
    OrganizationOptions orgOptions = businessObjectService.findByPrimaryKey(OrganizationOptions.class,
            criteria);

    sysinfoMap.put("checkPayableTo", orgOptions.getOrganizationCheckPayableToName());
    sysinfoMap.put("remitToName", orgOptions.getOrganizationRemitToAddressName());
    sysinfoMap.put("remitToAddressLine1", orgOptions.getOrganizationRemitToLine1StreetAddress());
    sysinfoMap.put("remitToAddressLine2", orgOptions.getOrganizationRemitToLine2StreetAddress());
    sysinfoMap.put("remitToCityStateZip", generateCityStateZipLine(orgOptions.getOrganizationRemitToCityName(),
            orgOptions.getOrganizationRemitToStateCode(), orgOptions.getOrganizationRemitToZipCode()));

    invoiceMap.put("billingOrgFax", (String) phoneNumberFormatter
            .format(phoneNumberFormatter.convertFromPresentationFormat(orgOptions.getOrganizationFaxNumber())));
    invoiceMap.put("billingOrgPhone", (String) phoneNumberFormatter.format(
            phoneNumberFormatter.convertFromPresentationFormat(orgOptions.getOrganizationPhoneNumber())));

    String fiscalYear = universityDateService.getCurrentFiscalYear().toString();

    criteria.clear();
    criteria.put("universityFiscalYear", fiscalYear);
    criteria.put("processingChartOfAccountCode", processingOrg.getChartOfAccountsCode());
    criteria.put("processingOrganizationCode", processingOrg.getOrganizationCode());
    SystemInformation sysinfo = businessObjectService.findByPrimaryKey(SystemInformation.class, criteria);

    sysinfoMap.put("univName", StringUtils.upperCase(sysinfo.getOrganizationCheckPayableToName()));
    sysinfoMap.put("univAddr", generateCityStateZipLine(processingOrg.getOrganizationCityName(),
            processingOrg.getOrganizationStateCode(), processingOrg.getOrganizationZipCode()));
    if (sysinfo != null) {
        sysinfoMap.put("FEIN", "FED ID #" + sysinfo.getUniversityFederalEmployerIdentificationNumber());
    }

    KualiDecimal bal = (statementFormat.equals(ArConstants.STATEMENT_FORMAT_DETAIL)) ? previousBalance
            : KualiDecimal.ZERO;
    calculateAgingAmounts(details, invoiceMap, bal);

    reportDataHolder.setSysinfo(sysinfoMap);
    reportDataHolder.setDetails(details);
    reportDataHolder.setInvoice(invoiceMap);

    Date runDate = dateTimeService.getCurrentSqlDate();
    File f = customerStatementReportService.generateReport(reportDataHolder, runDate, statementFormat);
    return f;
}

From source file:org.kuali.kfs.module.ec.document.web.struts.CertificationRecreateForm.java

/**
 * force the input data as upper case/*w  w w . j  a  v a2s . co m*/
 */
public void forceInputAsUpperCase() {

    String reportNumber = this.getEffortCertificationReportNumber();
    this.setEffortCertificationReportNumber(StringUtils.upperCase(reportNumber));
}

From source file:org.kuali.kfs.module.tem.document.service.impl.TaxableRamificationDocumentServiceImpl.java

/**
 * populate the given tax ramification document with the information provided by the given travel advance
 *//* w w  w . j a v  a  2 s .  c  o m*/
protected void populateTaxRamificationDocument(TaxableRamificationDocument taxRamificationDocument,
        TravelAdvance travelAdvance) {
    taxRamificationDocument.setArInvoiceDocNumber(travelAdvance.getArInvoiceDocNumber());

    taxRamificationDocument.setTravelAdvanceDocumentNumber(travelAdvance.getDocumentNumber());
    taxRamificationDocument.setTravelAdvance(travelAdvance);

    TravelAuthorizationDocument travelAuthorizationDocument = this
            .getTravelAuthorizationDocument(travelAdvance);
    String travelDocumentIdentifier = travelAuthorizationDocument.getTravelDocumentIdentifier();
    taxRamificationDocument.setTravelDocumentIdentifier(travelDocumentIdentifier);

    TravelerDetail travelerDetail = travelAuthorizationDocument.getTraveler();
    this.refreshTraverler(travelerDetail);
    taxRamificationDocument.setTravelerDetailId(travelerDetail.getId());
    taxRamificationDocument.setTravelerDetail(travelerDetail);

    AccountsReceivableCustomerInvoice customerInvoice = this.getOpenCustomerInvoice(travelAdvance);
    taxRamificationDocument.setOpenAmount(customerInvoice.getOpenAmount());
    taxRamificationDocument.setInvoiceAmount(customerInvoice.getTotalDollarAmount());
    taxRamificationDocument.setDueDate(customerInvoice.getInvoiceDueDate());

    String taxRamificationNotice = this.getNotificationText();
    taxRamificationDocument.setTaxableRamificationNotice(taxRamificationNotice);

    taxRamificationDocument.getDocumentHeader()
            .setOrganizationDocumentNumber(String.valueOf(travelDocumentIdentifier));

    String travelerPrincipalName = StringUtils.upperCase(travelerDetail.getPrincipalName());
    String description = this.getNotificationSubject() + travelerPrincipalName;
    taxRamificationDocument.getDocumentHeader().setDocumentDescription(
            StringUtils.left(description, KFSConstants.getMaxLengthOfDocumentDescription()));
}