Ejemplo n.º 1
0
void financialLayoutSpecial::populate()
{
  XSqlQuery financialpopulate;
  financialpopulate.prepare( "SELECT * "
             "FROM flspec "
             "WHERE (flspec_id=:flspec_id);" );
  financialpopulate.bindValue(":flspec_id", _flspecid);
  financialpopulate.exec();
  if (financialpopulate.first())
  {
    _name->setText(financialpopulate.value("flspec_name").toString());
    _showBeginning->setChecked(financialpopulate.value("flspec_showstart").toBool());
    _showEnding->setChecked(financialpopulate.value("flspec_showend").toBool());
    _showDB->setChecked(financialpopulate.value("flspec_showdelta").toBool());
    _showBudget->setChecked(financialpopulate.value("flspec_showbudget").toBool());
    _showDiff->setChecked(financialpopulate.value("flspec_showdiff").toBool());
    _showCustom->setChecked(financialpopulate.value("flspec_showcustom").toBool());
    _showBeginningPrcnt->setChecked(financialpopulate.value("flspec_showstartprcnt").toBool());
    _showEndingPrcnt->setChecked(financialpopulate.value("flspec_showendprcnt").toBool());
    _showDBPrcnt->setChecked(financialpopulate.value("flspec_showdeltaprcnt").toBool());
    _showBudgetPrcnt->setChecked(financialpopulate.value("flspec_showbudgetprcnt").toBool());
    _showDiffPrcnt->setChecked(financialpopulate.value("flspec_showdiffprcnt").toBool());
    _showCustomPrcnt->setChecked(financialpopulate.value("flspec_showcustomprcnt").toBool());

    QString src = financialpopulate.value("flspec_custom_source").toString();
    if("S" == src)
      _customUseBeginning->setChecked(true);
    else if("E" == src)
      _customUseEnding->setChecked(true);
    else if("D" == src)
      _customUseDebits->setChecked(true);
    else if("C" == src)
      _customUseCredits->setChecked(true);
    else if("B" == src)
      _customUseBudget->setChecked(true);
    else if("F" == src)
      _customUseDiff->setChecked(true);

    if(financialpopulate.value("flspec_subtract").toBool())
      _subtract->setChecked(true);
    else
      _add->setChecked(true);

    if(financialpopulate.value("flspec_type").toString() == "OpenAP")
      _type->setCurrentIndex(1);
    else //if(financialpopulate.value("flspec_type").toString() == "OpenAR")
      _type->setCurrentIndex(0);

    _flheadid = financialpopulate.value("flspec_flhead_id").toInt();

    int grpid = financialpopulate.value("flspec_prcnt_flgrp_id").toInt();
    sFillGroupList();
    _group->setId(grpid);
  }
}
Ejemplo n.º 2
0
void financialLayoutGroup::populate()
{
  XSqlQuery financialpopulate;
  financialpopulate.prepare( "SELECT flgrp_name, flgrp_descrip, flgrp_subtotal,"
             "       flgrp_summarize, flgrp_subtract,"
             "       flgrp_showstart, flgrp_showend,"
             "       flgrp_showdelta, flgrp_showbudget, flgrp_showdiff, flgrp_showcustom,"
             "       flgrp_showstartprcnt, flgrp_showendprcnt,"
             "       flgrp_showdeltaprcnt, flgrp_showbudgetprcnt, flgrp_showdiffprcnt, flgrp_showcustomprcnt,"
             "       flgrp_flhead_id, flgrp_prcnt_flgrp_id, flgrp_usealtsubtotal, flgrp_altsubtotal "
             "FROM flgrp "
             "WHERE (flgrp_id=:flgrp_id);" );
  financialpopulate.bindValue(":flgrp_id", _flgrpid);
  financialpopulate.exec();
  if (financialpopulate.first())
  {
    _flheadid = financialpopulate.value("flgrp_flhead_id").toInt();

    _name->setText(financialpopulate.value("flgrp_name").toString());
    _description->setText(financialpopulate.value("flgrp_descrip").toString());
    _showSubtotal->setChecked(financialpopulate.value("flgrp_subtotal").toBool());
    _summarize->setChecked(financialpopulate.value("flgrp_summarize").toBool());
    _altSubtotal->setChecked(financialpopulate.value("flgrp_usealtsubtotal").toBool());
    _altSubtotalLabel->setText(financialpopulate.value("flgrp_altsubtotal").toString());

    if(_summarize->isChecked() || _showSubtotal->isChecked())
    {
      _showStart->setChecked(financialpopulate.value("flgrp_showstart").toBool());
      _showEnd->setChecked(financialpopulate.value("flgrp_showend").toBool());
      _showDelta->setChecked(financialpopulate.value("flgrp_showdelta").toBool());
      _showBudget->setChecked(financialpopulate.value("flgrp_showbudget").toBool());
      _showDiff->setChecked(financialpopulate.value("flgrp_showdiff").toBool());
      _showCustom->setChecked(financialpopulate.value("flgrp_showcustom").toBool());
      _showStartPrcnt->setChecked(financialpopulate.value("flgrp_showstartprcnt").toBool());
      _showEndPrcnt->setChecked(financialpopulate.value("flgrp_showendprcnt").toBool());
      _showDeltaPrcnt->setChecked(financialpopulate.value("flgrp_showdeltaprcnt").toBool());
      _showBudgetPrcnt->setChecked(financialpopulate.value("flgrp_showbudgetprcnt").toBool());
      _showDiffPrcnt->setChecked(financialpopulate.value("flgrp_showdiffprcnt").toBool());
      _showCustomPrcnt->setChecked(financialpopulate.value("flgrp_showcustomprcnt").toBool());
    }

    if(financialpopulate.value("flgrp_subtract").toBool())
      _subtract->setChecked(true);
    else
      _add->setChecked(true);

    if ((_rpttype != cAdHoc) && ((_showEndPrcnt->isChecked()) || (_showDiffPrcnt->isChecked())))
      _showPrcnt->setChecked(true);

    int grpid = financialpopulate.value("flgrp_prcnt_flgrp_id").toInt();
    sFillGroupList();
    _group->setId(grpid);
  }
}
Ejemplo n.º 3
0
enum SetResponse financialLayoutSpecial::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("flhead_id", &valid);
  if (valid)
  {
    _flheadid = param.toInt();
    sFillGroupList();
  }

  param = pParams.value("flgrp_id", &valid);
  if (valid)
    _flgrpid = param.toInt();

  param = pParams.value("flspec_id", &valid);
  if (valid)
  {
    _flspecid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _buttonBox->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _buttonBox->setFocus();
    }
  }

  return NoError;
}
Ejemplo n.º 4
0
enum SetResponse financialLayoutGroup::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("flhead_id", &valid);
  if (valid)
  {
    _flheadid = param.toInt();
    sFillGroupList();
  }

  param = pParams.value("flgrp_flgrp_id", &valid);
  if (valid)
    _flgrp_flgrpid = param.toInt();

  param = pParams.value("flgrp_id", &valid);
  if (valid)
  {
    _flgrpid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      
      _buttonBox->clear();
      _buttonBox->addButton(QDialogButtonBox::Close);
      _name->setEnabled(false);
      _description->setEnabled(false);
      _subSummGroup->setEnabled(false);
      _operationGroup->setEnabled(false);
    }
  }
  param = pParams.value("type", &valid);
    if (valid)
    {
        if (param.toString() == "adHoc")
        {
			_rpttype = cAdHoc;
			_showPrcnt->setHidden(true);
		}
        else
        {
        
          _showStart->setHidden(true);
		  _showEnd->setHidden(true);
          _showDelta->setHidden(true);
          _showBudget->setHidden(true);
          _showDiff->setHidden(true);
          _showCustom->setHidden(true);
          _showStartPrcnt->setHidden(true);
          _showEndPrcnt->setHidden(true);
          _showDeltaPrcnt->setHidden(true);
          _showBudgetPrcnt->setHidden(true);
          _showDiffPrcnt->setHidden(true);
          _showCustomPrcnt->setHidden(true);
    
        }
        if (param.toString() == "income")
        {
          _rpttype = cIncome;
          _showPrcnt->setHidden(false);
		  _showStart->setChecked(false);
          _showEnd->setChecked(false);
          _showDelta->setChecked(false);
          _showBudget->setChecked(true);
          _showDiff->setChecked(true);
      
        }
        else if (param.toString() == "balance")
        {
        _rpttype = cBalance;
      _showPrcnt->setHidden(false);
      _showStart->setChecked(false);
      _showEnd->setChecked(true);
      _showDelta->setChecked(false);
      _showBudget->setChecked(true);
      _showDiff->setChecked(false);
        }
        else if (param.toString() == "cash")
        {
         _rpttype = cCash;
      _showPrcnt->setHidden(false);
      _showStart->setChecked(false);
      _showEnd->setChecked(false);
      _showDelta->setChecked(true);
      _showBudget->setChecked(true);
      _showDiff->setChecked(true);
      }
    }

  return NoError;
}
Ejemplo n.º 5
0
void financialLayoutItem::populate()
{
  q.prepare( "SELECT * "
             "FROM flitem "
	     "LEFT OUTER JOIN subaccnttype ON flitem_subaccnttype_code=subaccnttype_code "
             "WHERE (flitem_id=:flitem_id);" );
  q.bindValue(":flitem_id", _flitemid);
  q.exec();
  if (q.first())
  {
    if ( q.value("flitem_accnt_id").toInt() == -1 )
    {
      _selectSegment->setChecked(TRUE);

      if (_metrics->value("GLCompanySize").toInt())
        _company->setText(q.value("flitem_company"));
      if (_metrics->value("GLProfitSize").toInt())
        _profit->setText(q.value("flitem_profit"));
      _number->setText(q.value("flitem_number"));
      if (_metrics->value("GLSubaccountSize").toInt())
        _sub->setText(q.value("flitem_sub"));

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

      _subType->setId(q.value("subaccnttype_id").toInt());
    }
    else
    {
      _selectAccount->setChecked(TRUE);
      _account->setId(q.value("flitem_accnt_id").toInt());
    }
    _showBeginning->setChecked(q.value("flitem_showstart").toBool());
    _showEnding->setChecked(q.value("flitem_showend").toBool());
    _showDB->setChecked(q.value("flitem_showdelta").toBool());
    _showBudget->setChecked(q.value("flitem_showbudget").toBool());
    _showDiff->setChecked(q.value("flitem_showdiff").toBool());
    _showCustom->setChecked(q.value("flitem_showcustom").toBool());
    _showBeginningPrcnt->setChecked(q.value("flitem_showstartprcnt").toBool());
    _showEndingPrcnt->setChecked(q.value("flitem_showendprcnt").toBool());
    _showDBPrcnt->setChecked(q.value("flitem_showdeltaprcnt").toBool());
    _showBudgetPrcnt->setChecked(q.value("flitem_showbudgetprcnt").toBool());
    _showDiffPrcnt->setChecked(q.value("flitem_showdiffprcnt").toBool());
    _showCustomPrcnt->setChecked(q.value("flitem_showcustomprcnt").toBool());
    
    if ((_rpttype != cAdHoc) & ((_showDiffPrcnt->isChecked()) || (_showEndingPrcnt->isChecked())))
		_showPrcnt->setChecked(TRUE);

    QString src = q.value("flitem_custom_source").toString();
    if("S" == src)
      _customUseBeginning->setChecked(TRUE);
    else if("E" == src)
      _customUseEnding->setChecked(TRUE);
    else if("D" == src)
      _customUseDebits->setChecked(TRUE);
    else if("C" == src)
      _customUseCredits->setChecked(TRUE);
    else if("B" == src)
      _customUseBudget->setChecked(TRUE);
    else if("F" == src)
      _customUseDiff->setChecked(TRUE);

    if(q.value("flitem_subtract").toBool())
      _subtract->setChecked(TRUE);
    else
      _add->setChecked(TRUE);

    _flheadid = q.value("flitem_flhead_id").toInt();

    int grpid = q.value("flitem_prcnt_flgrp_id").toInt();
    sFillGroupList();
    _group->setId(grpid);
    
    sToggleShowPrcnt();
  }
}
Ejemplo n.º 6
0
enum SetResponse financialLayoutItem::set(const ParameterList &pParams)
{
  XDialog::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("flhead_id", &valid);
  if (valid)
  {
    _flheadid = param.toInt();
    sFillGroupList();
  }

