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 WOLABORENTRY_H
00025 #define WOLABORENTRY_H
00026
00027 # include <QDialog>
00028 # include "QcjData/QcjDataStatics.h"
00029 # include "QcjData/QcjDataConfigure.h"
00030 # include "laborselect.h"
00031 # include "ui_wolaborentry.h"
00032
00033 class WoLaborEntry : public QDialog
00034 {
00035 Q_OBJECT
00036
00037 public:
00038 WoLaborEntry(int wo, QWidget *parent = 0) : QDialog(parent)
00039 {
00040 printf("WoLaborEntry::WoLaborEntry(): Enter\n");
00041 fflush(stdout);
00042 ui.setupUi(this);
00043 workorder = wo;
00044 connect(ui.newLaborBtn, SIGNAL(clicked()), this, SLOT(haveNewRequest()));
00045 connect(ui.lookupLaborBtn, SIGNAL(clicked()), this, SLOT(haveLookupLaborBtn()));
00046 printf("WoLaborEntry::WoLaborEntry(): Exit\n");
00047 fflush(stdout);
00048 };
00049
00050 void setDatabase()
00051 {
00052 ui.woLaborForm->setDatabase();
00053 ui.woLaborTable->setDatabase();
00054 QString filter = "workorder = " + QString::number(workorder) +
00055 " and descr != '--DO_NOT_DELETE--'";
00056 ui.woLaborTable->setFilter(filter);
00057 ui.woLaborTable->seek(0);
00058 };
00059
00060 public slots:
00061 void haveNewRequest()
00062 {
00063 QMap<QString, QString> fields;
00064 fields.insert("workorder", QString::number(workorder));
00065 ui.woLaborForm->insertRecord(fields);
00066 fields.clear();
00067 QString xmldef = ui.woLaborForm->readXmlDef();
00068 QString index = pFormDef->getIndexField(xmldef);
00069 QString index_value = ui.woLaborForm->getFieldText(index);
00070 fields.insert(index, index_value);
00071 ui.woLaborTable->refresh();
00072 ui.woLaborTable->findRow(fields);
00073 };
00074
00075 void haveLookupLaborBtn()
00076 {
00077 printf("WoLaborEntry::haveLookupLaborBtn(): Enter\n");
00078 fflush(stdout);
00079 LaborSelect dlg(workorder, this);
00080 dlg.setDatabase();
00081 dlg.exec();
00082 ui.woLaborTable->refresh();
00083 printf("WoLaborEntry::haveLookupLaborBtn(): Exit\n");
00084 fflush(stdout);
00085 };
00086
00087 private:
00088 int workorder;
00089 Ui::WoLaborEntry ui;
00090 };
00091
00092 #endif
00093