Пример #1
0
vendorWorkBench::vendorWorkBench(QWidget* parent, const char *name, Qt::WFlags fl)
    : XWidget (parent, name, fl)
{
  setupUi(this);

  QWidget *hideme = 0;

  if (_privileges->check("ViewPurchaseOrders"))
  {
    _po = new dspPOsByVendor(this, "dspPOsByVendor", Qt::Widget);
    _poTab->layout()->addWidget(_po);
    _po->setCloseVisible(false);
    hideme = _po->findChild<QWidget*>("_vendGroup");
    hideme->hide();
    VendorGroup *povend = _po->findChild<VendorGroup*>("_vend");
    if (povend)
    {
      povend->setState(VendorGroup::Selected);
      connect(povend, SIGNAL(newVendId(int)), _po,    SLOT(sFillList()));
      connect(_vend,      SIGNAL(newId(int)), povend, SLOT(setVendId(int)));
    }
    _po->show();
  }
  else
    _tabWidget->setTabEnabled(_tabWidget->indexOf(_poTab), false);

  if (_privileges->check("ViewPurchaseOrders"))
  {
    _receipts = new dspPoItemReceivingsByVendor(this, "dspPoItemReceivingsByVendor", Qt::Widget);
    _receiptsTab->layout()->addWidget(_receipts);
    _receipts->setCloseVisible(false);
    QWidget *rcptvend = _receipts->findChild<QWidget*>("_vendorGroup");
    rcptvend->hide();
    connect(rcptvend,    SIGNAL(newId(int)), _receipts,     SLOT(sFillList()));
    connect(_vend,       SIGNAL(newId(int)), rcptvend,      SLOT(setId(int)));
  }
  else
    _tabWidget->setTabEnabled(_tabWidget->indexOf(_receiptsTab), false);

  if (_privileges->check("MaintainPayments"))
  {
    _payables = new selectPayments(this, "selectPayments", Qt::Widget);
    _payablesTab->layout()->addWidget(_payables);
    hideme = _payables->findChild<QWidget*>("_close");
    hideme->hide();
    VendorGroup *payvend = _payables->findChild<VendorGroup*>("_vendorgroup");
    payvend->setState(VendorGroup::Selected);
    payvend->hide();
    connect(payvend, SIGNAL(newVendId(int)), _payables,     SLOT(sFillList()));
    connect(_vend,       SIGNAL(newId(int)), payvend,       SLOT(setVendId(int)));
  }
  else
    _tabWidget->setTabEnabled(_tabWidget->indexOf(_payablesTab), false);

  if (_privileges->check("MaintainAPMemos") ||
      _privileges->check("ViewAPMemos"))
  {
    _credits = new unappliedAPCreditMemos(this, "unappliedAPCreditMemos", Qt::Widget);
    _cmTab->layout()->addWidget(_credits);
    hideme = _credits->findChild<QWidget*>("_close");
    hideme->hide();
    VendorGroup *cmvend = _credits->findChild<VendorGroup*>("_vendorgroup");
    cmvend->setState(VendorGroup::Selected);
    cmvend->hide();
    connect(cmvend,  SIGNAL(newVendId(int)), _credits,      SLOT(sFillList()));
    connect(_vend,       SIGNAL(newId(int)), cmvend,        SLOT(setVendId(int)));
  }
  else
    _tabWidget->setTabEnabled(_tabWidget->indexOf(_cmTab), false);

  if (_privileges->check("MaintainPayments"))
  {
    _checks = new dspCheckRegister(this, "dspCheckRegister", Qt::Widget);
    _checksTab->layout()->addWidget(_checks);
    _checks->findChild<QWidget*>("_close")->hide();
    _checks->findChild<QGroupBox*>("_recipGroup")->setChecked(true);
    _checks->findChild<QGroupBox*>("_recipGroup")->hide();
    _checks->findChild<DateCluster*>("_dates")->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
    _checks->findChild<DateCluster*>("_dates")->setEndNull(tr("Latest"),	  omfgThis->endOfTime(),   TRUE);
    VendorCluster *checkvend = _checks->findChild<VendorCluster*>("_vend");
    connect(checkvend,   SIGNAL(newId(int)), _checks,       SLOT(sFillList()));
    connect(_vend,       SIGNAL(newId(int)), checkvend,     SLOT(setId(int)));
  }
  else
    _tabWidget->setTabEnabled(_tabWidget->indexOf(_checksTab), false);
  
  if (_privileges->check("ViewAPOpenItems"))
  {
    _history = new dspVendorAPHistory(this, "dspVendorAPHistory", Qt::Widget);
    _historyTab->layout()->addWidget(_history);
    _history->setCloseVisible(false);
    _history->findChild<QWidget*>("_vendGroup")->hide();
    _history->findChild<DateCluster*>("_dates")->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
    _history->findChild<DateCluster*>("_dates")->setEndNull(tr("Latest"),	  omfgThis->endOfTime(),   TRUE);
    VendorCluster *histvend = _history->findChild<VendorCluster*>("_vend");
    connect(histvend,    SIGNAL(newId(int)), _history,      SLOT(sFillList()));
    connect(_vend,       SIGNAL(newId(int)), histvend,      SLOT(setId(int)));
  }
  else
    _tabWidget->setTabEnabled(_tabWidget->indexOf(_historyTab), false);

  connect(_crmacct,     SIGNAL(clicked()), this,          SLOT(sCRMAccount()));
  connect(_edit,        SIGNAL(clicked()), this,          SLOT(sVendor()));
  connect(_print,       SIGNAL(clicked()), this,          SLOT(sPrint()));
  connect(_vend,       SIGNAL(newId(int)), this,          SLOT(sPopulate()));
  connect(_contact1Button, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_contact2Button, SIGNAL(clicked()), this, SLOT(sHandleButtons()));

  _edit->setText(_privileges->check("MaintainVendors") ? tr("Edit") : tr("View"));

  _backlog->setPrecision(omfgThis->moneyVal());
  _lastYearsPurchases->setPrecision(omfgThis->moneyVal());
  _ytdPurchases->setPrecision(omfgThis->moneyVal());
  _openBalance->setPrecision(omfgThis->moneyVal());

  clear();
}
Пример #2
0
employee::employee(QWidget* parent, const char * name, Qt::WindowFlags fl)
    : XDialog(parent, name, fl)
{
  setupUi(this);

  connect(_attachGroup,   SIGNAL(clicked()), this, SLOT(sAttachGroup()));
  connect(_code,		  SIGNAL(editingFinished()), this, SLOT(sHandleButtons()));
  connect(_deleteCharass, SIGNAL(clicked()), this, SLOT(sDeleteCharass()));
  connect(_detachGroup,   SIGNAL(clicked()), this, SLOT(sDetachGroup()));
  connect(_editCharass,   SIGNAL(clicked()), this, SLOT(sEditCharass()));
  connect(_editGroup,     SIGNAL(clicked()), this, SLOT(sEditGroup()));
  connect(_newCharass,    SIGNAL(clicked()), this, SLOT(sNewCharass()));
  connect(_salesrepButton,SIGNAL(clicked()), this, SLOT(sSalesrep()));
  connect(_vendorButton,  SIGNAL(clicked()), this, SLOT(sVendor()));
  connect(_save,          SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_userButton,    SIGNAL(clicked()), this, SLOT(sUser()));
  connect(_viewGroup,     SIGNAL(clicked()), this, SLOT(sViewGroup()));

  XSqlQuery xtmfg;                                                                        
  xtmfg.exec("SELECT pkghead_name FROM pkghead WHERE pkghead_name='xtmfg'");              
  if (xtmfg.first())                                                                      
  {                                                                                       
    _shift->setEnabled(true);                                                             
    _shift->setVisible(true);                                                             
    shiftLit->setVisible(true);                                                           
  } else {                                                                                
    _shift->setEnabled(false);                                                            
    _shift->setVisible(false);                                                            
    shiftLit->setVisible(false);                                                          
  }

  _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name");
  _charass->addColumn(tr("Value"),          -1,          Qt::AlignLeft, true, "charass_value");

  _groups->addColumn(tr("Name"), _itemColumn, Qt::AlignLeft, true, "empgrp_name");
  _groups->addColumn(tr("Description"),   -1, Qt::AlignLeft, true, "empgrp_descrip");

  q.prepare("SELECT curr_abbr FROM curr_symbol WHERE (curr_id=baseCurrId());");
  q.exec();
  if (q.first())
    _currabbr = q.value("curr_abbr").toString();
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  _createUsers = false;
  q.exec("SELECT userCanCreateUsers(CURRENT_USER) AS enabled;");
  if (q.first())
    _createUsers = q.value("enabled").toBool();
  else if (q.lastError().type() != QSqlError::NoError)
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);

  if (_privileges->check("MaintainSalesReps") ||
      _privileges->check("ViewSalesReps"))
    connect(_salesrep, SIGNAL(toggled(bool)), _salesrepButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainVendors") ||
      _privileges->check("ViewVendors"))
    connect(_vendor, SIGNAL(toggled(bool)), _vendorButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainUsers"))
    connect(_user, SIGNAL(toggled(bool)), _userButton, SLOT(setEnabled(bool)));

  _per->setAllowNull(false);
  _per->append(0, tr("Hour"),      "Hour");
  _per->append(1, tr("Day"),       "Day");
  _per->append(2, tr("Week"),      "Week");
  _per->append(3, tr("Bi-Weekly"), "Biweek");
  _per->append(4, tr("Year"),      "Year");

  _per->setAllowNull(false);
  _perExt->append(0, tr("Hour"),      "Hour");
  _perExt->append(1, tr("Day"),       "Day");
  _perExt->append(2, tr("Week"),      "Week");
  _perExt->append(3, tr("Bi-Weekly"), "Biweek");
  _perExt->append(4, tr("Year"),      "Year");

  _comments->setId(-1);
  _comments->setReadOnly(true);

  _empid = -1;
  _mode = cView;
  _origmode = cView;
}
Пример #3
0
employee::employee(QWidget* parent, const char * name, Qt::WindowFlags fl)
    : XDialog(parent, name, fl)
{
  setupUi(this);

  connect(_attachGroup,   SIGNAL(clicked()), this, SLOT(sAttachGroup()));
  connect(_code,  SIGNAL(editingFinished()), this, SLOT(sHandleButtons()));
  connect(_deleteCharass, SIGNAL(clicked()), this, SLOT(sDeleteCharass()));
  connect(_detachGroup,   SIGNAL(clicked()), this, SLOT(sDetachGroup()));
  connect(_editCharass,   SIGNAL(clicked()), this, SLOT(sEditCharass()));
  connect(_editGroup,     SIGNAL(clicked()), this, SLOT(sEditGroup()));
  connect(_newCharass,    SIGNAL(clicked()), this, SLOT(sNewCharass()));
  connect(_salesrepButton,SIGNAL(clicked()), this, SLOT(sSalesrep()));
  connect(_vendorButton,  SIGNAL(clicked()), this, SLOT(sVendor()));
  connect(_save,          SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_userButton,    SIGNAL(clicked()), this, SLOT(sUser()));
  connect(_viewGroup,     SIGNAL(clicked()), this, SLOT(sViewGroup()));

  XSqlQuery xtmfg;
  xtmfg.exec("SELECT pkghead_name FROM pkghead WHERE pkghead_name='xtmfg'");
  if (xtmfg.first())
  {
    _shift->setEnabled(true);
    _shift->setVisible(true);
    shiftLit->setVisible(true);
  } else {
    _shift->setEnabled(false);
    _shift->setVisible(false);
    shiftLit->setVisible(false);
  }

  _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name");
  _charass->addColumn(tr("Value"),          -1,          Qt::AlignLeft, true, "charass_value");

  _groups->addColumn(tr("Name"), _itemColumn, Qt::AlignLeft, true, "empgrp_name");
  _groups->addColumn(tr("Description"),   -1, Qt::AlignLeft, true, "empgrp_descrip");

  if (_privileges->check("MaintainSalesReps") ||
      _privileges->check("ViewSalesReps"))
    connect(_salesrep, SIGNAL(toggled(bool)), _salesrepButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainVendors") ||
      _privileges->check("ViewVendors"))
    connect(_vendor, SIGNAL(toggled(bool)), _vendorButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainUsers"))
    connect(_user, SIGNAL(toggled(bool)), _userButton, SLOT(setEnabled(bool)));

  _wagetype->setAllowNull(false);
  _wagetype->append(0, tr("Hourly"),      "H");
  _wagetype->append(1, tr("Salaried"),    "S");

  _per->setAllowNull(false);
  _per->append(0, tr("Hour"),      "H");
  _per->append(1, tr("Day"),       "D");
  _per->append(2, tr("Week"),      "W");
  _per->append(3, tr("Bi-Weekly"), "BW");
  _per->append(4, tr("Month"),     "M");
  _per->append(5, tr("Year"),      "Y");

  _per->setAllowNull(false);
  _perExt->append(0, tr("Hour"),      "H");
  _perExt->append(1, tr("Day"),       "D");
  _perExt->append(2, tr("Week"),      "W");
  _perExt->append(3, tr("Bi-Weekly"), "BW");
  _perExt->append(4, tr("Month"),     "M");
  _perExt->append(4, tr("Year"),      "Y");

  _comments->setId(-1);
  _comments->setReadOnly(true);

  _createUsers= false;
  _crmacctid  = -1;
  _empid      = -1;
  _salesrepid = -1;
  _username   = "";
  _vendid     = -1;
  _NumberGen  = -1;
  _mode     = cView;
  _origmode = cView;
}