KPlato::Appointment Class Reference

#include <kptappointment.h>

List of all members.

Public Member Functions

 Appointment ()
 Appointment (Schedule *resource, Schedule *node, DateTime start, DateTime end, double load)
 Appointment (Schedule *resource, Schedule *node, DateTime start, Duration duration, double load)
 ~Appointment ()
Schedulenode () const
void setNode (Schedule *n)
Scheduleresource () const
void setResource (Schedule *r)
DateTime startTime () const
DateTime endTime () const
double maxLoad () const
const DurationrepeatInterval () const
void setRepeatInterval (Duration ri)
int repeatCount () const
void setRepeatCount (int rc)
void deleteAppointmentFromRepeatList (DateTime time)
void addAppointmentToRepeatList (DateTime time)
bool isBusy (const DateTime &start, const DateTime &end)
bool attach ()
 attach appointment to resource and node
void detach ()
 detach appointment from resource and node
void addInterval (AppointmentInterval *a)
void addInterval (AppointmentInterval &a)
void addInterval (const DateTime &start, const DateTime &end, double load=100)
void addInterval (const DateTime &start, const Duration &duration, double load=100)
const AppointmentIntervalListintervals () const
bool loadXML (QDomElement &element, Project &project, Schedule &sch)
void saveXML (QDomElement &element) const
EffortCostMap plannedPrDay (const QDate &start, const QDate &end) const
Duration effort (const DateTime &start, const DateTime &end) const
 Returns the planned effort from start to end.
Duration effort (const DateTime &start, const Duration &duration) const
 Returns the planned effort from start for the duration.
Duration effortFrom (const DateTime &time) const
 Returns the planned effort from time onwards.
Duration plannedEffort () const
 Returns the total planned effort for this appointment.
Duration plannedEffort (const QDate &date) const
 Returns the planned effort on the date.
Duration plannedEffortTo (const QDate &date) const
 Returns the planned effort upto and including date.
Duration actualEffort () const
 Returns the total actual effort for this appointment.
Duration actualEffort (const QDate &date) const
 Returns the actual effort on the date.
Duration actualEffortTo (const QDate &date) const
 Returns the actual effort on the date.
double plannedCost ()
 Calculates the total planned cost for this appointment.
double plannedCost (const QDate &date)
 Calculates the planned cost on date.
double plannedCostTo (const QDate &date)
 Calculates the planned cost upto and including date.
double actualCost ()
 Calculates the total actual cost for this appointment.
double actualCost (const QDate &date)
 Calculates the actual cost on date.
double actualCostTo (const QDate &date)
 Calculates the actual cost upto and including date.
Appointmentoperator= (const Appointment &app)
Appointmentoperator+= (const Appointment &app)
Appointment operator+ (const Appointment &app)
void addActualEffort (QDate date, Duration effort, bool overtime=false)
void printDebug (QString ident)

Private Attributes

Schedulem_node
Schedulem_resource
Duration m_repeatInterval
int m_repeatCount
QList< Duration * > m_extraRepeats
QList< Duration * > m_skipRepeats
AppointmentIntervalList m_intervals
UsedEffort m_actualEffort

Classes

class  UsedEffort
class  UsedEffortItem


Detailed Description

A resource (Resource) can be scheduled to be used at any time, this is represented internally with Appointments There is one Appointment per resource-task pair. An appointment can be divided into several intervals, represented with a list of AppointmentInterval. This list is sorted after 1) startdatetime, 2) enddatetime. The intervals do not overlap, an interval does not start before the previous interval ends. An interval is a countinous time interval with the same load. It can span dates.

Definition at line 130 of file kptappointment.h.


Constructor & Destructor Documentation

KPlato::Appointment::Appointment (  ) 

Definition at line 294 of file kptappointment.cc.

References m_node, m_repeatCount, m_repeatInterval, and m_resource.

KPlato::Appointment::Appointment ( Schedule resource,
Schedule node,
DateTime  start,
DateTime  end,
double  load 
)

Definition at line 303 of file kptappointment.cc.

References addInterval(), m_node, m_repeatCount, m_repeatInterval, m_resource, node(), and resource().

KPlato::Appointment::Appointment ( Schedule resource,
Schedule node,
DateTime  start,
Duration  duration,
double  load 
)

Definition at line 315 of file kptappointment.cc.

References addInterval(), m_node, m_repeatCount, m_repeatInterval, m_resource, node(), and resource().

KPlato::Appointment::~Appointment (  ) 

Definition at line 328 of file kptappointment.cc.

References detach(), and m_intervals.


Member Function Documentation

