company::company(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_extDB, SIGNAL(editingFinished()), this, SLOT(sHandleTest())); connect(_extPort, SIGNAL(editingFinished()), this, SLOT(sHandleTest())); connect(_extServer, SIGNAL(editingFinished()), this, SLOT(sHandleTest())); connect(_extTest, SIGNAL(clicked()), this, SLOT(sTest())); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); connect(_buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(_currency, SIGNAL(newID(int)), this, SLOT(sCurrencyChanged())); _number->setMaxLength(_metrics->value("GLCompanySize").toInt()); _cachedNumber = ""; _cachedCurrid = CurrCluster::baseId(); _external->setVisible(_metrics->boolean("MultiCompanyFinancialConsolidation")); _authGroup->setVisible(_metrics->boolean("MultiCompanyFinancialConsolidation")); _currency->setId(CurrCluster::baseId()); _unrlzgainloss->setType(GLCluster::cRevenue | GLCluster::cExpense); _unrlzgainloss->setShowExternal(true); _unrlzgainloss->setIgnoreCompany(true); _yearend->setShowExternal(true); _yearend->setType(GLCluster::cEquity); _yearend->setIgnoreCompany(true); _gainloss->setType(GLCluster::cExpense); _gainloss->setShowExternal(true); _gainloss->setIgnoreCompany(true); _discrepancy->setType(GLCluster::cExpense); _discrepancy->setShowExternal(true); _discrepancy->setIgnoreCompany(true); }
company::company(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_extDB, SIGNAL(editingFinished()), this, SLOT(sHandleTest())); connect(_extPort, SIGNAL(editingFinished()), this, SLOT(sHandleTest())); connect(_extServer, SIGNAL(editingFinished()), this, SLOT(sHandleTest())); connect(_extTest, SIGNAL(clicked()), this, SLOT(sTest())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); _number->setMaxLength(_metrics->value("GLCompanySize").toInt()); _cachedNumber = ""; _external->setVisible(_metrics->boolean("MultiCompanyFinancialConsolidation")); _authGroup->setVisible(_metrics->boolean("MultiCompanyFinancialConsolidation")); }
void company::populate() { XSqlQuery companypopulate; companypopulate.prepare( "SELECT * " "FROM company " "WHERE (company_id=:company_id);" ); companypopulate.bindValue(":company_id", _companyid); companypopulate.exec(); if (companypopulate.first()) { _number->setText(companypopulate.value("company_number").toString()); _descrip->setText(companypopulate.value("company_descrip").toString()); _external->setChecked(companypopulate.value("company_external").toBool()); _extServer->setText(companypopulate.value("company_server").toString()); _extPort->setValue(companypopulate.value("company_port").toInt()); _extDB->setText(companypopulate.value("company_database").toString()); _yearend->setId(companypopulate.value("company_yearend_accnt_id").toInt()); _gainloss->setId(companypopulate.value("company_gainloss_accnt_id").toInt()); _discrepancy->setId(companypopulate.value("company_dscrp_accnt_id").toInt()); _unassigned->setId(companypopulate.value("company_unassigned_accnt_id").toInt()); if (_external->isChecked()) { _cachedCurrid = companypopulate.value("company_curr_id").toInt(); _currency->setId(companypopulate.value("company_curr_id").toInt()); _unrlzgainloss->setId(companypopulate.value("company_unrlzgainloss_accnt_id").toInt()); } _cachedNumber = companypopulate.value("company_number").toString(); companypopulate.prepare("SELECT COUNT(*) AS result " "FROM accnt " "WHERE (accnt_company=:number);"); companypopulate.bindValue(":number", _cachedNumber); companypopulate.exec(); if (companypopulate.first()) _external->setEnabled(companypopulate.value("result").toInt() == 0); else if (companypopulate.lastError().type() != QSqlError::NoError) { systemError(this, companypopulate.lastError().databaseText(), __FILE__, __LINE__); return; } } else if (companypopulate.lastError().type() != QSqlError::NoError) { systemError(this, companypopulate.lastError().databaseText(), __FILE__, __LINE__); return; } sHandleTest(); }
void company::populate() { q.prepare( "SELECT * " "FROM company " "WHERE (company_id=:company_id);" ); q.bindValue(":company_id", _companyid); q.exec(); if (q.first()) { _number->setText(q.value("company_number").toString()); _descrip->setText(q.value("company_descrip").toString()); _external->setChecked(q.value("company_external").toBool()); _extServer->setText(q.value("company_server").toString()); _extPort->setValue(q.value("company_port").toInt()); _extDB->setText(q.value("company_database").toString()); _cachedNumber = q.value("company_number").toString(); q.prepare("SELECT COUNT(*) AS result " "FROM accnt " "WHERE (accnt_company=:number);"); q.bindValue(":number", _cachedNumber); q.exec(); if (q.first()) _external->setEnabled(q.value("result").toInt() == 0); else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } sHandleTest(); }