From 69476295f01054223460460dd08b299e3e37651e Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 14 May 2010 18:32:32 +0000 Subject: [PATCH] "big merge" - reimplement recent order, this time with date selector git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@452 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/mwin/orderstab.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/mwin/orderstab.h | 2 ++ www/inc/wext/cart.php | 1 + 3 files changed, 50 insertions(+), 0 deletions(-) diff --git a/src/mwin/orderstab.cpp b/src/mwin/orderstab.cpp index 120a7cd..731495f 100644 --- a/src/mwin/orderstab.cpp +++ b/src/mwin/orderstab.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -71,6 +72,10 @@ MOrdersTab::MOrdersTab(QString pk) connect(p,SIGNAL(clicked()),this,SLOT(orderDetails())); p->setEnabled(req->hasRight(req->RGetOrder)); vl->addSpacing(15); + vl->addWidget(p=new QPushButton(tr("Orders since...")),0); + connect(p,SIGNAL(clicked()),this,SLOT(orderSinceDate())); + p->setEnabled(req->hasRight(req->RGetOrderList)); + vl->addSpacing(15); vl->addWidget(p=new QPushButton(tr("Find by Ticket...")),0); connect(p,SIGNAL(clicked()),this,SLOT(orderByTicket())); p->setEnabled(req->hasRight(req->RGetOrderByBarcode)); @@ -164,6 +169,48 @@ void MOrdersTab::updateOrders() ordertable->resizeColumnsToContents(); } +void MOrdersTab::orderSinceDate() +{ + //display selection dialog + QDialog d(this); + d.setWindowTitle(tr("Select Date")); + QVBoxLayout*vl; + QHBoxLayout*hl; + d.setLayout(vl=new QVBoxLayout); + vl->addWidget(new QLabel(tr("Please select the date and time:"))); + QDateTimeEdit*dte; + vl->addWidget(dte=new QDateTimeEdit(QDateTime::fromTime_t(oldestOrderStamp()))); + dte->setDisplayFormat(tr("ddd MMMM d yyyy, h:mm ap","time format")); + dte->setCalendarPopup(true); + vl->addSpacing(10);vl->addStretch(1); + vl->addLayout(hl=new QHBoxLayout); + hl->addStretch(10); + QPushButton*p; + hl->addWidget(p=new QPushButton(tr("Ok")),0); + connect(p,SIGNAL(clicked()),&d,SLOT(accept())); + hl->addWidget(p=new QPushButton(tr("Cancel")),0); + connect(p,SIGNAL(clicked()),&d,SLOT(reject())); + //wait for user + if(d.exec()!=QDialog::Accepted) + return; + //get selection + qint64 ts=dte->dateTime().toTime_t(); + //request data and display + resetModel(); + MTGetOrderList ol=req->queryGetOrderList(ts); + if(ol.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("There was a problem retrieving the order list: %1").arg(ol.errorString())); + return; + } + QList orders=ol.getorders(); + QList cust=ol.getcustomers(); + for(int i=0;iresizeColumnsToContents(); + ordermode->setCurrentIndex(ordermode->count()-1); +} + void MOrdersTab::orderDetails() { //get selected order diff --git a/src/mwin/orderstab.h b/src/mwin/orderstab.h index f9096a5..7abb55d 100644 --- a/src/mwin/orderstab.h +++ b/src/mwin/orderstab.h @@ -52,6 +52,8 @@ class MOrdersTab:public QWidget void orderByCustomer(); /**find and display order by order ID*/ void orderByOrder(); + /**display all orders since a specific date*/ + void orderSinceDate(); signals: /**needs to be connected to the event tab*/ diff --git a/www/inc/wext/cart.php b/www/inc/wext/cart.php index 834a29d..1c2de52 100644 --- a/www/inc/wext/cart.php +++ b/www/inc/wext/cart.php @@ -335,6 +335,7 @@ class WOCartOrder extends WOCartOrderAbstract $oo=WOOrder::fromTableorder($ord); $ord->amountpaid=$oo->getTotalPrice(); $ord->senttime=$ord->ordertime; + $ord->status=WTorder::Sold; $ord->update(); } //update address use -- 1.7.2.5