void arWorkBench::sPostCashrcpt()
{
  XSqlQuery arPostCashrcpt;
  int journalNumber = -1;
  bool changeDate = false;
  QDate newDate = QDate();
  
  if (_privileges->check("ChangeCashRecvPostDate"))
  {
    getGLDistDate newdlg(this, "", TRUE);
    newdlg.sSetDefaultLit(tr("Distribution Date"));
    if (newdlg.exec() == XDialog::Accepted)
    {
      newDate = newdlg.date();
      changeDate = (newDate.isValid());
    }
    else
      return;
  }

  arPostCashrcpt.exec("BEGIN;");
  arPostCashrcpt.exec("SELECT fetchJournalNumber('C/R') AS journalnumber;");
  if (arPostCashrcpt.first())
    journalNumber = arPostCashrcpt.value("journalnumber").toInt();
  else if (arPostCashrcpt.lastError().type() != QSqlError::NoError)
  {
    systemError(this, arPostCashrcpt.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  XSqlQuery setDate;
  setDate.prepare("UPDATE cashrcpt SET cashrcpt_distdate=:distdate,"
                  "                    cashrcpt_applydate=CASE WHEN (cashrcpt_applydate < :distdate) THEN :distdate"
                  "                                            ELSE cashrcpt_applydate END "
                  "WHERE cashrcpt_id=:cashrcpt_id;");
  
  QList<XTreeWidgetItem*> selected = _cashrcpt->selectedItems();
  
  for (int i = 0; i < selected.size(); i++)
  {
    int id = ((XTreeWidgetItem*)(selected[i]))->id();
    
    if (changeDate)
    {
      setDate.bindValue(":distdate",    newDate);
      setDate.bindValue(":cashrcpt_id", id);
      setDate.exec();
      ErrorReporter::error(QtCriticalMsg, this, tr("Changing Dist. Date"),
                           setDate, __FILE__, __LINE__);
    }
  }
  
  for (int i = 0; i < selected.size(); i++)
  {
    arPostCashrcpt.prepare("SELECT postCashReceipt(:cashrcpt_id, :journalNumber) AS result;");
    arPostCashrcpt.bindValue(":cashrcpt_id", ((XTreeWidgetItem*)(selected[i]))->id());
    arPostCashrcpt.bindValue(":journalNumber", journalNumber);
    arPostCashrcpt.exec();
    if (arPostCashrcpt.first())
    {
      int result = arPostCashrcpt.value("result").toInt();
      if (result < 0)
      {
        systemError(this, storedProcErrorLookup("postCashReceipt", result),
                    __FILE__, __LINE__);
        arPostCashrcpt.exec("ROLLBACK;");
        return;
      }
    }
    else if (arPostCashrcpt.lastError().type() != QSqlError::NoError)
    {
      systemError(this, arPostCashrcpt.lastError().databaseText(), __FILE__, __LINE__);
      arPostCashrcpt.exec("ROLLBACK;");
      return;
    }
  }
  arPostCashrcpt.exec("COMMIT;");
  sFillList();
}
quoteList::quoteList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, fl )
{
  setObjectName(name ? name : "quoteList" );
  setModal(modal);

  _quheadid = -1;
  _custid = -1;
  _openOnly = false;

  setWindowTitle(tr("Quotes"));

  QVBoxLayout *mainLayout = new QVBoxLayout(this);
  mainLayout->setContentsMargins(5, 5, 5, 5);
  mainLayout->setSpacing(5);
  mainLayout->setObjectName("mainLayout");

  QVBoxLayout *warehouseLayout = new QVBoxLayout();
  warehouseLayout->setObjectName("warehouseLayout");

  QHBoxLayout *topLayout = new QHBoxLayout();
  topLayout->setSpacing(7);
  topLayout->setObjectName("topLayout");

  QVBoxLayout *buttonsLayout = new QVBoxLayout();
  buttonsLayout->setSpacing(5);
  buttonsLayout->setObjectName("buttonsLayout");

  QVBoxLayout *listLayout = new QVBoxLayout();
  listLayout->setObjectName("listLayout");

  _warehouse = new WarehouseGroup(this, "_warehouse");
  warehouseLayout->addWidget(_warehouse);

  QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred);
  warehouseLayout->addItem(spacer);
  topLayout->addLayout(warehouseLayout);

  QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
  topLayout->addItem(spacer_2);

  _close = new QPushButton(tr("&Cancel"), this);
  _close->setObjectName("_close");
  buttonsLayout->addWidget(_close);

  _select = new QPushButton(tr("&Select"), this);
  _select->setObjectName("_select");
  _select->setEnabled( FALSE );
  _select->setDefault( TRUE );

  buttonsLayout->addWidget(_select);
  buttonsLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
  topLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(topLayout);

  QLabel *_quotesLit = new QLabel(tr("Quotes:"), this);
  _quotesLit->setObjectName("_quotesLit");
  listLayout->addWidget(_quotesLit);

  _qu = new XTreeWidget(this);
  _qu->setObjectName("_qu");
  listLayout->addWidget(_qu, 1);
  mainLayout->addLayout(listLayout, 1);

  resize( QSize(490, 390).expandedTo(minimumSizeHint()) );

  connect( _close, SIGNAL( clicked() ), this, SLOT( reject() ) );
  connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
  connect( _qu, SIGNAL( itemSelected(int) ), _select, SLOT( animateClick() ) );
  connect( _qu, SIGNAL( valid(bool) ), _select, SLOT( setEnabled(bool) ) );
  connect( _warehouse, SIGNAL(updated()), this, SLOT( sFillList() ) );

  _qu->addColumn(tr("Order #"), _orderColumn, Qt::AlignLeft,  true, "quhead_number");
  _qu->addColumn(tr("Customer"),          -1, Qt::AlignLeft,  true, "cust_name");
  _qu->addColumn(tr("Ordered"),  _dateColumn, Qt::AlignCenter,true, "quhead_quotedate");
  _qu->addColumn(tr("Scheduled"),_dateColumn, Qt::AlignCenter,true, "duedate");

  setTabOrder(_warehouse, _qu);
  setTabOrder(_qu, _select);
  setTabOrder(_select, _close);
  setTabOrder(_close, _warehouse);
  _warehouse->setFocus();
}
Example #3
0
void purchaseOrder::populate()
{
  XSqlQuery po;
  po.prepare( "SELECT pohead_number, COALESCE(pohead_warehous_id,-1) AS pohead_warehous_id, "
              "       pohead_orderdate, pohead_status, pohead_printed, pohead_taxzone_id, "
              "       pohead_shipvia, pohead_comments,"
              "       pohead_fob, COALESCE(pohead_terms_id,-1) AS pohead_terms_id, "
              "       COALESCE(pohead_vend_id,-1) AS pohead_vend_id,"
              "       pohead_tax, pohead_freight,"
              "       pohead_agent_username,"
              "       vend_name, vend_address1, vend_address2, vend_address3,"
              "       vend_city, vend_state, vend_zip, vend_country,"
              "       COALESCE(vendaddr_id, -1) AS vendaddrid,"
              "       vendaddr_code, vendaddr_name, vendaddr_address1, vendaddr_address2,"
              "       vendaddr_address3, vendaddr_city, vendaddr_state, vendaddr_zipcode,"
              "       vendaddr_country, pohead_curr_id "
              "FROM vend, pohead LEFT OUTER JOIN vendaddr ON (pohead_vendaddr_id=vendaddr_id) "
              "WHERE ( (pohead_vend_id=vend_id)"
              " AND (pohead_id=:pohead_id) );" );
  po.bindValue(":pohead_id", _poheadid);
  po.exec();
  if (po.first())
  {
    _orderNumber->setText(po.value("pohead_number"));
    _warehouse->setId(po.value("pohead_warehous_id").toInt());
    _orderDate->setDate(po.value("pohead_orderdate").toDate(), true);
    _agent->setText(po.value("pohead_agent_username").toString());
    _status->setText(po.value("pohead_status").toString());
    _printed = po.value("pohead_printed").toBool();
    _terms->setId(po.value("pohead_terms_id").toInt());
    _shipVia->setText(po.value("pohead_shipvia"));
    _fob->setText(po.value("pohead_fob"));
    _notes->setText(po.value("pohead_comments").toString());
	
    _vendaddrid = po.value("vendaddrid").toInt();
    if (_vendaddrid == -1)
    {
      _vendaddrCode->setText(tr("Main"));
      _vendaddrName->setText(po.value("vend_name"));
      _vendaddrAddr1->setText(po.value("vend_address1"));
      _vendaddrAddr2->setText(po.value("vend_address2"));
      _vendaddrAddr3->setText(po.value("vend_address3"));
      _vendaddrCity->setText(po.value("vend_city"));
      _vendaddrState->setText(po.value("vend_state"));
      _vendaddrZipCode->setText(po.value("vend_zip"));
      _vendaddrCountry->setText(po.value("vend_country"));
    }
    else
    {
      _vendaddrCode->setText(po.value("vendaddr_code"));
      _vendaddrName->setText(po.value("vendaddr_name"));
      _vendaddrAddr1->setText(po.value("vendaddr_address1"));
      _vendaddrAddr2->setText(po.value("vendaddr_address2"));
      _vendaddrAddr3->setText(po.value("vendaddr_address3"));
      _vendaddrCity->setText(po.value("vendaddr_city"));
      _vendaddrState->setText(po.value("vendaddr_state"));
      _vendaddrZipCode->setText(po.value("vendaddr_zipcode"));
      _vendaddrCountry->setText(po.value("vendaddr_country"));
    }

    _comments->setId(_poheadid);
    _vendor->setId(po.value("pohead_vend_id").toInt());
    _taxZone->setId(po.value("pohead_taxzone_id").toInt());
    _poCurrency->setId(po.value("pohead_curr_id").toInt());
    _tax->setLocalValue(po.value("pohead_tax").toDouble());
    _freight->setLocalValue(po.value("pohead_freight").toDouble());
  }

  sFillList();
}
Example #4
0
itemList::itemList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, name, modal, fl )
{
    if ( !name )
      setName( "itemList" );

  _itemid = -1;
  _itemType = ItemLineEdit::cUndefined;
  _useQuery = FALSE;

    setCaption(tr("Item List"));

    Q3VBoxLayout *itemListLayout = new Q3VBoxLayout( this, 5, 5, "itemListLayout"); 
    Q3HBoxLayout *Layout69 = new Q3HBoxLayout( 0, 0, 0, "Layout69"); 
    Q3HBoxLayout *Layout72 = new Q3HBoxLayout( 0, 0, 7, "Layout72"); 
    Q3VBoxLayout *Layout71 = new Q3VBoxLayout( 0, 0, 0, "Layout71"); 
    Q3VBoxLayout *Layout70 = new Q3VBoxLayout( 0, 0, 5, "Layout70"); 
    Q3HBoxLayout *Layout5 = new Q3HBoxLayout( 0, 0, 5, "Layout5"); 
    Q3VBoxLayout *Layout18 = new Q3VBoxLayout( 0, 0, 5, "Layout18"); 
    Q3VBoxLayout *Layout20 = new Q3VBoxLayout( 0, 0, 0, "Layout20"); 

    QLabel *_searchForLit = new QLabel(tr("S&earch for:"), this, "_searchForLit");
    _searchForLit->setAlignment( int( Qt::AlignVCenter | Qt::AlignRight ) );
    Layout5->addWidget( _searchForLit );

    _searchFor = new QLineEdit( this, "_searchFor" );
    _searchForLit->setBuddy(_searchFor);
    Layout5->addWidget( _searchFor );
    Layout70->addLayout( Layout5 );

    _showInactive = new QCheckBox(tr("Show &Inactive Items"), this, "_showInactive");
    Layout69->addWidget( _showInactive );

    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout69->addItem( spacer );
    _showMake = new QCheckBox(tr("Show &Make Items"), this, "_showMake");
    _showBuy = new QCheckBox(tr("Show &Buy Items"), this, "_showBuy");
    Layout70->addWidget( _showMake );
    Layout70->addWidget( _showBuy );
    Layout70->addLayout( Layout69 );
    Layout71->addLayout( Layout70 );

    QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Preferred );
    Layout71->addItem( spacer_2 );
    Layout72->addLayout( Layout71 );

    _close = new QPushButton(tr("&Cancel"), this, "_close");
    Layout18->addWidget( _close );

    _select = new QPushButton(tr("&Select"), this, "_select");
    _select->setEnabled( FALSE );
    _select->setAutoDefault( TRUE );
    _select->setDefault( TRUE );
    Layout18->addWidget( _select );
    Layout72->addLayout( Layout18 );
    itemListLayout->addLayout( Layout72 );

    QLabel *_itemsLit = new QLabel(tr("&Items:"), this, "_itemsLit");
    Layout20->addWidget( _itemsLit );

    _item = new XTreeWidget(this);
    _item->setName("_item");
    _itemsLit->setBuddy(_item );
    Layout20->addWidget( _item );
    itemListLayout->addLayout( Layout20 );

    resize( QSize(467, 393).expandedTo(minimumSizeHint()) );
    //clearWState( WState_Polished );

    connect( _item, SIGNAL( itemSelected(int) ), this, SLOT( sSelect() ) );
    connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
    connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) );
    connect( _searchFor, SIGNAL( textChanged(const QString&) ), this, SLOT( sSearch(const QString&) ) );
    connect( _showInactive, SIGNAL( clicked() ), this, SLOT( sFillList() ) );
    connect( _showMake, SIGNAL( clicked() ), this, SLOT( sFillList() ) );
    connect( _showBuy, SIGNAL( clicked() ), this, SLOT( sFillList() ) );
    connect( _item, SIGNAL( valid(bool) ), _select, SLOT( setEnabled(bool) ) );


  _item->addColumn(tr("Item Number"), 100,  Qt::AlignLeft );
  _item->addColumn(tr("Description"), -1,   Qt::AlignLeft );
}
Example #5
0
void userPreferences::sPopulate()
{
  if (_currentUser->isChecked())
    _pref = Preferences(omfgThis->username());
  else
    _pref = Preferences(_user->currentText());

  if (_pref.value("BackgroundImageid").toInt() > 0)
  {
    _backgroundImage->setChecked(TRUE);
    setBackgroundImage(_pref.value("BackgroundImageid").toInt());
  }
  else
  {
    _noBackgroundImage->setChecked(TRUE);
    _backgroundImageid = -1;
  }

  if (_pref.value("PreferredWarehouse").toInt() == -1)
    _noWarehouse->setChecked(TRUE);
  else
  {
    _selectedWarehouse->setChecked(TRUE);
    _warehouse->setId(_pref.value("PreferredWarehouse").toInt());
  }

  if (_pref.value("InterfaceWindowOption") == "TopLevel")
    _interfaceTopLevel->setChecked(true);
  else
    _interfaceWorkspace->setChecked(true);

  _rememberCheckBoxes->setChecked(! _pref.boolean("XCheckBox/forgetful"));

  _itemCache->setChecked(_pref.boolean("UseItemCache"));
  _customerCache->setChecked(_pref.boolean("UseCustCache"));
  
  _standard->setChecked(_pref.boolean("UseOldMenu"));
  sStyleChanged();
  	
  //New Menus
  _inventoryMenu->setChecked(_pref.boolean("ShowIMMenu"));
  _productsMenu->setChecked(_pref.boolean("ShowPDMenu"));
  _scheduleMenu->setChecked(_pref.boolean("ShowMSMenu"));
  _manufactureMenu->setChecked(_pref.boolean("ShowWOMenu"));
  _crmMenu2->setChecked(_pref.boolean("ShowCRMMenu"));
  _purchaseMenu->setChecked(_pref.boolean("ShowPOMenu"));
  _salesMenu->setChecked(_pref.boolean("ShowSOMenu"));
  _accountingMenu->setChecked(_pref.boolean("ShowGLMenu"));

  _inventoryToolbar->setChecked(_pref.boolean("ShowIMToolbar"));
  _productsToolbar->setChecked(_pref.boolean("ShowPDToolbar"));
  _scheduleToolbar->setChecked(_pref.boolean("ShowMSToolbar"));
  _manufactureToolbar->setChecked(_pref.boolean("ShowWOToolbar"));
  _crmToolbar2->setChecked(_pref.boolean("ShowCRMToolbar"));
  _purchaseToolbar->setChecked(_pref.boolean("ShowPOToolbar"));
  _salesToolbar->setChecked(_pref.boolean("ShowSOToolbar"));
  _accountingToolbar->setChecked(_pref.boolean("ShowGLToolbar"));
  
  //Old Menus  
  _imMenu->setChecked(_pref.boolean("ShowIMMenu"));
  _pdMenu->setChecked(_pref.boolean("ShowPDMenu"));
  _msMenu->setChecked(_pref.boolean("ShowMSMenu"));
  _cpMenu->setChecked(_pref.boolean("ShowCPMenu"));
  _woMenu->setChecked(_pref.boolean("ShowWOMenu"));
  _crmMenu->setChecked(_pref.boolean("ShowCRMMenu"));
  _poMenu->setChecked(_pref.boolean("ShowPOMenu"));
  _soMenu->setChecked(_pref.boolean("ShowSOMenu"));
  _srMenu->setChecked(_pref.boolean("ShowSRMenu"));
  _saMenu->setChecked(_pref.boolean("ShowSAMenu"));
  _pmMenu->setChecked(_pref.boolean("ShowPMMenu"));
  _arMenu->setChecked(_pref.boolean("ShowARMenu"));
  _apMenu->setChecked(_pref.boolean("ShowAPMenu")); 
  _glMenu->setChecked(_pref.boolean("ShowGLMenu"));

  _imToolbar->setChecked(_pref.boolean("ShowIMToolbar"));
  _pdToolbar->setChecked(_pref.boolean("ShowPDToolbar"));
  _msToolbar->setChecked(_pref.boolean("ShowMSToolbar"));
  _cpToolbar->setChecked(_pref.boolean("ShowCPToolbar"));
  _woToolbar->setChecked(_pref.boolean("ShowWOToolbar"));
  _crmToolbar->setChecked(_pref.boolean("ShowCRMToolbar"));
  _poToolbar->setChecked(_pref.boolean("ShowPOToolbar"));
  _soToolbar->setChecked(_pref.boolean("ShowSOToolbar"));
  _srToolbar->setChecked(_pref.boolean("ShowSRToolbar"));
  _saToolbar->setChecked(_pref.boolean("ShowSAToolbar"));
  _pmToolbar->setChecked(_pref.boolean("ShowPMToolbar"));
  _arToolbar->setChecked(_pref.boolean("ShowARToolbar"));
  _apToolbar->setChecked(_pref.boolean("ShowAPToolbar")); 
  _glToolbar->setChecked(_pref.boolean("ShowGLToolbar"));

  _fixedWidthFonts->setChecked(_pref.boolean("UsedFixedWidthFonts"));
  _listNumericItemsFirst->setChecked(_pref.boolean("ListNumericItemNumbersFirst"));
  _showSoitemAvailability->setChecked(_pref.boolean("ShowSOItemAvailability"));

  _idleTimeout->setValue(_pref.value("IdleTimeout").toInt());

  if(_pref.value("DefaultEllipsesAction") == "search")
    _ellipsesAction->setId(2);
  else
    _ellipsesAction->setId(1);
    
  //Hide for PostBooks 
  if (_metrics->value("Application") != "OpenMFG")
  {
    _scheduleMenu->hide();
    _scheduleToolbar->hide();
    
    _msMenu->hide();
    _msToolbar->hide();
    _cpMenu->hide();
    _cpToolbar->hide();
  }
  
  if (!_metrics->boolean("MultiWhs"))
    _warehouseGroup->hide();

  sFillList();
  sFillWarehouseList();
}
Example #6
0
void dspSingleLevelBOM::sFillList()
{
  if (_item->isValid())
    sFillList(-1, FALSE);
}
Example #7
0
void boo::sFillList()
{
  sFillList(-1, TRUE);
}
Example #8
0
void fixSerial::sFix()
{
  if (fixOne(static_cast<XTreeWidgetItem*>(_serial->currentItem())))
    sFillList();
}
Example #9
0
void itemUOM::sCheck()
{
  if(cNew != _mode || _ignoreSignals)
    return;

  _ignoreSignals = true;

  _uomFrom->setEnabled(false);
  _uomTo->setEnabled(false);

  q.prepare("SELECT itemuomconv_id"
            "  FROM itemuomconv"
            " WHERE((itemuomconv_item_id=:item_id)"
            "   AND (((itemuomconv_from_uom_id=:from_uom_id) AND (itemuomconv_to_uom_id=:to_uom_id))"
            "     OR ((itemuomconv_from_uom_id=:to_uom_id) AND (itemuomconv_to_uom_id=:from_uom_id))));");
  q.bindValue(":item_id", _itemid);
  q.bindValue(":from_uom_id", _uomFrom->id());
  q.bindValue(":to_uom_id", _uomTo->id());
  q.exec();
  if(q.first())
  {
    _itemuomconvid = q.value("itemuomconv_id").toInt();
    _mode = cEdit;
    populate();
    _ignoreSignals = false;
    return;
  }

  q.prepare("SELECT uomconv_from_uom_id, uomconv_from_value,"
            "       uomconv_to_uom_id, uomconv_to_value,"
            "       uomconv_fractional"
            "  FROM uomconv"
            " WHERE(((uomconv_from_uom_id=:from_uom_id) AND (uomconv_to_uom_id=:to_uom_id))"
            "    OR ((uomconv_from_uom_id=:to_uom_id) AND (uomconv_to_uom_id=:from_uom_id)));");
  q.bindValue(":from_uom_id", _uomFrom->id());
  q.bindValue(":to_uom_id", _uomTo->id());
  q.exec();
  if(q.first())
  {
    _uomFrom->setId(q.value("uomconv_from_uom_id").toInt());
    _uomTo->setId(q.value("uomconv_to_uom_id").toInt());
    _fromValue->setDouble(q.value("uomconv_from_value").toDouble());
    _toValue->setDouble(q.value("uomconv_to_value").toDouble());
    _fractional->setChecked(q.value("uomconv_fractional").toBool());
    _fromValue->setEnabled(false);
    _toValue->setEnabled(false);
  }
  else
  {
    _fromValue->setEnabled(true);
    _toValue->setEnabled(true);
  }

  q.exec("SELECT nextval('itemuomconv_itemuomconv_id_seq') AS result;");
  q.first();
  _itemuomconvid = q.value("result").toInt();

  q.prepare("INSERT INTO itemuomconv"
            "      (itemuomconv_id, itemuomconv_item_id, itemuomconv_from_uom_id, itemuomconv_to_uom_id,"
            "       itemuomconv_from_value, itemuomconv_to_value, itemuomconv_fractional) "
            "VALUES(:id, :item_id, :from_uom_id, :to_uom_id, :fromvalue, :tovalue, :fractional);");
  q.bindValue(":id", _itemuomconvid);
  q.bindValue(":item_id", _itemid);
  q.bindValue(":from_uom_id", _uomFrom->id());
  q.bindValue(":to_uom_id", _uomTo->id());
  q.bindValue(":fromvalue", _fromValue->toDouble());
  q.bindValue(":tovalue", _toValue->toDouble());
  q.bindValue(":fractional", QVariant(_fractional->isChecked()));
  q.exec();

  sFillList();

  _ignoreSignals = false;
}
Example #10
0
enum SetResponse dspBacklogByParameterList::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

  param = pParams.value("custtype_id", &valid);
  if (valid)
  {
    _parameter->setType(CustomerType);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("custtype_pattern", &valid);
  if (valid)
  {
    _parameter->setType(CustomerType);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("custtype", &valid);
  if (valid)
    _parameter->setType(CustomerType);

  param = pParams.value("custgrp_id", &valid);
  if (valid)
  {
    _parameter->setType(CustomerGroup);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("custgrp_pattern", &valid);
  if (valid)
  {
    _parameter->setType(CustomerGroup);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("custgrp", &valid);
  if (valid)
    _parameter->setType(CustomerGroup);

  param = pParams.value("prodcat_id", &valid);
  if (valid)
  {
    _parameter->setType(ProductCategory);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("prodcat_pattern", &valid);
  if (valid)
  {
    _parameter->setType(ProductCategory);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("prodcat", &valid);
  if (valid)
    _parameter->setType(ProductCategory);

  if (pParams.inList("run"))
  {
    sFillList();
    return NoError_Run;
  }

  switch (_parameter->type())
  {
    case CustomerType:
      setCaption(tr("Backlog by Customer Type"));
      break;

    case CustomerGroup:
      setCaption(tr("Backlog by Customer Group"));
      break;

    case ProductCategory:
      setCaption(tr("Backlog by Product Category"));
      break;

    default:
      break;
  }

  return NoError;
}
Example #11
0
plannedOrderList::plannedOrderList(QWidget *parent, const char *name, bool modal, Qt::WFlags fl) :
  QDialog( parent, name, modal, fl )
{
  setWindowTitle(tr("Planned Orders"));

  _planordid = -1;

  if ( !name )
    setObjectName( "plannedOrderList" );

  QVBoxLayout *plannedOrderListLayout = new QVBoxLayout( this, 5, 5, "plannedOrderListLayout"); 
  QHBoxLayout *layout6387 = new QHBoxLayout( 0, 0, 7, "layout6387"); 
  QVBoxLayout *layout6385 = new QVBoxLayout( 0, 0, 0, "layout6385"); 
  QHBoxLayout *layout6384 = new QHBoxLayout( 0, 0, 5, "layout6384"); 
  QVBoxLayout *Layout183 = new QVBoxLayout( 0, 0, 5, "Layout183"); 
  QVBoxLayout *Layout185 = new QVBoxLayout( 0, 0, 0, "Layout185"); 
  QHBoxLayout *layout6386 = new QHBoxLayout( 0, 0, 0, "layout6386"); 

    _warehouseGroup = new QGroupBox( this );
    QVBoxLayout *_warehouseGroupLayout = new QVBoxLayout( _warehouseGroup );
    _warehouseGroupLayout->setSpacing( 0 );
    _warehouseGroupLayout->setMargin( 5 );
    _warehouseGroupLayout->setAlignment( Qt::AlignTop );

    _allWarehouses = new QRadioButton(tr("&All Sites"), _warehouseGroup, "_allWarehouses");
    _allWarehouses->setChecked( TRUE );
    _warehouseGroupLayout->addWidget( _allWarehouses );

    _selectedWarehouse = new QRadioButton(tr("Site:"), _warehouseGroup, "_selectedWarehouse");
    _selectedWarehouse->setChecked( FALSE );
    layout6384->addWidget( _selectedWarehouse );

    _warehouse = new WComboBox( _warehouseGroup, "_warehouse" );
    _warehouse->setEnabled( FALSE );
    layout6384->addWidget( _warehouse );
    _warehouseGroupLayout->addLayout( layout6384 );
    layout6385->addWidget( _warehouseGroup );
    _warehouseGroup->setLayout( _warehouseGroupLayout );

    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Preferred );
    layout6385->addItem( spacer );
    layout6387->addLayout( layout6385 );

    QSpacerItem* spacer_2 = new QSpacerItem( 223, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout6386->addItem( spacer_2 );

    _close = new QPushButton(tr("&Cancel"), this, "_close");
    Layout183->addWidget( _close );

    _select = new QPushButton(tr("&Select"), this, "_select");
    _select->setAutoDefault( TRUE );
    _select->setDefault( TRUE );
    Layout183->addWidget( _select );
    layout6386->addLayout( Layout183 );
    layout6387->addLayout( layout6386 );
    plannedOrderListLayout->addLayout( layout6387 );

    QLabel *_plannedOrdersLit = new QLabel(tr("Planned Orders:"), this, "_plannedOrdersLit");
    Layout185->addWidget( _plannedOrdersLit );

    _planord = new XTreeWidget( this);
    _planord->setObjectName("_planord" );
    Layout185->addWidget( _planord );
    plannedOrderListLayout->addLayout( Layout185 );

    resize( QSize(496, 360).expandedTo(minimumSizeHint()) );
    //clearWState( WState_Polished );

    // signals and slots connections
    connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) );
    connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
    connect( _planord, SIGNAL( itemSelected(int) ), this, SLOT( sSelect() ) );
    connect( _selectedWarehouse, SIGNAL( toggled(bool) ), this, SLOT( sFillList() ) );
    connect( _warehouse, SIGNAL( newID(int) ), this, SLOT( sFillList() ) );
    connect( _selectedWarehouse, SIGNAL( toggled(bool) ), _warehouse, SLOT( setEnabled(bool) ) );

  setTabOrder(_allWarehouses, _selectedWarehouse);
  setTabOrder(_selectedWarehouse, _warehouse);
  setTabOrder(_warehouse, _planord);
  setTabOrder(_planord, _select);
  setTabOrder(_select, _close);
  setTabOrder(_close, _allWarehouses);
  _planord->setFocus();

  _planord->addColumn(tr("PL/O #"),    _orderColumn, Qt::AlignLeft,  true, "number");
  _planord->addColumn(tr("Firmed"),              40, Qt::AlignCenter,true, "planord_firm");
  _planord->addColumn(tr("Whs."),        _whsColumn, Qt::AlignCenter,true, "warehous_code");
  _planord->addColumn(tr("Item Number"),_itemColumn, Qt::AlignLeft,  true, "item_number");
  _planord->addColumn(tr("Description"),         -1, Qt::AlignLeft,  true, "descrip");

  sFillList();
}
Example #12
0
void selectOrderForBilling::sPopulate(int pSoheadid)
{
  if (_so->isValid())
  {
    q.prepare("SELECT createBillingHeader(:sohead_id) AS cobmisc_id;");
    q.bindValue(":sohead_id", pSoheadid);
    q.exec();
    if (q.first())
    {
      _cobmiscid = q.value("cobmisc_id").toInt();
      if (_cobmiscid < 0)
      {
	systemError(this, storedProcErrorLookup("createBillingHeader", _cobmiscid),
		    __FILE__, __LINE__);
	return;
      }
    }
    else if (q.lastError().type() != QSqlError::NoError)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }

    XSqlQuery cobmisc;
    cobmisc.prepare( "SELECT cobmisc_id, cobmisc_notes, cobmisc_shipvia,"
                     "       cohead_orderdate, cobmisc_shipdate,"
		     "       cobmisc_invcdate, cobmisc_taxzone_id,"
                     "       cobmisc_freight AS freight,"
                     "       cobmisc_misc, cobmisc_misc_accnt_id, cobmisc_misc_descrip,"
                     "       cobmisc_payment AS payment,"
                     "       cobmisc_closeorder,"
                     "       cobmisc_curr_id,"
                     "       cohead_number, cohead_shipto_id,"
                     "       cohead_custponumber,"
                     "       cohead_billtoname, cohead_shiptoname,"
                     "       CASE WHEN (shipchrg_custfreight IS NULL) THEN TRUE"
                     "            ELSE shipchrg_custfreight"
                     "       END AS custfreight "
                     "FROM cobmisc , cohead "
                     "  LEFT OUTER JOIN shipchrg ON (cohead_shipchrg_id=shipchrg_id) "
                     "WHERE ( (cobmisc_id=:cobmisc_id)"
                     " AND (cohead_id=:cohead_id) ) ");
    cobmisc.bindValue(":cobmisc_id", _cobmiscid);
    cobmisc.bindValue(":cohead_id", pSoheadid);
    cobmisc.exec();
    if (cobmisc.first())
    {
      _cobmiscid = cobmisc.value("cobmisc_id").toInt();
      // do taxzone first so we can overwrite the result of the signal cascade
      _taxzoneidCache = cobmisc.value("cobmisc_taxzone_id").toInt();
      _taxZone->setId(cobmisc.value("cobmisc_taxzone_id").toInt());

      _orderDate->setDate(cobmisc.value("cohead_orderdate").toDate(), true);
      _shipDate->setDate(cobmisc.value("cobmisc_shipdate").toDate());
      _invoiceDate->setDate(cobmisc.value("cobmisc_invcdate").toDate());

      _poNumber->setText(cobmisc.value("cohead_custponumber").toString());
      _custName->setText(cobmisc.value("cohead_billtoname").toString());
      _shipToName->setText(cobmisc.value("cohead_shiptoname").toString());
      _shipvia->setText(cobmisc.value("cobmisc_shipvia").toString());
     
      _miscCharge->setLocalValue(cobmisc.value("cobmisc_misc").toDouble());
      _miscChargeAccount->setId(cobmisc.value("cobmisc_misc_accnt_id").toInt());
      _miscChargeDescription->setText(cobmisc.value("cobmisc_misc_descrip"));
      _payment->set(cobmisc.value("payment").toDouble(),
		    cobmisc.value("cobmisc_curr_id").toInt(),
		    cobmisc.value("cohead_orderdate").toDate(), false);
      _custCurrency->setId(cobmisc.value("cobmisc_curr_id").toInt());
      _comments->setText(cobmisc.value("cobmisc_notes").toString());
      _closeOpenItems->setChecked(cobmisc.value("cobmisc_closeorder").toBool());
      _freightCache = cobmisc.value("freight").toDouble();
      if (cobmisc.value("custfreight").toBool())
      {
        _freight->setEnabled(TRUE);
        _freight->setLocalValue(cobmisc.value("freight").toDouble());
      }
      else
      {
        _freight->setEnabled(FALSE);
        _freight->clear();
      }
    }
    else if (q.lastError().type() != QSqlError::NoError)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
  }
  else
  {
    clear();
  }

  sFillList();
}
Example #13
0
void userPreferences::sPopulate()
{
  if (_currentUser->isChecked())
  {
    _pref = _preferences;
    _username->setText(omfgThis->username());
  }
  else
  {
    if(_altPref)
      delete _altPref;
    _altPref = new Preferences(_user->currentText());
    _pref = _altPref;
    _username->setText(_user->currentText());
  }
  _username->setEnabled(FALSE);
  _currentpassword->setEnabled(_currentUser->isChecked());
  _newpassword->setEnabled(_currentUser->isChecked());
  _retypepassword->setEnabled(_currentUser->isChecked());
  

  if (_pref->value("BackgroundImageid").toInt() > 0)
  {
    _backgroundImage->setChecked(TRUE);
    setBackgroundImage(_pref->value("BackgroundImageid").toInt());
  }
  else
  {
    _noBackgroundImage->setChecked(TRUE);
    _background->clear();
    _backgroundImageid = -1;
  }

  if (_pref->value("PreferredWarehouse").toInt() == -1)
    _noWarehouse->setChecked(TRUE);
  else
  {
    _selectedWarehouse->setChecked(TRUE);
    _warehouse->setId(_pref->value("PreferredWarehouse").toInt());
  }

  if (_pref->value("InterfaceWindowOption") == "Workspace")
    _interfaceWorkspace->setChecked(true);
  else
    _interfaceTopLevel->setChecked(true);
    
  if (_pref->boolean("CopyListsPlainText"))
    _plainText->setChecked(true);
  else
    _richText->setChecked(true);

  _enableSpell->setChecked(_pref->boolean("SpellCheck"));

  //_rememberCheckBoxes->setChecked(! _pref->boolean("XCheckBox/forgetful"));
  
  _inventoryMenu->setChecked(_pref->boolean("ShowIMMenu"));
  _productsMenu->setChecked(_pref->boolean("ShowPDMenu"));
  _scheduleMenu->setChecked(_pref->boolean("ShowMSMenu"));
  _manufactureMenu->setChecked(_pref->boolean("ShowWOMenu"));
  _crmMenu2->setChecked(_pref->boolean("ShowCRMMenu"));
  _purchaseMenu->setChecked(_pref->boolean("ShowPOMenu"));
  _salesMenu->setChecked(_pref->boolean("ShowSOMenu"));
  _accountingMenu->setChecked(_pref->boolean("ShowGLMenu"));

  _inventoryToolbar->setChecked(_pref->boolean("ShowIMToolbar"));
  _productsToolbar->setChecked(_pref->boolean("ShowPDToolbar"));
  _scheduleToolbar->setChecked(_pref->boolean("ShowMSToolbar"));
  _manufactureToolbar->setChecked(_pref->boolean("ShowWOToolbar"));
  _crmToolbar2->setChecked(_pref->boolean("ShowCRMToolbar"));
  _purchaseToolbar->setChecked(_pref->boolean("ShowPOToolbar"));
  _salesToolbar->setChecked(_pref->boolean("ShowSOToolbar"));
  _accountingToolbar->setChecked(_pref->boolean("ShowGLToolbar"));
  
  _listNumericItemsFirst->setChecked(_pref->boolean("ListNumericItemNumbersFirst"));
  _ignoreTranslation->setChecked(_pref->boolean("IngoreMissingTranslationFiles"));

  _idleTimeout->setValue(_pref->value("IdleTimeout").toInt());

  _emailEvents->setChecked(_pref->boolean("EmailEvents"));

  _alarmEvent->setChecked(_pref->boolean("AlarmEventDefault"));
  _alarmEmail->setChecked(_pref->boolean("AlarmEmailDefault"));
  _alarmSysmsg->setChecked(_pref->boolean("AlarmSysmsgDefault"));

  if(_pref->value("DefaultEllipsesAction") == "search")
    _ellipsesAction->setId(2);
  else
    _ellipsesAction->setId(1);

  _alternating->setChecked(!_pref->boolean("NoAlternatingRowColors"));
    
  //Hide for PostBooks 
  if (_metrics->value("Application") == "PostBooks")
  {
    _scheduleMenu->hide();
    _scheduleToolbar->hide();
  }
  
  if (!_metrics->boolean("MultiWhs"))
    _warehouseGroup->hide();
    
  _debug->setChecked(_pref->boolean("EnableScriptDebug"));

  sFillList();
  sFillWarehouseList();
}
Example #14
0
enum SetResponse dspItemSitesByParameterList::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;

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

  _showInactive->setChecked(pParams.inList("showInactive"));

  param = pParams.value("classcode_id", &valid);
  if (valid)
  {
    _parameter->setType(ClassCode);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("classcode_pattern", &valid);
  if (valid)
  {
    _parameter->setType(ClassCode);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("classcode", &valid);
  if (valid)
    _parameter->setType(ClassCode);

  param = pParams.value("plancode_id", &valid);
  if (valid)
  {
    _parameter->setType(PlannerCode);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("plancode_pattern", &valid);
  if (valid)
  {
    _parameter->setType(PlannerCode);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("plancode", &valid);
  if (valid)
    _parameter->setType(PlannerCode);

  param = pParams.value("itemgrp_id", &valid);
  if (valid)
  {
    _parameter->setType(ItemGroup);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("itemgrp_pattern", &valid);
  if (valid)
  {
    _parameter->setType(ItemGroup);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("itemgrp", &valid);
  if (valid)
    _parameter->setType(ItemGroup);

  param = pParams.value("costcat_id", &valid);
  if (valid)
  {
    _parameter->setType(CostCategory);
    _parameter->setId(param.toInt());
  }

  param = pParams.value("costcat_pattern", &valid);
  if (valid)
  {
    _parameter->setType(CostCategory);
    _parameter->setPattern(param.toString());
  }

  param = pParams.value("costcat", &valid);
  if (valid)
    _parameter->setType(CostCategory);

  switch (_parameter->type())
  {
    case ClassCode:
      setCaption(tr("Item Sites by Class Code"));
      break;

    case PlannerCode:
      setCaption(tr("Item Sites by Planner Code"));
      break;

    case ItemGroup:
      setCaption(tr("Item Sites by Item Group"));
      break;

    case CostCategory:
      setCaption(tr("Item Sites by Cost Category"));
      break;

    default:
      break;
  }

  if (pParams.inList("run"))
  {
    sFillList();
    return NoError_Run;
  }

  return NoError;
}
Example #15
0
void BOM::sFillList()
{
  sFillList(_item->id(), TRUE);
}
Example #16
0
void bbom::sFillList()
{
  sFillList(_item->id(), FALSE);
}
Example #17
0
void reassignLotSerial::sReassign()
{
    if (_source->currentItem() == 0)
    {
        QMessageBox::critical( this, tr("Select Source Location"),
                               tr("You must select a Source Location before reassigning its Lot/Serial #.") );
        _source->setFocus();
        return;
    }

    if (_qty->toDouble() == 0)
    {
        QMessageBox::critical( this, tr("Enter Quantity to Reassign"),
                               tr("You must enter a quantity to reassign.") );
        _qty->setFocus();
        return;
    }

    QDoubleValidator* qtyVal = (QDoubleValidator*)(_qty->validator());
    q.prepare("SELECT reassignLotSerial(:source, CAST (:qty AS NUMERIC(100,:decimals)), "
              "                         :lotNumber, :expirationDate, :warrantyDate) AS result;");
    q.bindValue(":source", _source->id());
    q.bindValue(":qty", _qty->toDouble());
    q.bindValue(":decimals", qtyVal->decimals());
    q.bindValue(":lotNumber", _lotNumber->text());

    if (_expirationDate->isEnabled())
        q.bindValue(":expirationDate", _expirationDate->date());
    else
        q.bindValue(":expirationDate", omfgThis->startOfTime());

    if (_warrantyDate->isEnabled())
        q.bindValue(":warrantyDate", _warrantyDate->date());

    q.exec();
    if (q.first())
    {
        int result = q.value("result").toInt();
        if (result < 0)
        {
            systemError(this, storedProcErrorLookup("reassignLotSerial", result),
                        __FILE__, __LINE__);
            return;
        }
    }
    else if (q.lastError().type() != QSqlError::None)
    {
        systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
        return;
    }

    if (_captive)
        accept();
    else
    {
        _close->setText(tr("&Close"));

        sFillList();

        if (_qty->isEnabled())
            _qty->clear();

        _qty->setFocus();
        _lotNumber->clear();
        _expirationDate->setNull();
        _warrantyDate->setNull();
    }
}
Example #18
0
woList::woList(QWidget * parent, const char * name, bool modal, Qt::WFlags fl) :
  QDialog( parent, name, modal, fl )
{
  setCaption(tr("Work Orders"));

  _woid = -1;
  _type = 0;

  if ( !name )
    setName( "woList" );

  Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this, 5, 5, "woListLayout"); 
  Q3HBoxLayout *topLayout = new Q3HBoxLayout( 0, 0, 7, "topLayout"); 
  Q3VBoxLayout *warehouseLayout = new Q3VBoxLayout( 0, 0, 0, "warehouseLayout"); 
  Q3VBoxLayout *buttonsLayout = new Q3VBoxLayout( 0, 0, 5, "buttonsLayout"); 
  Q3VBoxLayout *listLayout = new Q3VBoxLayout( 0, 0, 0, "listLayout"); 

  _warehouse = new WarehouseGroup(this, "_warehouse");
  warehouseLayout->addWidget(_warehouse);

  QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred);
  warehouseLayout->addItem(spacer);

  topLayout->addLayout(warehouseLayout);

  QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
  topLayout->addItem(spacer_2);

  _close = new QPushButton(tr("&Cancel"), this, "_close");
  buttonsLayout->addWidget(_close);

  _select = new QPushButton(tr("&Select"), this, "_select");
  _select->setAutoDefault(TRUE);
  _select->setDefault(TRUE);
  buttonsLayout->addWidget(_select);
  topLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(topLayout);

  QLabel *_workOrdersLit = new QLabel(tr("Work Orders:"), this, "_workOrdersLit");
  listLayout->addWidget(_workOrdersLit);

  _wo = new XTreeWidget(this);
  _wo->setName("_wo");
  listLayout->addWidget( _wo );
  mainLayout->addLayout(listLayout);

  resize( QSize(484, 366).expandedTo(minimumSizeHint()) );

  connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) );
  connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
  connect( _wo, SIGNAL( itemSelected(int) ), this, SLOT( sSelect() ) );
  connect( _warehouse, SIGNAL(updated()), this, SLOT( sFillList() ) );

  setTabOrder(_warehouse, _wo);
  setTabOrder(_wo, _select);
  setTabOrder(_select, _close);
  setTabOrder(_close, _warehouse);
  _wo->setFocus();

  _wo->addColumn(tr("W/O #"),       _orderColumn, Qt::AlignLeft   );
  _wo->addColumn(tr("Status"),      40,           Qt::AlignCenter );
  _wo->addColumn(tr("Whs."),        _whsColumn,   Qt::AlignCenter );
  _wo->addColumn(tr("Item Number"), _itemColumn,  Qt::AlignLeft   );
  _wo->addColumn(tr("Description"), -1,           Qt::AlignLeft   );
}
Example #19
0
void dspSingleLevelWhereUsed::sFillList()
{
  sFillList(-1, FALSE);
}
Example #20
0
todoList::todoList(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

	QSqlDatabase db = QSqlDatabase::database();

  _parameterWidget->setType(tr("CRM Account"), "crmAccountId", ParameterWidget::Crmacct);
  _parameterWidget->setType(tr("Assigned"), "assigned_username", ParameterWidget::User, db.userName());
  _parameterWidget->setType(tr("Owner"), "owner_username", ParameterWidget::User);
  _parameterWidget->setType(tr("Assigned Pattern"), "assigned_usr_pattern", ParameterWidget::Text);
  _parameterWidget->setType(tr("Owner Pattern"), "owner_usr_pattern", ParameterWidget::Text);
  _parameterWidget->setType(tr("Start Date Before"), "startStartDate", ParameterWidget::Date);
  _parameterWidget->setType(tr("Start Date After"), "startEndDate", ParameterWidget::Date);
	_parameterWidget->setType(tr("Due Date Before"), "dueStartDate", ParameterWidget::Date);
  _parameterWidget->setType(tr("Due Date After"), "dueEndDate", ParameterWidget::Date);
  _parameterWidget->applyDefaultFilterSet();

  _crmAccount->hide();
  
  q.exec("SELECT current_user;");

  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    close();
  }

  connect(_parameterWidget, SIGNAL(updated()), this, SLOT(sFillList()));

	connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_autoUpdate,	SIGNAL(toggled(bool)),	this,	SLOT(sHandleAutoUpdate(bool)));
  connect(_close,	SIGNAL(clicked()),	this,	SLOT(sClose()));
  connect(_completed,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_delete,	SIGNAL(clicked()),	this,	SLOT(sDelete()));

  connect(_todolist,    SIGNAL(toggled(bool)),  this,   SLOT(sFillList()));
  connect(_incidents,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_projects,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_new,		SIGNAL(clicked()),	this,	SLOT(sNew()));
  connect(_print,	SIGNAL(clicked()),	this,	SLOT(sPrint()));
  connect(_todoList,	SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  connect(_todoList,	SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)),
	    this,	SLOT(sPopulateMenu(QMenu*)));
  connect(_todoList,	SIGNAL(itemSelectionChanged()),	this,	SLOT(handlePrivs()));

  connect(_edit,	SIGNAL(clicked()),	this,	SLOT(sEdit()));
  connect(_view,	SIGNAL(clicked()),	this,	SLOT(sView()));
  

  _todoList->addColumn(tr("Type"),      _userColumn,  Qt::AlignCenter, true, "type");
  _todoList->addColumn(tr("Seq"),        _seqColumn,  Qt::AlignRight,  false, "seq");
  _todoList->addColumn(tr("Priority"),  _userColumn,  Qt::AlignLeft,   true, "priority");
  _todoList->addColumn(tr("Assigned To"),_userColumn,  Qt::AlignLeft,   true, "usr");
  _todoList->addColumn(tr("Name"),              100,  Qt::AlignLeft,   true, "name");
  _todoList->addColumn(tr("Description"),        -1,  Qt::AlignLeft,   true, "descrip");
  _todoList->addColumn(tr("Status"),  _statusColumn,  Qt::AlignLeft,   true, "status");
  _todoList->addColumn(tr("Start Date"),_dateColumn,  Qt::AlignLeft,   false, "start");
  _todoList->addColumn(tr("Due Date"),  _dateColumn,  Qt::AlignLeft,   true, "due");
  _todoList->addColumn(tr("Parent#"),  _orderColumn,  Qt::AlignLeft,   true, "number");
  _todoList->addColumn(tr("Customer#"),_orderColumn,  Qt::AlignLeft,   false, "cust");
  _todoList->addColumn(tr("Account#"), _orderColumn,  Qt::AlignLeft,   false, "crmacct_number");
  _todoList->addColumn(tr("Account Name"),      100,  Qt::AlignLeft,   true, "crmacct_name");
  _todoList->addColumn(tr("Owner"),     _userColumn,  Qt::AlignLeft,   false,"owner");

  int menuItem;
  QMenu * todoMenu = new QMenu;
  menuItem = todoMenu->insertItem(tr("Incident"), this, SLOT(sNewIncdt()));
  if (!_privileges->check("MaintainIncidents"))
    todoMenu->setItemEnabled(menuItem, FALSE);
  menuItem = todoMenu->insertItem(tr("To-Do Item"),   this, SLOT(sNew()));
  if (!_privileges->check("MaintainPersonalTodoList") &&
      !_privileges->check("MaintainOtherTodoLists"))
    todoMenu->setItemEnabled(menuItem, FALSE);
  _new->setMenu(todoMenu);

  if (_preferences->boolean("XCheckBox/forgetful"))
    _incidents->setChecked(true);

  handlePrivs();
  sHandleAutoUpdate(_autoUpdate->isChecked());
}
Example #21
0
void dspCustomersByCharacteristic::sFillList()
{
  sFillList(-1, TRUE);
}
Example #22
0
void todoList::sDelete()
{
  QString recurstr;
  QString recurtype;
  if (_todoList->altId() == 1)
  {
    recurstr = "SELECT MAX(todoitem_due_date) AS max"
               "  FROM todoitem"
               " WHERE todoitem_recurring_todoitem_id=:id"
               "   AND todoitem_id!=:id;" ;
    recurtype = "TODO";
  }
  /* TODO: can't delete incidents from here. why not?
  else if (_todoList->altId() == 2)
  {
    recurstr = "SELECT MAX(incdt_timestamp) AS max"
               "   FROM incdt"
               " WHERE incdt_recurring_incdt_id=:id;" ;
    recurtype = "INCDT";
  }
   */

  bool deleteAll  = false;
  bool createMore = false;
  if (! recurstr.isEmpty())
  {
    XSqlQuery recurq;
    recurq.prepare(recurstr);
    recurq.bindValue(":id", _todoList->id());
    recurq.exec();
    if (recurq.first())
    {
      QMessageBox askdelete(QMessageBox::Question, tr("Delete Recurring Item?"),
                            tr("<p>This is a recurring item. Do you want to "
                               "delete just this one item or delete all open "
                               "items in this recurrence?"),
                            QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::Cancel,
                            this);
      askdelete.setDefaultButton(QMessageBox::Cancel);
      int ret = askdelete.exec();
      if (ret == QMessageBox::Cancel)
        return;
      else if (ret == QMessageBox::YesToAll)
        deleteAll = true;
      // user said delete one but the only one that exists is the base
      else if (ret == QMessageBox::Yes && recurq.value("max").isNull())
        createMore = true;
    }
    else if (recurq.lastError().type() != QSqlError::NoError)
    {
      systemError(this, recurq.lastError().text(), __FILE__, __LINE__);
      return;
    }
  }
  else if (QMessageBox::warning(this, tr("Delete List Item?"),
                                tr("<p>Are you sure that you want to "
                                   "completely delete the selected item?"),
			    QMessageBox::Yes | QMessageBox::No,
			    QMessageBox::No) == QMessageBox::No)
    return;

  QString procname;
  int procresult = 0;
  if (deleteAll)
  {
    procname = "deleteOpenRecurringItems";
    q.prepare("SELECT deleteOpenRecurringItems(:id, :type, NULL, TRUE)"
              "       AS result;");
    q.bindValue(":id",   _todoList->id());
    q.bindValue(":type", recurtype);
    q.exec();
    if (q.first())
      procresult = q.value("result").toInt();
  }
  if (procresult >= 0 && createMore)
  {
    procname = "createRecurringItems";
    q.prepare("SELECT createRecurringItems(:id, :type) AS result;");
    q.bindValue(":id",   _todoList->id());
    q.bindValue(":type", recurtype);
    q.exec();
    if (q.first())
      procresult = q.value("result").toInt();
  }

  // not elseif - error handling for 1 or 2 queries
  if (procresult < 0)
  {
    systemError(this, storedProcErrorLookup(procname, procresult));
    return;
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  if (_todoList->altId() == 1)
    q.prepare("SELECT deleteTodoItem(:todoitem_id) AS result;");
  else if (_todoList->altId() == 3)
    q.prepare("DELETE FROM prjtask"
              " WHERE (prjtask_id=:todoitem_id); ");
  else if (_todoList->altId() == 4)
    q.prepare("SELECT deleteProject(:todoitem_id) AS result");
  else
    return;
  q.bindValue(":todoitem_id", _todoList->id());
  q.exec();
  if (q.first())
  {
    int result = q.value("result").toInt();
    if (result < 0)
    {
      systemError(this, storedProcErrorLookup("deleteTodoItem", result));
      return;
    }
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  sFillList();
}
Example #23
0
void viewCheckRun::sFillList(int pBankaccntid)
{
  if (pBankaccntid == _bankaccnt->id())
    sFillList();
}
Example #24
0
enum SetResponse dspSalesHistory::set(const ParameterList &pParams)
{
  XWidget::set(pParams);
  QVariant param;
  bool     valid;

  parameterWidget()->setSavedFilters();

  param = pParams.value("cohead_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Sales Order"), param.toInt());

  param = pParams.value("cust_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Customer"), param.toInt());

  param = pParams.value("custtype_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Customer Type"), param.toInt());

  param = pParams.value("custtype_pattern", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Customer Type Pattern"), param.toString());

  param = pParams.value("item_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Item"), param.toInt());

  param = pParams.value("prodcat_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Product Category"), param.toInt());

  param = pParams.value("prodcat_pattern", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Product Category Pattern"), param.toString());

  param = pParams.value("salesrep_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Sales Rep."), param.toInt());

  param = pParams.value("startDate", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Invoice Start Date"), param.toDate());
  else
    parameterWidget()->setDefault(tr("Invoice Start Date"), QVariant());

  param = pParams.value("endDate", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Invoice End Date"), param.toDate());
  else
    parameterWidget()->setDefault(tr("Invoice End Date"), QVariant());

  param = pParams.value("shipStartDate", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Ship Start Date"), param.toDate());
  else
    parameterWidget()->setDefault(tr("Ship Start Date"), QVariant());

  param = pParams.value("shipEndDate", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Ship End Date"), param.toDate());
  else
    parameterWidget()->setDefault(tr("Ship End Date"), QVariant());

  param = pParams.value("shipzone_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Shipping Zones"), param.toInt());

  param = pParams.value("warehous_id", &valid);
  if (valid)
    parameterWidget()->setDefault(tr("Site"), param.toInt());

  parameterWidget()->applyDefaultFilterSet();

  if (pParams.inList("run"))
  {
    sFillList();
    return NoError_Run;
  }

  return NoError;
}
Example #25
0
enum SetResponse customerGroup::set(const ParameterList &pParams)
{
    XDialog::set(pParams);
    QVariant param;
    bool     valid;

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

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

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

            connect(_custgrpitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));

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

            sFillList();

            connect(_custgrpitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));

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

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

            sFillList();

            _close->setFocus();
        }
    }

    return NoError;
}
Example #26
0
void itemPricingSchedule::sFillList()
{
  sFillList(-1);
}
Example #27
0
enum SetResponse purchaseOrder::set(const ParameterList &pParams)
{
  QVariant param;
  bool     valid;
  int      itemsiteid;
  int      parentwo = -1;
  int      parentso = -1;
  int      prjid = -1;
  double   qty;
  QDate    dueDate;

  setPoheadid(-1);
  int _prid = -1;
  param = pParams.value("pr_id", &valid);
  if (valid)
    _prid = param.toInt();

  param = pParams.value("itemsite_id", &valid);
  if (valid)
    itemsiteid = param.toInt();
  else
    itemsiteid = -1;

  param = pParams.value("qty", &valid);
  if (valid)
    qty = param.toDouble();
  else
    qty = 0.0;

  param = pParams.value("dueDate", &valid);
  if (valid)
    dueDate = param.toDate();

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

      if (param.toString() == "releasePr")
      {
        q.prepare( "SELECT pr_itemsite_id, pr_qtyreq, pr_duedate,"
                   "       CASE WHEN(pr_order_type='W') THEN"
                   "              COALESCE((SELECT womatl_wo_id FROM womatl WHERE womatl_id=pr_order_id),-1)"
                   "            ELSE -1"
                   "       END AS parentwo,"
                   "       CASE WHEN(pr_order_type='S') THEN pr_order_id"
                   "            ELSE -1"
                   "       END AS parentso,"
                   "       pr_prj_id "
                   "FROM pr "
                   "WHERE (pr_id=:pr_id);" );
        q.bindValue(":pr_id", _prid);
        q.exec();
        if (q.first())
        {
          itemsiteid = q.value("pr_itemsite_id").toInt();
          qty = q.value("pr_qtyreq").toDouble();
          dueDate = q.value("pr_duedate").toDate();
          parentwo = q.value("parentwo").toInt();
          parentso = q.value("parentso").toInt();
          prjid = q.value("pr_prj_id").toInt();
        }
        else
        {
          systemError(this, tr("A System Error occurred at %1::%2.")
                            .arg(__FILE__)
                            .arg(__LINE__) );
          return UndefinedError;
        }
      }

