From: konrad Date: Sat, 25 Dec 2010 05:00:23 +0000 (+0000) Subject: pieces of audit display X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a469810d01572391d2d34c020c624a252738ecd7;p=web%2Fkonrad%2Fsmoke.git pieces of audit display git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@672 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/dialogs/orderwin.cpp b/src/dialogs/orderwin.cpp index a935233..f273b4a 100644 --- a/src/dialogs/orderwin.cpp +++ b/src/dialogs/orderwin.cpp @@ -119,6 +119,12 @@ MOrderWindow::MOrderWindow(QWidget*par,const MOOrder&o) m->addAction(tr("Print &Current Item..."),this,SLOT(printCurrentItem())); m->addAction(tr("&View Items..."),this,SLOT(itemView())); + m=mb->addMenu(tr("&Audit")); + m->addAction(tr("Voucher History..."),this,SLOT(voucherAudit())) + ->setEnabled(req->hasRight(req->RGetVoucherAudit)); + m->addAction(tr("Order History..."),this,SLOT(orderAudit())) + ->setEnabled(req->hasRight(req->RGetOrderAudit)); + QWidget*w; setCentralWidget(w=new QWidget); QVBoxLayout *vl; @@ -1022,6 +1028,73 @@ void MOrderWindow::changeShipping() updateData(); } +void MOrderWindow::voucherAudit() +{ + 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_VOUCHER){ + QMessageBox::warning(this,tr("Warning"),tr("The selected item is not a voucher.")); + } + //get data + MTGetVoucherAudit va=req->queryGetVoucherAudit(id); + if(va.getvoucher().size()==0){ + QMessageBox::warning(this,tr("No Data"),tr("No audit data found for this voucher.")); + return; + } + //display construction + QListvlist=va.getvoucher(); + qDebug()<<"got # vouchers:"<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,vlist.size()); +// model->insertColumns(0,5); + model->setHorizontalHeaderLabels(QStringList() + <setData(model->index(i,0),unix2dateTime(vlist[i].audittime())); + model->setData(model->index(i,1),vlist[i].audituname().value()); + model->setData(model->index(i,2),vlist[i].audittransaction().value()); + model->setData(model->index(i,3),vlist[i].valueString()); + model->setData(model->index(i,4),vlist[i].priceString()); + model->setData(model->index(i,5),vlist[i].comment().value()); + } + tab->resizeColumnsToContents(); + //show + d.exec(); +} + +void MOrderWindow::orderAudit() +{ + MTGetOrderAudit oa=req->queryGetOrderAudit(m_order.orderid()); + qDebug()<<"order lines"<abortWithError(tr("Not a valid cart object.")); return; } +// print_r($trans); //get permissions global $db; $isreserve=false; diff --git a/www/inc/wext/order.php b/www/inc/wext/order.php index b3c653a..7cc905e 100644 --- a/www/inc/wext/order.php +++ b/www/inc/wext/order.php @@ -689,6 +689,17 @@ class WOOrder extends WOOrderAbstract //return $trans->setvoucher(WOVoucher::fromTablevoucher($vou)); } + + ///order audit transaction + static public function getOrderAuditTransaction($trans) + { + global $db; + $oid=$trans->getorderid(); + $w='orderid='.$db->escapeInt($oid); + $trans->setorder( WOOrderAudit::fromTableArrayorder_audit( WTorder_audit::selectFromDB($w))); + $trans->setvouchers( WOVoucherAudit::fromTableArrayvoucher_audit( WTvoucher_audit::selectFromDB($w))); + $trans->settickets( WOTicketAudit::fromTableArrayticket_audit( WTticket_audit::selectFromDB($w))); + } }; ?> \ No newline at end of file diff --git a/www/inc/wext/voucher.php b/www/inc/wext/voucher.php index 6aecf5e..ddd1660 100644 --- a/www/inc/wext/voucher.php +++ b/www/inc/wext/voucher.php @@ -10,6 +10,14 @@ class WOVoucher extends WOVoucherAbstract return $inst->getcomment(); else return null; } + + public static function GetVoucherAuditTransaction($trans) + { + global $db; + $tab=WTvoucher_audit::selectFromDB('voucherid='.$db->escapeString($trans->getvoucherid())); + $arr=WOVoucherAudit::fromTableArrayvoucher_audit($tab); + $trans->setvoucher($arr); + } }; ?> \ No newline at end of file