00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LABORSELECT_H
00025 #define LABORSELECT_H
00026
00027 # include <QDialog>
00028 # include "QcjData/QcjDataStatics.h"
00029 # include "QcjData/QcjDataConfigure.h"
00030 # include "ui_laborselect.h"
00031
00032 class LaborSelect : public QDialog
00033 {
00034 Q_OBJECT
00035
00036 public:
00037 LaborSelect(int wo, QWidget *parent = 0) : QDialog(parent)
00038 {
00039 printf("LaborSelect::LaborSelect(): Enter\n");
00040 fflush(stdout);
00041 ui.setupUi(this);
00042 workorder = wo;
00043 printf("LaborSelect::LaborSelect(): Exit\n");
00044 fflush(stdout);
00045 };
00046
00047 void setDatabase()
00048 {
00049 printf("LaborSelect::setDatabase(): Enter\n");
00050 fflush(stdout);
00051 ui.laborForm->setDatabase();
00052 ui.laborTable->setDatabase();
00053 ui.partsForm->setDatabase();
00054 ui.partsTable->setDatabase();
00055 ui.jobSelectTable->setDatabase();
00056
00057 connect(ui.addJobBtn, SIGNAL(clicked()), this, SLOT(haveAddJobBtn()));
00058 connect(ui.delJobBtn, SIGNAL(clicked()), this, SLOT(haveDelJobBtn()));
00059 # if 0
00060 connect(ui.savePartBtn, SIGNAL(clicked()), this, SLOT(haveSavePartBtn()));
00061 connect(ui.delPartBtn, SIGNAL(clicked()), this, SLOT(haveDelPartBtn()));
00062 # endif
00063
00064 connect(ui.laborTable, SIGNAL(rowSelected(QSqlRecord*)), this, SLOT(haveLaborRecord(QSqlRecord*)));
00065 connect(ui.jobSelectTable, SIGNAL(rowActivated(QSqlRecord*)), this, SLOT(haveJobRecord(QSqlRecord*)));
00066
00067 QString filter = "workorder = '" + QString::number(workorder) + "' and job > 0";
00068 printf("LaborSelect::setDatabase(): setting filter: |%s|\n", qPrintable(filter));
00069 fflush(stdout);
00070 ui.laborTable->setFilter(filter);
00071 ui.laborTable->refresh();
00072
00073 ui.partsTable->setFilter(filter);
00074 ui.partsTable->refresh();
00075
00076 ui.jobSelectTable->refresh();
00077
00078 ui.laborTable->selectRow(0);
00079 printf("LaborSelect::setDatabase(): Exit\n");
00080 fflush(stdout);
00081 };
00082
00083 protected slots:
00084 void haveAddJobBtn();
00085 void haveDelJobBtn();
00086 void haveSavePartBtn();
00087 void haveDelPartBtn();
00088 void haveLaborRecord(QSqlRecord*);
00089 void haveJobRecord(QSqlRecord*);
00090
00091 private:
00092 int workorder;
00093 Ui::LaborSelect ui;
00094 };
00095
00096 #endif
00097
00098
00099