void shift_work::init_data() { QString date1 = ui->label_7->text(); QString date2 = ui->label_8->text(); QSqlQueryModel model; model.setQuery(QString("select count(a.ch_tableno), ifnull(sum(a.int_person), 0)from cey_u_table a , cey_u_checkout_master b where a.ch_payno =b.ch_payno and b.ch_state ='Y' and(b.vch_operID ='%1')and(b.dt_operdate >= '%2' and b.dt_operdate <='%3' )").arg(n_func::gs_operid).arg(date1).arg(date2)); taishu = model.record(0).value(0).toString(); renshu = model.record(0).value(1).toString(); model.clear(); model.setQuery(QString("Select ifnull(sum(num_cost), 0), ifnull(sum(num_discount), 0), ifnull(sum(num_present), 0), ifnull(sum(num_service), 0), ifnull(sum(num_lowcost), 0), ifnull(sum(num_blotout), 0), ifnull(sum (ifnull( num_free ,0)) , 0 ),ifnull(sum(num_cost), 0 )+ ifnull(sum(num_rate), 0 )- ifnull(sum(num_discount), 0)-ifnull(sum(num_present), 0)+ifnull(sum(num_service), 0)+ ifnull(sum(num_lowcost), 0)-ifnull(sum(num_blotout), 0)-ifnull(sum (ifnull(num_free,0 )) , 0 ),ifnull(sum(num_rate), 0)from cey_u_checkout_master where ch_state ='Y' and(vch_operID ='%1')and(dt_operdate >= '%2' and dt_operdate <= '%3' )").arg(n_func::gs_operid).arg(date1).arg(date2)); xiaofei = QString().sprintf("%0.2f",model.record(0).value(0).toFloat()); zhekou = QString().sprintf("%0.2f",model.record(0).value(1).toFloat()); zengsong = QString().sprintf("%0.2f",model.record(0).value(2).toFloat()); fuwufei = QString().sprintf("%0.2f",model.record(0).value(3).toFloat()); dixiao = QString().sprintf("%0.2f",model.record(0).value(4).toFloat()); moling = QString().sprintf("%0.2f",model.record(0).value(5).toFloat()); miandan = QString().sprintf("%0.2f",model.record(0).value(6).toFloat()); yingshou = QString().sprintf("%0.2f",model.record(0).value(7).toFloat()); shuishou = QString().sprintf("%0.2f",model.record(0).value(8).toFloat()); // model.clear(); // model.setQuery(QString("Select ifnull(sum(num_deposit), 0) from t_m_deposit where(vch_operID ='%1')and(dt_operdate >= '%2' and dt_operdate <= '%3')").arg(n_func::gs_operid).arg(date1).arg(date2)); // kafue = QString().sprintf("%0.2f",model.record(0).value(0).toFloat());//充值金额 // qDebug() << model.query().lastQuery(); // model.clear(); // model.setQuery(QString("Select ifnull(sum(num_realamount), 0) from t_m_deposit where(vch_operID ='%1')and(dt_operdate >= '%2' and dt_operdate <= '%3' )").arg(n_func::gs_operid).arg(date1).arg(date2)); // kafue_realamount = QString().sprintf("%0.2f",model.record(0).value(0).toFloat());//充值实收 // qDebug() << model.query().lastQuery(); }
void shift_work::inti_control() { QSqlQueryModel model; if(n_func::gs_operid == "0000") { ui->label_3->setText(tr("system(0000)")); } else { model.setQuery(QString("select vch_operator from cey_sys_operator where vch_operID = '%1' ").arg(n_func::gs_operid)); QString str = model.record(0).value(0).toString().trimmed() + tr("(") + n_func::gs_operid + tr(")"); ui->label_3->setText(str); } if(_str == "0000") { ui->label_5->setText(tr("system(0000)")); } else { model.setQuery(QString("select vch_operator from cey_sys_operator where vch_operID = '%1' ").arg(_str)); QString str = model.record(0).value(0).toString().trimmed() + tr("(") + _str + tr(")"); ui->label_5->setText(str); } model.clear(); model.setQuery(QString("Select max( dt_end)from cey_u_handover_master where vch_operID ='%1'").arg(n_func::gs_operid)); if(!model.record(0).value(0).toString().isEmpty()) { ui->label_7->setText(model.record(0).value(0).toDateTime().toString("yyyy-MM-dd hh:mm:ss")); } else { model.clear(); model.setQuery(QString("Select Min( dt_operdate)from cey_u_checkout_master where vch_operid ='%1'").arg(n_func::gs_operid)); ui->label_7->setText(model.record(0).value(0).toDateTime().toString("yyyy-MM-dd hh:mm:ss")); } model.clear(); model.setQuery(QString("Select NOW()")); ui->label_8->setText(model.record(0).value(0).toDateTime().toString("yyyy-MM-dd hh:mm:ss")); }
void discount_dispose::on_pushButton_13_clicked()//确定 { this->close(); if(n_func::gs_operid != "0000") { QSqlQueryModel model; model.setQuery(QString("Select int_discount from cey_sys_operator where vch_operID ='%1' and ch_flag = 'Y' ").arg(n_func::gs_operid)); int operdis = model.record(0).value(0).toInt(); if(operdis > ui->lineEdit->text().toInt()) { if(0==lds_messagebox::warning(this, tr("消息提示"),tr("指定操作员没有该折扣权限!"),tr("确认"),tr("取消"))) { power_oper oper; /*oper.exec();*/backheader::static_dialogexec(oper, tr("权限核实")); if(oper.btn_t_f == true) { if(oper.operid != "0000") { model.clear(); model.setQuery(QString("Select int_discount from cey_sys_operator where vch_operID ='%1' and ch_flag = 'Y' ").arg(oper.operid)); int zhe = model.record(0).value(0).toInt(); if(zhe > ui->lineEdit->text().toInt()) { ; lds_messagebox::warning(this, tr("消息提示"),tr("指定操作员没有该折扣权限!")); return; } } } else { return; } } else { return; } } } zhekouzhi = ui->lineEdit->text().toFloat(); btn_t_f = true; }
void cook_operation::init_control() { ui->lineEdit->setFocus(); // ui->tableView->verticalHeader()->hide(); // ui->tableView->horizontalHeader()->setStyleSheet("QHeaderView::section{background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 74, 255), stop:1 rgba(255, 255,21, 255));color:black;height:35px;border-radius:0px;font-size:14pt;}"); // ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); // ui->tableView->verticalHeader()->setDefaultSectionSize(50); // //ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);//设置属性为只读 // ui->tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents );//文字自适应表格 QStringList labels; labels <<"行号"<<"是否锁定" <<"餐桌号" <<"餐桌名"<<"餐桌类型" <<"当前单号" ; table_model = new QStandardItemModel(); table_model->setHorizontalHeaderLabels(labels); // ui->tableView->setModel(table_model); ui->tableView->setModel(table_model); lds_tableview_delegate_check *delegate=new lds_tableview_delegate_check(QVector<int>() << 1 ,ui->tableView); //delegate->setClickable(); ui->tableView->setItemDelegate(delegate); QSqlQueryModel model; QSqlQueryModel type; model.setQuery(QString("select * from cey_bt_table where ch_billno <> '' and ch_tableno <> '%1' ").arg(frontViewDialog_virtual::cur_desk_no)); for(int i = 0; i < model.rowCount(); i++) { int row = table_model->rowCount(); table_model->setRowCount(row + 1); table_model->setItem(row,0,new QStandardItem(QString::number(row + 1))); //行号 table_model->setItem(row,1,new QStandardItem(model.record(i).value(4).toString())); //是否锁定 table_model->setItem(row,2,new QStandardItem(model.record(i).value(0).toString())); //餐桌号 table_model->setItem(row,3,new QStandardItem(model.record(i).value(1).toString())); //餐桌名 type.clear(); type.setQuery(QString("select vch_typename from cey_bt_table_type where ch_typeno ='%1' ").arg(model.record(i).value(9).toString())); table_model->setItem(row,4,new QStandardItem(type.record(0).value(0).toString())); //餐桌类型 table_model->setItem(row,5,new QStandardItem(model.record(i).value(3).toString())); //当前单号 } // ui->tableView->setColumnWidth(0,40); // ui->tableView->setColumnWidth(1,80); // ui->tableView->setColumnWidth(2,100); // ui->tableView->setColumnWidth(3,100); // ui->tableView->setColumnWidth(4,100); // ui->tableView->setColumnWidth(5,150); // ui->tableView->horizontalHeader()->setResizeMode(0,QHeaderView::Fixed); // ui->tableView->horizontalHeader()->setResizeMode(1,QHeaderView::Fixed); // ui->tableView->horizontalHeader()->setResizeMode(2,QHeaderView::Fixed); // ui->tableView->horizontalHeader()->setResizeMode(3,QHeaderView::Fixed); // ui->tableView->horizontalHeader()->setResizeMode(4,QHeaderView::Fixed); // ui->tableView->horizontalHeader()->setResizeMode(5,QHeaderView::Fixed); if(table_model->rowCount() > 0) { ui->lineEdit->setText(table_model->item(0,2)->text()); ui->tableView->selectRow(0); zhuan_danhao = table_model->item(0,5)->text(); zhuan_zhuohao = table_model->item(0,2)->text(); } }