.RU

7 СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ - Пояснительная записка к кп содержит 29 страниц, 18 рисунков, 8 таблиц, 2 источника,...


^ 7 СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ


1 Дьяков И.А., Базы данных. Язык SQL-ТГТУ, 2004

  1. Qt 4.6: Qt Reference Documentation[Электронный ресурс]официальный сайт разработчиков Qt с документацией, примерами и описаниями /Nokia corporation;

документация-2010.-Режим доступа: http://doc.qt.nokia.com/, свободный.


^ ПРИЛОЖЕНИЕ – ИСХОДНЫЙ КОД ПРИЛОЖЕНИЯ


# -------------------------------------------------

# Project created by QtCreator 2010-04-13T16:43:20

# -------------------------------------------------

QT += sql

TEMPLATE = app

TARGET = VideoShop

unix:DESTDIR = bin

win32:DESTDIR = ../bin

unix:MOC_DIR = moc

win32:MOC_DIR = ../moc

unix:OBJECTS_DIR = obj

win32:OBJECTS_DIR = ../obj

TRANSLATIONS += cw_ru.ts

SOURCES += main.cpp \

cw.cpp \

supplier.cpp \

isupplier.cpp \

customer.cpp \

icustomer.cpp \

product.cpp \

iproduct.cpp \

seproduct.cpp \

sproduct.cpp \

supplys.cpp \

shop.cpp \

eshop.cpp \

admin.cpp \

newacc.cpp \

employs.cpp \

iemploys.cpp \

getdate.cpp \

raspisanie.cpp \

poolback.cpp

HEADERS += cw.h \

supplier.h \

isupplier.h \

customer.h \

icustomer.h \

product.h \

iproduct.h \

seproduct.h \

sproduct.h \

supplys.h \

shop.h \

eshop.h \

admin.h \

newacc.h \

employs.h \

iemploys.h \

getdate.h \

raspisanie.h \

poolback.h

FORMS += cw.ui \

supplier.ui \

isupplier.ui \

customer.ui \

icustomer.ui \

product.ui \

iproduct.ui \

seproduct.ui \

sproduct.ui \

supplys.ui \

shop.ui \

eshop.ui \

admin.ui \

newacc.ui \

employs.ui \

iemploys.ui \

getdate.ui \

raspisanie.ui \

poolback.ui

#ifndef ADMIN_H

#define ADMIN_H


#include

#include "customer.h"

#include "supplier.h"

#include "product.h"

#include "supplys.h"

#include "employs.h"

#include "raspisanie.h"

namespace Ui {

class admin;

}


class admin : public QDialog {

Q_OBJECT

public:

admin(QWidget *parent = 0);

~admin();


protected:

void changeEvent(QEvent *e);

private slots:


void on_productPushButton_clicked();

void on_supplierPushButton_clicked();

void on_customerPushButton_clicked();

void on_quitPushButton_clicked();

void on_supplyPushButton_clicked();

void on_employsPushButton_clicked();

void on_raspPushButton_clicked();

private:

Ui::admin *ui;

};


#endif // ADMIN_H


#ifndef CUSTOMER_H

#define CUSTOMER_H


#include "cw.h"

#include

#include

#include


namespace Ui {

class customer;

}


class customer : public QDialog {

Q_OBJECT

public:

customer(QWidget *parent = 0);

~customer();


protected:

void changeEvent(QEvent *e);


private:

Ui::customer *ui;

QSqlTableModel *model;

QPrinter _printer;


private:

QString tableViewToHtml();

QString htmlAlign( int a );


private slots:

void on_previewPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();


private slots:

void submitAll();

void check(QSqlDatabase db);

void print();

void insert();

void remove();

void preview();

void pPreview(QPrinter *p);


};


#endif // CUSTOMER_H


#ifndef CW_H

#define CW_H


#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include


#include "customer.h"

#include "supplier.h"

#include "product.h"

#include "supplys.h"

#include "eshop.h"

#include "shop.h"

#include "admin.h"

namespace Ui {

class cw;

}


class cw : public QDialog {

Q_OBJECT

public:

cw(QWidget *parent = 0);

~cw();


protected:

void changeEvent(QEvent *e);


private:


Ui::cw *ui;


private slots:

void on_eshopPushButton_clicked();

void on_shopPushButton_clicked();

void on_adminPushButton_clicked();

void on_productPushButton_clicked();

void on_supplierPushButton_clicked();

void on_customerPushButton_clicked();

void on_quitPushButton_clicked();

void on_salePushButton_clicked();

void on_supplyPushButton_clicked();


};


