1 Star 0 Fork 2

尘年灬往事 / smart-community

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
owner_feiyong_add_widget.cpp 3.28 KB
一键复制 编辑 原始数据 按行查看 历史
QingluWang 提交于 2019-01-23 16:00 . 业主->费用管理模块完成
#include "owner_feiyong_add_widget.h"
extern QString GLOBAL_ACCOUNT_NUM;
OwnerFeiYongAddWidget::OwnerFeiYongAddWidget()
{
label_1=new QLabel;
label_2=new QLabel;
label_3=new QLabel;
radio_btn_1=new QRadioButton;
radio_btn_2=new QRadioButton;
radio_btn_3=new QRadioButton;
lineEdit_1=new QLineEdit;
lineEdit_2=new QLineEdit;
qbg=new QButtonGroup;
radio_btn_1=new QRadioButton;
radio_btn_2=new QRadioButton;
radio_btn_3=new QRadioButton;
qbg=new QButtonGroup();
layout_1=new QHBoxLayout;
layout_2=new QHBoxLayout;
layout_3=new QHBoxLayout;
label_1->setText("业主账号");
label_2->setText("缴费类型");
label_3->setText("缴费数额");
radio_btn_1->setText("物业费");
radio_btn_2->setText("车位费");
radio_btn_3->setText("故障维修费");
lineEdit_1->setFocus();
qbg->addButton(radio_btn_1);
qbg->addButton(radio_btn_2);
qbg->addButton(radio_btn_3);
qbg->setId(radio_btn_1,1);
qbg->setId(radio_btn_2,2);
qbg->setId(radio_btn_3,3);
radio_btn_1->setChecked(true);
layout_1->addWidget(label_1,1);
layout_1->addWidget(lineEdit_1,3);
layout_2->addWidget(label_2,1);
layout_2->addWidget(radio_btn_1,1);
layout_2->addWidget(radio_btn_2,1);
layout_2->addWidget(radio_btn_3,1);
layout_3->addWidget(label_3,1);
layout_3->addWidget(lineEdit_2,3);
layout->addLayout(layout_2);
layout->addLayout(layout_3);
layout->addLayout(b_layout);
connect(this->enter_btn,QPushButton::clicked,this,enter);
connect(this->clear_btn,QPushButton::clicked,this,clear);
}
void OwnerFeiYongAddWidget::init(){
lineEdit_1->setText("");
lineEdit_2->setText("");
radio_btn_1->setChecked(true);
}
bool OwnerFeiYongAddWidget::isExisted(const QString &key){
QString str=QString("select count(*) from user"
" where u_type=3 and account_num='%1'").arg(key);
QSqlQuery query;
if(!query.exec(str)){
QMessageBox::information(this,tr("错误"),tr("加载错误!"),QMessageBox::Ok);
return false;
}
query.next();
if(query.value(0).toInt()>0)
return true;
return false;
}
void OwnerFeiYongAddWidget::sendSignal(){
emit newFeiYong();
}
void OwnerFeiYongAddWidget::enter(){
if(lineEdit_2->text().isEmpty()){
QMessageBox::information(this,tr("错误"),tr("缴费数额不能为空!"),QMessageBox::Ok);
lineEdit_2->setFocus();
}
else{
QString accountNum=GLOBAL_ACCOUNT_NUM;
int f_count=lineEdit_2->text().toInt();
int f_type=qbg->checkedId();
QSqlQuery query;
QString str=QString("insert into feiyong"
" (account_num,f_type,f_count,f_date)"
" values('%1',%2,%3,now())").arg(accountNum)
.arg(f_type).arg(f_count);
qDebug()<<str;
if(query.exec(str)){
QMessageBox::information(this,tr("成功"),tr("缴费成功!"),QMessageBox::Ok);
}
else
QMessageBox::information(this,tr("失败"),tr("缴费失败!"),QMessageBox::Ok);
}
//发送信号,要求更新列表
this->sendSignal();
}
void OwnerFeiYongAddWidget::clear(){
lineEdit_1->setText("");
lineEdit_2->setText("");
lineEdit_1->setFocus();
}
1
https://gitee.com/mikema_138/smart-community.git
git@gitee.com:mikema_138/smart-community.git
mikema_138
smart-community
smart-community
master

搜索帮助