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 WOPARTENTRY_H
00025 #define WOPARTENTRY_H
00026
00027 # include <QDialog>
00028 # include "QcjData/QcjDataStatics.h"
00029 # include "QcjData/QcjDataConfigure.h"
00030 # include "ui_wopartentry.h"
00031
00032 class WoPartEntry : public QDialog
00033 {
00034 Q_OBJECT
00035
00036 public:
00037 WoPartEntry(int wo, QWidget *parent = 0) : QDialog(parent)
00038 {
00039 printf("WoPartEntry::WoPartEntry(): Enter\n");
00040 fflush(stdout);
00041 ui.setupUi(this);
00042 workorder = wo;
00043 connect(ui.newPartBtn, SIGNAL(clicked()), this, SLOT(haveNewRequest()));
00044 printf("WoPartEntry::WoPartEntry(): Exit\n");
00045 fflush(stdout);
00046 };
00047
00048 void setDatabase()
00049 {
00050 ui.woPartsForm->setDatabase();
00051 ui.woPartsTable->setDatabase();
00052 QString filter = "workorder = " + QString::number(workorder);
00053 ui.woPartsTable->setFilter(filter);
00054 ui.woPartsTable->refresh();
00055 ui.woPartsTable->seek(0);
00056 connect(ui.lookupPartBtn, SIGNAL(clicked()), this, SLOT(haveLookupPartBtn()));
00057 };
00058
00059 public slots:
00060 void haveNewRequest()
00061 {
00062 QMap<QString, QString> fields;
00063 fields.insert("workorder", QString::number(workorder));
00064 ui.woPartsForm->insertRecord(fields);
00065 fields.clear();
00066 QString xmldef = ui.woPartsForm->readXmlDef();
00067 QString index = pFormDef->getIndexField(xmldef);
00068 QString index_value = ui.woPartsForm->getFieldText(index);
00069 fields.insert(index, index_value);
00070 ui.woPartsTable->refresh();
00071 ui.woPartsTable->findRow(fields);
00072 };
00073
00074 protected slots:
00075 void haveLookupPartBtn();
00076
00077 private:
00078 int workorder;
00079 Ui::WoPartEntry ui;
00080 };
00081
00082 #endif
00083
00084