#endif // CW_H


#ifndef employs_H

#define employs_H


#include "cw.h"

#include

#include

#include


namespace Ui {

class employs;

}


class employs : public QDialog {

Q_OBJECT

public:

employs(QWidget *parent = 0);

~employs();


protected:

void changeEvent(QEvent *e);


private:

Ui::employs *ui;

QSqlTableModel *model;

QPrinter _printer;

QSqlDatabase db2;


private:

QString tableViewToHtml();

QString htmlAlign( int a );


private slots:

void on_previewPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();

void on_newPushButton_clicked();


public:

QPrinter *printer();


private slots:

void submitAll();

void print();

void insert(QSqlDatabase db);

void remove();

void preview();

void pPreview(QPrinter *p);


};


#endif // employs_H


#ifndef ESHOP_H

#define ESHOP_H


#include

#include "cw.h"

namespace Ui {

class eshop;

}


class eshop : public QDialog {

Q_OBJECT

public:

eshop(QDialog *parent = 0);

~eshop();


protected:

void changeEvent(QEvent *e);

void save(QString login, QString pass);

protected slots:

void on_buyPushButton_clicked();

void on_quitPushButton_clicked();

void on_newPushButton_clicked();

void preview();

void pPreview(QPrinter *p);

private:

Ui::eshop *ui;

QSqlDatabase db;

QPrinter _printer;

QDate data_postavki;


public:

QPrinter *printer();


private:

QString tableViewToHtml();

QString htmlAlign( int a );

};


#endif // ESHOP_H


#ifndef GETDATE_H

#define GETDATE_H


#include

#include "QDate"


namespace Ui {

class getdate;

}


class getdate : public QDialog {

Q_OBJECT

public:

getdate(QWidget *parent = 0);

~getdate();

QDate getDateText();


protected:

void changeEvent(QEvent *e);


private slots:

void on_okPushButton_clicked();


private:

Ui::getdate *ui;

};


#endif // GETDATE_H


#ifndef ICUSTOMER_H

#define ICUSTOMER_H


#include

#include

#include

#include "QDate"

namespace Ui {

class icustomer;

}


class icustomer : public QDialog {

Q_OBJECT

public:

icustomer(QWidget *parent = 0);

~icustomer();


protected:

void changeEvent(QEvent *e);


public:


QString getNameText();

QString getAddressText();

QString getPhoneText();

QDate getDateText();

bool emptyField( QLineEdit *le, QString name);

bool noNum(QLineEdit *le, QString name );

bool noChar(QLineEdit *le, QString name );


private:

Ui::icustomer *m_ui;


private slots:

bool on_okPushButton_clicked();

void on_quitPushButton_clicked();

};


#endif // ICUSTOMER_H


#ifndef iemploys_H

#define iemploys_H


#include

#include

#include

#include "cw.h"

namespace Ui {

class iemploys;

}


class iemploys : public QDialog {

Q_OBJECT

public:

iemploys(QWidget *parent = 0);

~iemploys();


protected:

void changeEvent(QEvent *e);


public:


QString getNameText();

QString getAddressText();

QString getPhoneText();

QDate getDateText();

QString getEmployText();

bool emptyField( QLineEdit *le, QString name);

bool noNum(QLineEdit *le, QString name );

bool noChar(QLineEdit *le, QString name );


private:

Ui::iemploys *m_ui;

QSqlQueryModel *supModel;


private slots:

bool on_okPushButton_clicked();

void on_quitPushButton_clicked();

};


#endif // iemploys_H


#ifndef IPRODUCT_H

#define IPRODUCT_H


#include


namespace Ui {

class iproduct;

}


class iproduct : public QDialog {

Q_OBJECT

public:

iproduct(QWidget *parent = 0);

~iproduct();


protected:

void changeEvent(QEvent *e);


private:

Ui::iproduct *m_ui;


public:

QString getNameText();


private slots:

void on_okPushButton_clicked();

void on_quitPushButton_clicked();

};


#endif // IPRODUCT_H


#ifndef ISUPPLIER_H

#define ISUPPLIER_H


#include


namespace Ui {

class isupplier;

}


class isupplier : public QDialog {

Q_OBJECT

public:

isupplier(QWidget *parent = 0);

~isupplier();


protected:

void changeEvent(QEvent *e);


public:


QString getNameText();

QString getAddressText();

QString getPhoneText();

QString getFaxText();

bool emptyField( QLineEdit *le, QString name);

bool noNum(QLineEdit *le, QString name );

bool noChar(QLineEdit *le, QString name );


private:

Ui::isupplier *m_ui;


private slots:

bool on_okPushButton_clicked();

void on_quitPushButton_clicked();

};


#endif // ISUPPLIER_H


#ifndef NEWACC_H

#define NEWACC_H


#include

#include

#include

#include "cw.h"

namespace Ui {

class newAcc;

}


class newAcc : public QDialog {

Q_OBJECT

public:

newAcc(QWidget *parent = 0);

~newAcc();

bool emptyField( QLineEdit *le, QString name);

bool noNum(QLineEdit *le, QString name );

bool noChar(QLineEdit *le, QString name );


protected:

void changeEvent(QEvent *e);

protected slots:

void on_quitPushButton_clicked();

void on_okPushButton_clicked();

private:

Ui::newAcc *ui;

QSqlDatabase db;

};


#endif // NEWACC_H


#ifndef poolback_H

#define poolback_H


#include "cw.h"

#include "sproduct.h"

#include "iproduct.h"

#include "poolback.h"


namespace Ui {

class poolback;

}


class poolback : public QDialog {

Q_OBJECT

public:

poolback(QWidget *parent = 0);

~poolback();


protected:

void changeEvent(QEvent *e);


private:

Ui::poolback *ui;

QSqlTableModel *model;

QSqlTableModel *model2;

QSqlQueryModel *supModel;

QSqlQueryModel *prodModel;

QSqlQueryModel *markamodel;


private slots:

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();


};


#endif // poolback_H


#ifndef PRODUCT_H

#define PRODUCT_H


#include "cw.h"

#include "sproduct.h"

#include "iproduct.h"

#include "seproduct.h"


namespace Ui {

class product;

}


class product : public QDialog {

Q_OBJECT

public:

product(QWidget *parent = 0);

~product();


protected:

void changeEvent(QEvent *e);


private:

Ui::product *ui;

QSqlTableModel *model;

QPrinter _printer;

QSqlDatabase db2;


private:

QString tableViewToHtml();

QString htmlAlign( int a );


private slots:

void on_suppliedProductionPushButton_clicked();

void on_sellingProductionPushButton_clicked();

/* void on_suppliedProductionPushButton_clicked(); */

void on_previewPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();


private slots:

void submitAll();

void print();

void insert();

void remove();

void preview();

void pPreview(QPrinter *p);


};


#endif // PRODUCT_H


#ifndef raspisanie_H

#define raspisanie_H


#include "cw.h"

#include

#include

#include


namespace Ui {

class raspisanie;

}


class raspisanie : public QDialog {

Q_OBJECT

public:

raspisanie(QWidget *parent = 0);

~raspisanie();


protected:

void changeEvent(QEvent *e);


private:

Ui::raspisanie *ui;

QSqlTableModel *model;

QPrinter _printer;


private:

QString tableViewToHtml();

QString htmlAlign( int a );


private slots:

void on_previewPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();


private slots:

void submitAll();

void check(QSqlDatabase db);

void print();

void insert();

void remove();

void preview();

void pPreview(QPrinter *p);


};


#endif // raspisanie_H


#ifndef seproduct_H

#define seproduct_H


#include "cw.h"

#include "sproduct.h"

#include "iproduct.h"

#include "seproduct.h"


namespace Ui {

class seproduct;

}


class seproduct : public QDialog {

Q_OBJECT

public:

seproduct(QWidget *parent = 0);

~seproduct();


protected:

void changeEvent(QEvent *e);


private:

Ui::seproduct *ui;

QSqlTableModel *model;

QSqlTableModel *model2;

QSqlQueryModel *supModel;

QSqlQueryModel *prodModel;

QSqlQueryModel *searchmodel;

QPrinter _printer;


private:

QString tableViewToHtml();

QString htmlAlign( int a );

public:

int a;


private slots:

void on_searchPushButton_clicked();

void on_confirmPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();

int confirm();


private slots:

void submitAll();

void print();

void insert();

void remove();

void preview();

void pPreview(QPrinter *p);

void update();


};


#endif // seproduct_H


#ifndef SHOP_H

#define SHOP_H


#include

#include "cw.h"


namespace Ui {

class shop;

}


