invoiceItem::invoiceItem(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_billed, SIGNAL(lostFocus()), this, SLOT(sCalculateExtendedPrice())); connect(_item, SIGNAL(newId(int)), this, SLOT(sPopulateItemInfo(int))); connect(_extended,SIGNAL(valueChanged()), this, SLOT(sLookupTax())); connect(_listPrices, SIGNAL(clicked()), this, SLOT(sListPrices())); connect(_price, SIGNAL(idChanged(int)), this, SLOT(sPriceGroup())); connect(_price, SIGNAL(valueChanged()), this, SLOT(sCalculateExtendedPrice())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_taxLit, SIGNAL(leftClickedURL(QString)), this, SLOT(sTaxDetail())); connect(_taxcode, SIGNAL(newID(int)), this, SLOT(sLookupTax())); connect(_taxtype, SIGNAL(newID(int)), this, SLOT(sLookupTaxCode())); connect(_qtyUOM, SIGNAL(newID(int)), this, SLOT(sQtyUOMChanged())); connect(_pricingUOM, SIGNAL(newID(int)), this, SLOT(sPriceUOMChanged())); connect(_miscSelected, SIGNAL(toggled(bool)), this, SLOT(sMiscSelected(bool))); _item->setType(ItemLineEdit::cSold); _ordered->setValidator(omfgThis->qtyVal()); _billed->setValidator(omfgThis->qtyVal()); _taxtype->setEnabled(_privileges->check("OverrideTax")); _taxcode->setEnabled(_privileges->check("OverrideTax")); _mode = cNew; _invcheadid = -1; _custid = -1; _invcitemid = -1; _priceRatioCache = 1.0; _taxauthid = -1; _cachedPctA = 0; _cachedPctB = 0; _cachedPctC = 0; _cachedRateA = 0; _cachedRateB = 0; _cachedRateC = 0; _qtyinvuomratio = 1.0; _priceinvuomratio = 1.0; _invuomid = -1; //If not multi-warehouse hide whs control if (!_metrics->boolean("MultiWhs")) { _warehouseLit->hide(); _warehouse->hide(); } adjustSize(); }
void creditMemoItem::sQtyUOMChanged() { if(_qtyUOM->id() == _invuomid) _qtyinvuomratio = 1.0; else { XSqlQuery invuom; invuom.prepare("SELECT itemuomtouomratio(item_id, :uom_id, item_inv_uom_id) AS ratio" " FROM item" " WHERE(item_id=:item_id);"); invuom.bindValue(":item_id", _item->id()); invuom.bindValue(":uom_id", _qtyUOM->id()); invuom.exec(); if(invuom.first()) _qtyinvuomratio = invuom.value("ratio").toDouble(); else systemError(this, invuom.lastError().databaseText(), __FILE__, __LINE__); } if(_qtyUOM->id() != _invuomid) { _pricingUOM->setId(_qtyUOM->id()); _pricingUOM->setEnabled(false); } else _pricingUOM->setEnabled(true); sCalculateExtendedPrice(); }
void invoiceItem::sPriceUOMChanged() { if(_pricingUOM->id() == -1 || _qtyUOM->id() == -1) return; if(_pricingUOM->id() == _invuomid) _priceinvuomratio = 1.0; else { XSqlQuery invuom; invuom.prepare("SELECT itemuomtouomratio(item_id, :uom_id, item_inv_uom_id) AS ratio" " FROM item" " WHERE(item_id=:item_id);"); invuom.bindValue(":item_id", _item->id()); invuom.bindValue(":uom_id", _pricingUOM->id()); invuom.exec(); if(invuom.first()) _priceinvuomratio = invuom.value("ratio").toDouble(); else systemError(this, invuom.lastError().databaseText(), __FILE__, __LINE__); } XSqlQuery item; item.prepare("SELECT item_listprice" " FROM item" " WHERE(item_id=:item_id);"); item.bindValue(":item_id", _item->id()); item.exec(); item.first(); _listPrice->setBaseValue(item.value("item_listprice").toDouble() * (_priceinvuomratio / _priceRatioCache)); sDeterminePrice(); sCalculateExtendedPrice(); }
void invoiceItem::populate() { XSqlQuery invcitem; invcitem.prepare( "SELECT invcitem.*," " CASE WHEN (item_id IS NULL) THEN :na" " ELSE item_listprice" " END AS f_listprice " "FROM invcitem LEFT OUTER JOIN item ON (invcitem_item_id=item_id) " "WHERE (invcitem_id=:invcitem_id);" ); invcitem.bindValue(":invcitem_id", _invcitemid); invcitem.exec(); if (invcitem.first()) { _invcheadid = invcitem.value("invcitem_invchead_id").toInt(); _lineNumber->setText(invcitem.value("invcitem_linenumber").toString()); if (invcitem.value("invcitem_item_id").toInt() != -1) { _itemSelected->setChecked(TRUE); _item->setId(invcitem.value("invcitem_item_id").toInt()); _warehouse->setId(invcitem.value("invcitem_warehous_id").toInt()); } else { _miscSelected->setChecked(TRUE); _itemNumber->setText(invcitem.value("invcitem_number")); _itemDescrip->setText(invcitem.value("invcitem_descrip").toString()); _salescat->setId(invcitem.value("invcitem_salescat_id").toInt()); } _ordered->setText(formatQty(invcitem.value("invcitem_ordered").toDouble())); _billed->setText(formatQty(invcitem.value("invcitem_billed").toDouble())); _price->setLocalValue(invcitem.value("invcitem_price").toDouble()); _custPrice->setLocalValue(invcitem.value("invcitem_custprice").toDouble()); _listPrice->setBaseValue(invcitem.value("f_listprice").toDouble()); _custPn->setText(invcitem.value("invcitem_custpn").toString()); _notes->setText(invcitem.value("invcitem_notes").toString()); // do taxcode/taxtype before invcitem_tax_* to avoid signal cascade problems _taxcode->setId(invcitem.value("invcitem_tax_id").toInt()); _taxtype->setId(invcitem.value("invcitem_taxtype_id").toInt()); _cachedPctA = invcitem.value("invcitem_tax_pcta").toDouble(); _cachedPctB = invcitem.value("invcitem_tax_pctb").toDouble(); _cachedPctC = invcitem.value("invcitem_tax_pctc").toDouble(); _cachedRateA = invcitem.value("invcitem_tax_ratea").toDouble(); _cachedRateB = invcitem.value("invcitem_tax_rateb").toDouble(); _cachedRateC = invcitem.value("invcitem_tax_ratec").toDouble(); _tax->setLocalValue(_cachedRateA + _cachedRateB + _cachedRateC); } else if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } sCalculateExtendedPrice(); }
/* TODO: connect(_warehouse id, SIGNAL(newId(int)), ...) to set _trackqoh? bug 16465 - seems too disruptive now as we're between 3.8.0RC and RC2 */ invoiceItem::invoiceItem(QWidget* parent, const char * name, Qt::WindowFlags fl) : XDialog(parent, name, fl) { setupUi(this); connect(_billed, SIGNAL(editingFinished()), this, SLOT(sCalculateExtendedPrice())); connect(_item, SIGNAL(newId(int)), this, SLOT(sPopulateItemInfo(int))); connect(_item, SIGNAL(newId(int)), this, SLOT(sHandleUpdateInv())); connect(_extended,SIGNAL(valueChanged()), this, SLOT(sLookupTax())); connect(_listPrices, SIGNAL(clicked()), this, SLOT(sListPrices())); connect(_price, SIGNAL(idChanged(int)), this, SLOT(sPriceGroup())); connect(_price, SIGNAL(valueChanged()), this, SLOT(sCalculateExtendedPrice())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_taxLit, SIGNAL(leftClickedURL(QString)), this, SLOT(sTaxDetail())); connect(_taxtype, SIGNAL(newID(int)), this, SLOT(sLookupTax())); connect(_qtyUOM, SIGNAL(newID(int)), this, SLOT(sQtyUOMChanged())); connect(_pricingUOM, SIGNAL(newID(int)), this, SLOT(sPriceUOMChanged())); connect(_miscSelected, SIGNAL(toggled(bool)), this, SLOT(sMiscSelected(bool))); _ordered->setValidator(omfgThis->qtyVal()); _billed->setValidator(omfgThis->qtyVal()); _altRevAccnt->setType(GLCluster::cRevenue); _taxtype->setEnabled(_privileges->check("OverrideTax")); _mode = cNew; _invcheadid = -1; _custid = -1; _invcitemid = -1; _priceRatioCache = 1.0; _taxzoneid = -1; _qtyinvuomratio = 1.0; _priceinvuomratio = 1.0; _invuomid = -1; _trackqoh = true; //If not multi-warehouse hide whs control if (!_metrics->boolean("MultiWhs")) { _warehouseLit->hide(); _warehouse->hide(); } _saved = false; adjustSize(); }
creditMemoItem::creditMemoItem(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); #ifndef Q_WS_MAC _listPrices->setMaximumWidth(25); #endif connect(_discountFromSale, SIGNAL(lostFocus()), this, SLOT(sCalculateFromDiscount())); //connect(_extendedPrice, SIGNAL(valueChanged()), this, SLOT(sLookupTax())); connect(_item, SIGNAL(newId(int)), this, SLOT(sPopulateItemInfo())); connect(_listPrices, SIGNAL(clicked()), this, SLOT(sListPrices())); connect(_netUnitPrice, SIGNAL(valueChanged()), this, SLOT(sCalculateDiscountPrcnt())); connect(_netUnitPrice, SIGNAL(valueChanged()), this, SLOT(sCalculateExtendedPrice())); connect(_netUnitPrice, SIGNAL(idChanged(int)), this, SLOT(sPriceGroup())); connect(_qtyToCredit, SIGNAL(textChanged(const QString&)), this, SLOT(sCalculateExtendedPrice())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_taxCode, SIGNAL(newID(int)), this, SLOT(sLookupTax())); connect(_taxLit, SIGNAL(leftClickedURL(const QString&)), this, SLOT(sTaxDetail())); connect(_taxType, SIGNAL(newID(int)), this, SLOT(sLookupTaxCode())); connect(_qtyUOM, SIGNAL(newID(int)), this, SLOT(sQtyUOMChanged())); connect(_pricingUOM, SIGNAL(newID(int)), this, SLOT(sPriceUOMChanged())); _mode = cNew; _cmitemid = -1; _cmheadid = -1; _custid = -1; _invoiceNumber = -1; _priceRatio = 1.0; _qtyShippedCache = 0.0; _shiptoid = -1; _taxauthid = -1; _taxCache.clear(); _qtyinvuomratio = 1.0; _priceinvuomratio = 1.0; _invuomid = -1; _qtyToCredit->setValidator(omfgThis->qtyVal()); _qtyReturned->setValidator(omfgThis->qtyVal()); _qtyShipped->setPrecision(omfgThis->qtyVal()); _discountFromList->setPrecision(omfgThis->percentVal()); _discountFromSale->setValidator(new QDoubleValidator(-9999, 100, 2, this)); _taxType->setEnabled(_privileges->check("OverrideTax")); _taxCode->setEnabled(_privileges->check("OverrideTax")); //If not multi-warehouse hide whs control if (!_metrics->boolean("MultiWhs")) { _warehouseLit->hide(); _warehouse->hide(); } adjustSize(); }
void invoiceItem::populate() { XSqlQuery invcitem; invcitem.prepare( "SELECT invcitem.*," " CASE WHEN (item_id IS NULL) THEN :na" " ELSE item_listprice" " END AS f_listprice," " taxauth_id," " COALESCE(taxauth_curr_id, invchead_curr_id) AS taxcurrid " "FROM invcitem JOIN " " invchead ON (invcitem_invchead_id=invchead_id) LEFT OUTER JOIN" " item ON (invcitem_item_id=item_id) LEFT OUTER JOIN " " taxauth ON (invchead_taxauth_id=taxauth_id) " "WHERE (invcitem_id=:invcitem_id);" ); invcitem.bindValue(":invcitem_id", _invcitemid); invcitem.exec(); if (invcitem.first()) { _invcheadid = invcitem.value("invcitem_invchead_id").toInt(); _lineNumber->setText(invcitem.value("invcitem_linenumber").toString()); if (invcitem.value("invcitem_item_id").toInt() != -1) { _itemSelected->setChecked(TRUE); _item->setId(invcitem.value("invcitem_item_id").toInt()); _warehouse->setId(invcitem.value("invcitem_warehous_id").toInt()); } else { _miscSelected->setChecked(TRUE); _itemNumber->setText(invcitem.value("invcitem_number")); _itemDescrip->setText(invcitem.value("invcitem_descrip").toString()); _salescat->setId(invcitem.value("invcitem_salescat_id").toInt()); } _qtyUOM->setId(invcitem.value("invcitem_qty_uom_id").toInt()); _qtyinvuomratio = invcitem.value("invcitem_qty_invuomratio").toDouble(); _pricingUOM->setId(invcitem.value("invcitem_price_uom_id").toInt()); _priceinvuomratio = invcitem.value("invcitem_price_invuomratio").toDouble(); // do tax stuff before invcitem_price and _tax_* to avoid signal cascade problems if (! invcitem.value("taxauth_id").isNull()) _taxauthid = invcitem.value("taxauth_id").toInt(); _tax->setId(invcitem.value("taxcurr_id").toInt()); _taxcode->setId(invcitem.value("invcitem_tax_id").toInt()); _taxtype->setId(invcitem.value("invcitem_taxtype_id").toInt()); _ordered->setDouble(invcitem.value("invcitem_ordered").toDouble()); _billed->setDouble(invcitem.value("invcitem_billed").toDouble()); _price->setLocalValue(invcitem.value("invcitem_price").toDouble()); _custPrice->setLocalValue(invcitem.value("invcitem_custprice").toDouble()); _listPrice->setBaseValue(invcitem.value("f_listprice").toDouble() * (_priceinvuomratio / _priceRatioCache)); _custPn->setText(invcitem.value("invcitem_custpn").toString()); _notes->setText(invcitem.value("invcitem_notes").toString()); _cachedPctA = invcitem.value("invcitem_tax_pcta").toDouble(); _cachedPctB = invcitem.value("invcitem_tax_pctb").toDouble(); _cachedPctC = invcitem.value("invcitem_tax_pctc").toDouble(); _cachedRateA = invcitem.value("invcitem_tax_ratea").toDouble(); _cachedRateB = invcitem.value("invcitem_tax_rateb").toDouble(); _cachedRateC = invcitem.value("invcitem_tax_ratec").toDouble(); _tax->setLocalValue(_cachedRateA + _cachedRateB + _cachedRateC); } else if (invcitem.lastError().type() != QSqlError::NoError) { systemError(this, invcitem.lastError().databaseText(), __FILE__, __LINE__); return; } sCalculateExtendedPrice(); }
enum SetResponse invoiceItem::set(const ParameterList &pParams) { QVariant param; bool valid; param = pParams.value("invchead_id", &valid); if (valid) { _invcheadid = param.toInt(); q.prepare("SELECT taxauth_id, " " COALESCE(taxauth_curr_id, invchead_curr_id) AS curr_id " "FROM invchead, taxauth " "WHERE ((invchead_taxauth_id=taxauth_id)" " AND (invchead_id=:invchead_id));"); q.bindValue(":invchead_id", _invcheadid); q.exec(); if (q.first()) { _taxauthid = q.value("taxauth_id").toInt(); _tax->setId(q.value("curr_id").toInt()); } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return UndefinedError; } } param = pParams.value("invoiceNumber", &valid); if (valid) _invoiceNumber->setText(param.toString()); param = pParams.value("cust_id", &valid); if (valid) _custid = param.toInt(); param = pParams.value("cust_curr_id", &valid); if (valid) { _price->setId(param.toInt()); sPriceGroup(); } param = pParams.value("curr_date", &valid); if (valid) _price->setEffective(param.toDate()); param = pParams.value("invcitem_id", &valid); if (valid) { _invcitemid = param.toInt(); populate(); } param = pParams.value("mode", &valid); if (valid) { if (param.toString() == "new") { _mode = cNew; q.prepare( "SELECT (COALESCE(MAX(invcitem_linenumber), 0) + 1) AS linenumber " "FROM invcitem " "WHERE (invcitem_invchead_id=:invchead_id);" ); q.bindValue(":invchead_id", _invcheadid); q.exec(); if (q.first()) _lineNumber->setText(q.value("linenumber").toString()); else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return UndefinedError; } connect(_billed, SIGNAL(lostFocus()), this, SLOT(sDeterminePrice())); connect(_billed, SIGNAL(lostFocus()), this, SLOT(sCalculateExtendedPrice())); connect(_price, SIGNAL(lostFocus()), this, SLOT(sCalculateExtendedPrice())); } else if (param.toString() == "edit") { _mode = cEdit; connect(_billed, SIGNAL(lostFocus()), this, SLOT(sCalculateExtendedPrice())); connect(_price, SIGNAL(lostFocus()), this, SLOT(sCalculateExtendedPrice())); _save->setFocus(); } else if (param.toString() == "view") { _mode = cView; _itemTypeGroup->setEnabled(FALSE); _custPn->setEnabled(FALSE); _ordered->setEnabled(FALSE); _billed->setEnabled(FALSE); _price->setEnabled(FALSE); _notes->setReadOnly(TRUE); _taxtype->setEnabled(false); _taxcode->setEnabled(false); _save->hide(); _close->setText(tr("&Cancel")); _close->setFocus(); } } return NoError; }
void invoiceItem::populate() { XSqlQuery invcitem; invcitem.prepare( "SELECT invcitem.*, invchead_invcnumber," " CASE WHEN (item_id IS NULL) THEN :na" " ELSE item_listprice" " END AS f_listprice," " taxzone_id," " invchead_curr_id AS taxcurr_id " "FROM invcitem JOIN " " invchead LEFT OUTER JOIN taxzone ON " " (invchead_taxzone_id = taxzone_id) " " ON (invcitem_invchead_id = invchead_id) LEFT OUTER JOIN " " item ON (invcitem_item_id = item_id) " " LEFT OUTER JOIN invcitemtax ON (invcitem_id = taxhist_parent_id) " "WHERE (invcitem_id = :invcitem_id);" ); invcitem.bindValue(":invcitem_id", _invcitemid); invcitem.exec(); if (invcitem.first()) { _invcheadid = invcitem.value("invcitem_invchead_id").toInt(); _invoiceNumber->setText(invcitem.value("invchead_invcnumber").toString()); _lineNumber->setText(invcitem.value("invcitem_linenumber").toString()); _isMisc = ((invcitem.value("invcitem_coitem_id").toInt() > 0) ? false : true); if (invcitem.value("invcitem_item_id").toInt() != -1) { _itemSelected->setChecked(TRUE); _item->setId(invcitem.value("invcitem_item_id").toInt()); _warehouse->setId(invcitem.value("invcitem_warehous_id").toInt()); } else { _miscSelected->setChecked(TRUE); _itemNumber->setText(invcitem.value("invcitem_number")); _itemDescrip->setText(invcitem.value("invcitem_descrip").toString()); _salescat->setId(invcitem.value("invcitem_salescat_id").toInt()); } _qtyUOM->setId(invcitem.value("invcitem_qty_uom_id").toInt()); _qtyinvuomratio = invcitem.value("invcitem_qty_invuomratio").toDouble(); _pricingUOM->setId(invcitem.value("invcitem_price_uom_id").toInt()); _priceinvuomratio = invcitem.value("invcitem_price_invuomratio").toDouble(); // do tax stuff before invcitem_price and _tax_* to avoid signal cascade problems if (! invcitem.value("taxzone_id").isNull()) _taxzoneid = invcitem.value("taxzone_id").toInt(); _tax->setId(invcitem.value("taxcurr_id").toInt()); _taxtype->setId(invcitem.value("invcitem_taxtype_id").toInt()); _ordered->setDouble(invcitem.value("invcitem_ordered").toDouble()); _billed->setDouble(invcitem.value("invcitem_billed").toDouble()); if ( (invcitem.value("invcitem_coitem_id").toInt() > 0) || (invcitem.value("invcitem_item_id").toInt() == -1) ) { _updateInv->setChecked(false); _updateInv->setEnabled(false); } else { _updateInv->setChecked(invcitem.value("invcitem_updateinv").toBool()); _updateInv->setEnabled(true); } _price->setLocalValue(invcitem.value("invcitem_price").toDouble()); _custPrice->setLocalValue(invcitem.value("invcitem_custprice").toDouble()); _listPrice->setBaseValue(invcitem.value("f_listprice").toDouble() * (_priceinvuomratio / _priceRatioCache)); _custPn->setText(invcitem.value("invcitem_custpn").toString()); _notes->setText(invcitem.value("invcitem_notes").toString()); } else if (invcitem.lastError().type() != QSqlError::NoError) { systemError(this, invcitem.lastError().databaseText(), __FILE__, __LINE__); return; } invcitem.prepare( "SELECT SUM(COALESCE(taxhist_tax, 0.00)) AS lineTaxTotal " "FROM invcitem LEFT OUTER JOIN invcitemtax " " ON (invcitem_id = taxhist_parent_id) " "WHERE invcitem_id = :invcitem_id;" ); invcitem.bindValue(":invcitem_id", _invcitemid); invcitem.exec(); if (invcitem.first()) _tax->setLocalValue(invcitem.value("lineTaxTotal").toDouble()); else if (invcitem.lastError().type() != QSqlError::NoError) { systemError(this, invcitem.lastError().databaseText(), __FILE__, __LINE__); return; } sCalculateExtendedPrice(); _saved = true; }
enum SetResponse invoiceItem::set(const ParameterList &pParams) { XSqlQuery invoiceet; XDialog::set(pParams); QVariant param; bool valid; param = pParams.value("invchead_id", &valid); if (valid) { _invcheadid = param.toInt(); invoiceet.prepare("SELECT * " "FROM invchead " "WHERE (invchead_id = :invchead_id);"); invoiceet.bindValue(":invchead_id", _invcheadid); invoiceet.exec(); if (invoiceet.first()) { _invoiceNumber->setText(invoiceet.value("invchead_invcnumber").toString()); _custid = invoiceet.value("invchead_cust_id").toInt(); _taxzoneid = invoiceet.value("invchead_taxzone_id").toInt(); _tax->setId(invoiceet.value("invchead_curr_id").toInt()); _price->setId(invoiceet.value("invchead_curr_id").toInt()); _price->setEffective(invoiceet.value("invchead_invcdate").toDate()); sPriceGroup(); } else if (invoiceet.lastError().type() != QSqlError::NoError) { systemError(this, invoiceet.lastError().databaseText(), __FILE__, __LINE__); return UndefinedError; } } param = pParams.value("invcitem_id", &valid); if (valid) { _invcitemid = param.toInt(); populate(); } param = pParams.value("mode", &valid); if (valid) { if (param.toString() == "new") { _mode = cNew; invoiceet.exec("SELECT NEXTVAL('invcitem_invcitem_id_seq') AS invcitem_id;"); if (invoiceet.first()) _invcitemid = invoiceet.value("invcitem_id").toInt(); else if (invoiceet.lastError().type() != QSqlError::NoError) { systemError(this, invoiceet.lastError().databaseText(), __FILE__, __LINE__); return UndefinedError; } invoiceet.prepare( "SELECT (COALESCE(MAX(invcitem_linenumber), 0) + 1) AS linenumber " "FROM invcitem " "WHERE (invcitem_invchead_id=:invchead_id);" ); invoiceet.bindValue(":invchead_id", _invcheadid); invoiceet.exec(); if (invoiceet.first()) _lineNumber->setText(invoiceet.value("linenumber").toString()); else if (invoiceet.lastError().type() != QSqlError::NoError) { systemError(this, invoiceet.lastError().databaseText(), __FILE__, __LINE__); return UndefinedError; } connect(_billed, SIGNAL(editingFinished()), this, SLOT(sDeterminePrice())); connect(_billed, SIGNAL(editingFinished()), this, SLOT(sCalculateExtendedPrice())); connect(_price, SIGNAL(editingFinished()), this, SLOT(sCalculateExtendedPrice())); _item->setType(ItemLineEdit::cSold); _salescat->setType(XComboBox::SalesCategoriesActive); } else if (param.toString() == "edit") { _mode = cEdit; connect(_billed, SIGNAL(editingFinished()), this, SLOT(sDeterminePrice())); connect(_billed, SIGNAL(editingFinished()), this, SLOT(sCalculateExtendedPrice())); connect(_price, SIGNAL(editingFinished()), this, SLOT(sCalculateExtendedPrice())); } else if (param.toString() == "view") { _mode = cView; _itemTypeGroup->setEnabled(FALSE); _custPn->setEnabled(FALSE); _ordered->setEnabled(FALSE); _billed->setEnabled(FALSE); _price->setEnabled(FALSE); _notes->setReadOnly(TRUE); _taxtype->setEnabled(false); _altRevAccnt->setEnabled(false); _qtyUOM->setEnabled(false); _pricingUOM->setEnabled(false); _save->hide(); _close->setText(tr("&Cancel")); } } return NoError; }