Example usage for org.joda.time LocalDate getYear

List of usage examples for org.joda.time LocalDate getYear

Introduction

In this page you can find the example usage for org.joda.time LocalDate getYear.

Prototype

public int getYear() 

Source Link

Document

Get the year field value.

Usage

From source file:module.mission.domain.EmailDigesterUtil.java

License:Open Source License

public static void executeTask() {
    I18N.setLocale(new Locale(CoreConfiguration.getConfiguration().defaultLocale()));
    for (Person person : getPeopleToProcess()) {

        final User user = person.getUser();
        if (user.getPerson() != null && user.getExpenditurePerson() != null) {
            Authenticate.mock(user, "System Automation");

            try {
                final MissionYear missionYear = MissionYear.getCurrentYear();
                final LocalDate today = new LocalDate();
                final MissionYear previousYear = today.getMonthOfYear() == Month.JANUARY
                        ? MissionYear.findOrCreateMissionYear(today.getYear() - 1)
                        : null;/* w  w  w .j av a  2 s. co m*/

                Map<String, List<MissionProcessBean>> processesTypeMap = new LinkedHashMap<>();
                processesTypeMap.put(TAKEN, getMissionProcessBeans(getTaken(missionYear, previousYear)));
                if (previousYear == null) {
                    processesTypeMap.put(PENDING_APPROVAL,
                            getMissionProcessBeans(missionYear.getPendingAproval()));
                    processesTypeMap.put(PENDING_VEHICLE,
                            getMissionProcessBeans(missionYear.getPendingVehicleAuthorization()));
                    processesTypeMap.put(PENDING_AUTHORIZATION,
                            getMissionProcessBeans(missionYear.getPendingAuthorization()));
                    processesTypeMap.put(PENDING_FUND,
                            getMissionProcessBeans(missionYear.getPendingFundAllocation()));
                    processesTypeMap.put(PENDING_PROCESSING,
                            getMissionProcessBeans(missionYear.getPendingProcessingPersonelInformation()));
                } else {
                    processesTypeMap.put(PENDING_APPROVAL, getMissionProcessBeans(
                            previousYear.getPendingAproval(() -> missionYear.getPendingAproval())));
                    processesTypeMap.put(PENDING_VEHICLE,
                            getMissionProcessBeans(previousYear.getPendingVehicleAuthorization(
                                    () -> missionYear.getPendingVehicleAuthorization())));
                    processesTypeMap.put(PENDING_AUTHORIZATION, getMissionProcessBeans(
                            previousYear.getPendingAuthorization(() -> missionYear.getPendingAuthorization())));
                    processesTypeMap.put(PENDING_FUND, getMissionProcessBeans(previousYear
                            .getPendingFundAllocation(() -> missionYear.getPendingFundAllocation())));
                    processesTypeMap.put(PENDING_PROCESSING,
                            getMissionProcessBeans(previousYear.getPendingProcessingPersonelInformation(
                                    () -> missionYear.getPendingProcessingPersonelInformation())));
                }

                final int totalPending = processesTypeMap.values().stream().map(Collection::size).reduce(0,
                        Integer::sum);

                if (totalPending > 0) {
                    Message.fromSystem().to(Group.users(person.getUser()))
                            .template("expenditures.mission.pending")
                            .parameter("applicationTitle",
                                    Bennu.getInstance().getConfiguration().getApplicationSubTitle()
                                            .getContent())
                            .parameter("applicationUrl", CoreConfiguration.getConfiguration().applicationUrl())
                            .parameter("processesByType", processesTypeMap)
                            .parameter("processesTotal", totalPending).and().send();
                }
            } finally {
                Authenticate.unmock();
            }
        }
    }
}

From source file:module.mission.domain.EmailDigesterUtil.java

License:Open Source License

