void dspPoItemsByVendor::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *pSelected) { int menuItem; if (pSelected->text(POITEM_STATUS_COL) == "U") { menuItem = pMenu->insertItem(tr("Edit Order..."), this, SLOT(sEditOrder()), 0); if (!_privileges->check("MaintainPurchaseOrders")) pMenu->setItemEnabled(menuItem, FALSE); } menuItem = pMenu->insertItem(tr("View Order..."), this, SLOT(sViewOrder()), 0); if ((!_privileges->check("MaintainPurchaseOrders")) && (!_privileges->check("ViewPurchaseOrders"))) pMenu->setItemEnabled(menuItem, FALSE); menuItem = pMenu->insertItem(tr("Running Availability..."), this, SLOT(sRunningAvailability()), 0); if (!_privileges->check("ViewInventoryAvailability")) pMenu->setItemEnabled(menuItem, FALSE); pMenu->insertSeparator(); if (pSelected->text(POITEM_STATUS_COL) == "U") { menuItem = pMenu->insertItem(tr("Edit Item..."), this, SLOT(sEditItem()), 0); if (!_privileges->check("MaintainPurchaseOrders")) pMenu->setItemEnabled(menuItem, FALSE); } menuItem = pMenu->insertItem(tr("View Item..."), this, SLOT(sViewItem()), 0); if ((!_privileges->check("MaintainPurchaseOrders")) && (!_privileges->check("ViewPurchaseOrders"))) pMenu->setItemEnabled(menuItem, FALSE); if (pSelected->text(POITEM_STATUS_COL) != "C") { menuItem = pMenu->insertItem(tr("Reschedule..."), this, SLOT(sReschedule()), 0); if (!_privileges->check("ReschedulePurchaseOrders")) pMenu->setItemEnabled(menuItem, FALSE); menuItem = pMenu->insertItem(tr("Change Qty..."), this, SLOT(sChangeQty()), 0); if (!_privileges->check("ChangePurchaseOrderQty")) pMenu->setItemEnabled(menuItem, FALSE); pMenu->insertSeparator(); } if (pSelected->text(POITEM_STATUS_COL) == "O") { menuItem = pMenu->insertItem(tr("Close Item..."), this, SLOT(sCloseItem()), 0); if (!_privileges->check("MaintainPurchaseOrders")) pMenu->setItemEnabled(menuItem, FALSE); } else if (pSelected->text(POITEM_STATUS_COL) == "C") { menuItem = pMenu->insertItem(tr("Open Item..."), this, SLOT(sOpenItem()), 0); if (!_privileges->check("MaintainPurchaseOrders")) pMenu->setItemEnabled(menuItem, FALSE); } }
void dspPoItemsByItem::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *pSelected, int) { QAction *menuItem; XTreeWidgetItem *item = dynamic_cast<XTreeWidgetItem*>(pSelected); if (item && item->rawValue("poitem_status") == "U") { menuItem = pMenu->addAction(tr("Edit Order..."), this, SLOT(sEditOrder())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } menuItem = pMenu->addAction(tr("View Order..."), this, SLOT(sViewOrder())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders") || _privileges->check("ViewPurchaseOrders")); menuItem = pMenu->addAction(tr("Running Availability..."), this, SLOT(sRunningAvailability())); menuItem->setEnabled(_privileges->check("ViewInventoryAvailability")); pMenu->addSeparator(); if (item && item->rawValue("poitem_status") == "U") { menuItem = pMenu->addAction(tr("Edit Item..."), this, SLOT(sEditItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } menuItem = pMenu->addAction(tr("View Item..."), this, SLOT(sViewItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders") || _privileges->check("ViewPurchaseOrders")); if (item && item->rawValue("poitem_status") != "C") { menuItem = pMenu->addAction(tr("Reschedule..."), this, SLOT(sReschedule())); menuItem->setEnabled(_privileges->check("ReschedulePurchaseOrders")); menuItem = pMenu->addAction(tr("Change Qty..."), this, SLOT(sChangeQty())); menuItem->setEnabled(_privileges->check("ChangePurchaseOrderQty")); pMenu->addSeparator(); } if (item && item->rawValue("poitem_status") == "O") { menuItem = pMenu->addAction(tr("Close Item..."), this, SLOT(sCloseItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } else if (item && item->rawValue("poitem_status") == "C") { menuItem = pMenu->addAction(tr("Open Item..."), this, SLOT(sOpenItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } }