示例#1
0
/*
 *  Constructs a dspCashReceipts as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
dspCashReceipts::dspCashReceipts(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

//  (void)statusBar();

  // signals and slots connections
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNewCashrcpt()));
  connect(_post, SIGNAL(clicked()), this, SLOT(sPostCashrcpt()));
  connect(_reverse, SIGNAL(clicked()), this, SLOT(sReversePosted()));
  connect(_arapply, SIGNAL(valid(bool)), this, SLOT(sHandleButtons(bool)));
  connect(_arapply, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_applications, SIGNAL(toggled(bool)), _arapply, SLOT(clear()));
  connect(_applications, SIGNAL(toggled(bool)), this, SLOT(sHandleButtons(bool)));

  _dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _dates->setStartDate(QDate().currentDate().addDays(-90));
  _dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);
  
  _arapply->addColumn(tr("Number"),      _orderColumn,    Qt::AlignCenter, true,  "cashrcpt_number" );
  _arapply->addColumn(tr("Source"),      _itemColumn,     Qt::AlignLeft,   true,  "source" );
  _arapply->addColumn(tr("Cust. #"),     _orderColumn,    Qt::AlignCenter, true,  "cust_number" );
  _arapply->addColumn(tr("Customer"),    -1,              Qt::AlignLeft,   true,  "cust_name"   );
  _arapply->addColumn(tr("Posted"),      _ynColumn,       Qt::AlignCenter, true,  "posted" );
  _arapply->addColumn(tr("Voided"),      _ynColumn,       Qt::AlignCenter, true,  "voided" );
  _arapply->addColumn(tr("Date"),        _dateColumn,     Qt::AlignCenter, true,  "postdate" );
  _arapply->addColumn(tr("Apply-To"),    _itemColumn,     Qt::AlignCenter, true,  "target" );
  _arapply->addColumn(tr("Amount"),      _bigMoneyColumn, Qt::AlignRight,  true,  "applied"  );
  _arapply->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignLeft,   true,  "currAbbr"   );
  _arapply->addColumn(tr("Base Amount"), _bigMoneyColumn, Qt::AlignRight,  true,  "base_applied"  );
  
  _upgradeWarn = new XErrorMessage(this);
  
  _new->setEnabled(_privileges->check("MaintainCashReceipts"));
  
  sHandleButtons(false);
}
示例#2
0
void dspCashReceipts::sPopulateMenu(QMenu * pMenu, QTreeWidgetItem *, int)
{
  QAction *menuItem = 0;
  
  if (list()->id() > -1)
  {
    // Cash Receipt              
    if (!list()->currentItem()->rawValue("posted").toBool() && !list()->currentItem()->rawValue("voided").toBool())
    {
      menuItem = pMenu->addAction(tr("Edit Cash Receipt..."), this, SLOT(sEditCashrcpt()));
      menuItem->setEnabled(_privileges->check("MaintainCashReceipts"));
    }

    menuItem = pMenu->addAction(tr("View Cash Receipt..."), this, SLOT(sViewCashrcpt()));
    menuItem->setEnabled(_privileges->check("ViewCashReceipts") || _privileges->check("MaintainCashReceipts"));

    if (!list()->currentItem()->rawValue("voided").toBool())
    {      
      if (!list()->currentItem()->rawValue("posted").toBool())
      {   
        menuItem = pMenu->addAction(tr("Post Cash Receipt"), this, SLOT(sPostCashrcpt()));
        menuItem->setEnabled(_privileges->check("PostCashReceipts"));
      }
      else if (!list()->altId())
      {
        menuItem = pMenu->addAction(tr("Void Posted Cash Receipt"), this, SLOT(sReversePosted()));
        menuItem->setEnabled(_privileges->check("ReversePostedCashReceipt"));
      }
    }

    // Open Item
    if (list()->currentItem()->id("target") > -1 )
    {
      pMenu->addSeparator();
      menuItem = pMenu->addAction(tr("Edit Receivable Item..."), this, SLOT(sEditAropen()));
      menuItem->setEnabled(_privileges->check("EditAROpenItem"));
      menuItem = pMenu->addAction(tr("View Receivable Item..."), this, SLOT(sViewAropen()));
      menuItem->setEnabled(_privileges->check("ViewAROpenItems") || _privileges->check("EditAROpenItem"));
    }
  }
}
示例#3
0
void dspCashReceipts::sPopulateMenu( QMenu * pMenu )
{
  int menuItem = -1;
  
  if (_arapply->id() > -1)
  {
    // Cash Receipt              
    if (!_arapply->currentItem()->rawValue("posted").toBool() && !_arapply->currentItem()->rawValue("voided").toBool())
    {
      menuItem = pMenu->insertItem(tr("Edit Cash Receipt..."), this, SLOT(sEditCashrcpt()), 0);
      pMenu->setItemEnabled(menuItem, _privileges->check("MaintainCashReceipts"));
    }

    pMenu->insertItem(tr("View Cash Receipt..."), this, SLOT(sViewCashrcpt()), 0);
    pMenu->setItemEnabled(menuItem, _privileges->check("ViewCashReceipts") || _privileges->check("MaintainCashReceipts"));

    if (!_arapply->currentItem()->rawValue("voided").toBool())
    {      
      if (!_arapply->currentItem()->rawValue("posted").toBool())
      {   
        menuItem = pMenu->insertItem(tr("Post Cash Receipt"), this, SLOT(sPostCashrcpt()), 0);
        pMenu->setItemEnabled(menuItem, _privileges->check("PostCashReceipts"));
      }
      else if (!_arapply->altId())
      {
        menuItem = pMenu->insertItem(tr("Reverse Posted Cash Receipt"), this, SLOT(sReversePosted()), 0);
        pMenu->setItemEnabled(menuItem, _privileges->check("ReversePostedCashReceipt"));
      }
    }

    // Open Item
    if (_arapply->currentItem()->id("target") > -1 )
    {
      pMenu->insertSeparator();
      menuItem = pMenu->insertItem(tr("Edit Receivable Item..."), this, SLOT(sEditAropen()), 0);
      pMenu->setItemEnabled(menuItem, _privileges->check("EditAROpenItem"));
      menuItem = pMenu->insertItem(tr("View Receivable Item..."), this, SLOT(sViewAropen()), 0);
      pMenu->setItemEnabled(menuItem, _privileges->check("ViewAROpenItems") || _privileges->check("EditAROpenItem"));
    }
  }
}