Package org.libreplan.business.advance.entities

Examples of org.libreplan.business.advance.entities.AdvanceMeasurement


            DirectAdvanceAssignment directAdvanceAssignment = order
                    .getDirectAdvanceAssignmentOfTypeSubcontractor();

            // append the last advance measurement reported
            AdvanceMeasurement lastAdvanceMeasurementReported = reportAdvancesModel
                    .getLastAdvanceMeasurementReported(directAdvanceAssignment);
            if (lastAdvanceMeasurementReported != null) {
                appendLabel(row, toString(lastAdvanceMeasurementReported.getDate()));
                appendLabel(row, toString(lastAdvanceMeasurementReported.getValue()));
            } else {
                appendLabel(row, "");
                appendLabel(row, "");
            }

            // append the last advance measurement not reported
            AdvanceMeasurement lastAdvanceMeasurement = reportAdvancesModel
                    .getLastAdvanceMeasurement(directAdvanceAssignment);
            if (lastAdvanceMeasurement != null) {
                appendLabel(row, toString(lastAdvanceMeasurement.getDate()));
                appendLabel(row, toString(lastAdvanceMeasurement.getValue()));
            } else {
                appendLabel(row, "");
                appendLabel(row, "");
            }
View Full Code Here


            DirectAdvanceAssignment directAdvanceAssignment) {
        if (directAdvanceAssignment == null) {
            return null;
        }

        AdvanceMeasurement lastAdvanceMeasurementReported = null;
        for (AdvanceMeasurement advanceMeasurement : directAdvanceAssignment
                .getAdvanceMeasurements()) {
                if (advanceMeasurement.getCommunicationDate() != null) {
                    if (lastAdvanceMeasurementReported == null) {
                        lastAdvanceMeasurementReported = advanceMeasurement;
                    } else {
                        if (advanceMeasurement.getCommunicationDate()
                                .compareTo(
                                        lastAdvanceMeasurementReported
                                                .getCommunicationDate()) > 0) {
                            lastAdvanceMeasurementReported = advanceMeasurement;
                        }
                    }
                }
View Full Code Here

    }

    @Override
    public AdvanceMeasurement addNewLineAdvaceMeasurement() {
        if (advanceAssignment != null) {
            AdvanceMeasurement newMeasurement = createMeasurement();
            addMeasurement(advanceAssignment, newMeasurement);
            return newMeasurement;
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    private AdvanceMeasurement createMeasurement() {
        AdvanceMeasurement result = AdvanceMeasurement.create();
        result.setDate(new LocalDate());
        result.setAdvanceAssignment(advanceAssignment);
        return result;
    }
View Full Code Here

        return getLastReportedProgressToCustomerOf(advanceAssignment);
    }

    private LocalDate getLastReportedProgressToCustomerOf(DirectAdvanceAssignment advanceAssignment) {
        if (advanceAssignment != null && isSubcontractedByCustomer()) {
            AdvanceMeasurement lastAdvanceMeasurementReported = null;
            for (AdvanceMeasurement advanceMeasurement : advanceAssignment.getAdvanceMeasurements()) {
                if (advanceMeasurement.getCommunicationDate() != null) {
                    if (lastAdvanceMeasurementReported == null) {
                        lastAdvanceMeasurementReported = advanceMeasurement;
                    } else {
                        if (advanceMeasurement.getCommunicationDate().compareTo(
                                lastAdvanceMeasurementReported.getCommunicationDate()) > 0) {
                            lastAdvanceMeasurementReported = advanceMeasurement;
                        }
                    }
                }
            }
            return (lastAdvanceMeasurementReported != null) ? lastAdvanceMeasurementReported
                    .getDate() : null;
        }
        return null;
    }
View Full Code Here

        task.getName();
        task.getOrderElement().getOrder().getName();
        DirectAdvanceAssignment advanceAssignment = task.getOrderElement()
                .getReportGlobalAdvanceAssignment();
        if (advanceAssignment != null) {
            AdvanceMeasurement advanceMeasurement = advanceAssignment
                    .getLastAdvanceMeasurement();
            if (advanceMeasurement != null) {
                advanceMeasurement.getValue();
            }
        }
    }
View Full Code Here

            if (consolidation.isCalculated()) {
                return CalculatedConsolidatedValue.create(
                        LocalDate.fromDateFields(dto.getDate()),
                        dto.getPercentage(), task.getIntraDayEndDate());
            } else {
                AdvanceMeasurement measure = dto.getAdvanceMeasurement();
                NonCalculatedConsolidatedValue consolidatedValue = NonCalculatedConsolidatedValue
                        .create(LocalDate.fromDateFields(dto.getDate()),
                                dto.getPercentage(), measure,
                                task.getIntraDayEndDate());
                measure.getNonCalculatedConsolidatedValues().add(
                        consolidatedValue);
                return consolidatedValue;
            }
        }
        return null;
View Full Code Here

    private class AdvanceMeasurementRenderer implements ListitemRenderer {

        @Override
        public void render(Listitem item, Object data) {
            AdvanceMeasurement advanceMeasurement = (AdvanceMeasurement) data;
            item.setValue(advanceMeasurement);

            appendDecimalBoxValue(item);
            appendLabelPercentage(item);
            appendDateboxDate(item);
View Full Code Here

            appendDateboxDate(item);
            appendRemoveButton(item);
        }

        private void appendDecimalBoxValue(final Listitem listitem) {
            final AdvanceMeasurement advanceMeasurement = (AdvanceMeasurement) listitem
                    .getValue();
            final Decimalbox value = new Decimalbox();
            Listcell listcell = new Listcell();
            listcell.appendChild(value);
            listitem.appendChild(listcell);

            value.setScale(calculateScale(advanceMeasurement));
            value.setDisabled(isReadOnlyAdvanceMeasurements()
                    || manageOrderElementAdvancesModel
                            .hasConsolidatedAdvances(advanceMeasurement)
                    || manageOrderElementAdvancesModel.isAlreadyReportedProgress(advanceMeasurement));

            value.addEventListener(Events.ON_CHANGE, new EventListener() {

                @Override
                public void onEvent(Event event) {
                    if (manageOrderElementAdvancesModel
                            .canRemoveOrChange(advanceMeasurement)) {
                        updatesValue(value);
                        validateMeasurementValue(value, value.getValue());
                    } else {
                        throw new WrongValueException(
                                value,
                                _("Progress Measurement cannot be deleted. Progress Measurement already consolidated"));
                    }
                }
            });

            Util.bind(value, new Util.Getter<BigDecimal>() {

                @Override
                public BigDecimal get() {
                    return advanceMeasurement.getValue();
                }
            }, new Util.Setter<BigDecimal>() {

                @Override
                public void set(BigDecimal value) {
                    if (manageOrderElementAdvancesModel
                            .canRemoveOrChange(advanceMeasurement)) {
                        advanceMeasurement.setValue(value);
                        reloadAdvances();
                    }
                }
            });
            value.focus();
View Full Code Here

            });
            value.focus();
        }

        private void appendLabelPercentage(final Listitem listitem) {
            final AdvanceMeasurement advanceMeasurement = (AdvanceMeasurement) listitem
                    .getValue();

            BigDecimal percentage = manageOrderElementAdvancesModel
                    .getPercentageAdvanceMeasurement(advanceMeasurement);
            Label percentageLabel = new Label(percentage.toString() + " %");
View Full Code Here

TOP

Related Classes of org.libreplan.business.advance.entities.AdvanceMeasurement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.