class shop : public QDialog {

Q_OBJECT

public:

shop(QDialog *parent = 0);

~shop();


protected:

void changeEvent(QEvent *e);


private:

Ui::shop *ui;

QSqlDatabase db;


protected slots:

void on_buyPushButton_clicked();

void on_quitPushButton_clicked();

void on_nbuyPushButton_clicked();

void on_backPushButton_clicked();

void insert();

};


#endif // SHOP_H


#ifndef SPRODUCT_H

#define SPRODUCT_H


#include "cw.h"

namespace Ui {

class sproduct;

}


class sproduct : public QDialog {

Q_OBJECT

public:

sproduct(QWidget *parent = 0);

~sproduct();


protected:

void changeEvent(QEvent *e);


private:

Ui::sproduct *m_ui;

QSqlTableModel *model;

QSqlQueryModel *supModel;

QSqlQueryModel *prodModel;

QSqlDatabase db;


public:

QPrinter *printer();


private slots:

void on_pushButton_clicked();

void on_quitPushButton_clicked();

void update();

// void on_addPushButton_clicked();

// void preview();

// void pPreview(QPrinter *p);


private:

// QString tableViewToHtml();

// QString htmlAlign( int a );

};


#endif // SPRODUCT_H


#ifndef supplier_H

#define supplier_H


#include "cw.h"

#include

#include

#include


namespace Ui {

class supplier;

}


class supplier : public QDialog {

Q_OBJECT

public:

supplier(QWidget *parent = 0);

~supplier();


protected:

void changeEvent(QEvent *e);


private:

Ui::supplier *ui;

QSqlTableModel *model;

QPrinter _printer;


private:

QString tableViewToHtml();

QString htmlAlign( int a );


private slots:

void on_previewPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();


private slots:

void submitAll();

void print();

void insert();

void remove();

void preview();

void pPreview(QPrinter *p);


};


#endif // supplier_H


#ifndef supplys_H

#define supplys_H


#include "cw.h"

#include

#include

#include


namespace Ui {

class supplys;

}


class supplys : public QDialog {

Q_OBJECT

public:

supplys(QWidget *parent = 0);

~supplys();


protected:

void changeEvent(QEvent *e);


private:

Ui::supplys *ui;

QSqlTableModel *model;

QPrinter _printer;


private:

QString tableViewToHtml();

QString htmlAlign( int a );


private slots:

void on_previewPushButton_clicked();

void on_removePushButton_clicked();

void on_insertPushButton_clicked();

void on_printPushButton_clicked();

void on_updatePushButton_clicked();

void on_quitPushButton_clicked();


public:

QPrinter *printer();


private slots:

void submitAll();

void print();

void insert();

void remove();

void preview();

void pPreview(QPrinter *p);


};


#endif // supplys_H


#include "admin.h"

#include "ui_admin.h"


admin::admin(QWidget *parent) :

QDialog(parent),

ui(new Ui::admin)

{

ui->setupUi(this);

}


admin::~admin()

{

delete ui;

}


void admin::changeEvent(QEvent *e)

{

QDialog::changeEvent(e);

switch (e->type()) {

case QEvent::LanguageChange:

ui->retranslateUi(this);

break;

default:

break;

}

}


void admin::on_quitPushButton_clicked()

{

close();


}


void admin::on_customerPushButton_clicked()

{

customer customer;

customer.setWindowTitle(trUtf8("Доставки"));

customer.exec();

}


void admin::on_supplierPushButton_clicked()

{

supplier supplier;

supplier.setWindowTitle(trUtf8("Наши поставщики"));

supplier.exec();

}


void admin::on_supplyPushButton_clicked()

{

supplys supplys;

supplys.setWindowTitle(trUtf8("Предстоящие поставки"));

supplys.exec();

}


void admin::on_productPushButton_clicked()

{

product product;

product.setWindowTitle(trUtf8("Нашы товары"));

product.exec();

}

void admin::on_employsPushButton_clicked()

{

employs employs;

employs.setWindowTitle(trUtf8("Нашы сотрудники"));

employs.exec();

}

void admin::on_raspPushButton_clicked()

{

raspisanie raspisanie;

raspisanie.setWindowTitle(trUtf8("Расписание"));

raspisanie.exec();

}


#include "admin.h"

#include "ui_admin.h"


admin::admin(QWidget *parent) :

QDialog(parent),

ui(new Ui::admin)

{

ui->setupUi(this);

}


admin::~admin()

{

delete ui;

}


