From: Konrad Rosenbaum Date: Mon, 7 Oct 2013 18:53:38 +0000 (+0200) Subject: show price category in event summary X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=13a1d16fa3c895470801b699e52cd50220cb2a61;p=web%2Fkonrad%2Fsmoke.git show price category in event summary --- diff --git a/src/dialogs/eventsummary.cpp b/src/dialogs/eventsummary.cpp index bed6b5d..707c88d 100644 --- a/src/dialogs/eventsummary.cpp +++ b/src/dialogs/eventsummary.cpp @@ -68,15 +68,16 @@ MEventSummary::MEventSummary(QWidget*par,qint64 eid) tab->addTab(table=new QTableView,tr("Tickets")); table->setEditTriggers(QAbstractItemView::NoEditTriggers); table->setModel(model=new QStandardItemModel(this)); - model->insertColumns(0,4); + model->insertColumns(0,5); model->insertRows(0,tickets.size()); - model->setHorizontalHeaderLabels(QStringList()<setHorizontalHeaderLabels(QStringList() <setData(model->index(i,0),cent2str(tc.price)); - model->setData(model->index(i,1),tc.bought); - model->setData(model->index(i,2),tc.used); - model->setData(model->index(i,3),tc.unused); + model->setData(model->index(i,1),tc.category); + model->setData(model->index(i,2),tc.bought); + model->setData(model->index(i,3),tc.used); + model->setData(model->index(i,4),tc.unused); } table->resizeColumnsToContents(); @@ -126,7 +127,7 @@ void MEventSummary::getSummaryData() QListord=ges.getorders(); nreserved=ncancelled=ntotaltickets=ntotalmoney=0; - QMapmaptickets; + QMap,Tickets>maptickets; //parse orders for(int i=0;ipkey(p,c); + if(!maptickets.contains(pkey)) + maptickets.insert(pkey,Tickets(p,c)); //count up if(ticks[j].status().value()&MOTicket::MaskBlock){ ntotaltickets++; ntotalmoney+=ticks[j].price(); - maptickets[p].bought++; + maptickets[pkey].bought++; if(ticks[j].status()==MOTicket::Used) - maptickets[p].used++; + maptickets[pkey].used++; else - maptickets[p].unused++; + maptickets[pkey].unused++; } if(ticks[j].status()==MOTicket::Reserved) nreserved++; diff --git a/src/dialogs/eventsummary.h b/src/dialogs/eventsummary.h index 06e7191..6104550 100644 --- a/src/dialogs/eventsummary.h +++ b/src/dialogs/eventsummary.h @@ -54,8 +54,10 @@ class MEventSummary:public QDialog MOEvent event; int nreserved,ncancelled,ntotaltickets,ntotalmoney; struct Tickets{ - Tickets(int p=0){price=p;bought=used=unused=0;} - int price,bought,used,unused; + Tickets(){} + Tickets(int p,QString c=QString()):price(p),category(c){} + int price=0,bought=0,used=0,unused=0; + QString category; }; QListtickets; struct Comment{