void returnAuthorizationWorkbench::sPopulateDueMenu(QMenu *pMenu, QTreeWidgetItem * /*pSelected*/)
{
  QAction *menuItem;

  menuItem = pMenu->addAction(tr("Edit..."), this, SLOT(sEditDue()));
  menuItem->setEnabled(_privileges->check("MaintainReturns"));

  menuItem = pMenu->addAction(tr("View..."), this, SLOT(sViewDue()));
  
  menuItem = pMenu->addAction(tr("Process..."), this, SLOT(sProcess()));
  menuItem->setEnabled((_radue->altId() == 1 && _privileges->check("MaintainCreditMemos")) ||
                       (_radue->altId() == 2 && _privileges->check("MaintainPayments") &&
                        _privileges->check("MaintainCreditMemos") && 
                        _privileges->check("PostARDocuments")) ||
                       (_radue->altId() == 3 &&
                        _privileges->check("ProcessCreditCards") &&
                        _privileges->check("PostARDocuments") &&
                        _privileges->check("MaintainCreditMemos")));
}
Exemple #2
0
returnAuthorizationWorkbench::returnAuthorizationWorkbench(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  _codeGroup = new QButtonGroup(this);
  _codeGroup->addButton(_cust);
  _codeGroup->addButton(_custtype);
  _custInfo->hide();
  _parameter->setType(ParameterGroup::CustomerType);

//  connect(_ra, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*,QTreeWidgetItem*)));
//  connect(_radue, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*,QTreeWidgetItem*)));
  connect(_codeGroup, SIGNAL(buttonClicked(int)), this, SLOT(sParameterTypeChanged()));
  connect(_queryReview, SIGNAL(clicked()), this, SLOT(sFillListReview()));
  connect(_queryDue, SIGNAL(clicked()), this, SLOT(sFillListDue()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_editdue, SIGNAL(clicked()), this, SLOT(sEditDue()));
  connect(_viewdue, SIGNAL(clicked()), this, SLOT(sViewDue()));
  connect(_printdue, SIGNAL(clicked()), this, SLOT(sPrintDue()));
  connect(_process, SIGNAL(clicked()), this, SLOT(sProcess()));
  connect(_radue, SIGNAL(valid(bool)), this, SLOT(sHandleButton()));
  connect(omfgThis, SIGNAL(returnAuthorizationsUpdated()), this, SLOT(sFillListReview()));
  connect(omfgThis, SIGNAL(returnAuthorizationsUpdated()), this, SLOT(sFillListDue()));

  _ra->addColumn(tr("Auth. #"),       _orderColumn,   Qt::AlignLeft,   true, "rahead_number"   );
  _ra->addColumn(tr("Customer"),     -1,              Qt::AlignLeft,   true, "cust_name"  );
  _ra->addColumn(tr("Authorized"),   _dateColumn,     Qt::AlignRight,  true, "rahead_authdate"  );
  _ra->addColumn(tr("Expires"),      _dateColumn,     Qt::AlignRight,  true, "rahead_expiredate"  );
  _ra->addColumn(tr("Disposition"),  _itemColumn,     Qt::AlignRight,  true, "disposition"  );
  _ra->addColumn(tr("Credit By"),    _itemColumn,     Qt::AlignRight,  true, "creditmethod"  );
  _ra->addColumn(tr("Awaiting"),     _itemColumn,     Qt::AlignCenter, true, "awaiting" );

  _radue->addColumn(tr("Auth. #"),       _orderColumn,   Qt::AlignLeft, true, "rahead_number"   );
  _radue->addColumn(tr("Customer"),     -1,              Qt::AlignLeft, true, "cust_name"   );
  _radue->addColumn(tr("Authorized"),   _dateColumn,     Qt::AlignRight,true, "rahead_authdate");
  _radue->addColumn(tr("Amount"),       _moneyColumn,    Qt::AlignRight,true, "amount"  );
  _radue->addColumn(tr("Currency"),     _currencyColumn, Qt::AlignRight,true, "currency"  );
  _radue->addColumn(tr("Amount (%1)").arg(CurrDisplay::baseCurrAbbr()),
					_moneyColumn,    Qt::AlignRight,true, "baseamount"  );
  _radue->addColumn(tr("Credit By"),    _itemColumn,     Qt::AlignRight,true, "creditmethod"  );

  if (!_privileges->check("MaintainReturns"))
  {
    _edit->hide();
    _editdue->hide();
  }

  if (_metrics->boolean("CCAccept") && _privileges->check("ProcessCreditCards"))
  {
    /*
    if (! CreditCardProcessor::getProcessor())
      QMessageBox::warning(this, tr("Credit Card Processing error"),
			   CreditCardProcessor::errorMsg());
    */
  }
  else
  {
    _creditcard->setChecked(false);
    _creditcard->hide();
  }

  if (!_privileges->check("PostARDocuments"))
  {
    _postmemos->setChecked(false);
    _postmemos->setEnabled(false);
  }
}