Esempio n. 1
0
enum SetResponse purchaseOrderItem::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;
  bool     haveQty  = FALSE;
  bool     haveDate = FALSE;

  param = pParams.value("parentWo", &valid);
  if (valid)
    _parentwo = param.toInt();

  param = pParams.value("parentSo", &valid);
  if (valid)
    _parentso = param.toInt();

  param = pParams.value("pohead_id", &valid);
  if (valid)
  {
    _poheadid = param.toInt();

    q.prepare( "SELECT pohead_number, pohead_orderdate, pohead_status, "
               "       vend_id, vend_restrictpurch, pohead_curr_id "
               "FROM pohead, vend "
               "WHERE ( (pohead_vend_id=vend_id)"
               " AND (pohead_id=:pohead_id) );" );
    q.bindValue(":pohead_id", param.toInt());
    q.exec();
    if (q.first())
    {
      _poNumber->setText(q.value("pohead_number").toString());
      _poStatus = q.value("pohead_status").toString();
      _unitPrice->setEffective(q.value("pohead_orderdate").toDate());
      _unitPrice->setId(q.value("pohead_curr_id").toInt());

      if (q.value("vend_restrictpurch").toBool())
      {
        _item->setQuery( QString( "SELECT DISTINCT item_id, item_number, item_descrip1, item_descrip2,"
                                  "                uom_name, item_type, item_config "
                                  "FROM item, itemsite, itemsrc, uom  "
                                  "WHERE ( (itemsite_item_id=item_id)"
                                  " AND (itemsrc_item_id=item_id)"
                                  " AND (item_inv_uom_id=uom_id)"
                                  " AND (itemsite_active)"
                                  " AND (item_active)"
                                  " AND (itemsrc_active)"
                                  " AND (itemsrc_vend_id=%1) ) "
                                  "ORDER BY item_number;" )
                         .arg(q.value("vend_id").toInt()) );
        _item->setValidationQuery( QString( "SELECT DISTINCT item_id, item_number, item_descrip1, item_descrip2,"
                                            "                uom_name, item_type, item_config "
                                            "FROM item, itemsite, itemsrc, uom  "
                                            "WHERE ( (itemsite_item_id=item_id)"
                                            " AND (itemsrc_item_id=item_id)"
                                            " AND (item_inv_uom_id=uom_id)"
                                            " AND (itemsite_active)"
                                            " AND (item_active)"
                                            " AND (itemsrc_active)"
                                            " AND (itemsrc_vend_id=%1) "
                                            " AND (itemsite_item_id=:item_id) ) "
                                            "ORDER BY item_number;" )
                                   .arg(q.value("vend_id").toInt()) );
      }
      else
        _item->setType(ItemLineEdit::cGeneralPurchased | ItemLineEdit::cActive);
    }
    else
    {
      systemError(this, tr("A System Error occurred at %1::%2.")
                        .arg(__FILE__)
                        .arg(__LINE__) );
      return UndefinedError;
    }
  }

  param = pParams.value("poitem_id", &valid);
  if (valid)
  {
    _poitemid = param.toInt();

    q.prepare( "SELECT pohead_number "
               "FROM pohead, poitem "
               "WHERE ( (pohead_id=poitem_pohead_id) "
               " AND (poitem_id=:poitem_id) );" );
    q.bindValue(":poitem_id", param.toInt());
    q.exec();
    if (q.first())
    {
      _poNumber->setText(q.value("pohead_number").toString());
    }

    populate();
  }
  // connect here and not in the .ui to avoid timing issues at initialization
  connect(_unitPrice, SIGNAL(valueChanged()), this, SLOT(sPopulateExtPrice()));

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      q.exec("SELECT NEXTVAL('poitem_poitem_id_seq') AS poitem_id;");
      if (q.first())
        _poitemid = q.value("poitem_id").toInt();
      else
      {
        systemError(this, tr("A System Error occurred at %1::%2.")
                          .arg(__FILE__)
                          .arg(__LINE__) );
        return UndefinedError;
      }

      if(_parentso != -1)
      {
        q.prepare( "INSERT INTO charass"
                   "      (charass_target_type, charass_target_id,"
                   "       charass_char_id, charass_value) "
                   "SELECT 'PI', :orderid, charass_char_id, charass_value"
                   "  FROM charass"
                   " WHERE ((charass_target_type='SI')"
                   "   AND  (charass_target_id=:soitem_id));");
        q.bindValue(":orderid", _poitemid);
        q.bindValue(":soitem_id", _parentso);
        q.exec();
      }

      q.prepare( "SELECT (COALESCE(MAX(poitem_linenumber), 0) + 1) AS _linenumber "
                 "FROM poitem "
                 "WHERE (poitem_pohead_id=:pohead_id);" );
      q.bindValue(":pohead_id", _poheadid);
      q.exec();
      if (q.first())
        _lineNumber->setText(q.value("_linenumber").toString());
      else
      {
        systemError(this, tr("A System Error occurred at %1::%2.")
                          .arg(__FILE__)
                          .arg(__LINE__) );

        return UndefinedError;
      }

      if (!_item->isValid())
        _item->setFocus();
      else if (!haveQty)
        _ordered->setFocus();
      else if (!haveDate)
        _dueDate->setFocus();

      _comments->setEnabled(FALSE);
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _typeGroup->setEnabled(FALSE);

      _ordered->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _typeGroup->setEnabled(FALSE);
      _vendorItemNumber->setEnabled(FALSE);
      _vendorItemNumberList->setEnabled(FALSE);
      _vendorDescrip->setEnabled(FALSE);
      _warehouse->setEnabled(FALSE);
      _dueDate->setEnabled(FALSE);
      _ordered->setEnabled(FALSE);
      _unitPrice->setEnabled(FALSE);
      _freight->setEnabled(FALSE);
      _notes->setReadOnly(TRUE);
      _comments->setReadOnly(TRUE);
      _project->setEnabled(FALSE);

      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  param = pParams.value("itemsite_id", &valid);
  if (valid)
  {
    _item->setItemsiteid(param.toInt());
    _item->setEnabled(FALSE);
    _warehouse->setEnabled(FALSE);

    q.prepare( "SELECT DISTINCT char_id, char_name,"
               "       COALESCE(b.charass_value, (SELECT c.charass_value FROM charass c WHERE ((c.charass_target_type='I') AND (c.charass_target_id=:item_id) AND (c.charass_default) AND (c.charass_char_id=char_id)) LIMIT 1)) AS charass_value"
               "  FROM charass a, char "
               "    LEFT OUTER JOIN charass b"
               "      ON (b.charass_target_type='PI'"
               "      AND b.charass_target_id=:poitem_id"
               "      AND b.charass_char_id=char_id) "
               " WHERE ( (a.charass_char_id=char_id)"
               "   AND   (a.charass_target_type='I')"
               "   AND   (a.charass_target_id=:item_id) ) "
               " ORDER BY char_name;" );
    q.bindValue(":item_id", _item->id());
    q.bindValue(":poitem_id", _poitemid);
    q.exec();
    int row = 0;
    QModelIndex idx;
    while(q.next())
    {
      _itemchar->insertRow(_itemchar->rowCount());
      idx = _itemchar->index(row, 0);
      _itemchar->setData(idx, q.value("char_name"), Qt::DisplayRole);
      _itemchar->setData(idx, q.value("char_id"), Qt::UserRole);
      idx = _itemchar->index(row, 1);
      _itemchar->setData(idx, q.value("charass_value"), Qt::DisplayRole);
      _itemchar->setData(idx, _item->id(), Qt::UserRole);
      row++;
    }
  }

  param = pParams.value("qty", &valid);
  if (valid)
  {
    _ordered->setText(formatQty(param.toDouble()/_invVendUOMRatio));

    if (_item->isValid())
      sDeterminePrice();

    haveQty = TRUE;
  }

  param = pParams.value("dueDate", &valid);
  if (valid)
  {
    _dueDate->setDate(param.toDate());
    haveDate = TRUE;
  }

  param = pParams.value("prj_id", &valid);
  if (valid)
    _project->setId(param.toInt());

  if(_parentso != -1)
  {
    q.prepare("SELECT coitem_prcost"
              "  FROM coitem"
              " WHERE (coitem_id=:parentso); ");
    q.bindValue(":parentso", _parentso);
    q.exec();
    if(q.first())
    {
      if(q.value("coitem_prcost").toDouble() > 0)
      {
        _overriddenUnitPrice = true;
        _unitPrice->setLocalValue(q.value("coitem_prcost").toDouble());
        sPopulateExtPrice();
      }
    }
  }

  return NoError;
}
Esempio n. 2
0
enum SetResponse itemSubstitute::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("bomitem_id", &valid);
  if (valid)
  {
    _type = cBOMItemSub;
    _bomitemid = param.toInt();
    q.prepare( "SELECT bomitem_item_id "
               "FROM bomitem "
               "WHERE (bomitem_id=:bomitem_id);" );
    q.bindValue(":bomitem_id", _bomitemid);
    q.exec();
    if (q.first())
    {
      _item->setId(q.value("bomitem_item_id").toInt());
      _item->setReadOnly(TRUE);
    }
  }

  param = pParams.value("bomitem_item_id", &valid);
  if (valid)
  {
    _type = cBOMItemSub;
    _item->setId(param.toInt());
    _item->setReadOnly(TRUE);
  }

  param = pParams.value("item_id", &valid);
  if (valid)
  {
    _type = cItemSub;
    _item->setId(param.toInt());
    _item->setReadOnly(TRUE);
  }

  param = pParams.value("itemsub_id", &valid);
  if (valid)
  {
    _type = cItemSub;
    _itemsubid = param.toInt();
    populate();
  }

  param = pParams.value("bomitemsub_id", &valid);
  if (valid)
  {
    _type = cBOMItemSub;
    _itemsubid = param.toInt();

    _item->setEnabled(FALSE);

    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
      _item->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _item->setReadOnly(TRUE);
      _substitute->setReadOnly(TRUE);
      _uomRatio->setEnabled(FALSE);
      _ranking->setEnabled(FALSE);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  return NoError;
}
void
gdu_change_passphrase_dialog_show (GduWindow    *window,
                                   UDisksObject *object)
{
  ChangePassphraseData *data;

  data = g_new0 (ChangePassphraseData, 1);
  data->window = g_object_ref (window);
  data->object = g_object_ref (object);
  data->block = udisks_object_get_block (object);
  g_assert (data->block != NULL);
  data->encrypted = udisks_object_get_encrypted (object);
  g_assert (data->encrypted != NULL);
  data->has_passphrase_in_configuration = has_passphrase_in_configuration (data);

  data->dialog = GTK_WIDGET (gdu_application_new_widget (gdu_window_get_application (window),
                                                         "change-passphrase-dialog.ui",
                                                         "change-passphrase-dialog",
                                                         &data->builder));

  data->infobar_vbox = GTK_WIDGET (gtk_builder_get_object (data->builder, "infobar-vbox"));
  if (data->has_passphrase_in_configuration)
    {
      GtkWidget *infobar;
      infobar = gdu_utils_create_info_bar (GTK_MESSAGE_INFO,
                                           _("Changing the passphrase for this device, will also update the passphrase referenced by the <i>/etc/crypttab</i> file"),
                                           NULL);
      gtk_box_pack_start (GTK_BOX (data->infobar_vbox), infobar, TRUE, TRUE, 0);
    }

  data->existing_passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "existing-passphrase-entry"));
  g_signal_connect (data->existing_passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);

  data->passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "passphrase-entry"));
  g_signal_connect (data->passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);

  data->confirm_passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "confirm-passphrase-entry"));
  g_signal_connect (data->confirm_passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);
  data->show_passphrase_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "show-passphrase-checkbutton"));
  g_signal_connect (data->show_passphrase_checkbutton, "notify::active", G_CALLBACK (on_property_changed), data);

  data->passphrase_strengh_box = GTK_WIDGET (gtk_builder_get_object (data->builder, "passphrase-strength-box"));
  data->passphrase_strengh_widget = gdu_password_strength_widget_new ();
  gtk_widget_set_tooltip_markup (data->passphrase_strengh_widget,
                                 _("The strength of the passphrase"));
  gtk_box_pack_start (GTK_BOX (data->passphrase_strengh_box), data->passphrase_strengh_widget,
                      TRUE, TRUE, 0);


  gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (window));
  gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);

  populate (data);
  update (data);

  /* Retrieve the passphrase from system-level configuration, if applicable */
  if (data->has_passphrase_in_configuration)
    {
      udisks_block_call_get_secret_configuration (data->block,
                                                  g_variant_new ("a{sv}", NULL), /* options */
                                                  NULL, /* cancellable */
                                                  on_get_secret_configuration_cb,
                                                  data);
    }
  else
    {
      run_dialog (data);
    }
}
Esempio n. 4
0
enum SetResponse arOpenItem::set( const ParameterList &pParams )
{
  QVariant param;
  bool     valid;
  
  param = pParams.value("docType", &valid);
  if (valid)
  {
    if (param.toString() == "creditMemo")
    {
      setCaption(caption() + tr(" - Enter Misc. Credit Memo"));
      _docType->setCurrentItem(0);
    }
    else if (param.toString() == "debitMemo")
    {
      setCaption(caption() + tr(" - Enter Misc. Debit Memo"));
      _docType->setCurrentItem(1);
    }
    else if (param.toString() == "invoice")
      _docType->setCurrentItem(2);
    else if (param.toString() == "customerDeposit")
      _docType->setCurrentItem(3);
    else
      return UndefinedError;
//  ToDo - better error return types

    _docType->setEnabled(FALSE);
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      q.exec("SELECT fetchARMemoNumber() AS number;");
      if (q.first())
        _docNumber->setText(q.value("number").toString());
      else if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return UndefinedError;
      }

      _paid->clear();
      _commissionPaid->clear();
      _save->setText(tr("Post"));
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _cust->setReadOnly(TRUE);
      _docDate->setEnabled(FALSE);
      _docType->setEnabled(FALSE);
      _docNumber->setEnabled(FALSE);
      _orderNumber->setEnabled(FALSE);
      _journalNumber->setEnabled(FALSE);
      _terms->setEnabled(FALSE);
      _altPrepaid->setEnabled(FALSE);
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _cust->setReadOnly(TRUE);
      _docDate->setEnabled(FALSE);
      _dueDate->setEnabled(FALSE);
      _docType->setEnabled(FALSE);
      _docNumber->setEnabled(FALSE);
      _orderNumber->setEnabled(FALSE);
      _journalNumber->setEnabled(FALSE);
      _amount->setEnabled(FALSE);
      _terms->setEnabled(FALSE);
      _terms->setType(XComboBox::Terms);
      _salesrep->setEnabled(FALSE);
      _commissionDue->setEnabled(FALSE);
      _commissionPaid->setEnabled(FALSE);
      _rsnCode->setEnabled(FALSE);
      _altPrepaid->setEnabled(FALSE);
      _notes->setReadOnly(TRUE);
      _save->hide();

      _close->setText(tr("&Close"));
    }
    else
      return UndefinedError;
  }
  
  param = pParams.value("aropen_id", &valid);
  if (valid)
  {
    _aropenid = param.toInt();
    populate();
  }

  return NoError;
}
Esempio n. 5
0
void SysSettingsForm::show()
{
	populate();
	QDialog::show();
}
Esempio n. 6
0
enum SetResponse characteristicAssignment::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("item_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "I";
    handleTargetType();
  }

  param = pParams.value("cust_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "C";
    handleTargetType();
  }

  param = pParams.value("crmacct_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "CRMACCT";
    handleTargetType();
  }

  param = pParams.value("addr_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "ADDR";
    handleTargetType();
  }

  param = pParams.value("cntct_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "CNTCT";
    handleTargetType();
  }

  param = pParams.value("custtype_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "CT";
    handleTargetType();
  }

  param = pParams.value("ls_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "LS";
    handleTargetType();
  }

  param = pParams.value("lsreg_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "LSR";
    handleTargetType();
  }

  param = pParams.value("ophead_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "OPP";
    handleTargetType();
  }

  param = pParams.value("emp_id", &valid);
  if (valid)
  {
    _targetId = param.toInt();
    _targetType = "EMP";
    handleTargetType();
  }



  param = pParams.value("charass_id", &valid);
  if (valid)
  {
    _charassid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
      _char->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _char->setEnabled(FALSE);
      _value->setEnabled(FALSE);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  param = pParams.value("showPrices", &valid);
  if (valid)
  {
    _listpriceLit->show();
    _listprice->show();
  }

  param = pParams.value("char_id", &valid);
  if (valid)
  {
    _char->setId(param.toInt());
  }

  return NoError;
}
void MainWindow::start()
{
    mainScreen=new QStackedWidget();
    widget=new QWidget(this);
    widgetKeys=new QWidget(this);
    widget2=new QWidget(this);
    widgetTop=new QWidget(this);
//    camera=new QCameraControllerWidget(this);
    layout=new QGridLayout();
    layout2=new QGridLayout();
    layoutTop=new QGridLayout();
    amount=new QTextEdit(this);
    price=new QTextEdit(this);
    go=new QPushButton(this);
    buy=new QRadioButton(this);
    sell=new QRadioButton(this);
    market = new QComboBox(this);
    exchange = new QComboBox(this);
    exchange->addItem(tr("Bitmarket"));
    exchange->addItem(tr("Bitmaszyna"));
    widget->setLayout(layout);
    widgetTop->setLayout(layoutTop);
    mainScreen->addWidget(widget);
    mainScreen->addWidget(widgetKeys);
//    mainScreen->addWidget(camera);
    mainScreen->setCurrentIndex(0);
    setCentralWidget(mainScreen);
//    setCentralWidget(camera);
    //qview = new QQuickView();
    //qview->setResizeMode(QQuickView::SizeRootObjectToView);
    //qview->rootContext()->setContextProperty("closeView", closeView());
    //qview->setSource(QUrl("qrc:///camera.qml"));
    /*Table model;
    MyModel model2;
    model2.setData(model2.index(0,0), "Data 1", MyModel::price);
    model2.setData(model2.index(0,0), "Data 1", MyModel::amount);
    model2.setData(model2.index(1,0), "Data 2", MyModel::price);
    model2.setData(model2.index(1,0), "Data 2", MyModel::amount);
    qview->engine()->rootContext()->setContextProperty("theModel", &model);
    qview->engine()->rootContext()->setContextProperty("themodel2", &model2);
    qview->setSource(QUrl("qrc:///main.qml"));
    if ((width()==200)||(width()==640)) {
        resize(360,600);
        qview->resize(360,600);
    }*/
    /*QWidget *container = QWidget::createWindowContainer(qview);
    QSize ss;
    ss.setWidth(width());
    ss.setHeight(height());
    container->setMinimumSize(ss);
    container->setMaximumSize(ss);
    container->setFocusPolicy(Qt::TabFocus);
    mainScreen->addWidget(container);*/
    //widgetLayout->addWidget(container);
    //log(QString::number(width()).toStdString());
    //view->show();
    scalex=width()/480.0;
    scaley=height()/800.0;
    font.setPixelSize(12*scaley);
    font2.setPixelSize(16*scaley);
    buy->setChecked(true);
    buy->setText("Kup");
    buy->setFont(font2);
    sell->setText("Sprzedaj");
    sell->setFont(font2);
    go->setText("Wykonaj");
    go->setFont(font2);
    bidtable=makeTable();
    asktable=makeTable();
    populate();
    layout->setContentsMargins(0,0,0,0);
    layout2->setContentsMargins(0,0,0,0);
    layoutTop->setContentsMargins(0,0,0,0);
    widget2->setLayout(layout2);
    widget2->setFixedHeight(70*scaley);
    widgetTop->setFixedHeight(50*scaley);
    buy->setFixedWidth(120*scalex);
    sell->setFixedWidth(120*scalex);
    amount->setFixedWidth(100*scalex);
    amount->setFixedHeight(36*scalex);
    price->setFixedWidth(100*scalex);
    price->setFixedHeight(36*scalex);
    go->setFixedWidth(100*scalex);
    layoutTop->addWidget(exchange,0,0);
    layoutTop->addWidget(market,0,1);
    layout2->addWidget(buy,0,0);
    layout2->addWidget(sell,1,0);
    layout2->addWidget(amount,0,1,2,1);
    layout2->addWidget(price,0,2,2,1);
    layout2->addWidget(go,0,3,2,1);
    layout->addWidget(widgetTop,0,1);
    layout->addWidget(asktable,1,1);
    layout->addWidget(widget2,2,0,1,3);
    layout->addWidget(bidtable,3,1);
    connect(exchange,SIGNAL(currentIndexChanged(int)),this,SLOT(changeEx(int)));
    connect(market,SIGNAL(currentIndexChanged(int)),this,SLOT(changeMarket(int)));
    menu=menuBar()->addMenu(tr("Menu"));
    trade = new QAction(tr("&Trade"), this);
    trade->setStatusTip(tr("Trade"));
    connect(trade, SIGNAL(triggered()), this, SLOT(tradeWindow()));
    menu->addAction(trade);
    keys = new QAction(tr("&Keys"), this);
    keys->setStatusTip(tr("Keys"));
    connect(keys, SIGNAL(triggered()), this, SLOT(keysWindow()));
    menu->addAction(keys);
    exit = new QAction(tr("&Exit"), this);
    exit->setStatusTip(tr("Exit"));
    connect(exit, SIGNAL(triggered()), this, SLOT(quit()));
    menu->addAction(exit);
    /*
    camera=new QCamera(this);
    QCameraViewfinder *camview = new QCameraViewfinder(this);
    camera->setViewfinder(camview);
    mainScreen->addWidget(camview);
    setCentralWidget(camview);
    camera->start();*/
    //keysWindow();
    /*
    Table model;
    QQmlApplicationEngine engine;
    engine.rootContext()->setContextProperty("themodel", &model);
    engine.load(QUrl("qrc:/main.qml"));
    QList<QObject*> temp = engine.rootObjects();
    QObject *topLevel = temp.value(0);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    if ( !window ) {
        qWarning("Error: Your root item has to be a Window.");
        //return -1;
     }
    window->show();*/
    //QZXing qr;
    //log(":"+qr.decodeImageFromFile("qr2.png").toStdString());
    //log(":"+QString::number(qr.getProcessTimeOfLastDecoding()).toStdString());
/*    model=new QStandardItemModel(4, 4);
    for (int row = 0; row < 4; ++row) {
        for (int column = 0; column < 4; ++column) {
            QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
            model->setItem(row, column, item);
        }
    }*/
}
Esempio n. 8
0
enum SetResponse opportunity::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("ophead_id", &valid);
  if (valid)
  {
    _opheadid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    _mode = cNew;

    if (param.toString() == "new")
    {
      connect(_charass, SIGNAL(valid(bool)), _editCharacteristic, SLOT(setEnabled(bool)));
      connect(_charass, SIGNAL(valid(bool)), _deleteCharacteristic, SLOT(setEnabled(bool)));

      _comments->setReadOnly(true);
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      connect(_charass, SIGNAL(valid(bool)), _editCharacteristic, SLOT(setEnabled(bool)));
      connect(_charass, SIGNAL(valid(bool)), _deleteCharacteristic, SLOT(setEnabled(bool)));

      _crmacct->setEnabled(true);
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _crmacct->setEnabled(false);
      _owner->setEnabled(false);
      _oppstage->setEnabled(false);
      _oppsource->setEnabled(false);
      _opptype->setEnabled(false);
      _notes->setReadOnly(true);
      _name->setEnabled(false);
      _targetDate->setEnabled(false);
      _actualDate->setEnabled(false);
      _amount->setEnabled(false);
      _probability->setEnabled(false);
      _deleteTodoItem->setEnabled(false);
      _editTodoItem->setEnabled(false);
      _newTodoItem->setEnabled(false);
      _newCharacteristic->setEnabled(FALSE);

      _save->hide();
      _cancel->setText(tr("&Close"));
      _cancel->setFocus();
      _comments->setReadOnly(true);
    }
  }

  param = pParams.value("crmacct_id", &valid);
  if (valid)
  {
    _crmacct->setId(param.toInt());
    _crmacct->setEnabled(false);
  }

  sHandleTodoPrivs();
  return NoError;
}
Esempio n. 9
0
enum SetResponse creditMemoItem::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;
  bool     vrestrict = FALSE;

  param = pParams.value("cmhead_id", &valid);
  if (valid)
  {
    _cmheadid = param.toInt();
    q.prepare("SELECT cmhead_cust_id, cmhead_shipto_id, "
			  "       cmhead_number, COALESCE(cmhead_invcnumber, '-1') AS cmhead_invcnumber, "
			  "       cmhead_docdate, cmhead_curr_id, "
			  "       cmhead_taxzone_id, cmhead_rsncode_id "
              "FROM cmhead "
              "WHERE (cmhead_id=:cmhead_id);");
    q.bindValue(":cmhead_id", _cmheadid);
    q.exec();
    if (q.first())
    {
      _custid = q.value("cmhead_cust_id").toInt();
      _shiptoid = q.value("cmhead_shipto_id").toInt();
      _orderNumber->setText(q.value("cmhead_number").toString());
	  _invoiceNumber = q.value("cmhead_invcnumber").toInt();
	  if ( (_invoiceNumber != -1) && (_metrics->boolean("RestrictCreditMemos")) )
        vrestrict = TRUE;
      _taxzoneid = q.value("cmhead_taxzone_id").toInt();
      _tax->setId(q.value("cmhead_curr_id").toInt());
      _tax->setEffective(q.value("cmhead_docdate").toDate());
      _netUnitPrice->setId(q.value("cmhead_curr_id").toInt());
      _netUnitPrice->setEffective(q.value("cmhead_docdate").toDate());
      _rsnCode->setId(q.value("cmhead_rsncode_id").toInt());
    }
    else if (q.lastError().type() != QSqlError::NoError)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return UndefinedError;
    }
  }

  param = pParams.value("cmitem_id", &valid);
  if (valid)
  {
    _cmitemid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      q.prepare( "SELECT (COALESCE(MAX(cmitem_linenumber), 0) + 1) AS n_linenumber "
                 "FROM cmitem "
                 "WHERE (cmitem_cmhead_id=:cmhead_id);" );
      q.bindValue(":cmhead_id", _cmheadid);
      q.exec();
      if (q.first())
        _lineNumber->setText(q.value("n_linenumber").toString());
      else if (q.lastError().type() == QSqlError::NoError)
      {
	      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	      return UndefinedError;
      }

      connect(_discountFromSale, SIGNAL(lostFocus()), this, SLOT(sCalculateFromDiscount()));
      connect(_item, SIGNAL(valid(bool)), _listPrices, SLOT(setEnabled(bool)));

      _item->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _item->setReadOnly(TRUE);
      _warehouse->setEnabled(FALSE);
      _qtyReturned->setFocus();

      connect(_discountFromSale, SIGNAL(lostFocus()), this, SLOT(sCalculateFromDiscount()));
      connect(_item, SIGNAL(valid(bool)), _listPrices, SLOT(setEnabled(bool)));

      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _item->setReadOnly(TRUE);
      _warehouse->setEnabled(FALSE);
      _qtyReturned->setEnabled(FALSE);
      _qtyToCredit->setEnabled(FALSE);
      _netUnitPrice->setEnabled(FALSE);
      _discountFromSale->setEnabled(FALSE);
      _comments->setReadOnly(TRUE);
      _taxType->setEnabled(FALSE);
      _rsnCode->setEnabled(FALSE);

      _save->hide();
      _close->setText(tr("&Close"));
      _close->setFocus();
    }
  }

  if (vrestrict)
    _item->setQuery( QString( "SELECT DISTINCT item_id, item_number,"
                              "                (item_descrip1 || ' ' || item_descrip2) AS itemdescrip,"
                              "                item_upccode,"
                              "                item_descrip1, item_descrip2,"
                              "                item_active, item_config, item_type, uom_name, item_upccode "
                              "FROM invchead, invcitem, item, uom "
                              "WHERE ( (invcitem_invchead_id=invchead_id)"
                              " AND (invcitem_item_id=item_id)"
                              " AND (item_inv_uom_id=uom_id)"
                              " AND (invchead_invcnumber='%1') ) "
                              "ORDER BY item_number" )
                     .arg(_invoiceNumber) );
  else
    _item->setQuery( QString( "SELECT DISTINCT item_id, item_number,"
                              "                (item_descrip1 || ' ' || item_descrip2) AS itemdescrip,"
                              "                item_upccode,"
                              "                item_descrip1, item_descrip2,"
                              "                item_active, uom_name, item_type, item_config "
                              "FROM item, itemsite, uom "
                              "WHERE ( (itemsite_item_id=item_id)"
                              " AND (item_inv_uom_id=uom_id)"
                              " AND (itemsite_active)"
                              " AND (item_active)"
                              " AND (customerCanPurchase(item_id, %1, %2)) ) "
                              "ORDER BY item_number" )
                     .arg(_custid).arg(_shiptoid) );

  return NoError;
}
Esempio n. 10
0
enum SetResponse plannedOrder::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("itemsite_id", &valid);
  if (valid)
  {
    _captive = TRUE;

    _item->setItemsiteid(param.toInt());
    _item->setReadOnly(TRUE);
    _warehouse->setEnabled(FALSE);

    _qty->setFocus();
  }
  else
  {
    _captive = FALSE;

    _item->setFocus();
  }

  param = pParams.value("planord_id", &valid);
  if (valid)
  {
    _captive = TRUE;

    _planordid = param.toInt();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      populateFoNumber();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      populate();
      _close->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _number->setEnabled(FALSE);
      _item->setReadOnly(TRUE);
      _warehouse->setEnabled(FALSE);
      _typeGroup->setEnabled(FALSE);
      _qty->setEnabled(FALSE);
      _startDate->setEnabled(FALSE);
      _dueDate->setEnabled(FALSE);
      _leadTimeLit->hide();
      _leadTime->hide();
      _daysLit->hide();

      q.prepare( "SELECT fo_itemsite_id,"
                 "       formatFoNumber(fo_id) AS fonumber,"
                 "       fo_qtyord,"
                 "       fo_startdate, fo_duedate "
                 "FROM fo "
                 "WHERE (fo_id=:fo_id);" );
      q.bindValue(":fo_id", _planordid);
      q.exec();
      if (q.first())
      {
        _number->setText(q.value("fonumber").toString());
        _qty->setDouble(q.value("fo_qtyord").toDouble());
        _startDate->setDate(q.value("fo_startdate").toDate());
        _dueDate->setDate(q.value("fo_duedate").toDate());
        _item->setItemsiteid(q.value("fo_itemsite_id").toInt());
      }
    }
  }

  return NoError;
}
Esempio n. 11
0
enum SetResponse bomItem::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("bomitem_id", &valid);
  if (valid)
  {
    _bomitemid = param.toInt();
    populate();
  }

  param = pParams.value("item_id", &valid);
  if (valid)
    _itemid = param.toInt();

  param = pParams.value("revision_id", &valid);
  if (valid)
    _revisionid = param.toInt();

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
      _booitemseqid = -1;

      QString issueMethod = _metrics->value("DefaultWomatlIssueMethod");
      if (issueMethod == "S")
        _issueMethod->setCurrentItem(0);
      else if (issueMethod == "L")
        _issueMethod->setCurrentItem(1);
      else if (issueMethod == "M")
        _issueMethod->setCurrentItem(2);

      q.exec("SELECT NEXTVAL('bomitem_bomitem_id_seq') AS bomitem_id");
      if (q.first())
        _bomitemid = q.value("bomitem_id").toInt();
      else if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return UndefinedError;
      }
  
      //Set up configuration tab if parent item is configured
      q.prepare("SELECT item_config "
                "FROM item "
                "WHERE (item_id=:item_id); ");
      q.bindValue(":item_id", _itemid);
      q.exec();
      if (q.first())
      {
        if (q.value("item_config").toBool())
          _char->populate(QString( "SELECT -1 AS charass_char_id, '' AS char_name "
                                   "UNION "
                                   "SELECT DISTINCT charass_char_id, char_name "
                                   "FROM charass, char "
                                   "WHERE ((charass_char_id=char_id) "
                                   "AND (charass_target_type='I') "
                                   "AND (charass_target_id= %1)) "
                                   "ORDER BY char_name; ").arg(_itemid));
        else
          _tab->removeTab(_tab->indexOf(_configurationTab));
      }

      _item->setFocus();
    }
    else if (param.toString() == "replace")
    {
      _mode = cReplace;

      _item->setId(-1);
      _dates->setStartDate(omfgThis->dbDate());
      _item->setFocus();

      _sourceBomitemid = _bomitemid;
      q.exec("SELECT NEXTVAL('bomitem_bomitem_id_seq') AS bomitem_id");
      if (q.first())
        _bomitemid = q.value("bomitem_id").toInt();
      else if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return UndefinedError;
      }
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _item->setReadOnly(TRUE);

      _save->setFocus();
    }
    else if (param.toString() == "copy")
    {
      _mode = cCopy;

      _sourceBomitemid = _bomitemid;
      q.exec("SELECT NEXTVAL('bomitem_bomitem_id_seq') AS bomitem_id");
      if (q.first())
        _bomitemid = q.value("bomitem_id").toInt();
      else if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return UndefinedError;
      }

      _dates->setStartDate(omfgThis->dbDate());
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _item->setReadOnly(TRUE);
      _qtyPer->setEnabled(FALSE);
      _scrap->setEnabled(FALSE);
      _dates->setEnabled(FALSE);
      _createWo->setEnabled(FALSE);
      _issueMethod->setEnabled(FALSE);
      _uom->setEnabled(FALSE);
      _booitemList->setEnabled(FALSE);
      _scheduleAtWooper->setEnabled(FALSE);
      _comments->setReadOnly(TRUE);
      _ecn->setEnabled(FALSE);
      _substituteGroup->setEnabled(FALSE);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  return NoError;
}
Esempio n. 12
0
void XComboBox::setType(XComboBoxTypes pType)
{
  if (_type == pType)
    return;

  _type = pType;

  if (_x_metrics == 0)
    return;

  XSqlQuery query;

  switch (pType)
  {
    case Adhoc:
      break;

    case UOMs:
      setAllowNull(TRUE);
      query.exec( "SELECT uom_id, uom_name, uom_name "
                  "FROM uom "
                  "ORDER BY uom_name;" );
    break;

    case ClassCodes:
      query.exec( "SELECT classcode_id, (classcode_code || '-' || classcode_descrip), classcode_code  "
                  "FROM classcode "
                  "ORDER BY classcode_code;" );
      break;

    case ItemGroups:
      query.exec( "SELECT itemgrp_id, itemgrp_name, itemgrp_name "
                  "FROM itemgrp "
                  "ORDER BY itemgrp_name;" );
      break;

    case CostCategories:
      query.exec( "SELECT costcat_id,  (costcat_code || '-' || costcat_descrip), costcat_code "
                  "FROM costcat "
                  "ORDER BY costcat_code;" );
      break;

    case ProductCategories:
      query.exec( "SELECT prodcat_id, (prodcat_code || ' - ' || prodcat_descrip), prodcat_code "
                  "FROM prodcat "
                  "ORDER BY prodcat_code;" );
      break;

    case PlannerCodes:
      query.exec( "SELECT plancode_id, (plancode_code || '-' || plancode_name), plancode_code "
                  "FROM plancode "
                  "ORDER BY plancode_code;" );
      break;

    case CustomerTypes:
      query.exec( "SELECT custtype_id, (custtype_code || '-' || custtype_descrip), custtype_code "
                  "FROM custtype "
                  "ORDER BY custtype_code;" );
      break;

    case CustomerGroups:
      query.exec( "SELECT custgrp_id, custgrp_name, custgrp_name "
                  "FROM custgrp "
                  "ORDER BY custgrp_name;" );
      break;

    case VendorTypes:
      query.exec( "SELECT vendtype_id, (vendtype_code || '-' || vendtype_descrip), vendtype_code "
                  "FROM vendtype "
                  "ORDER BY vendtype_code;" );
      break;

    case VendorGroups:
      query.exec( "SELECT vendgrp_id, vendgrp_name, vendgrp_name "
                  "FROM vendgrp "
                  "ORDER BY vendgrp_name;" );
      break;

    case SalesRepsActive:
      query.exec( "SELECT salesrep_id, (salesrep_number || '-' || salesrep_name), salesrep_number "
                  "FROM salesrep "
                  "WHERE (salesrep_active) "
                  "ORDER by salesrep_number;" );
      break;

    case ShipVias:
      setAllowNull(TRUE);
      setEditable(TRUE);
      query.exec( "SELECT shipvia_id, (shipvia_code || '-' || shipvia_descrip), shipvia_code "
                  "FROM shipvia "
                  "ORDER BY shipvia_code;" );
      break;

    case SalesReps:
      query.exec( "SELECT salesrep_id, (salesrep_number || '-' || salesrep_name), salesrep_number "
                  "FROM salesrep "
                  "ORDER by salesrep_number;" );
      break;

    case ShippingCharges:
      query.exec( "SELECT shipchrg_id, (shipchrg_name || '-' || shipchrg_descrip), shipchrg_name "
                  "FROM shipchrg "
                  "ORDER by shipchrg_name;" );
      break;

    case ShippingForms:
      query.exec( "SELECT shipform_id, shipform_name, shipform_name "
                  "FROM shipform "
                  "ORDER BY shipform_name;" );
      break;

    case Terms:
      query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code "
                  "FROM terms "
                  "ORDER by terms_code;" );
      break;

    case ARTerms:
      query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code "
                  "FROM terms "
                  "WHERE (terms_ar) "
                  "ORDER by terms_code;" );
      break;

    case APTerms:
      query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code "
                  "FROM terms "
                  "WHERE (terms_ap) "
                  "ORDER by terms_code;" );
      break;

    case ARBankAccounts:
      query.exec( "SELECT bankaccnt_id, (bankaccnt_name || '-' || bankaccnt_descrip), bankaccnt_name "
                  "FROM bankaccnt "
                  "WHERE (bankaccnt_ar) "
                  "ORDER BY bankaccnt_name;" );
      break;

    case APBankAccounts:
      query.exec( "SELECT bankaccnt_id, (bankaccnt_name || '-' || bankaccnt_descrip), bankaccnt_name "
                  "FROM bankaccnt "
                  "WHERE (bankaccnt_ap) "
                  "ORDER BY bankaccnt_name;" );
      break;

    case AccountingPeriods:
      query.exec( "SELECT period_id, (formatDate(period_start) || '-' || formatDate(period_end), (formatDate(period_start) || '-' || formatDate(period_end)) "
                  "FROM period "
                  "ORDER BY period_start DESC;" );
      break;

    case FinancialLayouts:
      query.exec( "SELECT flhead_id, flhead_name, flhead_name "
                  "FROM flhead "
                  "WHERE (flhead_active) "
                  "ORDER BY flhead_name;" );
      break;

    case FiscalYears:
      query.exec( "SELECT yearperiod_id, formatdate(yearperiod_start) || '-' || formatdate(yearperiod_end), formatdate(yearperiod_start) || '-' || formatdate(yearperiod_end)"
                  "  FROM yearperiod"
                  " ORDER BY yearperiod_start DESC;" );
      break;

    case SoProjects:
      setAllowNull(TRUE);
      query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number "
                  "FROM prj "
                  "WHERE (prj_so) "
                  "ORDER BY prj_name;" );
      break;

    case WoProjects:
      setAllowNull(TRUE);
      query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number "
                  "FROM prj "
                  "WHERE (prj_wo) "
                  "ORDER BY prj_name;" );
      break;

    case PoProjects:
      setAllowNull(TRUE);
      query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number "
                  "FROM prj "
                  "WHERE (prj_po) "
                  "ORDER BY prj_name;" );
      break;

    case Currencies:
      query.exec( "SELECT curr_id, currConcat(curr_abbr, curr_symbol), curr_abbr"
                  " FROM curr_symbol "
                  "ORDER BY curr_base DESC, curr_abbr;" );
      break;

    case CurrenciesNotBase:
      query.exec( "SELECT curr_id, currConcat(curr_abbr, curr_symbol), curr_abbr"
                  " FROM curr_symbol "
                  " WHERE curr_base = FALSE "
                  "ORDER BY curr_abbr;" );
      break;

    case Companies:
      query.exec( "SELECT company_id, company_number, company_number "
                  "FROM company "
                  "ORDER BY company_number;" );
      break;

    case ProfitCenters:
      setEditable(_x_metrics->boolean("GLFFProfitCenters"));
      query.exec( "SELECT prftcntr_id, prftcntr_number, prftcntr_number "
                  "FROM prftcntr "
                  "ORDER BY prftcntr_number;" );
      break;

    case Subaccounts:
      setEditable(_x_metrics->boolean("GLFFSubaccounts"));
      query.exec( "SELECT subaccnt_id, subaccnt_number, subaccnt_number "
                  "FROM subaccnt "
                  "ORDER BY subaccnt_number;" );
      break;

    case CustomerCommentTypes:
      query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name "
                  "FROM cmnttype "
                  "WHERE (strpos(cmnttype_usedin, 'C')>0)"
                  "ORDER BY cmnttype_name;" );
      break;

    case VendorCommentTypes:
      query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name "
                  "FROM cmnttype "
                  "WHERE (strpos(cmnttype_usedin, 'V')>0)"
                  "ORDER BY cmnttype_name;" );
      break;

    case ItemCommentTypes:
      query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name "
                  "FROM cmnttype "
                  "WHERE (strpos(cmnttype_usedin, 'I')>0)"
                  "ORDER BY cmnttype_name;" );
      break;

    case ProjectCommentTypes:
      query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name "
                  "FROM cmnttype "
                  "WHERE (strpos(cmnttype_usedin, 'J')>0)"
                  "ORDER BY cmnttype_name;" );
      break;

    case LotSerialCommentTypes:
      query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name "
                  "FROM cmnttype "
                  "WHERE (strpos(cmnttype_usedin, 'L')>0)"
                  "ORDER BY cmnttype_name;" );
      break;

    case AllCommentTypes:
      query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name "
                  "FROM cmnttype "
                  "ORDER BY cmnttype_name;" );
      break;

    case AllProjects:
      query.exec( "SELECT prj_id, prj_name, prj_name "
                  "FROM prj "
                  "ORDER BY prj_name;" );
      break;

    case Users:
      query.exec( "SELECT usr_id, usr_username, usr_username "
                  "FROM usr "
                  "ORDER BY usr_username;" );
      break;

    case SalesCategories:
      query.exec( "SELECT salescat_id, (salescat_name || '-' || salescat_descrip), salescat_name "
                  "FROM salescat "
                  "ORDER BY salescat_name;" );
      break;

    case ExpenseCategories:
      query.exec( "SELECT expcat_id, (expcat_code || '-' || expcat_descrip), expcat_code "
                  "FROM expcat "
                  "ORDER BY expcat_code;" );
      break;

    case ReasonCodes:
      query.exec( "SELECT rsncode_id, (rsncode_code || '-' || rsncode_descrip), rsncode_code"
                  "  FROM rsncode "
                  "ORDER BY rsncode_code;" );
      break;

    case TaxCodes:
      query.exec( "SELECT tax_id, (tax_code || '-' || tax_descrip), tax_code"
                  "  FROM tax "
                  "ORDER BY tax_code;" );
      break;

    case WorkCenters:
      query.exec( "SELECT wrkcnt_id, (wrkcnt_code || '-' || wrkcnt_descrip), wrkcnt_code"
                  "  FROM wrkcnt "
                  "ORDER BY wrkcnt_code;" );
      break;

    case CRMAccounts:
      setAllowNull(TRUE);
      query.exec( "SELECT crmacct_id, (crmacct_number || '-' || crmacct_name), crmacct_number"
                  "  FROM crmacct "
                  "ORDER BY crmacct_number;" );
      break;

    case Honorifics:
      setAllowNull(TRUE);
      query.exec( "SELECT hnfc_id, hnfc_code, hnfc_code"
                  "  FROM hnfc "
                  "ORDER BY hnfc_code;" );
      break;

    case IncidentSeverity:
      query.exec( "SELECT incdtseverity_id, incdtseverity_name, incdtseverity_name"
                  "  FROM incdtseverity"
                  " ORDER BY incdtseverity_order, incdtseverity_name;" );
      break;

    case IncidentPriority:
      query.exec( "SELECT incdtpriority_id, incdtpriority_name, incdtpriority_name"
                  "  FROM incdtpriority"
                  " ORDER BY incdtpriority_order, incdtpriority_name;" );
      break;

    case IncidentResolution:
      query.exec( "SELECT incdtresolution_id, incdtresolution_name, incdtresolution_name"
                  "  FROM incdtresolution"
                  " ORDER BY incdtresolution_order, incdtresolution_name;" );
      break;

    case IncidentCategory:
      query.exec( "SELECT incdtcat_id, incdtcat_name, incdtcat_name"
                  "  FROM incdtcat"
                  " ORDER BY incdtcat_order, incdtcat_name;" );
      break;

    case TaxAuths:
      query.exec( "SELECT taxauth_id, taxauth_code, taxauth_code"
                  "  FROM taxauth"
                  " ORDER BY taxauth_code;" );
      break;

    case TaxTypes:
      query.exec( "SELECT taxtype_id, taxtype_name, taxtype_name"
                  "  FROM taxtype"
                  " ORDER BY taxtype_name;" );
      break;

    case Agent:
      query.exec( "SELECT usr_id, usr_username, usr_username "
                  "  FROM usr"
                  " WHERE (usr_agent) "
                  " ORDER BY usr_username;" );
      break;

    case Reports:
      query.exec( "SELECT a.report_id, a.report_name, a.report_name "
                  "FROM report a, "
                  "    (SELECT MIN(report_grade) AS report_grade, report_name "
                  "     FROM report "
                  "     GROUP BY report_name) b "
                  "WHERE ((a.report_name=b.report_name)"
                  "  AND  (a.report_grade=b.report_grade)) "
                  "ORDER BY report_name;" );
      break;

    case OpportunityStages:
      query.exec("SELECT opstage_id, opstage_name, opstage_name "
                 "  FROM opstage"
                 " ORDER BY opstage_order;");
      break;

    case OpportunitySources:
      query.exec("SELECT opsource_id, opsource_name, opsource_name "
                 "  FROM opsource;");
      break;

    case OpportunityTypes:
      query.exec("SELECT optype_id, optype_name, optype_name "
                 "  FROM optype;");
      break;

    case Locales:
      query.exec("SELECT locale_id, locale_code, locale_code "
                 "  FROM locale"
                 " ORDER BY locale_code;");
      break;

    case LocaleLanguages:
      query.exec("SELECT lang_id, lang_name, lang_name "
                 "  FROM lang"
                 " WHERE lang_qt_number IS NOT NULL"
                 " ORDER BY lang_name;");
      break;

    case Countries:
      query.exec("SELECT country_id, country_name, country_name "
                 "  FROM country"
                 " ORDER BY country_name;");
      break;

    case LocaleCountries:
      query.exec("SELECT country_id, country_name, country_name "
                 "  FROM country"
                 " WHERE country_qt_number IS NOT NULL"
                 " ORDER BY country_name;");
      break;
      
    case RegistrationTypes:
      query.exec("SELECT regtype_id, regtype_code, regtype_code "
                 "  FROM regtype"
                 " ORDER BY regtype_code;");
      break;

  }

  populate(query);

  switch (pType)
  {
    case SoProjects:
    case WoProjects:
    case PoProjects:
      setEnabled(count() > 1);
      break;

    case Currencies:
      if (count() <= 1)
      {
        hide();
        if (_label)
          _label->hide();
      }
      break;

    case CurrenciesNotBase:
      if (count() < 1)
      {
        hide();
        if (_label)
          _label->hide();
      }
      break;

    default:
      break;
  }
}
Esempio n. 13
0
enum SetResponse voucher::set(const ParameterList &pParams)
{
  XWidget::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      q.exec("SELECT NEXTVAL('vohead_vohead_id_seq') AS vohead_id");
      if (q.first())
        _voheadid = q.value("vohead_id").toInt();
      else
      {
        systemError(this, tr("A System Error occurred at %1::%2.")
                          .arg(__FILE__)
                          .arg(__LINE__) );
        return UndefinedError;
      }

      if (_metrics->value("VoucherNumberGeneration") == "A")
      {
        populateNumber();
        _poNumber->setFocus();
      }
      else
        _voucherNumber->setFocus();

      q.prepare("INSERT INTO vohead (vohead_id,   vohead_number, vohead_posted)"
		"            VALUES (:vohead_id, :vohead_number, false);" );
      q.bindValue(":vohead_id",     _voheadid);
      q.bindValue(":vohead_number", _voucherNumber->text());
      q.exec();
      if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return UndefinedError;
      }
      enableWindowModifiedSetting();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _voucherNumber->setEnabled(FALSE);
      _poNumber->setEnabled(FALSE);
      _poNumber->setListVisible(false);

      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _poNumber->setAllowedStatuses(OrderLineEdit::AnyStatus);
 
      _voucherNumber->setEnabled(FALSE);
      _poNumber->setEnabled(FALSE);
      _poNumber->setListVisible(false);
      _taxzone->setEnabled(FALSE);
      _amountToDistribute->setEnabled(FALSE);
      _distributionDate->setEnabled(FALSE);
      _invoiceDate->setEnabled(FALSE);
      _dueDate->setEnabled(FALSE);
      _invoiceNum->setEnabled(FALSE);
      _reference->setEnabled(FALSE);
      _poitem->setEnabled(FALSE);
      _distributions->setEnabled(FALSE);
      _miscDistrib->setEnabled(FALSE);
      _new->setEnabled(FALSE);
      _terms->setEnabled(FALSE);
      _terms->setType(XComboBox::Terms);
      _flagFor1099->setEnabled(FALSE);
      _distributeall->setEnabled(FALSE);
      _notes->setEnabled(false);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
      disconnect(_poNumber, SIGNAL(valid(bool)), _distributeall, SLOT(setEnabled(bool)));
    }
  }

  param = pParams.value("pohead_id", &valid);
  if (valid)
    _poNumber->setId(param.toInt(), "PO");

  param = pParams.value("vohead_id", &valid);
  if (valid)
  {
    _voheadid = param.toInt();
    populate();
    enableWindowModifiedSetting();
  }

  return NoError;
}
Esempio n. 14
0
enum SetResponse warehouse::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("warehous_id", &valid);
  if (valid)
  {
    _warehousid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
      _code->setFocus();

      q.exec("SELECT NEXTVAL('warehous_warehous_id_seq') AS warehous_id");
      if (q.first())
        _warehousid = q.value("warehous_id").toInt();
      else if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return UndefinedError;
      }

      connect(_whsezone, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
      connect(_whsezone, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
      connect(_whsezone, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));

      _taxauth->setId(_metrics->value("DefaultTaxAuthority").toInt());
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _description->setFocus();

      connect(_whsezone, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
      connect(_whsezone, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
      connect(_whsezone, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _code->setEnabled(FALSE);
      _sitetype->setEnabled(FALSE);
      _active->setEnabled(FALSE);
      _description->setEnabled(FALSE);
      _contact->setEnabled(FALSE);
      _address->setEnabled(FALSE);
      _defaultFOB->setEnabled(FALSE);
      _bolPrefix->setEnabled(FALSE);
      _bolNumber->setEnabled(FALSE);
      _shipping->setEnabled(FALSE);
      _countTagPrefix->setEnabled(FALSE);
      _countTagNumber->setEnabled(FALSE);
      _useSlips->setEnabled(FALSE);
      _arblGroup->setEnabled(FALSE);
      _useZones->setEnabled(FALSE);
      _new->setEnabled(FALSE);
      _account->setEnabled(FALSE);
      _shipcomm->setEnabled(FALSE);
      _taxauth->setEnabled(FALSE);
      _comments->setReadOnly(TRUE);
      _transit->setEnabled(FALSE);
      _shipform->setEnabled(FALSE);
      _shipvia->setEnabled(FALSE);
      _shipcomments->setEnabled(FALSE);

      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  return NoError;
}
Esempio n. 15
0
enum SetResponse group::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("grp_id", &valid);
  if (valid)
  {
    _grpid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      q.exec("SELECT NEXTVAL('grp_grp_id_seq') AS grp_id;");
      if (q.first())
        _grpid = q.value("grp_id").toInt();
      else if (q.lastError().type() != QSqlError::NoError)
      {
        systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
        return UndefinedError;
      }

      _mode = cNew;
      _trapClose = true;
      q.exec("BEGIN;");
      q.prepare( "INSERT INTO grp "
                 "( grp_id, grp_name, grp_descrip)"
                 "VALUES( :grp_id, :grp_id, '' );" );
      q.bindValue(":grp_id", _grpid);
      q.exec();
      if (q.lastError().type() != QSqlError::NoError)
      {
        systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
        q.exec("ROLLBACK;");
        _trapClose = false;
        return UndefinedError;
      }

      _module->setCurrentIndex(0);
      sModuleSelected(_module->itemText(0));
      _name->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _name->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _name->setEnabled(FALSE);
      _description->setEnabled(FALSE);
      _addAll->setEnabled(FALSE);
      _revokeAll->setEnabled(FALSE);
      disconnect(_available, SIGNAL(itemSelected(int)), this, SLOT(sAdd()));
      disconnect(_available, SIGNAL(valid(bool)), _add, SLOT(setEnabled(bool)));
      disconnect(_granted, SIGNAL(itemSelected(int)), this, SLOT(sRevoke()));
      disconnect(_granted, SIGNAL(valid(bool)), _revoke, SLOT(setEnabled(bool)));
      _save->hide();
      _close->setText(tr("&Close"));
      _close->setFocus();
    }
  }
Esempio n. 16
0
enum SetResponse opportunity::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("ophead_id", &valid);
  if (valid)
  {
    _opheadid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      connect(_charass, SIGNAL(valid(bool)), _editCharacteristic, SLOT(setEnabled(bool)));
      connect(_charass, SIGNAL(valid(bool)), _deleteCharacteristic, SLOT(setEnabled(bool)));

      _comments->setReadOnly(true);
      _documents->setReadOnly(true);
      
      param = pParams.value("crmacct_id", &valid);
      if (valid)
        _crmacct->setId(param.toInt());

      _startDate->setDate(omfgThis->dbDate());

      q.exec("SELECT NEXTVAL('ophead_ophead_id_seq') AS result;");
      if (q.first())
      {
        _opheadid = q.value("result").toInt();
        _number->setText(QString().number(_opheadid));
      }
      else if(q.lastError().type() != QSqlError::NoError)
      {
        systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      }
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      connect(_charass, SIGNAL(valid(bool)), _editCharacteristic, SLOT(setEnabled(bool)));
      connect(_charass, SIGNAL(valid(bool)), _deleteCharacteristic, SLOT(setEnabled(bool)));

      _crmacct->setEnabled(true);
      _buttonBox->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _crmacct->setEnabled(false);
      _owner->setEnabled(false);
      _oppstage->setEnabled(false);
      _oppsource->setEnabled(false);
      _opptype->setEnabled(false);
      _notes->setReadOnly(true);
      _name->setEnabled(false);
      _targetDate->setEnabled(false);
      _actualDate->setEnabled(false);
      _amount->setEnabled(false);
      _probability->setEnabled(false);
      _deleteTodoItem->setEnabled(false);
      _editTodoItem->setEnabled(false);
      _newTodoItem->setEnabled(false);
      _deleteSale->setEnabled(false);
      _editSale->setEnabled(false);
      _printSale->setEnabled(false);
      _newSale->setEnabled(false);
      _attachSale->setEnabled(false);
      _newCharacteristic->setEnabled(FALSE);

      _buttonBox->setStandardButtons(QDialogButtonBox::Close);
      _cntct->setReadOnly(true);
      _comments->setReadOnly(true);
      _documents->setReadOnly(true);
    }
  }

  param = pParams.value("crmacct_id", &valid);
  if (valid)
  {
    _crmacct->setId(param.toInt());
    _crmacct->setEnabled(false);
  }

  sHandleTodoPrivs();
  sHandleSalesPrivs();
  return NoError;
}
Esempio n. 17
0
enum SetResponse itemPricingSchedule::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      _name->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _save->setFocus();
    }
    else if (param.toString() == "copy")
    {
      _mode = cCopy;

      _name->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _name->setEnabled(FALSE);
      _descrip->setEnabled(FALSE);
      _dates->setEnabled(FALSE);
      _currency->setEnabled(FALSE);
      _new->setEnabled(FALSE);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  param = pParams.value("ipshead_id", &valid);
  if (valid)
  {
    _ipsheadid = param.toInt();
    populate();
  }

  if ( (_mode == cNew) || (_mode == cEdit) || (_mode == cCopy) )
  {
    connect(_ipsitem, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_ipsitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_ipsitem, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }

  if ( (_mode == cNew) || (_mode == cCopy) )
  {
    int oldIpsheadid = _ipsheadid;
    q.exec("SELECT NEXTVAL('ipshead_ipshead_id_seq') AS ipshead_id;");
    if (q.first())
      _ipsheadid = q.value("ipshead_id").toInt();
    else if (q.lastError().type() != QSqlError::None)
    {
	systemError(this, _rejectedMsg.arg(q.lastError().databaseText()),
                  __FILE__, __LINE__);
        reject();
        return UndefinedError;
    }

    if(_mode == cCopy)
    {
      q.prepare(" INSERT "
                "   INTO ipsitem "
                "       (ipsitem_ipshead_id, ipsitem_item_id, "
                "        ipsitem_qtybreak, ipsitem_price,"
                "        ipsitem_qty_uom_id, ipsitem_price_uom_id) "
                " SELECT :ipshead_id, ipsitem_item_id, "
                "        ipsitem_qtybreak, ipsitem_price,"
                "        ipsitem_qty_uom_id, ipsitem_price_uom_id "
                "   FROM ipsitem "
                "  WHERE (ipsitem_ipshead_id=:oldipshead_id); "
                " INSERT "
                "   INTO ipsprodcat "
                "       (ipsprodcat_ipshead_id, ipsprodcat_prodcat_id, "
                "        ipsprodcat_qtybreak, ipsprodcat_discntprcnt) "
                " SELECT :ipshead_id, ipsprodcat_prodcat_id, "
                "        ipsprodcat_qtybreak, ipsprodcat_discntprcnt "
                "   FROM ipsprodcat "
                "  WHERE (ipsprodcat_ipshead_id=:oldipshead_id); ");
      q.bindValue(":ipshead_id", _ipsheadid);
      q.bindValue(":oldipshead_id", oldIpsheadid);
      q.exec();
      if (q.lastError().type() != QSqlError::None)
      {
        systemError(this, _rejectedMsg.arg(q.lastError().databaseText()),
                    __FILE__, __LINE__);
        reject();
        return UndefinedError;
      }
    }
  }

  return NoError;
}
Esempio n. 18
0
enum SetResponse sysLocale::set(ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("locale_id", &valid);
  if (valid)
  {
    _localeid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
      _code->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _description->setFocus();
    }
    else if (param.toString() == "copy")
    {
      _mode = cCopy;

      q.prepare("SELECT copyLocale(:locale_id) AS _locale_id;");
      q.bindValue(":locale_id", _localeid);
      q.exec();
      if (q.first())
      {
        _localeid = q.value("_locale_id").toInt();
	populate();
      }
      else if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
        return UndefinedError;
      }

      _code->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _code->setEnabled(FALSE);
      _description->setEnabled(FALSE);
      _language->setEnabled(FALSE);
      _country->setEnabled(FALSE);
      _currencyScale->setEnabled(FALSE);
      _salesPriceScale->setEnabled(FALSE);
      _purchPriceScale->setEnabled(FALSE);
      _extPriceScale->setEnabled(FALSE);
      _costScale->setEnabled(FALSE);
      _qtyScale->setEnabled(FALSE);
      _qtyPerScale->setEnabled(FALSE);
      _uomRatioScale->setEnabled(FALSE);
      _comments->setReadOnly(TRUE);
      _close->setText(tr("&Close"));
      _save->hide();
      
      _close->setFocus();
    }
  }

  return NoError;
}
Esempio n. 19
0
enum SetResponse financialLayoutItem::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("flhead_id", &valid);
  if (valid)
  {
    _flheadid = param.toInt();
    sFillGroupList();
  }

  param = pParams.value("flgrp_id", &valid);
  if (valid)
    _flgrpid = param.toInt();

  param = pParams.value("flitem_id", &valid);
  if (valid)
  {
    _flitemid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _save->setHidden(TRUE);
      _close->setText(tr("Close"));
      _selectAccount->setEnabled(FALSE);
	  _selectSegment->setEnabled(FALSE);
	  _operationGroup->setEnabled(FALSE);
	  _showColumns->setEnabled(FALSE);
	  _showPrcnt->setEnabled(FALSE);
	  _group->setEnabled(FALSE);
	  _showCustom->setEnabled(FALSE);
      _close->setFocus();
    }
  }
  param = pParams.value("type", &valid);
    if (valid)
    {
    
        if (param.toString() == "adHoc")
        {
   			_rpttype = cAdHoc;
   			_showPrcnt->setHidden(TRUE);
   		}
		else
		{
			_showColumns->setHidden(TRUE);
			_showCustom->setHidden(TRUE);
		}
		
        if (param.toString() == "income")
        {
        	_rpttype = cIncome;	
   			_showBeginning->setChecked(FALSE);
			_showEnding->setChecked(FALSE);
			_showDB->setChecked(FALSE);
			_showBudget->setChecked(TRUE);
			_showDiff->setChecked(TRUE);
			_showCustom->setChecked(FALSE);
        }
        else if (param.toString() == "balance")
        {
            _rpttype = cBalance;
   			_showBeginning->setChecked(FALSE);
			_showEnding->setChecked(TRUE);
			_showDB->setChecked(FALSE);
			_showBudget->setChecked(TRUE);
			_showDiff->setChecked(TRUE);
			_showCustom->setChecked(FALSE);
        }
        else if (param.toString() == "cash")
        {
			_rpttype = cCash;
   			_showBeginning->setChecked(FALSE);
			_showEnding->setChecked(FALSE);
			_showDB->setChecked(TRUE);
			_showBudget->setChecked(TRUE);
			_showDiff->setChecked(TRUE);
			_showCustom->setChecked(FALSE);
		}
    }

  return NoError;
}
Esempio n. 20
0
enum SetResponse characteristic::set(const ParameterList &pParams)
{
  XSqlQuery characteristicet;
  XDialog::set(pParams);
  QVariant param;
  bool     valid;
  
  param = pParams.value("char_id", &valid);
  if (valid)
  {
    _charid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      characteristicet.exec("SELECT NEXTVAL('char_char_id_seq') AS char_id;");
      if (characteristicet.first())
        _charid = characteristicet.value("char_id").toInt();

      sFillList();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
// TODO
//      _mask->setEnabled(FALSE);
//      _validator->setEnabled(FALSE);
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _name->setEnabled(false);
      _search->setEnabled(false);
      _useGroup->setEnabled(false);
      _order->setEnabled(false);
      _mask->setEnabled(false);
      _validator->setEnabled(false);

      _items->setEnabled(false);
      _customers->setEnabled(false);
      _lotSerial->setEnabled(false);
      _addresses->setEnabled(false);
      _crmaccounts->setEnabled(false);
      _contacts->setEnabled(false);
      _opportunity->setEnabled(false);
      _employees->setEnabled(false);
      _incidents->setEnabled(false);
      _quotes->setEnabled(false);
      _salesorders->setEnabled(false);
      _invoices->setEnabled(false);
      _vendors->setEnabled(false);
      _purchaseorders->setEnabled(false);
      _vouchers->setEnabled(false);

      _buttonBox->clear();
      _buttonBox->addButton(QDialogButtonBox::Close);
    }
  }

  return NoError;
}
Esempio n. 21
0
/**
  * @brief Inizializzazione del nucleo.
  * @return void.
 */ 
int main(void)
{
	pcb_t *init;
	int i;

	/* Popolazione delle 4 nuove aree nella ROM Reserved Frame */
	
	/*	SYS/BP Exception Handling	*/
	populate(SYSBK_NEWAREA, (memaddr) sysBpHandler);
	
	/*	PgmTrap Exception Handling	*/
	populate(PGMTRAP_NEWAREA, (memaddr) pgmTrapHandler);
	
	/*	TLB Exception Handling		*/
	populate(TLB_NEWAREA, (memaddr) tlbHandler);
	
	/*	Interrupt Exception Handling	*/
	populate(INT_NEWAREA, (memaddr) intHandler);

	/* Inizializzazione delle strutture dati del livello 2 (phase1) */
	initPcbs();
	initSemd();
	
	/* Inizializzazione delle variabili globali */
	mkEmptyProcQ(&readyQueue);
	currentProcess = NULL;
	processCount = softBlockCount = pidCount = 0;
	timerTick = 0;
	
	/* Inizializzazione della tabella dei pcb utilizzati */
	for(i=0; i<MAXPROC; i++)
	{
		pcbused_table[i].pid = 0;
		pcbused_table[i].pcb = NULL;
	}
	
	/* Inizializzazione dei semafori dei device */
	for(i=0; i<DEV_PER_INT; i++)
	{
		sem.disk[i] = 0;
		sem.tape[i] = 0;
		sem.network[i] = 0;
		sem.printer[i] = 0;
		sem.terminalR[i] = 0;
		sem.terminalT[i] = 0;
	}
	
	/* Inizializzazione del semaforo dello pseudo-clock */
	pseudo_clock = 0;
	
	/* Inizializzazione del primo processo (init) */
	/* Se il primo processo (init) non viene creato, PANIC() */
	if((init = allocPcb()) == NULL)
		PANIC();
	
	/* Interrupt attivati e smascherati, Memoria Virtuale spenta, Kernel-Mode attivo */
	init->p_state.status = (init->p_state.status | STATUS_IEp | STATUS_INT_UNMASKED | STATUS_KUc) & ~STATUS_VMp;
	
	/* Il registro SP viene inizializzato a RAMTOP-FRAMESIZE */
	init->p_state.reg_sp = RAMTOP - FRAME_SIZE;
	
	/* PC inizializzato all'indirizzo di test() */
	init->p_state.pc_epc = init->p_state.reg_t9 = (memaddr)test;
	
	/* Il PID impostato per init è 1 */
	pidCount++;
	init->p_pid = pidCount;
	
	/* Aggiorna la tabella dei pcb utilizzati, assegnando il giusto pid e il puntatore al pcb di init */
	pcbused_table[0].pid = init->p_pid;
	pcbused_table[0].pcb = init;

	/* Inserisce init nella coda di processi Ready */
	insertProcQ(&readyQueue, init);
	
	processCount++;
	
	/* Avvio il tempo per il calcolo dello pseudo-clock tick */
	startTimerTick = GET_TODLOW;
	
	scheduler();
	
	return 0;
}
Esempio n. 22
0
// 
// main
//
// Run a game of life simulation.
//
int main() {
  int i, g, rows, cols;
  int div;
  
  // The first several lines take input parameters
  // for the game.
  //
  printf("Welcome to the Game of Life.\n");
  printf("How many generations would you like to watch? ");
  scanf("%d", &g);
  printf("Enter the width of the board: ");
  scanf("%d", &cols);
  printf("Enter the height of the board: ");
  scanf("%d", &rows);
  
  // Define our grids: G is our main grid, and T is our
  // temp grid. We also print the initial state of the grid
  // before actually running the simulation.
  //
  grid *G = initGrid(rows, cols);
  grid *T = initGrid(rows, cols);
  populate(G);
  printGrid(G);
  mgridUpdate(T, G, G->rows, 0);  

  // Gets the desired number of threads from the user -- we repeatedly
  // ask for a number until we get a divisor of rows. Once we know how
  // many threads there will be, we initialize the barrier.
  //
  printf("Please enter a divisor of %d to determine the number of threads: ", rows);
  scanf("%d", &div);
  while (rows % div != 0) {
    printf("I'm sorry, %d does not divide %d. Please choose a divisor of %d: ", div, rows, rows);
    scanf("%d", &div);
  }

  barrier_init(&barr, div);
  
  // Creates an array of tinfo structs and
  // pthreads. We then place the necessary 
  // info into each tinfo struct.
  //
  tinfo **I = malloc(div*sizeof(tinfo));
  pthread_t threads[div];
  
  for (i=0; i<div; i++) {
    I[i] = initTinfo();
    I[i]->in = G;
    I[i]->out = T;
    I[i]->section = i;
    I[i]->divide = div;
    I[i]->gen = g;
  }
  
  // Initialize a number of threads. Each thread works on a portion of our
  // grid -- which portion it works on is decided by the I[i] tinfo struct.
  //  
  for (i=0; i<div; i++) {
    pthread_create(&threads[i], NULL, &mFunc, (void *)I[i]);
  }

  // My implementation requires join, because the main thread
  // must wait for all of the child threads to complete before
  // destroying the barrier and printing the final grid.
  //
  for (i=0; i<div; i++) {
    pthread_join(threads[i], NULL);
  }
  
  // Destroy the barrier, print the final generation.
  //
  barrier_destroy(&barr);
  printGrid(G);

  return 0;
}
Esempio n. 23
0
enum SetResponse task::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("prj_id", &valid);
  if (valid)
    _prjid = param.toInt();

  param = pParams.value("prj_owner_username", &valid);
  if (valid)
    _owner->setUsername(param.toString());

  param = pParams.value("prj_usr_id", &valid);
  if (valid)
    _assignedTo->setId(param.toInt());

  param = pParams.value("prj_start_date", &valid);
  if (valid)
    _started->setDate(param.toDate());

  param = pParams.value("prj_assigned_date", &valid);
  if (valid)
    _assigned->setDate(param.toDate());

  param = pParams.value("prj_due_date", &valid);
  if (valid)
    _due->setDate(param.toDate());

  param = pParams.value("prj_completed_date", &valid);
  if (valid)
    _completed->setDate(param.toDate());

  param = pParams.value("prjtask_id", &valid);
  if (valid)
  {
    _prjtaskid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      q.exec("SELECT NEXTVAL('prjtask_prjtask_id_seq') AS prjtask_id;");
      if (q.first())
        _prjtaskid = q.value("prjtask_id").toInt();
      else
      {
        systemError(this, tr("A System Error occurred at %1::%2.")
                          .arg(__FILE__)
                          .arg(__LINE__) );
      }

      _alarms->setId(_prjtaskid);
    }
    if (param.toString() == "edit")
    {
      _mode = cEdit;

      _save->setFocus();
    }
    if (param.toString() == "view")
    {
      _mode = cView;

      _number->setEnabled(false);
      _name->setEnabled(false);
      _descrip->setEnabled(false);
      _status->setEnabled(false);
      _budgetHours->setEnabled(false);
      _actualHours->setEnabled(false);
      _budgetExp->setEnabled(false);
      _actualExp->setEnabled(false);
      _owner->setEnabled(false);
      _assignedTo->setEnabled(false);
      _due->setEnabled(false);
      _assigned->setEnabled(false);
      _started->setEnabled(false);
      _completed->setEnabled(false);
      _alarms->setEnabled(false);
      _save->hide();
    }
  }

  return NoError;
}
Esempio n. 24
0
void __fastcall TfrmRetrieveMain::CmbAliquot2DropDown( TObject *Sender ) {
	populate( CmbAliquot2, CmbAliquot1 );
}
Esempio n. 25
0
int SysSettingsForm::exec()
{
	populate();
	return QDialog::exec();
}
Esempio n. 26
0
enum SetResponse prospect::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("crmacct_name", &valid);
  if (valid)
    _name->setText(param.toString());

  param = pParams.value("crmacct_number", &valid);
  if (valid)
    _number->setText(param.toString());

  param = pParams.value("crmacct_id", &valid);
  if (valid)
  {
    _crmacct->setId(param.toInt());
  }

  param = pParams.value("prospect_id", &valid);
  if (valid)
  {
    _prospectid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      // prospects and customers share an id sequence
      q.exec("SELECT NEXTVAL('cust_cust_id_seq') AS prospect_id;");
      if (q.first())
      {
        _prospectid = q.value("prospect_id").toInt();
	_number->setFocus();
      }
      else
      {
        systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
        return UndefinedError;
      }

      if(((_metrics->value("CRMAccountNumberGeneration") == "A") ||
          (_metrics->value("CRMAccountNumberGeneration") == "O"))
       && _number->text().isEmpty() )
      {
        q.exec("SELECT fetchCRMAccountNumber() AS number;");
        if (q.first())
        {
          _number->setText(q.value("number"));
          _NumberGen = q.value("number").toInt();
        }


      }

    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _number->setEnabled(FALSE);
      _name->setEnabled(FALSE);
      _active->setEnabled(FALSE);
      _contact->setEnabled(FALSE);
      _taxauth->setEnabled(FALSE);
      _notes->setReadOnly(TRUE);
      _newQuote->setEnabled(FALSE);
      _save->hide();

      disconnect(_quotes, SIGNAL(itemSelected(int)), _editQuote, SLOT(animateClick(QMenu*)));
      disconnect(_quotes, SIGNAL(valid(bool)),       _editQuote, SLOT(setEnabled(bool)));
      disconnect(_quotes, SIGNAL(valid(bool)),       _editQuote, SLOT(setEnabled(bool)));
      disconnect(_quotes, SIGNAL(valid(bool)),     _deleteQuote, SLOT(setEnabled(bool)));

      connect(_quotes, SIGNAL(itemSelected(int)), _viewQuote, SLOT(animateClick(QMenu*)));

      _close->setText(tr("&Close"));
      _close->setFocus();
    }
  }

  if(_metrics->value("CRMAccountNumberGeneration") == "A")
    _number->setEnabled(FALSE);
  
  return NoError;
}
Esempio n. 27
0
enum SetResponse workCenter::set(ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("wrkcnt_id", &valid);
  if (valid)
  {
    _wrkcntid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
      _code->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _description->setFocus();
    }
    else if (param.toString() == "copy")
    {
      _mode = cNew;
      _code->clear();
      _code->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _code->setEnabled(FALSE);
      _description->setEnabled(FALSE);
      _department->setEnabled(FALSE);
      _warehouse->setEnabled(FALSE);
      _wipLocation->setEnabled(FALSE);
      _numOfMachines->setEnabled(FALSE);
      _numOfPeople->setEnabled(FALSE);
      _setupSpecifyRate->setEnabled(FALSE);
      _setupUseSelectedRate->setEnabled(FALSE);
      _setupRate->setEnabled(FALSE);
      _stdSetupRate->setEnabled(FALSE);
      _setupType->setEnabled(FALSE);
      _runSpecifyRate->setEnabled(FALSE);
      _runUseSelectedRate->setEnabled(FALSE);
      _runRate->setEnabled(FALSE);
      _stdRunRate->setEnabled(FALSE);
      _overheadPrcntOfLabor->setEnabled(FALSE);
      _overheadPerLaborHour->setEnabled(FALSE);
      _overheadPerMachHour->setEnabled(FALSE);
      _overheadPerUnit->setEnabled(FALSE);
      _avgQueueDays->setEnabled(FALSE);
      _avgSetup->setEnabled(FALSE);
      _dailyCapacity->setEnabled(FALSE);
      _efficiencyFactor->setEnabled(FALSE);
      _comments->setEnabled(FALSE);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  return NoError;
}
Esempio n. 28
0
enum SetResponse creditCard::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("cust_id", &valid);
  if (valid)
    _custid = param.toInt();

  param = pParams.value("ccard_id", &valid);
  if (valid)
  {
    _ccardid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    XSqlQuery cust;
    cust.prepare( "SELECT cust_number, cust_name "
               "FROM cust "
               "WHERE (cust_id=:cust_id);" );
    cust.bindValue(":cust_id", _custid);
    cust.exec();
    if (cust.first())
    {
      _custNum->setText(cust.value("cust_number").toString());
      _custName->setText(cust.value("cust_name").toString());

    }
    else if (cust.lastError().type() != QSqlError::NoError)
      systemError(this, cust.lastError().databaseText(), __FILE__, __LINE__);

    if (param.toString() == "new")
    {
      _mode = cNew;
      _address->setCountry("United States");

      cust.prepare( "SELECT cust_number, cust_name,"
                    "       addr_line1, addr_line2, addr_line3,"
                    "       addr_city, addr_state, addr_country,"
                    "       addr_postalcode "
                    "  FROM custinfo, cntct, addr "
                    " WHERE((cust_id=:cust_id)"
                    "   AND (cust_cntct_id=cntct_id)"
                    "   AND (cntct_addr_id=addr_id));" );
      cust.bindValue(":cust_id", _custid);
      cust.exec();
      if (cust.first())
      {
        _address->setLine1(cust.value("addr_line1").toString());
        _address->setLine3(cust.value("addr_line3").toString());
        _address->setLine2(cust.value("addr_line2").toString());
        _address->setCity(cust.value("addr_city").toString());
        _address->setState(cust.value("addr_state").toString());
        _address->setPostalCode(cust.value("addr_postalcode").toString());
        _address->setCountry(cust.value("addr_country").toString());
      }
      _fundsType2->setFocus();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _fundsType2->setEnabled(FALSE);
      _save->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _fundsType2->setEnabled(FALSE);
      _creditCardNumber->setEnabled(FALSE);
      _active->setEnabled(FALSE);
      _name->setEnabled(FALSE);
      _address->setEnabled(FALSE);
      _expireMonth->setEnabled(FALSE);
      _expireYear->setEnabled(FALSE);
      _close->setText(tr("&Close"));
      _save->hide();

      _close->setFocus();
    }
  }

  return NoError;
}
Esempio n. 29
0
void
browse(const char *ipath, const char *ifilter)
{
	int r, fd;
	regex_t re;
	char *newpath;
	struct stat sb;
	char *name, *bin, *dir, *tmp, *run, *env;
	int nowtyping = 0;
    FILE *fp;

	oldpath = NULL;
	path = xstrdup(ipath);
	fltr = xstrdup(ifilter);
begin:
	/* Path and filter should be malloc(3)-ed strings at all times */
	r = populate();
	if (r == -1) {
		if (!nowtyping) {
			printwarn();
			goto nochange;
		}
	}

	for (;;) {
		redraw();

		/* Handle filter-as-you-type mode */
		if (nowtyping)
			goto moretyping;
nochange:
		switch (nextsel(&run, &env)) {
		case SEL_QUIT:
			free(path);
			free(fltr);
			dentfree(dents, n);
			return;
		case SEL_BACK:
			/* There is no going back */
			if (strcmp(path, "/") == 0 ||
			    strcmp(path, ".") == 0 ||
			    strchr(path, '/') == NULL)
				goto nochange;
			dir = xdirname(path);
			if (canopendir(dir) == 0) {
				free(dir);
				printwarn();
				goto nochange;
			}
			/* Save history */
			oldpath = path;
			path = dir;
			/* Reset filter */
			free(fltr);
			fltr = xstrdup(ifilter);
			goto begin;
		case SEL_GOIN:
			/* Cannot descend in empty directories */
			if (n == 0)
				goto nochange;

			name = dents[cur].name;
			newpath = mkpath(path, name);
			DPRINTF_S(newpath);

			/* Get path info */
			fd = open(newpath, O_RDONLY | O_NONBLOCK);
			if (fd == -1) {
				printwarn();
				free(newpath);
				goto nochange;
			}
			r = fstat(fd, &sb);
			if (r == -1) {
				printwarn();
				close(fd);
				free(newpath);
				goto nochange;
			}
			close(fd);
			DPRINTF_U(sb.st_mode);

			switch (sb.st_mode & S_IFMT) {
			case S_IFDIR:
				if (canopendir(newpath) == 0) {
					printwarn();
					free(newpath);
					goto nochange;
				}
				free(path);
				path = newpath;
				/* Reset filter */
				free(fltr);
				fltr = xstrdup(ifilter);
				goto begin;
			case S_IFREG:
				bin = openwith(newpath);
				if (bin == NULL) {
					printmsg("No association");
					free(newpath);
					goto nochange;
				}
				exitcurses();
				spawn(bin, newpath, NULL);
				initcurses();
				free(newpath);
				continue;
			default:
				printmsg("Unsupported file");
				goto nochange;
			}
		case SEL_FLTR:
			/* Read filter */
			printprompt("filter: ");
			tmp = readln();
			if (tmp == NULL)
				tmp = xstrdup(ifilter);
			/* Check and report regex errors */
			r = setfilter(&re, tmp);
			if (r != 0) {
				free(tmp);
				goto nochange;
			}
			free(fltr);
			fltr = tmp;
			DPRINTF_S(fltr);
			/* Save current */
			if (n > 0)
				oldpath = mkpath(path, dents[cur].name);
			goto begin;
		case SEL_TYPE:
			nowtyping = 1;
			tmp = NULL;
moretyping:
			printprompt("type: ");
			if (tmp != NULL)
				printw("%s", tmp);
			r = readmore(&tmp);
			DPRINTF_D(r);
			DPRINTF_S(tmp);
			if (r == 1)
				nowtyping = 0;
			/* Check regex errors */
			if (tmp != NULL) {
				r = setfilter(&re, tmp);
				if (r != 0)
					if (nowtyping) {
						goto moretyping;
					} else {
						free(tmp);
						goto nochange;
					}
			}
			/* Copy or reset filter */
			free(fltr);
			if (tmp != NULL)
				fltr = xstrdup(tmp);
			else
				fltr = xstrdup(ifilter);
			/* Save current */
			if (n > 0)
				oldpath = mkpath(path, dents[cur].name);
			if (!nowtyping)
				free(tmp);
			goto begin;
		case SEL_NEXT:
			if (cur < n - 1)
				cur++;
			break;
		case SEL_PREV:
			if (cur > 0)
				cur--;
			break;
		case SEL_PGDN:
			if (cur < n - 1)
				cur += MIN((LINES - 4) / 2, n - 1 - cur);
			break;
		case SEL_PGUP:
			if (cur > 0)
				cur -= MIN((LINES - 4) / 2, cur);
			break;
		case SEL_HOME:
			cur = 0;
			break;
		case SEL_END:
			cur = n - 1;
			break;
		case SEL_CD:
			/* Read target dir */
			printprompt("chdir: ");
			tmp = readln();
			if (tmp == NULL) {
				clearprompt();
				goto nochange;
			}
			newpath = mkpath(path, tmp);
			free(tmp);
			if (canopendir(newpath) == 0) {
				free(newpath);
				printwarn();
				goto nochange;
			}
			free(path);
			path = newpath;
			free(fltr);
			fltr = xstrdup(ifilter); /* Reset filter */
			DPRINTF_S(path);
			goto begin;
		case SEL_MTIME:
			mtimeorder = !mtimeorder;
			/* Save current */
			if (n > 0)
				oldpath = mkpath(path, dents[cur].name);
			goto begin;
		case SEL_REDRAW:
			/* Save current */
			if (n > 0)
				oldpath = mkpath(path, dents[cur].name);
			goto begin;
		case SEL_RUN:
			run = xgetenv(env, run);
			exitcurses();
			spawn(run, NULL, path);
			initcurses();
			break;
		case SEL_RUNARG:
			name = dents[cur].name;
			run = xgetenv(env, run);
			exitcurses();
			spawn(run, name, path);
			initcurses();
			break;
        case SEL_PRINT:
			name = dents[cur].name;
            fp = fopen("savelist.txt", "a");
            fprintf(fp, "%s/%s\n", path, name);
            fclose(fp);
            break;
		}
		/* Screensaver */
		if (idletimeout != 0 && idle == idletimeout) {
			idle = 0;
			exitcurses();
			spawn(idlecmd, NULL, NULL);
			initcurses();
		}
	}
}
Esempio n. 30
0
enum SetResponse apOpenItem::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;
  
  param = pParams.value("docType", &valid);
  if (valid)
  {
    if (param.toString() == "creditMemo")
    {
      setWindowTitle(caption() + tr(" - Enter Misc. Credit Memo"));
      _docType->setCurrentIndex(0);
    }
    else if (param.toString() == "debitMemo")
    {
      setWindowTitle(caption() + tr(" - Enter Misc. Debit Memo"));
      _docType->setCurrentIndex(1);
    }
    else if (param.toString() == "voucher")
      _docType->setCurrentIndex(2);
    else
      return UndefinedError;
//  ToDo - better error return types

    _docType->setEnabled(FALSE);
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      q.exec("SELECT fetchAPMemoNumber() AS number;");
      if (q.first())
        _docNumber->setText(q.value("number").toString());
//  ToDo

      _paid->clear();
      _save->setText(tr("Post"));
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _vend->setReadOnly(TRUE);
      _docDate->setEnabled(FALSE);
      _dueDate->setEnabled(FALSE);
      _docType->setEnabled(FALSE);
      _docNumber->setEnabled(FALSE);
      _poNumber->setEnabled(FALSE);
      _journalNumber->setEnabled(FALSE);
      _terms->setEnabled(FALSE);
      _notes->setReadOnly(FALSE);
      _altPrepaid->setEnabled(FALSE);
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _vend->setReadOnly(TRUE);
      _docDate->setEnabled(FALSE);
      _dueDate->setEnabled(FALSE);
      _docType->setEnabled(FALSE);
      _docNumber->setEnabled(FALSE);
      _poNumber->setEnabled(FALSE);
      _journalNumber->setEnabled(FALSE);
      _amount->setEnabled(FALSE);
      _terms->setEnabled(FALSE);
      _terms->setType(XComboBox::Terms);
      _notes->setReadOnly(TRUE);
      _altPrepaid->setEnabled(FALSE);
      _save->hide();
      _close->setText(tr("&Close"));
    }
  }

  param = pParams.value("vend_id", &valid);
  if (valid)
    _vend->setId(param.toInt());

  param = pParams.value("apopen_id", &valid);
  if (valid)
  {
    _apopenid = param.toInt();
    populate();
  }

  return NoError;
}