}
}
-qint64 MOrdersTab::oldestOrderStamp(int age)
+qint64 MOrdersTab::oldestOrderStamp(OrderTimeStampMode mode,int age)
{
if(age<0){//age not given, get configuration
QSettings set;
set.beginGroup("profiles/"+profilekey);
- age=set.value("maxorderage",0).toInt();
+ switch(mode){
+ case OldestForAll:age=set.value("maxorderage",0).toInt();break;
+ case OldestForOpen:age=set.value("maxorderageopen",0).toInt();break;
+ case OldestForEvent:age=set.value("maxorderageevent",0).toInt();break;
+ case OldestForCustomer:age=set.value("maxorderagecust",0).toInt();break;
+ case OldestForSince:age=set.value("deforderagesince",7).toInt();break;
+ default: age=0;break;
+ }
}
//zero means no limit
if(age<=0)return 0;
int omode=ordermode->itemData(ordermode->currentIndex()).toInt();
if(omode==ORDERNONE)return;
resetModel();
- MTGetOrderList ol=req->queryGetOrderList(oldestOrderStamp());
+ MTGetOrderList ol=req->queryGetOrderList(oldestOrderStamp(omode==ORDERALL?OldestForAll:OldestForOpen));
if(ol.hasError()){
QMessageBox::warning(this,tr("Warning"),tr("There was a problem retrieving the order list: %1").arg(ol.errorString()));
return;
d.setLayout(vl=new QVBoxLayout);
vl->addWidget(new QLabel(tr("Please select the date and time:")));
QDateTimeEdit*dte;
- vl->addWidget(dte=new QDateTimeEdit(TimeStamp(oldestOrderStamp()).toDateTime()));
+ vl->addWidget(dte=new QDateTimeEdit());
dte->setDisplayFormat(tr("ddd MMMM d yyyy, h:mm ap","time format"));
- dte->setDateTime(QDateTime::currentDateTime().addDays(-1));
+ dte->setDateTime(TimeStamp(oldestOrderStamp(OldestForSince)).toDateTime());
dte->setCalendarPopup(true);
vl->addSpacing(10);vl->addStretch(1);
vl->addLayout(hl=new QHBoxLayout);
}
//request data and display
resetModel();
- MTGetOrdersByEvents obe=req->queryGetOrdersByEvents(eventids,oldestOrderStamp());
+ MTGetOrdersByEvents obe=req->queryGetOrdersByEvents(eventids,oldestOrderStamp(OldestForEvent));
if(obe.hasError()){
QMessageBox::warning(this,tr("Warning"),tr("There was a problem retrieving the order list: %1").arg(obe.errorString()));
return;
}
//request data and display
resetModel();
- MTGetOrdersByCustomer obc=req->queryGetOrdersByCustomer(cst.customerid(),oldestOrderStamp());
+ MTGetOrdersByCustomer obc=req->queryGetOrdersByCustomer(cst.customerid(), oldestOrderStamp(OldestForCustomer));
if(obc.hasError()){
QMessageBox::warning(this,tr("Warning"),tr("Error while retrieving order list: %1").arg(obc.errorString()));
return;
#include <QSpinBox>
#include <QStatusBar>
#include <QTabWidget>
+#include <QGroupBox>
MOverview::MOverview(QString pk)
{
//get settings
int maxage=set.value("maxeventage", 0).toInt();
int maxageo=set.value("maxorderage", 0).toInt();
+ int maxageoo=set.value("maxorderageopen", 0).toInt();
+ int maxageoe=set.value("maxorderageevent", 0).toInt();
+ int maxageoc=set.value("maxorderagecust", 0).toInt();
+ int maxageos=set.value("deforderagesince", 7).toInt();
//dialog
QDialog d;
+ QLabel*lab;
+ QGroupBox*gbox;
d.setWindowTitle(tr("Display Settings"));
QGridLayout*gl;
QHBoxLayout*hl;
- d.setLayout(gl=new QGridLayout);
- int cl=0;
- gl->addWidget(new QLabel(tr("Maximum event age (days, 0=show all):")),cl,0);
+ QVBoxLayout*vl;
+ d.setLayout(vl=new QVBoxLayout);
+ vl->addWidget(gbox=new QGroupBox(tr("Event settings")),0);
+ gbox->setLayout(gl=new QGridLayout);
+ int cl=-1;
+ gl->addWidget(new QLabel(tr("Maximum event age (days, 0=show all):")),++cl,0);
QSpinBox*mage;
gl->addWidget(mage=new QSpinBox,cl,1);
mage->setRange(0,99999);
mage->setValue(maxage);
- gl->addWidget(new QLabel(tr("Maximum order list age (days, 0=show all):")),++cl,0);
+
+ vl->addWidget(gbox=new QGroupBox(tr("Maximum order list age")),0);
+ gbox->setLayout(gl=new QGridLayout);
+ cl=-1;
+ gl->addWidget(new QLabel(tr("Age in days, 0=show all.")),++cl,0,1,2);
+ gl->addWidget(new QLabel(tr("When showing all orders:")),++cl,0);
QSpinBox*oage;
gl->addWidget(oage=new QSpinBox,cl,1);
oage->setRange(0,99999);
oage->setValue(maxageo);
- gl->setRowMinimumHeight(++cl,5);
+ gl->addWidget(new QLabel(tr("When showing open orders:")),++cl,0);
+ QSpinBox*ooage;
+ gl->addWidget(ooage=new QSpinBox,cl,1);
+ ooage->setRange(0,99999);
+ ooage->setValue(maxageoo);
+ gl->addWidget(new QLabel(tr("When searching by event:")),++cl,0);
+ QSpinBox*oeage;
+ gl->addWidget(oeage=new QSpinBox,cl,1);
+ oeage->setRange(0,99999);
+ oeage->setValue(maxageoe);
+ gl->addWidget(new QLabel(tr("When searching by customer:")),++cl,0);
+ QSpinBox*ocage;
+ gl->addWidget(ocage=new QSpinBox,cl,1);
+ ocage->setRange(0,99999);
+ ocage->setValue(maxageoc);
+ gl->addWidget(new QLabel(tr("Default age when searching by date:")),++cl,0);
+ QSpinBox*osage;
+ gl->addWidget(osage=new QSpinBox,cl,1);
+ osage->setRange(0,99999);
+ osage->setValue(maxageos);
+
+ vl->addWidget(gbox=new QGroupBox(tr("Script settings")));
+ gbox->setLayout(gl=new QGridLayout);
+ cl=-1;
QComboBox*udeb;
gl->addWidget(new QLabel(tr("Show script debugger:")),++cl,0);
gl->addWidget(udeb=new QComboBox,cl,1);
udeb->addItems(MScriptEngine::debugModes());
udeb->setCurrentIndex(MScriptEngine::debugMode());
- gl->setRowMinimumHeight(++cl,15);
- gl->addLayout(hl=new QHBoxLayout,++cl,0,1,2);
+ vl->addSpacing(15);vl->addStretch(1);
+ vl->addLayout(hl=new QHBoxLayout);
hl->addStretch(10);
QPushButton*p;
hl->addWidget(p=new QPushButton(tr("&OK")));
//write settings
maxage=mage->value();
maxageo=oage->value();
+ maxageoo=ooage->value();
+ maxageoe=oeage->value();
+ maxageoc=ocage->value();
set.setValue("maxeventage",maxage);
set.setValue("maxorderage",maxageo);
+ set.setValue("maxorderageopen",maxageoo);
+ set.setValue("maxorderageevent",maxageoe);
+ set.setValue("maxorderagecust",maxageoc);
+ set.setValue("deforderagesince",maxageos);
MScriptEngine::setDebugMode(udeb->currentIndex());
}