laborselect.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 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 

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