| | |
| | | ui->setupUi(this); |
| | | m_menu = nullptr; |
| | | //initUi(); |
| | | readInfo(); // 加载表格 |
| | | //readInfo(); // 加载表格 |
| | | addMenu(); // 增加菜单 |
| | | disableWheelEvent(); // 禁用下拉框的滚轮事件 |
| | | |
| | | // 自适应处理 |
| | | ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| | |
| | | it4->setCheckState(0,Qt::Checked); |
| | | |
| | | // 复选框状态处理 |
| | | connect(ui->treeWidget,QOverload<QTreeWidgetItem*,int>::of(QTreeWidget::itemClicked),this,[=](QTreeWidgetItem* it,int index){ |
| | | connect(ui->treeWidget,QOverload<QTreeWidgetItem*,int>::of(&QTreeWidget::itemClicked),this,[=](QTreeWidgetItem* it,int index){ |
| | | qDebug()<<it<<index; |
| | | if(it == top1){ |
| | | qDebug()<<"点击了码蚁集团"; |
| | |
| | | m_menu = new QMenu(this); |
| | | m_menu->addAction("删除"); |
| | | m_menu->addAction("增加"); |
| | | m_menu->addAction("保存导出"); |
| | | |
| | | ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
| | | connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenu(QPoint))); |
| | | |
| | | connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteInfo())); |
| | | connect(m_menu->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(addInfo())); |
| | | connect(m_menu->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(saveInfo())); |
| | | // 单位内容修改 |
| | | |
| | | // 右边可编辑内容 |
| | |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"添加公司信息,在节点:"<<m_curItem->text(0); |
| | | on_pushButton_laodFile_clicked(); |
| | | } |
| | | |
| | | void ConverInfo2::deleteInfo() |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"删除公司信息,节点:"<<m_curItem->text(0); |
| | | //auto resList = m_curItem->takeChildren(); |
| | | |
| | | //qDebug()<<"删除数量:"<<resList.size(); |
| | | |
| | | // 删除数据库表里面对应的公司信息,并且再次刷新下拉框和树状图 |
| | | |
| | | // 数据库表有:封面信息表 all_company_info 综合信息表 comprehensive_entry_info 三合一的表 standing_book_info |
| | | QString name = m_curItem->text(0); |
| | | QStringList sp = name.split("(本级)"); |
| | | QStringList sp2 = name.split("下级数"); |
| | | qDebug()<<"拆开:"<<sp<<"汇总:"<<sp2; |
| | | if(sp.size() == 2){ |
| | | name = sp.at(0); |
| | | } |
| | | if(sp2.size() == 2){ // 得递归删除底下的所有单位 |
| | | name = sp2.at(0); |
| | | } |
| | | // 删除所有表中这个名字 |
| | | deleteAllByName(name); |
| | | |
| | | // 删除完了,还得去刷新下拉框 |
| | | for(auto it=m_nameAndComInfos.begin();it!=m_nameAndComInfos.end();){ |
| | | if(it.key() == name){ |
| | | m_nameAndComInfos.erase(it++); |
| | | break; |
| | | }else{ |
| | | it++; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 去刷新树形图 |
| | | for(auto it=m_treeNodes.begin();it!=m_treeNodes.end();){ |
| | | // 如果等于键,那么要删除对应的所有的值 |
| | | if(it.key() == name){ |
| | | // 把所有的值对应的单位信息都删掉 |
| | | for(auto str:it.value()){ |
| | | auto p = m_nameAndComInfos.find(str); |
| | | if(p != m_nameAndComInfos.end()){ |
| | | deleteAllByName(str); // 还得再删掉数据库中的内容 |
| | | m_nameAndComInfos.erase(p); |
| | | } |
| | | } |
| | | m_treeNodes.erase(it++); |
| | | break; |
| | | } |
| | | // 只是某个值,只删除一个即可,遍历值里面的迭代器,找到删除即可 |
| | | else{ |
| | | auto p = it.value().find(name); |
| | | if(p != it.value().end()){ |
| | | it.value().erase(p); |
| | | } |
| | | it++; |
| | | } |
| | | } |
| | | |
| | | emit updateComboListSignal(m_nameAndComInfos); |
| | | createTreeNode(); |
| | | |
| | | |
| | | } |
| | | |
| | | void ConverInfo2::saveInfo() |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"保存公司信息,节点:"<<m_curItem->text(0); |
| | | QString name = m_curItem->text(0); |
| | | if(name.contains("(本级)")){ |
| | | name = name.split("(本级)").at(0); |
| | | }else if(name.contains("(汇总)")){ |
| | | name = name.split("(汇总)").at(0); |
| | | name = name + "(汇总)"; |
| | | } |
| | | qDebug()<<"保存公司名:"<<name; |
| | | ComInfo cif = m_nameAndComInfos[name]; |
| | | ExportToFile etf(this); |
| | | etf.saveToExcelFromComInfo(cif); |
| | | |
| | | } |
| | | |
| | | void ConverInfo2::on_treeWidget_doubleClicked(const QModelIndex &index) |
| | | { |
| | | QString name = index.model()->data(index).toString(); |
| | | qDebug()<<"双击"<<index<<name; |
| | | ComInfo curCominfo = m_nameAndComInfos[name]; |
| | | |
| | | ComInfo curCominfo; // 不要直接给值,可能会导致多添加新的名字进来 |
| | | if(name.contains("(本级)")){ |
| | | QStringList sps = name.split("(本级)"); |
| | | name = sps.at(0); |
| | | curCominfo = m_nameAndComInfos[name]; |
| | | }else if(name.contains("(汇总)")){ |
| | | name = name.split("(汇总)").at(0); |
| | | qDebug()<<"汇总处理:"; |
| | | // 做一个汇总的处理,把所有下级的都累加起来 |
| | | ComInfo allCominfo = m_nameAndComInfos[name]; |
| | | for(QString cur:m_treeNodes[name]){ |
| | | if(name != cur){ |
| | | ComInfo &tmp = m_nameAndComInfos[cur]; |
| | | allCominfo.organazationNum += tmp.organazationNum; |
| | | allCominfo.realNum += tmp.realNum; |
| | | allCominfo.professionalNum += tmp.professionalNum; |
| | | allCominfo.CIANum += tmp.CIANum; |
| | | allCominfo.masterNum += tmp.masterNum; |
| | | allCominfo.undergraduatesNum += tmp.undergraduatesNum; |
| | | allCominfo.juniorNum += tmp.juniorNum; |
| | | allCominfo.seniorNum += tmp.seniorNum; |
| | | allCominfo.intermediateNum += tmp.intermediateNum; |
| | | allCominfo.primaryNum += tmp.primaryNum; |
| | | allCominfo.noTitleNum += tmp.noTitleNum; |
| | | allCominfo.upFiftyOldNum += tmp.upFiftyOldNum; |
| | | allCominfo.upThirtyOldNum += tmp.upThirtyOldNum; |
| | | allCominfo.downThirtyOldNum += tmp.downThirtyOldNum; |
| | | allCominfo.auditNum += tmp.auditNum; |
| | | allCominfo.accountingNum += tmp.accountingNum; |
| | | allCominfo.economyNum += tmp.economyNum; |
| | | allCominfo.lawNum += tmp.lawNum; |
| | | allCominfo.managerNum += tmp.managerNum; |
| | | allCominfo.itNum += tmp.itNum; |
| | | allCominfo.engineeringNum += tmp.engineeringNum; |
| | | allCominfo.otherNum += tmp.otherNum; |
| | | } |
| | | |
| | | } |
| | | curCominfo = allCominfo; |
| | | // 处理完了之后,还需要单独起一个汇总的名字 |
| | | name = name + "(汇总)"; |
| | | strcpy(curCominfo.name,name.toLocal8Bit().data()); |
| | | m_nameAndComInfos[name] = curCominfo; |
| | | |
| | | // 刷新组合下拉框的列表 |
| | | emit updateComboListSignal(m_nameAndComInfos); |
| | | |
| | | }else{ |
| | | curCominfo = m_nameAndComInfos[name]; |
| | | } |
| | | //ComInfo curCominfo = m_nameAndComInfos[name]; |
| | | // 一、单位基本情况 |
| | | ui->lineEdit_creditCode->setText(curCominfo.creditCode); |
| | | ui->lineEdit_name->setText(QString::fromLocal8Bit( curCominfo.name)); |
| | |
| | | it.next(); |
| | | list.append(it.fileInfo().absoluteFilePath()); |
| | | } |
| | | int allSize = list.size(); |
| | | float cntIdx=1.0; |
| | | foreach(QString str, list) |
| | | { |
| | | qDebug() << str; |
| | | int index = str.indexOf("内审统01表"); |
| | | qDebug()<<"index:"<<index; |
| | | |
| | | |
| | | if(index > 0){ |
| | | QAxObject excel("ket.Application"); |
| | | if(!excel.setControl("ket" |
| | |
| | | QVariant name = valRows[9].toList().at(8); |
| | | if(name.isValid()){ |
| | | ui->label_name->setText(name.toString()); |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name.toString()); |
| | | //QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | //top1->setText(0,name.toString()); |
| | | strcpy(curComInfo.name,name.toString().toLocal8Bit().data()); |
| | | |
| | | }else{ |
| | |
| | | |
| | | // 四、内审人员配备基本情况 |
| | | // 编制数 |
| | | QVariant organazationNum = valRows[56].toList().at(4); |
| | | //QVariant organazationNum = valRows[56].toList().at(4); |
| | | QVariant organazationNum = valRows[60].toList().at(4); |
| | | if(organazationNum.isValid()){ |
| | | curComInfo.organazationNum = organazationNum.toInt(); |
| | | qDebug()<<"organazationNum"<<organazationNum; |
| | | } |
| | | // 实有人员数 |
| | | QVariant realNum = valRows[56].toList().at(4); |
| | | QVariant realNum = valRows[60].toList().at(6); |
| | | if(realNum.isValid()){ |
| | | curComInfo.realNum = realNum.toInt(); |
| | | qDebug()<<"realNum"<<realNum; |
| | | } |
| | | // 专职人员数 |
| | | QVariant professionalNum = valRows[56].toList().at(4); |
| | | QVariant professionalNum = valRows[60].toList().at(8); |
| | | if(professionalNum.isValid()){ |
| | | curComInfo.professionalNum = professionalNum.toInt(); |
| | | qDebug()<<"professionalNum"<<professionalNum; |
| | | } |
| | | // 拥有CIA人员数 |
| | | QVariant CIANum = valRows[56].toList().at(4); |
| | | QVariant CIANum = valRows[61].toList().at(6); |
| | | if(CIANum.isValid()){ |
| | | curComInfo.CIANum = CIANum.toInt(); |
| | | qDebug()<<"CIANum"<<CIANum; |
| | | } |
| | | // 学历:硕士及以上 人员数 |
| | | QVariant masterNum = valRows[56].toList().at(4); |
| | | QVariant masterNum = valRows[62].toList().at(6); |
| | | if(masterNum.isValid()){ |
| | | curComInfo.masterNum = masterNum.toInt(); |
| | | qDebug()<<"masterNum"<<masterNum; |
| | | } |
| | | // 大学本科 |
| | | QVariant undergraduatesNum = valRows[56].toList().at(4); |
| | | QVariant undergraduatesNum = valRows[63].toList().at(6); |
| | | if(undergraduatesNum.isValid()){ |
| | | curComInfo.undergraduatesNum = undergraduatesNum.toInt(); |
| | | qDebug()<<"undergraduatesNum"<<undergraduatesNum; |
| | | } |
| | | // 专科及以下 |
| | | QVariant juniorNum = valRows[56].toList().at(4); |
| | | QVariant juniorNum = valRows[64].toList().at(6); |
| | | if(juniorNum.isValid()){ |
| | | curComInfo.juniorNum = juniorNum.toInt(); |
| | | qDebug()<<"juniorNum"<<juniorNum; |
| | | } |
| | | |
| | | // 职称 高级职称 |
| | | QVariant seniorNum = valRows[56].toList().at(4); |
| | | QVariant seniorNum = valRows[65].toList().at(6); |
| | | if(seniorNum.isValid()){ |
| | | curComInfo.seniorNum = seniorNum.toInt(); |
| | | qDebug()<<"seniorNum"<<seniorNum; |
| | | } |
| | | // 中级职称 |
| | | QVariant intermediateNum = valRows[56].toList().at(4); |
| | | QVariant intermediateNum = valRows[66].toList().at(6); |
| | | if(intermediateNum.isValid()){ |
| | | curComInfo.intermediateNum = intermediateNum.toInt(); |
| | | qDebug()<<"intermediateNum"<<intermediateNum; |
| | | } |
| | | // 初级职称 |
| | | QVariant primaryNum = valRows[56].toList().at(4); |
| | | QVariant primaryNum = valRows[67].toList().at(6); |
| | | if(primaryNum.isValid()){ |
| | | curComInfo.primaryNum = primaryNum.toInt(); |
| | | qDebug()<<"primaryNum"<<primaryNum; |
| | | } |
| | | // 无职称 |
| | | QVariant noTitleNum = valRows[56].toList().at(4); |
| | | QVariant noTitleNum = valRows[68].toList().at(6); |
| | | if(noTitleNum.isValid()){ |
| | | curComInfo.noTitleNum = noTitleNum.toInt(); |
| | | qDebug()<<"noTitleNum"<<noTitleNum; |
| | | } |
| | | |
| | | // 年龄结构 50岁以上 |
| | | QVariant upFiftyOldNum = valRows[56].toList().at(4); |
| | | QVariant upFiftyOldNum = valRows[69].toList().at(6); |
| | | if(upFiftyOldNum.isValid()){ |
| | | curComInfo.upFiftyOldNum = upFiftyOldNum.toInt(); |
| | | qDebug()<<"upFiftyOldNum"<<upFiftyOldNum; |
| | | } |
| | | // 30-50岁 |
| | | QVariant upThirtyOldNum = valRows[56].toList().at(4); |
| | | QVariant upThirtyOldNum = valRows[70].toList().at(6); |
| | | if(upThirtyOldNum.isValid()){ |
| | | curComInfo.upThirtyOldNum = upThirtyOldNum.toInt(); |
| | | qDebug()<<"upThirtyOldNum"<<upThirtyOldNum; |
| | | } |
| | | // 30岁以下 |
| | | QVariant downThirtyOldNum = valRows[56].toList().at(4); |
| | | QVariant downThirtyOldNum = valRows[71].toList().at(6); |
| | | if(downThirtyOldNum.isValid()){ |
| | | curComInfo.downThirtyOldNum = downThirtyOldNum.toInt(); |
| | | qDebug()<<"downThirtyOldNum"<<downThirtyOldNum; |
| | | } |
| | | |
| | | // 知识结构 审计 |
| | | QVariant auditNum = valRows[56].toList().at(4); |
| | | QVariant auditNum = valRows[72].toList().at(6); |
| | | if(auditNum.isValid()){ |
| | | curComInfo.auditNum = auditNum.toInt(); |
| | | qDebug()<<"auditNum"<<auditNum; |
| | | } |
| | | // 会计 |
| | | QVariant accountingNum = valRows[56].toList().at(4); |
| | | QVariant accountingNum = valRows[73].toList().at(6); |
| | | if(accountingNum.isValid()){ |
| | | curComInfo.accountingNum = accountingNum.toInt(); |
| | | qDebug()<<"accountingNum"<<accountingNum; |
| | | } |
| | | // 经济 |
| | | QVariant economyNum = valRows[56].toList().at(4); |
| | | QVariant economyNum = valRows[74].toList().at(6); |
| | | if(economyNum.isValid()){ |
| | | curComInfo.economyNum = economyNum.toInt(); |
| | | qDebug()<<"economyNum"<<economyNum; |
| | | } |
| | | // 法律 |
| | | QVariant lawNum = valRows[56].toList().at(4); |
| | | QVariant lawNum = valRows[75].toList().at(6); |
| | | if(lawNum.isValid()){ |
| | | curComInfo.lawNum = lawNum.toInt(); |
| | | qDebug()<<"lawNum"<<lawNum; |
| | | } |
| | | // 管理 |
| | | QVariant managerNum = valRows[56].toList().at(4); |
| | | QVariant managerNum = valRows[76].toList().at(6); |
| | | if(managerNum.isValid()){ |
| | | curComInfo.managerNum = managerNum.toInt(); |
| | | qDebug()<<"managerNum"<<managerNum; |
| | | } |
| | | // 信息技术 |
| | | QVariant itNum = valRows[56].toList().at(4); |
| | | QVariant itNum = valRows[77].toList().at(6); |
| | | if(itNum.isValid()){ |
| | | curComInfo.itNum = itNum.toInt(); |
| | | qDebug()<<"itNum"<<itNum; |
| | | } |
| | | // 工程 |
| | | QVariant engineeringNum = valRows[56].toList().at(4); |
| | | QVariant engineeringNum = valRows[78].toList().at(6); |
| | | if(engineeringNum.isValid()){ |
| | | curComInfo.engineeringNum = engineeringNum.toInt(); |
| | | qDebug()<<"engineeringNum"<<engineeringNum; |
| | | } |
| | | // 其他 |
| | | QVariant otherNum = valRows[56].toList().at(4); |
| | | QVariant otherNum = valRows[79].toList().at(6); |
| | | if(otherNum.isValid()){ |
| | | curComInfo.otherNum = otherNum.toInt(); |
| | | qDebug()<<"otherNum"<<otherNum; |
| | |
| | | // 最后存到map中 |
| | | m_nameAndComInfos[name.toString()]=curComInfo; |
| | | |
| | | // 更新到数据库中 |
| | | saveToSQL(curComInfo); |
| | | qDebug()<<"load Excel save to SQL ok:"<<name; |
| | | |
| | | |
| | | // 添加树形列表节点 |
| | | //addTreeWidgetNode(upName,name); |
| | | |
| | | if(upName.isValid()){ |
| | | if(name.isValid()){ |
| | | //m_treeNodes[upName.toString()].push_back(name.toString()); |
| | | m_treeNodes[upName.toString()].insert(name.toString()); |
| | | } |
| | | }else{ |
| | | if(name.isValid()){ |
| | | //m_treeNodes[name.toString()].push_back(name.toString()); |
| | | m_treeNodes[name.toString()].insert(name.toString()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | wbs->dynamicCall("Close()"); |
| | | excel.dynamicCall("Quit(void)"); |
| | | |
| | | |
| | | |
| | | qDebug()<<"单位信息数量:"<<m_nameAndComInfos.size(); |
| | | } |
| | | |
| | | // 控制显示进度相关 |
| | | emit loadProgress((cntIdx/allSize)*100); |
| | | cntIdx++; |
| | | } |
| | | |
| | | // 再次查询数据库中所有的信息 |
| | | readAllSQLData(); |
| | | |
| | | createTreeNode(); // 构建树形节点 |
| | | |
| | | // 发射 加载完成的信号 |
| | | emit loadFinished(); |
| | | |
| | | // 更新其他界面的公司信息下拉框 |
| | | emit updateComboListSignal(m_nameAndComInfos); |
| | | |
| | | // QAxObject excel("./debug/Data/附件2_内审统01表_单位及内部审计机构基本情况表-1.301版(1).xls"); |
| | | // excel.setProperty("Visible",true); |
| | |
| | | |
| | | m_menu->addAction("删除"); |
| | | m_menu->addAction("增加"); |
| | | m_menu->addAction("保存导出"); |
| | | |
| | | ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
| | | connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenu(QPoint))); |
| | | |
| | | connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteInfo())); |
| | | connect(m_menu->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(addInfo())); |
| | | connect(m_menu->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(saveInfo())); |
| | | } |
| | | |
| | | void ConverInfo2::on_pushButton_commit_clicked() |
| | |
| | | |
| | | |
| | | // 更新到数据库 |
| | | saveToSQL(curComInfo); |
| | | |
| | | // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | QString sql = QString("select id,name from all_company_info where name='%1'").arg(name); |
| | | qDebug()<<"sql:"<<sql; |
| | | QSqlQuery query; |
| | | int rowCnt = 0; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"size:"<<query.size(); |
| | | // // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | // QString sql = QString("select id,name from all_company_info where name='%1'").arg(name); |
| | | // qDebug()<<"sql:"<<sql; |
| | | // QSqlQuery query; |
| | | // int rowCnt = 0; |
| | | // if(query.exec(sql)){ |
| | | // qDebug()<<"size:"<<query.size(); |
| | | |
| | | while (query.next()) { |
| | | rowCnt++; |
| | | } |
| | | } |
| | | if(rowCnt == 0){ |
| | | // 不存在,则插入一条新数据 |
| | | qDebug()<<"不存在:"<<name; |
| | | sql = QString("insert into all_company_info (name,\ |
| | | code,\ |
| | | 机构类型,\ |
| | | 主要业务活动,\ |
| | | 行业代码,\ |
| | | 单位注册地及区域,\ |
| | | 区域代码,\ |
| | | 城乡代码,\ |
| | | 单位规模,\ |
| | | 从业期末人数,\ |
| | | 法定代表人,\ |
| | | 执行会记标准类别,\ |
| | | 长途区号,\ |
| | | 固定电话,\ |
| | | 邮政编码,\ |
| | | 电子邮箱,\ |
| | | 网址,\ |
| | | 是否有上一级法人,\ |
| | | 上一级统信代码,\ |
| | | 原组织代码,\ |
| | | 上级单位名称,\ |
| | | 是否设置总审计师,\ |
| | | 总审计师职位层级,\ |
| | | 总审任职方式,\ |
| | | 是否设置内审机构,\ |
| | | 内审机构名称,\ |
| | | 领导机构,\ |
| | | 是否独立设置内审机构,\ |
| | | 财务部门,\ |
| | | 法务部门,\ |
| | | 内部控制部门,\ |
| | | 纪检部门,\ |
| | | 其他部门,\ |
| | | 内审层级,\ |
| | | 编制数量,\ |
| | | 实有人数量,\ |
| | | 专职人员数量,\ |
| | | 拥有CIA人数,\ |
| | | 硕士学历以上人数,\ |
| | | 本科人数,\ |
| | | 专科及以下人数,\ |
| | | 高级职称人数,\ |
| | | 中级职称人数,\ |
| | | 初级职称人数,\ |
| | | 无职称人数,\ |
| | | 五十岁以上人数,\ |
| | | 三十至五十岁岁人数,\ |
| | | 三十岁以下人数,\ |
| | | 审计数量,\ |
| | | 会计数量,\ |
| | | 经济数量,\ |
| | | 法律数量,\ |
| | | 管理数量,\ |
| | | 信息技术数量,\ |
| | | 工程数量,\ |
| | | 其他数量,\ |
| | | 统计负责人,\ |
| | | 填表人,\ |
| | | 联系电话,\ |
| | | 填报日期) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\ |
| | | '%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\ |
| | | '%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\ |
| | | %31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\ |
| | | %41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\ |
| | | %51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\ |
| | | )").arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | // while (query.next()) { |
| | | // rowCnt++; |
| | | // } |
| | | // } |
| | | // if(rowCnt == 0){ |
| | | // // 不存在,则插入一条新数据 |
| | | // qDebug()<<"不存在:"<<name; |
| | | // sql = QString("insert into all_company_info (name,\ |
| | | //code,\ |
| | | //机构类型,\ |
| | | //主要业务活动,\ |
| | | //行业代码,\ |
| | | //单位注册地及区域,\ |
| | | //区域代码,\ |
| | | //城乡代码,\ |
| | | //单位规模,\ |
| | | //从业期末人数,\ |
| | | //法定代表人,\ |
| | | //执行会记标准类别,\ |
| | | //长途区号,\ |
| | | //固定电话,\ |
| | | //邮政编码,\ |
| | | //电子邮箱,\ |
| | | //网址,\ |
| | | //是否有上一级法人,\ |
| | | //上一级统信代码,\ |
| | | //原组织代码,\ |
| | | //上级单位名称,\ |
| | | //是否设置总审计师,\ |
| | | //总审计师职位层级,\ |
| | | //总审任职方式,\ |
| | | //是否设置内审机构,\ |
| | | //内审机构名称,\ |
| | | //领导机构,\ |
| | | //是否独立设置内审机构,\ |
| | | //财务部门,\ |
| | | //法务部门,\ |
| | | //内部控制部门,\ |
| | | //纪检部门,\ |
| | | //其他部门,\ |
| | | //内审层级,\ |
| | | //编制数量,\ |
| | | //实有人数量,\ |
| | | //专职人员数量,\ |
| | | //拥有CIA人数,\ |
| | | //硕士学历以上人数,\ |
| | | //本科人数,\ |
| | | //专科及以下人数,\ |
| | | //高级职称人数,\ |
| | | //中级职称人数,\ |
| | | //初级职称人数,\ |
| | | //无职称人数,\ |
| | | //五十岁以上人数,\ |
| | | //三十至五十岁岁人数,\ |
| | | //三十岁以下人数,\ |
| | | //审计数量,\ |
| | | //会计数量,\ |
| | | //经济数量,\ |
| | | //法律数量,\ |
| | | //管理数量,\ |
| | | //信息技术数量,\ |
| | | //工程数量,\ |
| | | //其他数量,\ |
| | | //统计负责人,\ |
| | | //填表人,\ |
| | | //联系电话,\ |
| | | //填报日期) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\ |
| | | //'%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\ |
| | | //'%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\ |
| | | //%31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\ |
| | | //%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\ |
| | | //%51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\ |
| | | //)").arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | // arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | // arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | // arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | // arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | // arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | |
| | | |
| | | qDebug()<<"sql insert:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"insert ok"; |
| | | }else{ |
| | | qDebug()<<"insert fail:"<<query.lastError().text(); |
| | | } |
| | | // qDebug()<<"sql insert:"<<sql; |
| | | // if(query.exec(sql)){ |
| | | // qDebug()<<"insert ok"; |
| | | // }else{ |
| | | // qDebug()<<"insert fail:"<<query.lastError().text(); |
| | | // } |
| | | |
| | | }else{ |
| | | // 更新 |
| | | qDebug()<<"存在:"<<name; |
| | | sql = QString("update all_company_info set name='%1',code='%2',机构类型='%3',主要业务活动='%4',行业代码='%5',单位注册地及区域='%6',区域代码='%7',城乡代码='%8',单位规模='%9',从业期末人数=%10\ |
| | | ,法定代表人='%11',执行会记标准类别='%12',长途区号='%13',固定电话='%14',邮政编码='%15',电子邮箱='%16',网址='%17',是否有上一级法人='%18',上一级统信代码='%19',原组织代码='%20'\ |
| | | ,上级单位名称='%21',是否设置总审计师='%22',总审计师职位层级='%23',总审任职方式='%24',是否设置内审机构='%25',内审机构名称='%26',领导机构='%27',是否独立设置内审机构='%28',财务部门=%29,法务部门=%30\ |
| | | ,内部控制部门=%31,纪检部门=%32,其他部门=%33,内审层级='%34',编制数量=%35,实有人数量=%36,专职人员数量=%37,拥有CIA人数=%38,硕士学历以上人数=%39,本科人数=%40\ |
| | | ,专科及以下人数=%41,高级职称人数=%42,中级职称人数=%43,初级职称人数=%44,无职称人数=%45,五十岁以上人数=%46,三十至五十岁岁人数=%47,三十岁以下人数=%48,审计数量=%49,会计数量=%50\ |
| | | ,经济数量=%51,法律数量=%52,管理数量=%53,信息技术数量=%54,工程数量=%55,其他数量=%56,统计负责人='%57',填表人='%58',联系电话='%59',填报日期='%60'"). |
| | | arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | // }else{ |
| | | // // 更新 |
| | | // qDebug()<<"存在:"<<name; |
| | | // sql = QString("update all_company_info set name='%1',code='%2',机构类型='%3',主要业务活动='%4',行业代码='%5',单位注册地及区域='%6',区域代码='%7',城乡代码='%8',单位规模='%9',从业期末人数=%10\ |
| | | //,法定代表人='%11',执行会记标准类别='%12',长途区号='%13',固定电话='%14',邮政编码='%15',电子邮箱='%16',网址='%17',是否有上一级法人='%18',上一级统信代码='%19',原组织代码='%20'\ |
| | | //,上级单位名称='%21',是否设置总审计师='%22',总审计师职位层级='%23',总审任职方式='%24',是否设置内审机构='%25',内审机构名称='%26',领导机构='%27',是否独立设置内审机构='%28',财务部门=%29,法务部门=%30\ |
| | | //,内部控制部门=%31,纪检部门=%32,其他部门=%33,内审层级='%34',编制数量=%35,实有人数量=%36,专职人员数量=%37,拥有CIA人数=%38,硕士学历以上人数=%39,本科人数=%40\ |
| | | //,专科及以下人数=%41,高级职称人数=%42,中级职称人数=%43,初级职称人数=%44,无职称人数=%45,五十岁以上人数=%46,三十至五十岁岁人数=%47,三十岁以下人数=%48,审计数量=%49,会计数量=%50\ |
| | | //,经济数量=%51,法律数量=%52,管理数量=%53,信息技术数量=%54,工程数量=%55,其他数量=%56,统计负责人='%57',填表人='%58',联系电话='%59',填报日期='%60'"). |
| | | // arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | // arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | // arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | // arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | // arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | // arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | |
| | | qDebug()<<"update sql:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"update ok"; |
| | | }else{ |
| | | qDebug()<<"update fail:"<<query.lastError().text(); |
| | | } |
| | | } |
| | | // qDebug()<<"update sql:"<<sql; |
| | | // if(query.exec(sql)){ |
| | | // qDebug()<<"update ok"; |
| | | // }else{ |
| | | // qDebug()<<"update fail:"<<query.lastError().text(); |
| | | // } |
| | | // } |
| | | |
| | | // 独立出来一个函数,传一个结构体就ok |
| | | } |
| | | |
| | | void ConverInfo2::readExcelFromPath(QString path) |
| | |
| | | qDebug()<<"excel:"<<excel.className(); |
| | | QAxObject * wbs = excel.querySubObject("WorkBooks"); |
| | | qDebug()<<"wbs:"<<wbs->className(); |
| | | QAxObject * wb = wbs->querySubObject("Open(QString&)",path); |
| | | QAxObject * wb = wbs->querySubObject("Open(QString&)",path); // 哪个对象是Open的返回值,哪个就可以保存 |
| | | //QAxObject* pWorkBook = excel.querySubObject("ActiveWorkBook"); |
| | | //QAxObject* pWorkSheets = pWorkBook->querySubObject("Sheets");//获取工作表 |
| | | //QAxObject * shs = wb->querySubObject("Sheets"); // WorkSheets 也可以 |
| | |
| | | qDebug()<<"financeDepartment"<<financeDepartment; |
| | | } |
| | | // 法务部门、内部控制部门、纪检部门、其他部门 |
| | | // 需要特殊获取 |
| | | QAxObject *checkBox = sheet->querySubObject("CheckBoxes(const QString&)", QString::fromLocal8Bit("财务部门")); |
| | | if(checkBox){ |
| | | qDebug()<<"取到财务部门"<<checkBox->property("Value2").toInt()<<checkBox->property("Value").toInt()<<checkBox->property("Value2").toBool(); |
| | | if(checkBox->property("Value").toBool()){ |
| | | qDebug()<<"财务部门勾选"; |
| | | }else{ |
| | | qDebug()<<"财务部门未勾选"; |
| | | } |
| | | }else{ |
| | | qDebug()<<"未取到财务部门"; |
| | | } |
| | | |
| | | QAxObject *checkBox1 = sheet->querySubObject("CheckBoxes(const QString&)", QString::fromLocal8Bit("法务部门")); |
| | | if(checkBox1){ |
| | | qDebug()<<"取到法务部门"<<checkBox1->property("Value").toInt(); |
| | | if(checkBox1->property("Value").toBool()){ |
| | | qDebug()<<"法务部门勾选"; |
| | | }else{ |
| | | qDebug()<<"法务部门未勾选"; |
| | | } |
| | | }else{ |
| | | qDebug()<<"未取到法务部门"; |
| | | } |
| | | |
| | | // 内审机构层级 |
| | | QVariant intavalAuditLeval = valRows[56].toList().at(4); |
| | |
| | | |
| | | // 添加左边树形图相关 |
| | | // 菜单相关 当上级公司为空上级时,自己当自己的上级,并且罗列进去当 本级 |
| | | addTreeWidgetNode(upName,name); |
| | | |
| | | if(upName.isValid()) // 有效 |
| | | { |
| | | // 判断顶层树节点是否已经存在 |
| | | QTreeWidgetItem *top = nullptr; |
| | | for(int k=0;k<ui->treeWidget->topLevelItemCount();++k){ |
| | | QTreeWidgetItem *tmp = ui->treeWidget->topLevelItem(k); |
| | | qDebug()<<k<<tmp->text(0)<<upName.toString(); |
| | | if(upName.toString()+"(汇总)" == tmp->text(0)){ |
| | | top = tmp; |
| | | break; |
| | | } |
| | | } |
| | | if(name.isValid()){ |
| | | if(top){ // 存在,则添加到孩子列表中 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(top); |
| | | top1->setText(0,name.toString()); |
| | | }else{ // 不存在,则新建一个列表 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name.toString()+"(汇总)"); |
| | | QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); |
| | | top2->setText(0,name.toString()+"(本级)"); |
| | | } |
| | | } |
| | | |
| | | |
| | | }else{ |
| | | qDebug()<<"没发现上一级,只能自己当"<<name; |
| | | if(name.isValid()){ |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name.toString()+"(汇总)"); |
| | | QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); |
| | | top2->setText(0,name.toString()+"(本级)"); |
| | | } |
| | | |
| | | } |
| | | // if(upName.isValid()){ |
| | | // if(name.isValid()){ |
| | | // m_treeNodes[upName.toString()].push_back(name.toString()); |
| | | // } |
| | | // }else{ |
| | | // if(name.isValid()){ |
| | | // m_treeNodes[name.toString()].push_back(name.toString()); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | excel.dynamicCall("Quit(void)"); |
| | | |
| | | qDebug()<<"单位信息数量:"<<m_nameAndComInfos.size(); |
| | | emit updateComboListSignal(m_nameAndComInfos); // 更新组合下拉框的单位信息 |
| | | } |
| | | |
| | | void ConverInfo2::createTreeNode(){ |
| | | // 先清除当前树上的所有节点 |
| | | ui->treeWidget->clear(); |
| | | |
| | | qDebug()<<"构建树形列表"<<m_treeNodes.size(); |
| | | for(auto iter=m_treeNodes.begin();iter != m_treeNodes.end();iter++) |
| | | { |
| | | // 先构建一个每级的父节点 |
| | | addTreeWidgetNode(iter.key(),iter.key()); |
| | | // 再添加孩子节点 |
| | | for(QString node:iter.value()){ |
| | | qDebug()<<iter.key()<<node; |
| | | if(iter.key() != node){ |
| | | addTreeWidgetNode(iter.key(),node); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::disableWheelEvent() |
| | | { |
| | | ui->comboBox_ChiefDesignerLevel->installEventFilter(this); |
| | | ui->comboBox_comType->installEventFilter(this); |
| | | ui->comboBox_employmentMode->installEventFilter(this); |
| | | ui->comboBox_hasChiefDesigner->installEventFilter(this); |
| | | ui->comboBox_hasSetIntervalAudit->installEventFilter(this); |
| | | ui->comboBox_hasSetSeparateIA->installEventFilter(this); |
| | | ui->comboBox_hasUpLegal->installEventFilter(this); |
| | | ui->comboBox_intavalAuditLeval->installEventFilter(this); |
| | | ui->comboBox_leadingOrganization->installEventFilter(this); |
| | | ui->comboBox_scale->installEventFilter(this); |
| | | ui->comboBox_standardType->installEventFilter(this); |
| | | } |
| | | |
| | | bool ConverInfo2::eventFilter(QObject *watched, QEvent *event) |
| | | { |
| | | QString cls = watched->metaObject()->className(); |
| | | if(cls == "QComboBox"){ |
| | | //qDebug()<<"发现下拉框"; |
| | | if(event->type() == QEvent::Wheel){ |
| | | //qDebug()<<"使用了滚轮"; |
| | | return true; // 返回真表示禁用,返回假则能用 |
| | | } |
| | | }else{ |
| | | qDebug()<<"其他类型:"<<cls; |
| | | } |
| | | |
| | | return QMainWindow::eventFilter(watched,event); |
| | | |
| | | } |
| | | |
| | | void ConverInfo2::saveToSQL(ComInfo &info) |
| | | { |
| | | // 更新到数据库 |
| | | |
| | | // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | QString sql = QString("select id,name from all_company_info where name='%1'").arg(QString::fromLocal8Bit(info.name)); |
| | | qDebug()<<"sql:"<<sql; |
| | | QSqlQuery query; |
| | | int rowCnt = 0; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"size:"<<query.size(); |
| | | |
| | | while (query.next()) { |
| | | rowCnt++; |
| | | } |
| | | qDebug()<<"rowCnt:"<<rowCnt; |
| | | } |
| | | if(rowCnt == 0){ |
| | | // 不存在,则插入一条新数据 |
| | | qDebug()<<"不存在:"<<QString::fromLocal8Bit(info.name); |
| | | sql = QString("insert into all_company_info (name,\ |
| | | code,\ |
| | | 机构类型,\ |
| | | 主要业务活动,\ |
| | | 行业代码,\ |
| | | 单位注册地及区域,\ |
| | | 区域代码,\ |
| | | 城乡代码,\ |
| | | 单位规模,\ |
| | | 从业期末人数,\ |
| | | 法定代表人,\ |
| | | 执行会记标准类别,\ |
| | | 长途区号,\ |
| | | 固定电话,\ |
| | | 邮政编码,\ |
| | | 电子邮箱,\ |
| | | 网址,\ |
| | | 是否有上一级法人,\ |
| | | 上一级统信代码,\ |
| | | 原组织代码,\ |
| | | 上级单位名称,\ |
| | | 是否设置总审计师,\ |
| | | 总审计师职位层级,\ |
| | | 总审任职方式,\ |
| | | 是否设置内审机构,\ |
| | | 内审机构名称,\ |
| | | 领导机构,\ |
| | | 是否独立设置内审机构,\ |
| | | 财务部门,\ |
| | | 法务部门,\ |
| | | 内部控制部门,\ |
| | | 纪检部门,\ |
| | | 其他部门,\ |
| | | 内审层级,\ |
| | | 编制数量,\ |
| | | 实有人数量,\ |
| | | 专职人员数量,\ |
| | | 拥有CIA人数,\ |
| | | 硕士学历以上人数,\ |
| | | 本科人数,\ |
| | | 专科及以下人数,\ |
| | | 高级职称人数,\ |
| | | 中级职称人数,\ |
| | | 初级职称人数,\ |
| | | 无职称人数,\ |
| | | 五十岁以上人数,\ |
| | | 三十至五十岁岁人数,\ |
| | | 三十岁以下人数,\ |
| | | 审计数量,\ |
| | | 会计数量,\ |
| | | 经济数量,\ |
| | | 法律数量,\ |
| | | 管理数量,\ |
| | | 信息技术数量,\ |
| | | 工程数量,\ |
| | | 其他数量,\ |
| | | 统计负责人,\ |
| | | 填表人,\ |
| | | 联系电话,\ |
| | | 填报日期) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\ |
| | | '%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\ |
| | | '%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\ |
| | | %31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\ |
| | | %41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\ |
| | | %51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\ |
| | | )").arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(QString::fromLocal8Bit(info.comType)).arg(QString::fromLocal8Bit(info.business)).arg(QString::fromLocal8Bit(info.businessCode)).arg(QString::fromLocal8Bit(info.addr)).arg(QString::fromLocal8Bit(info.areaCode)).arg(QString::fromLocal8Bit(info.townCode)).arg(QString::fromLocal8Bit(info.scale)).arg(info.people). |
| | | arg(QString::fromLocal8Bit(info.representative)).arg(QString::fromLocal8Bit(info.standardType)).arg(QString::fromLocal8Bit(info.trunkCode)).arg(QString::fromLocal8Bit(info.fixedTel)).arg(info.postCode).arg(QString::fromLocal8Bit(info.email)).arg(QString::fromLocal8Bit(info.webSite)).arg(QString::fromLocal8Bit(info.hasUpLegal)).arg(QString::fromLocal8Bit(info.upCreditCode)).arg(QString::fromLocal8Bit(info.oldCreditCode)). |
| | | arg(QString::fromLocal8Bit(info.upName)).arg(QString::fromLocal8Bit(info.hasChiefDesigner)).arg(QString::fromLocal8Bit(info.ChiefDesignerLevel)).arg(QString::fromLocal8Bit(info.employmentMode)).arg(QString::fromLocal8Bit(info.hasSetIntervalAudit)).arg(QString::fromLocal8Bit(info.internalName)).arg(QString::fromLocal8Bit(info.leadingOrganization)).arg(QString::fromLocal8Bit(info.hasSetSeparateIA)).arg(info.financeDepartment).arg(info.legalDepartment). |
| | | arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(QString::fromLocal8Bit(info.intavalAuditLeval)).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum). |
| | | arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum). |
| | | arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(QString::fromLocal8Bit(info.statisticalConOfficer)).arg(QString::fromLocal8Bit(info.personFilling)).arg(QString::fromLocal8Bit(info.officerTel)).arg(QString::fromLocal8Bit(info.fillingDateTime)); |
| | | |
| | | |
| | | qDebug()<<"sql insert:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"insert ok"; |
| | | }else{ |
| | | qDebug()<<"insert fail:"<<query.lastError().text(); |
| | | } |
| | | |
| | | }else{ |
| | | // 更新 |
| | | qDebug()<<"存在:"<<QString::fromLocal8Bit(info.name); |
| | | sql = QString("update all_company_info set name='%1',code='%2',机构类型='%3',主要业务活动='%4',行业代码='%5',单位注册地及区域='%6',区域代码='%7',城乡代码='%8',单位规模='%9',从业期末人数=%10\ |
| | | ,法定代表人='%11',执行会记标准类别='%12',长途区号='%13',固定电话='%14',邮政编码='%15',电子邮箱='%16',网址='%17',是否有上一级法人='%18',上一级统信代码='%19',原组织代码='%20'\ |
| | | ,上级单位名称='%21',是否设置总审计师='%22',总审计师职位层级='%23',总审任职方式='%24',是否设置内审机构='%25',内审机构名称='%26',领导机构='%27',是否独立设置内审机构='%28',财务部门=%29,法务部门=%30\ |
| | | ,内部控制部门=%31,纪检部门=%32,其他部门=%33,内审层级='%34',编制数量=%35,实有人数量=%36,专职人员数量=%37,拥有CIA人数=%38,硕士学历以上人数=%39,本科人数=%40\ |
| | | ,专科及以下人数=%41,高级职称人数=%42,中级职称人数=%43,初级职称人数=%44,无职称人数=%45,五十岁以上人数=%46,三十至五十岁岁人数=%47,三十岁以下人数=%48,审计数量=%49,会计数量=%50\ |
| | | ,经济数量=%51,法律数量=%52,管理数量=%53,信息技术数量=%54,工程数量=%55,其他数量=%56,统计负责人='%57',填表人='%58',联系电话='%59',填报日期='%60' where name='%1'").arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(QString::fromLocal8Bit(info.comType)).arg(QString::fromLocal8Bit(info.business)).arg(QString::fromLocal8Bit(info.businessCode)).arg(QString::fromLocal8Bit(info.addr)).arg(QString::fromLocal8Bit(info.areaCode)).arg(QString::fromLocal8Bit(info.townCode)).arg(QString::fromLocal8Bit(info.scale)).arg(info.people). |
| | | arg(QString::fromLocal8Bit(info.representative)).arg(QString::fromLocal8Bit(info.standardType)).arg(QString::fromLocal8Bit(info.trunkCode)).arg(QString::fromLocal8Bit(info.fixedTel)).arg(info.postCode).arg(QString::fromLocal8Bit(info.email)).arg(QString::fromLocal8Bit(info.webSite)).arg(QString::fromLocal8Bit(info.hasUpLegal)).arg(QString::fromLocal8Bit(info.upCreditCode)).arg(QString::fromLocal8Bit(info.oldCreditCode)). |
| | | arg(QString::fromLocal8Bit(info.upName)).arg(QString::fromLocal8Bit(info.hasChiefDesigner)).arg(QString::fromLocal8Bit(info.ChiefDesignerLevel)).arg(QString::fromLocal8Bit(info.employmentMode)).arg(QString::fromLocal8Bit(info.hasSetIntervalAudit)).arg(QString::fromLocal8Bit(info.internalName)).arg(QString::fromLocal8Bit(info.leadingOrganization)).arg(QString::fromLocal8Bit(info.hasSetSeparateIA)).arg(info.financeDepartment).arg(info.legalDepartment). |
| | | arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(QString::fromLocal8Bit(info.intavalAuditLeval)).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum). |
| | | arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum). |
| | | arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(QString::fromLocal8Bit(info.statisticalConOfficer)).arg(QString::fromLocal8Bit(info.personFilling)).arg(QString::fromLocal8Bit(info.officerTel)).arg(QString::fromLocal8Bit(info.fillingDateTime)); |
| | | /*. |
| | | arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(info.comType).arg(info.business).arg(info.businessCode).arg(info.addr).arg(info.areaCode).arg(info.townCode).arg(info.scale).arg(info.people). |
| | | arg(info.representative).arg(info.standardType).arg(info.trunkCode).arg(info.fixedTel).arg(info.postCode).arg(info.email).arg(info.webSite).arg(info.hasUpLegal).arg(info.upCreditCode).arg(info.oldCreditCode). |
| | | arg(info.upName).arg(info.hasChiefDesigner).arg(info.ChiefDesignerLevel).arg(info.employmentMode).arg(info.hasSetIntervalAudit).arg(info.internalName).arg(info.leadingOrganization).arg(info.hasSetSeparateIA).arg(info.financeDepartment).arg(info.legalDepartment). |
| | | arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(info.intavalAuditLeval).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum). |
| | | arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum). |
| | | arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(info.statisticalConOfficer).arg(info.personFilling).arg(info.officerTel).arg(info.fillingDateTime);*/ |
| | | |
| | | qDebug()<<"update sql:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"update ok"; |
| | | }else{ |
| | | qDebug()<<"update fail:"<<query.lastError().text(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::readAllSQLData() |
| | | { |
| | | QString sql = QString("select * from all_company_info"); |
| | | qDebug()<<"sql:"<<sql; |
| | | QSqlQuery query; |
| | | int rowCnt = 0; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"size:"<<query.size(); |
| | | |
| | | |
| | | while (query.next()) { |
| | | rowCnt++; |
| | | ComInfo info; // 单位信息结构体 |
| | | // 基本情况 |
| | | strcpy(info.name,query.value(1).toString().toLocal8Bit().data()); |
| | | strcpy(info.creditCode,query.value(2).toString().toLocal8Bit().data()); |
| | | strcpy(info.comType,query.value(3).toString().toLocal8Bit().data()); |
| | | strcpy(info.business,query.value(4).toString().toLocal8Bit().data()); |
| | | strcpy(info.businessCode,query.value(5).toString().toLocal8Bit().data()); |
| | | strcpy(info.addr,query.value(6).toString().toLocal8Bit().data()); |
| | | strcpy(info.areaCode,query.value(7).toString().toLocal8Bit().data()); |
| | | strcpy(info.townCode,query.value(8).toString().toLocal8Bit().data()); |
| | | strcpy(info.scale,query.value(9).toString().toLocal8Bit().data()); |
| | | info.people = query.value(10).toInt(); |
| | | strcpy(info.representative,query.value(11).toString().toLocal8Bit().data()); |
| | | strcpy(info.standardType,query.value(12).toString().toLocal8Bit().data()); |
| | | strcpy(info.trunkCode,query.value(13).toString().toLocal8Bit().data()); |
| | | strcpy(info.fixedTel,query.value(14).toString().toLocal8Bit().data()); |
| | | strcpy(info.postCode,query.value(15).toString().toLocal8Bit().data()); |
| | | strcpy(info.email,query.value(16).toString().toLocal8Bit().data()); |
| | | strcpy(info.webSite,query.value(17).toString().toLocal8Bit().data()); |
| | | // 单位组织结构情况 |
| | | strcpy(info.hasUpLegal,query.value(18).toString().toLocal8Bit().data()); |
| | | strcpy(info.upCreditCode,query.value(19).toString().toLocal8Bit().data()); |
| | | strcpy(info.oldCreditCode,query.value(20).toString().toLocal8Bit().data()); |
| | | strcpy(info.upName,query.value(21).toString().toLocal8Bit().data()); |
| | | |
| | | // 总审计师与内部审计机构基本情况 |
| | | strcpy(info.hasChiefDesigner,query.value(22).toString().toLocal8Bit().data()); |
| | | strcpy(info.ChiefDesignerLevel,query.value(23).toString().toLocal8Bit().data()); |
| | | strcpy(info.employmentMode,query.value(24).toString().toLocal8Bit().data()); |
| | | strcpy(info.hasSetIntervalAudit,query.value(25).toString().toLocal8Bit().data()); |
| | | strcpy(info.internalName,query.value(26).toString().toLocal8Bit().data()); |
| | | strcpy(info.leadingOrganization,query.value(27).toString().toLocal8Bit().data()); |
| | | strcpy(info.hasSetSeparateIA,query.value(28).toString().toLocal8Bit().data()); |
| | | info.financeDepartment = query.value(29).toBool(); |
| | | info.legalDepartment = query.value(30).toBool(); |
| | | info.internalConDepart = query.value(31).toBool(); |
| | | info.disceplineInDepart = query.value(32).toBool(); |
| | | info.otherDepart = query.value(33).toBool(); |
| | | strcpy(info.intavalAuditLeval,query.value(34).toString().toLocal8Bit().data()); |
| | | |
| | | // 内部审计人员配备基本情况 |
| | | info.organazationNum = query.value(35).toInt(); |
| | | info.realNum = query.value(36).toInt(); |
| | | info.professionalNum = query.value(37).toInt(); |
| | | info.CIANum = query.value(38).toInt(); |
| | | info.masterNum = query.value(39).toInt(); |
| | | info.undergraduatesNum = query.value(40).toInt(); |
| | | info.juniorNum = query.value(41).toInt(); |
| | | info.seniorNum = query.value(42).toInt(); |
| | | info.intermediateNum = query.value(43).toInt(); |
| | | info.primaryNum = query.value(44).toInt(); |
| | | info.noTitleNum = query.value(45).toInt(); |
| | | info.upFiftyOldNum = query.value(46).toInt(); |
| | | info.upThirtyOldNum = query.value(47).toInt(); |
| | | info.downThirtyOldNum = query.value(48).toInt(); |
| | | info.auditNum = query.value(49).toInt(); |
| | | info.accountingNum = query.value(50).toInt(); |
| | | info.economyNum = query.value(51).toInt(); |
| | | info.lawNum = query.value(52).toInt(); |
| | | info.managerNum = query.value(53).toInt(); |
| | | info.itNum = query.value(54).toInt(); |
| | | info.engineeringNum = query.value(55).toInt(); |
| | | info.otherNum = query.value(56).toInt(); |
| | | |
| | | // 后面的4个信息 |
| | | strcpy(info.statisticalConOfficer,query.value(57).toString().toLocal8Bit().data()); |
| | | strcpy(info.personFilling,query.value(58).toString().toLocal8Bit().data()); |
| | | strcpy(info.officerTel,query.value(59).toString().toLocal8Bit().data()); |
| | | strcpy(info.fillingDateTime,query.value(60).toString().toLocal8Bit().data()); |
| | | |
| | | // 存信息到map |
| | | QString name = query.value(1).toString(); |
| | | m_nameAndComInfos[query.value(1).toString()] = info; |
| | | // 存名字到单位树map |
| | | QString upName = query.value(21).toString(); |
| | | if(!upName.isEmpty()){ |
| | | //m_treeNodes[upName].push_back(name); |
| | | m_treeNodes[upName].insert(name); |
| | | }else{ |
| | | //m_treeNodes[name].push_back(name); |
| | | //m_treeNodes[upName].insert(name); |
| | | if(!name.isEmpty()){ |
| | | //m_treeNodes[name.toString()].push_back(name.toString()); |
| | | m_treeNodes[name].insert(name); |
| | | } |
| | | } |
| | | qDebug()<<"name"<<name<<"upName"<<upName; |
| | | |
| | | } |
| | | qDebug()<<"rowCnt:"<<rowCnt; |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::deleteAllByName(QString name) |
| | | { |
| | | // 数据库表有:封面信息表 all_company_info |
| | | // 综合信息表 comprehensive_entry_info |
| | | // 三合一的表 standing_book_info |
| | | |
| | | QString first_sql = QString("delete from all_company_info where name='%1'").arg(name); |
| | | qDebug()<<"first_sql:"<<first_sql; |
| | | |
| | | QString second_sql = QString("delete from comprehensive_entry_info where name='%1'").arg(name); |
| | | qDebug()<<"second_sql:"<<second_sql; |
| | | |
| | | QString three_sql = QString("delete from standing_book_info where 责任主体名称='%1'").arg(name); |
| | | qDebug()<<"three_sql:"<<three_sql; |
| | | |
| | | |
| | | QSqlQuery query; |
| | | if(query.exec(first_sql)) |
| | | { |
| | | qDebug()<<"first_sql run ok"; |
| | | } |
| | | if(query.exec(second_sql)) |
| | | { |
| | | qDebug()<<"second_sql run ok"; |
| | | } |
| | | if(query.exec(three_sql)) |
| | | { |
| | | qDebug()<<"three_sql run ok"; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | void ConverInfo2::addTreeWidgetNode(QVariant upName,QVariant name){ |
| | | // 添加左边树形图相关 |
| | | // 菜单相关 当上级公司为空上级时,自己当自己的上级,并且罗列进去当 本级 |
| | | |
| | | if(upName.isValid()) // 有效 |
| | | { |
| | | // 判断顶层树节点是否已经存在 |
| | | QTreeWidgetItem *top = nullptr; |
| | | for(int k=0;k<ui->treeWidget->topLevelItemCount();++k){ |
| | | QTreeWidgetItem *tmp = ui->treeWidget->topLevelItem(k); |
| | | qDebug()<<k<<tmp->text(0)<<upName.toString(); |
| | | int pos = tmp->text(0).indexOf(upName.toString()+"(汇总)"); |
| | | if(upName.toString()+"(汇总)" == tmp->text(0) || pos != -1){ |
| | | top = tmp; |
| | | break; |
| | | } |
| | | } |
| | | if(name.isValid()){ |
| | | if(top){ // 存在,则添加到孩子列表中 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(top); |
| | | top1->setText(0,name.toString()); |
| | | top->setText(0,upName.toString()+"(汇总)下级数:"+QString::number(top->childCount()-1)); |
| | | }else{ // 不存在,则新建一个列表 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name.toString()+"(汇总)"); |
| | | QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); |
| | | top2->setText(0,name.toString()+"(本级)"); |
| | | top1->setText(0,name.toString()+"(汇总)下级数:"+QString::number(top1->childCount()-1)); |
| | | } |
| | | } |
| | | |
| | | |
| | | }else{ |
| | | qDebug()<<"没发现上一级,只能自己当"<<name; |
| | | if(name.isValid()){ |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name.toString()+"(汇总)"); |
| | | QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); |
| | | top2->setText(0,name.toString()+"(本级)"); |
| | | top1->setText(0,name.toString()+"(汇总)下级数:"+QString::number(top1->childCount()-1)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | void ConverInfo2::on_pushButton_laodFile_clicked() |
| | | { |
| | | QString path = QFileDialog::getOpenFileName(this,"选择表格:单位及内部审计机构基本情况表","./","excel(*基本情况表*.xls)"); |
| | |
| | | readExcelFromPath(path); |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::showExcelSlot() |
| | | { |
| | | readInfo(); // 加载表格 |
| | | } |
| | | |
| | | void ConverInfo2::on_pushButton_save_to_file_clicked() |
| | | { |
| | | QString name = ui->lineEdit_name->text(); |
| | | if(name.size()== 0){ |
| | | QMessageBox::information(this,"单位名称为空,请先选中一家单位","请先选中一家单位"); |
| | | return; |
| | | } |
| | | ExportToFile etf(this); |
| | | ComInfo cif = m_nameAndComInfos[name]; |
| | | etf.saveToExcelFromComInfo(cif); |
| | | } |