Пример #1
0
void itemSite::sCheckItemsite()
{
  int whsCache;
  if ( (_item->isValid()) &&
       (_updates) &&
       (_warehouse->id() != -1) )
  {
    _updates = FALSE;
	
    XSqlQuery query;
    query.prepare( "SELECT itemsite_id "
                   "FROM itemsite "
                   "WHERE ( (itemsite_item_id=:item_id)"
                   " AND (COALESCE(itemsite_warehous_id,:warehous_id)=:warehous_id) );" );
    query.bindValue(":item_id", _item->id());
    query.bindValue(":warehous_id", _warehouse->id());
    query.exec();
    if (query.first())
    {
      _mode = cEdit;
      _itemsiteid = query.value("itemsite_id").toInt();
      whsCache=_warehouse->id();
      disconnect(_warehouse, SIGNAL(newID(int)), this, SLOT(sCheckItemsite()));
      populate();
      if (_warehouse->id() == -1)
      {
        _warehouse->setId(whsCache);
        populateLocations();
      }
      connect(_warehouse, SIGNAL(newID(int)), this, SLOT(sCheckItemsite()));
    }
Пример #2
0
void createItemSitesByClassCode::clear()
{
  _useParameters->setChecked(FALSE);
  _useParametersOnManual->setChecked(FALSE);
  _reorderLevel->setText("0.00");
  _orderUpToQty->setText("0.00");
  _minimumOrder->setText("0.00");
  _maximumOrder->setText("0.00");
  _orderMultiple->setText("0.00");
  _safetyStock->setText("0.00");

  _orderGroup->setValue(1);

  _cycleCountFreq->setValue(0);
  _leadTime->setValue(0);
  _eventFence->setValue(_metrics->value("DefaultEventFence").toInt());

  _controlMethod->setCurrentItem(1);
  _supply->setChecked(TRUE);
  _sold->setChecked(TRUE);
  _stocked->setChecked(FALSE);

  _locationControl->setChecked(FALSE);
  _useDefaultLocation->setChecked(FALSE);
  _miscLocationName->clear();
  _locationComments->clear();

  _costcat->setId(-1);

  populateLocations();
}
Пример #3
0
void itemSite::clear()
{
  if (_item->id() != -1)
    _item->setFocus();
  else
    _active->setFocus();
    
  _active->setChecked(TRUE);
  _useParameters->setChecked(FALSE);
  _useParametersOnManual->setChecked(FALSE);
  _reorderLevel->setText("0.00");
  _orderUpToQty->setText("0.00");
  _minimumOrder->setText("0.00");
  _maximumOrder->setText("0.00");
  _orderMultiple->setText("0.00");
  _safetyStock->setText("0.00");
    
  _cycleCountFreq->setValue(0);
  _leadTime->setValue(0);
  _eventFence->setValue(_metrics->value("DefaultEventFence").toInt());

  _orderGroup->setValue(1);
  _mpsTimeFence->setValue(0);
    
  _controlMethod->setCurrentItem(1);
  _supply->setChecked((_itemType!='L'));
  _sold->setChecked(!(_itemType == 'B' || _itemType == 'F' || _itemType == 'L'));
  _stocked->setChecked(FALSE);
    
  _locationControl->setChecked(FALSE);
  _useDefaultLocation->setChecked(FALSE);
  _miscLocationName->clear();
  _locationComments->clear();
    
  _costcat->setId(-1);
    
  populateLocations();
}
Пример #4
0
void itemSite::populate()
{
  XSqlQuery itemsite;
  itemsite.prepare( "SELECT itemsite_item_id, itemsite_warehous_id, itemsite_qtyonhand,"
                    "       item_sold, item_type, itemsite_active, itemsite_controlmethod,"
                    "       itemsite_perishable, itemsite_useparams, itemsite_useparamsmanual,"
                    "       formatQty(itemsite_reorderlevel) AS f_reorderlevel,"
                    "       formatQty(itemsite_ordertoqty) AS f_ordertoqty,"
                    "       formatQty(itemsite_minordqty) AS f_minordqty,"
                    "       formatQty(itemsite_maxordqty) AS f_maxordqty,"
                    "       formatQty(itemsite_multordqty) AS f_multordqty,"
                    "       formatQty(itemsite_safetystock) AS f_safetystock,"
                    "       itemsite_leadtime, itemsite_eventfence, itemsite_plancode_id,"
                    "       itemsite_supply, itemsite_createpr, itemsite_createwo, itemsite_sold,"
                    "       itemsite_soldranking, itemsite_stocked, itemsite_abcclass, itemsite_autoabcclass,"
                    "       itemsite_loccntrl, itemsite_location_id, itemsite_location,"
                    "       itemsite_location_comments,"
                    "       itemsite_cyclecountfreq,"
                    "       itemsite_costcat_id, itemsite_notes,"
                    "       itemsite_ordergroup, itemsite_mps_timefence,"
                    "       itemsite_disallowblankwip "
                    "FROM itemsite, item "
                    "WHERE ( (itemsite_item_id=item_id)"
                    " AND (itemsite_id=:itemsite_id) );" );
  itemsite.bindValue(":itemsite_id", _itemsiteid);
  itemsite.exec();
  if (itemsite.first())
  {
    _updates = FALSE;

    _item->setId(itemsite.value("itemsite_item_id").toInt());
    _warehouse->setId(itemsite.value("itemsite_warehous_id").toInt());
    _warehouse->setEnabled(itemsite.value("itemsite_warehous_id").isNull() ||
			   itemsite.value("itemsite_warehous_id").toInt() <= 0);
    populateLocations();

    _active->setChecked(itemsite.value("itemsite_active").toBool());

    _qohCache = itemsite.value("itemsite_qtyonhand").toDouble();

    _useParameters->setChecked(itemsite.value("itemsite_useparams").toBool());
    _useParametersOnManual->setChecked(itemsite.value("itemsite_useparamsmanual").toBool());

    _reorderLevel->setText(itemsite.value("f_reorderlevel"));
    _orderUpToQty->setText(itemsite.value("f_ordertoqty"));
    _minimumOrder->setText(itemsite.value("f_minordqty"));
    _maximumOrder->setText(itemsite.value("f_maxordqty"));
    _orderMultiple->setText(itemsite.value("f_multordqty"));
    _safetyStock->setText(itemsite.value("f_safetystock"));

    _cycleCountFreq->setValue(itemsite.value("itemsite_cyclecountfreq").toInt());
    _leadTime->setValue(itemsite.value("itemsite_leadtime").toInt());
    _eventFence->setValue(itemsite.value("itemsite_eventfence").toInt());

    _orderGroup->setValue(itemsite.value("itemsite_ordergroup").toInt());
    _mpsTimeFence->setValue(itemsite.value("itemsite_mps_timefence").toInt());

    if (itemsite.value("itemsite_controlmethod").toString() == "N")
    {
      _controlMethod->setCurrentItem(0);
      _wasLotSerial = FALSE;
    }
    else if (itemsite.value("itemsite_controlmethod").toString() == "R")
    {
      _controlMethod->setCurrentItem(1);
      _wasLotSerial = FALSE;
    }
    else if (itemsite.value("itemsite_controlmethod").toString() == "L")
    {
      _controlMethod->setCurrentItem(2);
      _wasLotSerial = TRUE;
    }
    else if (itemsite.value("itemsite_controlmethod").toString() == "S")
    {
      _controlMethod->setCurrentItem(3);
      _wasLotSerial = TRUE;
    }

    if ( (_controlMethod->currentItem() == 2) ||
         (_controlMethod->currentItem() == 3) )
    {
      _perishable->setEnabled(TRUE);
      _perishable->setChecked(itemsite.value("itemsite_perishable").toBool());
    }
    else
      _perishable->setEnabled(FALSE);

    _costcat->setId(itemsite.value("itemsite_costcat_id").toInt());
    _plannerCode->setId(itemsite.value("itemsite_plancode_id").toInt());
    _supply->setChecked(itemsite.value("itemsite_supply").toBool());
    _sold->setChecked(itemsite.value("itemsite_sold").toBool());
    _soldRanking->setValue(itemsite.value("itemsite_soldranking").toInt());
    _stocked->setChecked(itemsite.value("itemsite_stocked").toBool());
    _notes->setText(itemsite.value("itemsite_notes").toString());

    if ( (itemsite.value("item_type").toString() == "P") ||
         (itemsite.value("item_type").toString() == "O")    )
      _createPr->setChecked(itemsite.value("itemsite_createpr").toBool());
    else
      _createPr->setEnabled(FALSE);

    if ( (itemsite.value("item_type").toString() == "M") )
      _createWo->setChecked(itemsite.value("itemsite_createwo").toBool());
    else
      _createWo->setEnabled(FALSE);

    if (itemsite.value("itemsite_loccntrl").toBool())
    {
      _locationControl->setChecked(TRUE);
      _miscLocation->setEnabled(FALSE);
      _miscLocationName->setEnabled(FALSE);
    }
    else
    {
      _locationControl->setChecked(FALSE);
      _miscLocation->setEnabled(TRUE);
      _miscLocationName->setEnabled(TRUE);
    }
    _wasLocationControl = itemsite.value("itemsite_loccntrl").toBool();
    _disallowBlankWIP->setChecked(itemsite.value("itemsite_disallowblankwip").toBool());

    if (itemsite.value("itemsite_location_id").toInt() == -1)
    {
      if (!itemsite.value("itemsite_loccntrl").toBool())
      {
        if (itemsite.value("itemsite_location").toString().length())
        {
          _useDefaultLocation->setChecked(TRUE);
          _miscLocation->setChecked(TRUE);
          _miscLocationName->setEnabled(TRUE);
          _miscLocationName->setText(itemsite.value("itemsite_location").toString());
        }
        else
        {
          _useDefaultLocation->setChecked(FALSE);
        }
      }
    }
    else
    {
      _useDefaultLocation->setChecked(TRUE);
      _location->setChecked(TRUE);
      _locations->setId(itemsite.value("itemsite_location_id").toInt());
    }
	
    _locationComments->setText(itemsite.value("itemsite_location_comments").toString());

    for (int counter = 0; counter < _abcClass->count(); counter++)
      if (_abcClass->text(counter) == itemsite.value("itemsite_abcclass").toString())
        _abcClass->setCurrentItem(counter);

    _autoUpdateABCClass->setChecked(itemsite.value("itemsite_autoabcclass").toBool());
	
    sHandleSupplied(itemsite.value("itemsite_supply").toBool());
    sCacheItemType(_itemType);
    _comments->setId(_itemsiteid);

    _updates = TRUE;
  }
}