Exemple #1
0
void accountNumber::populate()
{
  q.prepare( "SELECT accnt_company, accnt_profit, accnt_number, accnt_sub,"
             "       accnt_closedpost, accnt_forwardupdate,"
             "       accnt_type, accnt_descrip, accnt_extref, accnt_comments, subaccnttype_id, "
             "       accnt_curr_id, "
             "       accnt_active, "
             "       CASE WHEN (gltrans_id IS NULL) THEN false ELSE true END AS used "
             "FROM accnt "
             "  LEFT OUTER JOIN subaccnttype ON (subaccnttype_code=accnt_subaccnttype_code) "
             "  LEFT OUTER JOIN gltrans ON (accnt_id=gltrans_accnt_id) "
             "WHERE (accnt_id=:accnt_id)"
             "LIMIT 1" );
  q.bindValue(":accnt_id", _accntid);
  q.exec();
  if (q.first())
  {
    if (_metrics->value("GLCompanySize").toInt())
      _company->setText(q.value("accnt_company"));

    if (_metrics->value("GLProfitSize").toInt())
      _profit->setText(q.value("accnt_profit"));

    if (_metrics->value("GLSubaccountSize").toInt())
      _sub->setText(q.value("accnt_sub"));

    _number->setText(q.value("accnt_number"));
    _description->setText(q.value("accnt_descrip"));
    _extReference->setText(q.value("accnt_extref"));
    _postIntoClosed->setChecked(q.value("accnt_closedpost").toBool());
    _forwardUpdate->setChecked(q.value("accnt_forwardupdate").toBool());
    _active->setChecked(q.value("accnt_active").toBool());
    _wasActive = _active->isChecked();
    _comments->setText(q.value("accnt_comments").toString());
    _currency->setId(q.value("accnt_curr_id").toInt());

    if (q.value("accnt_type").toString() == "A")
      _type->setCurrentIndex(0);
    else if (q.value("accnt_type").toString() == "L")
      _type->setCurrentIndex(1);
    else if (q.value("accnt_type").toString() == "E")
      _type->setCurrentIndex(2);
    else if (q.value("accnt_type").toString() == "R")
      _type->setCurrentIndex(3);
    else if (q.value("accnt_type").toString() == "Q")
      _type->setCurrentIndex(4);

    _type->setDisabled(q.value("used").toBool());

    populateSubTypes();
    _subType->setId(q.value("subaccnttype_id").toInt());
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
accountNumbers::accountNumbers(QWidget* parent, const char* name, Qt::WindowFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

//  (void)statusBar();

  connect(_account,        SIGNAL(valid(bool)), this, SLOT(sHandleButtons()));
  connect(_delete,           SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_edit,             SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_new,              SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_print,            SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_showExternal, SIGNAL(toggled(bool)), this, SLOT(sBuildList()));
  connect(_showInactive, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_type, SIGNAL(newID(int)), this, SLOT(sFillList()));
  connect(_type, SIGNAL(activated(int)), this, SLOT(populateSubTypes()));
  connect(_subType, SIGNAL(newID(int)), this, SLOT(sFillList()));

  connect(omfgThis, SIGNAL(configureGLUpdated()), this, SLOT(sBuildList()));

  _type->setAllowNull(true);
  QString qryType = QString( "SELECT  1, '%1' UNION "
                             "SELECT  2, '%2' UNION "
                             "SELECT  3, '%3' UNION "
                             "SELECT  4, '%4' UNION "
                             "SELECT  5, '%5' ")
  .arg(tr("Asset"))
  .arg(tr("Liability"))
  .arg(tr("Expense"))
  .arg(tr("Revenue"))
  .arg(tr("Equity"));

  _type->populate(qryType);

  _subType->setAllowNull(true);
  populateSubTypes();

  _showExternal->setVisible(_metrics->boolean("MultiCompanyFinancialConsolidation"));

  _externalCol = -1;

  sBuildList();
}
Exemple #3
0
accountNumber::accountNumber(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave()));
  connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  connect(_type, SIGNAL(activated(int)), this, SLOT(populateSubTypes()));

  _currency->setLabel(_currencyLit);

  // Until we find out what use there is for an account-level currency, hide it
  _currencyLit->hide();
  _currency->hide();
  
  _subType->setAllowNull(TRUE);
  populateSubTypes();
  
  if (_metrics->value("GLCompanySize").toInt() == 0)
  {
    _company->hide();
    _sep1Lit->hide();
  }

  if (_metrics->value("GLProfitSize").toInt() == 0)
  {
    _profit->hide();
    _sep2Lit->hide();
  }

  if (_metrics->value("GLSubaccountSize").toInt() == 0)
  {
    _sub->hide();
    _sep3Lit->hide();
  }
  if (!_metrics->boolean("ManualForwardUpdate"))
    _forwardUpdate->hide();

  _wasActive = false;
}
Exemple #4
0
/*
 *  Constructs a financialLayoutItem as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
financialLayoutItem::financialLayoutItem(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);


  // signals and slots connections
  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave()));
  connect(_showBeginning, SIGNAL(toggled(bool)), _showBeginningPrcnt, SLOT(setEnabled(bool)));
  connect(_showBudget, SIGNAL(toggled(bool)), _showBudgetPrcnt, SLOT(setEnabled(bool)));
  connect(_showDB, SIGNAL(toggled(bool)), _showDBPrcnt, SLOT(setEnabled(bool)));
  connect(_showEnding, SIGNAL(toggled(bool)), _showEndingPrcnt, SLOT(setEnabled(bool)));
  connect(_showDiff, SIGNAL(toggled(bool)), _showDiffPrcnt, SLOT(setEnabled(bool)));
  connect(_showPrcnt, SIGNAL(toggled(bool)), this, SLOT(sToggleShowPrcnt()));
  connect(_selectAccount, SIGNAL(toggled(bool)), this, SLOT(sToggleSegment()));
  connect(_selectSegment, SIGNAL(toggled(bool)), this, SLOT(sToggleAccount()));
  connect(_type, SIGNAL(activated(int)), this, SLOT(populateSubTypes()));

  _flheadid = -1;
  _flitemid = -1;

  _account->setShowExternal(true);
  _company->setType(XComboBox::Companies);
  _company->append(-1,tr("All"));
  _company->setText(tr("All"));
  _profit->setType(XComboBox::ProfitCenters);
  _profit->append(-1,tr("All"));
  _profit->setText(tr("All"));
  _type->setCurrentIndex(5);
  _sub->setType(XComboBox::Subaccounts);
  _sub->append(-1,tr("All"));
  _sub->setText(tr("All"));

  q.prepare( "SELECT DISTINCT accnt_id, accnt_number "
                  "FROM accnt "
                  "ORDER BY accnt_number;" );
  q.exec();
  _number->populate(q);
  _number->append(-1,tr("All"));
  _number->setText(tr("All"));

  _subType->setAllowNull(FALSE);
  populateSubTypes();

  if (_metrics->value("GLCompanySize").toInt() == 0)
  {
    _company->hide();
    _sep1Lit->hide();
  }

  if (_metrics->value("GLProfitSize").toInt() == 0)
  {
    _profit->hide();
    _sep2Lit->hide();
  }

  if (_metrics->value("GLSubaccountSize").toInt() == 0)
  {
    _sub->hide();
    _sep3Lit->hide();
  }
}