[kplato] chart: troubles using cost

Dag Andersen danders at get2net.dk
Wed Mar 14 19:38:54 CET 2007


Fredag 09 marts 2007 16:12 skrev Frédéric Lambert:
> Hi everybody!
Hi, I've been away some days so excuse the late answer.
>
> We have some troubles when we try to display the curves. The cost
> (from Project::actualCostTo(...) and Project::plannedCostTo(...) )
> seems to return always 0 in our methods ( kptchart.cc =>
> calculateActualCost(..) and calculatePlannedCost(..) ).
>
> So we wonder 2 things:
> - the two methods in Project,  quoted before don't work.(where should
> we look at?).
I have made some methods for this, but they are not tested much so expect 
bugs.
You can find these in Project class:
    /**
     * Returns the total planned cost for this project
     * @param id Identity of the schedule to be used
     */
    virtual double plannedCost( long id = -1 ) const;
    /**
     * Planned cost on date
     * @param date The cost is calulated for this date (only)
     * @param id Identity of the schedule to be used
     */
    virtual double plannedCost( const QDate &date, long id = -1  ) const;
    /**
     * Planned cost up to and including date
     * @param date The cost is calculated from the start of the project upto 
including date.
     * @param id Identity of the schedule to be used.
     */
    virtual double plannedCostTo( const QDate &date, long id = -1  ) const;

    /**
     * Returns the actually reported cost for this project
     * @param date The cost is calulated for this date (only)
     * @param id Identity of the schedule to be used
     */
    virtual double actualCost( long id = -1 ) const;
    /**
     *  Actual cost on date
     * @param date The cost is calulated for this date (only)
     * @param id Identity of the schedule to be used
     */
    virtual double actualCost( const QDate &date, long id = -1  ) const;
    /**
     * Actual cost up to and including date
     * @param date The cost is calculated from the start of the project upto 
including date.
     * @param id Identity of the schedule to be used.
     */
    virtual double actualCostTo( const QDate &date, long id = -1  ) const;

These are iterative, so equivalents are also found in the Task and Node 
classes.

I would think you want to get the cost pr day, in which case you should use 
something like (iterating over all the days you want to calculate):
	double pl, ac;
	pl = project->plannedCost( day, project->currentViewScheduleId() );
	ac = project->actualCost( day, project->currentViewScheduleId() );

But, as I said, this isn't tested much, especially the actualCost* hasn't got 
much attention.

> - we don't know how to use the tasks's cost in KPlato (what do we need to
> do ?).
* You need to assign a cost to your resource(s), (hourly rate).
* Assign a startup- and/or shutdown cost to the task(s).
* Allocate the resource(s) to the task(s).
* Calulate a project schedule.

>
> Thanks!
> _______________________________________________
> kplato mailing list
> kplato at kde.org
> https://mail.kde.org/mailman/listinfo/kplato

-- 
Mvh
Dag Andersen


More information about the kplato mailing list