Schedule* KPlato::Appointment::node (  )  const [inline]

Definition at line 138 of file kptappointment.h.

References m_node.

Referenced by KPlato::NamedCommand::addSchDeleted(), KPlato::NamedCommand::addSchScheduled(), Appointment(), KPlato::ResourceAppointmentsView::draw(), loadXML(), operator=(), and KPlato::ResourceSchedule::takeAppointment().

void KPlato::Appointment::setNode ( Schedule n  )  [inline]

Definition at line 139 of file kptappointment.h.

References m_node.

Referenced by KPlato::Node::addAppointment().

Schedule* KPlato::Appointment::resource (  )  const [inline]

Definition at line 141 of file kptappointment.h.

References m_resource.

Referenced by KPlato::NamedCommand::addSchDeleted(), KPlato::NamedCommand::addSchScheduled(), Appointment(), KPlato::GanttView::modifyTask(), operator=(), and KPlato::NodeSchedule::takeAppointment().

void KPlato::Appointment::setResource ( Schedule r  )  [inline]

Definition at line 142 of file kptappointment.h.

References m_resource.

Referenced by KPlato::Resource::addAppointment().

DateTime KPlato::Appointment::startTime (  )  const

Definition at line 358 of file kptappointment.cc.

References m_intervals.

DateTime KPlato::Appointment::endTime (  )  const

Definition at line 369 of file kptappointment.cc.

References m_intervals.

Referenced by operator+().

double KPlato::Appointment::maxLoad (  )  const

Definition at line 347 of file kptappointment.cc.

References m_intervals.

const Duration& KPlato::Appointment::repeatInterval (  )  const [inline]

Definition at line 148 of file kptappointment.h.

References m_repeatInterval.

Referenced by operator=().

void KPlato::Appointment::setRepeatInterval ( Duration  ri  )  [inline]

Definition at line 149 of file kptappointment.h.

References m_repeatInterval.

int KPlato::Appointment::repeatCount (  )  const [inline]

Definition at line 151 of file kptappointment.h.

References m_repeatCount.

Referenced by operator=().

void KPlato::Appointment::setRepeatCount ( int  rc  )  [inline]

Definition at line 152 of file kptappointment.h.

References m_repeatCount.

void KPlato::Appointment::deleteAppointmentFromRepeatList ( DateTime  time  ) 

Definition at line 380 of file kptappointment.cc.

void KPlato::Appointment::addAppointmentToRepeatList ( DateTime  time  ) 

Definition at line 383 of file kptappointment.cc.

bool KPlato::Appointment::isBusy ( const DateTime start,
const DateTime end 
)

Definition at line 386 of file kptappointment.cc.

bool KPlato::Appointment::attach (  ) 

attach appointment to resource and node

Definition at line 595 of file kptappointment.cc.

References KPlato::Schedule::add(), m_node, and m_resource.

void KPlato::Appointment::detach (  ) 

detach appointment from resource and node

Definition at line 607 of file kptappointment.cc.

References m_node, m_resource, and KPlato::Schedule::takeAppointment().

Referenced by KPlato::RemoveResourceCmd::execute(), KPlato::NodeDeleteCmd::execute(), and ~Appointment().

void KPlato::Appointment::addInterval ( AppointmentInterval a  ) 

Definition at line 335 of file kptappointment.cc.

References KPlato::AppointmentIntervalList::inSort(), and m_intervals.

Referenced by KPlato::ResourceSchedule::addAppointment(), KPlato::NodeSchedule::addAppointment(), addInterval(), Appointment(), loadXML(), operator+(), and operator=().

void KPlato::Appointment::addInterval ( AppointmentInterval a  )  [inline]

Definition at line 165 of file kptappointment.h.

References addInterval().

void KPlato::Appointment::addInterval ( const DateTime start,
const DateTime end,
double  load = 100 
)

Definition at line 339 of file kptappointment.cc.

References addInterval().

void KPlato::Appointment::addInterval ( const DateTime start,
const Duration duration,
double  load = 100 
)

Definition at line 342 of file kptappointment.cc.

References addInterval().

const AppointmentIntervalList& KPlato::Appointment::intervals (  )  const [inline]

Definition at line 170 of file kptappointment.h.

References m_intervals.

Referenced by KPlato::ResourceSchedule::isOverbooked(), and operator+().

bool KPlato::Appointment::loadXML ( QDomElement &  element,
Project project,
Schedule sch 
)

Definition at line 390 of file kptappointment.cc.

