Example #1
0
cashReceipt::cashReceipt(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_cust, SIGNAL(newId(int)), this, SLOT(sPopulateCustomerInfo(int)));
  connect(_received, SIGNAL(lostFocus()), this, SLOT(sUpdateBalance()));
  connect(_applyToBalance, SIGNAL(clicked()), this, SLOT(sApplyToBalance()));
  connect(_apply, SIGNAL(clicked()), this, SLOT(sApply()));
  connect(_applyLineBalance, SIGNAL(clicked()), this, SLOT(sApplyLineBalance()));
  connect(_add, SIGNAL(clicked()), this, SLOT(sAdd()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_clear, SIGNAL(clicked()), this, SLOT(sClear()));
  connect(_searchDocNum, SIGNAL(textChanged(const QString&)), this, SLOT(sSearchDocNumChanged()));
  connect(_applied, SIGNAL(valueChanged()), this, SLOT(sUpdateBalance()));
  connect(_miscDistribs, SIGNAL(valueChanged()), this, SLOT(sUpdateBalance()));
  connect(_received, SIGNAL(valueChanged()), this, SLOT(sUpdateBalance()));
  connect(_received, SIGNAL(idChanged(int)), this, SLOT(sFillApplyList()));
  connect(_received, SIGNAL(idChanged(int)), this, SLOT(sFillMiscList()));
  connect(_received, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(sFillApplyList()));
  connect(_received, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(sFillMiscList()));
  connect(_received, SIGNAL(idChanged(int)), this, SLOT(sChangeCurrency(int)));
  if (_metrics->boolean("CCAccept"))
  {
    connect(_newCC, SIGNAL(clicked()), this, SLOT(sNewCreditCard()));
    connect(_editCC, SIGNAL(clicked()), this, SLOT(sEditCreditCard()));
    connect(_viewCC, SIGNAL(clicked()), this, SLOT(sViewCreditCard()));
    connect(_upCC, SIGNAL(clicked()), this, SLOT(sMoveUp()));
    connect(_downCC, SIGNAL(clicked()), this, SLOT(sMoveDown()));
    connect(_fundsType, SIGNAL(activated(int)), this, SLOT(setCreditCard()));
  }
Example #2
0
/*
 *  Constructs a customer as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
customer::customer(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
    setupUi(this);

    (void)statusBar();

    connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
    connect(_number, SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_number, SIGNAL(textEdited(const QString&)), this, SLOT(sNumberEdited()));
    connect(_salesrep, SIGNAL(newID(int)), this, SLOT(sPopulateCommission()));
    connect(_newShipto, SIGNAL(clicked()), this, SLOT(sNewShipto()));
    connect(_editShipto, SIGNAL(clicked()), this, SLOT(sEditShipto()));
    connect(_viewShipto, SIGNAL(clicked()), this, SLOT(sViewShipto()));
    connect(_deleteShipto, SIGNAL(clicked()), this, SLOT(sDeleteShipto()));
    connect(_shipto, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateShiptoMenu(QMenu*)));
    connect(_printShipto, SIGNAL(clicked()), this, SLOT(sPrintShipto()));
    connect(_downCC, SIGNAL(clicked()), this, SLOT(sMoveDown()));
    connect(_upCC, SIGNAL(clicked()), this, SLOT(sMoveUp()));
    connect(_viewCC, SIGNAL(clicked()), this, SLOT(sViewCreditCard()));
    connect(_editCC, SIGNAL(clicked()), this, SLOT(sEditCreditCard()));
    connect(_newCC, SIGNAL(clicked()), this, SLOT(sNewCreditCard()));
    connect(_ediProfile, SIGNAL(activated(int)), this, SLOT(sProfileSelected()));
    connect(_deleteCharacteristic, SIGNAL(clicked()), this, SLOT(sDeleteCharacteristic()));
    connect(_editCharacteristic, SIGNAL(clicked()), this, SLOT(sEditCharacteristic()));
    connect(_newCharacteristic, SIGNAL(clicked()), this, SLOT(sNewCharacteristic()));
    connect(_deleteTaxreg, SIGNAL(clicked()), this, SLOT(sDeleteTaxreg()));
    connect(_editTaxreg,   SIGNAL(clicked()), this, SLOT(sEditTaxreg()));
    connect(_newTaxreg,    SIGNAL(clicked()), this, SLOT(sNewTaxreg()));
    connect(_viewTaxreg,   SIGNAL(clicked()), this, SLOT(sViewTaxreg()));
    connect(_soEdiProfile, SIGNAL(activated(int)), this, SLOT(sSoProfileSelected()));
    connect(_custtype, SIGNAL(currentIndexChanged(int)), this, SLOT(sFillCharacteristicList()));
    
    _custid = -1;
    _crmacctid = -1;

    _sellingWarehouse->setId(-1);

    _currency->setLabel(_currencyLit);
    
    _balanceMethod->insertItem(tr("Balance Forward"));
    _balanceMethod->insertItem(tr("Open Items"));

    _taxreg->addColumn(tr("Tax Authority"), 100, Qt::AlignLeft );
    _taxreg->addColumn(tr("Registration #"), -1, Qt::AlignLeft );

    _shipto->addColumn(tr("Default"),          _itemColumn,  Qt::AlignLeft );
    _shipto->addColumn(tr("Number"),           _itemColumn,  Qt::AlignLeft );
    _shipto->addColumn(tr("Name"),             150,          Qt::AlignLeft );
    _shipto->addColumn(tr("Address"),          150,          Qt::AlignLeft );
    _shipto->addColumn(tr("City, State, Zip"), -1,           Qt::AlignLeft );

    _cc->addColumn(tr("Sequence"),          _itemColumn,  Qt::AlignLeft );
    _cc->addColumn(tr("Type"),           _itemColumn,  Qt::AlignLeft );
    _cc->addColumn(tr("Number"),             150,          Qt::AlignRight );
    _cc->addColumn(tr("Active"),          -1,          Qt::AlignLeft );
    
    _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft );
    _charass->addColumn(tr("Value"),          -1,          Qt::AlignLeft );
  
    _custchar = new QStandardItemModel(0, 2, this);
    _custchar->setHeaderData( 0, Qt::Horizontal, tr("Characteristc"), Qt::DisplayRole);
    _custchar->setHeaderData( 1, Qt::Horizontal, tr("Value"), Qt::DisplayRole);
    _chartempl->setModel(_custchar);
    CustCharacteristicDelegate * delegate = new CustCharacteristicDelegate(this);
    _chartempl->setItemDelegate(delegate);

    key = omfgThis->_key;
    if(!_metrics->boolean("CCAccept") || key.length() == 0 || key.isNull() || key.isEmpty())
    {
      _tab->removePage(_tab->page(10));
    }
    
    if (_metrics->boolean("EnableBatchManager"))
    {
      _ediProfile->append(-1, tr("No EDI"));
      _ediProfile->append(0, tr("Custom Email"));
    
      _soEdiProfile->append(-1, tr("No EDI"));
      _soEdiProfile->append(0, tr("Custom Email"));
    
      q.prepare("SELECT ediprofile_id, ediprofile_name"
                "  FROM ediprofile, ediform"
                " WHERE ((ediform_ediprofile_id=ediprofile_id)"
                "   AND  (ediform_type='invoice')) "
                "ORDER BY ediprofile_name; ");
      q.exec();
      while(q.next()) 
      {
        _ediProfile->append(q.value("ediprofile_id").toInt(), q.value("ediprofile_name").toString());
        _soEdiProfile->append(q.value("ediprofile_id").toInt(), q.value("ediprofile_name").toString());
      }
    }
    else
    {
      _tab->removePage(_tab->page(9));
      _tab->removePage(_tab->page(8));
    }
    
    //If not multi-warehouse hide whs control
    if (!_metrics->boolean("MultiWhs"))
    {
      _sellingWarehouseLit->hide();
      _sellingWarehouse->hide();
    }
}
cashReceipt::cashReceipt(QWidget* parent, const char* name, Qt::WindowFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_cust, SIGNAL(newId(int)), this, SLOT(sPopulateCustomerInfo(int)));
  connect(_received, SIGNAL(editingFinished()), this, SLOT(sUpdateBalance()));
  connect(_applyToBalance, SIGNAL(clicked()), this, SLOT(sApplyToBalance()));
  connect(_apply, SIGNAL(clicked()), this, SLOT(sApply()));
  connect(_applyLineBalance, SIGNAL(clicked()), this, SLOT(sApplyLineBalance()));
  connect(_add, SIGNAL(clicked()), this, SLOT(sAdd()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_clear, SIGNAL(clicked()), this, SLOT(sClear()));
  connect(_searchDocNum, SIGNAL(textChanged(const QString&)), this, SLOT(sSearchDocNumChanged()));
  connect(_applied, SIGNAL(valueChanged()), this, SLOT(sUpdateBalance()));
  connect(_miscDistribs, SIGNAL(valueChanged()), this, SLOT(sUpdateBalance()));
  connect(_received, SIGNAL(valueChanged()), this, SLOT(sUpdateBalance()));
  connect(_received, SIGNAL(idChanged(int)), this, SLOT(sFillApplyList()));
  connect(_received, SIGNAL(idChanged(int)), this, SLOT(sFillMiscList()));
  connect(_received, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(sFillApplyList()));
  connect(_received, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(sFillMiscList()));
  connect(_received, SIGNAL(idChanged(int)), this, SLOT(sChangeCurrency(int)));
  connect(_distDate, SIGNAL(newDate(QDate)), this, SLOT(sDateChanged()));
  connect(_applDate, SIGNAL(newDate(QDate)), this, SLOT(sDateChanged()));
  connect(_credits, SIGNAL(toggled(bool)), this, SLOT(sFillApplyList()));
  if (!_metrics->boolean("CCAccept") || !_privileges->check("ProcessCreditCards"))
  {
    _tab->removeTab(_tab->indexOf(_creditCardTab));
  }
  else
  {
    connect(_newCC, SIGNAL(clicked()), this, SLOT(sNewCreditCard()));
    connect(_editCC, SIGNAL(clicked()), this, SLOT(sEditCreditCard()));
    connect(_viewCC, SIGNAL(clicked()), this, SLOT(sViewCreditCard()));
    connect(_upCC, SIGNAL(clicked()), this, SLOT(sMoveUp()));
    connect(_downCC, SIGNAL(clicked()), this, SLOT(sMoveDown()));
    connect(_fundsType, SIGNAL(activated(int)), this, SLOT(setCreditCard()));
  }

  QButtonGroup * bg = new QButtonGroup(this);
  bg->addButton(_balCreditMemo);
  bg->addButton(_balCustomerDeposit);

  _applied->clear();

  _CCCVV->setValidator(new QIntValidator(100, 9999, this));

  _cust->setType(CLineEdit::ActiveCustomers);
  _bankaccnt->setType(XComboBox::ARBankAccounts);
  _salescat->setType(XComboBox::SalesCategoriesActive);

  _aropen->addColumn(tr("Doc. Type"), -1,              Qt::AlignCenter, true, "doctype");
  _aropen->addColumn(tr("Doc. #"),    _orderColumn,    Qt::AlignCenter, true, "aropen_docnumber");
  _aropen->addColumn(tr("Ord. #"),    _orderColumn,    Qt::AlignCenter, true, "aropen_ordernumber");
  _aropen->addColumn(tr("Doc. Date"), _dateColumn,     Qt::AlignCenter, true, "aropen_docdate");
  _aropen->addColumn(tr("Due Date"),  _dateColumn,     Qt::AlignCenter, true, "aropen_duedate");
  _aropen->addColumn(tr("Balance"),   _bigMoneyColumn, Qt::AlignRight,  true, "balance");
  _aropen->addColumn(tr("Currency"),  _currencyColumn, Qt::AlignLeft,  !omfgThis->singleCurrency(), "balance_curr");
  _aropen->addColumn(tr("Applied"),   _bigMoneyColumn, Qt::AlignRight,  true, "applied");
  _aropen->addColumn(tr("Currency"),  _currencyColumn, Qt::AlignLeft,  !omfgThis->singleCurrency(), "applied_curr");
  _aropen->addColumn(tr("Discount"),  _moneyColumn,    Qt::AlignRight , true, "discount" );
  _aropen->addColumn(tr("All Pending"),_moneyColumn,   Qt::AlignRight,  true, "pending");
  _aropen->addColumn(tr("Currency"),  _currencyColumn, Qt::AlignLeft,  !omfgThis->singleCurrency(), "pending_curr");

  _cashrcptmisc->addColumn(tr("Account #"), _itemColumn,     Qt::AlignCenter, true, "account");
  _cashrcptmisc->addColumn(tr("Notes"),     -1,              Qt::AlignLeft,  true, "firstline");
  _cashrcptmisc->addColumn(tr("Amount"),    _bigMoneyColumn, Qt::AlignRight, true, "cashrcptmisc_amount");

  _cc->addColumn(tr("Sequence"),_itemColumn, Qt::AlignLeft, true, "ccard_seq");
  _cc->addColumn(tr("Type"),    _itemColumn, Qt::AlignLeft, true, "type");
  _cc->addColumn(tr("Number"),  _itemColumn, Qt::AlignRight,true, "f_number");
  _cc->addColumn(tr("Active"),  _itemColumn, Qt::AlignLeft, true, "ccard_active");
  _cc->addColumn(tr("Name"),    _itemColumn, Qt::AlignLeft, true, "ccard_name");
  _cc->addColumn(tr("Expiration Date"),  -1, Qt::AlignLeft, true, "expiration");

  for (unsigned int i = 0; i < sizeof(_fundsTypes) / sizeof(_fundsTypes[1]); i++)
  {
    // only show credit card funds types if the user can process cc transactions
    if (! _fundsTypes[i].cc ||
        (_fundsTypes[i].cc && _metrics->boolean("CCAccept") &&
         _privileges->check("ProcessCreditCards")) )
      _fundsType->append(i, tr(_fundsTypes[i].full), _fundsTypes[i].abbr);
  }

  if (!_metrics->boolean("CCAccept") || ! _privileges->check("ProcessCreditCards"))
    _tab->removeTab(_tab->indexOf(_creditCardTab));

  if(_metrics->boolean("HideApplyToBalance"))
    _applyToBalance->hide();

  if(_metrics->boolean("EnableCustomerDeposits"))
    _balCustomerDeposit->setChecked(true);
  else
  {
   _applyBalLit->hide();
   _balCreditMemo->hide();
   _balCustomerDeposit->hide();
  }

  if(_metrics->boolean("AltCashExchangeRate"))
  {
    connect(_altExchRate, SIGNAL(toggled(bool)), this, SLOT(sHandleAltExchRate()));
    connect(_exchRate, SIGNAL(editingFinished()), this, SLOT(sUpdateGainLoss()));
  }