Re: chart: troubles using cost
Dag Andersen <[email protected]> Wed, 14 Mar 2007 19:38:54 +0100
| Newsgroups | gmane.comp.kde.kplato |
|---|---|
| Message-ID | <[email protected]> |
Fredag 09 marts 2007 16:12 skrev Fr=E9d=E9ric 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 =3D>
> 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 =3D -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 =3D -1 ) const;
/**
* Planned cost up to and including date
* @param date The cost is calculated from the start of the project upt=
o =
including date.
* @param id Identity of the schedule to be used.
*/
virtual double plannedCostTo( const QDate &date, long id =3D -1 ) cons=
t;
/**
* 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 =3D -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 =3D -1 ) const;
/**
* Actual cost up to and including date
* @param date The cost is calculated from the start of the project upt=
o =
including date.
* @param id Identity of the schedule to be used.
*/
virtual double actualCostTo( const QDate &date, long id =3D -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 =3D project->plannedCost( day, project->currentViewScheduleId() );
ac =3D project->actualCost( day, project->currentViewScheduleId() );
But, as I said, this isn't tested much, especially the actualCost* hasn't g=
ot =
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
> [email protected]
> https://mail.kde.org/mailman/listinfo/kplato
-- =
Mvh
Dag Andersen