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()<<tr("Price")<<tr("Bought")<<tr("Used")<<tr("Unused"));
+ model->setHorizontalHeaderLabels(QStringList() <<tr("Price") <<tr("Category") <<tr("Bought") <<tr("Used") <<tr("Unused"));
for(int i=0;i<tickets.size();i++){
Tickets tc=tickets[i];
model->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();
QList<MOOrder>ord=ges.getorders();
nreserved=ncancelled=ntotaltickets=ntotalmoney=0;
- QMap<int,Tickets>maptickets;
+ QMap<QPair<int,QString>,Tickets>maptickets;
//parse orders
for(int i=0;i<ord.size();i++){
if(ticks[j].eventid()!=eventid)
continue;
//count accumulated prices
- int p=ticks[j].price();
- if(!maptickets.contains(p))
- maptickets.insert(p,Tickets(p));
+ const int p=ticks[j].price();
+ const QString c=ticks[j].priceCategoryName();
+ const QPair<int,QString>pkey(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++;