References KPlato::Schedule::addAppointment(), KPlato::Resource::addAppointment(), addInterval(), KPlato::Project::findNode(), KPlato::Appointment::UsedEffort::load(), m_actualEffort, m_intervals, m_resource, KPlato::Schedule::name(), KPlato::Resource::name(), node(), KPlato::Project::resource(), and KPlato::Schedule::takeAppointment().

void KPlato::Appointment::saveXML ( QDomElement &  element  )  const

Definition at line 434 of file kptappointment.cc.

References KPlato::Node::id(), KPlato::Resource::id(), m_actualEffort, m_intervals, m_node, m_resource, KPlato::Schedule::node(), KPlato::Schedule::resource(), and KPlato::Appointment::UsedEffort::save().

EffortCostMap KPlato::Appointment::plannedPrDay ( const QDate &  start,
const QDate &  end 
) const

Returns the planned effort and cost for the interval start to end (inclusive). Only dates with any planned effort is returned.

Definition at line 498 of file kptappointment.cc.

References KPlato::EffortCostMap::add(), m_intervals, m_resource, KPlato::Schedule::normalRatePrHour(), KPlato::Duration::toDouble(), and KPlato::Duration::Unit_h.

Referenced by KPlato::ResourceAppointmentsView::draw().

Duration KPlato::Appointment::effort ( const DateTime start,
const DateTime end 
) const

Returns the planned effort from start to end.

Definition at line 618 of file kptappointment.cc.

References m_intervals.

Referenced by addActualEffort(), and KPlato::Appointment::UsedEffort::inSort().

Duration KPlato::Appointment::effort ( const DateTime start,
const Duration duration 
) const

Returns the planned effort from start for the duration.

Definition at line 628 of file kptappointment.cc.

References m_intervals.

Duration KPlato::Appointment::effortFrom ( const DateTime time  )  const

Returns the planned effort from time onwards.

Definition at line 638 of file kptappointment.cc.

References m_intervals.

Duration KPlato::Appointment::plannedEffort (  )  const

Returns the total planned effort for this appointment.

Definition at line 461 of file kptappointment.cc.

References m_intervals.

Referenced by plannedCost().

Duration KPlato::Appointment::plannedEffort ( const QDate &  date  )  const

Returns the planned effort on the date.

Definition at line 472 of file kptappointment.cc.

References m_intervals.

Duration KPlato::Appointment::plannedEffortTo ( const QDate &  date  )  const

Returns the planned effort upto and including date.

Definition at line 485 of file kptappointment.cc.

References m_intervals.

Referenced by plannedCostTo().

Duration KPlato::Appointment::actualEffort (  )  const

Returns the total actual effort for this appointment.

Definition at line 529 of file kptappointment.cc.

References m_actualEffort, and KPlato::Appointment::UsedEffort::usedEffort().

Duration KPlato::Appointment::actualEffort ( const QDate &  date  )  const

Returns the actual effort on the date.

Definition at line 534 of file kptappointment.cc.

References m_actualEffort, and KPlato::Appointment::UsedEffort::usedEffort().

Duration KPlato::Appointment::actualEffortTo ( const QDate &  date  )  const

Returns the actual effort on the date.

Definition at line 539 of file kptappointment.cc.

References m_actualEffort, and KPlato::Appointment::UsedEffort::usedEffortTo().

double KPlato::Appointment::plannedCost (  ) 

Calculates the total planned cost for this appointment.

Definition at line 543 of file kptappointment.cc.

References m_resource, KPlato::Resource::normalRate(), plannedEffort(), KPlato::Schedule::resource(), KPlato::Duration::toDouble(), and KPlato::Duration::Unit_h.

double KPlato::Appointment::plannedCost ( const QDate &  date  ) 

Calculates the planned cost on date.

Definition at line 551 of file kptappointment.cc.

References m_resource, KPlato::Resource::normalRate(), plannedEffort(), KPlato::Schedule::resource(), KPlato::Duration::toDouble(), and KPlato::Duration::Unit_h.

double KPlato::Appointment::plannedCostTo ( const QDate &  date  ) 

Calculates the planned cost upto and including date.

Definition at line 559 of file kptappointment.cc.

References m_resource, KPlato::Resource::normalRate(), plannedEffortTo(), KPlato::Schedule::resource(), KPlato::Duration::toDouble(), and KPlato::Duration::Unit_h.

double KPlato::Appointment::actualCost (  ) 

Calculates the total actual cost for this appointment.

Definition at line 567 of file kptappointment.cc.

References m_actualEffort, m_resource, KPlato::Resource::normalRate(), KPlato::Resource::overtimeRate(), KPlato::Schedule::resource(), KPlato::Duration::toDouble(), KPlato::Duration::Unit_h, KPlato::Appointment::UsedEffort::usedEffort(), and KPlato::Appointment::UsedEffort::usedOvertime().