private static Collection<Person> getPeopleToProcess() {
    final Set<Person> people = new HashSet<Person>();
    final LocalDate today = new LocalDate();
    final ExpenditureTrackingSystem expendituresSystem = ExpenditureTrackingSystem.getInstance();
    for (User user : MissionSystem.getInstance().getVehicleAuthorizersSet()) {
        people.add(user.getExpenditurePerson());
    }//from  w  w  w  .ja v  a  2s . c om

    for (final Authorization authorization : expendituresSystem.getAuthorizationsSet()) {
        if (authorization.isValidFor(today)) {
            final Person person = authorization.getPerson();
            if (person.getOptions().getReceiveNotificationsByEmail()) {
                people.add(person);
            }
        }
    }
    for (final RoleType roleType : RoleType.values()) {
        addPeopleWithRole(people, roleType);
    }
    for (final AccountingUnit accountingUnit : expendituresSystem.getAccountingUnitsSet()) {
        addPeople(people, accountingUnit.getPeopleSet());
        addPeople(people, accountingUnit.getProjectAccountantsSet());
        addPeople(people, accountingUnit.getResponsiblePeopleSet());
        addPeople(people, accountingUnit.getResponsibleProjectAccountantsSet());
        addPeople(people, accountingUnit.getTreasuryMembersSet());
    }
    final MissionYear missionYear = MissionYear.getCurrentYear();
    addRequestorsAndResponsibles(people, missionYear);
    if (today.getMonthOfYear() == Month.JANUARY) {
        final MissionYear previousYear = MissionYear.findOrCreateMissionYear(today.getYear() - 1);
        addRequestorsAndResponsibles(people, previousYear);
    }
    return people;
}

From source file:module.mission.domain.util.MissionPendingProcessCounter.java

License:Open Source License

@Override
public int getCount() {
    try {/*from ww  w . ja va 2 s .  com*/
        final MissionYear missionYear = MissionYear.getCurrentYear();
        final LocalDate today = new LocalDate();
        final MissionYear previousYear = today.getMonthOfYear() == Month.JANUARY
                ? MissionYear.findOrCreateMissionYear(today.getYear() - 1)
                : null;

        final int takenByUser = (int) (missionYear.getTakenStream().count()
                + (previousYear == null ? 0 : previousYear.getTakenStream().count()));
        final long pendingApprovalCount = missionYear.getPendingAproval().count()
                + (previousYear == null ? 0 : previousYear.getPendingAproval().count());
        final long pendingAuthorizationCount = missionYear.getPendingAuthorization().count()
                + (previousYear == null ? 0 : previousYear.getPendingAuthorization().count());
        final long pendingFundAllocationCount = missionYear.getPendingFundAllocation().count()
                + (previousYear == null ? 0 : previousYear.getPendingFundAllocation().count());
        final long pendingProcessingCount = missionYear.getPendingProcessingPersonelInformation().count()
                + (previousYear == null ? 0 : previousYear.getPendingProcessingPersonelInformation().count());

        return (int) (takenByUser + pendingApprovalCount + pendingAuthorizationCount
                + pendingFundAllocationCount + pendingProcessingCount);
    } catch (final Throwable t) {
        t.printStackTrace();
        //throw new Error(t);
        return 0;
    }
}

From source file:module.siadap.domain.util.SiadapMiscUtilClass.java

License:Open Source License

/**
 * /*from  ww w . j a v  a 2 s .  co m*/
 * @param date
 *            the {@link LocalDate} that will be converted to represent the
 *            date at the beginning of the day
 * @return an {@link ReadableInstant} with the same day/month/year but the
 *         last instant of it, that is the last hour, last minute, last
 *         second etc...
 */
public static ReadableInstant convertDateToEndOfDay(LocalDate date) {
    ReadableInstant newLocalDate = null;
    if (date != null) {
        return new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), 23, 59, 59, 59);

    }
    return newLocalDate;

}

From source file:module.siadap.domain.wrappers.PersonSiadapWrapper.java

License:Open Source License

/**
 * Verifies that the given date is indeed within the {@link #getYear()} year. If it isn't, it will throw a SiadapException
 * /*from w ww.j av a2s  .  c om*/
 * @param dateToVerify
 *            the date to verify
 */
private void verifyDate(LocalDate dateToVerify) {
    if (!getConfiguration().containsYear(dateToVerify.getYear())) {
        throw new SiadapException("resources/SiadapResources", "manage.workingUnitOrEvaluator.invalid.date",
                String.valueOf(getYear()));
    }
}