void admin::changeEvent(QEvent *e)

{

QDialog::changeEvent(e);

switch (e->type()) {

case QEvent::LanguageChange:

ui->retranslateUi(this);

break;

default:

break;

}

}


void admin::on_quitPushButton_clicked()

{

close();


}


void admin::on_customerPushButton_clicked()

{

customer customer;

customer.setWindowTitle(trUtf8("Доставки"));

customer.exec();

}


void admin::on_supplierPushButton_clicked()

{

supplier supplier;

supplier.setWindowTitle(trUtf8("Наши поставщики"));

supplier.exec();

}


void admin::on_supplyPushButton_clicked()

{

supplys supplys;

supplys.setWindowTitle(trUtf8("Предстоящие поставки"));

supplys.exec();

}


void admin::on_productPushButton_clicked()

{

product product;

product.setWindowTitle(trUtf8("Нашы товары"));

product.exec();

}

void admin::on_employsPushButton_clicked()

{

employs employs;

employs.setWindowTitle(trUtf8("Нашы сотрудники"));

employs.exec();

}

void admin::on_raspPushButton_clicked()

{

raspisanie raspisanie;

raspisanie.setWindowTitle(trUtf8("Расписание"));

raspisanie.exec();

}


#include "cw.h"

#include "ui_cw.h"

#include


cw::cw(QWidget *parent) :

QDialog(parent),

ui(new Ui::cw)


{

QSqlDatabase _db = QSqlDatabase::addDatabase("QIBASE",

"connection");

_db.setConnectOptions("CHARSET=UTF8");

_db.setHostName("localhost");

_db.setDatabaseName("C:\\Users\\user\\Desktop\\KURSOVIK_DB.GDB");

_db.setUserName("SYSDBA");

_db.setPassword("masterkey");

// _db.setPort(3306);

if (!_db.open())

{

QString error = _db.lastError().text();

QMessageBox::critical( this, "IBase error", error);

}


else ui->setupUi(this);

}


cw::~cw()

{

delete ui;

}


void cw::changeEvent(QEvent *e)

{

QDialog::changeEvent(e);

switch (e->type()) {

case QEvent::LanguageChange:

ui->retranslateUi(this);

break;

default:

break;

}

}


void cw::on_quitPushButton_clicked()

{

close();

}


void cw::on_customerPushButton_clicked()

{

customer customer;

customer.setWindowTitle(tr("Our Customers"));

customer.exec();

}


void cw::on_supplierPushButton_clicked()

{

supplier supplier;

supplier.setWindowTitle(tr("Our Suppliers"));

supplier.exec();

}


void cw::on_salePushButton_clicked()

{

supplys supplys;

supplys.setWindowTitle(tr("Our Suppliers"));

supplys.exec();

}


void cw::on_supplyPushButton_clicked()

{

supplys supplys;

supplys.setWindowTitle(trUtf8("Предстоящие поставки"));

supplys.exec();

}


void cw::on_productPushButton_clicked()

{

product product;

product.setWindowTitle(tr("Our Production"));

product.exec();

}


void cw::on_eshopPushButton_clicked()

{

eshop eshop;

eshop.setWindowTitle((trUtf8("Электронная версия")));

eshop.exec();


}


void cw::on_shopPushButton_clicked()

{

shop shop;

shop.setWindowTitle(trUtf8("Магазин"));

shop.exec();

}


void cw::on_adminPushButton_clicked()

{

admin admin;

admin.setWindowTitle(trUtf8("Администратору"));

admin.exec();

}


#include "employs.h"

#include "ui_employs.h"

#include "cw.h"

#include "iemploys.h"

#include

#include

#include

#include

#include

#include "QInputDialog"


employs::employs(QWidget *parent) :

QDialog(parent),

ui(new Ui::employs)

{

ui->setupUi(this);

// Creating a model

QSqlDatabase db = QSqlDatabase::database("connection",1);

model = new QSqlTableModel(this, db);

model->setTable("SOTRUDNIKI_TABLE1");

model->setEditStrategy(QSqlTableModel::OnManualSubmit);


model->setHeaderData(1, Qt::Horizontal, QObject::trUtf8("Ф.И.О сотрудника"));

model->setHeaderData(2, Qt::Horizontal, QString::fromUtf8("Должность"));

model->setHeaderData(3, Qt::Horizontal, QObject::trUtf8("Дата рождения"));

model->setHeaderData(4, Qt::Horizontal, QObject::trUtf8("Домашний адрес"));

model->setHeaderData(5, Qt::Horizontal, QObject::trUtf8("Контактный телефон"));


model->select();

// Creating a view

ui->tableView->setModel(model);

ui->tableView->setSortingEnabled(true);

ui->tableView->hideColumn(0);

ui->tableView->resizeColumnsToContents();

}


employs::~employs()

{

delete ui;

}


void employs::changeEvent(QEvent *e)

{

QDialog::changeEvent(e);

switch (e->type()) {

case QEvent::LanguageChange:

ui->retranslateUi(this);

break;

default:

break;

}

}


void employs::on_quitPushButton_clicked()

{

close();

}


void employs::submitAll()

{

if ( ! model->submitAll() )

{

QMessageBox::critical(this,tr("Error"),

tr("Can't submit data: ") + model->lastError().text() );

}

}


void employs::on_updatePushButton_clicked()

{

submitAll();

}


void employs::on_printPushButton_clicked()

{

print();

}


void employs::insert(QSqlDatabase db)

{

iemploys iemploys;

iemploys.setWindowTitle(trUtf8("Новый сотрудник"));

int res = iemploys.exec();

if ( res != QDialog::Accepted ) return;

QSqlRecord rec = model->record();


rec.setValue(1, iemploys.getNameText());


rec.setValue(2, iemploys.getEmployText());


rec.setValue(3, iemploys.getDateText());


rec.setValue(4, iemploys.getAddressText());


rec.setValue(5, iemploys.getPhoneText());


rec.setValue(0, model->rowCount()+1);


model->insertRecord(model->rowCount(), rec);

submitAll();

QString empty="0";

QString str = "INSERT INTO Raspisanie_TABLE "

"VALUES ('" + iemploys.getNameText() + "' ," + "'"+ iemploys.getEmployText() + "' ," + ""

"'" + empty + "' ," + "'" + empty + "' ," + "'" + empty + "' ," + "'" + empty + ""

"'," + "'"+ empty + "' ," + "'"+ empty + "' ," + "'" + empty + "')";

QSqlQuery query(str, db);

qDebug()<

}

void employs::on_insertPushButton_clicked()

{

QSqlDatabase db = QSqlDatabase::database("connection",1);

insert(db);

}

void employs::on_newPushButton_clicked()

{

bool ok;

QString text = QInputDialog::getText(this, trUtf8("Новая Должность"),

trUtf8("Должность:"), QLineEdit::Normal,

QDir::home().dirName(), &ok);

if (ok && !text.isEmpty())

{

db2 = QSqlDatabase::database("connection",1);

QString string = "SELECT MAX(DOLGNOST_ID) "

^ "FROM DOLGNOST_TABLE ";

QSqlQuery q(string, db2);

q.exec(string);

QSqlQueryModel m;

m.setQuery(q);

int ID = m.index(0,0).data(Qt::DisplayRole).toInt();

qDebug() << "ID" << ID;

QString id;

id = id.setNum(ID+1);

QString str = "INSERT INTO DOLGNOST_TABLE "

"VALUES ('" + id + "' ," + "'"+ text + "' ," + "'10000');";


qDebug()<
QSqlQuery query(str, db2);

//query.exec();

qDebug() << query.lastError();

}

}

void employs::remove()

{

int row;

QItemSelectionModel *selectModel;

QModelIndexList indexes;

QModelIndex index;


// Узнаем выделенную строку

selectModel = ui->tableView->selectionModel();

indexes = selectModel->selectedIndexes();

foreach(index, indexes)

{

QString str;

row = index.row();

if (!model->removeRows(row,1))

{

qDebug() << str << "\n";

break;

}

else

{

ui->tableView->setRowHidden(row, true);

}

}


}

void employs::on_removePushButton_clicked()

{

remove();

}


void employs::preview()

{

QPrintPreviewDialog preview( printer(), this );

connect(&preview, SIGNAL(paintRequested(QPrinter *)), this, SLOT(pPreview(QPrinter *)));

preview.resize(640, 480);

preview.exec();


}


QString employs::tableViewToHtml()

