void TemplKatalogListView::addCalcParts( FloskelTemplate *tmpl ) { QTreeWidgetItem *item = tmpl->getListViewItem(); if( ! item ) return; CalcPartList parts = tmpl->getCalcPartsList(); CalcPartListIterator it(parts); while( it.hasNext() ) { CalcPart *cp = it.next(); QString title = cp->getName(); QString type = cp->getType(); // qDebug () << "Type is " << type << endl; if( type == KALKPART_TIME ) { TimeCalcPart *zcp = static_cast<TimeCalcPart*>(cp); StdSatz stdsatz = zcp->getStundensatz(); title = QString( "%1, %2 %3 %4" ) .arg( cp->getName() ) .arg( QString::number(zcp->duration())) .arg( TimeCalcPart::timeUnitString(zcp->timeUnit())) .arg( stdsatz.getName() ); } QStringList list; list << title; list << cp->basisKosten().toString( catalog()->locale() ); list << cp->getType(); QTreeWidgetItem *cpItem = new QTreeWidgetItem( item, list ); cpItem->setDisabled(true); } }
Geld CalcPartList::costPerCalcPart( const QString& calcPart ) { CalcPart *cp; Geld g; /* suche nach einer speziellen Kalkulationsart */ QListIterator<CalcPart*> i( *this ); while( i.hasNext()) { cp = i.next(); if( ( calcPart == ALL_KALKPARTS || calcPart == cp->getType() ) && ! cp->isToDelete() ) { g += cp->basisKosten(); } } return g; }