//slots void manager_menu::on_show_humans_button_clicked() { QString qtext("SELECT first_name as \"Ім’я\",last_name as \"Фамілія\",patronymic as \"По-батькові\",tel_num as \"Номер телефона\",passport as \"Номер паспорта\",code as \"Ідентифікаційний код\" FROM people_workers"); QSqlQuery query(qtext); QSqlQueryModel* model = new QSqlQueryModel(); model->setQuery(query); emit open_main_window(model); this->hide(); }
void manager_menu::on_show_personel_button_clicked() { QString qtext("SELECT first_name||' '||last_name||' '||patronymic||' - '||passport as \"Людина\", position_name as \"Назва посади\", incentive as \"Надбавка\", p.start_date as \"Дата початку роботи\", p.end_date as \"Дата закінчення роботи\" FROM personnel p join administrating_positions ap on p.id_administrating_position=ap.id_administrating_position join people_workers pw on p.id_human=pw.id_human join positions pos on ap.id_position=pos.id_position order by position_name asc,p.start_date desc"); QSqlQuery query(qtext); QSqlQueryModel* model = new QSqlQueryModel(); model->setQuery(query); emit open_main_window(model); this->hide(); }
void manager_menu::on_show_administrating_positions_button_clicked() { QString qtext("SELECT position_name as \"Назва посади\",salary as \"Зарплата\",position_quantity as \"Кількість місць\",start_date as \"Дата початку\",end_date as \"Дата закінчення\" FROM administrating_positions a join positions p on a.id_position=p.id_position order by position_name, start_date desc"); QSqlQuery query(qtext); QSqlQueryModel* model = new QSqlQueryModel(); model->setQuery(query); emit open_main_window(model); this->hide(); }
void manager_menu::on_show_positions_button_clicked() { QString qtext("SELECT position_name as \"Назва посади\",subject_name as \"Назва предмета\" FROM positions p join subjects s on p.id_subject=s.id_subject order by position_name"); QSqlQuery query(qtext); QSqlQueryModel* model = new QSqlQueryModel(); model->setQuery(query); emit open_main_window(model); this->hide(); }
void manager_menu::on_show_subjects_button_clicked() { QString qtext("SELECT subject_name as \"Назва предмета\",hours_quantity as \"Кількість годин\",study_programe as \"Програма навчання\" FROM subjects order by subject_name"); QSqlQuery query(qtext); QSqlQueryModel* model = new QSqlQueryModel(); model->setQuery(query); emit open_main_window(model); this->hide(); }
QStringList qnamelist (const RefAdaAST& n) { QString txt = qtext (n); // kdDebug() << "qnamelist: input is " << txt << endl; return QStringList::split ('.', txt); }
int parse_it(char *words[], char input[]) { int i, state, thisword; input[strlen(input) + 1] = 0; /* double-null */ for (state = OUTWORD, thisword = i = 0; input[i]; i++) { switch (state) { case INWORD: { if (isspace(input[i])) { input[i] = 0; state = OUTWORD; } break; } case OUTWORD: { if (input[i] == QUOTE || input[i] == QUOTE2) { state = INQUOTES; } else if (!isspace(input[i])) { state = INWORD; } /* if we are now in a string, setup, otherwise, break */ if (state != OUTWORD) { if (thisword >= MXWORD) { return (thisword); } if (state == INWORD) { words[thisword++] = (input + i); } else { words[thisword++] = (input + i + 1); } } break; } case INQUOTES: { i += qtext(input + i, input + i, input[i - 1]); state = OUTWORD; break; } } } return (thisword); }
manager_menu::manager_menu(QWidget *parent, QString db_login) : menu_base(parent), ui(new Ui::manager_menu) { ui->setupUi(this); n_human_picker = new new_human_picker(); a_new_subject = new add_new_subject(); a_new_job = new add_new_job(); ch_job = new change_job(); ad_positions = new administrate_position(); exp_position = new expire_position(); ass_human_to_position = new assign_human_to_position(); exp_human_on_position = new expire_human_on_position(); learn_man_menu = new learning_manager_menu(); //connects connect(n_human_picker,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(a_new_subject,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(a_new_job,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(ch_job,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(ad_positions,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(exp_position,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(ass_human_to_position,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(exp_human_on_position,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(learn_man_menu,SIGNAL(restore_main_menu()),this,SLOT(restore_menu())); connect(this,SIGNAL(show_add_new_job_dialog()),a_new_job,SLOT(show_add_new_job_dialog())); connect(this,SIGNAL(show_change_job_dialog()),ch_job,SLOT(show_change_job_dialog())); connect(this,SIGNAL(show_administrating_positions_dialog()),ad_positions,SLOT(show_administrating_positions_dialog())); connect(this,SIGNAL(show_expire_position_dialog()),exp_position,SLOT(show_expire_position_dialog())); connect(this,SIGNAL(show_assign_human_to_position_dialog()),ass_human_to_position,SLOT(show_assign_human_to_position_dialog())); connect(this,SIGNAL(show_expire_human_on_position_dialog()),exp_human_on_position,SLOT(show_expire_human_on_position_dialog())); //Get the staff id if(db_login.length()) { QString qtext("SELECT sl.id_human, fio(last_name, first_name, patronymic) AS fio " "FROM staff_logins sl " "LEFT JOIN people_workers p ON sl.id_human=p.id_human " "WHERE sl.db_login =?;"); QSqlQuery query; query.prepare(qtext); query.addBindValue(db_login); query.exec(); if (query.lastError().type()!=QSqlError::NoError){ QMessageBox msg; qDebug() << query.lastError().text(); msg.setText(query.lastError().text()); msg.exec(); return; } if(query.next()) { staff_id = query.value(0).toInt(); QString fio = query.value(1).toString(); this->setWindowTitle(fio); } query.finish(); } else { staff_id=0; } }