/trunk/source_code/src/addsotrydnikform.cpp |
---|
New file |
0,0 → 1,61 |
#include "addsotrydnikform.h" |
#include "mainwindowimpl.h" |
// place your code here |
addsotrydnikForm::addsotrydnikForm() |
: QDialog() |
{ |
// QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
setupUi(this); |
// proizv_list = getManufacturiesList(); |
// comboBox->addItems(proizv_list); |
// TODO |
connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNewSotrydnikSlot())); |
} |
void addsotrydnikForm::closeEvent ( QCloseEvent * event ) { |
emit formClose(); |
} |
void addsotrydnikForm::addNewSotrydnikSlot(){ |
QSqlQuery q; |
QString sqltext; |
int field_fio, field_identifikator, field_identifikator_otdela; |
QString id, fio, id_otdela; |
bool ok; |
if (lineEdit->text()==""){ |
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
this, // Ðîäèòåëüñêèé âèäæåò. |
QObject::tr("Îøèáêà äîáîâëåíèÿ ñîòðóäíèêà"), // Çàãîëîâîê. |
tr("Âû íå ââåëè ÔÈÎ ñîòðóäíèêà!")); // Òåêñò ñîîáùåíèÿ. |
return; |
} |
sqltext = tr("select * from sotrydniki where sotrydniki.ÔÈÎ = \""); |
sqltext.append(lineEdit->text()); |
sqltext.append(tr("\"")); |
q.prepare(sqltext); |
ok = q.exec(); |
field_fio = q.record().indexOf(tr("ÔÈÎ")); |
if (q.next()) { |
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
this, // Ðîäèòåëüñêèé âèäæåò. |
QObject::tr("Îøèáêà äîáîâëåíèÿ ñîòðóäíèêà"), // Çàãîëîâîê. |
tr("Ñîòðóäíèê ñ òàêèì ÔÈÎ ñóùåñòâóåò!")); // Òåêñò ñîîáùåíèÿ. |
return; |
} |
else { |
q.clear(); |
q.prepare(tr("insert into sotrydniki (ÔÈÎ, Èäåíòèôèêàòîð_îòäåëà) " |
"values (:fio, :id_otd)")); |
q.bindValue(tr(":fio"), lineEdit->text()); |
q.bindValue(tr(":id_otd"), IdOtdela); |
ok = q.exec(); |
emit componentAdd(); |
close();} |
} |
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/main.cpp |
=================================================================== |
--- source_code/src/main.cpp (revision 0) |
+++ source_code/src/main.cpp (revision 6) |
@@ -0,0 +1,21 @@ |
+#include <QApplication> |
+#include <QtGui> |
+#include "mainwindowimpl.h" |
+// |
+int main(int argc, char ** argv) |
+{ |
+ |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec::setCodecForTr(codec); |
+// QTextCodec::setCodecForCStrings(codec); |
+// QTextCodec::setCodecForLocale(codec); |
+ QApplication app( argc, argv ); |
+ MainWindowImpl win; |
+ win.show(); |
+ app.addLibraryPath("/usr/lib64/qt4/plugins/sqldrivers"); |
+ app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) ); |
+ return app.exec(); |
+ |
+} |
+ |
/source_code/src/main.cpp |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/addsysblockform.cpp |
=================================================================== |
--- source_code/src/addsysblockform.cpp (revision 0) |
+++ source_code/src/addsysblockform.cpp (revision 6) |
@@ -0,0 +1,67 @@ |
+#include "addsysblockform.h" |
+#include "mainwindowimpl.h" |
+// place your code here |
+ |
+ |
+addsysblockForm::addsysblockForm() |
+ : QDialog(){ |
+ setupUi(this); |
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNewSysBlockSlot())); |
+ } |
+ |
+void addsysblockForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+void addsysblockForm::addNewSysBlockSlot(){ |
+ int i; |
+ i++; |
+ //test cvs |
+ QDate data_p; |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_fio, field_identifikator, field_inventar_num; |
+ QString serial_num, inventar_num, data_str, garant_str, id, fio, id_otdela; |
+ bool ok; |
+ if (lineEdit_2->text()==""){ |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà äîáîâëåíèÿ ñèñòåìíîãî áëîêà íà ñêëàä"), // Çàãîëîâîê. |
+ tr("Âû íå ââåëè èíâåíòàðíûé íîìåð ñèñòåìíîãî áëîêà!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ |
+ sqltext = tr("select * from system_blocks where system_blocks.Èíâåíòàðíûé_íîìåð = \""); |
+ sqltext.append(lineEdit_2->text()); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ ok = q.exec(); |
+ field_inventar_num = q.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+if (q.next()) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà äîáîâëåíèÿ ñèñòåìíîãî áëîêà íà ñêëàä!"), // Çàãîëîâîê. |
+ tr("Ñèñòåìíûé áëîê ñ òàêèì èíâåíòàðíûì íîìåðîì óæå åñòü â áàçå äàííûõ!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ else { |
+ q.clear(); |
+ data_p = dateEdit->date(); |
+ data_str = data_p.toString(tr("yyyy-MM-dd")); |
+ garant_str = QVariant(spinBox->value()).toString(); |
+ q.prepare(tr("insert into system_blocks (Ñåðèéíûé_íîìåð, Èíâåíòàðíûé_íîìåð, Äàòà_ïîêóïêè, Ñðîê_ãàðàíòèè, Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà) " |
+ "values (:ser_num, :inv_num, :date, :garant, :id_otv_lica)")); |
+ q.bindValue(tr(":ser_num"), lineEdit->text()); |
+ q.bindValue(tr(":inv_num"), lineEdit_2->text()); |
+ q.bindValue(tr(":date"), data_str); |
+ q.bindValue(tr(":garant"), garant_str); |
+ q.bindValue(tr(":id_otv_lica"), tr("1")); |
+ ok = q.exec(); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ |
+ |
+} |
+ |
/source_code/src/addsysblockform.cpp |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/addsotrydnikform.h |
=================================================================== |
--- source_code/src/addsotrydnikform.h (revision 0) |
+++ source_code/src/addsotrydnikform.h (revision 6) |
@@ -0,0 +1,34 @@ |
+#ifndef __ADDSOTRYDNIKFORM_H__ |
+#define __ADDSOTRYDNIKFORM_H__ |
+ |
+// place your code here |
+#include <QDialog> |
+#include <QtGui> |
+#include <QtSql> |
+#include "ui_addsotrydnikform.h" |
+ |
+class addsotrydnikForm : public QDialog, public Ui::addsotrydnikform |
+{ |
+Q_OBJECT |
+ public: |
+ addsotrydnikForm(); |
+ QString IdOtdela; |
+ |
+ |
+signals: |
+ void formClose(); |
+ void componentAdd(); |
+ |
+private slots: |
+ void addNewSotrydnikSlot(); |
+ |
+private: |
+ |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+ |
+ |
+#endif // __ADDSOTRYDNIKFORM_H__ |
/source_code/src/addsotrydnikform.h |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/addsysblockform.h |
=================================================================== |
--- source_code/src/addsysblockform.h (revision 0) |
+++ source_code/src/addsysblockform.h (revision 6) |
@@ -0,0 +1,32 @@ |
+#ifndef __ADDSYSBLOCKFORM_H__ |
+#define __ADDSYSBLOCKFORM_H__ |
+ |
+// place your code here |
+#include <QDialog> |
+#include <QtGui> |
+#include <QtSql> |
+#include "ui_addsysblockform.h" |
+ |
+class addsysblockForm : public QDialog, public Ui::addsysblockform |
+{ |
+Q_OBJECT |
+ public: |
+ addsysblockForm(); |
+ |
+ |
+signals: |
+ void formClose(); |
+ void componentAdd(); |
+ |
+private slots: |
+ void addNewSysBlockSlot(); |
+ |
+private: |
+ |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+ |
+#endif // __ADDSYSBLOCKFORM_H__ |
/source_code/src/addsysblockform.h |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/raportform.cpp |
=================================================================== |
--- source_code/src/raportform.cpp (revision 0) |
+++ source_code/src/raportform.cpp (revision 6) |
@@ -0,0 +1,1134 @@ |
+#include "raportform.h" |
+///#include "mainwindowimpl.h" |
+ |
+#define ENTER cursor->insertBlock(); |
+// place your code here |
+/////raportForm::raportForm( QWidget * parent, Qt::WFlags f) |
+///// : QMainWindow(parent, f) |
+raportForm::raportForm() |
+///// : QMainWindow(parent, f) |
+ : QMainWindow() |
+ { |
+ setupUi(this); |
+ connect(printAction, SIGNAL(triggered()), this, SLOT(on_print_raport())); |
+ connect(printPdfAction, SIGNAL(triggered()), this, SLOT(on_print_raport_to_pdf())); |
+ |
+ |
+ |
+ } |
+ |
+ |
+ |
+raportForm::~raportForm() |
+{ |
+ |
+} |
+ |
+void raportForm::create_raport() |
+{ |
+ |
+// raportForm::textEdit.setText('1'); |
+// textEdit.setText("hello!"); |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+void raportForm::on_pushButton_clicked() |
+{ |
+/* |
+ textEdit->setText(tr("Ñèáãèïðîñåëüõîçìàø")); |
+ document = textEdit->document(); |
+ cursor = new QTextCursor(document); |
+ cursor->movePosition(QTextCursor::Start); |
+ QTextCharFormat format(cursor->charFormat()); |
+ //format.setFontFamily("Courier"); |
+ format.setFontFamily("Arial"); |
+ //format.setFontItalic(false); |
+ |
+ format.setFontWeight(QFont::Normal); |
+ QTextCharFormat boldFormat = format; |
+ boldFormat.setFontWeight(QFont::Bold); |
+ //boldFormat.setFontItalic(true); |
+//// cursor->insertText(tr("Ì1"), boldFormat); |
+//// cursor->insertBlock(); |
+//// cursor->insertText(tr("Þøêîâ"), format); |
+ ENTER |
+ |
+int fieldName, fieldID; |
+// QTreeWidgetItem *otdelItem; |
+ bool ok; |
+ //ok= pdb->isOpen(); |
+ QSqlQuery q; |
+ ok = q.prepare(tr("select * from otdeli"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id, user_name; |
+ ok = q.exec(); |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ cursor->insertText(otdel, format); |
+ ENTER |
+ |
+// otdelItem = new QTreeWidgetItem(addmemoryForm::treeWidget); |
+// otdelItem->setText(0, otdel); |
+// addmemoryForm::SotrydnikiOtdela(otdel_id, otdelItem); |
+ } |
+// print_raport(); |
+// print_raport_to_pdf(); |
+ QList<TOtdel> otdel_list_local; |
+ |
+ otdel_list_local = get_otdel_list(); |
+ QString otdel_name; |
+ |
+ for (int i = 0; i < otdel_list_local.size(); ++i) { |
+ otdel_name = otdel_list_local.at(i).name; |
+ cursor->insertText(otdel_name, format); |
+ ENTER |
+ otdel_id = otdel_list_local.at(i).ID; |
+ cursor->insertText(otdel_id, format); |
+ ENTER |
+ } |
+*/ |
+ bild_raport(); |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+void raportForm::print_raport() |
+{ |
+ QTextDocument *document = textEdit->document(); |
+ QPrinter printer; |
+ |
+ QPrintDialog *dlg = new QPrintDialog(&printer, this); |
+ if (dlg->exec() != QDialog::Accepted) |
+ return; |
+ |
+ document->print(&printer); |
+} |
+ |
+void raportForm::print_raport_to_pdf() |
+{ |
+ |
+ QString fileName = QFileDialog::getSaveFileName(this, "Export PDF", |
+ QString(), "*.pdf"); |
+ if (!fileName.isEmpty()) { |
+ if (QFileInfo(fileName).suffix().isEmpty()) |
+ fileName.append(".pdf"); |
+ QPrinter printer(QPrinter::HighResolution); |
+ printer.setOutputFormat(QPrinter::PdfFormat); |
+ printer.setOutputFileName(fileName); |
+ textEdit->document()->print(&printer); |
+ } |
+} |
+ |
+ |
+/* |
+QStringList raportForm::get_otgel_list() |
+{ |
+ |
+ struct otdel otdel_tmp; |
+ int fieldName, fieldID; |
+ QString int_otdel_id; |
+ QStringList tmp; |
+// QTreeWidgetItem *otdelItem; |
+ QSqlQuery q(tr("select * from Îòäåëû"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ otdel_list.clear(); //î÷èùàåì ñïèñîê |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ tmp.append(otdel); |
+ int_otdel_id = q.value(fieldID).toString(); |
+ otdel_tmp.name = otdel; |
+ otdel_tmp.ID = int_otdel_id; |
+ otdel_list.append(otdel_tmp); |
+// otdel_id = q.value(fieldID).toString(); |
+// otdelItem = new QTreeWidgetItem(addmemoryForm::treeWidget); |
+// otdelItem->setText(0, otdel); |
+// addmemoryForm::SotrydnikiOtdela(otdel_id, otdelItem); |
+ |
+ } |
+ return tmp; |
+} |
+*/ |
+ |
+ |
+TSibgipro raportForm::get_sibgipro(){ |
+// TOtdel otdel_tmp; |
+ TSibgipro sibgipro_tmp; |
+// int fieldName, fieldID; |
+// QVariant int_otdel_id; |
+// QStringList tmp; |
+// bool ok; |
+ //ok= pdb->isOpen(); |
+// QSqlQuery q; |
+// ok = q.prepare(tr("select * from Îòäåëû"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+// QString otdel, otdel_id; |
+// ok = q.exec(); |
+// if (!ok) { |
+// QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+// this, // Ðîäèòåëüñêèé âèäæåò. |
+// QObject::tr("Database Error"), // Çàãîëîâîê. |
+// pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+// } |
+// fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+// fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+// while (q.next()){ |
+// otdel = q.value(fieldName).toString(); |
+// otdel_id = q.value(fieldID).toString(); |
+// int_otdel_id = q.value(fieldID); |
+// otdel_tmp.name = otdel; |
+// otdel_tmp.ID = int_otdel_id; |
+// sibgipro_tmp.otdel_list.append(otdel_tmp); |
+// } |
+ sibgipro_tmp.otdel_list = get_otdel_list(); |
+ return sibgipro_tmp; |
+} |
+ |
+QList<TOtdel> raportForm::get_otdel_list(){ |
+ TOtdel otdel_tmp; |
+ QList<TOtdel> otdel_list_rtrn; |
+ int fieldName, fieldID; |
+ QString int_otdel_id; |
+ QStringList tmp; |
+ bool ok; |
+ |
+ |
+ |
+ //ok= pdb->isOpen(); |
+ QSqlQuery q; |
+ ok = q.prepare(tr("select * from otdeli"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ ok = q.exec(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ int_otdel_id = q.value(fieldID).toString(); |
+ otdel_tmp.name = otdel; |
+ otdel_tmp.ID = int_otdel_id; |
+ otdel_tmp.user_list = get_user_list(int_otdel_id); |
+ otdel_list_rtrn.append(otdel_tmp); |
+ } |
+ |
+ return otdel_list_rtrn; |
+} |
+ |
+QList<TUser> raportForm::get_user_list(QString otdel_ID) |
+{ |
+ TUser user_tmp; |
+ QList<TUser> user_list_rtrn; |
+ |
+ int field_fio_sotrydnika, field_id_sotrydnika; |
+ QString fio_sotrydnika_otdela, id_sotrydnika_otdela, oboryd; |
+ QSqlQuery qsotrydnikiOtdela; |
+ QString sqlQueryString; |
+ QTreeWidgetItem *treeItem_sotrydnika; |
+ sqlQueryString = tr("select Èäåíòèôèêàòîð, ÔÈÎ from sotrydniki where Èäåíòèôèêàòîð_îòäåëà="); |
+ sqlQueryString.append(otdel_ID); |
+ qsotrydnikiOtdela.prepare(sqlQueryString); |
+ qsotrydnikiOtdela.exec(); |
+ field_fio_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("ÔÈÎ")); |
+ field_id_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qsotrydnikiOtdela.next()) |
+ { |
+ QList <TSystemBlock> sys_block_list_tmp; |
+ QString id_user; |
+// fio_sotrydnika_otdela = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+// id_sotrydnika_otdela = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ user_tmp.name = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+ id_user = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ user_tmp.ID = id_user; |
+ // user_list_rtrn.append(user_tmp); |
+ sys_block_list_tmp = get_sys_block_list(id_user); |
+ user_tmp.system_block_list = sys_block_list_tmp; |
+// treeItem_sotrydnika = new QTreeWidgetItem(itemOtdela); |
+// treeItem_sotrydnika->setText(1, fio_sotrydnika_otdela ); |
+ user_list_rtrn.append(user_tmp); |
+ } |
+ return user_list_rtrn; |
+} |
+ |
+ |
+void raportForm::bild_raport(){ |
+ TSibgipro sgshm; |
+ QList <TOtdel> sgshm_otdel_list; |
+ QString otdel_name, otdel_id, user_name; |
+ document = textEdit->document(); |
+ cursor = new QTextCursor(document); |
+ cursor->movePosition(QTextCursor::Start); |
+ QTextCharFormat format(cursor->charFormat()); |
+ //format.setFontFamily("Courier"); |
+ format.setFontFamily("Arial"); |
+ //format.setFontItalic(false); |
+ |
+ format.setFontWeight(QFont::Normal); |
+ QTextCharFormat boldFormat = format; |
+ boldFormat.setFontWeight(QFont::Bold); |
+ |
+ QTextCharFormat italicFormat = format; |
+ //format.setFontFamily("Courier"); |
+// format.setFontFamily("Arial"); |
+ italicFormat.setFontItalic(true); |
+ |
+ |
+ |
+ sgshm = get_sibgipro(); |
+ sgshm_otdel_list = sgshm.otdel_list; |
+ |
+ |
+ for (int i = 0; i < sgshm_otdel_list.size(); ++i) { |
+ otdel_name = sgshm_otdel_list.at(i).name; |
+ |
+///// cursor->insertText(otdel_name, boldFormat); |
+///// ENTER |
+ otdel_id = sgshm_otdel_list.at(i).ID; |
+///// cursor->insertText(otdel_id, format); |
+///// ENTER |
+ |
+ for (int m = 0; m < sgshm_otdel_list.at(i).user_list.size(); ++m) |
+ { |
+ QString sys_id, sys_inv_num, sys_ser_num; |
+// int k_tmp; |
+ user_name = sgshm_otdel_list.at(i).user_list.at(m).name; |
+ cursor->insertText(otdel_name, format); |
+ ENTER |
+ cursor->insertText(user_name, boldFormat); |
+ ENTER |
+// k_tmp = ; |
+ for (int k = 0; k < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.size(); ++k) |
+ { |
+ |
+ sys_id = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).ID; |
+ sys_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).inv_num; |
+ sys_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).ser_num; |
+ cursor->insertText(tr("Ñèñòåìíûé áëîê:"), format); |
+// ENTER |
+ cursor->insertText(tr(" èíâ. íîìåð: "), italicFormat); |
+ cursor->insertText(sys_inv_num, format); |
+ cursor->insertText(tr(" ñåð. íîìåð: "), italicFormat); |
+ cursor->insertText(sys_ser_num, format); |
+ |
+ ENTER |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).mb_list.size(); ++l) |
+ { |
+ QString mb_proizvoditel, mb_model; |
+ mb_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).mb_list.at(l).proizvoditel; |
+ mb_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).mb_list.at(l).model; |
+ cursor->insertText(tr(" Ìàòåðèíñêàÿ ïëàòà: "), format); |
+ cursor->insertText(mb_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(mb_model, format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.size(); ++l) |
+ { |
+ QString cpu_proizvoditel, cpu_model, cpu_fqr; |
+ cpu_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.at(l).proizvoditel; |
+ cpu_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.at(l).model; |
+ cpu_fqr = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.at(l).fqr; |
+ cursor->insertText(tr(" Ïðîöåññîð: "), format); |
+ cursor->insertText(cpu_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(cpu_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(cpu_fqr, format); |
+ cursor->insertText(tr(" ÌÃö"), format); |
+ ENTER |
+ } |
+ |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.size(); ++l) |
+ { |
+ QString memory_proizvoditel, memory_tip, memory_obem; |
+ memory_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.at(l).proizvoditel; |
+ memory_tip = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.at(l).tip; |
+ memory_obem = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.at(l).obem; |
+ cursor->insertText(tr(" Ìîäóëü ïàìÿòè: "), format); |
+ cursor->insertText(memory_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(memory_tip, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(memory_obem, format); |
+ cursor->insertText(tr(" ÌÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.size(); ++l) |
+ { |
+ QString hdd_proizvoditel, hdd_model, hdd_obem; |
+ hdd_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.at(l).proizvoditel; |
+ hdd_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.at(l).model; |
+ hdd_obem = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.at(l).obem; |
+ cursor->insertText(tr(" Æåñòêèé äèñê: "), format); |
+ cursor->insertText(hdd_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(hdd_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(hdd_obem, format); |
+ cursor->insertText(tr(" ÃÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.size(); ++l) |
+ { |
+ QString privod_proizvoditel, privod_model, privod_ID, privod_speed, privod_inv_num, privod_ser_num, privod_tip; |
+ privod_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).proizvoditel; |
+ privod_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).model; |
+ privod_speed = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).speed; |
+ privod_tip = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).tip; |
+ cursor->insertText(tr(" Ïðèâîä: "), format); |
+ cursor->insertText(privod_tip, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(privod_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(privod_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(privod_speed, format); |
+ //cursor->insertText(tr(" ÃÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.size(); ++l) |
+ { |
+ QString videocard_proizvoditel, videocard_model, videocard_ID, videocard_ram_size, videocard_inv_num, videocard_ser_num, videocard_interfeis; |
+ videocard_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).proizvoditel; |
+ videocard_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).model; |
+ videocard_ram_size = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).memory_value; |
+ videocard_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).inv_num; |
+ videocard_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).ser_num; |
+ videocard_interfeis = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).interfeis; |
+ cursor->insertText(tr(" Âèäåîàäàïòåð: "), format); |
+ cursor->insertText(videocard_interfeis, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(videocard_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(videocard_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(videocard_ram_size, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(privod_speed, format); |
+ cursor->insertText(tr(" MÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.size(); ++l) |
+ { |
+ QString soundcard_proizvoditel, soundcard_model, soundcard_ID, soundcard_ram_size, soundcard_inv_num, soundcard_ser_num, soundcard_interfeis; |
+ soundcard_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).proizvoditel; |
+ soundcard_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).model; |
+// soundcard_ram_size = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).memory_value; |
+ soundcard_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).inv_num; |
+ soundcard_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).ser_num; |
+// soundcard_interfeis = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).interfeis; |
+ cursor->insertText(tr(" Çâóêîâàÿ êàðòà: "), format); |
+ cursor->insertText(soundcard_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_proizvoditel, format); |
+// cursor->insertText(tr(" "), format); |
+ cursor->insertText(soundcard_model, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_ram_size, format); |
+// cursor->insertText(tr(" "), format); |
+// cursor->insertText(privod_speed, format); |
+// cursor->insertText(tr(" MÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.size(); ++l) |
+ { |
+ QString lancard_proizvoditel, lancard_model, lancard_ID, lancard_ram_size, lancard_inv_num, lancard_ser_num, landcard_interfeis; |
+ lancard_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).proizvoditel; |
+ lancard_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).model; |
+// soundcard_ram_size = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).memory_value; |
+ lancard_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).inv_num; |
+ lancard_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).ser_num; |
+// soundcard_interfeis = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).interfeis; |
+ cursor->insertText(tr(" Ñåòåâàÿ êàðòà: "), format); |
+ cursor->insertText(lancard_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_proizvoditel, format); |
+// cursor->insertText(tr(" "), format); |
+ cursor->insertText(lancard_model, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_ram_size, format); |
+// cursor->insertText(tr(" "), format); |
+// cursor->insertText(privod_speed, format); |
+// cursor->insertText(tr(" MÁ"), format); |
+ ENTER |
+ } |
+ |
+ |
+ |
+ |
+ } |
+ |
+ ENTER |
+ ENTER |
+ |
+ |
+ } |
+ |
+ |
+ ENTER |
+ } |
+} |
+ |
+ |
+QList<TSystemBlock> raportForm::get_sys_block_list(QString id_otv_lica) |
+{ |
+ QList<TSystemBlock> sys_block_list_rtrn; |
+ TSystemBlock sys_block_tmp; |
+ QString result, prResult; |
+ QVariant data_tmp; |
+ QString sqlQueryText; |
+ QString serial_num, inventar_num, proizvoditel, model, system_block_id; |
+ QSqlQuery quer; |
+ QString MB_information, Memory_information, CPU_information, HDD_information, CD_DVD_information, Vidio_information; |
+ QString Sound_card_information, Lan_card_information; |
+ int field_serialNum, field_inventarNum, field_proizvoditel, field_model, field_system_block_id, field_data_pokypki; |
+// QSqlQuery qns(tr("SET NAMES utf8"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QTreeWidgetItem *itemSysBlock; |
+// sqlQueryText.reserve(300); |
+ sqlQueryText = tr("select system_blocks.Ñåðèéíûé_íîìåð, system_blocks.Èíâåíòàðíûé_íîìåð, system_blocks.Äàòà_ïîêóïêè, system_blocks.Èäåíòèôèêàòîð" |
+ " from system_blocks" |
+ " where system_blocks.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà ="); |
+ sqlQueryText.append(id_otv_lica); |
+// sqlQueryText.append(tr(" AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð")); |
+ quer.prepare(sqlQueryText); |
+// quer.prepare(tr("select Ñèñòåìíûå_áëîêè.Ñåðèéíûé_íîìåð, Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð,Ìàòåðèíñêèå_ïëàòû.Ïðîèçâîäèòåëü, Ìàòåðèíñêèå_ïëàòû.Ìîäåëü from Ñèñòåìíûå_áëîêè,Ìàòåðèíñêèå_ïëàòû where Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà = 4 AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð;")); |
+ quer.exec(); |
+ field_serialNum = quer.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventarNum = quer.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_system_block_id = quer.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+// field_proizvoditel = quer.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+// field_model = quer.record().indexOf(tr("Ìîäåëü")); |
+ while(quer.next()){ |
+ QList <TMatheboard> mb_list_tmp; |
+ QList <TMemory> memory_list_tmp; |
+ QList<TCpu> cpu_list_tmp; |
+ QList<THarddisc> harddisc_list_tmp; |
+ QList<TPrivod> privod_list_tmp; |
+ QList<TVideocard> videocard_list_tmp; |
+ QList<TSoundcard> soundcard_list_tmp; |
+ QList<TLancard> lancard_list_tmp; |
+ system_block_id = quer.value(field_system_block_id).toString(); //èäåíòèôèêàòîð ñèñòåìíîãî áëîêà |
+ sys_block_tmp.ID = system_block_id; |
+ prResult = ""; |
+ serial_num = quer.value(field_serialNum).toString(); |
+ sys_block_tmp.ser_num = serial_num; |
+ inventar_num = quer.value(field_inventarNum).toString(); |
+ sys_block_tmp.inv_num = inventar_num; |
+ mb_list_tmp = get_matheboard_list(system_block_id); |
+ sys_block_tmp.mb_list = mb_list_tmp; |
+ memory_list_tmp = get_memory_list(system_block_id); |
+ sys_block_tmp.memory_list = memory_list_tmp; |
+ cpu_list_tmp = get_cpu_list(system_block_id); |
+ sys_block_tmp.cpu_list = cpu_list_tmp; |
+ harddisc_list_tmp = get_harddisc_list(system_block_id); |
+ sys_block_tmp.harddisc_list = harddisc_list_tmp; |
+ privod_list_tmp = get_privod_list(system_block_id); |
+ sys_block_tmp.privod_list = privod_list_tmp; |
+ videocard_list_tmp = get_videocard_list(system_block_id); |
+ sys_block_tmp.videocard_list = videocard_list_tmp; |
+ soundcard_list_tmp = get_soundcard_list(system_block_id); |
+ sys_block_tmp.soundcard_list = soundcard_list_tmp; |
+ lancard_list_tmp = get_lancard_list(system_block_id); |
+ sys_block_tmp.lancard_list = lancard_list_tmp; |
+ |
+ sys_block_list_rtrn.append(sys_block_tmp); |
+ } |
+ return sys_block_list_rtrn; |
+} |
+ |
+ |
+QList<TMatheboard> raportForm::get_matheboard_list(QString id_system_block) |
+{ |
+ TMatheboard matheboard_tmp; |
+ QList<TMatheboard> mb_list_rtrn; |
+ QString result, tmp; |
+ QString MB_proizvoditel, MB_model, MB_identifikator, MB_serial_num, MB_inventar_num; |
+ QString MatheBoardSqlQueryText; |
+ QSqlQuery MatheBoardQuery; |
+ int field_proizvoditel, field_model, field_identifikator, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *itemMB, *itmMB_block; |
+ MatheBoardSqlQueryText = tr("select * " |
+ " from matheboards where matheboards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MatheBoardSqlQueryText.append(id_system_block); |
+ MatheBoardQuery.prepare(MatheBoardSqlQueryText); |
+ MatheBoardQuery.exec(); |
+ field_identifikator = MatheBoardQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MatheBoardQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = MatheBoardQuery.record().indexOf(tr("Ìîäåëü")); |
+ field_serial_num = MatheBoardQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = MatheBoardQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+ |
+ while(MatheBoardQuery.next()){ |
+ tmp = ""; |
+ MB_identifikator = MatheBoardQuery.value(field_identifikator).toString(); |
+ MB_proizvoditel = MatheBoardQuery.value(field_proizvoditel).toString(); |
+ MB_model = MatheBoardQuery.value(field_model).toString(); |
+ MB_serial_num = MatheBoardQuery.value(field_serial_num).toString(); |
+ MB_inventar_num = MatheBoardQuery.value(field_inventar_num).toString(); |
+ |
+ matheboard_tmp.ID = MB_identifikator; |
+ matheboard_tmp.proizvoditel = MB_proizvoditel; |
+ matheboard_tmp.model = MB_model; |
+ matheboard_tmp.ser_num = MB_serial_num; |
+ matheboard_tmp.inv_num = MB_inventar_num; |
+ |
+ mb_list_rtrn.append(matheboard_tmp); |
+ |
+/* if (MB_proizvoditel != "") { |
+// tmp.append(tr("MB: ")); |
+ tmp.append(MB_proizvoditel); |
+ } |
+ if (MB_model != "") {tmp.append(tr(" ")); |
+ tmp.append(MB_model); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ |
+ itemMB = new QTreeWidgetItem(itemSysBlock); |
+ itemMB->setIcon(4, matheboard_icon); |
+ itemMB->setText(4, tmp); |
+ itemMB->setText(12, MB_identifikator); |
+ itemMB->setText(13, id_systemBlock); |
+ itemMB->setText(14, id_otvetstvennogo_lica); |
+ itemMB->setText(2, tr("Ìàòåðèíñêàÿ ïëàòà")); |
+ itemMB->setText(3, MB_inventar_num); |
+ if (id_systemBlock !="1") itemSysBlock->setText(5, tmp); |
+*/ |
+ } |
+ return mb_list_rtrn; |
+} |
+ |
+QList<TMemory> raportForm::get_memory_list(QString id_system_block) |
+{ |
+ TMemory memory_tmp; |
+ QList <TMemory> memory_list_rtrn; |
+ QString result, tmp; |
+ QString Memiry_id, Memory_proizvoditel, Memory_type, Memory_obem, Memory_inventar_num, Memory_serial_num; |
+ QString MemorySqlQueryText; |
+ QSqlQuery MemoryQuery; |
+ int field_proizvoditel, field_type, field_obem, field_id, field_inventar_num, field_sereal_num; |
+// QTreeWidgetItem *itemMemory, *itemMemory_block; |
+ MemorySqlQueryText = tr("select memory.* " |
+ " from memory where memory.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MemorySqlQueryText.append(id_system_block); |
+ MemoryQuery.prepare(MemorySqlQueryText); |
+ MemoryQuery.exec(); |
+ field_id = MemoryQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MemoryQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = MemoryQuery.record().indexOf(tr("Òèï")); |
+ field_obem = MemoryQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = MemoryQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = MemoryQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ while(MemoryQuery.next()){ |
+// tmp = tr("RAM: "); |
+ tmp = tr(""); |
+ Memiry_id = MemoryQuery.value(field_id).toString(); |
+ Memory_proizvoditel = MemoryQuery.value(field_proizvoditel).toString(); |
+ Memory_type = MemoryQuery.value(field_type).toString(); |
+ Memory_obem = MemoryQuery.value(field_obem).toString(); |
+ Memory_inventar_num = MemoryQuery.value(field_inventar_num).toString(); |
+ Memory_serial_num = MemoryQuery.value(field_sereal_num).toString(); |
+ memory_tmp.ID = Memiry_id; |
+ memory_tmp.proizvoditel = Memory_proizvoditel; |
+ memory_tmp.obem = Memory_obem; |
+ memory_tmp.tip = Memory_type; |
+ memory_tmp.inv_num = Memory_inventar_num; |
+ memory_tmp.ser_num = Memory_serial_num; |
+//// if (Memory_proizvoditel != "") { |
+//// tmp.append(Memory_proizvoditel);} |
+/* |
+ if (Memory_type != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_type); |
+ tmp.append(tr(" "));} |
+ if (Memory_obem != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_obem); |
+ tmp.append(tr("MB; "));} |
+ result.append(tmp); |
+*/ |
+ memory_list_rtrn.append(memory_tmp); |
+ } |
+ return memory_list_rtrn; |
+} |
+ |
+ |
+QList<TCpu> raportForm::get_cpu_list(QString id_system_block) |
+{ |
+ TCpu cpu_tmp; |
+ QList <TCpu> cpu_list_rtrn; |
+ QString CPU_id, CPU_proizvoditel, CPU_slot, CPU_fqr, CPU_inventar_num, CPU_serial_num, CPU_model; |
+ QString CpuSqlQueryText; |
+ QSqlQuery CpuQuery; |
+ int field_id, field_proizvoditel, field_slot, field_fqr, field_inventar_num, field_serial_num, field_model; |
+ CpuSqlQueryText = tr("select processors.* " |
+ " from processors where processors.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CpuSqlQueryText.append(id_system_block); |
+ CpuQuery.prepare(CpuSqlQueryText); |
+ CpuQuery.exec(); |
+ field_id = CpuQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CpuQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_slot = CpuQuery.record().indexOf(tr("Ñëîò")); |
+ field_fqr = CpuQuery.record().indexOf(tr("×àñòîòà")); |
+ field_inventar_num = CpuQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CpuQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_model = CpuQuery.record().indexOf(tr("Ìîäåëü")); |
+ |
+ while(CpuQuery.next()){ |
+ CPU_id = CpuQuery.value(field_id).toString(); |
+ CPU_proizvoditel = CpuQuery.value(field_proizvoditel).toString(); |
+ CPU_slot = CpuQuery.value(field_slot).toString(); |
+ CPU_fqr = CpuQuery.value(field_fqr).toString(); |
+ CPU_inventar_num = CpuQuery.value(field_inventar_num).toString(); |
+ CPU_serial_num = CpuQuery.value(field_serial_num).toString(); |
+ CPU_model = CpuQuery.value(field_model).toString(); |
+ |
+ cpu_tmp.ID = CPU_id; |
+ cpu_tmp.proizvoditel = CPU_proizvoditel; |
+ cpu_tmp.slot = CPU_slot; |
+ cpu_tmp.fqr = CPU_fqr; |
+ cpu_tmp.inv_num = CPU_inventar_num; |
+ cpu_tmp.ser_num = CPU_serial_num; |
+ cpu_tmp.model = CPU_model; |
+ cpu_list_rtrn.append(cpu_tmp); |
+ } |
+ return cpu_list_rtrn; |
+} |
+ |
+QList<THarddisc> raportForm::get_harddisc_list(QString id_system_block) |
+{ |
+ QList<THarddisc> harddisc_list_rtrn; |
+ THarddisc harddisc_tmp; |
+ QString result, tmp; |
+ QString HDD_id, HDD_proizvoditel, HDD_interfeis, HDD_obem, HDD_inventar_num, HDD_serial_num; |
+ QString HDDSqlQueryText; |
+ QSqlQuery HDDQuery; |
+ int field_id, field_proizvoditel, field_interfeis, field_obem, field_inventar_num, field_serial_num; |
+ HDDSqlQueryText = tr("select harddiscs.* " |
+ " from harddiscs where harddiscs.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ HDDSqlQueryText.append(id_system_block); |
+ HDDQuery.prepare(HDDSqlQueryText); |
+ HDDQuery.exec(); |
+ field_id = HDDQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = HDDQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_interfeis = HDDQuery.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_obem = HDDQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = HDDQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = HDDQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ while(HDDQuery.next()){ |
+// tmp = tr("HDD: "); |
+ tmp = tr(""); |
+ HDD_id = HDDQuery.value(field_id).toString(); |
+ HDD_proizvoditel = HDDQuery.value(field_proizvoditel).toString(); |
+ HDD_interfeis = HDDQuery.value(field_interfeis).toString(); |
+ HDD_obem = HDDQuery.value(field_obem).toString(); |
+ HDD_inventar_num = HDDQuery.value(field_inventar_num).toString(); |
+ HDD_serial_num = HDDQuery.value(field_serial_num).toString(); |
+ harddisc_tmp.ID = HDD_id; |
+ harddisc_tmp.proizvoditel = HDD_proizvoditel; |
+ harddisc_tmp.interfeis = HDD_interfeis; |
+ harddisc_tmp.obem = HDD_obem; |
+ harddisc_tmp.inv_num = HDD_inventar_num; |
+ harddisc_tmp.ser_num = HDD_serial_num; |
+ harddisc_list_rtrn.append(harddisc_tmp); |
+ } |
+ |
+// if (result!="") itemSysBlock->setIcon(7, hdd_icon); |
+// if (id_systemBlock !="1") itemSysBlock->setText(7, result); |
+ return harddisc_list_rtrn; |
+ |
+} |
+ |
+ |
+QList<TPrivod> raportForm::get_privod_list(QString id_system_block) |
+{ |
+ TPrivod privod_tmp; |
+ QList<TPrivod> privod_list_rtrn; |
+ QString result, tmp; |
+ QString CD_DVD_id, CD_DVD_proizvoditel, CD_DVD_type, CD_DVD_speed, CD_DVD_serial_num, CD_DVD_inventar_num; |
+ QString CD_DVD_SqlQueryText; |
+ QSqlQuery CD_DVD_Query; |
+ int field_id, field_proizvoditel, field_type, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_CD_DVD; |
+ QTreeWidgetItem *item_CD_DVD_block; |
+ CD_DVD_SqlQueryText = tr("select cd_dvd.* " |
+ " from cd_dvd where cd_dvd.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CD_DVD_SqlQueryText.append(id_system_block); |
+ CD_DVD_Query.prepare(CD_DVD_SqlQueryText); |
+ CD_DVD_Query.exec(); |
+ field_id = CD_DVD_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CD_DVD_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = CD_DVD_Query.record().indexOf(tr("Òèï")); |
+ field_speed = CD_DVD_Query.record().indexOf(tr("Ñêîðîñòü")); |
+ field_inventar_num = CD_DVD_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CD_DVD_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD_block = new QTreeWidgetItem(itemSysBlock); |
+ item_CD_DVD_block->setText(2, tr("ÏÐÈÂÎÄÛ")); |
+ item_CD_DVD_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ |
+ while(CD_DVD_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ CD_DVD_id = CD_DVD_Query.value(field_id).toString(); |
+ CD_DVD_proizvoditel = CD_DVD_Query.value(field_proizvoditel).toString(); |
+ CD_DVD_type = CD_DVD_Query.value(field_type).toString(); |
+ CD_DVD_speed = CD_DVD_Query.value(field_speed).toString(); |
+ CD_DVD_serial_num = CD_DVD_Query.value(field_serial_num).toString(); |
+ CD_DVD_inventar_num = CD_DVD_Query.value(field_inventar_num).toString(); |
+ |
+ privod_tmp.ID = CD_DVD_id; |
+ privod_tmp.proizvoditel = CD_DVD_proizvoditel; |
+ privod_tmp.tip = CD_DVD_type; |
+ privod_tmp.speed = CD_DVD_speed; |
+ privod_tmp.inv_num = CD_DVD_inventar_num; |
+ privod_tmp.ser_num = CD_DVD_serial_num; |
+ privod_list_rtrn.append(privod_tmp); |
+/* |
+ |
+ if (CD_DVD_type != "") { |
+ tmp.append(CD_DVD_type);} |
+ if (CD_DVD_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_proizvoditel); |
+ tmp.append(tr(" "));} |
+ if (CD_DVD_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_speed); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ |
+if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD = new QTreeWidgetItem(item_CD_DVD_block); |
+ } |
+ else item_CD_DVD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_CD_DVD->setText(2, tr("Ïðèâîä")); |
+ item_CD_DVD->setText(12, CD_DVD_id); |
+ item_CD_DVD->setText(13, id_systemBlock); |
+ item_CD_DVD->setText(14, id_otvetstvennogo_lica); |
+ item_CD_DVD->setIcon(4, cd_dvd_icon); |
+ item_CD_DVD->setText(4, tmp); |
+ item_CD_DVD->setText(3, CD_DVD_inventar_num); |
+*/ |
+ } |
+ |
+// if (id_systemBlock !="1") itemSysBlock->setText(8, result); |
+ return privod_list_rtrn; |
+ |
+} |
+ |
+ |
+QList<TVideocard> raportForm::get_videocard_list(QString id_system_block) |
+{ |
+ QList<TVideocard> videocard_list_rtrn; |
+ TVideocard videocard_tmp; |
+ QString result, tmp; |
+ QString Vidio_id, Vidio_proizvoditel, Vidio_model, Vidio_interfeis, Vidio_ram, Vidio_inventar_num, Vidio_sereal_num; |
+ QString Vidio_SqlQueryText; |
+ QSqlQuery Vidio_Query; |
+ int field_id, field_proizvoditel, field_model, field_interfeis, field_ram, field_inventar_num, field_sereal_num; |
+ QTreeWidgetItem *item_Vidio, *item_Vidio_block; |
+ Vidio_SqlQueryText = tr("select videocards.* " |
+ " from videocards where videocards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Vidio_SqlQueryText.append(id_system_block); |
+ Vidio_Query.prepare(Vidio_SqlQueryText); |
+ Vidio_Query.exec(); |
+ field_id = Vidio_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Vidio_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Vidio_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_interfeis = Vidio_Query.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_ram = Vidio_Query.record().indexOf(tr("Ïàìÿòü")); |
+ field_inventar_num = Vidio_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = Vidio_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Vidio_block->setText(2, tr("ÂÈÄÅÎÊÀÐÒÛ")); |
+ item_Vidio_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ |
+ |
+ while(Vidio_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Vidio_id = Vidio_Query.value(field_id).toString(); |
+ Vidio_proizvoditel = Vidio_Query.value(field_proizvoditel).toString(); |
+ Vidio_model = Vidio_Query.value(field_model).toString(); |
+ Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+ Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ Vidio_inventar_num = Vidio_Query.value(field_inventar_num).toString(); |
+ Vidio_sereal_num = Vidio_Query.value(field_sereal_num).toString(); |
+ |
+ |
+ videocard_tmp.ID = Vidio_id; |
+ videocard_tmp.proizvoditel = Vidio_proizvoditel; |
+ videocard_tmp.interfeis = Vidio_interfeis; |
+ videocard_tmp.model = Vidio_model; |
+ videocard_tmp.memory_value = Vidio_ram; |
+ videocard_tmp.inv_num = Vidio_inventar_num; |
+ videocard_tmp.ser_num = Vidio_sereal_num; |
+ |
+ videocard_list_rtrn.append(videocard_tmp); |
+ |
+/* |
+ if (Vidio_interfeis != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_interfeis);} |
+ if (Vidio_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_proizvoditel);} |
+ if (Vidio_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_model);} |
+ |
+ if (Vidio_ram !=""){tmp.append(tr(" ")); |
+ tmp.append(Vidio_ram); |
+ tmp.append(tr(" Mb")); |
+ |
+ } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio = new QTreeWidgetItem(item_Vidio_block); |
+ } |
+ else item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_Vidio->setText(2, tr("Âèäåîêàðòà")); |
+ item_Vidio->setText(12, Vidio_id); |
+ item_Vidio->setText(13, id_systemBlock); |
+ item_Vidio->setText(14, id_otvetstvennogo_lica); |
+ item_Vidio->setIcon(4, vidio_card_icon); |
+ item_Vidio->setText(4, tmp); |
+ item_Vidio->setText(3, Vidio_inventar_num); |
+*/ |
+ } |
+// if (id_systemBlock !="1") itemSysBlock->setText(9, result); |
+ return videocard_list_rtrn; |
+} |
+ |
+QList<TSoundcard> raportForm::get_soundcard_list(QString id_system_block) |
+{ |
+ TSoundcard soundcard_tmp; |
+ QList<TSoundcard> soundcard_list_rtrn; |
+ QString result, tmp; |
+ QString Sound_card_id, Sound_card_proizvoditel, Sound_card_model, Sound_card_inventar_num, Sound_card_serial_num; |
+ QString Sound_card_SqlQueryText; |
+ QSqlQuery Sound_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *item_Sound_card, *item_Sound_card_block; |
+ Sound_card_SqlQueryText = tr("select soundcards.* " |
+ " from soundcards where soundcards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Sound_card_SqlQueryText.append(id_system_block); |
+ Sound_card_Query.prepare(Sound_card_SqlQueryText); |
+ Sound_card_Query.exec(); |
+ field_id = Sound_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Sound_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Sound_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_inventar_num = Sound_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = Sound_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Sound_card_block->setText(2, tr("ÇÂÓÊÎÂÛÅ ÊÀÐÒÛ")); |
+ item_Sound_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ while(Sound_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Sound_card_id = Sound_card_Query.value(field_id).toString(); |
+ Sound_card_proizvoditel = Sound_card_Query.value(field_proizvoditel).toString(); |
+ Sound_card_model = Sound_card_Query.value(field_model).toString(); |
+ Sound_card_inventar_num = Sound_card_Query.value(field_inventar_num).toString(); |
+ Sound_card_serial_num = Sound_card_Query.value(field_serial_num).toString(); |
+ |
+ soundcard_tmp.ID = Sound_card_id; |
+ soundcard_tmp.proizvoditel = Sound_card_proizvoditel; |
+ soundcard_tmp.model = Sound_card_model; |
+ soundcard_tmp.inv_num = Sound_card_inventar_num; |
+ soundcard_tmp.ser_num = Sound_card_serial_num; |
+ |
+ soundcard_list_rtrn.append(soundcard_tmp); |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ |
+/* |
+ if (Sound_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_proizvoditel);} |
+ |
+ if (Sound_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_model);} |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card = new QTreeWidgetItem(item_Sound_card_block); |
+ } |
+ else item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Sound_card->setText(2, tr("Çâóêîâàÿ êàðòà")); |
+ item_Sound_card->setText(12, Sound_card_id); |
+ item_Sound_card->setText(13, id_systemBlock); |
+ item_Sound_card->setText(14, id_otvetstvennogo_lica); |
+ item_Sound_card->setIcon(4, sound_card_icon); |
+ item_Sound_card->setText(4, tmp); |
+ item_Sound_card->setText(3, Sound_card_inventar_num); |
+*/ |
+ } |
+// if (id_systemBlock !="1") itemSysBlock->setText(10, result); |
+ return soundcard_list_rtrn; |
+ |
+} |
+ |
+QList<TLancard> raportForm::get_lancard_list(QString id_system_block) |
+{ |
+ |
+ TLancard lancard_tmp; |
+ QList<TLancard> lancard_list_rtrn; |
+ QString result, tmp; |
+ QString Lan_card_id, Lan_card_proizvoditel, Lan_card_model, Lan_speed, Lan_inventar_num, Lan_serial_num; |
+ QString Lan_card_SqlQueryText; |
+ QSqlQuery Lan_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_Lan_card, *item_Lan_card_block; |
+ Lan_card_SqlQueryText = tr("select lancards.* " |
+ " from lancards where lancards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Lan_card_SqlQueryText.append(id_system_block); |
+ Lan_card_Query.prepare(Lan_card_SqlQueryText); |
+ Lan_card_Query.exec(); |
+ field_id = Lan_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Lan_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Lan_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_speed = Lan_card_Query.record().indexOf(tr("Ñêîðîñòü_ïåðåäà÷è_äàííûõ")); |
+ field_serial_num = Lan_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = Lan_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Lan_card_block->setText(2, tr("ÑÅÒÅÂÛÅ ÊÀÐÒÛ")); |
+ item_Lan_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ while(Lan_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Lan_card_id = Lan_card_Query.value(field_id).toString(); |
+ Lan_card_proizvoditel = Lan_card_Query.value(field_proizvoditel).toString(); |
+ Lan_card_model = Lan_card_Query.value(field_model).toString(); |
+ Lan_speed = Lan_card_Query.value(field_speed).toString(); |
+ Lan_inventar_num = Lan_card_Query.value(field_inventar_num).toString(); |
+ Lan_serial_num = Lan_card_Query.value(field_serial_num).toString(); |
+ |
+ lancard_tmp.ID = Lan_card_id; |
+ lancard_tmp.proizvoditel = Lan_card_proizvoditel; |
+ lancard_tmp.model = Lan_card_model; |
+ lancard_tmp.speed = Lan_speed; |
+ lancard_tmp.ser_num = Lan_serial_num; |
+ lancard_tmp.inv_num = Lan_inventar_num; |
+ |
+ lancard_list_rtrn.append(lancard_tmp); |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ |
+/* |
+ if (Lan_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_proizvoditel);} |
+ |
+ if (Lan_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_model);} |
+ |
+ if (Lan_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_speed); |
+ tmp.append(tr(" Mbit"));} |
+ |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card = new QTreeWidgetItem(item_Lan_card_block); |
+ } |
+ else item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+// item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Lan_card->setText(2, tr("Ñåòåâàÿ êàðòà")); |
+ item_Lan_card->setText(12, Lan_card_id); |
+ item_Lan_card->setText(13, id_systemBlock); |
+ item_Lan_card->setText(14, id_otvetstvennogo_lica); |
+ item_Lan_card->setIcon(4, lan_card_icon); |
+ item_Lan_card->setText(4, tmp); |
+ item_Lan_card->setText(3, Lan_inventar_num); |
+*/ |
+ } |
+// if (id_systemBlock !="1") itemSysBlock->setText(11, result); |
+ return lancard_list_rtrn; |
+ |
+} |
+ |
+void raportForm::on_print_raport() |
+{ |
+ print_raport(); |
+} |
+ |
+void raportForm::on_print_raport_to_pdf() |
+{ |
+ print_raport_to_pdf(); |
+} |
+ |
Index: source_code/src/mainwindowimpl.cpp |
=================================================================== |
--- source_code/src/mainwindowimpl.cpp (revision 0) |
+++ source_code/src/mainwindowimpl.cpp (revision 6) |
@@ -0,0 +1,1265 @@ |
+#include "mainwindowimpl.h" |
+//ïðîâåðêà |
+MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f) |
+ : QMainWindow(parent, f) |
+{ |
+ |
+ |
+ |
+ setupUi(this); |
+ fEnable_component_add = false; //ðåæèì äîáîâëåíèÿ êîìïîíåíòà îòêëþ÷åí |
+ fEnable_naznachit_otvetstv = false; |
+ curr_task = no_task; |
+ readSettings(); |
+ lineEdit->insert(baseName); |
+ metaDataAction = new QAction(tr("Èçìåíèòü"), treeWidget); |
+ addMemoryAction = new QAction(tr("Íîâûé ìîäóëü ïàìÿòè"), treeWidget); |
+ MB_na_skladAction = new QAction(tr("Ñäàòü íà ñêëàä"), treeWidget); |
+ new_sotrydnikAction = new QAction(tr("Íîâûé ñîòðóäíèê"), treeWidget); |
+ novoe_oborydovanieAction = new QAction(tr("Íîâîå îáîðóäîâàíèå"), treeWidget); |
+ pereimenovat_otdelAction = new QAction(tr("Ïåðåèìåíîâàòü îòäåë"), treeWidget); |
+ perevesti_sotrydnika_v_drygo1_otdelAction = new QAction(tr("Ïåðåâåñòè â äðóãîé îòäåë"), treeWidget); |
+ yvolit_sotrydnikaAction = new QAction(tr("Óâîëèòü ñîòðóäíèêà"), treeWidget); |
+ SpliterAction = new QAction(tr("Ïåðñîíàë"), treeWidget); |
+ naznachit_otvetstvennim_za_oborydovanieAction = new QAction(tr("Íàçíà÷èòü îòâåòñòâåííûì çà îáîðóäîâàíèå"), treeWidget); |
+ ystanovit_novie_complektyushieAction = new QAction(tr("Óñòàíîâèòü íîâûå êîìïëåêòóþùèå"), treeWidget); |
+ sozdat_otdelAction = new QAction(tr("Ñîçäàòü íîâûé îòäåë"), treeWidget); |
+ |
+ novaya_SYSTEM_BLOCK_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ñèñòåìíûé áëîê íà ñêëàä"), treeWidget); |
+ novaya_MB_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ ìàòåðèíñêóþ ïëàòó íà ñêëàä"), treeWidget); |
+ novaya_RAM_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ìîäóëü ïàìÿòè íà ñêëàä"), treeWidget); |
+ novaya_CPU_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ïðîöåññîð íà ñêëàä"), treeWidget); |
+ novaya_HDD_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé âèí÷åñòåð íà ñêëàä"), treeWidget); |
+ novaya_CD_DVD_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ïðèâîä íà ñêëàä"), treeWidget); |
+ novaya_VIDEO_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ âèäåîêàðòó íà ñêëàä"), treeWidget); |
+ novaya_SoundCard_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ çâóêîâóþ êàðòó íà ñêëàä"), treeWidget); |
+ novaya_LAN_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ ñåòåâóþ êàðòó íà ñêëàä"), treeWidget); |
+ peredat_sys_block_pod_otveystvennostAction = new QAction(tr("Ïåðåäàòü ñèñòåìíûé áëîê ïîä îòâåòñòâåííîñòü ñîòðóäíèêà"), treeWidget); |
+ |
+ |
+// novaya_SoundCard_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ çâóêîâóþ êàðòó íà ñêëàä"), treeWidget); |
+// novaya_LAN_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ ñåòåâóþ êàðòó íà ñêëàä"), treeWidget); |
+ |
+ insert_MB_to_system_blockAction = new QAction(tr("Óñòàíîâèòü â ñèñòåìíûé áëîê"), treeWidget); |
+ |
+ treeWidget->addAction(metaDataAction); |
+ treeWidget->addAction(addMemoryAction); |
+ |
+ |
+ connect(insert_MB_to_system_blockAction, SIGNAL(triggered()), SLOT(insert_MB_to_system_block())); |
+ connect(novaya_MB_na_skladAction, SIGNAL(triggered()), SLOT(novaya_MB_na_sklad())); |
+ connect(novaya_RAM_na_skladAction, SIGNAL(triggered()), SLOT(novaya_RAM_na_sklad())); |
+ connect(novaya_CPU_na_skladAction, SIGNAL(triggered()), SLOT(novaya_CPU_na_sklad())); |
+ connect(novaya_HDD_na_skladAction, SIGNAL(triggered()), SLOT(novaya_HDD_na_sklad())); |
+ connect(novaya_CD_DVD_na_skladAction, SIGNAL(triggered()), SLOT(novaya_CD_DVD_na_sklad())); |
+ connect(novaya_VIDEO_na_skladAction, SIGNAL(triggered()), SLOT(novaya_VIDEO_na_sklad())); |
+ connect(novaya_SoundCard_na_skladAction, SIGNAL(triggered()), SLOT(novaya_SoundCard_na_sklad())); |
+ connect(novaya_LAN_na_skladAction, SIGNAL(triggered()), SLOT(novaya_LAN_na_sklad())); |
+ connect(novaya_SYSTEM_BLOCK_na_skladAction, SIGNAL(triggered()), SLOT(novaya_SYSTEM_BLOCK_na_sklad())); |
+ |
+ connect(peredat_sys_block_pod_otveystvennostAction, SIGNAL(triggered()), SLOT(peredat_sys_block_pod_otveystvennost())); |
+ |
+ connect(sozdat_otdelAction, SIGNAL(triggered()), SLOT(addNewOtdel())); |
+ |
+ |
+ connect(metaDataAction, SIGNAL(triggered()), SLOT(editTreeWidget())); |
+ connect(addMemoryAction, SIGNAL(triggered()), SLOT(addNewMemory())); |
+ connect(MB_na_skladAction, SIGNAL(triggered()), SLOT(move_to_sklad())); |
+ connect(new_sotrydnikAction, SIGNAL(triggered()), SLOT(new_sotrydnik())); |
+ connect(novoe_oborydovanieAction, SIGNAL(triggered()), SLOT(novoe_oborydovanie())); |
+ connect(pereimenovat_otdelAction, SIGNAL(triggered()), SLOT(pereimenovft_otdel())); |
+ connect(yvolit_sotrydnikaAction, SIGNAL(triggered()), SLOT(yvolit_sotrydnika())); |
+ connect(naznachit_otvetstvennim_za_oborydovanieAction, SIGNAL(triggered()), SLOT(naznachit_otvetstvennim_za_oborydovanie())); |
+ connect(ystanovit_novie_complektyushieAction, SIGNAL(triggered()), SLOT(ystanovit_novie_complektyushie())); |
+ treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); |
+ connect(openBaseAct, SIGNAL(triggered()), this, SLOT(openBase())); |
+ connect(openMemoryTableAct, SIGNAL(triggered()), this, SLOT(openMemoryTable())); |
+ connect(getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); |
+ connect(addStringAct, SIGNAL(triggered()), this, SLOT(addString())); |
+ connect(delStringAct, SIGNAL(triggered()), this, SLOT(delString())); |
+ connect(FiltrButton, SIGNAL(clicked()), this, SLOT(filter())); |
+ connect(hiddenButton, SIGNAL(clicked()), this, SLOT(hiddenRow())); |
+ connect(showButton, SIGNAL(clicked()), this, SLOT(showRow())); |
+ connect(appyButton, SIGNAL(clicked()), this, SLOT(dbUpdate())); |
+ connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *item, int column)), this, SLOT(dblClick(QTreeWidgetItem *item, int column))); |
+ connect(&addmemFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addmemFrm îáíîâëÿåì treeWidget |
+ connect(&addotdelFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addotdelFrm îáíîâëÿåì treeWidget |
+ connect(&addsotrydnikFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addsotFrm îáíîâëÿåì treeWidget |
+ connect(&addsysblockFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addsysblockFrm îáíîâëÿåì treeWidget |
+ |
+ connect(&addmemFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ connect(&addotdelFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ connect(&addsotrydnikFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ connect(&addsysblockFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ |
+ connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput())); |
+ |
+ comp_icon.addFile("./pc.png"); |
+///// hdd_icon.addFile("./gnome-dev-harddisk.png"); |
+ hdd_icon.addFile("./hdd5.png"); |
+ memory_icon.addFile("./memory1.png"); |
+ cd_dvd_icon.addFile("./cd_dvd3.png"); |
+// memory_icon.addFile("./gnome-dev-memory.png"); |
+ matheboard_icon.addFile("./icon_motherboard.png"); |
+ cpu_icon.addFile("./cpu3.png"); |
+ vidio_card_icon.addFile("./vidiocard2.png"); |
+ sound_card_icon.addFile("./soundcard1.png"); |
+ lan_card_icon.addFile("./lan1.png"); |
+ appyButton->setIcon(comp_icon); |
+///// for (int i = 0; i < 10; ++i) |
+///// items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); |
+///// treeWidget->insertTopLevelItems(0, items); |
+//////items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÑÃÑÕÌ: %1")).arg(0)))); |
+/////////items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÑÃÑÕÌ:"))))); |
+/////////items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÇÀÎ:"))))); |
+/////////treeWidget->insertTopLevelItems(0, items); |
+ |
+//->itm = new QTreeWidgetItem(treeWidget); |
+//->itm->setText(0, tr("ÑÃÑÕÌ")); |
+/////////itm->setText(1, "hello1"); |
+//->QTreeWidgetItem *itm1 = new QTreeWidgetItem(itm); |
+//->itm1->setText(1, tr("M1")); |
+//->QTreeWidgetItem *itm1_1 = new QTreeWidgetItem(itm1); |
+//->itm1_1->setText(2, tr("Þð÷åíêî")); |
+//->QTreeWidgetItem *itm1_2 = new QTreeWidgetItem(itm1); |
+//->itm1_2->setText(2, tr("Þøêîâ")); |
+ |
+//->QTreeWidgetItem *itm2 = new QTreeWidgetItem(itm); |
+//->itm2->setText(1, tr("M2")); |
+//////treeWidget->insertTopLevelItem(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÑÃÑÕÌ:"))))); |
+} |
+ |
+MainWindowImpl::~MainWindowImpl() |
+{ |
+ db.close(); |
+// delete setFrm; |
+} |
+ |
+ |
+void MainWindowImpl::delString() |
+{ |
+ QModelIndex index; |
+ int column, row; |
+ QSqlRecord record; |
+ index=view.currentIndex(); |
+ column=view.currentIndex().column(); |
+ row=view.currentIndex().row(); |
+ record = model->record(row); |
+ int UserNameIndex = record.indexOf(tr("Ïîëüçîâàòåëü")); |
+ QString ls_UserName=record.value(UserNameIndex).toString(); |
+ model->removeRows(row, 1); |
+} |
+ |
+// |
+void MainWindowImpl::openBase() |
+{ |
+ lineEdit->insert(tr("Îòêðûòü áàçó ")); |
+// db = new QSqlDatabase("QMYSQL"); |
+ db = QSqlDatabase::addDatabase("QMYSQL"); |
+ pdb = &db; |
+ raportFrm.pdb = &db; |
+// db->addDatabase("QMYSQL"); |
+//db = QSqlDatabase::addDatabase("QSQLITE"); |
+ pdb->setHostName(hostName); |
+ pdb->setDatabaseName(baseName); |
+ pdb->setUserName(userName); |
+ pdb->setPassword(password); |
+ bool ok = pdb->open(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ if (ok) |
+ {lineEdit-> insert(tr("Áàçà óñïåøíî îòêðûòà")); |
+ } |
+ else {lineEdit-> insert(tr("Áàçà íåäîñòóïíà. Êîä îøèáêè: ")); |
+ lineEdit-> insert(pdb->lastError().text()); |
+ } |
+// QSqlQuery q; |
+// q.prepare(tr("set NAMES cp1251")); |
+ |
+// ok = q.exec(); |
+ model = new QSqlTableModel(); |
+ model->setTable(tableName); |
+ |
+ model->setEditStrategy(QSqlTableModel::OnFieldChange); |
+// model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ model->setSort(0, Qt::AscendingOrder); |
+ model->select(); |
+// model->setHeaderData(0, Qt::Horizontal, |
+// QObject::tr("Èìÿ\nïîëüçîâàòåëÿ")); |
+// model->setHeaderData(1, Qt::Horizontal, |
+// QObject::tr("Îòäåë")); |
+// model->setHeaderData(2, Qt::Horizontal, |
+// QObject::tr("IP àäðåñ")); |
+// model->setHeaderData(3, Qt::Horizontal, |
+// QObject::tr("Èíâåíòàííûé\níîìåð")); |
+// model->setHeaderData(4, Qt::Horizontal, |
+// QObject::tr("Îïåðàöèîííàÿ\nñèñòåìà")); |
+// view = new QTableView(); |
+ view.setModel(model); |
+ view.setAlternatingRowColors(true); |
+// view->resizeRowsToContents(); |
+ view.resizeColumnsToContents(); |
+ view.show(); |
+ initTreeWidget(); |
+} |
+ |
+void MainWindowImpl::openMemoryTable() |
+{ |
+ memory_model = new QSqlTableModel(); |
+ memory_model->setTable(tr("Ïàìÿòü")); |
+// memory_model->setTable(tableName); |
+ memory_model->setEditStrategy(QSqlTableModel::OnFieldChange); |
+// model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ memory_model->setSort(0, Qt::AscendingOrder); |
+ memory_model->select(); |
+ tableView->setModel(memory_model); |
+ tableView->setAlternatingRowColors(true); |
+ tableView->resizeColumnsToContents(); |
+ tableView->show(); |
+///// memory_view.setModel(memory_model); |
+///// memory_view.setAlternatingRowColors(true); |
+// view->resizeRowsToContents(); |
+///// memory_view.resizeColumnsToContents(); |
+///// memory_view.show(); |
+} |
+ |
+ |
+void MainWindowImpl::applySetting() |
+{ |
+ int i; |
+ i=5; |
+ lineEdit->insert(tr("Íàñòðîéêè ïîëó÷åíû!")); |
+ baseName = setFrm->lineEdit->text(); |
+ userName = setFrm->lineEdit_2->text(); |
+ password = setFrm->lineEdit_3->text(); |
+ tableName = setFrm->lineEdit_4->text(); |
+ hostName = setFrm->lineEdit_5->text(); |
+ i+=1; |
+ writeSettings(); |
+ setFrm->close(); |
+ delete setFrm; |
+} |
+ |
+void MainWindowImpl::writeSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ settings.setValue("baseName", baseName); |
+ settings.setValue("userName", userName); |
+ settings.setValue("password", password); |
+ settings.setValue("tableName", tableName); |
+ settings.setValue("hostName", hostName); |
+} |
+ |
+ |
+void MainWindowImpl::readSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ baseName = settings.value("baseName", "an_db").toString(); |
+ userName = settings.value("userName", "an").toString(); |
+ password = settings.value("password", "393939").toString(); |
+ tableName = settings.value("tableName", "inventar").toString(); |
+ hostName = settings.value("hostName", "server").toString(); |
+// resize(size); |
+// move(pos);tableName |
+} |
+ |
+void MainWindowImpl::getSetting() |
+{ |
+ setFrm = new settingForm; |
+ connect(setFrm->pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
+ setFrm->lineEdit->setText(baseName); |
+ setFrm->lineEdit_2->setText(userName); |
+ setFrm->lineEdit_3->setText(password); |
+ setFrm->lineEdit_4->setText(tableName); |
+ setFrm->lineEdit_5->setText(hostName); |
+ setFrm->show(); |
+ |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::addString() |
+{ |
+ QString query_begin=(tr("INSERT INTO ")); |
+// QString query_end=(tr(" VALUES('íå çàäàíî','íå çàäàíî','íå çàäàíî','íå çàäàíî',default)")); |
+ QString query_end=(tr(" VALUES()")); |
+ query_begin.append(tableName); |
+ query_begin.append(query_end); |
+ QSqlQuery query; |
+ query.prepare(query_begin); |
+// query.prepare(tr("INSERT INTO inventar VALUES('íå çàäàíî','íå çàäàíî','íå çàäàíî','íå çàäàíî',default)")); |
+// query.bindValue(":tab", "inventar"); |
+// if (!query.execBatch()) |
+// qDebug() << query.lastError(); |
+ query.exec(); |
+ model->select(); |
+// view->close(); |
+ view.setModel(model); |
+ //view->show(); |
+ lineEdit->insert(tr("Äîáàâèòü ñòðîêó!")); |
+} |
+ |
+//Ïðîöåäóðà ïðèìèíåíèÿ ôèëòðàöèè |
+void MainWindowImpl::filter() |
+{ |
+// int i; |
+// i++; |
+ model->setFilter(tr("Ïðèìå÷àíèÿ='Ìèõàéëåíêî'")); |
+ model->select(); |
+// view->close(); |
+ view.setModel(model); |
+} |
+//TEST CVS gh |
+void MainWindowImpl::hiddenRow() |
+{ |
+ int n; |
+ for(n=0;n<20;n++) view.setRowHidden(n,true); |
+} |
+ |
+ |
+void MainWindowImpl::showRow() |
+{ |
+ int n; |
+ for(n=0;n<20;n++) view.setRowHidden(n,false); |
+} |
+ |
+void MainWindowImpl::dbUpdate() |
+{ |
+ model->submitAll(); |
+ addString(); |
+} |
+ |
+ |
+void MainWindowImpl::novaya_MB_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(3); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::novaya_HDD_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(1); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::novaya_CD_DVD_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::novaya_VIDEO_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(5); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::novaya_RAM_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::novaya_SoundCard_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(6); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::novaya_LAN_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(7); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+} |
+ |
+ |
+ |
+ |
+void MainWindowImpl::novaya_CPU_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(2); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::peredat_sys_block_pod_otveystvennost(){ |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñîòðóäíèêà "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñîòðóäíèêà (äâîéíûì êëèêîì ìûøêè), êîòîðûé áóäåò îòâåòñòâåííåí çà ñèñòåìíûé áëîê.")); |
+ fEnable_naznachit_otvetstv = true; |
+ curr_sys_block_id = treeWidget-> currentItem ()->text(12); |
+} |
+ |
+ |
+ |
+void MainWindowImpl::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column) |
+{ |
+ QString tmp; |
+ tmp = item->text(3); |
+ if (tmp !=""){ |
+ addmemFrm.pushButton->setEnabled(true); |
+ } |
+ else addmemFrm.pushButton->setEnabled(false); |
+ addmemFrm.label_7->setText(tmp); |
+} |
+ |
+ |
+ |
+void MainWindowImpl::editTreeWidget() |
+{ |
+ QString inventar_num; |
+ QTreeWidgetItem * currItem; |
+ int currColomn; |
+ int top_item_index; |
+ lineEdit->insert(tr("Ðåäàêòèðîâàòü")); |
+ currItem = treeWidget->currentItem (); |
+ top_item_index = treeWidget->indexOfTopLevelItem(currItem); |
+ currColomn = treeWidget->currentColumn(); |
+ MainWindowImpl::on_treeWidget_itemClicked(currItem, 3); //âûâîäèì íîìåð ñèñòåìíèêà íà ôîðìó |
+// inventar_num = tr("Èíâ.íîì: "); |
+ inventar_num.append(currItem ->text(3)); |
+ if (currColomn == 1){ |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.show(); |
+ }; |
+ if (inventar_num == "") return; |
+ lineEdit->insert(currItem ->text(currColomn)); |
+ switch(currColomn) |
+ { |
+ case 1://Ñîòðóäíèêè |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.show(); |
+ |
+ } |
+ break; |
+ |
+ |
+ case 4: //Ïðîöåññîð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(2); |
+ addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 5: //Ìàòåðèíñêèå ïëàòû |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(3); |
+ addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 6: //Ïàìÿòü |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addNewMemory(inventar_num); |
+// addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 7: //Âèí÷åñòåð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(1); |
+ addmemFrm.show(); |
+ } |
+ break; |
+ |
+ |
+ case 2: break; |
+ defaul: break; |
+ } |
+ addmemFrm.treeWidget->clear(); |
+// addmemFrm.initTreeWidgrt(); |
+} |
+ |
+void MainWindowImpl::initTreeWidget()//íàñòðàèâàåì âèäæåò |
+{ |
+ QStringList treeHeaders;//ñïèñîê çàãîëîâêîâ treeWidget |
+ treeWidget->setColumnCount(15); |
+ treeHeaders << tr("Îòäåëû") //0 ñòîëáåö |
+ << tr("Ïåðñîíàë") //1 ñòîëáåö |
+ << tr("Îïèñàíèå") //2 ñòîëáåö |
+ << tr("Îáîðóäîâàíèå") //3 ñòîëáåö |
+ << tr("Ïðîöåññîð") //4 ñòîëáåö |
+ << tr("Ìàòåðèíêà") //5 ñòîëáåö |
+ << tr("Ïàìÿòü") //6 ñòîëáåö |
+ << tr("Âèí÷åñòåð") //7 ñòîëáåö |
+ << tr("Ïðèâîä") //8 ñòîëáåö |
+ << tr("Âèäåîêàðòà") //9 ñòîëáåö |
+ << tr("Çâóêîâàÿ êàðòà") //10 ñòîëáåö |
+ << tr("Ñåòåâàÿ êàðòà") //11 ñòîëáåö |
+ << tr("Èäåíòèôèêàòîð") //12 ñòîëáåö |
+ << tr("Èäåíòèôèêàòîð ñèñòåíîãî áëîêà") //13 ñòîëáåö |
+ << tr("ID îòâåòñòâííîãî ëèöà"); //14 ñòîëáåö |
+ treeWidget->setHeaderLabels(QStringList (treeHeaders)); |
+// treeWidget->setColumnHidden(2, true); |
+// treeWidget->setColumnHidden(12, true); |
+// treeWidget->setColumnHidden(13, true); |
+ treeWidget->clear(); |
+ addOtdels(); |
+ treeWidget->sortItems(0, Qt::AscendingOrder); |
+} |
+ |
+void MainWindowImpl::addOtdels() |
+{ |
+ int fieldName, fieldID; |
+ QTreeWidgetItem *otdelItem; |
+ QSqlQuery q(tr("select * from otdeli"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ otdelItem = new QTreeWidgetItem(treeWidget); |
+ if (otdel == tr("Ñêëàä")) { otdelItem->setText(0, otdel); |
+ otdelItem->setText(2, tr("Ñêëàä")); |
+ otdelItem->setText(12, otdel_id); |
+ SotrydnikiOtdela(otdel_id, otdelItem); |
+ continue; |
+ } |
+ otdelItem->setText(0, otdel); |
+ otdelItem->setText(2, tr("Îòäåë")); |
+ otdelItem->setText(12, otdel_id); |
+ SotrydnikiOtdela(otdel_id, otdelItem); |
+ } |
+} |
+ |
+ |
+void MainWindowImpl::SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela) // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ îòäåëà |
+{ |
+ int field_fio_sotrydnika, field_id_sotrydnika; |
+ int kolichestvo_sotrudnikov=0; |
+ QString fio_sotrydnika_otdela, id_sotrydnika_otdela, oboryd; |
+ QSqlQuery qsotrydnikiOtdela; |
+ QString sqlQueryString; |
+ QTreeWidgetItem *treeItem_sotrydnika; |
+ sqlQueryString = tr("select Èäåíòèôèêàòîð, ÔÈÎ from sotrydniki where Èäåíòèôèêàòîð_îòäåëà="); |
+ sqlQueryString.append(id_otdela); |
+ qsotrydnikiOtdela.prepare(sqlQueryString); |
+ qsotrydnikiOtdela.exec(); |
+ field_fio_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("ÔÈÎ")); |
+ field_id_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qsotrydnikiOtdela.next()) |
+ { |
+ fio_sotrydnika_otdela = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+ id_sotrydnika_otdela = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ |
+ |
+ treeItem_sotrydnika = new QTreeWidgetItem(itemOtdela); |
+ treeItem_sotrydnika->setText(1, fio_sotrydnika_otdela ); |
+ treeItem_sotrydnika->setText(2, tr("Ñîòðóäíèê")); |
+ treeItem_sotrydnika->setText(14, id_sotrydnika_otdela ); |
+ if (id_sotrydnika_otdela == "1"){ |
+ itm_sklad_system_blocks = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_system_blocks->setText(2, tr("ÑÈÑÒÅÌÍÛÅ ÁËÎÊÈ")); |
+ itm_sklad_orgtehnika = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_orgtehnika->setText(2, tr("ÎÐÃÒÅÕÍÈÊÀ")); |
+ itm_sklad_orgtehnika_printers = new QTreeWidgetItem(itm_sklad_orgtehnika); |
+ itm_sklad_orgtehnika_printers->setText(2, tr("ÏÐÈÍÒÅÐÛ")); |
+ itm_sklad_orgtehnika_mfy = new QTreeWidgetItem(itm_sklad_orgtehnika); |
+ itm_sklad_orgtehnika_mfy->setText(2, tr("ÌÔÓ")); |
+ itm_sklad_komplectyushie = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_komplectyushie->setText(2, tr("ÊÎÌÏËÅÊÒÓÞÙÈÅ")); |
+ itm_sklad_orgtehnika_scaners = new QTreeWidgetItem(itm_sklad_orgtehnika); |
+ itm_sklad_orgtehnika_scaners->setText(2, tr("ÑÊÀÍÅÐÛ")); |
+ itm_sklad_rashodniki = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_rashodniki->setText(2, tr("ÐÀÑÕÎÄÍÛÅ ÌÀÒÅÐÈÀËÛ")); |
+ } |
+ oboryd = oborydovanie(id_sotrydnika_otdela, treeItem_sotrydnika); |
+// treeItem_sotrydnika->setText(3, oboryd ); |
+ ++kolichestvo_sotrudnikov; |
+ } |
+ itemOtdela->setText(13, QVariant(kolichestvo_sotrudnikov).toString()); |
+} |
+ |
+QString MainWindowImpl::oborydovanie(QString id_sotrydnika, QTreeWidgetItem * itemSotrydnika){ |
+ QString result, prResult; |
+ QString sqlQueryText; |
+ QString serial_num, inventar_num, proizvoditel, model, system_block_id; |
+ QSqlQuery quer; |
+ QString MB_information, Memory_information, CPU_information, HDD_information, CD_DVD_information, Vidio_information; |
+ QString Sound_card_information, Lan_card_information; |
+ int field_serialNum, field_inventarNum, field_proizvoditel, field_model, field_system_block_id; |
+// QSqlQuery qns(tr("SET NAMES utf8"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QTreeWidgetItem *itemSysBlock; |
+// sqlQueryText.reserve(300); |
+ sqlQueryText = tr("select system_blocks.Ñåðèéíûé_íîìåð, system_blocks.Èíâåíòàðíûé_íîìåð, system_blocks.Èäåíòèôèêàòîð" |
+ " from system_blocks" |
+ " where system_blocks.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà ="); |
+ sqlQueryText.append(id_sotrydnika); |
+// sqlQueryText.append(tr(" AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð")); |
+ quer.prepare(sqlQueryText); |
+// quer.prepare(tr("select Ñèñòåìíûå_áëîêè.Ñåðèéíûé_íîìåð, Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð,Ìàòåðèíñêèå_ïëàòû.Ïðîèçâîäèòåëü, Ìàòåðèíñêèå_ïëàòû.Ìîäåëü from Ñèñòåìíûå_áëîêè,Ìàòåðèíñêèå_ïëàòû where Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà = 4 AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð;")); |
+ quer.exec(); |
+ field_serialNum = quer.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventarNum = quer.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_system_block_id = quer.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+// field_proizvoditel = quer.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+// field_model = quer.record().indexOf(tr("Ìîäåëü")); |
+ while(quer.next()){ |
+ system_block_id = quer.value(field_system_block_id).toString(); //èäåíòèôèêàòîð ñèñòåìíîãî áëîêà |
+ prResult = ""; |
+ serial_num = quer.value(field_serialNum).toString(); |
+ inventar_num = quer.value(field_inventarNum).toString(); |
+//// if (serial_num != "") {prResult.append(tr("s/n: ")); |
+//// prResult.append(serial_num);} |
+ if (inventar_num != "") { |
+//// prResult.append(tr(" èíâ.íîì: ")); |
+ prResult.append(inventar_num); |
+//// prResult.append(tr(" ")); |
+} |
+ |
+// result.append(q.value(field_proizvoditel).toString()); |
+// result.append(tr(" ")); |
+// result.append(q.value(field_model).toString()); |
+ |
+ |
+ |
+ |
+ |
+// if (id_sotrydnika == "1" & system_block_id == "1") itemSysBlock->setText(2, tr("Êîìïëåêòóþùèå"));// ýòî ñêëàä |
+ if (id_sotrydnika == "1" && system_block_id == "1") itemSysBlock = itm_sklad_komplectyushie;// ýòî ñêëàä |
+ else if (id_sotrydnika == "1" ){ |
+ itemSysBlock = new QTreeWidgetItem(itm_sklad_system_blocks); // íà ñêëàä ñèñòåìíèê |
+ itemSysBlock->setText(2, tr("Ñèñòåìíûé áëîê")); |
+ itemSysBlock->setIcon(3, comp_icon); |
+ if (system_block_id !="") itemSysBlock->setText(12, system_block_id); |
+ if (id_sotrydnika !="") itemSysBlock->setText(14, id_sotrydnika); |
+ } |
+ |
+ else { |
+ itemSysBlock = new QTreeWidgetItem(itemSotrydnika); |
+ itemSysBlock->setText(2, tr("Ñèñòåìíûé áëîê")); |
+ itemSysBlock->setIcon(3, comp_icon); |
+ if (system_block_id !="") itemSysBlock->setText(12, system_block_id); |
+ if (id_sotrydnika !="") itemSysBlock->setText(14, id_sotrydnika); |
+ |
+ } |
+ |
+ MB_information = addMatheBoardInformation (id_sotrydnika, system_block_id, itemSysBlock); //ïîëó÷àåì èíôîðìàöèþ î ìàòåðèíñêîé ïëàòå |
+//// prResult.append(MB_information); |
+ Memory_information = addMemoryInformation(id_sotrydnika, system_block_id, itemSysBlock); //ïîëó÷àåì èíôîðìàöèþ î ïàìÿòè |
+//// prResult.append(Memory_information); |
+ CPU_information = addCpuInformation(id_sotrydnika, system_block_id, itemSysBlock); |
+//// prResult.append(CPU_information); |
+ HDD_information = addHDDInformation(id_sotrydnika, system_block_id, itemSysBlock); |
+//// prResult.append(HDD_information); |
+ CD_DVD_information = add_CD_DVD_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+//// prResult.append(CD_DVD_information); |
+ Vidio_information = add_Vidio_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+ Sound_card_information = add_Sound_Card_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+ Lan_card_information = add_Lan_Card_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+ if (system_block_id != "1"){ |
+ |
+ itemSysBlock->setText(3, prResult); |
+ result.append(prResult); |
+} |
+ |
+ |
+ } |
+ return result; |
+} |
+ |
+QString MainWindowImpl::addMatheBoardInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString MB_proizvoditel, MB_model, MB_identifikator, MB_serial_num, MB_inventar_num; |
+ QString MatheBoardSqlQueryText; |
+ QSqlQuery MatheBoardQuery; |
+ int field_proizvoditel, field_model, field_identifikator, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *itemMB, *itmMB_block; |
+ MatheBoardSqlQueryText = tr("select * " |
+ " from matheboards where matheboards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MatheBoardSqlQueryText.append(id_systemBlock); |
+ MatheBoardQuery.prepare(MatheBoardSqlQueryText); |
+ MatheBoardQuery.exec(); |
+ field_identifikator = MatheBoardQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MatheBoardQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = MatheBoardQuery.record().indexOf(tr("Ìîäåëü")); |
+ field_serial_num = MatheBoardQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = MatheBoardQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itmMB_block = new QTreeWidgetItem(itm_sklad_komplectyushie); |
+ itmMB_block->setText(2, tr("ÌÀÒÅÐÈÍÑÊÈÅ ÏËÀÒÛ")); |
+// itmMB_block->setIcon(3, matheboard_icon); |
+ } |
+ |
+ while(MatheBoardQuery.next()){ |
+ tmp = ""; |
+ MB_identifikator = MatheBoardQuery.value(field_identifikator).toString(); |
+ MB_proizvoditel = MatheBoardQuery.value(field_proizvoditel).toString(); |
+ MB_model = MatheBoardQuery.value(field_model).toString(); |
+ MB_serial_num = MatheBoardQuery.value(field_serial_num).toString(); |
+ MB_inventar_num = MatheBoardQuery.value(field_inventar_num).toString(); |
+ |
+ if (MB_proizvoditel != "") { |
+// tmp.append(tr("MB: ")); |
+ tmp.append(MB_proizvoditel); |
+ } |
+ if (MB_model != "") {tmp.append(tr(" ")); |
+ tmp.append(MB_model); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1") {itemMB = new QTreeWidgetItem(itmMB_block); |
+ } |
+ else itemMB = new QTreeWidgetItem(itemSysBlock); |
+ itemMB->setIcon(4, matheboard_icon); |
+ itemMB->setText(4, tmp); |
+ itemMB->setText(12, MB_identifikator); |
+ itemMB->setText(13, id_systemBlock); |
+ itemMB->setText(14, id_otvetstvennogo_lica); |
+ itemMB->setText(2, tr("Ìàòåðèíñêàÿ ïëàòà")); |
+ itemMB->setText(3, MB_inventar_num); |
+ if (id_systemBlock !="1") itemSysBlock->setText(5, tmp); |
+ |
+ } |
+ return result; |
+} |
+ |
+ |
+QString MainWindowImpl::addMemoryInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString Memiry_id, Memory_proizvoditel, Memory_type, Memory_obem, Memory_inventar_num, Memory_serial_num; |
+ QString MemorySqlQueryText; |
+ QSqlQuery MemoryQuery; |
+ int field_proizvoditel, field_type, field_obem, field_id, field_inventar_num, field_sereal_num; |
+ QTreeWidgetItem *itemMemory, *itemMemory_block; |
+ MemorySqlQueryText = tr("select memory.* " |
+ " from memory where memory.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MemorySqlQueryText.append(id_systemBlock); |
+ MemoryQuery.prepare(MemorySqlQueryText); |
+ MemoryQuery.exec(); |
+ field_id = MemoryQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MemoryQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = MemoryQuery.record().indexOf(tr("Òèï")); |
+ field_obem = MemoryQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = MemoryQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = MemoryQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemMemory_block = new QTreeWidgetItem(itm_sklad_komplectyushie); |
+ itemMemory_block->setText(2, tr("ÌÎÄÓËÈ ÏÀÌßÒÈ")); |
+ } |
+ while(MemoryQuery.next()){ |
+// tmp = tr("RAM: "); |
+ tmp = tr(""); |
+ Memiry_id = MemoryQuery.value(field_id).toString(); |
+ Memory_proizvoditel = MemoryQuery.value(field_proizvoditel).toString(); |
+ Memory_type = MemoryQuery.value(field_type).toString(); |
+ Memory_obem = MemoryQuery.value(field_obem).toString(); |
+ Memory_inventar_num = MemoryQuery.value(field_inventar_num).toString(); |
+ Memory_serial_num = MemoryQuery.value(field_sereal_num).toString(); |
+//// if (Memory_proizvoditel != "") { |
+//// tmp.append(Memory_proizvoditel);} |
+ if (Memory_type != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_type); |
+ tmp.append(tr(" "));} |
+ if (Memory_obem != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_obem); |
+ tmp.append(tr("MB; "));} |
+ result.append(tmp); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemMemory = new QTreeWidgetItem(itemMemory_block); |
+ } |
+ else itemMemory = new QTreeWidgetItem(itemSysBlock); |
+ itemMemory->setIcon(4, memory_icon); |
+ itemMemory->setText(4, tmp); |
+ |
+ itemMemory->setText(2, tr("Ìîäóëü ïàìÿòè")); |
+ itemMemory->setText(12, Memiry_id); |
+ itemMemory->setText(13, id_systemBlock); |
+ itemMemory->setText(14, id_otvetstvennogo_lica); |
+ itemMemory->setText(3, Memory_inventar_num); |
+ |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(6, result); |
+ return result; |
+} |
+ |
+ |
+QString MainWindowImpl::addCpuInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString CPU_id, CPU_proizvoditel, CPU_slot, CPU_fqr, CPU_inventar_num, CPU_serial_num; |
+ QString CpuSqlQueryText; |
+ QSqlQuery CpuQuery; |
+ int field_id, field_proizvoditel, field_slot, field_fqr, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *itemCpu, *itemCpu_block; |
+ CpuSqlQueryText = tr("select processors.* " |
+ " from processors where processors.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CpuSqlQueryText.append(id_systemBlock); |
+ CpuQuery.prepare(CpuSqlQueryText); |
+ CpuQuery.exec(); |
+ field_id = CpuQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CpuQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_slot = CpuQuery.record().indexOf(tr("Ñëîò")); |
+ field_fqr = CpuQuery.record().indexOf(tr("×àñòîòà")); |
+ field_inventar_num = CpuQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CpuQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemCpu_block = new QTreeWidgetItem(itemSysBlock); |
+ itemCpu_block->setText(2, tr("ÏÐÎÖÅÑÑÎÐÛ")); |
+ itemCpu_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ while(CpuQuery.next()){ |
+// tmp = tr("CPU: "); |
+ tmp = tr(""); |
+ CPU_id = CpuQuery.value(field_id).toString(); |
+ CPU_proizvoditel = CpuQuery.value(field_proizvoditel).toString(); |
+ CPU_slot = CpuQuery.value(field_slot).toString(); |
+ CPU_fqr = CpuQuery.value(field_fqr).toString(); |
+ CPU_inventar_num = CpuQuery.value(field_inventar_num).toString(); |
+ CPU_serial_num = CpuQuery.value(field_serial_num).toString(); |
+ |
+ if (CPU_proizvoditel != "") { |
+ tmp.append(CPU_proizvoditel);} |
+// if (CPU_slot != "") {tmp.append(tr(" ")); |
+// tmp.append(CPU_slot); |
+// tmp.append(tr(" "));} |
+ if (CPU_fqr != "") {tmp.append(tr(" ")); |
+ tmp.append(CPU_fqr); |
+ tmp.append(tr("MGz "));} |
+ result.append(tmp); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemCpu = new QTreeWidgetItem(itemCpu_block); |
+ } |
+ else itemCpu = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// itemCpu = new QTreeWidgetItem(itemSysBlock); |
+ itemCpu->setText(2, tr("Ïðîöåññîð")); |
+ itemCpu->setText(12, CPU_id); |
+ itemCpu->setText(13, id_systemBlock); |
+ itemCpu->setText(14, id_otvetstvennogo_lica); |
+ |
+ itemCpu->setIcon(4, cpu_icon); |
+ itemCpu->setText(4, tmp); |
+ |
+ itemCpu->setText(3, CPU_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(4, tmp); |
+ return result; |
+} |
+ |
+QString MainWindowImpl::addHDDInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString HDD_id, HDD_proizvoditel, HDD_interfeis, HDD_obem, HDD_inventar_num, HDD_serial_num; |
+ QString HDDSqlQueryText; |
+ QSqlQuery HDDQuery; |
+ int field_id, field_proizvoditel, field_interfeis, field_obem, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *itemHDD; |
+ QTreeWidgetItem *itemHDD_block; |
+ HDDSqlQueryText = tr("select harddiscs.* " |
+ " from harddiscs where harddiscs.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ HDDSqlQueryText.append(id_systemBlock); |
+ HDDQuery.prepare(HDDSqlQueryText); |
+ HDDQuery.exec(); |
+ field_id = HDDQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = HDDQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_interfeis = HDDQuery.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_obem = HDDQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = HDDQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = HDDQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemHDD_block = new QTreeWidgetItem(itemSysBlock); |
+ itemHDD_block->setText(2, tr("ÂÈÍ×ÅÑÒÅÐÛ")); |
+ itemHDD_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ while(HDDQuery.next()){ |
+// tmp = tr("HDD: "); |
+ tmp = tr(""); |
+ HDD_id = HDDQuery.value(field_id).toString(); |
+ HDD_proizvoditel = HDDQuery.value(field_proizvoditel).toString(); |
+ HDD_interfeis = HDDQuery.value(field_interfeis).toString(); |
+ HDD_obem = HDDQuery.value(field_obem).toString(); |
+ HDD_inventar_num = HDDQuery.value(field_inventar_num).toString(); |
+ HDD_serial_num = HDDQuery.value(field_serial_num).toString(); |
+ if (HDD_proizvoditel != "") { |
+ tmp.append(HDD_proizvoditel);} |
+ if (HDD_interfeis != "") {tmp.append(tr(" ")); |
+ tmp.append(HDD_interfeis); |
+ tmp.append(tr(" "));} |
+ if (HDD_obem != "") {tmp.append(tr(" ")); |
+ tmp.append(HDD_obem); |
+ tmp.append(tr("GB; "));} |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemHDD = new QTreeWidgetItem(itemHDD_block); |
+ } |
+ else itemHDD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// itemHDD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ itemHDD->setText(2, tr("Æåñòêèé äèñê")); |
+ itemHDD->setText(12, HDD_id); |
+ itemHDD->setText(13, id_systemBlock); |
+ itemHDD->setText(14, id_otvetstvennogo_lica); |
+ |
+ itemHDD->setIcon(4, hdd_icon); |
+ itemHDD->setText(4, tmp); |
+ itemHDD->setText(3, HDD_inventar_num); |
+ } |
+// if (result!="") itemSysBlock->setIcon(7, hdd_icon); |
+ if (id_systemBlock !="1") itemSysBlock->setText(7, result); |
+ return result; |
+} |
+ |
+QString MainWindowImpl::add_CD_DVD_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString CD_DVD_id, CD_DVD_proizvoditel, CD_DVD_type, CD_DVD_speed, CD_DVD_serial_num, CD_DVD_inventar_num; |
+ QString CD_DVD_SqlQueryText; |
+ QSqlQuery CD_DVD_Query; |
+ int field_id, field_proizvoditel, field_type, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_CD_DVD; |
+ QTreeWidgetItem *item_CD_DVD_block; |
+ CD_DVD_SqlQueryText = tr("select cd_dvd.* " |
+ " from cd_dvd where cd_dvd.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CD_DVD_SqlQueryText.append(id_systemBlock); |
+ CD_DVD_Query.prepare(CD_DVD_SqlQueryText); |
+ CD_DVD_Query.exec(); |
+ field_id = CD_DVD_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CD_DVD_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = CD_DVD_Query.record().indexOf(tr("Òèï")); |
+ field_speed = CD_DVD_Query.record().indexOf(tr("Ñêîðîñòü")); |
+ field_inventar_num = CD_DVD_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CD_DVD_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD_block = new QTreeWidgetItem(itemSysBlock); |
+ item_CD_DVD_block->setText(2, tr("ÏÐÈÂÎÄÛ")); |
+ item_CD_DVD_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ while(CD_DVD_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ CD_DVD_id = CD_DVD_Query.value(field_id).toString(); |
+ CD_DVD_proizvoditel = CD_DVD_Query.value(field_proizvoditel).toString(); |
+ CD_DVD_type = CD_DVD_Query.value(field_type).toString(); |
+ CD_DVD_speed = CD_DVD_Query.value(field_speed).toString(); |
+ CD_DVD_serial_num = CD_DVD_Query.value(field_serial_num).toString(); |
+ CD_DVD_inventar_num = CD_DVD_Query.value(field_inventar_num).toString(); |
+ |
+ if (CD_DVD_type != "") { |
+ tmp.append(CD_DVD_type);} |
+ if (CD_DVD_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_proizvoditel); |
+ tmp.append(tr(" "));} |
+ if (CD_DVD_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_speed); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ |
+if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD = new QTreeWidgetItem(item_CD_DVD_block); |
+ } |
+ else item_CD_DVD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_CD_DVD->setText(2, tr("Ïðèâîä")); |
+ item_CD_DVD->setText(12, CD_DVD_id); |
+ item_CD_DVD->setText(13, id_systemBlock); |
+ item_CD_DVD->setText(14, id_otvetstvennogo_lica); |
+ item_CD_DVD->setIcon(4, cd_dvd_icon); |
+ item_CD_DVD->setText(4, tmp); |
+ item_CD_DVD->setText(3, CD_DVD_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(8, result); |
+ return result; |
+} |
+ |
+QString MainWindowImpl::add_Vidio_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock){ |
+ |
+ QString result, tmp; |
+ QString Vidio_id, Vidio_proizvoditel, Vidio_model, Vidio_interfeis, Vidio_ram, Vidio_inventar_num, Vidio_sereal_num; |
+ QString Vidio_SqlQueryText; |
+ QSqlQuery Vidio_Query; |
+ int field_id, field_proizvoditel, field_model, field_interfeis, field_ram, field_inventar_num, field_sereal_num; |
+ QTreeWidgetItem *item_Vidio, *item_Vidio_block; |
+ Vidio_SqlQueryText = tr("select videocards.* " |
+ " from videocards where videocards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Vidio_SqlQueryText.append(id_systemBlock); |
+ Vidio_Query.prepare(Vidio_SqlQueryText); |
+ Vidio_Query.exec(); |
+ field_id = Vidio_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Vidio_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Vidio_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_interfeis = Vidio_Query.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_ram = Vidio_Query.record().indexOf(tr("Ïàìÿòü")); |
+ field_inventar_num = Vidio_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = Vidio_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Vidio_block->setText(2, tr("ÂÈÄÅÎÊÀÐÒÛ")); |
+ item_Vidio_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ |
+ while(Vidio_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Vidio_id = Vidio_Query.value(field_id).toString(); |
+ Vidio_proizvoditel = Vidio_Query.value(field_proizvoditel).toString(); |
+ Vidio_model = Vidio_Query.value(field_model).toString(); |
+ Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+ Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ Vidio_inventar_num = Vidio_Query.value(field_inventar_num).toString(); |
+ Vidio_sereal_num = Vidio_Query.value(field_sereal_num).toString(); |
+ if (Vidio_interfeis != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_interfeis);} |
+ if (Vidio_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_proizvoditel);} |
+ if (Vidio_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_model);} |
+ |
+ if (Vidio_ram !=""){tmp.append(tr(" ")); |
+ tmp.append(Vidio_ram); |
+ tmp.append(tr(" Mb")); |
+ |
+ } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio = new QTreeWidgetItem(item_Vidio_block); |
+ } |
+ else item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_Vidio->setText(2, tr("Âèäåîêàðòà")); |
+ item_Vidio->setText(12, Vidio_id); |
+ item_Vidio->setText(13, id_systemBlock); |
+ item_Vidio->setText(14, id_otvetstvennogo_lica); |
+ item_Vidio->setIcon(4, vidio_card_icon); |
+ item_Vidio->setText(4, tmp); |
+ item_Vidio->setText(3, Vidio_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(9, result); |
+ return result; |
+} |
+ |
+ |
+QString MainWindowImpl::add_Sound_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock){ |
+ |
+ |
+ QString result, tmp; |
+ QString Sound_card_id, Sound_card_proizvoditel, Sound_card_model, Sound_card_inventar_num, Sound_card_serial_num; |
+ QString Sound_card_SqlQueryText; |
+ QSqlQuery Sound_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *item_Sound_card, *item_Sound_card_block; |
+ Sound_card_SqlQueryText = tr("select soundcards.* " |
+ " from soundcards where soundcards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Sound_card_SqlQueryText.append(id_systemBlock); |
+ Sound_card_Query.prepare(Sound_card_SqlQueryText); |
+ Sound_card_Query.exec(); |
+ field_id = Sound_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Sound_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Sound_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_inventar_num = Sound_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = Sound_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Sound_card_block->setText(2, tr("ÇÂÓÊÎÂÛÅ ÊÀÐÒÛ")); |
+ item_Sound_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ while(Sound_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Sound_card_id = Sound_card_Query.value(field_id).toString(); |
+ Sound_card_proizvoditel = Sound_card_Query.value(field_proizvoditel).toString(); |
+ Sound_card_model = Sound_card_Query.value(field_model).toString(); |
+ Sound_card_inventar_num = Sound_card_Query.value(field_inventar_num).toString(); |
+ Sound_card_serial_num = Sound_card_Query.value(field_serial_num).toString(); |
+ |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ if (Sound_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_proizvoditel);} |
+ |
+ if (Sound_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_model);} |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card = new QTreeWidgetItem(item_Sound_card_block); |
+ } |
+ else item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Sound_card->setText(2, tr("Çâóêîâàÿ êàðòà")); |
+ item_Sound_card->setText(12, Sound_card_id); |
+ item_Sound_card->setText(13, id_systemBlock); |
+ item_Sound_card->setText(14, id_otvetstvennogo_lica); |
+ item_Sound_card->setIcon(4, sound_card_icon); |
+ item_Sound_card->setText(4, tmp); |
+ item_Sound_card->setText(3, Sound_card_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(10, result); |
+ return result; |
+ |
+} |
+ |
+QString MainWindowImpl::add_Lan_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock){ |
+ |
+ |
+ QString result, tmp; |
+ QString Lan_card_id, Lan_card_proizvoditel, Lan_card_model, Lan_speed, Lan_inventar_num, Lan_serial_num; |
+ QString Lan_card_SqlQueryText; |
+ QSqlQuery Lan_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_Lan_card, *item_Lan_card_block; |
+ Lan_card_SqlQueryText = tr("select lancards.* " |
+ " from lancards where lancards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Lan_card_SqlQueryText.append(id_systemBlock); |
+ Lan_card_Query.prepare(Lan_card_SqlQueryText); |
+ Lan_card_Query.exec(); |
+ field_id = Lan_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Lan_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Lan_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_speed = Lan_card_Query.record().indexOf(tr("Ñêîðîñòü_ïåðåäà÷è_äàííûõ")); |
+ field_serial_num = Lan_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = Lan_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Lan_card_block->setText(2, tr("ÑÅÒÅÂÛÅ ÊÀÐÒÛ")); |
+ item_Lan_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ while(Lan_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Lan_card_id = Lan_card_Query.value(field_id).toString(); |
+ Lan_card_proizvoditel = Lan_card_Query.value(field_proizvoditel).toString(); |
+ Lan_card_model = Lan_card_Query.value(field_model).toString(); |
+ Lan_speed = Lan_card_Query.value(field_speed).toString(); |
+ Lan_inventar_num = Lan_card_Query.value(field_inventar_num).toString(); |
+ Lan_serial_num = Lan_card_Query.value(field_serial_num).toString(); |
+ |
+ |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ if (Lan_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_proizvoditel);} |
+ |
+ if (Lan_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_model);} |
+ |
+ if (Lan_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_speed); |
+ tmp.append(tr(" Mbit"));} |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card = new QTreeWidgetItem(item_Lan_card_block); |
+ } |
+ else item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+// item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Lan_card->setText(2, tr("Ñåòåâàÿ êàðòà")); |
+ item_Lan_card->setText(12, Lan_card_id); |
+ item_Lan_card->setText(13, id_systemBlock); |
+ item_Lan_card->setText(14, id_otvetstvennogo_lica); |
+ item_Lan_card->setIcon(4, lan_card_icon); |
+ item_Lan_card->setText(4, tmp); |
+ item_Lan_card->setText(3, Lan_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(11, result); |
+ return result; |
+ |
+} |
+ |
+void MainWindowImpl::refreshTree(){ |
+ |
+ initTreeWidget(); |
+} |
+ |
+int MainWindowImpl::select_system_block(){ |
+ return 1; |
+} |
+ |
+ |
Index: source_code/src/actions.cpp |
=================================================================== |
--- source_code/src/actions.cpp (revision 0) |
+++ source_code/src/actions.cpp (revision 6) |
@@ -0,0 +1,110 @@ |
+#include "mainwindowimpl.h" |
+ |
+void MainWindowImpl::delete_all_actions(){ |
+ treeWidget->removeAction(addMemoryAction); |
+ treeWidget->removeAction(MB_na_skladAction); |
+ treeWidget->removeAction(new_sotrydnikAction); |
+ treeWidget->removeAction(novoe_oborydovanieAction); |
+ treeWidget->removeAction(SpliterAction); |
+ treeWidget->removeAction(metaDataAction); |
+ treeWidget->removeAction(pereimenovat_otdelAction); |
+ treeWidget->removeAction(yvolit_sotrydnikaAction); |
+ treeWidget->removeAction(perevesti_sotrydnika_v_drygo1_otdelAction); |
+ treeWidget->removeAction(naznachit_otvetstvennim_za_oborydovanieAction); |
+ treeWidget->removeAction(ystanovit_novie_complektyushieAction); |
+ treeWidget->removeAction(sozdat_otdelAction); |
+ treeWidget->removeAction(novaya_MB_na_skladAction); |
+ treeWidget->removeAction(insert_MB_to_system_blockAction); |
+ treeWidget->removeAction(novaya_RAM_na_skladAction); |
+ treeWidget->removeAction(novaya_CPU_na_skladAction); |
+ treeWidget->removeAction(novaya_HDD_na_skladAction); |
+ treeWidget->removeAction(novaya_CD_DVD_na_skladAction); |
+ treeWidget->removeAction(novaya_VIDEO_na_skladAction); |
+ treeWidget->removeAction(novaya_SoundCard_na_skladAction); |
+ treeWidget->removeAction(novaya_LAN_na_skladAction); |
+ treeWidget->removeAction(novaya_SYSTEM_BLOCK_na_skladAction); |
+ treeWidget->removeAction(peredat_sys_block_pod_otveystvennostAction); |
+ |
+} |
+ |
+void MainWindowImpl::add_actions_for_otdel(){ |
+ treeWidget->addAction(pereimenovat_otdelAction); |
+ treeWidget->addAction(new_sotrydnikAction); |
+ treeWidget->addAction(sozdat_otdelAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sotrydnik(){ |
+// SpliterAction->setText(tr("Cîòðóäíèê")); |
+// perevesti_sotrydnika_v_drygo1_otdelAction->setEnabled(false); |
+ treeWidget->addAction(perevesti_sotrydnika_v_drygo1_otdelAction); |
+ |
+// SpliterAction->setSeparator (true); |
+// treeWidget->addAction(SpliterAction); |
+ |
+ treeWidget->addAction(yvolit_sotrydnikaAction); |
+ treeWidget->addAction(naznachit_otvetstvennim_za_oborydovanieAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_system_block(){ |
+ treeWidget->addAction(MB_na_skladAction); |
+ treeWidget->addAction(ystanovit_novie_complektyushieAction); |
+ |
+} |
+ |
+void MainWindowImpl::add_actions_for_kompletyushie(){ |
+ treeWidget->addAction(MB_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad(){ |
+ treeWidget->addAction(sozdat_otdelAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_MB(){ |
+ treeWidget->addAction(novaya_MB_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_HDD(){ |
+ treeWidget->addAction(novaya_HDD_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_CD_DVD(){ |
+ treeWidget->addAction(novaya_CD_DVD_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_SoundCard(){ |
+ treeWidget->addAction(novaya_SoundCard_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_LAN(){ |
+ treeWidget->addAction(novaya_LAN_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad_VIDEO(){ |
+ treeWidget->addAction(novaya_VIDEO_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_RAM(){ |
+ treeWidget->addAction(novaya_RAM_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_CPU(){ |
+ treeWidget->addAction(novaya_CPU_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_insert_MB_to_system_block(){ |
+ treeWidget->addAction(insert_MB_to_system_blockAction); |
+ } |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad_SB(){ |
+ treeWidget->addAction(novaya_SYSTEM_BLOCK_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad_system_block(){ //Äëÿ ñèñòåìíèêîâ íà ñêëàäå äîáàâëÿåì àêöèþ "íàçíà÷èòü îòâåòñòâåííîãî çà ñèñòåìíûé áëîê" |
+ treeWidget->addAction(peredat_sys_block_pod_otveystvennostAction); |
+} |
+ |
\ No newline at end of file |
/source_code/src/actions.cpp |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/raportform.h |
=================================================================== |
--- source_code/src/raportform.h (revision 0) |
+++ source_code/src/raportform.h (revision 6) |
@@ -0,0 +1,197 @@ |
+#ifndef __RAPORTFORM_H__ |
+#define __RAPORTFORM_H__ |
+ |
+// place your code here |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlTableModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QPrinter> |
+#include <QPrintDialog> |
+#include <QFileDialog> |
+#include <QDate> |
+#include "ui_raportform.h" |
+ |
+ |
+typedef struct soundcard { |
+ QString proizvoditel; |
+ QString ID; |
+ QString model; |
+ QString id_sys_block; |
+ QString inv_num; |
+ QString ser_num; |
+ |
+} TSoundcard; |
+ |
+typedef struct lancard { |
+ QString proizvoditel; |
+ QString ID; |
+ QString model; |
+ QString id_sys_block; |
+ QString inv_num; |
+ QString ser_num; |
+ QString speed; |
+ |
+} TLancard; |
+ |
+ |
+typedef struct memory { |
+ QString proizvoditel; |
+ QString tip; |
+ QString ID; |
+ QString obem; |
+ QString inv_num; |
+ QString ser_num; |
+ |
+} TMemory; |
+ |
+typedef struct privod { |
+ QString proizvoditel; |
+ QString tip; |
+ QString model; |
+ QString ID; |
+ QString speed; |
+ QString inv_num; |
+ QString ser_num; |
+ |
+} TPrivod; |
+ |
+typedef struct cpu { |
+ QString proizvoditel; |
+ QString model; |
+ QString ID; |
+ QString slot; |
+ QString inv_num; |
+ QString ser_num; |
+ QString fqr; |
+ |
+} TCpu; |
+ |
+typedef struct videocard { |
+ QString ID; |
+ QString proizvoditel; |
+ QString model; |
+ QString interfeis; |
+ QString memory_value; |
+ QString id_sys_block; |
+ QString ser_num; |
+ QString inv_num; |
+} TVideocard; |
+ |
+typedef struct matheboard { |
+ QString proizvoditel; |
+ QString model; |
+ QString ID; |
+ QString ser_num; |
+ QString inv_num; |
+ |
+ |
+} TMatheboard; |
+ |
+typedef struct harddisc { |
+ QString ID; |
+ QString proizvoditel; |
+ QString interfeis; |
+ QString obem; |
+ QString model; |
+ QString ser_num; |
+ QString inv_num; |
+ |
+ |
+} THarddisc; |
+ |
+ |
+typedef struct system_block { |
+ QString ID; |
+ QString inv_num; |
+ QString ser_num; |
+ QVariant date; |
+ QVariant garantiya; |
+ QString id_otv_lica; |
+ QList<TMatheboard> mb_list; |
+ QList<TMemory> memory_list; |
+ QList<TCpu> cpu_list; |
+ QList<THarddisc> harddisc_list; |
+ QList<TPrivod> privod_list; |
+ QList<TVideocard> videocard_list; |
+ QList<TSoundcard> soundcard_list; |
+ QList<TLancard> lancard_list; |
+ |
+} TSystemBlock; |
+ |
+ |
+typedef struct user { |
+ QString name; |
+ QString ID; |
+ QList <TSystemBlock> system_block_list; |
+} TUser; |
+ |
+typedef struct otdel { |
+ QString name; |
+ QString ID; |
+ QList <TUser> user_list; |
+} TOtdel; |
+ |
+typedef struct sibgipro |
+{ |
+ QList <TOtdel> otdel_list; |
+} TSibgipro; |
+ |
+class raportForm : public QMainWindow, public Ui::raportWindow |
+{ |
+ |
+ |
+ |
+ |
+ |
+Q_OBJECT |
+public: |
+ //raportForm( QWidget * parent = 0, Qt::WFlags f = 0 ); |
+ raportForm(); |
+ ~raportForm(); |
+private slots: |
+ |
+void create_raport(); |
+void on_pushButton_clicked(); |
+//QStringList get_otgel_list(); |
+void on_print_raport(); |
+void on_print_raport_to_pdf(); |
+ |
+private: |
+QTextDocument *document; |
+// = ui->textEdit->document(); |
+QTextCursor *cursor; |
+void print_raport(); |
+void print_raport_to_pdf(); |
+TSibgipro get_sibgipro(); // ïîëó÷àåì ïîëíóþ ñòðóêòóðó îðãàíèçàöèè |
+QList<TOtdel> get_otdel_list(); |
+QList<TUser> get_user_list(QString otdel_ID); |
+QList<TSystemBlock> get_sys_block_list(QString id_otv_lica); // ñïèñîê ñèñòåìíûõ áëîêîâ, çàêðåïëåííûõ çà ïîëüçîâàòåëåì |
+QList<TMatheboard> get_matheboard_list(QString id_system_block); // ñïèñîê ìàòåðèíñêèõ ïëàò, óñòàíîâëåííûõ â ñèñòåìíîì áëîêå |
+QList<TMemory> get_memory_list(QString id_system_block); |
+QList<THarddisc> get_harddisc_list(QString id_system_block); |
+QList<TCpu> get_cpu_list(QString id_system_block); |
+QList<TPrivod> get_privod_list(QString id_system_block); |
+QList<TVideocard> get_videocard_list(QString id_system_block); |
+QList<TSoundcard> get_soundcard_list(QString id_system_block); |
+QList<TLancard> get_lancard_list(QString id_system_block); |
+//QList<THarddisc> get_harddisc_list(QString id_system_block); |
+void bild_raport(); |
+ |
+ |
+QList<TOtdel> otdel_list; |
+ |
+ |
+ |
+public: |
+QSqlDatabase *pdb; |
+ |
+}; |
+ |
+ |
+#endif // __RAPORTFORM_H__ |
Index: source_code/src/settingform.cpp |
=================================================================== |
--- source_code/src/settingform.cpp (revision 0) |
+++ source_code/src/settingform.cpp (revision 6) |
@@ -0,0 +1,10 @@ |
+#include "settingform.h" |
+ |
+// place your code here |
+settingForm::settingForm( ) |
+ : QWidget() |
+{ |
+ setupUi(this); |
+ |
+ // TODO |
+} |
/source_code/src/settingform.cpp |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/mainwindowimpl.h |
=================================================================== |
--- source_code/src/mainwindowimpl.h (revision 0) |
+++ source_code/src/mainwindowimpl.h (revision 6) |
@@ -0,0 +1,228 @@ |
+#ifndef MAINWINDOWIMPL_H |
+#define MAINWINDOWIMPL_H |
+// |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlTableModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QProcess> |
+#include <QByteArray> |
+#include "ui_mainwindow.h" |
+#include "settingform.h" |
+#include "addmemoryform.h" |
+#include "addotdelform.h" |
+#include "addsotrydnikform.h" |
+//#include "addsósblockform.h" |
+#include "addsysblockform.h" |
+#include "raportform.h" |
+ |
+ |
+ |
+#include <string.h> |
+ |
+ |
+ |
+// |
+ |
+bool myfun(void); |
+/// /// bool send(void); |
+bool send(int); |
+bool connecttoregistry(void); |
+bool initcomponentcontext(void); |
+ |
+class MainWindowImpl : public QMainWindow, public Ui::MainWindow |
+{ |
+enum type_komplektyushie {MB, HDD, CD_DVD}; |
+typedef enum type_komplektyushie komplektyushie; |
+ |
+enum type_currient_task_for_dblclick {no_task, select_sys_block, select_sotrydnik_for_sys_block}; |
+typedef enum type_currient_task_for_dblclick currient_task_for_dblclick; |
+ |
+ |
+ |
+ |
+Q_OBJECT |
+public: |
+ MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 ); |
+ ~MainWindowImpl(); |
+ void initTreeWidget(); |
+ |
+ |
+private slots: |
+ void openBase(); |
+ void openMemoryTable(); |
+ void getSetting(); |
+ void applySetting(); |
+ void addString(); |
+ void delString(); |
+ void filter(); |
+ void hiddenRow(); |
+ void showRow(); |
+ void dbUpdate();//âíîñèì èçìåíåíèÿ â áàçó äàííûõ |
+ void dblClick(QTreeWidgetItem *item, int column); |
+ void on_treeWidget_itemActivated(QTreeWidgetItem *item, int column); |
+ void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column); |
+ void on_treeWidget_itemSelectionChanged (); |
+ void editTreeWidget(); |
+ void addNewOtdel();//ñîçäàåì íîâûé îòäåë |
+ void addNewMemory(); |
+ void addNewMemory(QString inventar_num); |
+ void refreshTree(); |
+ void move_to_sklad(); |
+ void new_sotrydnik(); |
+ void novoe_oborydovanie(); |
+ void ystanovit_novie_complektyushie(); |
+ void pereimenovft_otdel(); |
+ void yvolit_sotrydnika(); |
+ void perevesti_sotrydnika_v_drygo1_otdel(); |
+ void naznachit_otvetstvennim_za_oborydovanie(); |
+ void novaya_MB_na_sklad(); |
+ void novaya_RAM_na_sklad(); |
+ void novaya_CPU_na_sklad(); |
+ void novaya_HDD_na_sklad(); |
+ void novaya_CD_DVD_na_sklad(); |
+ void novaya_VIDEO_na_sklad(); |
+ void novaya_SoundCard_na_sklad(); |
+ void novaya_LAN_na_sklad(); |
+ void novaya_SYSTEM_BLOCK_na_sklad(); |
+ void on_addmemoryForm_formClose(); |
+ void insert_MB_to_system_block(); |
+ void on_createButton_clicked(); |
+ void on_exportButton_clicked(); |
+ void on_wmiButton_clicked(); |
+ void peredat_sys_block_pod_otveystvennost(); |
+ void readStandartProcessOutput(); |
+ void readStandartProcessError(); |
+ |
+private: |
+//ïåðåìåííûå |
+ QString baseName; |
+ QString hostName; |
+ QString userName; |
+ QString password; |
+ QString tableName; |
+ |
+ |
+ |
+ QString component_table; // òèï êîìïîíåíòà, óñòàíàâëèâàåìíîãî â ñèñòåìíûé áëîê |
+ QString component_id;// èäåíòèôèêàòîð êîìïîíåíòà, óñòàíàâëèâàåìîãî â ñèñòåìíûé áëîê |
+ QString curr_sys_block_id; |
+ bool fEnable_component_add; |
+ bool fEnable_naznachit_otvetstv; |
+ int id_sys_block_pod_otvetstv; |
+ currient_task_for_dblclick curr_task; |
+//óêàçàòåëè íà îáúåêòû |
+ settingForm *setFrm; |
+ addmemoryForm addmemFrm; |
+ addotdelForm addotdelFrm; |
+ addsotrydnikForm addsotrydnikFrm; |
+ raportForm raportFrm; |
+ |
+ addsysblockForm addsysblockFrm; |
+ QSqlTableModel *model; |
+ QSqlTableModel *memory_model; |
+ QTableView view; |
+ QTableView memory_view;// return res; |
+ QList<QTreeWidgetItem *> items; |
+ QTreeWidgetItem *itm; |
+ QTreeWidgetItem *itm1; |
+ QTreeWidgetItem *itm_sklad_komplectyushie; |
+ QTreeWidgetItem *itm_sklad_system_blocks; |
+ QTreeWidgetItem *itm_sklad_orgtehnika; |
+ QTreeWidgetItem *itm_sklad_orgtehnika_printers; |
+ QTreeWidgetItem *itm_sklad_orgtehnika_mfy; |
+ QTreeWidgetItem *itm_sklad_orgtehnika_scaners; |
+ QTreeWidgetItem *itm_sklad_rashodniki; |
+ QAction *metaDataAction; |
+ QAction *addMemoryAction; |
+ QAction *MB_na_skladAction; // àêöèÿ "ïåðåìåñòèòü íà ñêëàä" |
+ QAction *new_sotrydnikAction; |
+ QAction *novoe_oborydovanieAction; |
+ QAction *SpliterAction; |
+ QAction *pereimenovat_otdelAction; |
+ QAction *perevesti_sotrydnika_v_drygo1_otdelAction; |
+ QAction *yvolit_sotrydnikaAction; |
+ QAction *naznachit_otvetstvennim_za_oborydovanieAction; |
+ QAction *peredat_sys_block_pod_otveystvennostAction; |
+ QAction *ystanovit_novie_complektyushieAction; |
+ QAction *sozdat_otdelAction; |
+ |
+ QAction *novaya_MB_na_skladAction; |
+ QAction *novaya_RAM_na_skladAction; |
+ QAction *novaya_CPU_na_skladAction; |
+ QAction *novaya_HDD_na_skladAction; |
+ QAction *novaya_CD_DVD_na_skladAction; |
+ QAction *novaya_VIDEO_na_skladAction; |
+ QAction *novaya_SoundCard_na_skladAction; |
+ QAction *novaya_LAN_na_skladAction; |
+ QAction *novaya_SYSTEM_BLOCK_na_skladAction; |
+ |
+ QAction *insert_MB_to_system_blockAction; //íîâûé ñèñòåìíèê íà ñêëàä |
+ |
+//ôóíêöèè |
+ void writeSettings(); |
+ void readSettings(); |
+ void SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela); // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ |
+ void addOtdels();//äîáàâëÿåì îòäåëû â treeView |
+ |
+ |
+ |
+ QString oborydovanie(QString id_sotrydnika, QTreeWidgetItem * itemSotrydnika); |
+ QString addMatheBoardInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString addMemoryInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString addCpuInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString addHDDInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_CD_DVD_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_Vidio_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_Sound_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_Lan_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString get_info_from_system_block(QString inventar_num); |
+ void delete_all_actions(); |
+ void add_actions_for_otdel(); |
+ void add_actions_for_sklad(); |
+ void add_actions_for_sotrydnik(); |
+ void add_actions_for_system_block(); |
+ void add_actions_for_kompletyushie(); |
+ void add_actions_for_sklad_MB(); |
+ void add_actions_for_sklad_RAM(); |
+ void add_actions_for_sklad_CPU(); |
+ void add_actions_for_sklad_HDD(); |
+ void add_actions_for_sklad_CD_DVD(); |
+ void add_actions_for_sklad_VIDEO(); |
+ void add_actions_for_sklad_SoundCard(); |
+ void add_actions_for_sklad_LAN(); |
+ void add_actions_for_sklad_SB(); |
+ void add_actions_for_insert_MB_to_system_block(); |
+ void add_actions_for_sklad_system_block(); |
+ |
+ |
+ int select_system_block(); // ôóíêöèÿ âåðí¸ò èäåíòèôèêàòîð âûáðàííîãî ñèñòåìíîãî áëîêà |
+ |
+ |
+ |
+public: |
+ QIcon comp_icon; |
+ QIcon printer_icon; |
+ QIcon hdd_icon; |
+ QIcon memory_icon; |
+ QIcon matheboard_icon; |
+ QIcon cpu_icon; |
+ QIcon cd_dvd_icon; |
+ QIcon vidio_card_icon; |
+ QIcon sound_card_icon; |
+ QIcon lan_card_icon; |
+ QSqlDatabase *pdb; |
+ QSqlDatabase db; |
+ QProcess process; |
+ |
+}; |
+#endif |
+ |
+ |
+ |
+ |
/source_code/src/mainwindowimpl.h |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/slots.cpp |
=================================================================== |
--- source_code/src/slots.cpp (revision 0) |
+++ source_code/src/slots.cpp (revision 6) |
@@ -0,0 +1,1009 @@ |
+#include "mainwindowimpl.h" |
+// place your code here |
+// ïðîâåðêà |
+ |
+void MainWindowImpl::addNewMemory(){ |
+QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+QStringList user_list; |
+// addmemFrm = new addmemoryForm; |
+// QString temp; |
+// int lsize; |
+ addmemFrm.treeWidget->clear(); |
+ addmemFrm.comboBox->clear(); |
+ addmemFrm.comboBox_4->clear(); |
+ proizv_list = addmemFrm.getManufacturiesList(); |
+ user_list = addmemFrm.getSystemBlockList(); |
+ |
+// lsize = proizv_list.size(); |
+//for (int i = 0; i < lsize; ++i){ |
+// temp = proizv_list.at(i); } |
+ addmemFrm.comboBox->addItems(proizv_list); |
+ addmemFrm.comboBox_4->addItems(user_list); |
+ addmemFrm.show(); |
+} |
+ |
+void MainWindowImpl::addNewMemory(QString inventar_num){ |
+QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+QStringList mb_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ìàòåðèíñêèõ ïëàò |
+QStringList hdd_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé âèí÷åñòåðîâ |
+QStringList cpu_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé âèí÷åñòåðîâ |
+QStringList video_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé âèäåîêàðò |
+QStringList mb_model_list;//ñïèñîê ìîäåëåé ìàòåðèíñêèõ ïëàò |
+QStringList user_list; |
+QString currProizvoditel; |
+// addmemFrm = new addmemoryForm; |
+// QString temp; |
+// int lsize; |
+ treeWidget->setEnabled(false); |
+ |
+ addmemFrm.label_7->setText(inventar_num); |
+ addmemFrm.treeWidget->clear(); |
+ addmemFrm.comboBox->clear(); |
+ addmemFrm.comboBox_4->clear(); |
+ addmemFrm.comboBox_5->clear(); |
+ addmemFrm.comboBox_6->clear(); |
+ addmemFrm.comboBox_13->clear();//ïðîèçâîäèòåëè HDD |
+ addmemFrm.comboBox_9->clear();//ïðîèçâîäèòåëè CPU |
+ addmemFrm.comboBox_19->clear();//ïðîèçâîäèòåëè VIDEO |
+ addmemFrm.comboBox_20->clear();//ìîäåëè âèäåîêàðò |
+ addmemFrm.lineEdit_2->clear(); |
+ addmemFrm.lineEdit->clear(); |
+ |
+ proizv_list = addmemFrm.getManufacturiesList(); |
+ mb_proizv_list = addmemFrm.getManufacturiesListMB(); |
+ hdd_proizv_list = addmemFrm.getManufacturiesListHDD(); |
+ cpu_proizv_list = addmemFrm.getManufacturiesListCPU(); |
+ video_proizv_list = addmemFrm.getManufacturiesListVIDEO(); |
+ |
+ user_list = addmemFrm.getSystemBlockList(); |
+ |
+ |
+// lsize = proizv_list.size(); |
+//for (int i = 0; i < lsize; ++i){ |
+// temp = proizv_list.at(i); } |
+ addmemFrm.comboBox->addItems(proizv_list); |
+ addmemFrm.comboBox_5->addItems(mb_proizv_list); |
+ addmemFrm.comboBox_13->addItems(hdd_proizv_list); |
+ addmemFrm.comboBox_9->addItems(cpu_proizv_list); |
+ addmemFrm.comboBox_19->addItems(video_proizv_list); |
+ currProizvoditel = addmemFrm.comboBox_5->currentText(); |
+// mb_model_list = addmemFrm.getModelListMB(currProizvoditel); |
+// addmemFrm.comboBox_6->addItems(mb_model_list); |
+ addmemFrm.comboBox_4->addItems(user_list); |
+ |
+ addmemFrm.show(); |
+} |
+ |
+ |
+QString MainWindowImpl::get_info_from_system_block(QString inventar_num){ |
+ |
+ QSqlQuery query; |
+ int field_id, field_serial_num, field_inventar_num, field_data_pokypki, field_srok_garantii, field_id_otv_lica; |
+ QString sql_query_text, tmp; |
+ QString identifikator, serial_num, data_pokypki, srok_garantii, id_otv_lica ; |
+ |
+ sql_query_text = tr("select Ñèñòåìíûå_áëîêè.* from Ñèñòåìíûå_áëîêè where Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð = "); |
+ sql_query_text.append(inventar_num); |
+ query.prepare(sql_query_text); |
+ query.exec(); |
+ |
+ field_id = query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_serial_num = query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_data_pokypki = query.record().indexOf(tr("Äàòà_ïîêóïêè")); |
+ field_srok_garantii = query.record().indexOf(tr("Ñðîê_ãàðàíòèè")); |
+ field_id_otv_lica = query.record().indexOf(tr("Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà")); |
+ |
+ identifikator = query.value(field_id).toString(); |
+ serial_num = query.value(field_serial_num).toString(); |
+ data_pokypki = query.value(field_data_pokypki).toString(); |
+ srok_garantii = query.value(field_srok_garantii).toString(); |
+ id_otv_lica = query.value(field_id_otv_lica).toString(); |
+ |
+ tmp = "Èíâ. íîì: "; |
+ tmp.append(inventar_num); |
+ |
+ |
+ return tmp; |
+} |
+ |
+void MainWindowImpl::on_treeWidget_itemSelectionChanged (){ |
+ if (fEnable_component_add || fEnable_naznachit_otvetstv) { |
+ delete_all_actions(); |
+ return; |
+ } |
+ QTreeWidgetItem *currItm; |
+ QString txt; |
+ QString id_otv_lica; |
+ int i; |
+ i++; |
+ currItm = treeWidget-> currentItem (); |
+ txt = currItm->text(2); |
+ id_otv_lica = currItm->text(14); |
+ if (txt==tr("Îòäåë")){ |
+ delete_all_actions(); |
+ add_actions_for_otdel(); |
+// treeWidget->removeAction(MB_na_skladAction); |
+// treeWidget->removeAction(addMemoryAction); |
+// treeWidget->removeAction(novoe_oborydovanieAction); |
+ } |
+ else if (txt==tr("Ñîòðóäíèê")) { |
+ delete_all_actions(); |
+ add_actions_for_sotrydnik(); |
+// treeWidget->removeAction(addMemoryAction); |
+// treeWidget->removeAction(MB_na_skladAction); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("Ñêëàä")) { |
+ delete_all_actions(); |
+// treeWidget->removeAction(MB_na_skladAction); |
+// treeWidget->removeAction(addMemoryAction); |
+ add_actions_for_sklad(); |
+ } |
+ else if (txt==tr("Ñèñòåìíûé áëîê") && id_otv_lica != tr("1")){ |
+ delete_all_actions(); |
+ add_actions_for_system_block(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("Ñèñòåìíûé áëîê") && id_otv_lica == tr("1")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_system_block(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("ÌÀÒÅÐÈÍÑÊÈÅ ÏËÀÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_MB(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("ÌÎÄÓËÈ ÏÀÌßÒÈ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_RAM(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÏÐÎÖÅÑÑÎÐÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_CPU(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÂÈÍ×ÅÑÒÅÐÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_HDD(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÏÐÈÂÎÄÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_CD_DVD(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÂÈÄÅÎÊÀÐÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_VIDEO(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÇÂÓÊÎÂÛÅ ÊÀÐÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_SoundCard(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÑÅÒÅÂÛÅ ÊÀÐÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_LAN(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+else if (txt==tr("ÑÈÑÒÅÌÍÛÅ ÁËÎÊÈ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_SB(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ |
+/* else if (txt==tr("Ìàòåðèíñêàÿ ïëàòà") && id_otv_lica == tr("1")){ |
+ delete_all_actions(); |
+ add_actions_for_insert_MB_to_system_block(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } */ |
+ |
+ |
+ else if (id_otv_lica != tr("1")){treeWidget->addAction(addMemoryAction); //íå ñêëàä |
+ delete_all_actions(); |
+ add_actions_for_kompletyushie(); |
+// treeWidget->addAction(SpliterAction); |
+ |
+// SpliterAction->setSeparator (true); |
+// treeWidget->addAction(MB_na_skladAction); |
+ } |
+ |
+ else {treeWidget->addAction(addMemoryAction); // ñêëàä |
+ delete_all_actions(); |
+ add_actions_for_insert_MB_to_system_block();//íàçâàíèå ôóíêöèè íàäî ïîìåíÿòü, ýòî êî âñåì êîìïëåêòóþùèì îòíîñèòñÿ |
+// treeWidget->addAction(SpliterAction); |
+ |
+// SpliterAction->setSeparator (true); |
+// treeWidget->addAction(MB_na_skladAction); |
+ } |
+ |
+// if (txt==tr("Ñèñòåìíûé áëîê")) {i++;} |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+void MainWindowImpl::novoe_oborydovanie(){ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::pereimenovft_otdel(){ |
+ |
+} |
+ |
+void MainWindowImpl::yvolit_sotrydnika(){ |
+ |
+} |
+ |
+void MainWindowImpl::perevesti_sotrydnika_v_drygo1_otdel(){ |
+ int i; |
+ i++; |
+} |
+ |
+void MainWindowImpl::naznachit_otvetstvennim_za_oborydovanie(){ |
+ |
+} |
+ |
+void MainWindowImpl::ystanovit_novie_complektyushie(){ |
+ QString inventar_num; |
+ QTreeWidgetItem * currItem; |
+ int currColomn; |
+ int top_item_index; |
+ lineEdit->insert(tr("Ðåäàêòèðîâàòü")); |
+ currItem = treeWidget->currentItem (); |
+ top_item_index = treeWidget->indexOfTopLevelItem(currItem); |
+ currColomn = treeWidget->currentColumn(); |
+ MainWindowImpl::on_treeWidget_itemClicked(currItem, 3); //âûâîäèì íîìåð ñèñòåìíèêà íà ôîðìó |
+// inventar_num = tr("Èíâ.íîì: "); |
+ inventar_num.append(currItem ->text(3)); |
+ if (currColomn == 1){ |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.show(); |
+ }; |
+ if (inventar_num == "") return; |
+ lineEdit->insert(currItem ->text(currColomn)); |
+switch(currColomn) |
+ { |
+ case 1://Ñîòðóäíèêè |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addNewMemory(inventar_num); |
+ |
+ } |
+ break; |
+ |
+ |
+ case 4: //Ïðîöåññîð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(2); |
+ addNewMemory(inventar_num); |
+ } |
+ break; |
+ |
+ case 5: //Ìàòåðèíñêèå ïëàòû |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(3); |
+ addNewMemory(inventar_num); |
+ } |
+ break; |
+ |
+ case 6: //Ïàìÿòü |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addNewMemory(inventar_num); |
+// addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 7: //Âèí÷åñòåð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(1); |
+ addNewMemory(inventar_num); |
+ } |
+ break; |
+ |
+ |
+// case 2: break; |
+ default : { |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addNewMemory(inventar_num); |
+ } |
+ |
+ break; |
+ } |
+ addmemFrm.treeWidget->clear(); |
+ |
+ |
+ |
+ |
+ |
+ addmemFrm.treeWidget->clear(); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+void MainWindowImpl::on_addmemoryForm_formClose(){ |
+ treeWidget->setEnabled(true); |
+} |
+ |
+ |
+ |
+ |
+ |
+void MainWindowImpl::insert_MB_to_system_block(){ // óñòàíàâëèâàåì êîìïîíåíòû ñî ñêëàäà |
+ QTreeWidgetItem * currItem; |
+ QString tip_komplekt; |
+ QString identifikator_kimplekt; // èäåíòèôèêàòîð êîìïëåêòóþùåãî â òàáëèöå |
+ currItem = treeWidget->currentItem (); |
+ tip_komplekt = currItem->text(2); |
+ identifikator_kimplekt = currItem->text(12); |
+ if (tip_komplekt == tr("Ìàòåðèíñêàÿ ïëàòà")){ |
+ component_table = tr("matheboards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé õîòèòå óñòàíîâèòü ìàòåðèíñêóþ ïëàòó.")); |
+ |
+ } |
+ else if (tip_komplekt == tr("Ìîäóëü ïàìÿòè")){ |
+ component_table = tr("memory"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ìîäóëü ïàìÿòè.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Ïðîöåññîð")){ |
+ component_table = tr("processors"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ïðîöåññîð.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Âèäåîêàðòà")){ |
+ component_table = tr("videocards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü âèäåîêàðòó.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Ïðèâîä")){ |
+ component_table = tr("cd_dvd"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ïðèâîä.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Çâóêîâàÿ êàðòà")){ |
+ component_table = tr("soundcards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü çâóêîâóþ êàðòó.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Ñåòåâàÿ êàðòà")){ |
+ component_table = tr("lancards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ñåòåâóþ êàðòó.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Æåñòêèé äèñê")){ |
+ component_table = tr("harddiscs"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü æåñòêèé äèñê.")); |
+ } |
+ |
+ // select an_db.Îòäåëû.Íàçâàíèå, an_db.Ñîòðóäíèêè.ÔÈÎ, an_db.Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð from an_db.Îòäåëû , an_db.Ñîòðóäíèêè, an_db.Ñèñòåìíûå_áëîêè where an_db.Îòäåëû.Èäåíòèôèêàòîð = an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð_îòäåëà and an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð = an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà; |
+// select an_db.Îòäåëû.Íàçâàíèå, an_db.Ñîòðóäíèêè.ÔÈÎ, an_db.Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð, an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð from an_db.Îòäåëû , an_db.Ñîòðóäíèêè, an_db.Ñèñòåìíûå_áëîêè where an_db.Îòäåëû.Èäåíòèôèêàòîð = an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð_îòäåëà and an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð = an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà and an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð != 1 and an_db.Îòäåëû.Íàçâàíèå = "ÑÀÏÐ"; |
+ |
+ |
+ int i; |
+ i++; |
+ |
+ |
+} |
+ |
+void MainWindowImpl::dblClick(QTreeWidgetItem *item, int column) |
+{ |
+ lineEdit->insert(item->text(column)); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::move_to_sklad(){ |
+ QString SqlText; |
+ QString currID; |
+ QString typeOdorydovaniya; |
+ QString tableName; |
+ QTreeWidgetItem * currItem; |
+ QString TipOborydovaniya; |
+ QSqlQuery UpdateSqlQuery; |
+ currItem = treeWidget->currentItem (); |
+ currID = currItem->text(12); |
+ typeOdorydovaniya = currItem->text(2); |
+ |
+// tableName = |
+ if (typeOdorydovaniya == tr("Ìîäóëü ïàìÿòè")){ |
+ tableName = tr("memory"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ìàòåðèíñêàÿ ïëàòà")){ |
+ tableName = tr("matheboards"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ïðîöåññîð")){ |
+ tableName = tr("processors"); |
+ } |
+ else if (typeOdorydovaniya == tr("Âèäåîêàðòà")){ |
+ tableName = tr("videocards"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ïðèâîä")){ |
+ tableName = tr("cd_dvd"); |
+ } |
+ else if (typeOdorydovaniya == tr("Çâóêîâàÿ êàðòà")){ |
+ tableName = tr("soundcards"); |
+ } |
+ else if (typeOdorydovaniya == tr("Æåñòêèé äèñê")){ |
+ tableName = tr("harddiscs"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ñåòåâàÿ êàðòà")){ |
+ tableName = tr("lancards"); |
+ } |
+ |
+ else return; |
+ SqlText = tr("update "); |
+ SqlText.append(tableName); |
+ SqlText.append(tr(" set Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = 1 where Èäåíòèôèêàòîð = ")); |
+ SqlText.append(currID); |
+ UpdateSqlQuery.prepare(SqlText); |
+ UpdateSqlQuery.exec(); |
+ initTreeWidget(); |
+} |
+ |
+ |
+ |
+void MainWindowImpl::on_treeWidget_itemActivated(QTreeWidgetItem *item, int column)// ñîáûòèå íàñòóïàåò ïðè äâîéíîì êëèêå ìûøêè |
+{ |
+ if (fEnable_naznachit_otvetstv) { |
+ QString SqlText; |
+ QSqlQuery UpdateSqlQuery; |
+ QString id_sotrydnika; |
+ if (item ->text(2) == tr("Ñîòðóäíèê")) { |
+ id_sotrydnika = item ->text(14); |
+ SqlText = tr("update system_blocks set Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà = "); |
+ SqlText.append(id_sotrydnika); |
+ SqlText.append(tr(" where system_blocks.Èäåíòèôèêàòîð = ")); |
+ SqlText.append(tr(curr_sys_block_id)); |
+ UpdateSqlQuery.prepare(SqlText); |
+ UpdateSqlQuery.exec(); |
+ initTreeWidget(); |
+ fEnable_naznachit_otvetstv = false; |
+ |
+ } |
+ } |
+ |
+ else if (!fEnable_component_add) lineEdit->insert(item->text(column)); |
+ else { |
+ QString SqlText; |
+ QSqlQuery UpdateSqlQuery; |
+ QString id_sys_block; |
+// QTreeWidgetItem * currItem; |
+// currItem = treeWidget->currentItem (); |
+ if (item ->text(2) == tr("Ñèñòåìíûé áëîê")) { |
+ id_sys_block = item ->text(12); |
+ SqlText = tr("update "); |
+ SqlText.append(component_table); |
+ SqlText.append(tr(" set Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = ")); |
+ SqlText.append(id_sys_block); |
+ SqlText.append(tr(" where Èäåíòèôèêàòîð = ")); |
+ SqlText.append(tr(component_id)); |
+ UpdateSqlQuery.prepare(SqlText); |
+ UpdateSqlQuery.exec(); |
+ initTreeWidget(); |
+ fEnable_component_add = false; |
+ } |
+ |
+ else return; |
+ |
+ |
+ } |
+ |
+} |
+ |
+void addmemoryForm::on_comboBox_5_currentIndexChanged (QString newText){ |
+ QStringList mb_model_list; |
+ comboBox_6->clear(); |
+ mb_model_list = getModelListMB(newText); |
+ comboBox_6->addItems(mb_model_list); |
+ |
+// int i; |
+// i++; |
+// i++; |
+} |
+ |
+void addmemoryForm::on_comboBox_19_currentIndexChanged (QString newText){ |
+ QStringList video_model_list; |
+ comboBox_20->clear(); |
+ video_model_list = getModelListVIDEO(newText); |
+ comboBox_20->addItems(video_model_list); |
+ |
+// int i; |
+// i++; |
+// i++; |
+} |
+ |
+ |
+void addmemoryForm::on_comboBox_9_currentIndexChanged (QString newText){ |
+ QStringList mb_model_list; |
+ comboBox_12->clear(); |
+ mb_model_list = getModelListCPU(newText); |
+ comboBox_12->addItems(mb_model_list); |
+ |
+// int i; |
+// i++; |
+// i++; |
+} |
+ |
+void MainWindowImpl::on_createButton_clicked(){ |
+// int i; |
+// i++; |
+// i++; |
+ bool ok; |
+QSqlQuery q; |
+//q.prepare(tr("set NAMES cp1251")); |
+//ok = q.exec(); |
+// q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó îòäåëîâ |
+ |
+ |
+q.prepare(tr("CREATE TABLE an_db.otdeli ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Íàçâàíèå CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàíî\", " |
+ "Ñïðàâêà CHAR(255) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåò\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ ok = q.exec(); |
+ |
+ |
+//Ñîçäàåì òàáëèöó ñîòðóäíèêîâ |
+ |
+q.clear(); |
+ |
+q.prepare(tr("CREATE TABLE an_db.sotrydniki ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "ÔÈÎ CHAR(80) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàíî\", " |
+ "Èäåíòèôèêàòîð_îòäåëà INTEGER UNSIGNED, " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó ñèñòåìíûõ áëîêîâ |
+ |
+q.prepare(tr("CREATE TABLE an_db.system_blocks ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Äàòà_ïîêóïêè DATE, " |
+ "Ñðîê_ãàðàíòèè INTEGER UNSIGNED NOT NULL DEFAULT 0, " |
+ "Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà INTEGER UNSIGNED DEFAULT 1, " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó ìàòåðèíñêèõ ïëàò |
+ |
+q.prepare(tr("CREATE TABLE an_db.matheboards ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Ñëîò CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòíî\", " |
+ "×àñòîòà_øèíû INTEGER UNSIGNED DEFAULT 100, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó ìîäóëåé ïàìÿòè |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.memory ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Òèï ENUM(\"DIM\",\"DDR\",\"DDRII\",\"RIMM\",\"SIMM\") DEFAULT \"DDRII\", " |
+ "Îáúåì INTEGER UNSIGNED, " |
+ "×àñòîòà_øèíû INTEGER UNSIGNED, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.proizvoditeli_pamyati (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.processors (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "×àñòîòà INTEGER UNSIGNED, " |
+ "Ñëîò CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòåí\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.processor_models (Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòåí\"" |
+ ") ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.harddiscs (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíòåðôåéñ CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Îáúåì INTEGER UNSIGNED, " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.proizvoditeli_hdd (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.proizvoditeli_mb (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.proizvoditeli_cpu (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.proizvoditeli_mb (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.proizvoditeli_video (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.video_models (Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòåí\"" |
+ ") ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.cd_dvd (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Òèï CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ñêîðîñòü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.videocards (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Èíòåðôåéñ CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ïàìÿòü INTEGER UNSIGNED, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.soundcards (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE an_db.lancards (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Ñêîðîñòü_ïåðåäà÷è_äàííûõ INTEGER UNSIGNED DEFAULT 100, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("INSERT INTO an_db.otdeli VALUES( default, \"Ñêëàä\", \"Ñêëàä\")")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+//sotrydniki |
+ |
+q.prepare(tr("insert into sotrydniki (ÔÈÎ, Èäåíòèôèêàòîð_îòäåëà) " |
+ "values (:fio, :id_otd)")); |
+ q.bindValue(tr(":fio"), tr("Êëàäîâùèê")); |
+ q.bindValue(tr(":id_otd"), tr("1")); |
+ |
+ok = q.exec(); |
+ |
+ |
+} |
+ |
+ |
+ |
+void MainWindowImpl::on_exportButton_clicked(){ |
+ |
+raportFrm.show(); |
+/* |
+ |
+int ch; |
+QChar qch = 'Ï'; |
+ |
+char ch_arr[32]; |
+ch_arr[0] = char('À'); |
+ch_arr[1] = char('í'); |
+ch_arr[2] = char('ä'); |
+ch_arr[3] = char('ð'); |
+ch_arr[4] = char('å'); |
+ |
+ch = qch.unicode(); |
+ |
+// int y; |
+// y = 20 / 0; |
+ if (!(myfun())){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+ |
+ |
+ |
+if (!(connecttoregistry())){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+if (!(initcomponentcontext())){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+ |
+ if (!(send(10))){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+ |
+ |
+ |
+ |
+ |
+*/ |
+ |
+}; |
+ |
+ |
+void MainWindowImpl::on_wmiButton_clicked(){ |
+ |
+// QString program = tr(" wmic -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\""); |
+ QString program = tr("wmic"); |
+ QStringList arguments; |
+ |
+// arguments << tr(" -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\""); |
+ program.append(tr(" -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\"")); |
+ int i; |
+ i++; |
+ process.start(program); |
+ |
+} |
+ |
+ |
+void MainWindowImpl::addNewOtdel(){ |
+ int i=0; |
+ i++; |
+ addotdelFrm.lineEdit->clear(); |
+ addotdelFrm.lineEdit_2->clear(); |
+ treeWidget->setEnabled(false); |
+ addotdelFrm.show(); |
+ |
+} |
+ |
+void MainWindowImpl::new_sotrydnik(){ |
+ QTreeWidgetItem *currItm; |
+ currItm = treeWidget-> currentItem (); |
+ int i=0; |
+ i++; |
+ addsotrydnikFrm.lineEdit->clear(); |
+ addsotrydnikFrm.IdOtdela = currItm->text(12); |
+ treeWidget->setEnabled(false); |
+ addsotrydnikFrm.show(); |
+ |
+} |
+ |
+void MainWindowImpl::novaya_SYSTEM_BLOCK_na_sklad(){ |
+ int i=0; |
+ i++; |
+ treeWidget->setEnabled(false); |
+ addsysblockFrm.show(); |
+ |
+} |
+ |
+void MainWindowImpl::readStandartProcessOutput(){ |
+ QByteArray arr; |
+ QStringList result; |
+ QString str1, str2; |
+ int i; |
+ arr = process.readAllStandardOutput(); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec::setCodecForTr(codecUTF); |
+ str1 = QString(tr(arr)); |
+ QTextCodec::setCodecForTr(codec); |
+ result << QStringList(arr); |
+// str2 << arr; |
+ i = result.size(); |
+// str1 = result.at(0); |
+ i++; |
+ lineEdit->insert(str1); |
+ |
+} |
+ |
+void MainWindowImpl::readStandartProcessError(){ |
+ QByteArray arr; |
+ arr = process.readAllStandardError(); |
+ |
+} |
Index: source_code/src/addotdelform.cpp |
=================================================================== |
--- source_code/src/addotdelform.cpp (revision 0) |
+++ source_code/src/addotdelform.cpp (revision 6) |
@@ -0,0 +1,61 @@ |
+#include "addotdelform.h" |
+#include "mainwindowimpl.h" |
+// place your code here |
+ |
+addotdelForm::addotdelForm() |
+ : QDialog() |
+{ |
+// QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+ setupUi(this); |
+// proizv_list = getManufacturiesList(); |
+// comboBox->addItems(proizv_list); |
+ // TODO |
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNemOtdelSlot())); |
+ |
+} |
+ |
+ |
+ |
+void addotdelForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+void addotdelForm::addNemOtdelSlot(){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_identifikator, field_nazvanie, field_spravka; |
+ QString identifikator, nazvanie, spravka; |
+ bool ok; |
+ if (lineEdit->text()==""){ |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ñîçäàíèÿ îòäåëà"), // Çàãîëîâîê. |
+ tr("Âû íå ââåëè íàçâàíèå îòäåëà!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ |
+ sqltext = tr("select * from otdeli where otdeli.Íàçâàíèå = \""); |
+ sqltext.append(lineEdit->text()); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ ok = q.exec(); |
+ field_nazvanie = q.record().indexOf(tr("Íàçâàíèå")); |
+ if (q.next()) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ñîçäàíèÿ îòäåëà"), // Çàãîëîâîê. |
+ tr("Îòäåë ñ òàêèì èìåíåì ñóùåñòâóåò!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ else { |
+ q.clear(); |
+ q.prepare(tr("insert into otdeli (Íàçâàíèå, Ñïðàâêà) " |
+ "values (:name, :comment)")); |
+ q.bindValue(tr(":name"), lineEdit->text()); |
+ q.bindValue(tr(":comment"), lineEdit_2->text()); |
+ ok = q.exec(); |
+ emit componentAdd(); |
+ close();} |
+ |
+} |
\ No newline at end of file |
/source_code/src/addotdelform.cpp |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/addmemoryform.cpp |
=================================================================== |
--- source_code/src/addmemoryform.cpp (revision 0) |
+++ source_code/src/addmemoryform.cpp (revision 6) |
@@ -0,0 +1,754 @@ |
+#include "addmemoryform.h" |
+#include "mainwindowimpl.h" |
+ |
+// place your code here |
+addmemoryForm::addmemoryForm( ) |
+ : QWidget() |
+{ |
+// QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+ setupUi(this); |
+// proizv_list = getManufacturiesList(); |
+// comboBox->addItems(proizv_list); |
+ // TODO |
+} |
+ |
+QStringList addmemoryForm::getManufacturiesList(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from an_db.proizvoditeli_pamyati"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM an_db.Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+QStringList addmemoryForm::getManufacturiesListVIDEO(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from an_db.proizvoditeli_video"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM an_db.Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+ |
+ |
+QStringList addmemoryForm::getManufacturiesListMB(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from an_db.proizvoditeli_mb"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM an_db.Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+QStringList addmemoryForm::getManufacturiesListHDD(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from an_db.proizvoditeli_hdd"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM an_db.Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+QStringList addmemoryForm::getManufacturiesListCPU(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from an_db.proizvoditeli_cpu"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM an_db.Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+ |
+QStringList addmemoryForm::getModelListMB(QString proizvoditel){ |
+ QStringList modelList; |
+ QString SqlText, tmp; |
+ QSqlQuery qmodel; |
+ int field_model; |
+ SqlText = tr("select * from an_db.Ìîäåëè_ìàòåðèíñêèõ_ïëàò where an_db.Ìîäåëè_ìàòåðèíñêèõ_ïëàò.Ïðîèçâîäèòåëü = \""); |
+ SqlText.append(proizvoditel); |
+ SqlText.append(tr("\"")); |
+ qmodel.prepare(SqlText); |
+ qmodel.exec(); |
+ field_model = qmodel.record().indexOf(tr("Ìîäåëü")); |
+ modelList.clear(); |
+ while (qmodel.next()){ |
+ tmp = qmodel.value(field_model).toString(); |
+// comboBox->addItem(tmp); |
+ modelList.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return modelList; |
+} |
+ |
+ |
+ |
+QStringList addmemoryForm::getModelListVIDEO(QString proizvoditel){ |
+ QStringList modelList; |
+ QString SqlText, tmp; |
+ QSqlQuery qmodel; |
+ int field_model; |
+ SqlText = tr("select * from an_db.video_models where an_db.video_models.Ïðîèçâîäèòåëü = \""); |
+ SqlText.append(proizvoditel); |
+ SqlText.append(tr("\"")); |
+ qmodel.prepare(SqlText); |
+ qmodel.exec(); |
+ field_model = qmodel.record().indexOf(tr("Ìîäåëü")); |
+ modelList.clear(); |
+ while (qmodel.next()){ |
+ tmp = qmodel.value(field_model).toString(); |
+// comboBox->addItem(tmp); |
+ modelList.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return modelList; |
+} |
+ |
+ |
+ |
+QStringList addmemoryForm::getModelListCPU(QString proizvoditel){ |
+ QStringList modelList; |
+ QString SqlText, tmp; |
+ QSqlQuery qmodel; |
+ int field_model; |
+ SqlText = tr("select * from an_db.processor_models where an_db.processor_models.Ïðîèçâîäèòåëü = \""); |
+ SqlText.append(proizvoditel); |
+ SqlText.append(tr("\"")); |
+ qmodel.prepare(SqlText); |
+ qmodel.exec(); |
+ field_model = qmodel.record().indexOf(tr("Ìîäåëü")); |
+ modelList.clear(); |
+ while (qmodel.next()){ |
+ tmp = qmodel.value(field_model).toString(); |
+// comboBox->addItem(tmp); |
+ modelList.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return modelList; |
+} |
+ |
+ |
+QStringList addmemoryForm::getSystemBlockList(){ |
+ QStringList sysBlockList; |
+ bool b1, b2; |
+ QString tmp, SerialNum, InventarNum, DataPokypki, SrokGarantii, UserId, Identifikator; |
+ int field_identifikator, field_serial_num, field_inventar_num, field_data_pokypki, field_srok_garantii, field_user_id; |
+ QSqlQuery qysBlockList(tr("select * from an_db.system_blocks")); |
+ field_serial_num = qysBlockList.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = qysBlockList.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_data_pokypki = qysBlockList.record().indexOf(tr("Äàòà_ïîêóïêè")); |
+ field_srok_garantii = qysBlockList.record().indexOf(tr("Ñðîê_ãàðàíòèè")); |
+ field_user_id = qysBlockList.record().indexOf(tr("Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà")); |
+ field_identifikator = qysBlockList.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qysBlockList.next()){ |
+ tmp = ""; |
+ SerialNum = qysBlockList.value(field_serial_num).toString(); |
+ InventarNum = qysBlockList.value(field_inventar_num).toString(); |
+ DataPokypki = qysBlockList.value(field_data_pokypki).toString(); |
+ SrokGarantii = qysBlockList.value(field_srok_garantii).toString(); |
+ UserId = qysBlockList.value(field_user_id).toString(); |
+ Identifikator = qysBlockList.value(field_identifikator).toString(); |
+ b1 = (SerialNum !=""); |
+ b2 = (SerialNum !=tr("Ñïèñàí")); |
+// if (SerialNum == tr("Ñïèñàí")){continue;} |
+// if (SerialNum == tr("Ñêëàä")){sysBlockList << tr("Íà ñêëàä"); continue;} |
+// if (SerialNum !="") {tmp.append(tr("S/N: ")); |
+// tmp.append(SerialNum); } |
+ if (InventarNum == tr("Ñïèñàí")){continue;} |
+ if (InventarNum == tr("Ñêëàä")){sysBlockList << tr("Íà ñêëàä"); continue;} |
+ if (InventarNum !="") {tmp.append(tr("Èíâ.íîì:")); |
+ tmp.append(InventarNum); } |
+ tmp.append(addmemoryForm::getUserInfo(UserId)); |
+// if (InventarNum !=""){tmp.append(tr(" Èíâ.íîì: ")); |
+// tmp.append(InventarNum);} |
+ if (tmp !="") sysBlockList << tmp; |
+ |
+ } |
+ return sysBlockList; |
+ |
+} |
+ |
+QString addmemoryForm::getUserInfo(QString userID){ |
+ QString rslt, tmp, sqlQueryText; |
+ QString identifikator_polzovatela, fio_polzovatela, identifikator_otdela; |
+ int field_identifikator, field_fio, field_id_otdela; |
+ QSqlQuery qSqlUserInfo; |
+ sqlQueryText = tr("select * from an_db.Ñîòðóäíèêè where Èäåíòèôèêàòîð = "); |
+ sqlQueryText.append(userID); |
+ qSqlUserInfo.prepare(sqlQueryText); |
+ qSqlUserInfo.exec(); |
+ field_identifikator = qSqlUserInfo.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_fio = qSqlUserInfo.record().indexOf(tr("ÔÈÎ")); |
+ field_id_otdela = qSqlUserInfo.record().indexOf(tr("Èäåíòèôèêàòîð_îòäåëà")); |
+ tmp=""; |
+ while(qSqlUserInfo.next()){ |
+ identifikator_polzovatela = qSqlUserInfo.value(field_identifikator).toString(); |
+ fio_polzovatela = qSqlUserInfo.value(field_fio).toString(); |
+ identifikator_otdela = qSqlUserInfo.value(field_id_otdela).toString(); |
+ if (fio_polzovatela !="") { |
+ tmp.append(tr(" ")); |
+ tmp.append(fio_polzovatela); |
+ tmp.append(addmemoryForm::getOtdelName(identifikator_otdela)); |
+ } |
+ |
+ } |
+ rslt.append(tmp); |
+ return rslt; |
+ |
+} |
+ |
+ |
+QString addmemoryForm::getOtdelName(QString otdelID){ |
+ QString otdel, sqlText, tmp; |
+ QSqlQuery query; |
+ int field_name; |
+ sqlText = (tr("select an_db.Îòäåëû.Íàçâàíèå from an_db.Îòäåëû where Èäåíòèôèêàòîð = ")); |
+ sqlText.append(otdelID); |
+ query.prepare(sqlText); |
+ query.exec(); |
+ field_name = query.record().indexOf(tr("Íàçâàíèå")); |
+ tmp=""; |
+ while(query.next()){ |
+ tmp.append(tr(" ")); |
+ tmp.append( query.value(field_name).toString()); |
+ } |
+ otdel = tmp; |
+ return otdel; |
+} |
+ |
+void addmemoryForm::initTreeWidgrt(){ |
+int fieldName, fieldID; |
+ QTreeWidgetItem *otdelItem; |
+ QSqlQuery q(tr("select * from Îòäåëû"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ otdelItem = new QTreeWidgetItem(addmemoryForm::treeWidget); |
+ otdelItem->setText(0, otdel); |
+ addmemoryForm::SotrydnikiOtdela(otdel_id, otdelItem); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela){ |
+ int field_fio_sotrydnika, field_id_sotrydnika; |
+ QString fio_sotrydnika_otdela, id_sotrydnika_otdela, oboryd; |
+ QSqlQuery qsotrydnikiOtdela; |
+ QString sqlQueryString; |
+ QTreeWidgetItem *treeItem_sotrydnika; |
+ sqlQueryString = tr("select Èäåíòèôèêàòîð, ÔÈÎ from Ñîòðóäíèêè where Èäåíòèôèêàòîð_îòäåëà="); |
+ sqlQueryString.append(id_otdela); |
+ qsotrydnikiOtdela.prepare(sqlQueryString); |
+ qsotrydnikiOtdela.exec(); |
+ field_fio_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("ÔÈÎ")); |
+ field_id_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qsotrydnikiOtdela.next()) |
+ { |
+ fio_sotrydnika_otdela = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+ id_sotrydnika_otdela = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ treeItem_sotrydnika = new QTreeWidgetItem(itemOtdela); |
+ treeItem_sotrydnika->setText(1, fio_sotrydnika_otdela ); |
+// treeItem_sotrydnika->setText(2, id_sotrydnika_otdela ); |
+// oboryd = oborydovanie(id_sotrydnika_otdela, treeItem_sotrydnika); |
+// treeItem_sotrydnika->setText(3, oboryd ); |
+ } |
+} |
+ |
+void addmemoryForm::on_pushButton_clicked(){ |
+QSqlQuery q; |
+QString sqlText; |
+if (lineEdit->text() == "") |
+ { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ââîäà äàííûõ"), // Çàãîëîâîê. |
+ tr("Ââåäèòå èíâåíòàðíûé íîìåð")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+switch (tabWidget->currentIndex()) |
+{ |
+ case 0: //Ìîäóëè ïàìÿòè |
+ { |
+ QString id; |
+ |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into memory (Ïðîèçâîäèòåëü, Òèï, Îáúåì, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :tip, :obem, :sys_id, :inv_num, :serial_num)")); |
+// q.bindValue(":ident", "default"); |
+ q.bindValue(tr(":proizvoditel"), comboBox->currentText()); |
+ q.bindValue(tr(":tip"), comboBox_3->currentText()); |
+ q.bindValue(tr(":obem"), comboBox_2->currentText()); |
+// q.bindValue(tr(":chastota"), "default"); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+// query.bindValue(":surname", "Simpson"); |
+// sqlText = tr("insert into Ïàìÿòü vflue()"); |
+ q.exec(); |
+ add_mem_proizvoditel(comboBox->currentText()); //äîáàâèì ïðîèçâîäèòåëÿ â ñïèñîê, åñëè åãî òàì íåò |
+ emit componentAdd(); |
+ close(); |
+// MainWindowImpl::initTreeWidget(); |
+ } |
+ break; |
+ |
+ case 1: //Âèí÷åñòåðû |
+ { |
+ QString id; |
+ |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into harddiscs (Ïðîèçâîäèòåëü, Èíòåðôåéñ, Îáúåì, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :interface, :obem, :sys_id, :inv_num, :serial_num)")); |
+// q.bindValue(":ident", "default"); |
+ q.bindValue(tr(":proizvoditel"), comboBox_13->currentText()); |
+ q.bindValue(tr(":interface"), comboBox_14->currentText()); |
+ q.bindValue(tr(":obem"), comboBox_15->currentText()); |
+// q.bindValue(tr(":chastota"), "default"); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+// query.bindValue(":surname", "Simpson"); |
+// sqlText = tr("insert into Ïàìÿòü vflue()"); |
+ q.exec(); |
+ add_hdd_proizvoditel(comboBox_13->currentText()); //äîáàâèì ïðîèçâîäèòåëÿ â ñïèñîê, åñëè åãî òàì íåò |
+ emit componentAdd(); |
+ close(); |
+// MainWindowImpl::initTreeWidget(); |
+ } |
+ break; |
+ |
+ |
+ case 2: //Ïðîöåññîðû |
+ { |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into processors (Ïðîèçâîäèòåëü, Ìîäåëü, ×àñòîòà , Ñëîò, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :fqr, :slot, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_9->currentText()); |
+ q.bindValue(tr(":model"), comboBox_12->currentText()); |
+ q.bindValue(tr(":slot"), comboBox_11->currentText()); |
+ q.bindValue(tr(":fqr"), comboBox_10->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_cpu_proizvoditel(comboBox_9->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ add_cpu_model(comboBox_9->currentText(), comboBox_12->currentText()); |
+ |
+ emit componentAdd(); |
+ close(); |
+ } |
+ break; |
+ |
+ case 3: //Ìàòåðèíñêèå ïëàòû |
+ { |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into matheboards (Ïðîèçâîäèòåëü, Ìîäåëü , Ñëîò, ×àñòîòà_øèíû, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :slot, :bus_fqr, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_5->currentText()); |
+ q.bindValue(tr(":model"), comboBox_6->currentText()); |
+ q.bindValue(tr(":slot"), comboBox_7->currentText()); |
+ q.bindValue(tr(":bus_fqr"), comboBox_8->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ break; |
+ |
+ case 4: //CD/DVD ïðèâîäû |
+ { |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into cd_dvd (Òèï, Ïðîèçâîäèòåëü, Ñêîðîñòü, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:tip, :proizvoditel, :skorost, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":tip"), comboBox_16->currentText()); |
+ q.bindValue(tr(":proizvoditel"), comboBox_17->currentText()); |
+ q.bindValue(tr(":skorost"), comboBox_18->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ |
+ |
+ break; |
+ |
+ case 5: //Âèäåîêàðòû |
+ { |
+ |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into videocards (Ïðîèçâîäèòåëü, Ìîäåëü , Èíòåðôåéñ, Ïàìÿòü, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :interface, :memory, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_19->currentText()); |
+ q.bindValue(tr(":model"), comboBox_20->currentText()); |
+ q.bindValue(tr(":interface"), comboBox_21->currentText()); |
+ q.bindValue(tr(":memory"), comboBox_22->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_video_proizvoditel(comboBox_19->currentText()); |
+ add_video_model(comboBox_19->currentText(), comboBox_20->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ break; |
+ |
+ case 6: //Çâóêîâûå êàðòû |
+ { |
+ |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into soundcards (Ïðîèçâîäèòåëü, Ìîäåëü , Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_23->currentText()); |
+ q.bindValue(tr(":model"), comboBox_24->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ |
+ } |
+ break; |
+ case 7: //Ñåòåâûå êàðòû |
+ { |
+ |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into lancards (Ïðîèçâîäèòåëü, Ìîäåëü , Ñêîðîñòü_ïåðåäà÷è_äàííûõ, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :spd, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_25->currentText()); |
+ q.bindValue(tr(":model"), comboBox_26->currentText()); |
+ q.bindValue(tr(":spd"), comboBox_27->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ |
+ } |
+ break; |
+ |
+ default: |
+ |
+ |
+ break; |
+} |
+ |
+void componentAdd(); |
+ |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+QString addmemoryForm::getIdentifikator(QString inventar_num){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_id; |
+ QString identifikator; |
+ if (inventar_num == tr("Íà ñêëàä")) return tr("1"); |
+ sqltext = tr("select * from system_blocks where system_blocks.Èíâåíòàðíûé_íîìåð = \""); |
+ sqltext.append(inventar_num); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_id = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ if (q.next()) {identifikator = q.value(field_id).toString();} |
+ else { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ââîäà äàííûõ"), // Çàãîëîâîê. |
+ tr("Íåâîçìîæíî îïðåäåëèòü èäåíòèôèêàòîð ñèñòåìíîãî áëîêà")); // Òåêñò ñîîáùåíèÿ. |
+ return identifikator; |
+ |
+ |
+ }; |
+ return identifikator; |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+void addmemoryForm::add_video_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_video where proizvoditeli_video.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_video (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+void addmemoryForm::add_mem_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_pamyati where proizvoditeli_pamyati.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_pamyati (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+void addmemoryForm::add_mb_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_mb where proizvoditeli_mb.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_mb (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_hdd_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_hdd where proizvoditeli_hdd.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_hdd (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_cpu_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_cpu where proizvoditeli_hdd.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_cpu (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_mb_model(QString brend, QString model){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from Ìîäåëè_ìàòåðèíñêèõ_ïëàò where Ìîäåëè_ìàòåðèíñêèõ_ïëàò.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\" and Ìîäåëè_ìàòåðèíñêèõ_ïëàò.Ìîäåëü = \"")); |
+ sqltext.append(model); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into Ìîäåëè_ìàòåðèíñêèõ_ïëàò (Ìîäåëü, Ïðîèçâîäèòåëü) " |
+ "values (:model, :proizvoditel)")); |
+ q.bindValue(tr(":model"), model); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+ |
+void addmemoryForm::add_cpu_model(QString brend, QString model){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from processor_models where processor_models.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\" and processor_models.Ìîäåëü = \"")); |
+ sqltext.append(model); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into processor_models (Ìîäåëü, Ïðîèçâîäèòåëü) " |
+ "values (:model, :proizvoditel)")); |
+ q.bindValue(tr(":model"), model); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_video_model(QString brend, QString model){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from video_models where video_models.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\" and video_models.Ìîäåëü = \"")); |
+ sqltext.append(model); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into video_models (Ìîäåëü, Ïðîèçâîäèòåëü) " |
+ "values (:model, :proizvoditel)")); |
+ q.bindValue(tr(":model"), model); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+//void addmemoryForm::hide (){ |
+// treeWidget->setEnabled(true); |
+//} |
+ |
+void addmemoryForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+ |
Index: source_code/src/settingform.h |
=================================================================== |
--- source_code/src/settingform.h (revision 0) |
+++ source_code/src/settingform.h (revision 6) |
@@ -0,0 +1,15 @@ |
+#ifndef __SETTINGFORM_H__ |
+#define __SETTINGFORM_H__ |
+#include <QWidget> |
+#include "ui_settingform.h" |
+// place your code here |
+class settingForm : public QWidget, public Ui::settingForm |
+{ |
+Q_OBJECT |
+public: |
+ settingForm(); |
+ |
+ private slots: |
+// void on_pushButton_clicked(); |
+}; |
+#endif // __SETTINGFORM_H__ |
/source_code/src/settingform.h |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/addotdelform.h |
=================================================================== |
--- source_code/src/addotdelform.h (revision 0) |
+++ source_code/src/addotdelform.h (revision 6) |
@@ -0,0 +1,33 @@ |
+#ifndef __ADDOTDELFORM_H__ |
+#define __ADDOTDELFORM_H__ |
+ |
+// place your code here |
+#include <QDialog> |
+#include <QtGui> |
+#include <QtSql> |
+#include "ui_addotdelform.h" |
+ |
+class addotdelForm : public QDialog, public Ui::addotdelform |
+{ |
+Q_OBJECT |
+ public: |
+ addotdelForm(); |
+ |
+ |
+signals: |
+ void formClose(); |
+ void componentAdd(); |
+ |
+private slots: |
+ void addNemOtdelSlot(); |
+ |
+private: |
+ |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+ |
+ |
+#endif // __ADDOTDELFORM_H__ |
/source_code/src/addotdelform.h |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: source_code/src/addmemoryform.h |
=================================================================== |
--- source_code/src/addmemoryform.h (revision 0) |
+++ source_code/src/addmemoryform.h (revision 6) |
@@ -0,0 +1,56 @@ |
+#ifndef __ADDMEMORYFORM_H__ |
+#define __ADDMEMORYFORM_H__ |
+#include <QWidget> |
+#include <QtSql> |
+#include <QtGui> |
+#include "ui_addmemoryform.h" |
+// place your code here |
+class addmemoryForm : public QWidget, public Ui::addmemoryForm |
+{ |
+Q_OBJECT |
+ public: |
+ addmemoryForm(); |
+// addmemoryForm(QTreeWidgetItem * currItem); |
+ QStringList getManufacturiesList(); |
+ QStringList getManufacturiesListMB(); |
+ QStringList getManufacturiesListHDD(); |
+ QStringList getManufacturiesListCPU(); |
+ QStringList getManufacturiesListVIDEO(); |
+ QStringList getModelListMB(QString proizvoditel); |
+ QStringList getModelListCPU(QString proizvoditel); |
+ QStringList getModelListVIDEO(QString proizvoditel); |
+ QStringList getSystemBlockList(); |
+ QStringList getSystemBlockList(QString inventar_num); |
+ QString getUserInfo(QString userID); |
+ QString getOtdelName(QString otdelID); |
+ QString getIdentifikator(QString inventar_num); |
+ void initTreeWidgrt(); |
+ void SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela); // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ |
+ |
+//public slots: |
+// void hide(); |
+ |
+signals: |
+ void componentAdd(); |
+ void formClose(); |
+ |
+private slots: |
+ void on_pushButton_clicked(); |
+ void on_comboBox_5_currentIndexChanged (QString newText); |
+ void on_comboBox_9_currentIndexChanged (QString newText); |
+ void on_comboBox_19_currentIndexChanged (QString newText); |
+private: |
+ void add_video_proizvoditel(QString brend); |
+ void add_mem_proizvoditel(QString brend); |
+ void add_mb_proizvoditel(QString brend); |
+ void add_cpu_proizvoditel(QString brend); |
+ void add_hdd_proizvoditel(QString brend); |
+ void add_mb_model (QString brend, QString model); |
+ void add_cpu_model (QString brend, QString model); |
+ void add_video_model (QString brend, QString model); |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+#endif // __ADDMEMORYFORM_H__ |
/source_code/src/addmemoryform.h |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |