wolaborentry.h

00001 /*********************************************************************************
00002 **
00003 **   $Id: //depot/WorkInProgress/ah2/AcctSelect.h#1 $
00004 **   Copyright (c) 2004 Joe Croft <joe@croftj.net>
00005 **   
00006 **   This file is part of ah3.
00007 **
00008 **   ah3 is free software; you can redistribute it and/or modify
00009 **   it under the terms of the GNU General Public License as published by
00010 **   the Free Software Foundation; either version 2 of the License, or
00011 **   (at your option) any later version.
00012 **
00013 **   Foobar is distributed in the hope that it will be useful,
00014 **   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 **   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 **   GNU General Public License for more details.
00017 **
00018 **   You should have received a copy of the GNU General Public License
00019 **   along with Foobar; if not, write to the Free Software
00020 **   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 

Generated on Tue Sep 11 07:00:01 2007 for Ah3 Invoicing and Inventory System for Repair Shops by  doxygen 1.5.0