From source file:module.siadap.domain.wrappers.PersonSiadapWrapper.java

License:Open Source License

@Atomic
public void changeEvaluatorTo(Person newEvaluator, LocalDate dateOfChange) {

    SiadapActionChangeValidatorEnum.EVALUATOR_CHANGE.validate(this);

    verifyDate(dateOfChange);/*  w  w  w.ja va  2  s.  c o  m*/
    @SuppressWarnings("boxing")
    LocalDate startOfYear = SiadapMiscUtilClass.firstDayOfYear(dateOfChange.getYear());
    LocalDate endOfYear = SiadapMiscUtilClass.lastDayOfYear(dateOfChange.getYear());
    SiadapYearConfiguration configuration = getConfiguration();
    AccountabilityType evaluationRelation = configuration.getEvaluationRelation();
    boolean needToAddAcc = true;
    for (Accountability accountability : getParentAccountabilityTypes(evaluationRelation)) {
        if (accountability.isActive(getConfiguration().getLastDayForAccountabilities())
                && accountability.getParent() instanceof Person
                && accountability.getChild() instanceof Person) {
            // let's close it if we have a different person here
            if (!accountability.getParent().equals(newEvaluator)) {
                accountability.editDates(accountability.getBeginDate(), dateOfChange, null);
            } else {
                needToAddAcc = false;
            }
        }
    }
    if (needToAddAcc) {
        // let's
        newEvaluator.addChild(getPerson(), evaluationRelation, dateOfChange, null, null);

    }

}

From source file:module.workingCapital.domain.EmailDigesterUtil.java

License:Open Source License

public static void executeTask() {
    final DateTime now = new DateTime();

    I18N.setLocale(new Locale(CoreConfiguration.getConfiguration().defaultLocale()));
    for (Person person : getPeopleToProcess()) {

        final User user = person.getUser();
        if (user.getPerson() != null && user.getExpenditurePerson() != null) {
            Authenticate.mock(user, "System Automation");

            try {
                final LocalizedString applicationTitle = Bennu.getInstance().getConfiguration()
                        .getApplicationSubTitle();
                final String applicationUrl = CoreConfiguration.getConfiguration().applicationUrl();
                final WorkingCapitalYear workingCapitalYear = WorkingCapitalYear.getCurrentYear();
                final LocalDate today = new LocalDate();
                final WorkingCapitalYear previousYear = today.getMonthOfYear() == Month.JANUARY
                        ? WorkingCapitalYear.findOrCreate(today.getYear() - 1)
                        : null;/*from   w  w w . j av a  2 s .  c  om*/

                Map<String, List<WorkingCapitalProcessBean>> processesTypeMap = new LinkedHashMap<>();
                if (previousYear == null) {
                    processesTypeMap.put(TAKEN, getMissionProcessBeans(workingCapitalYear.getTaken()));
                    processesTypeMap.put(PENDING_APPROVAL,
                            getMissionProcessBeans(workingCapitalYear.getPendingAproval()));
                    processesTypeMap.put(PENDING_VERIFICATION,
                            getMissionProcessBeans(workingCapitalYear.getPendingVerification()));
                    processesTypeMap.put(PENDING_PROCESSING,
                            getMissionProcessBeans(workingCapitalYear.getPendingProcessing()));
                    processesTypeMap.put(PENDING_AUTHORIZATION,
                            getMissionProcessBeans(workingCapitalYear.getPendingAuthorization()));
                    processesTypeMap.put(PENDING_PAYMENT,
                            getMissionProcessBeans(workingCapitalYear.getPendingPayment()));
                } else {
                    processesTypeMap.put(TAKEN,
                            getMissionProcessBeans(previousYear.getTaken(workingCapitalYear.getTaken())));
                    processesTypeMap.put(PENDING_APPROVAL, getMissionProcessBeans(
                            previousYear.getPendingAproval(workingCapitalYear.getPendingAproval())));
                    processesTypeMap.put(PENDING_VERIFICATION, getMissionProcessBeans(
                            previousYear.getPendingVerification(workingCapitalYear.getPendingVerification())));
                    processesTypeMap.put(PENDING_PROCESSING, getMissionProcessBeans(
                            previousYear.getPendingProcessing(workingCapitalYear.getPendingProcessing())));
                    processesTypeMap.put(PENDING_AUTHORIZATION, getMissionProcessBeans(previousYear
                            .getPendingAuthorization(workingCapitalYear.getPendingAuthorization())));
                    processesTypeMap.put(PENDING_PAYMENT, getMissionProcessBeans(
                            previousYear.getPendingPayment(workingCapitalYear.getPendingPayment())));
                }

                final int totalPending = processesTypeMap.values().stream().map(Collection::size).reduce(0,
                        Integer::sum);

                if (totalPending > 0) {
                    Message.fromSystem().to(Group.users(user)).template("expenditures.capital.pending")
                            .parameter("applicationTitle", applicationTitle)
                            .parameter("applicationUrl", applicationUrl)
                            .parameter("processesByType", processesTypeMap)
                            .parameter("processesTotal", totalPending).and().send();
                }

                for (final WorkingCapital workingCapital : user.getPerson()
                        .getMovementResponsibleWorkingCapitalsSet()) {
                    final Integer year = workingCapital.getWorkingCapitalYear().getYear();
                    if (year.intValue() < now.getYear()
                            || (year.intValue() == now.getYear() && now.getMonthOfYear() == 12)
                                    && now.getDayOfMonth() > 15) {
                        final PresentableProcessState state = workingCapital
                                .getPresentableAcquisitionProcessState();
                        if (state == WorkingCapitalProcessState.WORKING_CAPITAL_AVAILABLE) {
                            Message.fromSystem().to(Group.users(user))
                                    .template("expenditures.capital.pending.termination")
                                    .parameter("applicationTitle", applicationTitle)
                                    .parameter("applicationUrl", applicationUrl)
                                    .parameter("unit", workingCapital.getUnit().getPresentationName())
                                    .parameter("year", workingCapital.getWorkingCapitalYear().getYear()).and()
                                    .send();
                        }
                    }
                }
            } finally {
                Authenticate.unmock();
            }
        }
    }
}

