Example #1
0
void vendor::sNewTaxreg()
{
  ParameterList params;
  params.append("mode", "new");
  params.append("taxreg_rel_id", _vendid);
  params.append("taxreg_rel_type", "V");

  taxRegistration newdlg(this, "", TRUE);
  if (newdlg.set(params) == NoError && newdlg.exec() != XDialog::Rejected)
    sFillTaxregList();
}
Example #2
0
void vendor::sEditTaxreg()
{
  ParameterList params;
  params.append("mode", "edit");
  params.append("taxreg_id", _taxreg->id());

  taxRegistration newdlg(this, "", TRUE);
  newdlg.set(params);

  if (newdlg.set(params) == NoError && newdlg.exec() != XDialog::Rejected)
    sFillTaxregList();
}
Example #3
0
void vendor::sDeleteTaxreg()
{
  XSqlQuery delq;
  delq.prepare("DELETE FROM taxreg WHERE (taxreg_id=:taxreg_id);");
  delq.bindValue(":taxreg_id", _taxreg->id());
  delq.exec();
  if (ErrorReporter::error(QtCriticalMsg, this, tr("Deleting Tax Registration"),
                           delq, __FILE__, __LINE__))
    return;

  sFillTaxregList();
}
Example #4
0
void vendor::sDeleteTaxreg()
{
  q.prepare("DELETE FROM taxreg "
            "WHERE (taxreg_id=:taxreg_id);");
  q.bindValue(":taxreg_id", _taxreg->id());
  q.exec();
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  sFillTaxregList();
}
Example #5
0
void vendor::populate()
{
  MetaSQLQuery mql(
            "SELECT vendinfo.*, crmacct_id, "
            "<? if exists(\"key\") ?>"
            "       CASE WHEN LENGTH(vend_ach_routingnumber) > 0 THEN"
            "       formatbytea(decrypt(setbytea(vend_ach_routingnumber),"
            "                           setbytea(<? value(\"key\") ?>), 'bf'))"
            "            ELSE '' END AS routingnum,"
            "       CASE WHEN LENGTH(vend_ach_accntnumber) > 0 THEN"
            "       formatbytea(decrypt(setbytea(vend_ach_accntnumber),"
            "                           setbytea(<? value(\"key\") ?>), 'bf'))"
            "            ELSE '' END AS accntnum "
            "<? else ?>"
            "       <? value(\"na\") ?> AS routingnum,"
            "       <? value(\"na\") ?> AS accntnum "
            "<? endif ?>"
            "FROM vendinfo "
            "  JOIN crmacct ON (vend_id=crmacct_vend_id) "
            "WHERE (vend_id=<? value(\"vend_id\") ?>);" );
  ParameterList params;
  params.append("vend_id", _vendid);
  params.append("key",     omfgThis->_key);
  params.append("na",      tr("N/A"));
  q = mql.toQuery(params);
  if (q.first())
  {
    _notice = FALSE;
    _cachedNumber = q.value("vend_number").toString();

    _number->setText(q.value("vend_number"));
    _accountNumber->setText(q.value("vend_accntnum"));
    _vendtype->setId(q.value("vend_vendtype_id").toInt());
    _active->setChecked(q.value("vend_active").toBool());
    _name->setText(q.value("vend_name"));
    _contact1->setId(q.value("vend_cntct1_id").toInt());
    _contact1->setSearchAcct(q.value("crmacct_id").toInt());
    _contact2->setId(q.value("vend_cntct2_id").toInt());
    _contact2->setSearchAcct(q.value("crmacct_id").toInt());
    _address->setId(q.value("vend_addr_id").toInt());
    _defaultTerms->setId(q.value("vend_terms_id").toInt());
    _defaultShipVia->setText(q.value("vend_shipvia").toString());
    _defaultCurr->setId(q.value("vend_curr_id").toInt());
    _poItems->setChecked(q.value("vend_po").toBool());
    _restrictToItemSource->setChecked(q.value("vend_restrictpurch").toBool());
    _receives1099->setChecked(q.value("vend_1099").toBool());
    _match->setChecked(q.value("vend_match").toBool());
    _qualified->setChecked(q.value("vend_qualified").toBool());
    _notes->setText(q.value("vend_comments").toString());
    _poComments->setText(q.value("vend_pocomments").toString());
    
    _taxzone->setId(q.value("vend_taxzone_id").toInt());

    if (q.value("vend_fobsource").toString() == "V")
    {
      _useVendorFOB->setChecked(TRUE);
      _vendorFOB->setText(q.value("vend_fob"));
    }
    else
      _useWarehouseFOB->setChecked(TRUE);

    _achGroup->setChecked(q.value("vend_ach_enabled").toBool());
    _routingNumber->setText(q.value("routingnum").toString());
    _achAccountNumber->setText(q.value("accntnum").toString());
    _useACHSpecial->setChecked(! q.value("vend_ach_use_vendinfo").toBool());
    _individualId->setText(q.value("vend_ach_indiv_number").toString());
    _individualName->setText(q.value("vend_ach_indiv_name").toString());

    _accountType->setCode(q.value("vend_ach_accnttype").toString());

    sFillAddressList();
    sFillTaxregList();
    _comments->setId(_vendid);

    _crmacctid = q.value("crmacct_id").toInt();
    _address->setSearchAcct(_crmacctid);

    emit newId(_vendid);
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  else
  {
    systemError(this, tr("Could not find the Vendor information. Perhaps the "
                         "Vendor and CRM Account have been disconnected."),
                __FILE__, __LINE__);
    return;
  }

  emit populated();
}
Example #6
0
void vendor::populate()
{
  q.prepare( "SELECT vend_number, vend_accntnum, vend_active, vend_vendtype_id, vend_name,"
             "       vend_cntct1_id, vend_cntct2_id, vend_addr_id, "
             "       vend_po, vend_restrictpurch,"
             "       vend_1099, vend_qualified,"
             "       vend_comments, vend_pocomments,"
             "       vend_fobsource, vend_fob, vend_terms_id, vend_shipvia,"
	     "       vend_curr_id, "
             "       vend_emailpodelivery, vend_ediemail, vend_ediemailbody,"
             "       vend_edisubject, vend_edifilename, vend_edicc,"
             "       vend_taxauth_id, vend_match "
             "FROM vendinfo "
             "WHERE (vend_id=:vend_id);" );
  q.bindValue(":vend_id", _vendid);
  q.exec();
  if (q.first())
  {
    _cachedNumber = q.value("vend_number").toString();

    _number->setText(q.value("vend_number"));
    _accountNumber->setText(q.value("vend_accntnum"));
    _vendtype->setId(q.value("vend_vendtype_id").toInt());
    _active->setChecked(q.value("vend_active").toBool());
    _name->setText(q.value("vend_name"));
    _contact1->setId(q.value("vend_cntct1_id").toInt());
    _contact2->setId(q.value("vend_cntct2_id").toInt());
    _address->setId(q.value("vend_addr_id").toInt());
    _defaultTerms->setId(q.value("vend_terms_id").toInt());
    _defaultShipVia->setText(q.value("vend_shipvia").toString());
    _defaultCurr->setId(q.value("vend_curr_id").toInt());
    _poItems->setChecked(q.value("vend_po").toBool());
    _restrictToItemSource->setChecked(q.value("vend_restrictpurch").toBool());
    _receives1099->setChecked(q.value("vend_1099").toBool());
    _match->setChecked(q.value("vend_match").toBool());
    _qualified->setChecked(q.value("vend_qualified").toBool());
    _notes->setText(q.value("vend_comments").toString());
    _poComments->setText(q.value("vend_pocomments").toString());
    _emailPODelivery->setChecked(q.value("vend_emailpodelivery").toBool());
    _ediEmail->setText(q.value("vend_ediemail"));
    _ediSubject->setText(q.value("vend_edisubject"));
    _ediFilename->setText(q.value("vend_edifilename"));
    _ediEmailBody->setText(q.value("vend_ediemailbody").toString());
    _ediCC->setText(q.value("vend_edicc").toString());

    _taxauth->setId(q.value("vend_taxauth_id").toInt());

    if (q.value("vend_fobsource").toString() == "V")
    {
      _useVendorFOB->setChecked(TRUE);
      _vendorFOB->setText(q.value("vend_fob"));
    }
    else
      _useWarehouseFOB->setChecked(TRUE);

    sFillAddressList();
    sFillTaxregList();
    _comments->setId(_vendid);
  }
  else if (q.lastError().type() == QSqlError::None)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  q.prepare("SELECT crmacct_id "
	    "FROM crmacct "
	    "WHERE (crmacct_vend_id=:vend_id);");
  q.bindValue(":vend_id", _vendid);
  q.exec();
  if (q.first())
    _crmacctid = q.value("crmacct_id").toInt();
  else if (q.lastError().type() == QSqlError::None)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
Example #7
0
void customer::populate()
{
  XSqlQuery cust;
  _notice = FALSE;
  cust.prepare( "SELECT custinfo.*, "
                "       formatScrap(cust_commprcnt) AS commprcnt,"
                "       formatScrap(cust_discntprcnt) AS discountpercent,"
                "       crmacct_id "
                "FROM custinfo, crmacct "
                "WHERE ((cust_id=:cust_id) "
                "  AND  (cust_id=crmacct_cust_id));" );
  cust.bindValue(":cust_id", _custid);
  cust.exec();
  if (cust.first())
  {
    _crmacctid = cust.value("crmacct_id").toInt();

    _number->setText(cust.value("cust_number"));
    _cachedNumber = cust.value("cust_number").toString();
    _name->setText(cust.value("cust_name"));
    _corrCntct->setId(cust.value("cust_corrcntct_id").toInt());
    _billCntct->setId(cust.value("cust_cntct_id").toInt());
    _creditLimit->set(cust.value("cust_creditlmt").toDouble(),
                      cust.value("cust_creditlmt_curr_id").toInt(),
                      QDate::currentDate());
    _creditRating->setText(cust.value("cust_creditrating"));
    _autoUpdateStatus->setChecked(cust.value("cust_autoupdatestatus").toBool());
    _autoHoldOrders->setChecked(cust.value("cust_autoholdorders").toBool());
    _defaultDiscountPrcnt->setText(cust.value("discountpercent"));

    _notes->setText(cust.value("cust_comments").toString());

    _custtype->setId(cust.value("cust_custtype_id").toInt());
    _salesrep->setId(cust.value("cust_salesrep_id").toInt());
    _defaultCommissionPrcnt->setText(cust.value("commprcnt"));
    _terms->setId(cust.value("cust_terms_id").toInt());
    _taxauth->setId(cust.value("cust_taxauth_id").toInt());
    _shipform->setId(cust.value("cust_shipform_id").toInt());
    _shipchrg->setId(cust.value("cust_shipchrg_id").toInt());
    _shipvia->setText(cust.value("cust_shipvia").toString());

    _sellingWarehouse->setId(cust.value("cust_preferred_warehous_id").toInt());

    if (cust.value("cust_balmethod").toString() == "B")
      _balanceMethod->setCurrentItem(0);
    else if (cust.value("cust_balmethod").toString() == "O")
      _balanceMethod->setCurrentItem(1);

    _active->setChecked(cust.value("cust_active").toBool());
    _backorders->setChecked(cust.value("cust_backorder").toBool());
    _partialShipments->setChecked(cust.value("cust_partialship").toBool());
    _partialShipments->setEnabled(cust.value("cust_backorder").toBool());
    _allowFFShipto->setChecked(cust.value("cust_ffshipto").toBool());
    _allowFFBillto->setChecked(cust.value("cust_ffbillto").toBool());
    _usesPOs->setChecked(cust.value("cust_usespos").toBool());
    _blanketPos->setChecked(cust.value("cust_blanketpos").toBool());
    _currency->setId(cust.value("cust_curr_id").toInt());

    if (cust.value("cust_creditstatus").toString() == "G")
      _inGoodStanding->setChecked(TRUE);
    else if (cust.value("cust_creditstatus").toString() == "W")
      _onCreditWarning->setChecked(TRUE);
    else
      _onCreditHold->setChecked(TRUE);

    if(cust.value("cust_emaildelivery").toBool())
      _ediProfile->setId(0);
    else
    {
      _ediProfile->setId(cust.value("cust_ediprofile_id").toInt());
      if(0 == _ediProfile->id())
        _ediProfile->setId(-1);
    }
    sProfileSelected();
    _ediEmail->setText(cust.value("cust_ediemail"));
    _ediSubject->setText(cust.value("cust_edisubject"));
    _ediFilename->setText(cust.value("cust_edifilename"));
    _ediEmailBody->setText(cust.value("cust_ediemailbody").toString());
    _ediCC->setText(cust.value("cust_edicc").toString());
    
    if(cust.value("cust_soemaildelivery").toBool())
      _soEdiProfile->setId(0);
    else
    {
      _soEdiProfile->setId(cust.value("cust_soediprofile_id").toInt());
      if(0 == _soEdiProfile->id())
        _soEdiProfile->setId(-1);
    }
    sSoProfileSelected();
    _soEdiEmail->setText(cust.value("cust_soediemail"));
    _soEdiSubject->setText(cust.value("cust_soedisubject"));
    _soEdiFilename->setText(cust.value("cust_soedifilename"));
    _soEdiEmailBody->setText(cust.value("cust_soediemailbody").toString());
    _soEdiCC->setText(cust.value("cust_soedicc").toString());

    _comments->setId(_custid);
    sFillShiptoList();
    sFillTaxregList();
    sFillCharacteristicList();
    sFillCcardList();
  }
  else if (cust.lastError().type() != QSqlError::None)
  {
    systemError(this, cust.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
Example #8
0
void vendor::populate()
{
  MetaSQLQuery mql(
            "SELECT *, crmacct_id, "
            "<? if exists(\"key\") ?>"
            "       CASE WHEN LENGTH(vend_ach_routingnumber) > 0 THEN"
            "       formatbytea(decrypt(setbytea(vend_ach_routingnumber),"
            "                           setbytea(<? value(\"key\") ?>), 'bf'))"
            "            ELSE '' END AS routingnum,"
            "       CASE WHEN LENGTH(vend_ach_accntnumber) > 0 THEN"
            "       formatbytea(decrypt(setbytea(vend_ach_accntnumber),"
            "                           setbytea(<? value(\"key\") ?>), 'bf'))"
            "            ELSE '' END AS accntnum "
            "<? else ?>"
            "       <? value(\"na\") ?> AS routingnum,"
            "       <? value(\"na\") ?> AS accntnum "
            "<? endif ?>"
            "FROM vendinfo "
            "  JOIN crmacct ON (vend_id=crmacct_vend_id) "
            "WHERE (vend_id=<? value(\"vend_id\") ?>);" );
  ParameterList params;
  params.append("vend_id", _vendid);
  params.append("key",     omfgThis->_key);
  params.append("na",      tr("N/A"));
  q = mql.toQuery(params);
  if (q.first())
  {
    _cachedNumber = q.value("vend_number").toString();

    _number->setText(q.value("vend_number"));
    _accountNumber->setText(q.value("vend_accntnum"));
    _vendtype->setId(q.value("vend_vendtype_id").toInt());
    _active->setChecked(q.value("vend_active").toBool());
    _name->setText(q.value("vend_name"));
    _contact1->setId(q.value("vend_cntct1_id").toInt());
    _contact1->setSearchAcct(q.value("crmacct_id").toInt());
    _contact2->setId(q.value("vend_cntct2_id").toInt());
    _contact2->setSearchAcct(q.value("crmacct_id").toInt());
    _address->setId(q.value("vend_addr_id").toInt());
    _defaultTerms->setId(q.value("vend_terms_id").toInt());
    _defaultShipVia->setText(q.value("vend_shipvia").toString());
    _defaultCurr->setId(q.value("vend_curr_id").toInt());
    _poItems->setChecked(q.value("vend_po").toBool());
    _restrictToItemSource->setChecked(q.value("vend_restrictpurch").toBool());
    _receives1099->setChecked(q.value("vend_1099").toBool());
    _match->setChecked(q.value("vend_match").toBool());
    _qualified->setChecked(q.value("vend_qualified").toBool());
    _notes->setText(q.value("vend_comments").toString());
    _poComments->setText(q.value("vend_pocomments").toString());
    _emailPODelivery->setChecked(q.value("vend_emailpodelivery").toBool());
    _ediEmail->setText(q.value("vend_ediemail"));
    _ediSubject->setText(q.value("vend_edisubject"));
    _ediFilename->setText(q.value("vend_edifilename"));
    _ediEmailBody->setText(q.value("vend_ediemailbody").toString());
    _ediCC->setText(q.value("vend_edicc").toString());

    _taxauth->setId(q.value("vend_taxauth_id").toInt());

    if (q.value("vend_fobsource").toString() == "V")
    {
      _useVendorFOB->setChecked(TRUE);
      _vendorFOB->setText(q.value("vend_fob"));
    }
    else
      _useWarehouseFOB->setChecked(TRUE);

    _achGroup->setChecked(q.value("vend_ach_enabled").toBool());
    _routingNumber->setText(q.value("routingnum").toString());
    _achAccountNumber->setText(q.value("accntnum").toString());
    _useACHSpecial->setChecked(! q.value("vend_ach_use_vendinfo").toBool());
    _individualId->setText(q.value("vend_ach_indiv_number").toString());
    _individualName->setText(q.value("vend_ach_indiv_name").toString());

    if (q.value("vend_ach_accnttype").toString() == "K")
      _accountType->setCurrentItem(0);
    else if (q.value("vend_ach_accnttype").toString() == "C")
      _accountType->setCurrentItem(1);

    sFillAddressList();
    sFillTaxregList();
    _comments->setId(_vendid);
  }
  else if (q.lastError().type() == QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  q.prepare("SELECT crmacct_id "
	    "FROM crmacct "
	    "WHERE (crmacct_vend_id=:vend_id);");
  q.bindValue(":vend_id", _vendid);
  q.exec();
  if (q.first())
    _crmacctid = q.value("crmacct_id").toInt();
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
Example #9
0
bool vendor::sPopulate()
{
  if (DEBUG)
    qDebug("vendor::sPopulate() entered with _vendid %d and _crmacctid %d",
           _vendid, _crmacctid);

  MetaSQLQuery mql(
            "<? if exists('vend_id') ?>"
            "SELECT vendinfo.*, crmacct_id, crmacct_owner_username, "
            "<? if exists('key') ?>"
            "       CASE WHEN LENGTH(vend_ach_routingnumber) > 0 THEN"
            "       formatbytea(decrypt(setbytea(vend_ach_routingnumber),"
            "                           setbytea(<? value('key') ?>), 'bf'))"
            "            ELSE '' END AS routingnum,"
            "       CASE WHEN LENGTH(vend_ach_accntnumber) > 0 THEN"
            "       formatbytea(decrypt(setbytea(vend_ach_accntnumber),"
            "                           setbytea(<? value('key') ?>), 'bf'))"
            "            ELSE '' END AS accntnum "
            "<? else ?>"
            "       <? value('na') ?> AS routingnum,"
            "       <? value('na') ?> AS accntnum "
            "<? endif ?>"
            "FROM vendinfo "
            "  JOIN crmacct ON (vend_id=crmacct_vend_id) "
            "WHERE (vend_id=<? value('vend_id') ?>);"
            "<? elseif exists('crmacct_id') ?>"
            "SELECT crmacct_number AS vend_number, crmacct_name   AS vend_name,"
            "       crmacct_active AS vend_active,"
            "       crmacct_cntct_id_1 AS vend_cntct1_id,"
            "       crmacct_cntct_id_2 AS vend_cntct2_id,"
            "       fetchMetricText('DefaultPOShipVia') AS vend_shipvia,"
            "       NULL AS vend_accntnum,    NULL AS vend_vendtype_id,"
            "       NULL AS vend_name,        NULL AS vend_addr_id,"
            "       fetchMetricValue('DefaultTerms') AS vend_terms_id,"
            "       NULL  AS vend_curr_id,"
            "       FALSE AS vend_po,         FALSE AS vend_restrictpurch,"
            "       FALSE AS vend_1099,       NULL AS vend_match,"
            "       FALSE  AS vend_qualified, NULL AS vend_comments,"
            "       NULL AS vend_pocomments,  NULL AS vend_taxzone_id,"
            "       'W'  AS vend_fobsource,   NULL AS vend_fob,"
            "       NULL AS vend_ach_enabled, NULL AS routingnum,"
            "       NULL AS accntnum,         NULL AS vend_ach_use_vendinfo,"
            "       NULL AS vend_ach_indiv_number, NULL AS vend_ach_indiv_name,"
            "       NULL AS vend_ach_accnttype,"
            "       crmacct_id, crmacct_owner_username"
            "  FROM crmacct"
            " WHERE crmacct_id=<? value('crmacct_id') ?>;"
            "<? endif ?>");
  ParameterList params;
  if (_vendid > 0)
    params.append("vend_id", _vendid);
  else if (_crmacctid > 0)
    params.append("crmacct_id", _crmacctid);

  params.append("key",     omfgThis->_key);
  params.append("na",      tr("N/A"));
  XSqlQuery getq = mql.toQuery(params);
  if (getq.first())
  {
    _notice = FALSE;
    _cachedNumber = getq.value("vend_number").toString();

    _crmacctid = getq.value("crmacct_id").toInt();
    _crmowner = getq.value("crmacct_owner_username").toString();
    _number->setText(getq.value("vend_number"));
    _accountNumber->setText(getq.value("vend_accntnum"));
    _vendtype->setId(getq.value("vend_vendtype_id").toInt());
    _active->setChecked(getq.value("vend_active").toBool());
    _name->setText(getq.value("vend_name"));
    _contact1->setId(getq.value("vend_cntct1_id").toInt());
    _contact1->setSearchAcct(_crmacctid);
    _contact2->setId(getq.value("vend_cntct2_id").toInt());
    _contact2->setSearchAcct(_crmacctid);
    _address->setId(getq.value("vend_addr_id").toInt());
    _defaultTerms->setId(getq.value("vend_terms_id").toInt());
    _defaultShipVia->setText(getq.value("vend_shipvia").toString());
    _defaultCurr->setId(getq.value("vend_curr_id").toInt());
    _poItems->setChecked(getq.value("vend_po").toBool());
    _restrictToItemSource->setChecked(getq.value("vend_restrictpurch").toBool());
    _receives1099->setChecked(getq.value("vend_1099").toBool());
    _match->setChecked(getq.value("vend_match").toBool());
    _qualified->setChecked(getq.value("vend_qualified").toBool());
    _notes->setText(getq.value("vend_comments").toString());
    _poComments->setText(getq.value("vend_pocomments").toString());

    _taxzone->setId(getq.value("vend_taxzone_id").toInt());

    if (getq.value("vend_fobsource").toString() == "V")
    {
      _useVendorFOB->setChecked(TRUE);
      _vendorFOB->setText(getq.value("vend_fob"));
    }
    else
      _useWarehouseFOB->setChecked(TRUE);

    _achGroup->setChecked(getq.value("vend_ach_enabled").toBool());
    _routingNumber->setText(getq.value("routingnum").toString());
    _achAccountNumber->setText(getq.value("accntnum").toString());
    _useACHSpecial->setChecked(! getq.value("vend_ach_use_vendinfo").toBool());
    _individualId->setText(getq.value("vend_ach_indiv_number").toString());
    _individualName->setText(getq.value("vend_ach_indiv_name").toString());

    _accountType->setCode(getq.value("vend_ach_accnttype").toString());

    _account->setId(getq.value("vend_accnt_id").toInt());
    if(getq.value("vend_expcat_id").toInt() != -1)
    {
      _expcatSelected->setChecked(TRUE);
      _expcat->setId(getq.value("vend_expcat_id").toInt());
    }
    if(getq.value("vend_tax_id").toInt() != -1)
    {
      _taxSelected->setChecked(TRUE);
      _taxCode->setId(getq.value("vend_tax_id").toInt());
    }

    sFillAddressList();
    sFillTaxregList();
    sFillCharacteristic();

    _comments->setId(_crmacctid);
    _address->setSearchAcct(_crmacctid);

    emit newId(_vendid);
  }
  else if (ErrorReporter::error(QtCriticalMsg, this, tr("Getting Vendor"),
                                getq, __FILE__, __LINE__))
    return false;
  else
  {
    ErrorReporter::error(QtCriticalMsg, this, tr("Getting Vendor"),
                         tr("Could not find the Vendor information. Perhaps "
                            "the Vendor and CRM Account have been disconnected."),
                __FILE__, __LINE__);
    return false;
  }

  _crmacct->setEnabled(_crmacctid > 0 &&
                       (_privileges->check("MaintainAllCRMAccounts") ||
                        _privileges->check("ViewAllCRMAccounts") ||
                        (omfgThis->username() == _crmowner && _privileges->check("MaintainPersonalCRMAccounts")) ||
                        (omfgThis->username() == _crmowner && _privileges->check("ViewPersonalCRMAccounts"))));

  emit populated();
  return true;
}