      connect(_poitem, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
      connect(_poitem, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
      connect(_poitem, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
      connect(_vendor, SIGNAL(valid(bool)), _new, SLOT(setEnabled(bool)));
      //_new->setEnabled(TRUE);

      if (itemsiteid != -1)
      {
	      q.prepare( "SELECT itemsite_item_id, itemsrc_id "
                   "FROM itemsite, itemsrc "
                   "WHERE ( (itemsrc_item_id=itemsite_item_id)"
                   " AND (itemsite_id=:itemsite_id) ) "
                    "LIMIT 1;" );
        q.bindValue(":itemsite_id", itemsiteid);
        q.exec();
        if (!q.first())
        {
          QMessageBox::warning(omfgThis, tr("Cannot Create P/O"),
                               tr("<p>A Purchase Order cannot be automatically "
                                  "created for this Item as there are no Item "
                                  "Sources for it.  You must create one or "
                                  "more Item Sources for this Item before "
                                  "the application can automatically create "
                                  "Purchase Orders for it." ) );
          return UndefinedError;
        }

        ParameterList itemSourceParams;
        itemSourceParams.append("item_id", q.value("itemsite_item_id").toInt());
        itemSourceParams.append("qty", qty);
  
        itemSourceList newdlg(omfgThis, "", TRUE);
        newdlg.set(itemSourceParams);
        int itemsrcid = newdlg.exec();
        if (itemsrcid == XDialog::Rejected)
      	{
          deleteLater();
          return UndefinedError;
        }

        q.prepare( "SELECT itemsrc_vend_id "
                   "FROM itemsrc "
                   "WHERE (itemsrc_id=:itemsrc_id);" );
        q.bindValue(":itemsrc_id", itemsrcid);
        q.exec();
        if (!q.first())
        {
          systemError(this, tr("A System Error occurred at %1::%2.")
                            .arg(__FILE__)
                            .arg(__LINE__) );
          return UndefinedError;
        }
        else
        {
          int vendid = q.value("itemsrc_vend_id").toInt();;

          q.prepare( "SELECT pohead_id "
                     "FROM pohead "
                     "WHERE ( (pohead_status='U')"
                     " AND (pohead_vend_id=:vend_id) ) "
                     "ORDER BY pohead_number "
                     "LIMIT 1;" );
          q.bindValue(":vend_id", vendid);
          q.exec();
          if (q.first())
          {
            if(QMessageBox::question( this, tr("An Open Purchase Order Exists"),
                tr("An Open Purchase Order already exists for this Vendor.\n"
                   "Would you like to use this Purchase Order?\n"
                   "Click Yes to use the existing Purchase Order otherwise a new one will be created."),
                QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
            {
//  Use an existing pohead
              _mode = cEdit;

              setPoheadid(q.value("pohead_id").toInt());
              _orderNumber->setEnabled(FALSE);
              _orderDate->setEnabled(FALSE);
              _vendor->setReadOnly(TRUE);
              populate();
            }
            else
            {
              _vendor->setId(vendid);
              createHeader();
            }
          }
          else
          {
//  Create a new pohead for the chosen vend
            _vendor->setId(vendid);
            createHeader();
          }

//  Start to create the new Poitem
          ParameterList newItemParams;
          newItemParams.append("mode", "new");
          newItemParams.append("pohead_id", _poheadid);
          newItemParams.append("itemsrc_id", itemsrcid);

          if (qty > 0.0)
            newItemParams.append("qty", qty);

          if (!dueDate.isNull())
            newItemParams.append("dueDate", dueDate);

          if (parentwo != -1)
            newItemParams.append("parentWo", parentwo);

          if (parentso != -1)
            newItemParams.append("parentSo", parentso);

          if (prjid != -1)
            newItemParams.append("prj_id", prjid);

          purchaseOrderItem poItem(this, "", TRUE);
          poItem.set(newItemParams);
          if (poItem.exec() != XDialog::Rejected)
          {
            if(_mode == cEdit)
            {
              // check for another open window
              QWidgetList list = omfgThis->windowList();
              for(int i = 0; i < list.size(); i++)
              {
                QWidget * w = list.at(i);
                if(w->isA("purchaseOrder") && w != this)
                {
                  purchaseOrder *other = (purchaseOrder*)w;
                  if(_poheadid == other->_poheadid)
                  {
                    if(_prid != -1 && cEdit == other->_mode)
                    {
                      q.prepare("SELECT deletePr(:pr_id) AS _result;");
                      q.bindValue(":pr_id", _prid);
                      q.exec();
                      omfgThis->sPurchaseRequestsUpdated();
                    }
                    other->sFillList();
                    other->setFocus();
                    return UndefinedError;
                  }
                }
              }
            }
            sFillList();
          }
          else
            _prid = -1;
        }
      }
      else
//  This is a new P/O without a chosen Itemsite Line Item
        createHeader();
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _orderNumber->setEnabled(FALSE);
      _orderDate->setEnabled(FALSE);
      _warehouse->setEnabled(FALSE);
      _vendor->setReadOnly(TRUE);

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

      _new->setEnabled(TRUE);

    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _orderNumber->setEnabled(FALSE);
      _orderDate->setEnabled(FALSE);
      _warehouse->setEnabled(FALSE);
	  _taxZone->setEnabled(FALSE);
      _agent->setEnabled(FALSE);
      _terms->setEnabled(FALSE);
      _terms->setType(XComboBox::Terms);
      _vendor->setReadOnly(TRUE);
      _shipVia->setEnabled(FALSE);
      _fob->setEnabled(FALSE);
      _notes->setEnabled(FALSE);
      _new->setEnabled(FALSE);
      _freight->setEnabled(FALSE);
      _tax->setEnabled(FALSE);
      _vendaddrList->hide();
      _purchaseOrderInformation->removePage(_quickEntryTab);
      _poCurrency->setEnabled(FALSE);
      _qeitemView->setEnabled(FALSE);
      _qesave->setEnabled(FALSE);
      _qedelete->setEnabled(FALSE);
      _qecurrency->setEnabled(FALSE);
      _comments->setReadOnly(TRUE);

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

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

      _close->setFocus();
    }
  }

  if (_prid != -1 && cNew != _mode)
  {
    q.prepare("SELECT deletePr(:pr_id) AS _result;");
    q.bindValue(":pr_id", _prid);
    q.exec();
    _prid = -1;
    omfgThis->sPurchaseRequestsUpdated();
  }

  if(_prid != -1)
    _pridList.append(_prid);

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

  return NoError;
}
Example #28
0
opportunityList::opportunityList(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  _targetDates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _targetDates->setEndNull(tr("Latest"),     omfgThis->endOfTime(),   TRUE);
  _targetDates->setStartCaption(tr("First Target Date:"));
  _targetDates->setEndCaption(tr("Last Target Date:"));

  _usrGroup->setEnabled(_privileges->check("MaintainOtherTodoLists"));
  q.exec("SELECT current_user;");
  if (q.first())
    _usr->setUsername(q.value("current_user").toString());
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    close();
  }

  connect(_close,	SIGNAL(clicked()),	this,	SLOT(sClose()));
  connect(_delete,	SIGNAL(clicked()),	this,	SLOT(sDelete()));
  connect(_crmAccount, SIGNAL(newId(int)), this, SLOT(sFillList()));
  connect(_showInactive,	SIGNAL(toggled(bool)),	this,   SLOT(sFillList()));
  connect(_search,		SIGNAL(lostFocus()),	this,   SLOT(sFillList()));
  connect(_targetDates,	SIGNAL(updated()),	this,   SLOT(sFillList()));
  connect(_opsource,	SIGNAL(updated()),	this,   SLOT(sFillList()));
  connect(_opstage,	SIGNAL(updated()),	this,   SLOT(sFillList()));
  connect(_optype,	SIGNAL(updated()),	this,   SLOT(sFillList()));
  connect(_all,		SIGNAL(clicked()),	this,	SLOT(sFillList()));
  connect(_selected,	SIGNAL(clicked()),	this,	SLOT(sFillList())); 
  connect(_usr,		SIGNAL(newId(int)),	this,	SLOT(sFillList()));
  connect(_pattern,	SIGNAL(editingFinished()),	this,	SLOT(sFillList()));
  connect(_edit,	SIGNAL(clicked()),	this,	SLOT(sEdit()));
  connect(_new,		SIGNAL(clicked()),	this,	SLOT(sNew()));
  connect(_print,	SIGNAL(clicked()),	this,	SLOT(sPrint()));
  connect(_list,	SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  connect(_list,	SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this,	SLOT(sPopulateMenu(QMenu*)));
  connect(_view,	SIGNAL(clicked()),	this,	SLOT(sView()));
  connect(_more,        SIGNAL(clicked()), this, SLOT(sHandleMore()));
  connect(_usePattern,  SIGNAL(toggled(bool)), _pattern, SLOT(setEnabled(bool)));

  if(_privileges->check("MaintainOpportunities"))
  {
    connect(_list, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_list, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));
    connect(_list, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_list, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    connect(_list, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));
    connect(_list, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

//  statusBar()->hide();

  _list->addColumn(tr("Active"),      _orderColumn,    Qt::AlignLeft,   false, "ophead_active" );
  _list->addColumn(tr("Name"),        -1,              Qt::AlignLeft,   true, "ophead_name"  );
  _list->addColumn(tr("CRM Acct."),   _userColumn,     Qt::AlignLeft,   true, "crmacct_number" );
  _list->addColumn(tr("Owner"),       _userColumn,     Qt::AlignLeft,   true, "ophead_owner_username" );
  _list->addColumn(tr("Stage"),       _orderColumn,    Qt::AlignLeft,   true, "opstage_name" );
  _list->addColumn(tr("Source"),      _orderColumn,    Qt::AlignLeft,   false, "opsource_name" );
  _list->addColumn(tr("Type"),        _orderColumn,    Qt::AlignLeft,   false, "optype_name" );
  _list->addColumn(tr("Prob.%"),      _prcntColumn,    Qt::AlignCenter, false, "ophead_probability_prcnt" );
  _list->addColumn(tr("Amount"),      _moneyColumn,    Qt::AlignRight,  false, "ophead_amount" );
  _list->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignLeft,   false, "f_currency" );
  _list->addColumn(tr("Target Date"), _dateColumn,     Qt::AlignLeft,   false, "ophead_target_date" );
  _list->addColumn(tr("Actual Date"), _dateColumn,     Qt::AlignLeft,   false, "ophead_actual_date" );
  
  _more->setChecked(_preferences->boolean("opListShowAll"));
  sHandleMore();
  _search->setFocus();
}
Example #29
0
transferOrderList::transferOrderList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, name, modal, fl )
{
  if ( !name )
    setObjectName( "transferOrderList" );

  _toheadid = -1;
  _type = (cToOpen | cToClosed);

  setWindowTitle(tr("Transfer Orders"));

  QVBoxLayout *mainLayout	= new QVBoxLayout(this, 5, 5, "mainLayout"); 
  QHBoxLayout *warehouseLayout	= new QHBoxLayout(0, 0, 0, "warehouseLayout"); 
  QHBoxLayout *topLayout	= new QHBoxLayout( 0, 0, 7, "topLayout"); 
  QVBoxLayout *buttonsLayout	= new QVBoxLayout(0, 0, 5, "buttonsLayout");
  QVBoxLayout *listLayout	= new QVBoxLayout( 0, 0, 0, "listLayout"); 

  _srcwhs = new WarehouseGroup(this, "_srcwhs");
  _srcwhs->setTitle(tr("From Site:"));
  _dstwhs = new WarehouseGroup(this, "_dstwhs");
  _dstwhs->setTitle(tr("To Site:"));
  _dstwhs->setAll();
  warehouseLayout->addWidget(_srcwhs);
  warehouseLayout->addWidget(_dstwhs);

  QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred);
  warehouseLayout->addItem(spacer);
  topLayout->addLayout(warehouseLayout);

  QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
  topLayout->addItem(spacer_2);

  _close = new QPushButton(tr("&Cancel"), this, "_close");
  buttonsLayout->addWidget(_close);

  _select = new QPushButton(tr("&Select"), this, "_select");
  _select->setEnabled( FALSE );
  _select->setDefault( TRUE );
  buttonsLayout->addWidget(_select);
  topLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(topLayout);

  QLabel *_transferOrdersLit = new QLabel(tr("Transfer Orders:"), this, "_transferOrdersLit");
  listLayout->addWidget(_transferOrdersLit);

  _to = new XTreeWidget(this);
  _to->setObjectName("_to");
  listLayout->addWidget(_to);
  mainLayout->addLayout(listLayout);

  resize( QSize(490, 390).expandedTo(minimumSizeHint()) );

  connect(_close,	SIGNAL(clicked()), this,    SLOT( sClose() ) );
  connect(_dstwhs,	SIGNAL(updated()), this,    SLOT( sFillList() ) );
  connect(_select,	SIGNAL(clicked()), this,    SLOT( sSelect() ) );
  connect(_srcwhs,	SIGNAL(updated()), this,    SLOT( sFillList() ) );
  connect(_to,	      SIGNAL(valid(bool)), _select, SLOT( setEnabled(bool) ) );
  connect(_to,	SIGNAL(itemSelected(int)), _select, SLOT( animateClick() ) );

  _to->addColumn(tr("Order #"), _orderColumn, Qt::AlignLeft,  true, "tohead_number");
  _to->addColumn(tr("From Whs."),         -1, Qt::AlignLeft,  true, "tohead_srcname");
  _to->addColumn(tr("To Whs."), _orderColumn, Qt::AlignLeft,  true, "tohead_destname");
  _to->addColumn(tr("Ordered"),  _dateColumn, Qt::AlignCenter, true, "tohead_orderdate");
  _to->addColumn(tr("Scheduled"),_dateColumn, Qt::AlignCenter,true, "scheddate");

  setTabOrder(_srcwhs,	_dstwhs);
  setTabOrder(_dstwhs,	_to);
  setTabOrder(_to,	_select);
  setTabOrder(_select,	_close);
  setTabOrder(_close,	_srcwhs);
  _srcwhs->setFocus();
}
arWorkBench::arWorkBench(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  _aritems = new dspAROpenItems(this, "_aritems", Qt::Widget);
  _aropenFrame->layout()->addWidget(_aritems);
  _aritems->setCloseVisible(false);
  _aritems->findChild<QWidget*>("_customerSelector")->hide();
  _aritems->queryAction()->setVisible(false);
  _aritems->findChild<QWidget*>("_asofGroup")->hide();
  _aritems->findChild<DLineEdit*>("_asOf")->setDate(omfgThis->endOfTime());
  _aritems->findChild<QWidget*>("_dateGroup")->hide();
  _aritems->findChild<QWidget*>("_showGroup")->hide();
  _aritems->findChild<QWidget*>("_printGroup")->hide();
  _aritems->findChild<QRadioButton*>("_dueDate")->click();
  
  _cctrans = new dspCreditCardTransactions(this, "_cctrans", Qt::Widget);
  _creditCardTab->layout()->addWidget(_cctrans);
  _cctrans->findChild<QWidget*>("_close")->hide();
  _cctrans->findChild<QWidget*>("_customerSelector")->hide();
  _cctrans->findChild<QWidget*>("_query")->hide();
  _cctrans->findChild<QWidget*>("_alltrans")->hide();
  _cctrans->findChild<QWidget*>("_pending")->hide();
  _cctrans->findChild<QWidget*>("_processed")->hide();
  _cctrans->findChild<XTreeWidget*>("_preauth")->hideColumn("type");
  _cctrans->findChild<XTreeWidget*>("_preauth")->hideColumn("status");
  
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_newCashrcpt, SIGNAL(clicked()), this, SLOT(sNewCashrcpt()));
  connect(_editCashrcpt, SIGNAL(clicked()), this, SLOT(sEditCashrcpt()));
  connect(_viewCashrcpt, SIGNAL(clicked()), this, SLOT(sViewCashrcpt()));
  connect(_deleteCashrcpt, SIGNAL(clicked()), this, SLOT(sDeleteCashrcpt()));
  connect(_postCashrcpt, SIGNAL(clicked()), this, SLOT(sPostCashrcpt()));
  connect(_cashrcpt, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*)),
          this, SLOT(sPopulateCashRcptMenu(QMenu*)));
  connect(_customerSelector, SIGNAL(newState(int)), this, SLOT(sClear()));
  connect(_customerSelector, SIGNAL(newCustId(int)), this, SLOT(sClear()));
  connect(_customerSelector, SIGNAL(newCustTypeId(int)), this, SLOT(sClear()));
  connect(_customerSelector, SIGNAL(newTypePattern(QString)), this, SLOT(sClear()));
  connect(_customerSelector, SIGNAL(newCustGroupId(int)), this, SLOT(sClear()));

  connect(_customerSelector, SIGNAL(newState(int)), 
          _aritems->findChild<CustomerSelector*>("_customerSelector"), SLOT(setState(int)));
  connect(_customerSelector, SIGNAL(newCustId(int)), 
          _aritems->findChild<CustomerSelector*>("_customerSelector"), SLOT(setCustId(int)));
  connect(_customerSelector, SIGNAL(newCustTypeId(int)), 
          _aritems->findChild<CustomerSelector*>("_customerSelector"), SLOT(setCustTypeId(int)));
  connect(_customerSelector, SIGNAL(newCustGroupId(int)), 
          _aritems->findChild<CustomerSelector*>("_customerSelector"), SLOT(setCustGroupId(int)));
  connect(_customerSelector, SIGNAL(newTypePattern(QString)), 
          _aritems->findChild<CustomerSelector*>("_customerSelector"), SLOT(setTypePattern(QString)));
  connect(_customerSelector, SIGNAL(newState(int)), 
          _cctrans->findChild<CustomerSelector*>("_customerSelector"), SLOT(setState(int)));
  connect(_customerSelector, SIGNAL(newCustId(int)), 
          _cctrans->findChild<CustomerSelector*>("_customerSelector"), SLOT(setCustId(int)));
  connect(_customerSelector, SIGNAL(newCustTypeId(int)), 
          _cctrans->findChild<CustomerSelector*>("_customerSelector"), SLOT(setCustTypeId(int)));
  connect(_customerSelector, SIGNAL(newCustGroupId(int)), 
          _cctrans->findChild<CustomerSelector*>("_customerSelector"), SLOT(setCustGroupId(int)));
  connect(_customerSelector, SIGNAL(newTypePattern(QString)), 
          _cctrans->findChild<CustomerSelector*>("_customerSelector"), SLOT(setTypePattern(QString)));
  connect(_debits, SIGNAL(clicked()), 
          _aritems->findChild<QRadioButton*>("_debits"), SLOT(click()));
  connect(_credits, SIGNAL(clicked()), 
          _aritems->findChild<QRadioButton*>("_credits"), SLOT(click()));
  connect(_both, SIGNAL(clicked()), 
          _aritems->findChild<QRadioButton*>("_both"), SLOT(click()));
  connect(_searchDocNum, SIGNAL(textChanged(const QString&)), this, SLOT(sSearchDocNumChanged()));

  _cashrcpt->addColumn(tr("Cust. #"),       _bigMoneyColumn, Qt::AlignLeft,  true, "cust_number");                                                                
  _cashrcpt->addColumn(tr("Name"),                       -1, Qt::AlignLeft,  true, "cust_name"); 
  _cashrcpt->addColumn(tr("Check/Doc. #"),     _orderColumn, Qt::AlignLeft,  true, "cashrcpt_docnumber");
  _cashrcpt->addColumn(tr("Bank Account"),     _orderColumn, Qt::AlignLeft,  true, "bankaccnt_name");
  _cashrcpt->addColumn(tr("Dist. Date"),        _dateColumn, Qt::AlignCenter,true, "cashrcpt_distdate");
  _cashrcpt->addColumn(tr("Funds Type"),    _bigMoneyColumn, Qt::AlignCenter,true, "cashrcpt_fundstype");
  _cashrcpt->addColumn(tr("Amount"),        _bigMoneyColumn, Qt::AlignRight, true, "cashrcpt_amount");
  _cashrcpt->addColumn(tr("Currency"),      _currencyColumn, Qt::AlignLeft,  true, "currabbr");
  
  if (_privileges->check("MaintainCashReceipts"))
  {
    connect(_cashrcpt, SIGNAL(valid(bool)), _editCashrcpt, SLOT(setEnabled(bool)));
    connect(_cashrcpt, SIGNAL(valid(bool)), _deleteCashrcpt, SLOT(setEnabled(bool)));
    if (_privileges->check("PostCashReceipts"))
      connect(_cashrcpt, SIGNAL(valid(bool)), _postCashrcpt, SLOT(setEnabled(bool)));
  }
  else
  {
    _newCashrcpt->setEnabled(FALSE);
    connect(_cashrcpt, SIGNAL(itemSelected(int)), _viewCashrcpt, SLOT(animateClick()));
  }
  
  if(_privileges->check("PostCashReceipts"))
    connect(_cashrcpt, SIGNAL(itemSelected(int)), _editCashrcpt, SLOT(animateClick()));
  connect(omfgThis, SIGNAL(cashReceiptsUpdated(int, bool)), this, SLOT(sFillList()));

  if (omfgThis->singleCurrency())
    _cashrcpt->hideColumn(2);

  if (!_metrics->boolean("CCAccept") || !_privileges->check("ProcessCreditCards"))
    _tab->removeTab(_tab->indexOf(_creditCardTab));
}