{

int firstRow = 0;

int lastRow = ui->tableView->model()->rowCount();

int firstColumn = 0;

int lastColumn = ui->tableView->model()->columnCount();


bool selectionOnly = ui->tableView->selectionModel()->hasSelection();

if ( selectionOnly )

{

firstRow = -1;

lastRow = -1;

firstColumn = -1;

lastColumn = -1;

QModelIndexList indexList = ui->tableView->selectionModel()->selection().indexes();

foreach( QModelIndex index, indexList )



lastRow = lastRow +1;

lastColumn = lastColumn +1;


}


QString title = tr("Our employss:");

QDateTime dt;

QString time = dt.currentDateTime().toString();

QString value;

QString string;

QString employs =

""

"^ " + time + " " +title + ""

""

"
"width='98%' cellspacing='0' cellpadding='1'>";


employs += "";


// head


for (int head = firstColumn; head != lastColumn; head++)

{

value += "
if ( ui->tableView->isColumnHidden(head) == true) continue;


QString al = ui->tableView->model()->headerData(head, Qt::Horizontal,

Qt::TextAlignmentRole).toString();

if (al != "") value += " align=" + al;


QString bgc = ui->tableView->model()->headerData(head, Qt::Horizontal,

Qt::BackgroundRole).toString();

if (bgc != "") value += " bgcolor=" + bgc;


value += ">";


QString tc = ui->tableView->model()->headerData(head, Qt::Horizontal,

Qt::ForegroundRole).toString();

if (tc != "") value += "";


value += ui->tableView->model()->headerData(head, Qt::Horizontal,

Qt::DisplayRole).toString();


if (tc != "") value += "";

value += "";


}


employs += value;


//strings


employs += "
";


for (int row = firstRow; row != lastRow; ++row)

{

string += "";

QString cell;

for (int col = firstColumn; col != lastColumn; ++col)

{

if ( ui->tableView->isColumnHidden(col) == true) continue;

cell += "";

}


string += cell;

string += "\n";

}


employs += string;


employs += "


int a = ui->tableView->model()->index(row, col).

data(Qt::TextAlignmentRole).toInt();

cell += htmlAlign(a);


QString bgc = ui->tableView->model()->index(row, col).

data(Qt::BackgroundRole).toString();

if (bgc != "") cell += " bgcolor=" + bgc;


cell += ">";


QString tc = ui->tableView->model()->index(row, col).

data(Qt::ForegroundRole).toString();

if (tc != "") cell += "";


QString d = ui->tableView->model()->index(row, col).

data(Qt::DisplayRole).toString();

cell += d;


if (tc != "") cell += "";


cell += "
"

"

514-grafik-samostoyatelnoj-raboti-studenta-uchebno-metodicheskij-kompleks-disciplini-150204-osnovi-professionalno-proizvodstvennoj.html
514-ovoshnie-kulturi-otchet-o-nir-po-dogovoru-27-ot-06-05-2010-razrabotka-proekta-regionalnoj-ekonomicheski.html
514-rinki-finansovih-uslug-doklad-o-sostoyanii-konkurencii-v-rossijskoj-federacii.html
5141-testi-k-zanyatiyu-1-metodicheskie-rekomendacii-k-izucheniyu-disciplini-i-k-organizacii-samostoyatelnoj-raboti.html
515-ekspluataciya-vozdushnih-kompressorov-pravila-bezopasnosti-dlya-obektov-ispolzuyushih-szhizhennie-uglevodorodnie.html
515-otzivi-potrebitelej-specialistov-otchyot-o-rezultatah-samoobsledovaniya-gou-spo-kolledzha-industrii-gostepriimstva.html
  • uchitel.bystrickaya.ru/razdel3ocenka-stoimosti-predpriyatiya-v-konkretnih-celyah-uchebno-metodicheskij-kompleks-dlya-studentov-vseh-form.html
  • shkola.bystrickaya.ru/stoyanka-xxv-maks-fraj-zhalobnaya-kniga.html
  • laboratory.bystrickaya.ru/vegetarianstvo-chast-6.html
  • teacher.bystrickaya.ru/glava-8-trasti-kontrol-za-sootvetstviem-dejstvij-upravlyayushej-kompanii-pravilam-paevogo-fonda-i-trebovaniyam-zakonodatelstva.html
  • institute.bystrickaya.ru/glava-9-svoboda-bit-svobodnim-igra-v-poddavki-aleksandr-mitich.html
  • college.bystrickaya.ru/2organizaciya-buhgalterskogo-ucheta-i-dokumentooborota-ezhekvartalnijotche-t-emitenta-emissionnih-cennih-bumag.html
  • student.bystrickaya.ru/124-ponizhennie-tarifi-strahovih-vznosov-dlya-inih-kategorij-strahovatelej.html
  • testyi.bystrickaya.ru/84-zadacha-na-samostoyatelnoe-reshenie-uchebnoe-posobie-rpk-politehnik-volgograd.html
  • esse.bystrickaya.ru/prostranstvo-kak-kompozicionnij-faktor-o-ponyatii-kompozicii.html
  • knowledge.bystrickaya.ru/mezh-dunaem-i-dnestrom.html
  • pisat.bystrickaya.ru/uchastniki-konkursa-fotografij-nominaciya-moya-skazka.html
  • spur.bystrickaya.ru/konkurentosposobnost-vedushih-kompanij-na-mirovom-rinke-aviauslug.html
  • esse.bystrickaya.ru/razrabotka-elektromashinnogo-ceha-elektrovozoremontnogo-depo-poyasnitelnaya-zapiska-190303-54-pd-00-pz-oboznachenie-dokumenta-razrabotal.html
  • knigi.bystrickaya.ru/spektr-m-novinki-i-luchshie-sorta-otechestvennoj-i-zarubezhnoj-selekcii-rekomenduemie-v-tatarstane-ih-sozdatelyami-selekcioneram-stranica-4.html
  • urok.bystrickaya.ru/programma-disciplini-bankovskij-menedzhment-dlya-specialnosti-080105-65-finansi-i-kredit-po-specializacii-banki-i-bankovskaya-deyatelnost-avtor-programmi.html
  • notebook.bystrickaya.ru/gosudarstvennij-obrazovatelnij-standart-visshego-professionalnogo-obrazovaniya-napravlenie-552900.html
  • letter.bystrickaya.ru/obshij-uhod-za-bolnimi-osnovnie-lechebno-diagnosticheskie-proceduri-stranica-16.html
  • reading.bystrickaya.ru/konstantin-kalbazov-stranica-19.html
  • teacher.bystrickaya.ru/gibkie-i-proizvodstvennie-sistemi-sborki-i-montazha-elektronnih-modulej-1-go-urovnya-razkrupneniya-mea.html
  • college.bystrickaya.ru/1-tau-ken-adaalau-blmn-bas-mamani-s-o-5-1-brlk.html
  • lesson.bystrickaya.ru/nuzhni-li-rossii-specialisti-po-public-relations.html
  • klass.bystrickaya.ru/administraciya-municipalnogo-obrazovaniya-priozerskij-municipalnij-rajon-leningradskoj-oblasti-postanovleni-e-stranica-6.html
  • uchit.bystrickaya.ru/tkan-kosmosa-prostranstvo-vremya-i-struktura-realnosti-stranica-22.html
  • college.bystrickaya.ru/1-soderzhanie-predprinimatelskoj-deyatelnosti-3.html
  • books.bystrickaya.ru/dmitrij-gluhovskij-metro-2034.html
  • paragraph.bystrickaya.ru/matematika-visshaya-matematika-linejnaya-algebra-i-analiticheskaya-geometriya.html
  • books.bystrickaya.ru/doklad-na-temu-sovremennie-podhodi-k-organizacii-samostoyatelnoj-raboti-studentov-samostoyatelnaya-rabota-eto-planiruemaya-rabota-studentov.html
  • studies.bystrickaya.ru/etiketka-i-upakovka.html
  • klass.bystrickaya.ru/aktualnie-voprosi-organizacii.html
  • turn.bystrickaya.ru/plan-uroka-organizacionnij-moment-1-2min.html
  • uchit.bystrickaya.ru/statya-166-poryadok-ischisleniya-naloga-zakon-ot-05-08-2000-117-fz-nalogovij-kodeks-rossijskoj-federacii-chast.html
  • predmet.bystrickaya.ru/sluchajnie-lyudi-v-sps-ne-prihodyat-pervij-kanal-novosti-ekonomiki-18-05-2005-6-41-00-15.html
  • thescience.bystrickaya.ru/instrukciya-uchastnikam-razmesheniya-zakaza-3-13-stranica-10.html
  • spur.bystrickaya.ru/kvalifikacionnie-testi-po-detskoj-hirurgii-vtoraya-kategoriya-moskva-2010g.html
  • tetrad.bystrickaya.ru/vi4-imya-sobstvennoe-i-normi-ego-upotrebleniya-m-ya-dimarskij-vi-9-kand-filol-nauk.html
  • © bystrickaya.ru
    Мобильный рефератник - для мобильных людей.