Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.EffortDuration


    private Integer calculateHoursInGap(Resource resource, IntraDayDate start,
            IntraDayDate end) {
        final ResourceCalendar calendar = resource.getCalendar();
        Iterable<PartialDay> days = start.daysUntil(end);
        EffortDuration result = zero();
        for (PartialDay each : days) {
            result = result.plus(calendar.getCapacityOn(each));
        }
        return result.roundToHours();
    }
View Full Code Here


        List<HoursWorkedPerWorkerInAMonthDTO> result = new ArrayList<HoursWorkedPerWorkerInAMonthDTO>();

        for (Object row: rows) {
            Object[] columns = (Object[]) row;
            Resource resource = (Resource) findExistingEntity((Long) columns[0]);
            EffortDuration effort = EffortDuration.seconds(((Long) columns[1])
                    .intValue());

            HoursWorkedPerWorkerInAMonthDTO dto = new HoursWorkedPerWorkerInAMonthDTO(
                    resource, effort);
            result.add(dto);
View Full Code Here

    private List<DayAssignment> createSpecific(List<LocalDate> days,
            SpecificResourceAllocation allocation, Resource resource) {
        List<DayAssignment> result = new ArrayList<DayAssignment>();
        int i = 0;
        for (LocalDate each : days) {
            EffortDuration hours = EffortDuration.hours(assignableHours[i]);
            result.add(SpecificDayAssignment.create(each, hours, resource));
            i++;
        }
        return result;
    }
View Full Code Here

    private List<DayAssignment> createGeneric(List<LocalDate> days,
            GenericResourceAllocation allocation, Resource resource) {
        List<DayAssignment> result = new ArrayList<DayAssignment>();
        int i = 0;
        for (LocalDate each : days) {
            EffortDuration hours = EffortDuration.hours(assignableHours[i]);
            result.add(GenericDayAssignment.create(each, hours, resource));
            i++;
        }
        return result;
    }
View Full Code Here

        LocalDate start = new LocalDate(task.getStartDate());
        LocalDate day = start;

        double duration = daysDuration.doubleValue();
        for (int i = 0; i < duration;) {
            EffortDuration workableTime = calendar.getCapacityOn(PartialDay
                    .wholeDay(day));
            if (!EffortDuration.zero().equals(workableTime)) {
                i++;
            }
            day = day.plusDays(1);
View Full Code Here

        }

        @Override
        public int toPixels(IDatesMapper datesMapper) {
            int pixesUntilDate = datesMapper.toPixels(this.date.getDate());
            EffortDuration effortDuration = date.getEffortDuration();
            Duration durationInDay = calculateDurationInDayFor(effortDuration);
            int pixelsInsideDay = datesMapper.toPixels(durationInDay);
            return pixesUntilDate + pixelsInsideDay;
        }
View Full Code Here

    }

    @Override
    public void afterDetailEval() throws JRScriptletException {
        EffortDuration current = (EffortDuration) this
                .getFieldValue("numHours");
        HoursWorkedPerWorkerInAMonthDTO dto = (HoursWorkedPerWorkerInAMonthDTO) this
                .getFieldValue("self");
        if (!dtos.contains(dto)) {
            if (current != null) {
                EffortDuration effort = EffortDuration.sum(EffortDuration
                        .parseFromFormattedString((String) this
                                .getVariableValue("sumNumHours")), current);
                this.setVariableValue("sumNumHours", effort.toFormattedString());
            }
            dtos.add(dto);
        }
    }
View Full Code Here

    public String getEstimatedHours(OrderElement orderElement) {
        return (orderElement.getWorkHours()).toString();
    }

    private String getWorkedHours(OrderElement orderElement){
        EffortDuration asignedDirectHours = orderElementDAO
                .getAssignedDirectEffort(orderElement);
        return asignedDirectHours.toFormattedString();
    }
View Full Code Here

    public Integer getLastWorkReportLineSequenceCode() {
        return lastWorkReportLineSequenceCode;
    }

    public EffortDuration getTotalEffortDuration() {
        EffortDuration result = EffortDuration.zero();
        for (WorkReportLine line : workReportLines) {
            result = result.plus(line.getEffort());
        }
        return result;
    }
View Full Code Here

                OrderElement orderElement = taskElement.getOrderElement();
                if (orderElement == null) {
                    return BigDecimal.ZERO;
                }

                EffortDuration totalChargedEffort = orderElement
                        .getSumChargedEffort() != null ? orderElement
                        .getSumChargedEffort().getTotalChargedEffort()
                        : EffortDuration.zero();

                EffortDuration estimatedEffort = taskElement.getSumOfAssignedEffort();

                if(estimatedEffort.isZero()) {
                    estimatedEffort = EffortDuration.hours(orderElement.getWorkHours());
                    if(estimatedEffort.isZero()) {
                        return BigDecimal.ZERO;
                    }
                }
                return new BigDecimal(totalChargedEffort.divivedBy(
                        estimatedEffort).doubleValue()).setScale(2,
View Full Code Here

TOP

Related Classes of org.libreplan.business.workingday.EffortDuration

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.