double KPlato::Appointment::actualCost ( const QDate &  date  ) 

Calculates the actual cost on date.

Definition at line 576 of file kptappointment.cc.

References m_actualEffort, m_resource, KPlato::Resource::normalRate(), KPlato::Resource::overtimeRate(), KPlato::Schedule::resource(), KPlato::Duration::toDouble(), KPlato::Duration::Unit_h, KPlato::Appointment::UsedEffort::usedEffort(), and KPlato::Appointment::UsedEffort::usedOvertime().

double KPlato::Appointment::actualCostTo ( const QDate &  date  ) 

Calculates the actual cost upto and including date.

Definition at line 584 of file kptappointment.cc.

References m_actualEffort, m_resource, KPlato::Resource::normalRate(), KPlato::Resource::overtimeRate(), KPlato::Schedule::resource(), KPlato::Duration::toDouble(), KPlato::Duration::Unit_h, KPlato::Appointment::UsedEffort::usedEffortTo(), and KPlato::Appointment::UsedEffort::usedOvertimeTo().

Appointment & KPlato::Appointment::operator= ( const Appointment app  ) 

Definition at line 648 of file kptappointment.cc.

References addInterval(), m_intervals, m_node, m_repeatCount, m_repeatInterval, m_resource, node(), repeatCount(), repeatInterval(), and resource().

Appointment & KPlato::Appointment::operator+= ( const Appointment app  ) 

Definition at line 663 of file kptappointment.cc.

Appointment KPlato::Appointment::operator+ ( const Appointment app  ) 

Definition at line 668 of file kptappointment.cc.

References addInterval(), endTime(), KPlato::AppointmentInterval::endTime(), KPlato::AppointmentInterval::firstInterval(), intervals(), KPlato::AppointmentInterval::isValid(), KPlato::AppointmentInterval::load(), m_intervals, and KPlato::AppointmentInterval::startTime().

void KPlato::Appointment::addActualEffort ( QDate  date,
Duration  effort,
bool  overtime = false 
)

Definition at line 591 of file kptappointment.cc.

References effort(), KPlato::Appointment::UsedEffort::inSort(), and m_actualEffort.

void KPlato::Appointment::printDebug ( QString  ident  ) 

Definition at line 717 of file kptappointment.cc.

References m_intervals, m_node, m_resource, KPlato::Resource::name(), KPlato::Schedule::name(), KPlato::Schedule::node(), KPlato::Schedule::resource(), and KPlato::Schedule::type().


Member Data Documentation

Schedule* KPlato::Appointment::m_node [private]

Definition at line 223 of file kptappointment.h.

Referenced by Appointment(), attach(), detach(), node(), operator=(), printDebug(), saveXML(), and setNode().

Schedule* KPlato::Appointment::m_resource [private]

Definition at line 224 of file kptappointment.h.

Referenced by actualCost(), actualCostTo(), Appointment(), attach(), detach(), loadXML(), operator=(), plannedCost(), plannedCostTo(), plannedPrDay(), printDebug(), resource(), saveXML(), and setResource().

Duration KPlato::Appointment::m_repeatInterval [private]

Definition at line 226 of file kptappointment.h.

Referenced by Appointment(), operator=(), repeatInterval(), and setRepeatInterval().

int KPlato::Appointment::m_repeatCount [private]

Definition at line 227 of file kptappointment.h.

Referenced by Appointment(), operator=(), repeatCount(), and setRepeatCount().

QList<Duration*> KPlato::Appointment::m_extraRepeats [private]

Definition at line 228 of file kptappointment.h.

QList<Duration*> KPlato::Appointment::m_skipRepeats [private]

Definition at line 229 of file kptappointment.h.

AppointmentIntervalList KPlato::Appointment::m_intervals [private]

Definition at line 231 of file kptappointment.h.

Referenced by addInterval(), effort(), effortFrom(), endTime(), intervals(), loadXML(), maxLoad(), operator+(), operator=(), plannedEffort(), plannedEffortTo(), plannedPrDay(), printDebug(), saveXML(), startTime(), and ~Appointment().

UsedEffort KPlato::Appointment::m_actualEffort [private]

Definition at line 259 of file kptappointment.h.

Referenced by actualCost(), actualCostTo(), actualEffort(), actualEffortTo(), addActualEffort(), loadXML(), and saveXML().


The documentation for this class was generated from the following files:
Generated on Wed Nov 22 23:21:43 2006 for KPlato by  doxygen 1.5.1-p1