From source file:module.workingCapital.domain.EmailDigesterUtil.java

License:Open Source License

private static Collection<Person> getPeopleToProcess() {
    final Set<Person> people = new HashSet<Person>();
    final LocalDate today = new LocalDate();
    final ExpenditureTrackingSystem instance = ExpenditureTrackingSystem.getInstance();
    for (final Authorization authorization : instance.getAuthorizationsSet()) {
        if (authorization.isValidFor(today)) {
            final Person person = authorization.getPerson();
            if (person.getOptions().getReceiveNotificationsByEmail()) {
                people.add(person);/*from   www  .  j a va2 s . c o m*/
            }
        }
    }
    for (final RoleType roleType : RoleType.values()) {
        addPeopleWithRole(people, roleType);
    }
    for (final AccountingUnit accountingUnit : instance.getAccountingUnitsSet()) {
        addPeople(people, accountingUnit.getPeopleSet());
        addPeople(people, accountingUnit.getProjectAccountantsSet());
        addPeople(people, accountingUnit.getResponsiblePeopleSet());
        addPeople(people, accountingUnit.getResponsibleProjectAccountantsSet());
        addPeople(people, accountingUnit.getTreasuryMembersSet());
    }
    final WorkingCapitalYear workingCapitalYear = WorkingCapitalYear.getCurrentYear();
    addMovementResponsibles(people, workingCapitalYear);
    if (today.getMonthOfYear() == Month.JANUARY) {
        final WorkingCapitalYear previousYear = WorkingCapitalYear.findOrCreate(today.getYear() - 1);
        addMovementResponsibles(people, previousYear);
    }

    return people;
}

From source file:module.workingCapital.domain.WorkingCapital.java

License:Open Source License

