m=mb->addMenu(tr("&Audit"));
m->addAction(tr("Voucher History..."),this,SLOT(voucherAudit()))
->setEnabled(req->hasRight(req->RGetVoucherAudit));
+ m->addAction(tr("Ticket History..."),this,SLOT(ticketAudit()))
+ ->setEnabled(req->hasRight(req->RGetTicketAudit));
m->addAction(tr("Order History..."),this,SLOT(orderAudit()))
->setEnabled(req->hasRight(req->RGetOrderAudit));
int type=m_model->data(idx,Qt::UserRole).toInt();
if(type!=ITEM_VOUCHER){
QMessageBox::warning(this,tr("Warning"),tr("The selected item is not a voucher."));
+ return;
}
//get data
MTGetVoucherAudit va=req->queryGetVoucherAudit(id);
d.exec();
}
+void MOrderWindow::ticketAudit()
+{
+ QModelIndexList lst=m_table->selectionModel()->selectedIndexes();
+ if(lst.size()<1)return;
+ QModelIndex idx=m_model->index(lst[0].row(),0);
+ QString id=m_model->data(idx).toString();
+ if(id=="")return;
+ int type=m_model->data(idx,Qt::UserRole).toInt();
+ if(type!=ITEM_TICKET){
+ QMessageBox::warning(this,tr("Warning"),tr("The selected item is not a ticket."));
+ return;
+ }
+ //get data
+ MTGetTicketAudit va=req->queryGetTicketAudit(id);
+ if(va.getticket().size()==0){
+ QMessageBox::warning(this,tr("No Data"),tr("No audit data found for this ticket."));
+ return;
+ }
+ //display construction
+ QList<MOTicketAudit>tlist=va.getticket();
+ QList<MOEvent>elist=va.getevent();
+ qDebug()<<"got # tickets:"<<tlist.size();
+ QDialog d(this);
+ d.setWindowTitle(tr("Ticket Audit: %1").arg(id));
+ d.setSizeGripEnabled(true);
+ d.resize(800,600);
+ QHBoxLayout*hl;
+ QVBoxLayout*vl;
+ d.setLayout(vl=new QVBoxLayout);
+ QTableView*tab;
+ QStandardItemModel*model;
+ vl->addWidget(tab=new QTableView,1);
+ tab->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ tab->setModel(model=new QStandardItemModel(tab));
+ vl->addLayout(hl=new QHBoxLayout);
+ hl->addStretch(1);
+ QPushButton*p;
+ hl->addWidget(p=new QPushButton(tr("Close")));
+ connect(p,SIGNAL(clicked()),&d,SLOT(accept()));
+ //enter data
+ model->insertRows(0,tlist.size());
+// model->insertColumns(0,5);
+ model->setHorizontalHeaderLabels(QStringList()
+ <<tr("Date/Time")
+ <<tr("User")
+ <<tr("Transaction")
+ <<tr("Price")
+ <<tr("Event Date")
+ <<tr("Event")
+ );
+ for(int i=0;i<tlist.size();i++){
+ int eid=tlist[i].eventid();
+ MOEvent ev;
+ foreach(MOEvent e,elist)
+ if(e.eventid()==eid)ev=e;
+ model->setData(model->index(i,0),unix2dateTime(tlist[i].audittime()));
+ model->setData(model->index(i,1),tlist[i].audituname().value());
+ model->setData(model->index(i,2),tlist[i].audittransaction().value());
+ model->setData(model->index(i,3),tlist[i].priceString());
+ model->setData(model->index(i,4),unix2dateTime(ev.start()));
+ model->setData(model->index(i,5),ev.title().value());
+ }
+ tab->resizeColumnsToContents();
+ //show
+ d.exec();
+}
+
void MOrderWindow::orderAudit()
{
MTGetOrderAudit oa=req->queryGetOrderAudit(m_order.orderid());
<Var name="ticket" type="Ticket"/>
</Output>
</Transaction>
+
+ <Transaction name="GetTicketAudit" updating="no">
+ <Doc>returns all audit data for a ticket (when it was bought, changed prices, when it was used)</Doc>
+ <Input>
+ <Var name="ticketid" type="astring"/>
+ </Input>
+ <Call lang="php" method="WOTicket::GetTicketAuditTransaction($this);"/>
+ <Output>
+ <Var name="ticket" type="List:TicketAudit"/>
+ <Var name="event" type="List:Event"/>
+ </Output>
+ </Transaction>
<Transaction name="GetVoucher" updating="no">
<Doc>returns a specific voucher with detailed info</Doc>
<Input>
<Var name="orderid" type="int">ID of the order that is to be paid for</Var>
<Var name="voucherid" type="astring">ID of the voucher that is to be used for payment</Var>
+ <!-- if this transaction ever gains a "comment" field you need to enhance the voucher audit table to include the additional orderid - currently the orderid is stored as comment in the audit -->
</Input>
<Call lang="php" method="WOOrder::payForOrderVoucher($this);"/>
<Output>