  param = pParams.value("flgrp_id", &valid);
  if (valid)
    _flgrpid = param.toInt();

  param = pParams.value("flitem_id", &valid);
  if (valid)
  {
    _flitemid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;
      _buttonBox->setFocus();
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _buttonBox->clear();
      _buttonBox->addButton(QDialogButtonBox::Close);
      _buttonBox->setFocus();
      _selectAccount->setEnabled(FALSE);
      _selectSegment->setEnabled(FALSE);
      _operationGroup->setEnabled(FALSE);
      _showColumns->setEnabled(FALSE);
      _showPrcnt->setEnabled(FALSE);
      _group->setEnabled(FALSE);
      _showCustom->setEnabled(FALSE);
      _buttonBox->setFocus();
    }
  }
  param = pParams.value("type", &valid);
    if (valid)
    {
    
        if (param.toString() == "adHoc")
        {
   			_rpttype = cAdHoc;
   			_showPrcnt->setHidden(TRUE);
   		}
		else
		{
			_showColumns->setHidden(TRUE);
			_showCustom->setHidden(TRUE);
		}
		
        if (param.toString() == "income")
        {
        	_rpttype = cIncome;	
   			_showBeginning->setChecked(FALSE);
			_showEnding->setChecked(FALSE);
			_showDB->setChecked(FALSE);
			_showBudget->setChecked(TRUE);
			_showDiff->setChecked(TRUE);
			_showCustom->setChecked(FALSE);
        }
        else if (param.toString() == "balance")
        {
            _rpttype = cBalance;
   			_showBeginning->setChecked(FALSE);
			_showEnding->setChecked(TRUE);
			_showDB->setChecked(FALSE);
			_showBudget->setChecked(TRUE);
			_showDiff->setChecked(TRUE);
			_showCustom->setChecked(FALSE);
        }
        else if (param.toString() == "cash")
        {
			_rpttype = cCash;
   			_showBeginning->setChecked(FALSE);
			_showEnding->setChecked(FALSE);
			_showDB->setChecked(TRUE);
			_showBudget->setChecked(TRUE);
			_showDiff->setChecked(TRUE);
			_showCustom->setChecked(FALSE);
		}
    }

  return NoError;
}