private void collectAuthorizations(final SortedMap<Person, Set<Authorization>> authorizations,
        final Unit unit) {
    for (final Authorization authorization : unit.getAuthorizationsSet()) {
        int year = getWorkingCapitalYear().getYear().intValue();
        final LocalDate begin = authorization.getStartDate();
        final LocalDate end = authorization.getEndDate();
        if ((end != null && end.getYear() < year) || begin != null && begin.getYear() > year) {
            continue;
        }//from w w w . j  a  v  a2  s  . c om
        final Person person = authorization.getPerson().getUser().getPerson();
        if (person != null) {
            if (!authorizations.containsKey(person)) {
                authorizations.put(person,
                        new TreeSet<Authorization>(Authorization.COMPARATOR_BY_NAME_AND_DATE));
            }
            authorizations.get(person).add(authorization);
        }
    }
    if (authorizations.isEmpty()) {
        final Unit parent = unit.getParentUnit();
        if (parent != null) {
            collectAuthorizations(authorizations, parent);
        }
    }
}

From source file:module.workingCapital.presentationTier.action.WorkingCapitalAction.java

License:Open Source License

private ActionForward exportInfoToExcel(Set<WorkingCapitalProcess> processes, WorkingCapitalContext context,
        HttpServletResponse response) throws Exception {

    final Integer year = context.getWorkingCapitalYear().getYear();
    SheetData<WorkingCapitalProcess> sheetData = new SheetData<WorkingCapitalProcess>(processes) {
        @Override/*from   w  w  w  .ja va  2 s.  c  o  m*/
        protected void makeLine(WorkingCapitalProcess workingCapitalProcess) {
            if (workingCapitalProcess == null) {
                return;
            }
            final WorkingCapital workingCapital = workingCapitalProcess.getWorkingCapital();
            final WorkingCapitalInitialization initialization = workingCapital
                    .getWorkingCapitalInitialization();
            final AccountingUnit accountingUnit = workingCapital.getAccountingUnit();

            addCell(getLocalizedMessate("label.module.workingCapital.year"), year);
            addCell(getLocalizedMessate("label.module.workingCapital"),
                    workingCapitalProcess.getWorkingCapital().getUnit().getPresentationName());
            addCell(getLocalizedMessate("WorkingCapitalProcessState"),
                    workingCapitalProcess.getPresentableAcquisitionProcessState().getLocalizedName());
            addCell(getLocalizedMessate("label.module.workingCapital.unit.responsible"),
                    getUnitResponsibles(workingCapital));
            addCell(getLocalizedMessate("label.module.workingCapital.initialization.accountingUnit"),
                    accountingUnit == null ? "" : accountingUnit.getName());

            addCell(getLocalizedMessate("label.module.workingCapital.requestingDate"),
                    initialization.getRequestCreation().toString("yyyy-MM-dd HH:mm:ss"));
            addCell(getLocalizedMessate("label.module.workingCapital.requester"),
                    initialization.getRequestor().getName());
            final Person movementResponsible = workingCapital.getMovementResponsible();
            addCell(getLocalizedMessate("label.module.workingCapital.movementResponsible"),
                    movementResponsible == null ? "" : movementResponsible.getName());
            addCell(getLocalizedMessate("label.module.workingCapital.fiscalId"), initialization.getFiscalId());
            addCell(getLocalizedMessate("label.module.workingCapital.internationalBankAccountNumber"),
                    initialization.getInternationalBankAccountNumber());
            addCell(getLocalizedMessate("label.module.workingCapital.fundAllocationId"),
                    initialization.getFundAllocationId());
            final Money requestedAnualValue = initialization.getRequestedAnualValue();
            addCell(getLocalizedMessate("label.module.workingCapital.requestedAnualValue.requested"),
                    requestedAnualValue);
            addCell(getLocalizedMessate("label.module.workingCapital.requestedMonthlyValue.requested"),
                    requestedAnualValue.divideAndRound(new BigDecimal(6)));
            final Money authorizedAnualValue = initialization.getAuthorizedAnualValue();
            addCell(getLocalizedMessate("label.module.workingCapital.authorizedAnualValue"),
                    authorizedAnualValue == null ? "" : authorizedAnualValue);
            final Money maxAuthorizedAnualValue = initialization.getMaxAuthorizedAnualValue();
            addCell(getLocalizedMessate("label.module.workingCapital.maxAuthorizedAnualValue"),
                    maxAuthorizedAnualValue == null ? "" : maxAuthorizedAnualValue);
            final DateTime lastSubmission = initialization.getLastSubmission();
            addCell(getLocalizedMessate("label.module.workingCapital.initialization.lastSubmission"),
                    lastSubmission == null ? "" : lastSubmission.toString("yyyy-MM-dd"));
            final DateTime refundRequested = initialization.getRefundRequested();
            addCell(getLocalizedMessate("label.module.workingCapital.initialization.refundRequested"),
                    refundRequested == null ? "" : refundRequested.toString("yyyy-MM-dd"));

            final WorkingCapitalTransaction lastTransaction = workingCapital.getLastTransaction();
            if (lastTransaction == null) {
                addCell(getLocalizedMessate("label.module.workingCapital.transaction.accumulatedValue"),
                        Money.ZERO);
                addCell(getLocalizedMessate("label.module.workingCapital.transaction.balance"), Money.ZERO);
                addCell(getLocalizedMessate("label.module.workingCapital.transaction.debt"), Money.ZERO);
            } else {
                addCell(getLocalizedMessate("label.module.workingCapital.transaction.accumulatedValue"),
                        lastTransaction.getAccumulatedValue());
                addCell(getLocalizedMessate("label.module.workingCapital.transaction.balance"),
                        lastTransaction.getBalance());
                addCell(getLocalizedMessate("label.module.workingCapital.transaction.debt"),
                        lastTransaction.getDebt());
            }

            for (final AcquisitionClassification classification : WorkingCapitalSystem.getInstance()
                    .getAcquisitionClassificationsSet()) {
                final String description = classification.getDescription();
                final String pocCode = classification.getPocCode();
                final String key = pocCode + " - " + description;

                final Money value = calculateValueForClassification(workingCapital, classification);

                addCell(key, value);
            }

        }

        private Money calculateValueForClassification(final WorkingCapital workingCapital,
                final AcquisitionClassification classification) {
            Money result = Money.ZERO;
            for (final WorkingCapitalTransaction transaction : workingCapital
                    .getWorkingCapitalTransactionsSet()) {
                if (transaction.isAcquisition()) {
                    final WorkingCapitalAcquisitionTransaction acquisitionTransaction = (WorkingCapitalAcquisitionTransaction) transaction;
                    final WorkingCapitalAcquisition acquisition = acquisitionTransaction
                            .getWorkingCapitalAcquisition();
                    final AcquisitionClassification acquisitionClassification = acquisition
                            .getAcquisitionClassification();
                    if (acquisitionClassification == classification) {
                        result = result.add(acquisition.getValueAllocatedToSupplier());
                    }
                }
            }
            return result;
        }

        private String getUnitResponsibles(final WorkingCapital workingCapital) {
            final StringBuilder builder = new StringBuilder();
            final SortedMap<Person, Set<Authorization>> authorizations = workingCapital
                    .getSortedAuthorizations();
            if (!authorizations.isEmpty()) {
                for (final Entry<Person, Set<Authorization>> entry : authorizations.entrySet()) {
                    if (builder.length() > 0) {
                        builder.append("; ");
                    }
                    builder.append(entry.getKey().getName());
                }
            }

            return builder.toString();
        }

    };

    final LocalDate currentLocalDate = new LocalDate();
    final SpreadsheetBuilder builder = new SpreadsheetBuilder();
    builder.addConverter(Money.class, new CellConverter() {

        @Override
        public Object convert(final Object source) {
            final Money money = (Money) source;
            return money == null ? null : money.getRoundedValue().doubleValue();
        }

    });

    builder.addSheet(getLocalizedMessate("label.module.workingCapital") + " " + year + " - "
            + currentLocalDate.toString(), sheetData);

    final List<WorkingCapitalTransaction> transactions = new ArrayList<WorkingCapitalTransaction>();
    for (final WorkingCapitalProcess process : processes) {
        final WorkingCapital workingCapital = process.getWorkingCapital();
        transactions.addAll(workingCapital.getSortedWorkingCapitalTransactions());
    }
    final SheetData<WorkingCapitalTransaction> transactionsSheet = new SheetData<WorkingCapitalTransaction>(
            transactions) {
        @Override
        protected void makeLine(WorkingCapitalTransaction transaction) {
            final WorkingCapital workingCapital = transaction.getWorkingCapital();
            final WorkingCapitalProcess workingCapitalProcess = workingCapital.getWorkingCapitalProcess();

            addCell(getLocalizedMessate("label.module.workingCapital.year"), year);
            addCell(getLocalizedMessate("label.module.workingCapital"),
                    workingCapitalProcess.getWorkingCapital().getUnit().getPresentationName());
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.number"),
                    transaction.getNumber());
            addCell(getLocalizedMessate("WorkingCapitalProcessState.CANCELED"),
                    transaction.isCanceledOrRejected() ? getLocalizedMessate("label.yes")
                            : getLocalizedMessate("label.no"));
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.description") + " "
                    + getLocalizedMessate("label.module.workingCapital.transaction.number"),
                    transaction.getDescription());
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.approval"),
                    approvalLabel(transaction));
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.verification"),
                    verificationLabel(transaction));
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.value"),
                    transaction.getValue());
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.accumulatedValue"),
                    transaction.getAccumulatedValue());
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.balance"),
                    transaction.getBalance());
            addCell(getLocalizedMessate("label.module.workingCapital.transaction.debt"), transaction.getDebt());

            if (transaction.isAcquisition()) {
                final WorkingCapitalAcquisitionTransaction acquisitionTx = (WorkingCapitalAcquisitionTransaction) transaction;
                final WorkingCapitalAcquisition acquisition = acquisitionTx.getWorkingCapitalAcquisition();
                final AcquisitionClassification acquisitionClassification = acquisition
                        .getAcquisitionClassification();
                final String economicClassification = acquisitionClassification.getEconomicClassification();
                final String pocCode = acquisitionClassification.getPocCode();
                addCell(getLocalizedMessate(
                        "label.module.workingCapital.configuration.acquisition.classifications.economicClassification"),
                        economicClassification);
                addCell(getLocalizedMessate(
                        "label.module.workingCapital.configuration.acquisition.classifications.pocCode"),
                        pocCode);
                addCell(getLocalizedMessate(
                        "label.module.workingCapital.configuration.acquisition.classifications.description"),
                        acquisition.getDescription());
            }
        }

        private Object verificationLabel(final WorkingCapitalTransaction transaction) {
            if (transaction.isAcquisition()) {
                final WorkingCapitalAcquisitionTransaction acquisition = (WorkingCapitalAcquisitionTransaction) transaction;
                if (acquisition.getWorkingCapitalAcquisition().getVerified() != null) {
                    return getLocalizedMessate("label.verified");
                }
                if (acquisition.getWorkingCapitalAcquisition().getNotVerified() != null) {
                    return getLocalizedMessate("label.notVerified");
                }
            }
            return "-";
        }

        private String approvalLabel(final WorkingCapitalTransaction transaction) {
            if (transaction.isAcquisition()) {
                final WorkingCapitalAcquisitionTransaction acquisition = (WorkingCapitalAcquisitionTransaction) transaction;
                if (acquisition.getWorkingCapitalAcquisition().getApproved() != null) {
                    return getLocalizedMessate("label.approved");
                }
                if (acquisition.getWorkingCapitalAcquisition().getRejectedApproval() != null) {
                    return getLocalizedMessate("label.rejected");
                }
            }
            return "-";
        }

    };
    builder.addSheet(getLocalizedMessate("label.module.workingCapital.transactions"), transactionsSheet);

    return streamSpreadsheet(response, "FundosManeio_" + year + "-" + currentLocalDate.getDayOfMonth() + "-"
            + currentLocalDate.getMonthOfYear() + "-" + currentLocalDate.getYear(), builder);

}