| | |
| | | #include "searchinfo.h" |
| | | #include "searchinfo.h" |
| | | #include "ui_searchinfo.h" |
| | | #include <QAxObject> |
| | | #include <QDebug> |
| | |
| | | #include <QSqlQuery> |
| | | #include <QMessageBox> |
| | | #include <QFileDialog> |
| | | #include <QCalendarWidget> |
| | | |
| | | SearchInfo::SearchInfo(QWidget *parent) : |
| | | QMainWindow(parent), |
| | |
| | | // ui->label_3->hide(); |
| | | // ui->dateTimeEdit->hide(); |
| | | // ui->dateTimeEdit_2->hide(); |
| | | |
| | | ui->dateEdit_begin->calendarWidget()->setStyleSheet("background-color:#deab8a"); |
| | | ui->dateEdit_end->calendarWidget()->setStyleSheet("background-color:pink"); |
| | | ui->dateEdit_end->setDate(QDate::currentDate()); |
| | | |
| | | m_model = new QStandardItemModel(this); |
| | |
| | | QString item = ui->comboBox->currentText(); |
| | | QString comName = ui->comboBox_company->currentText(); |
| | | QString sql = QString("select * from %1 where com_id=%2").arg(m_itemAndTable[item]).arg(m_comInfo[comName]); |
| | | if(ui->checkBox->isChecked()){ // 勾选之后 |
| | | sql = QString("select * from %1 where com_id=%2 and time between '%3' and '%4'").arg(m_itemAndTable[item]).arg(m_comInfo[comName]) |
| | | .arg(ui->dateEdit_begin->date().toString("yyyy-MM-dd")) |
| | | .arg(ui->dateEdit_end->date().toString("yyyy-MM-dd")); |
| | | } |
| | | qDebug()<<__FUNCTION__<<sql; |
| | | QSqlQuery query; |
| | | if(query.exec(sql)){ |