コード例 #1
0
vendor::vendor(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_printAddresses, SIGNAL(clicked()), this, SLOT(sPrintAddresses()));
  connect(_newAddress, SIGNAL(clicked()), this, SLOT(sNewAddress()));
  connect(_editAddress, SIGNAL(clicked()), this, SLOT(sEditAddress()));
  connect(_viewAddress, SIGNAL(clicked()), this, SLOT(sViewAddress()));
  connect(_deleteAddress, SIGNAL(clicked()), this, SLOT(sDeleteAddress()));
  connect(_deleteTaxreg, SIGNAL(clicked()), this, SLOT(sDeleteTaxreg()));
  connect(_editTaxreg,   SIGNAL(clicked()), this, SLOT(sEditTaxreg()));
  connect(_newTaxreg,    SIGNAL(clicked()), this, SLOT(sNewTaxreg()));
  connect(_viewTaxreg,   SIGNAL(clicked()), this, SLOT(sViewTaxreg()));
  connect(_next, SIGNAL(clicked()), this, SLOT(sNext()));
  connect(_previous, SIGNAL(clicked()), this, SLOT(sPrevious()));
  connect(_mainButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_altButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));

  _defaultCurr->setLabel(_defaultCurrLit);
  _routingNumber->setValidator(new QIntValidator(100000000, 999999999, this));
  _achAccountNumber->setValidator(new QRegExpValidator(QRegExp("^\\d{4,17}$"), this));

  _vendaddr->addColumn(tr("Number"), 70, Qt::AlignLeft, true, "vendaddr_code");
  _vendaddr->addColumn(tr("Name"),   50, Qt::AlignLeft, true, "vendaddr_name");
  _vendaddr->addColumn(tr("City"),   -1, Qt::AlignLeft, true, "vendaddr_city");
  _vendaddr->addColumn(tr("State"),  -1, Qt::AlignLeft, true, "vendaddr_state");
  _vendaddr->addColumn(tr("Country"),-1, Qt::AlignLeft, true, "vendaddr_country");
  _vendaddr->addColumn(tr("Postal Code"),-1, Qt::AlignLeft, true, "vendaddr_zipcode");

  _taxreg->addColumn(tr("Tax Authority"), 100, Qt::AlignLeft, true, "taxauth_code");
  _taxreg->addColumn(tr("Registration #"), -1, Qt::AlignLeft, true, "taxreg_number");

  _crmacctid = -1;
  _ignoreClose = false;
  _NumberGen = -1;
  
  if (_metrics->boolean("EnableBatchManager") &&
      ! _metrics->boolean("ACHEnabled"))
    _transmitTabGroup->removeTab(_transmitTabGroup->indexOf(_checksTab));
  else if (! _metrics->boolean("EnableBatchManager") &&
           _metrics->boolean("ACHEnabled"))
    _purchaseOrderTab->setVisible(false);
  else if (! _metrics->boolean("EnableBatchManager") &&
           ! _metrics->boolean("ACHEnabled"))
    ediTab->setVisible(false);
  // else defaults are OK

  if (_metrics->boolean("ACHEnabled") && omfgThis->_key.isEmpty())
    _checksTab->setEnabled(false);
}
コード例 #2
0
dspWoScheduleByParameterList::dspWoScheduleByParameterList(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_wo, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*, QTreeWidgetItem*)));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_autoUpdate, SIGNAL(toggled(bool)), this, SLOT(sHandleAutoUpdate(bool)));
  connect(_postProduction, SIGNAL(clicked()), this, SLOT(sPostProduction()));
  connect(_printTraveler, SIGNAL(clicked()), this, SLOT(sPrintTraveler()));
  connect(_wo, SIGNAL(itemSelectionChanged()), this, SLOT(sHandleButtons()));

  _dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);

  _wo->addColumn(tr("parentType"),  0,             Qt::AlignCenter, true,  "wo_ordtype" );
  _wo->addColumn(tr("W/O #"),       _orderColumn,  Qt::AlignLeft,   true,  "wonumber"   );
  _wo->addColumn(tr("Status"),      _statusColumn, Qt::AlignCenter, true,  "wo_status" );
  _wo->addColumn(tr("Pri."),        _statusColumn, Qt::AlignCenter, false,  "wo_priority" );
  _wo->addColumn(tr("Site"),        _whsColumn,    Qt::AlignCenter, true,  "warehous_code" );
  _wo->addColumn(tr("Item Number"), _itemColumn,   Qt::AlignLeft,   true,  "item_number"   );
  _wo->addColumn(tr("Description"), -1,            Qt::AlignLeft,   true,  "itemdescrip"   );
  _wo->addColumn(tr("UOM"),         _uomColumn,    Qt::AlignCenter, true,  "uom_name" );
  _wo->addColumn(tr("Ordered"),     _qtyColumn,    Qt::AlignRight,  true,  "wo_qtyord"  );
  _wo->addColumn(tr("Received"),    _qtyColumn,    Qt::AlignRight,  true,  "wo_qtyrcv"  );
  _wo->addColumn(tr("Start Date"),  _dateColumn,   Qt::AlignRight,  true,  "wo_startdate"  );
  _wo->addColumn(tr("Due Date"),    _dateColumn,   Qt::AlignRight,  true,  "wo_duedate"  );
  _wo->addColumn(tr("Condition"),   _dateColumn,   Qt::AlignLeft,   true,  "condition"   );

  connect(omfgThis, SIGNAL(workOrdersUpdated(int, bool)), this, SLOT(sFillList()));
 
  sHandleAutoUpdate(_autoUpdate->isChecked());
}
コード例 #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(_save,          SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_userButton,    SIGNAL(clicked()), this, SLOT(sUser()));
  connect(_viewGroup,     SIGNAL(clicked()), this, SLOT(sViewGroup()));

  _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("MaintainUsers"))
    connect(_user, SIGNAL(toggled(bool)), _userButton, SLOT(setEnabled(bool)));

  _per->append(-1,   "",           "");
  _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");

  _comments->setId(-1);

  _empid = -1;
  _mode = cView;
  _origmode = cView;
}
コード例 #4
0
printQuote::printQuote(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_number, SIGNAL(lostFocus()), this, SLOT(sHandleButtons()));
  connect(_print,    SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_report,  SIGNAL(newID(int)), this, SLOT(sHandleButtons()));

  _cust->setFocus();

  _captive  = false;
  _quheadid = -1; // TODO: replace with a QuoteCluster
}
コード例 #5
0
ファイル: shipOrder.cpp プロジェクト: Fortyseven/qt-client
shipOrder::shipOrder(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_create,   SIGNAL(toggled(bool)), this, SLOT(sCreateToggled(bool)));
  connect(_select,   SIGNAL(toggled(bool)), this, SLOT(sSelectToggled(bool)));
  connect(_ship,     SIGNAL(clicked()),     this, SLOT(sShip()));
  connect(_shipment, SIGNAL(newId(int)),    this, SLOT(sFillList()));
  connect(_shipment, SIGNAL(newId(int)),    this, SLOT(sFillTracknum()));
  connect(_order,    SIGNAL(newId(int,QString)),    this, SLOT(sHandleOrder()));
  connect(_warehouse,SIGNAL(newID(int)),            this, SLOT(sHandleOrder()));
  connect(_tracknum, SIGNAL(activated(const QString&)), this, SLOT(sFillFreight()));
  connect(_tracknum, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(sFillFreight()));
  connect(_tracknum, SIGNAL(highlighted(const QString&)), this, SLOT(sFillFreight()));

  _captive = FALSE;

  _coitem->addColumn( tr("#"),           _whsColumn,  Qt::AlignCenter , true, "linenumber");
  _coitem->addColumn( tr("Item Number"), _itemColumn, Qt::AlignLeft   , true, "item_number");
  _coitem->addColumn( tr("Description"), -1,          Qt::AlignLeft   , true, "itemdescrip");
  _coitem->addColumn( tr("UOM"),         _uomColumn,  Qt::AlignCenter , true, "uom_name");
  _coitem->addColumn( tr("Qty."),        _qtyColumn,  Qt::AlignRight  , true, "shipitem_qty");

  sCreateToggled(_create->isChecked());
  sHandleButtons();
  _reject = false;

  if (!_metrics->boolean("MultiWhs"))
  {
    _warehouseLit->hide();
    _warehouse->hide();
  }
  
  _order->setAllowedStatuses(OrderLineEdit::Open);
  _order->setAllowedTypes(OrderLineEdit::Sales |
                          OrderLineEdit::Transfer);
  _order->setFromSitePrivsEnforced(TRUE);
  _order->setFocus();

  _transDate->setEnabled(_privileges->check("AlterTransactionDates"));
  _transDate->setDate(omfgThis->dbDate(), true);

  _shipValue->setPrecision(omfgThis->moneyVal());
  _shipValue->setDouble(0);
}
コード例 #6
0
void dspWoScheduleByParameterList::sFillList()
{
  XSqlQuery wosched;
  MetaSQLQuery mql = mqlLoad("workOrderSchedule", "parameterlist");
  ParameterList params;
  if (! setParams(params))
    return;
  wosched = mql.toQuery(params);
  _wo->populate(wosched, true);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  sHandleButtons();
}
コード例 #7
0
void printQuote::sHandleNewQuoteId()
{
  setId(_quote->id());
  if (_quote->isValid())
  {
    ParameterList params;
    params.append("docid", _quote->id());
    MetaSQLQuery mql(_docinfoQueryString);
    XSqlQuery    qry = mql.toQuery(params);
    if (qry.first())
      _report->setCode(qry.value("reportname").toString());
    else if (ErrorReporter::error(QtCriticalMsg, this, tr("Getting Quote Form"),
                                  qry, __FILE__, __LINE__))
      return;
  }
  sHandleButtons();
}
コード例 #8
0
ファイル: docAttach.cpp プロジェクト: dwatson78/qt-client
docAttach::docAttach(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
  : QDialog(parent, fl)
{
  setupUi(this);
  setObjectName(name ? name : "docAttach");
  setModal(modal);

  _p = new docAttachPrivate(this);

  _save = _buttonBox->button(QDialogButtonBox::Save);
  _save->setEnabled(false);
  connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  connect(_docType,   SIGNAL(newID(int)), this, SLOT(sHandleButtons()));
  connect(_filetitle,   SIGNAL(textChanged(QString)), this, SLOT(sHandleButtons()));
  connect(_fileList,  SIGNAL(clicked()),  this, SLOT(sFileList()));
  connect(_save,      SIGNAL(clicked()),  this, SLOT(sSave()));

  _sourcetype = "";
  _sourceid = -1;
  _targetid = -1;
  _urlid = -1;
  _mode = "new";

  _po->setAllowedTypes(OrderLineEdit::Purchase);
  _so->setAllowedTypes(OrderLineEdit::Sales);

  _docType->populate("SELECT * FROM"
                     "(SELECT source_docass_num, source_descrip, source_name"
                     "  FROM source"
                     " WHERE source_widget != ''"
                     " UNION SELECT -2, 'File',     'FILE'"
                     " UNION SELECT -3, 'Web Site', 'URL') data"
                     " ORDER BY source_descrip;");

#ifndef Q_OS_MAC
    _fileList->setMaximumWidth(25);
#else
    _fileList->setMinimumWidth(60);
    _fileList->setMinimumHeight(32);
#endif

    shortcuts::setStandardKeys(this);
    adjustSize();
}
コード例 #9
0
/*
 *  Constructs a financialLayout as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
financialLayout::financialLayout(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
  setupUi(this);

  // signals and slots connections
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_close, SIGNAL(clicked()), this, SLOT(reject()));
  //connect(_editLabels, SIGNAL(clicked()), this, SLOT(sEditLabels()));
  connect(_name, SIGNAL(lostFocus()), this, SLOT(sCheck()));
  connect(_layout, SIGNAL(itemSelectionChanged()), this, SLOT(sHandleButtons()));
  connect(_addTopLevelGroup, SIGNAL(clicked()), this, SLOT(sAddTopLevelGroup()));
  connect(_addGroup, SIGNAL(clicked()), this, SLOT(sAddGroup()));
  connect(_layout, SIGNAL(itemSelected(int)), this, SLOT(sHandleSelection()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_addAccount, SIGNAL(clicked()), this, SLOT(sAddAccount()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_moveUp, SIGNAL(clicked()), this, SLOT(sMoveUp()));
  connect(_moveDown, SIGNAL(clicked()), this, SLOT(sMoveDown()));
  connect(_addSpecial, SIGNAL(clicked()), this, SLOT(sAddSpecial()));
  connect(_income, SIGNAL(clicked()), this, SLOT(sSetType()));
  connect(_balance, SIGNAL(clicked()), this, SLOT(sSetType()));
  connect(_cash, SIGNAL(clicked()), this, SLOT(sSetType()));
  connect(_adHoc, SIGNAL(clicked()), this, SLOT(sSetType()));
  connect(_addCol, SIGNAL(clicked()), this, SLOT(sAddCol()));
  connect(_editCol, SIGNAL(clicked()), this, SLOT(sEditCol()));
  connect(_viewCol, SIGNAL(clicked()), this, SLOT(sEditCol()));
  connect(_deleteCol, SIGNAL(clicked()), this, SLOT(sDeleteCol()));
  connect(_layouts, SIGNAL(itemSelectionChanged()), this, SLOT(sHandleButtonsCol()));
  connect(_layouts, SIGNAL(itemSelected(int)), this, SLOT(sEditCol()));
  connect(_showTotal, SIGNAL(toggled(bool)), this, SLOT(sUncheckAltGrandTotal()));
  connect(_showGrandTotal, SIGNAL(toggled(bool)), this, SLOT(sUncheckAltGrandTotal()));

  _layout->setRootIsDecorated(TRUE);
  _layout->addColumn( tr("Group/Account Name"), -1, Qt::AlignLeft   );

  _layouts->addColumn( tr("Name"), _itemColumn, Qt::AlignLeft   );
  _layouts->addColumn( tr("Description"),  -1, Qt::AlignLeft );
  
  _cachedType=cIncome;

}
コード例 #10
0
void createFiscalYear::sHandleChoice(int selection)
{
  QWidget *page = NULL;
  XTreeWidgetItem *lastFY = _fy->topLevelItem(0);
  bool fyExists = (lastFY != NULL);
  bool fyIsCurrent = fyExists
                  && lastFY->rawValue("start").toDate() <= QDate::currentDate()
                  && lastFY->rawValue("end").toDate()   >= QDate::currentDate();

  _fy->setEnabled(hasPriv(cEdit));
  _period->setEnabled(hasPriv(cEdit));

  _period->setVisible(fyIsCurrent);
  _noFYLit->setVisible(! fyIsCurrent);

  _fy->setVisible(fyExists);
  _noFYToCopyLit->setVisible(! fyExists);

  _save->setText(saveButtonText);

  if (! hasPriv())
    page = _noPrivPage;
  else
    switch (selection) {
      case 1:
        page = _newPeriodPage;
        break;
      case 2:
        page = _newFYPage;
        break;
      case 3:
        page = _copyFYPage;
        _save->setText(tr("Copy Fiscal Year"));
        break;
      default:
        qWarning() << "Probable bug at" << __FILE__ << __LINE__ << ":" << selection;
    }
  if (page)
  {
    _stack->setCurrentWidget(page);
  }
  sHandleButtons();
}
コード例 #11
0
/*
 *  Constructs a dspWoScheduleByParameterList as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
dspWoScheduleByParameterList::dspWoScheduleByParameterList(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
  setupUi(this);

  (void)statusBar();

  // signals and slots connections
  connect(_wo, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*, QTreeWidgetItem*)));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_autoUpdate, SIGNAL(toggled(bool)), this, SLOT(sHandleAutoUpdate(bool)));
  connect(_postProduction, SIGNAL(clicked()), this, SLOT(sPostProduction()));
  connect(_postOperations, SIGNAL(clicked()), this, SLOT(sPostOperations()));
  connect(_printTraveler, SIGNAL(clicked()), this, SLOT(sPrintTraveler()));
  connect(_wo, SIGNAL(itemSelectionChanged()), this, SLOT(sHandleButtons()));

  _dates->setStartCaption(tr("Start W/O Start Date:"));
  _dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);
  _dates->setEndCaption(tr("End W/O Start Date:"));

  _wo->addColumn(tr("parentType"),  0,             Qt::AlignCenter );
  _wo->addColumn(tr("W/O #"),       _orderColumn,  Qt::AlignLeft   );
  _wo->addColumn(tr("Status"),      _statusColumn, Qt::AlignCenter );
  _wo->addColumn(tr("Pri."),        _statusColumn, Qt::AlignCenter );
  _wo->addColumn(tr("Whs."),        _whsColumn,    Qt::AlignCenter );
  _wo->addColumn(tr("Item Number"), _itemColumn,   Qt::AlignLeft   );
  _wo->addColumn(tr("Description"), -1,            Qt::AlignLeft   );
  _wo->addColumn(tr("UOM"),         _uomColumn,    Qt::AlignCenter );
  _wo->addColumn(tr("Ordered"),     _qtyColumn,    Qt::AlignRight  );
  _wo->addColumn(tr("Received"),    _qtyColumn,    Qt::AlignRight  );
  _wo->addColumn(tr("Start Date"),  _dateColumn,   Qt::AlignRight  );
  _wo->addColumn(tr("Due Date"),    _dateColumn,   Qt::AlignRight  );
  _wo->addColumn(tr("Condition"),      _dateColumn,   Qt::AlignLeft   );

  connect(omfgThis, SIGNAL(workOrdersUpdated(int, bool)), this, SLOT(sFillList()));
  
  if (!_metrics->boolean("Routings"))
    _postOperations->hide();
}
コード例 #12
0
exportData::exportData(QWidget *parent, const char *name, Qt::WFlags fl)
  : XWidget(parent, name, fl)
{
  setupUi(this);

  _paramedit = new ParameterEdit(this);
  QGridLayout *lyt = qobject_cast<QGridLayout*>(layout());
  if (lyt)
    lyt->addWidget(_paramedit, 4, 0, 1, -1);

  connect(_otherXML,    SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));
  connect(_deleteQuerySet,SIGNAL(clicked()),   this, SLOT(sDeleteQuerySet()));
  connect(_editQuerySet,SIGNAL(clicked()),     this, SLOT(sEditQuerySet()));
  connect(_export,      SIGNAL(clicked()),     this, SLOT(sExport()));
  connect(_exportList,  SIGNAL(newId(int)),    this, SLOT(sHandleButtons()));
  connect(_newQuerySet, SIGNAL(clicked()),     this, SLOT(sNewQuerySet()));
  connect(_qrySetList,  SIGNAL(newId(int)),    this, SLOT(sHandleButtons()));
  connect(_xtupleXML,   SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));

  _exportList->addColumn(tr("Name"),             -1, Qt::AlignLeft, true, "xsltmap_name");
  _exportList->addColumn(tr("Document Type"),    -1, Qt::AlignLeft, true, "xsltmap_doctype");
  _exportList->addColumn(tr("System Identifier"),-1, Qt::AlignLeft, false,"xsltmap_system");
  _exportList->addColumn(tr("Export XSLT File"), -1, Qt::AlignLeft, false,"xsltmap_export");

  _qrySetList->addColumn(tr("Name"),        -1, Qt::AlignLeft, true, "qryhead_name");
  _qrySetList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "qryhead_descrip");

  _exportList->populate("SELECT xsltmap_id, xsltmap_name, xsltmap_doctype,"
                        "       xsltmap_system, xsltmap_export"
                        "  FROM xsltmap"
                        " WHERE (LENGTH(xsltmap_export) > 0)"
                        " ORDER BY xsltmap_name;");
  sFillList();
  sHandleButtons();

  _queryset = new QuerySet(0, Qt::Dialog);
  if (_queryset)
  {
    _queryset->setWindowModality(Qt::WindowModal);
    connect(_queryset, SIGNAL(saved(int)), this, SLOT(sFillList()));
  }
}
コード例 #13
0
/*
 *  Constructs a dspCashReceipts as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
dspCashReceipts::dspCashReceipts(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

//  (void)statusBar();

  // signals and slots connections
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNewCashrcpt()));
  connect(_post, SIGNAL(clicked()), this, SLOT(sPostCashrcpt()));
  connect(_reverse, SIGNAL(clicked()), this, SLOT(sReversePosted()));
  connect(_arapply, SIGNAL(valid(bool)), this, SLOT(sHandleButtons(bool)));
  connect(_arapply, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_applications, SIGNAL(toggled(bool)), _arapply, SLOT(clear()));
  connect(_applications, SIGNAL(toggled(bool)), this, SLOT(sHandleButtons(bool)));

  _dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _dates->setStartDate(QDate().currentDate().addDays(-90));
  _dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);
  
  _arapply->addColumn(tr("Number"),      _orderColumn,    Qt::AlignCenter, true,  "cashrcpt_number" );
  _arapply->addColumn(tr("Source"),      _itemColumn,     Qt::AlignLeft,   true,  "source" );
  _arapply->addColumn(tr("Cust. #"),     _orderColumn,    Qt::AlignCenter, true,  "cust_number" );
  _arapply->addColumn(tr("Customer"),    -1,              Qt::AlignLeft,   true,  "cust_name"   );
  _arapply->addColumn(tr("Posted"),      _ynColumn,       Qt::AlignCenter, true,  "posted" );
  _arapply->addColumn(tr("Voided"),      _ynColumn,       Qt::AlignCenter, true,  "voided" );
  _arapply->addColumn(tr("Date"),        _dateColumn,     Qt::AlignCenter, true,  "postdate" );
  _arapply->addColumn(tr("Apply-To"),    _itemColumn,     Qt::AlignCenter, true,  "target" );
  _arapply->addColumn(tr("Amount"),      _bigMoneyColumn, Qt::AlignRight,  true,  "applied"  );
  _arapply->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignLeft,   true,  "currAbbr"   );
  _arapply->addColumn(tr("Base Amount"), _bigMoneyColumn, Qt::AlignRight,  true,  "base_applied"  );
  
  _upgradeWarn = new XErrorMessage(this);
  
  _new->setEnabled(_privileges->check("MaintainCashReceipts"));
  
  sHandleButtons(false);
}
コード例 #14
0
alarmMaint::alarmMaint(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
  : QDialog(parent, fl)
{
  setupUi(this);

  setObjectName(name ? name : "alarmMaint");
  setModal(modal);

  // signals and slots connections
  connect(_cancel, SIGNAL(clicked()), this, SLOT(reject()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_contactCluster, SIGNAL(newId(int)), this, SLOT(sContactLookup(int)));
  connect(_usernameCluster, SIGNAL(newId(int)), this, SLOT(sUserLookup(int)));

  _mode = cNew;
  _source = Alarms::Uninitialized;
  _sourceid = -1;
  _alarmid = -1;
  XSqlQuery tickle;
  tickle.exec( "SELECT CURRENT_TIME AS dbdate;" );
  if (tickle.first())
  {
    _alarmDate->setDate(tickle.value("dbdate").toDate());
    _alarmTime->setTime(tickle.value("dbdate").toTime());
  }
  
  _eventAlarm->setChecked(_x_preferences && _x_preferences->boolean("AlarmEventDefault"));
  if (_x_metrics)
  {
    if (_x_metrics->boolean("EnableBatchManager"))
      _emailAlarm->setChecked(_x_preferences && _x_preferences->boolean("AlarmEmailDefault"));
    else
    {
      _emailAlarm->hide();
      _emailRecipient->hide();
    }
  }
  _sysmsgAlarm->setChecked(_x_preferences && _x_preferences->boolean("AlarmSysmsgDefault"));

  sHandleButtons();
}
コード例 #15
0
shipOrder::shipOrder(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_create,   SIGNAL(toggled(bool)), this, SLOT(sCreateToggled(bool)));
  connect(_select,   SIGNAL(toggled(bool)), this, SLOT(sSelectToggled(bool)));
  connect(_ship,     SIGNAL(clicked()),     this, SLOT(sShip()));
  connect(_shipment, SIGNAL(newId(int)),    this, SLOT(sFillList()));
  connect(_shipment, SIGNAL(newId(int)),    this, SLOT(sFillTracknum()));
  connect(_soList,   SIGNAL(clicked()),     this, SLOT(sSoList()));
  connect(_soNumber, SIGNAL(newId(int)),    this, SLOT(sHandleSo()));
  connect(_soNumber, SIGNAL(requestList()), this, SLOT(sSoList()));
  connect(_toNumber, SIGNAL(newId(int)),    this, SLOT(sHandleTo()));
  connect(_tracknum, SIGNAL(activated(const QString&)), this, SLOT(sFillFreight()));
  connect(_tracknum, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(sFillFreight()));
  connect(_tracknum, SIGNAL(highlighted(const QString&)), this, SLOT(sFillFreight()));

  _captive = FALSE;

#ifndef Q_WS_MAC
  _soList->setMaximumWidth(25);
#endif
  
  _coitem->addColumn( tr("#"),           _whsColumn,  Qt::AlignCenter );
  _coitem->addColumn( tr("Item Number"), _itemColumn, Qt::AlignLeft   );
  _coitem->addColumn( tr("Description"), -1,          Qt::AlignLeft   );
  _coitem->addColumn( tr("UOM"),         _uomColumn,  Qt::AlignCenter );
  _coitem->addColumn( tr("Qty."),        _qtyColumn,  Qt::AlignRight  );

  _select->setChecked(_privileges->check("SelectBilling") && _metrics->boolean("AutoSelectForBilling"));
  _select->setEnabled(_privileges->check("SelectBilling"));
  _create->setEnabled(_privileges->check("SelectBilling"));

  _toNumber->setVisible(_metrics->boolean("MultiWhs"));

  sCreateToggled(_create->isChecked());
  sHandleButtons();
  _reject = false;
}
コード例 #16
0
dspCheckRegister::dspCheckRegister(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_check, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_vendRB,    SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));
  connect(_taxauthRB, SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));
  connect(_custRB,    SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));

  _bankaccnt->setType(XComboBox::APBankAccounts);

  _check->addColumn(tr("Void"),        _ynColumn,       Qt::AlignCenter, true,  "checkhead_void" );
  _check->addColumn(tr("Misc."),       _ynColumn,       Qt::AlignCenter, true,  "checkhead_misc" );
  _check->addColumn(tr("Prt'd"),       _ynColumn,       Qt::AlignCenter, true,  "checkhead_printed" );
  _check->addColumn(tr("Posted"),      _ynColumn,       Qt::AlignCenter, true,  "checkhead_posted" );
  _check->addColumn(tr("Chk./Vchr."),  _itemColumn,     Qt::AlignCenter, true,  "number" );
  _check->addColumn(tr("Recipient"),   -1,              Qt::AlignLeft,   true,  "description"   );
  _check->addColumn(tr("Check Date") , _dateColumn,     Qt::AlignCenter, true,  "checkdate" );
  _check->addColumn(tr("Amount"),      _moneyColumn,    Qt::AlignRight,  true,  "amount"  );
  _check->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignRight,  true,  "currAbbr"  );
  _check->addColumn(tr("Base Amount"), _bigMoneyColumn, Qt::AlignRight,  true,  "base_amount"  );
  if (_metrics->boolean("ACHSupported") && _metrics->boolean("ACHEnabled"))
    _check->addColumn(tr("EFT Batch"), _orderColumn,    Qt::AlignRight,  true,  "checkhead_ach_batch");

  _check->sortByColumn(4);

  sHandleButtons();
  _recipGroup->setChecked(false);

  _total->setPrecision(omfgThis->moneyVal());
  if (omfgThis->singleCurrency())
  {
    _check->hideColumn("currAbbr");
    _totalCurr->hide();
  }
}
コード例 #17
0
/*
 *  Constructs a dspCheckRegister as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
dspCheckRegister::dspCheckRegister(QWidget* parent, const char* name, Qt::WFlags fl)
    : XMainWindow(parent, name, fl)
{
  setupUi(this);

  (void)statusBar();

  // signals and slots connections
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_check, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_vendRB,    SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));
  connect(_taxauthRB, SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));
  connect(_custRB,    SIGNAL(toggled(bool)), this, SLOT(sHandleButtons()));

  _bankaccnt->setType(XComboBox::APBankAccounts);

  _check->addColumn(tr("Void"),        _ynColumn,    Qt::AlignCenter );
  _check->addColumn(tr("Misc."),       _ynColumn,    Qt::AlignCenter );
  _check->addColumn(tr("Prt'd"),       _ynColumn,    Qt::AlignCenter );
  _check->addColumn(tr("Posted"),      _ynColumn,    Qt::AlignCenter );
  _check->addColumn(tr("Chk./Vchr."),  _itemColumn,  Qt::AlignCenter );
  _check->addColumn(tr("Recipient"),   -1,           Qt::AlignLeft   );
  _check->addColumn(tr("Check Date") , _dateColumn,     Qt::AlignCenter );
  _check->addColumn(tr("Amount"),      _moneyColumn,    Qt::AlignRight  );
  _check->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignRight  );
  _check->sortByColumn(4);

  sHandleButtons();
  _recipGroup->setChecked(false);

  if (omfgThis->singleCurrency())
  {
    _check->hideColumn(8);
    _totalCurr->hide();
  }
}
コード例 #18
0
batchManager::batchManager(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, fl)
{
  setupUi(this);
  if (name)
    setObjectName(name);

  QButtonGroup * buttonGroup = new QButtonGroup(this);
  buttonGroup->addButton(_currentUser);
  buttonGroup->addButton(_allUsers);
  buttonGroup->addButton(_selectedUser);

  connect(_autoUpdate,   SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_batch, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_batch, SIGNAL(itemSelectionChanged()),    this, SLOT(sHandleButtons()));
  connect(_cancel,       SIGNAL(clicked()),          this, SLOT(sCancel()));
  connect(_reschedule,   SIGNAL(clicked()),          this, SLOT(sReschedule()));
  connect(_retry,        SIGNAL(clicked()),          this, SLOT(sRetry()));
  connect(_showCompleted,SIGNAL(toggled(bool)),      this, SLOT(sFillList()));
  connect(_usr,          SIGNAL(newID(int)),         this, SLOT(sFillList()));
  connect(_view,         SIGNAL(clicked()),          this, SLOT(sView()));
  connect(buttonGroup,   SIGNAL(buttonClicked(int)), this, SLOT(sFillList()));

  _db = QSqlDatabase();
  
  _timer = new QTimer(this);

  _batch->addColumn( tr("User"),          _dateColumn, Qt::AlignLeft, true, "batch_user");
  _batch->addColumn( tr("Action"),        _itemColumn, Qt::AlignLeft, true, "batch_action");
  _batch->addColumn( tr("Scheduled"), _timeDateColumn, Qt::AlignLeft, true, "batch_scheduled");
  _batch->addColumn( tr("Run Status"),_timeDateColumn, Qt::AlignLeft, true, "runstatus");
  _batch->addColumn( tr("Completed"), _timeDateColumn, Qt::AlignLeft, true, "batch_completed");
  _batch->addColumn( tr("Exit Status"),            -1, Qt::AlignLeft, true, "exitstatus" );

  setDatabase(_db);
}
コード例 #19
0
createFiscalYear::createFiscalYear(QWidget *parent) :
  XDialog(parent)
{
  setupUi(this);

  saveButtonText = _save->text();

  connect(_cancel,   SIGNAL(clicked(bool)),  SLOT(sCancel()));
  connect(_choose,   SIGNAL(newID(int)),     SLOT(sHandleChoice(int)));
  connect(_fy,       SIGNAL(valid(bool)),    SLOT(sHandleButtons()));
  connect(_firstDay, SIGNAL(newDate(QDate)), SLOT(sHandleButtons()));
  connect(_period,   SIGNAL(updated()),      SLOT(sHandleButtons()));
  connect(_save,     SIGNAL(clicked(bool)),  SLOT(sSave()));
  connect(_style,    SIGNAL(currentIndexChanged(int)), SLOT(sHandleButtons()));

  _choose->append(1, tr("Add a new accounting period"),  "PERIOD");
  _choose->append(2, tr("Add a new Fiscal Year"),        "NEWFY");
  _choose->append(3, tr("Copy an existing Fiscal Year"), "COPYFY");

  _firstDay->setDate(QDate(QDate::currentDate().year(), 1, 1));

  _fy->addColumn(tr("Starting"), -1, Qt::AlignLeft, true, "start");
  _fy->addColumn(tr("Ending"),   -1, Qt::AlignLeft, true, "end");

  XSqlQuery q;

  q.prepare("WITH maxid AS (SELECT * FROM yearperiod"
            "                ORDER BY yearperiod_start DESC LIMIT 1) "
            "SELECT yearperiod_id, 0 AS xtindentrole,"
            "       yearperiod_start AS start, yearperiod_end AS end"
            "  FROM maxid"
            " UNION "
            "SELECT period_yearperiod_id, 1,"
            "       period_start, period_end"
            "  FROM period"
            " WHERE period_yearperiod_id = (SELECT yearperiod_id FROM maxid)"
            " ORDER BY xtindentrole, start;");
  q.exec();
  _fy->populate(q, true);
  if (_fy->topLevelItemCount() < 0)
    _choose->setCode("NEWFY");
  else
    _fy->setCurrentItem(_fy->topLevelItem(0));

  q.prepare("SELECT period_start + interval '1 month' AS start,"
            "       period_end   + interval '1 month' AS end,"
            "       1 AS seq"
            "  FROM period"
            " UNION "
            "SELECT date_trunc('month', current_timestamp),"
            "       date_trunc('month', current_timestamp) + INTERVAL '1 month' - INTERVAL '1 day',"
            "       2 AS seq"
            " ORDER BY seq, start DESC LIMIT 1;");
  q.exec();
  if (q.first())
  {
    _period->setStartDate(q.value("start").toDate().addDays(1));
    _period->setEndDate(q.value("end").toDate());
  }

  _style->append(1, tr("Monthly"),   "M");
  _style->append(2, tr("Quarterly"), "Q");

  sHandleChoice(_choose->id());
}
コード例 #20
0
ファイル: shipOrder.cpp プロジェクト: Fortyseven/qt-client
void shipOrder::sHandleTo()
{
  XSqlQuery shipHandleTo;
  _coitem->clear();
  _shipment->setEnabled(false);
  _shipment->removeOrderLimit();

  sHandleButtons();

  shipHandleTo.prepare("SELECT tohead_freight_curr_id, tohead_destname,"
                       "       tohead_destaddress1,"
                       "       SUM(toitem_freight) + tohead_freight AS freight "
                       "FROM tohead JOIN toitem ON (toitem_tohead_id=tohead_id) "
                       "WHERE ((toitem_status<>'X')"
                       "  AND  (tohead_src_warehous_id=:warehous_id)"
                       "  AND  (tohead_id=:tohead_id)) "
                       "GROUP BY tohead_freight_curr_id, tohead_destname,"
                       "         tohead_destaddress1, tohead_freight;");
  shipHandleTo.bindValue(":tohead_id", _order->id());
  shipHandleTo.bindValue(":warehous_id", _warehouse->id());
  shipHandleTo.exec();
  if (shipHandleTo.first())
  {
    _freight->setId(shipHandleTo.value("tohead_freight_curr_id").toInt());
    _freight->setLocalValue(shipHandleTo.value("freight").toDouble());
    _billToName->setText(tr("Transfer Order"));
    _shipToName->setText(shipHandleTo.value("tohead_destname").toString());
    _shipToAddr1->setText(shipHandleTo.value("tohead_destaddress1").toString());
  }
  else if (shipHandleTo.lastError().type() != QSqlError::NoError)
  {
    systemError(this, shipHandleTo.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  QString sql("SELECT shiphead_id "
              "FROM shiphead "
              "<? if exists(\"shiphead_id\") ?>"
              "WHERE (shiphead_id=<? value(\"shiphead_id\") ?>)"
              "<? else ?>"
              "WHERE (shiphead_number=getOpenShipment('TO', <? value(\"tohead_id\") ?>, <? value(\"warehous_id\") ?>))"
              "<? endif ?>"
              ";" );
  ParameterList params;
  params.append("tohead_id", _order->id());
  params.append("warehous_id", _warehouse->id());
  if (_shipment->isValid())
    params.append("shiphead_id", _shipment->id());
  MetaSQLQuery mql(sql);
  shipHandleTo = mql.toQuery(params);
  if (shipHandleTo.first())
  {
    if (_shipment->id() != shipHandleTo.value("shiphead_id").toInt())
      _shipment->setId(shipHandleTo.value("shiphead_id").toInt());

    if (shipHandleTo.next())
    {
      _shipment->setType("TO");
      _shipment->limitToOrder(_order->id());
      _shipment->setEnabled(true);
    }
  }
  else if (shipHandleTo.lastError().type() != QSqlError::NoError)
  {
    systemError(this, shipHandleTo.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  else if (_shipment->isValid())
  {
    params.clear();
    params.append("tohead_id", _order->id());
    params.append("warehous_id", _warehouse->id());
    MetaSQLQuery mql(sql);
    shipHandleTo = mql.toQuery(params);
    if (shipHandleTo.first())
    {
      _shipment->setId(shipHandleTo.value("shiphead_id").toInt());
      if (shipHandleTo.next())
      {
        _shipment->setType("TO");
        _shipment->limitToOrder(_order->id());
        _shipment->setEnabled(true);
      }
    }
    else if (shipHandleTo.lastError().type() != QSqlError::NoError)
    {
      systemError(this, shipHandleTo.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
    else
      _shipment->clear();
  }
  else
  {
    QMessageBox::warning(this, tr("Nothing to ship"),
                      tr("<p>You may not ship this Transfer Order because "
                         "no stock has been issued to shipping for it."));
    _order->setFocus();
    return;
  }
}
コード例 #21
0
ファイル: shipOrder.cpp プロジェクト: Fortyseven/qt-client
void shipOrder::sHandleSo()
{
  XSqlQuery shipHandleSo;
  _coitem->clear();
  _shipment->setEnabled(false);
  _shipment->removeOrderLimit();

  sHandleButtons();


  shipHandleSo.prepare( "SELECT DISTINCT"
                        "       cohead_holdtype, cust_name, cohead_shiptoname, "
                        "       cohead_shiptoaddress1, cohead_curr_id, cohead_freight "
                        "FROM cohead JOIN custinfo ON (cust_id=cohead_cust_id)"
                        "            JOIN coitem ON (coitem_cohead_id=cohead_id)"
                        "            JOIN itemsite ON (itemsite_id=coitem_itemsite_id) "
                        "WHERE ((cohead_id=:sohead_id)"
                        "  AND  (itemsite_warehous_id=:warehous_id));" );
  shipHandleSo.bindValue(":sohead_id", _order->id());
  shipHandleSo.bindValue(":warehous_id", _warehouse->id());
  shipHandleSo.exec();
  if (shipHandleSo.first())
  {
    QString msg;
    if ( (shipHandleSo.value("cohead_holdtype").toString() == "C"))
      msg = storedProcErrorLookup("shipShipment", -12);
    else if (shipHandleSo.value("cohead_holdtype").toString() == "P")
      msg = storedProcErrorLookup("shipShipment", -13);
    else if (shipHandleSo.value("cohead_holdtype").toString() == "R")
      msg = storedProcErrorLookup("shipShipment", -14);
    else if (shipHandleSo.value("cohead_holdtype").toString() == "S")
      msg = storedProcErrorLookup("shipShipment", -15);

    if (! msg.isEmpty())
    {
      QMessageBox::warning(this, tr("Cannot Ship Order"), msg);
      if (_captive)
      {
        _reject = true;	// so set() can return an error
        reject();	// this only works if shipOrder has been exec()'ed
      }
      else
      {
        _order->setId(-1);
        return;
      }
    }

    _freight->setId(shipHandleSo.value("cohead_curr_id").toInt());
    _freight->setLocalValue(shipHandleSo.value("cohead_freight").toDouble());
    _billToName->setText(shipHandleSo.value("cust_name").toString());
    _shipToName->setText(shipHandleSo.value("cohead_shiptoname").toString());
    _shipToAddr1->setText(shipHandleSo.value("cohead_shiptoaddress1").toString());

    QString sql("SELECT shiphead_id "
                "FROM shiphead "
                "<? if exists(\"shiphead_id\") ?>"
                "WHERE (shiphead_id=<? value(\"shiphead_id\") ?>)"
                "<? else ?>"
                "WHERE (shiphead_number=getOpenShipment('SO', <? value(\"sohead_id\") ?>, <? value(\"warehous_id\") ?>))"
                "<? endif ?>"
                ";" );
    ParameterList params;
    params.append("sohead_id", _order->id());
    params.append("warehous_id", _warehouse->id());
    if (_shipment->isValid())
      params.append("shiphead_id", _shipment->id());
    MetaSQLQuery mql(sql);
    shipHandleSo = mql.toQuery(params);
    if (shipHandleSo.first())
    {
      if (_shipment->id() != shipHandleSo.value("shiphead_id").toInt())
        _shipment->setId(shipHandleSo.value("shiphead_id").toInt());

      if (shipHandleSo.next())
      {
        _shipment->setType("SO");
        _shipment->limitToOrder(_order->id());
        _shipment->setEnabled(true);
      }
    }
    else if (shipHandleSo.lastError().type() != QSqlError::NoError)
    {
      systemError(this, shipHandleSo.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
    else if (_shipment->isValid())
    {
      params.clear();
      params.append("sohead_id", _order->id());
      params.append("warehous_id", _warehouse->id());
      MetaSQLQuery mql(sql);
      shipHandleSo = mql.toQuery(params);
      if (shipHandleSo.first())
      {
        _shipment->setId(shipHandleSo.value("shiphead_id").toInt());
        if (shipHandleSo.next())
        {
          _shipment->setType("SO");
          _shipment->limitToOrder(_order->id());
          _shipment->setEnabled(true);
        }
      }
      else if (shipHandleSo.lastError().type() != QSqlError::NoError)
      {
        systemError(this, shipHandleSo.lastError().databaseText(), __FILE__, __LINE__);
        return;
      }
      else
        _shipment->clear();
    }
    else
    {
      QMessageBox::warning(this, tr("Nothing to ship"),
                        tr("<p>You may not ship this Sales Order because "
                           "no stock has been issued to shipping for it."));
      _order->setFocus();
      return;
    }
  }
  else if (shipHandleSo.lastError().type() != QSqlError::NoError)
  {
    systemError(this, shipHandleSo.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
コード例 #22
0
ファイル: employee.cpp プロジェクト: Wushaowei001/xtuple-1
bool employee::sPopulate()
{
  XSqlQuery getq;
  if (_empid > 0)
  {
    getq.prepare("SELECT emp.*, crmacct_id, crmacct_owner_username,"
                 "       crmacct_salesrep_id, crmacct_usr_username, crmacct_vend_id"
                 "  FROM emp JOIN crmacct ON (emp_id=crmacct_emp_id)"
                 " WHERE (emp_id=:id);");
    getq.bindValue(":id", _empid);
  }
  else if (_crmacctid > 0)
  {
    getq.prepare("SELECT crmacct_number     AS emp_code, NULL AS emp_number,"
                 "       crmacct_name       AS emp_name,"
                 "       crmacct_active     AS emp_active,"
                 "       crmacct_cntct_id_1 AS emp_cntct_id,"
                 "       NULL AS emp_startdate,      NULL AS emp_mgr_emp_id,"
                 "       NULL AS emp_warehous_id,    NULL AS emp_wage_type,"
                 "       NULL AS emp_wage,           NULL AS emp_wage_curr_id,"
                 "       NULL AS emp_extrate,        NULL AS emp_wage_period,"
                 "       NULL AS emp_extrate_period, NULL AS emp_dept_id,"
                 "       NULL AS emp_shift_id,       NULL AS emp_notes,"
                 "       NULL AS emp_image_id,"
                 "crmacct_id, crmacct_owner_username"
                 "  FROM crmacct"
                 " WHERE (crmacct_id=:id);");
    getq.bindValue(":id", _crmacctid);
  }

  getq.exec();
  if (getq.first())
  {
    _code->setText(getq.value("emp_code").toString());
    _name->setText(getq.value("emp_name").toString());
    _number->setText(getq.value("emp_number").toString());
    _active->setChecked(getq.value("emp_active").toBool());
    _startDate->setDate(getq.value("emp_startdate").toDate());
    _contact->setId(getq.value("emp_cntct_id").toInt());
    _site->setId(getq.value("emp_warehous_id").toInt());
    _mgr->setId(getq.value("emp_mgr_emp_id").toInt());
    _wagetype->setCode(getq.value("emp_wage_type").toString());
    _rate->set(getq.value("emp_wage").toDouble(),
               getq.value("emp_wage_curr_id").toInt(),
               QDate::currentDate());
    _externalRate->set(getq.value("emp_extrate").toDouble(),
                       getq.value("emp_wage_curr_id").toInt(),
                       QDate::currentDate());
    _per->setCode(getq.value("emp_wage_period").toString());
    _perExt->setCode(getq.value("emp_extrate_period").toString());
    _dept->setId(getq.value("emp_dept_id").toInt());
    _shift->setId(getq.value("emp_shift_id").toInt());
    _notes->setText(getq.value("emp_notes").toString());
    _image->setId(getq.value("emp_image_id").toInt());

    _crmacctid  = getq.value("crmacct_id").toInt();
    _crmowner   = getq.value("crmacct_owner_username").toString();

    if (DEBUG)
      qDebug("image %s and %s",
             qPrintable(getq.value("image").toString()),
             qPrintable(_image->number()));

    sFillCharassList();
    sFillGroupsList();
    _comments->setId(_empid);
    _comments->setReadOnly(_empid==-1);
    emit populated();
  }
  else if (ErrorReporter::error(QtCriticalMsg, this,
                                tr("Error getting Employee"),
                                getq, __FILE__, __LINE__))
    return false;

  sHandleButtons();
  return true;
}
コード例 #23
0
ファイル: shipOrder.cpp プロジェクト: Fortyseven/qt-client
void shipOrder::sShip()
{
  XSqlQuery shipq;
  shipq.prepare( "UPDATE shiphead "
	     "   SET shiphead_shipvia=:shiphead_shipvia,"
	     "       shiphead_freight=:shiphead_freight,"
	     "       shiphead_freight_curr_id=:shiphead_freight_curr_id,"
	     "       shiphead_tracknum=:shiphead_tracknum "
	     " WHERE (shiphead_id=:shiphead_id);");
  shipq.bindValue(":shiphead_shipvia",	_shipVia->currentText());
  shipq.bindValue(":shiphead_freight",	_freight->localValue());
  shipq.bindValue(":shiphead_freight_curr_id", _freight->id());
  shipq.bindValue(":shiphead_tracknum",	_tracknum->currentText());
  shipq.bindValue(":shiphead_id",		_shipment->id());
  shipq.exec();
  if (shipq.lastError().type() != QSqlError::NoError)
  {
    systemError(this, shipq.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  XSqlQuery rollback;
  rollback.prepare("ROLLBACK;");
  // failed insertGLTransaction RETURNs -5 rather than RAISE EXCEPTION
  shipq.exec("BEGIN;");

  shipq.prepare( "SELECT shipShipment(:shiphead_id, :ts) AS result;");
  shipq.bindValue(":shiphead_id", _shipment->id());
  shipq.bindValue(":ts",          _transDate->date());
  shipq.exec();
  if (shipq.first())
  {
    int result = shipq.value("result").toInt();
    if (result == -6)
    {
      rollback.exec();
      shipq.prepare("SELECT itemsite_id, tohead_trns_warehous_id,"
	        "       tohead_dest_warehous_id "
	        "FROM shiphead, shipitem, tohead, toitem, itemsite "
	        "WHERE ((itemsite_item_id=toitem_item_id)"
	        "  AND  (itemsite_warehous_id=tohead_src_warehous_id)"
	        "  AND  (toitem_tohead_id=tohead_id)"
	        "  AND  (shipitem_orderitem_id=toitem_id)"
	        "  AND  (shiphead_id=shipitem_shiphead_id)"
	        "  AND  (shiphead_order_type='TO')"
	        "  AND  (NOT shiphead_shipped)"
	        "  AND  (shiphead_id=:shiphead_id));");
      shipq.bindValue(":shiphead_id", _shipment->id());
      shipq.exec();
      while (shipq.next())
      {
	// missing transit itemsite is fatal here but not missing dest
	int transis = itemSite::createItemSite(this,
					       shipq.value("itemsite_id").toInt(),
				     shipq.value("tohead_trns_warehous_id").toInt(),
				     false);
	int destis  = itemSite::createItemSite(this,
					       shipq.value("itemsite_id").toInt(),
				     shipq.value("tohead_dest_warehous_id").toInt(),
				     true);
	if (transis <= 0 || destis < 0)
	  return;
      }
      if (shipq.lastError().type() != QSqlError::NoError)
      {
        systemError(this, shipq.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }
      sShip();	// beware of endless loop if you change createItemSite err check
      return;	// return because the recursive call cleans up for us
    }
    else if (result < 0)
    {
      rollback.exec();
      systemError(this, storedProcErrorLookup("shipShipment", result),
		  __FILE__, __LINE__);
      return;
    }
  }
  else if (shipq.lastError().type() != QSqlError::NoError)
  {
    rollback.exec();
    QString errorStr = shipq.lastError().databaseText();
    if(errorStr.startsWith("ERROR:  null value in column \"gltrans_accnt_id\" violates not-null constraint"))
      errorStr = tr("One or more required accounts are not set or set incorrectly."
                    " Please make sure that all your Cost Category and Sales Account Assignments"
                    " are complete and correct.");
    systemError(this, errorStr, __FILE__, __LINE__);
    return;
  }

  shipq.exec("COMMIT;");
  if (shipq.lastError().type() != QSqlError::NoError)
  {
    systemError(this, shipq.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  // END the transaction

  if (_print->isChecked())
  {
    ParameterList params;
    params.append("shiphead_id", _shipment->id());
    params.append("print");

    printPackingList newdlg(this, "", TRUE);
    newdlg.set(params);
  }

  if (_order->isSO() && _select->isChecked())
  {
    shipq.prepare("SELECT selectUninvoicedShipment(:shiphead_id) AS result;");
    shipq.bindValue(":shiphead_id", _shipment->id());
    shipq.exec();
    if (shipq.first())
    {
      int cobmiscid = shipq.value("result").toInt();
      if (cobmiscid < 0)
      {
	systemError(this,
	      storedProcErrorLookup("selectUninvoicedShipment", cobmiscid),
	      __FILE__, __LINE__);
	return;
      }
      else if (0 == cobmiscid)
      {
	QMessageBox::information(this, tr("Already Invoiced"),
				 tr("<p>This shipment appears to have been "
				   "invoiced already. It will not be selected "
				   "for billing again."));
      }
      else if (_create->isChecked())
      {
        shipq.prepare("SELECT createInvoice(:cobmisc_id) AS result;");
	shipq.bindValue(":cobmisc_id", cobmiscid);
	shipq.exec();
	if (shipq.first())
	{
	  int result = shipq.value("result").toInt();
	  if (result < 0)
	  {
	    systemError(this,
		      storedProcErrorLookup("postBillingSelection", result),
		      __FILE__, __LINE__);
	    return;
	  }
	  ParameterList params;
	  params.append("invchead_id", result);

	  printInvoice newdlg(this, "", TRUE);
	  newdlg.set(params);
	  newdlg.exec();

	  omfgThis->sInvoicesUpdated(result, TRUE);
	  omfgThis->sSalesOrdersUpdated(_order->id());
	}
	else if (shipq.lastError().type() != QSqlError::NoError)
	{
	  systemError(this, shipq.lastError().databaseText() +
		      tr("<p>Although Sales Order %1 was successfully shipped "
			 "and selected for billing, the Invoice was not "
			 "created properly. You may need to create an Invoice "
			 "manually from the Billing Selection.")
			.arg(_order->id()),
		      __FILE__, __LINE__);
	  return;
	}

	omfgThis->sBillingSelectionUpdated(_order->id(), TRUE);
      }
    }
    else if (shipq.lastError().type() != QSqlError::NoError)
    {
      systemError(this, shipq.lastError().databaseText() +
		  tr("<p>Although Sales Order %1 was successfully shipped, "
		     "it was not selected for billing. You must manually "
		     "select this Sales Order for Billing.")
		    .arg(_order->id()),
		  __FILE__, __LINE__);
      return;
    }
  }

  if (_order->isTO() && _receive->isChecked())
  {
    QString recverr = tr("<p>Receiving inventory for this Transfer Order "
			"failed although Shipping the Order succeeded. "
			"Manually receive this order using the Enter Order "
			"Receipt window.");
    shipq.exec("BEGIN;");
    ParameterList params;

    if (_metrics->boolean("MultiWhs"))
      params.append("MultiWhs");
    params.append("tohead_id",   _order->id());
    params.append("orderid",     _order->id());
    params.append("ordertype",   "TO");
    params.append("shiphead_id", _shipment->id());

    MetaSQLQuery recvm = mqlLoad("receipt", "receiveAll");
    shipq = recvm.toQuery(params);

    while (shipq.next())
    {
      int result = shipq.value("result").toInt();
      if (result < 0)
      {
	rollback.exec();
	systemError(this,
		    recverr + storedProcErrorLookup("enterReceipt", result),
		    __FILE__, __LINE__);
      }
      omfgThis->sPurchaseOrderReceiptsUpdated();
    }
    if (shipq.lastError().type() != QSqlError::NoError)
    {
      rollback.exec();
      systemError(this, recverr + "<br>" + shipq.lastError().databaseText(),
		  __FILE__, __LINE__);
    }

    shipq.exec("COMMIT;");
    if (shipq.lastError().type() != QSqlError::NoError)
    {
      systemError(this,
		  recverr + "<br>" + shipq.lastError().databaseText(),
		  __FILE__, __LINE__);
    }

    ParameterList recvParams;
    recvParams.append("tohead_id", _order->id());
    enterPoReceipt *newdlg = new enterPoReceipt();
    newdlg->set(recvParams);

    // to address bug 5680, replace
    // omfgThis->handleNewWindow(newdlg, Qt::ApplicationModal);
    // with
    newdlg->sPost();
    // end of replacement
  }

  if (_captive)
    accept();
  else
  {
    _order->setId(-1);
    _order->setEnabled(true);
    sHandleButtons();
    _billToName->clear();
    _shipToName->clear();
    _shipToAddr1->clear();
    _freight->setEnabled(TRUE);
    _freight->reset();
    _shipVia->clear();
    _shipment->clear();
    _shipment->setEnabled(false);
    _close->setText(tr("&Close"));

    _order->setFocus();
  }

  // Update the shipdatasum record to reflect shipped
  shipq.prepare("UPDATE shipdatasum "
		"   SET shipdatasum_shipped=true "
                " WHERE ((shipdatasum_cosmisc_tracknum = :tracknum)"
		"   AND  (   (shipdatasum_shiphead_number=:shiphead_number)"
		"         OR (:shiphead_number IS NULL)));");
  shipq.bindValue(":tracknum", _tracknum->currentText());
  if (! _shipment->number().isEmpty())
    shipq.bindValue(":shiphead_number", _shipment->number());
  shipq.exec();
  if (shipq.lastError().type() != QSqlError::NoError)
  {
    systemError(this, shipq.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
コード例 #24
0
ファイル: employee.cpp プロジェクト: Wushaowei001/xtuple-1
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(_crmacct,       SIGNAL(clicked()), this, SLOT(sCrmAccount()));
  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(_save,          SIGNAL(clicked()), this, SLOT(sSave()));
  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");

  _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);

  _crmacctid  = -1;
  _empid      = -1;
  _NumberGen  = -1;
  _mode     = cView;
  _origmode = cView;
}
コード例 #25
0
void dspWoScheduleByParameterList::sFillList()
{
  int woid = _wo->id();
  _wo->clear();

  QString sql( "SELECT wo_id, wo_ordtype,"
               "       CASE WHEN (wo_ordid IS NULL) THEN -1"
               "            ELSE wo_ordid"
               "       END AS orderid,"
               "       formatWONumber(wo_id) as wonumber,"
               "       wo_status, wo_priority, warehous_code,"
               "       item_number, (item_descrip1 || ' ' || item_descrip2) AS description,"
               "       uom_name,"
               "       formatQty(wo_qtyord) as ordered,"
               "       formatQty(wo_qtyrcv) as received,"
               "       formatDate(wo_startdate) as startdate,"
               "       formatDate(wo_duedate) as duedate,"
               "       ((wo_startdate <= CURRENT_DATE) AND (wo_status IN ('O','E','S','R'))) AS latestart,"
               "       (wo_duedate<=CURRENT_DATE) AS latedue "
               "FROM wo, itemsite, warehous, item, uom "
               "WHERE ( (wo_itemsite_id=itemsite_id)"
               " AND (itemsite_item_id=item_id)"
               " AND (item_inv_uom_id=uom_id)"
               " AND (itemsite_warehous_id=warehous_id)"
               " AND (wo_startdate BETWEEN :startDate AND :endDate)" );

  if (_warehouse->isSelected())
    sql += " AND (itemsite_warehous_id=:warehous_id)";

  if (_parameter->isSelected())
  {
    if (_parameter->type() == ClassCode)
      sql += " AND (item_classcode_id=:classcode_id)";
    else if (_parameter->type() == ItemGroup)
      sql += " AND (item_id IN (SELECT itemgrpitem_item_id FROM itemgrpitem WHERE (itemgrpitem_itemgrp_id=:itemgrp_id)))";
    else if (_parameter->type() == PlannerCode)
      sql += " AND (itemsite_plancode_id=:plancode_id)";
    else if (_parameter->type() == WorkCenter)
      sql += " AND (wo_id IN (SELECT wooper_wo_id FROM wooper WHERE (wooper_wrkcnt_id=:wrkcnt_id)))";
  }
  else if (_parameter->isPattern())
  {
    if (_parameter->type() == ClassCode)
      sql += " AND (item_classcode_id IN (SELECT classcode_id FROM classcode WHERE (classcode_code ~ :classcode_pattern)))";
    else if (_parameter->type() == ItemGroup)
      sql += " AND (item_id IN (SELECT itemgrpitem_item_id FROM itemgrpitem, itemgrp WHERE ( (itemgrpitem_itemgrp_id=itemgrp_id) AND (itemgrp_name ~ :itemgrp_pattern) ) ))";
    else if (_parameter->type() == PlannerCode)
      sql += " AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ :plancode_pattern)))";
    else if (_parameter->type() == WorkCenter)
      sql += " AND (wo_id IN (SELECT wooper_wo_id FROM wooper, wrkcnt WHERE ((wooper_wrkcnt_id=wrkcnt_id) AND (wrkcnt_code ~ :wrkcnt_pattern))))";
  }

  if (_showOnlyRI->isChecked())
    sql += " AND (wo_status IN ('R','I'))";
  else
    sql += " AND (wo_status<>'C')";

  if (_showOnlyTopLevel->isChecked())
    sql += " AND (wo_ordtype<>'W')";

  sql += ") ";

  if(_sortByStartDate->isChecked())
    sql += " ORDER BY wo_startdate, wo_number, wo_subnumber";
  else if(_sortByDueDate->isChecked())
    sql += " ORDER BY wo_duedate, wo_number, wo_subnumber";
  else
    sql += " ORDER BY item_number, wo_number, wo_subnumber";

  q.prepare(sql);
  _warehouse->bindValue(q);
  _parameter->bindValue(q);
  _dates->bindValue(q);
  q.exec();
  while (q.next())
  {
    XTreeWidgetItem *last = new XTreeWidgetItem( _wo, q.value("wo_id").toInt(), q.value("orderid").toInt(),
                                             q.value("wo_ordtype"), q.value("wonumber"),
                                             q.value("wo_status"), q.value("wo_priority"),
                                             q.value("warehous_code"), q.value("item_number"),
                                             q.value("description"), q.value("uom_name"),
                                             q.value("ordered"), q.value("received"),
                                             q.value("startdate") );
    last->setText(11, q.value("duedate").toString());

    if (q.value("latestart").toBool())
      last->setTextColor(10, "red");

    if (q.value("latedue").toBool())
    {
      last->setTextColor(11, "red");
      last->setText(12, tr("Overdue"));
      last->setTextColor(12, "red");
    }
    else
      last->setText(12, tr("On Time"));

    if(last->id() == woid)
      _wo->setCurrentItem(last);
  }

  sHandleButtons();
}
コード例 #26
0
vendor::vendor(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_printAddresses, SIGNAL(clicked()), this, SLOT(sPrintAddresses()));
  connect(_newAddress, SIGNAL(clicked()), this, SLOT(sNewAddress()));
  connect(_editAddress, SIGNAL(clicked()), this, SLOT(sEditAddress()));
  connect(_viewAddress, SIGNAL(clicked()), this, SLOT(sViewAddress()));
  connect(_deleteAddress, SIGNAL(clicked()), this, SLOT(sDeleteAddress()));
  connect(_deleteTaxreg, SIGNAL(clicked()), this, SLOT(sDeleteTaxreg()));
  connect(_editTaxreg,   SIGNAL(clicked()), this, SLOT(sEditTaxreg()));
  connect(_newTaxreg,    SIGNAL(clicked()), this, SLOT(sNewTaxreg()));
  connect(_viewTaxreg,   SIGNAL(clicked()), this, SLOT(sViewTaxreg()));
  connect(_next, SIGNAL(clicked()), this, SLOT(sNext()));
  connect(_previous, SIGNAL(clicked()), this, SLOT(sPrevious()));
  connect(_mainButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_altButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_checksButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_number, SIGNAL(textEdited(const QString&)), this, SLOT(sNumberEdited()));
  connect(_number, SIGNAL(lostFocus()), this, SLOT(sCheck()));

  connect(_address, SIGNAL(addressChanged(QString,QString,QString,QString,QString,QString, QString)),
          _contact2, SLOT(setNewAddr(QString,QString,QString,QString,QString,QString, QString)));

  connect(_address, SIGNAL(addressChanged(QString,QString,QString,QString,QString,QString, QString)),
          _contact1, SLOT(setNewAddr(QString,QString,QString,QString,QString,QString, QString)));

  _defaultCurr->setLabel(_defaultCurrLit);

  QRegExp tmpregex = QRegExp(_metrics->value("EFTAccountRegex"));
  _accountValidator = new QRegExpValidator (tmpregex, this);
  tmpregex = QRegExp(_metrics->value("EFTRoutingRegex"));
  _routingValidator = new QRegExpValidator(tmpregex, this);

  _routingNumber->setValidator(_routingValidator);
  _achAccountNumber->setValidator(_accountValidator);

  _vendaddr->addColumn(tr("Number"), 70, Qt::AlignLeft, true, "vendaddr_code");
  _vendaddr->addColumn(tr("Name"),   50, Qt::AlignLeft, true, "vendaddr_name");
  _vendaddr->addColumn(tr("City"),   -1, Qt::AlignLeft, true, "vendaddr_city");
  _vendaddr->addColumn(tr("State"),  -1, Qt::AlignLeft, true, "vendaddr_state");
  _vendaddr->addColumn(tr("Country"),-1, Qt::AlignLeft, true, "vendaddr_country");
  _vendaddr->addColumn(tr("Postal Code"),-1, Qt::AlignLeft, true, "vendaddr_zipcode");

  _taxreg->addColumn(tr("Tax Authority"), 100, Qt::AlignLeft, true, "taxauth_code");
  _taxreg->addColumn(tr("Tax Zone"),      100, Qt::AlignLeft, true, "taxzone_code");
  _taxreg->addColumn(tr("Registration #"), -1, Qt::AlignLeft, true, "taxreg_number");

  _accountType->append(0, "Checking", "K");
  _accountType->append(1, "Savings",  "C");

  _crmacctid = -1;
  _ignoreClose = false;
  _NumberGen = -1;
  
  if (_metrics->boolean("EnableBatchManager") &&
      ! _metrics->boolean("ACHEnabled"))
  {
    _checksButton->hide();
  }
  else if (! _metrics->boolean("EnableBatchManager") &&
           _metrics->boolean("ACHEnabled"))
  {
    _checksButton->hide();
    _transmitStack->setCurrentIndex(1);
  }
  else if (! _metrics->boolean("EnableBatchManager") &&
           ! _metrics->boolean("ACHEnabled"))
    ediTab->setVisible(false);
  // else defaults are OK

  if (_metrics->boolean("ACHEnabled") && omfgThis->_key.isEmpty())
    _checksButton->setEnabled(false);

  _vendid = -1;
}
コード例 #27
0
    _itemdlg = new QueryItem(0, Qt::Dialog);
    if (_itemdlg)
    {
      _itemdlg->setWindowModality(Qt::WindowModal);
      connect(_itemdlg, SIGNAL(closed(bool)), this, SLOT(sFillList()));
    }
  }
  else
    _itemdlg = 0;

  connect(_qryDelete,  SIGNAL(clicked()),         this, SLOT(sDelete()));
  connect(_qryEdit,    SIGNAL(clicked()),         this, SLOT(sEdit()));
  connect(_qryList,    SIGNAL(itemSelected(int)), this, SLOT(sEdit()));
  connect(_qryNew,     SIGNAL(clicked()),         this, SLOT(sNew()));
  connect(_save,       SIGNAL(clicked()),         this, SLOT(sSave()));
  connect(_setName,    SIGNAL(editingFinished()), this, SLOT(sHandleButtons()));

  _qryList->addColumn(tr("Order"),        _seqColumn, Qt::AlignRight, true, "qryitem_order");
  _qryList->addColumn(tr("Name"),        _itemColumn, Qt::AlignLeft,  true, "qryitem_name");
  _qryList->addColumn(tr("Source"),       _seqColumn, Qt::AlignLeft,  true, "qryitem_src");
  _qryList->addColumn(tr("Schema/Group"),_itemColumn, Qt::AlignLeft,  true, "qryitem_group");
  _qryList->addColumn(tr("Table/Name"),           -1, Qt::AlignLeft,  true, "qryitem_detail");

  sHandleButtons();

  _qryheadid = -1;

}

QuerySet::~QuerySet()
{
コード例 #28
0
itemAvailabilityWorkbench::itemAvailabilityWorkbench(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  _dspInventoryAvailability = new dspInventoryAvailability(this, "dspInventoryAvailabilty", Qt::Widget);
  _dspInventoryAvailability->setObjectName("dspInventoryAvailability");
  _availabilityPage->layout()->addWidget(_dspInventoryAvailability);
  _dspInventoryAvailability->setCloseVisible(false);
  _dspInventoryAvailability->setQueryOnStartEnabled(false);
  _dspInventoryAvailability->setParameterWidgetVisible(false);
  _dspInventoryAvailability->setAutoUpdateEnabled(false);
  _dspInventoryAvailability->optionsWidget()->show();
  _dspInventoryAvailability->list()->hideColumn("item_number");
  _dspInventoryAvailability->list()->hideColumn("itemdescrip");
  _dspInventoryAvailability->list()->hideColumn("uom_name");
  _dspInventoryAvailability->findChild<QWidget*>("_showGroup")->hide();
  
  _dspRunningAvailability = new dspRunningAvailability(this, "dspRunningAvailabilty", Qt::Widget);
  _dspRunningAvailability->setObjectName("dspRunningAvailability");
  _runningAvailabilityPage->layout()->addWidget(_dspRunningAvailability);
  _dspRunningAvailability->setCloseVisible(false);
  _dspRunningAvailability->setQueryOnStartEnabled(false);
  _dspRunningAvailability->findChild<QWidget*>("_item")->hide();
  
  _dspInventoryLocator = new dspInventoryLocator(this, "dspInventoryLocator", Qt::Widget);
  _dspInventoryLocator->setObjectName("dspInventoryLocator");
  _locationDetailPage->layout()->addWidget(_dspInventoryLocator);
  _dspInventoryLocator->setCloseVisible(false);
  _dspInventoryLocator->setQueryOnStartEnabled(false);
  _dspInventoryLocator->findChild<QWidget*>("_item")->hide();
  _dspInventoryLocator->findChild<QWidget*>("_itemGroup")->hide();
  
  _dspCostedIndentedBOM = new dspCostedIndentedBOM(this, "dspCostedIndentedBOM", Qt::Widget);
  _dspCostedIndentedBOM->setObjectName("dspCostedIndentedBOM");
  _costedIndentedBOMPage->layout()->addWidget(_dspCostedIndentedBOM);
  _dspCostedIndentedBOM->setCloseVisible(false);
  _dspCostedIndentedBOM->setQueryOnStartEnabled(false);
  _dspCostedIndentedBOM->findChild<QWidget*>("_item")->hide();
  
  _dspSingleLevelWhereUsed = new dspSingleLevelWhereUsed(this, "dspSingleLevelWhereUsed", Qt::Widget);
  _dspSingleLevelWhereUsed->setObjectName("dspSingleLevelWhereUsed");
  _whereUsedPage->layout()->addWidget(_dspSingleLevelWhereUsed);
  _dspSingleLevelWhereUsed->setCloseVisible(false);
  _dspSingleLevelWhereUsed->setQueryOnStartEnabled(false);
  _dspSingleLevelWhereUsed->findChild<QWidget*>("_item")->hide();
  
  _dspInventoryHistory = new dspInventoryHistory(this, "dspInventoryHistory", Qt::Widget);
  _dspInventoryHistory->setObjectName("dspInventoryHistory");
  _inventoryHistoryPage->layout()->addWidget(_dspInventoryHistory);
  _dspInventoryHistory->setCloseVisible(false);
  _dspInventoryHistory->setQueryOnStartEnabled(false);
  _dspInventoryHistory->setParameterWidgetVisible(false);
  _dspInventoryHistory->setAutoUpdateEnabled(false);
  _dspInventoryHistory->setStartDate(QDate().currentDate().addDays(-365));
  _dspInventoryHistory->list()->hideColumn("item_number");
  
  _dspPoItemReceivingsByItem = new dspPoItemReceivingsByItem(this, "dspPoItemReceivingsByItem", Qt::Widget);
  _dspPoItemReceivingsByItem->setObjectName("dspPoItemReceivingsByItem");
  _receivingHistoryPage->layout()->addWidget(_dspPoItemReceivingsByItem);
  _dspPoItemReceivingsByItem->setCloseVisible(false);
  _dspPoItemReceivingsByItem->setQueryOnStartEnabled(false);
  _dspPoItemReceivingsByItem->findChild<QWidget*>("_item")->hide();
  _dspPoItemReceivingsByItem->findChild<QWidget*>("_itemGroup")->hide();
  _dspPoItemReceivingsByItem->findChild<DateCluster*>("_dates")->setStartDate(QDate().currentDate().addDays(-365));
  _dspPoItemReceivingsByItem->findChild<DateCluster*>("_dates")->setEndDate(QDate().currentDate());
  
  _dspSalesHistory = new dspSalesHistory(this, "dspSalesHistory", Qt::Widget);
  _dspSalesHistory->setObjectName("dspSalesHistory");
  _salesHistoryPage->layout()->addWidget(_dspSalesHistory);
  _dspSalesHistory->setCloseVisible(false);
  _dspSalesHistory->setQueryOnStartEnabled(false);
  _dspSalesHistory->setParameterWidgetVisible(false);
  _dspSalesHistory->setAutoUpdateEnabled(false);
  _dspSalesHistory->setStartDate(QDate().currentDate().addDays(-365));
  _dspSalesHistory->list()->hideColumn("item_number");
  _dspSalesHistory->list()->hideColumn("itemdescription");
  
  _dspPoItemsByItem = new dspPoItemsByItem(this, "dspPoItemsByItem", Qt::Widget);
  _dspPoItemsByItem->setObjectName("dspPoItemsByItem");
  _purchaseOrderItemsPage->layout()->addWidget(_dspPoItemsByItem);
  _dspPoItemsByItem->setCloseVisible(false);
  _dspPoItemsByItem->setQueryOnStartEnabled(false);
  _dspPoItemsByItem->findChild<QWidget*>("_item")->hide();
  _dspPoItemsByItem->findChild<QWidget*>("_itemGroup")->hide();
  
  _dspSalesOrdersByItem = new dspSalesOrdersByItem(this, "dspSalesOrdersByItem", Qt::Widget);
  _dspSalesOrdersByItem->setObjectName("dspSalesOrdersByItem");
  _salesOrderItemsPage->layout()->addWidget(_dspSalesOrdersByItem);
  _dspSalesOrdersByItem->setCloseVisible(false);
  _dspSalesOrdersByItem->setQueryOnStartEnabled(false);
  _dspSalesOrdersByItem->findChild<QWidget*>("_item")->hide();
  
  _dspQuotesByItem = new dspQuotesByItem(this, "dspQuotesByItem", Qt::Widget);
  _dspQuotesByItem->setObjectName("dspQuotesByItem");
  _quoteItemsPage->layout()->addWidget(_dspQuotesByItem);
  _dspQuotesByItem->setCloseVisible(false);
  _dspQuotesByItem->setQueryOnStartEnabled(false);
  _dspQuotesByItem->findChild<QWidget*>("_item")->hide();
  
  _dspPricesByCustomer = new dspPricesByCustomer(this, "dspPricesByCustomer", Qt::Widget);
  _dspPricesByCustomer->setObjectName("dspPricesByCustomer");
  _customerPricesPage->layout()->addWidget(_dspPricesByCustomer);
  _dspPricesByCustomer->setCloseVisible(false);
  _dspPricesByCustomer->setQueryOnStartEnabled(false);
  _dspPricesByCustomer->findChild<QWidget*>("_item")->hide();
  
  _itemMaster = new item(this, "item", Qt::Widget);
  _itemMaster->setObjectName("item");
  _itemPage->layout()->addWidget(_itemMaster);
  _itemMaster->findChild<QWidget*>("_itemNumber")->hide();
  _itemMaster->findChild<QWidget*>("_itemNumberLit")->hide();
  _itemMaster->findChild<QWidget*>("_description1")->hide();
  _itemMaster->findChild<QWidget*>("_description2")->hide();
  _itemMaster->findChild<QWidget*>("_descriptionLit")->hide();
  _itemMaster->findChild<QWidget*>("_save")->hide();
  _itemMaster->findChild<QWidget*>("_close")->hide();
  _itemMaster->findChild<QWidget*>("_print")->hide();
  _itemMaster->findChild<QWidget*>("_newCharacteristic")->hide();
  _itemMaster->findChild<QWidget*>("_editCharacteristic")->hide();
  _itemMaster->findChild<QWidget*>("_deleteCharacteristic")->hide();
  _itemMaster->findChild<QWidget*>("_newAlias")->hide();
  _itemMaster->findChild<QWidget*>("_editAlias")->hide();
  _itemMaster->findChild<QWidget*>("_deleteAlias")->hide();
  _itemMaster->findChild<QWidget*>("_newSubstitute")->hide();
  _itemMaster->findChild<QWidget*>("_editSubstitute")->hide();
  _itemMaster->findChild<QWidget*>("_deleteSubstitute")->hide();
  _itemMaster->findChild<QWidget*>("_newTransform")->hide();
  _itemMaster->findChild<QWidget*>("_deleteTransform")->hide();
  _itemMaster->findChild<QWidget*>("_newItemSite")->hide();
  _itemMaster->findChild<QWidget*>("_editItemSite")->hide();
  _itemMaster->findChild<QWidget*>("_deleteItemSite")->hide();
  _itemMaster->findChild<QWidget*>("_itemtaxNew")->hide();
  _itemMaster->findChild<QWidget*>("_itemtaxEdit")->hide();
  _itemMaster->findChild<QWidget*>("_itemtaxDelete")->hide();
  _itemMaster->findChild<QWidget*>("_newUOM")->hide();
  _itemMaster->findChild<QWidget*>("_editUOM")->hide();
  _itemMaster->findChild<QWidget*>("_deleteUOM")->hide();
  _itemMaster->findChild<QWidget*>("_newSrc")->hide();
  _itemMaster->findChild<QWidget*>("_editSrc")->hide();
  _itemMaster->findChild<QWidget*>("_deleteSrc")->hide();
  _itemMaster->findChild<QWidget*>("_copySrc")->hide();
  _itemMaster->findChild<QTabWidget*>("_tab")->removeTab(2);
  _itemMaster->findChild<QWidget*>("_active")->setEnabled(false);
  _itemMaster->findChild<QWidget*>("_sold")->setEnabled(false);
  _itemMaster->findChild<QWidget*>("_itemGroup")->setEnabled(false);
  _itemMaster->findChild<QWidget*>("_weightGroup")->setEnabled(false);
  
  connect(_tab, SIGNAL(currentChanged(int)), this, SLOT(sFillList()));
  connect(_availabilityButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_runningAvailabilityButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_locationDetailButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_costedIndentedBOMButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_whereUsedButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_inventoryHistoryButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_receivingHistoryButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_salesHistoryButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_purchaseOrderItemsButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_salesOrderItemsButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_quoteItemsButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_customerPricesButton, SIGNAL(clicked()), this, SLOT(sHandleButtons()));
  connect(_item,	SIGNAL(newId(int)), this, SLOT(populate()));

  // General
  if (!_privileges->check("ViewInventoryAvailability") && !_privileges->check("ViewQOH"))
    _tab->removeTab(0);
  else
  {
    if (!_privileges->check("ViewInventoryAvailability"))
    {
      _availabilityButton->hide();
      _runningAvailabilityButton->hide();
    }
    if (!_privileges->check("ViewQOH"))
      _locationDetailButton->hide();
  }
  
  if (!_privileges->check("ViewPurchaseOrders") && !_privileges->check("ViewSalesOrders") && !_privileges->check("ViewQuotes"))
    _tab->removeTab(1);
  else
  {
    if (!_privileges->check("ViewPurchaseOrders"))
      _purchaseOrderItemsButton->hide();
    if (!_privileges->check("ViewSalesOrders"))
      _salesOrderItemsButton->hide();
    if (!_privileges->check("ViewQuotes"))
      _quoteItemsButton->hide();
  }
  
  if (!_privileges->check("ViewInventoryHistory") && !_privileges->check("ViewReceiptsReturns") && !_privileges->check("ViewSalesHistory"))
    _tab->removeTab(2);
  else
  {
    if (!_privileges->check("ViewInventoryHistory"))
      _inventoryHistoryButton->hide();
    if (!_privileges->check("ViewReceiptsReturns"))
      _receivingHistoryButton->hide();
    if (!_privileges->check("ViewSalesHistory"))
      _salesHistoryButton->hide();
  }

  if (!_privileges->check("ViewItemMaster") && !_privileges->check("MaintainItemMasters"))
    _tab->removeTab(3);

  if (!_privileges->check("ViewCosts") && !_privileges->check("ViewBOMs"))
    _tab->removeTab(4);
  else
  {
    if (!_privileges->check("ViewCosts"))
      _costedIndentedBOMButton->hide();
    if (!_privileges->check("ViewBOMs"))
      _whereUsedButton->hide();
  }
}
コード例 #29
0
void dspWoScheduleByParameterList::sFillList()
{
  int woid = _wo->id();
  _wo->clear();

  QString sql( "SELECT wo_id, wo_ordtype,"
               "       CASE WHEN (wo_ordid IS NULL) THEN -1"
               "            ELSE wo_ordid"
               "       END AS orderid,"
               "       formatWONumber(wo_id) as wonumber,"
               "       wo_status, wo_priority, warehous_code,"
               "       item_number, (item_descrip1 || ' ' || item_descrip2) AS description,"
               "       uom_name,"
               "       formatQty(wo_qtyord) as ordered,"
               "       formatQty(wo_qtyrcv) as received,"
               "       formatDate(wo_startdate) as startdate,"
               "       formatDate(wo_duedate) as duedate,"
	       "       ((wo_startdate<=CURRENT_DATE)"
	       "         AND (wo_status IN ('O','E','S','R'))) AS latestart,"
               "       (wo_duedate<=CURRENT_DATE) AS latedue "
               "FROM wo, itemsite, warehous, item, uom "
               "WHERE ( (wo_itemsite_id=itemsite_id)"
               " AND (itemsite_item_id=item_id)"
               " AND (item_inv_uom_id=uom_id)"
               " AND (itemsite_warehous_id=warehous_id)"
	       " AND (wo_startdate BETWEEN <? value(\"startDate\") ?>"
	       "                       AND <? value(\"endDate\") ?>)"
	       "<? if exists(\"warehous_id\") ?>"
	       " AND (itemsite_warehous_id=<? value(\"warehous_id\") ?>)"
	       "<? endif ?>"
	       "<? if exists(\"showOnlyRI\") ?>"
	       " AND (wo_status IN ('R','I'))"
	       "<? else ?>"
	       " AND (wo_status<>'C')"
	       "<? endif ?>"
	       "<? if exists(\"showOnlyTopLevel\") ?>"
	       " AND (wo_ordtype<>'W')"
	       "<? endif ?>"
	       "<? if exists(\"classcode_id\") ?>"
	       " AND (item_classcode_id=<? value(\"classcode_id\") ?>)"
	       "<? elseif exists(\"itemgrp_id\") ?>"
	       " AND (item_id IN (SELECT itemgrpitem_item_id FROM itemgrpitem WHERE (itemgrpitem_itemgrp_id=<? value(\"itemgrp_id\") ?>)))"
	       "<? elseif exists(\"plancode_id\") ?>"
	       " AND (itemsite_plancode_id=<? value(\"plancode_id\") ?>)"
	       "<? elseif exists(\"wrkcnt_id\") ?>"
	       " AND (wo_id IN (SELECT wooper_wo_id FROM wooper WHERE (wooper_wrkcnt_id=<? value(\"wrkcnt_id\") ?>)))"
	       "<? elseif exists(\"classcode_pattern\") ?>"
	       " AND (item_classcode_id IN (SELECT classcode_id FROM classcode WHERE (classcode_code ~ <? value(\"classcode_pattern\") ?>)))"
	       "<? elseif exists(\"itemgrp_pattern\") ?>"
	       " AND (item_id IN (SELECT itemgrpitem_item_id FROM itemgrpitem, itemgrp WHERE ( (itemgrpitem_itemgrp_id=itemgrp_id) AND (itemgrp_name ~ <? value(\"itemgrp_pattern\") ?>) ) ))"
	       "<? elseif exists(\"plancode_pattern\") ?>"
	       " AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ <? value(\"plancode_pattern\") ?>)))"
	       "<? elseif exists(\"wrkcnt_pattern\") ?>"
	       " AND (wo_id IN (SELECT wooper_wo_id FROM wooper, wrkcnt WHERE ((wooper_wrkcnt_id=wrkcnt_id) AND (wrkcnt_code ~ <? value(\"wrkcnt_pattern\") ?>))))"
	       "<? endif ?>"
	       ") "
	       "ORDER BY "
	       "<? if exists(\"sortByStartDate\") ?>"
	       "	wo_startdate,"
	       "<? elseif exists(\"sortByDueDate\") ?>"
	       "	wo_duedate,"
	       "<? elseif exists(\"sortByItemNumber\") ?>"
	       "        item_number,"
	       "<? endif ?>"
	       " wo_number, wo_subnumber" );

  MetaSQLQuery mql(sql);
  ParameterList params;
  if (! setParams(params))
    return;
  q = mql.toQuery(params);
  while (q.next())
  {
    XTreeWidgetItem *last = new XTreeWidgetItem( _wo, q.value("wo_id").toInt(), q.value("orderid").toInt(),
                                             q.value("wo_ordtype"), q.value("wonumber"),
                                             q.value("wo_status"), q.value("wo_priority"),
                                             q.value("warehous_code"), q.value("item_number"),
                                             q.value("description"), q.value("uom_name"),
                                             q.value("ordered"), q.value("received"),
                                             q.value("startdate") );
    last->setText(11, q.value("duedate").toString());

    if (q.value("latestart").toBool())
      last->setTextColor(10, "red");

    if (q.value("latedue").toBool())
    {
      last->setTextColor(11, "red");
      last->setText(12, tr("Overdue"));
      last->setTextColor(12, "red");
    }
    else
      last->setText(12, tr("On Time"));

    if(last->id() == woid)
      _wo->setCurrentItem(last);
  }

  sHandleButtons();
}
コード例 #30
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();
}