BOOL CDlgStrategyParamConf::OnInitDialog() 
{
	CDlgBase::OnInitDialog();

	//added  by hlw 因现在分析周期只支持日线,暂屏蔽其它分析周期  20020614
	//#ifdef _ONLY_SUPPORT_DAYLINE
	//
	//	m_wndPeriod.ResetContent();
	//	m_wndPeriod.AddString("日线");
	//
	//#endif
	m_wndPeriod.ResetContent();
	AddPeriodNameToWnd(&m_wndPeriod);
	//end 

	m_EditEidolon.CreateEx(WS_EX_CLIENTEDGE,NULL,NULL,WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
		CRect(0,0,0,0),this,1001);
	m_EditEidolon.SetFont( GetFont() );

	CRect rect;
	CWnd* pWnd = GetDlgItem(IDC_PARAM);
	pWnd->GetWindowRect(&rect);
	ScreenToClient(&rect);
	m_EditEidolon.MoveWindow(rect);

	CTreeCtrlFormula* pCurTree = m_wndTab.GetTree();
	if( pCurTree )
	{
		CDlgFormulaMan* pDlg = (CDlgFormulaMan*)AfxGetMainWnd();

		pCurTree->ModifyStyleEx(0,WS_EX_CLIENTEDGE);
		pCurTree->SetImageList(&CDlgFormulaMan::m_expressImages, TVSIL_NORMAL);
		pCurTree->m_pFormulaMan = pDlg;

		if( m_nType == 1 ) // 选择条件
		{
			pDlg->CopyTree(pCurTree);

			//HTREEITEM hRootItem = pCurTree->InsertItem(CTreeCtrlFormula::g_strUnionCondition, 0, 0);
			//	HTREEITEM hRootItem = pCurTree->InsertItem(CTreeCtrlFormula::g_strJiben, CExpression::Yls_Exp_Condition, CExpression::Yls_Exp_Condition);
			HTREEITEM hRootItem = pCurTree->InsertItem(CTreeCtrlFormula::g_strJiben,
				CExpression::Yls_Exp_Condition, CExpression::Yls_Exp_Condition);
			CTreeGroup* pTreeGroup = new CTreeGroup(hx_OtherData,(DWORD)CExpression::JiBenMian); 
			pCurTree->SetItemData(hRootItem, (DWORD)pTreeGroup);

			CString strText;
			BOOL bSet = TRUE;
			CString strFind;

			this->SetWindowText(HS_LANGUAGE("选择条件"));

			switch(m_sSingleSel.m_nType)
			{
			case CExpression::JiBenMian: //
				{
					if( hRootItem != NULL)
					{			
						pCurTree->SelectItem(hRootItem);
					}
					LoadCurExp(CTreeCtrlFormula::YlsBrowser, (LPARAM)pTreeGroup);

					strFind = CDlgCondition::GetNameByKey(m_sSingleSel.m_strCondition);
				}
				break;
			case CExpression::Tech:
			case CExpression::Condition:
			case CExpression::Exchange:
			case CExpression::MoreKLine:
				{
					CValue* valoare;
					CExpression* pExpress = NULL;
					if( CExpression::m_pExternExpression->Lookup( m_sSingleSel.m_strExp,
						m_sSingleSel.m_nType,valoare ) )
					{
						pExpress = valoare->GetExp();

						pCurTree->Show(pExpress,0);
						LoadCurExp(HX_EXPRESSSENTENCE, (LPARAM)pExpress);
					}

					strFind = m_sSingleSel.m_strCondition;
				}
				break;
			default:
				bSet = FALSE;
				break;
			}
			if( bSet )
			{
				m_wndCon.SelectString(0,strFind);

				m_wndCompare.SetCurSel(m_sSingleSel.m_SubData.m_cType);
				OnSelchangeCompare();

				strText = hxSubZero(m_sSingleSel.m_SubData.m_dData1);
				m_wndData1.SetWindowText(strText);

				strText = hxSubZero(m_sSingleSel.m_SubData.m_dData2);
				m_wndData2.SetWindowText(strText);

				int nPos;
				GetPeriodStr(m_sSingleSel.m_nPeriod,&nPos);
				m_wndPeriod.SetCurSel(nPos);
			}
		}
		else
		{
			if( m_pData != NULL )
			{
				if( m_pData->m_strName != NULL )
				{
					this->SetWindowText(*m_pData->m_strName);
				}
				WORD nType = (m_pData->m_wType & 0xF);

				int nCopy = CTreeCtrlFormula::CopyNone;
				if( m_pData->m_wType & hxShowByExpressType )
				{
					if( (m_pData->m_wType & 0xF0) == hxShowByExpressType_AddTech )
					{
						nCopy = CTreeCtrlFormula::CopyNotGroup | CTreeCtrlFormula::CopyNone | YLS_EXP_MAINCHART;
						m_wndTab.DeleteAllItems();
					}
				}

				if( YLS_EXP_OUTTYPE(m_pData->m_dStyle) )
				{
					nCopy |= CTreeCtrlFormula::CopyNotGroup; 
				}

				if( nType != 0 )
				{
					CTreeCtrlFormula* pTree;
					for( int i = 0; i < 4; i++ )
					{
						switch(i)
						{
						case 0:
							nType = ((m_pData->m_wType & 0xF) & CExpression::Tech);
							break;
						case 1:
							nType = ((m_pData->m_wType & 0xF) & CExpression::Condition);
							break;
						case 2:
							nType = ((m_pData->m_wType & 0xF) & CExpression::Exchange);
							break;
						case 3:
							nType = ((m_pData->m_wType & 0xF) & CExpression::MoreKLine);
							break;
						}

						pTree = pDlg->GetCurTree( nType );
						pCurTree->CopyTree(pTree,nCopy,m_pData->m_dStyle);
					}

					if( m_pData->m_pData != NULL )
					{
						pCurTree->Show((CExpression*)m_pData->m_pData,0);
					}
					else
					{
						pCurTree->Show(NULL,0); // 显示第一个

						/*
						HTREEITEM hItem = pCurTree->GetRootItem();
						if(hItem != NULL)
						{
						pCurTree->Expand(hItem,TVE_EXPAND);
						}
						*/
					}

					//pCurTree->SetFocus();

				}
				else
				{
					pDlg->CopyTree(pCurTree,CTreeCtrlFormula::CopyDelete);
				}
			}
		}
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #2
0
//---------------------------------------------------------------------------
void __fastcall TFormReportBUCityMounth::CreateWordDocument(void)
{
    InitReportQuery();

    WordMacros macros;
    macros.BeginMacros();

    if (ZMySqlQuery->RecordCount == 0)
        return;

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.SelectionFont("Size=20");
    macros.SelectionFont("Bold=true");
    macros.SelectionText("ќтчет по оплате представительств");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Size=12");
    macros.SelectionFont("Bold=false");
    TDateTime DateRep=pFormSelDate->GetSelectedDate();
    macros.SelectionText("на "+DateRep.DateString());
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.SelectionText("ќтчетный период: ");
    macros.SelectionFont("Bold=true");
    macros.SelectionText(GetPeriodStr(DateRep));
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold=false");

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");

  // ‘ормирование таблицы
    AnsiString Str,Strtmp;
    int CountTables=0;
    int CountRows=ZMySqlQuery->RecordCount;

    macros.TablesAdd(CountRows+1, 3);
    CountTables++;

    macros.TablesColumns(CountTables, 1, "Width = 50");
    macros.TablesColumns(CountTables, 2, "Width = 300");
    macros.TablesColumns(CountTables, 3, "Width = 80");

    macros.TablesColumns(CountTables, 1, "Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.TablesColumns(CountTables, 2, "Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.TablesColumns(CountTables, 3, "Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
    macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Range.Font.Size = 10");

    macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Rows.Item(1).Range.Font.Bold=true");
//  WordDocument->Tables->Item(CountTables)->Range->Select();

    macros.TablesCell(CountTables, 1, 1, "Range.Text = \"єп/п\"");
    macros.TablesCell(CountTables, 1, 1, "Range.Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.TablesCell(CountTables, 1, 2, "Range.Text = \"ѕредставительство\"");
    macros.TablesCell(CountTables, 1, 2, "Range.Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.TablesCell(CountTables, 1, 3, "Range.Text = \"—умма (руб.)\"");
    macros.TablesCell(CountTables, 1, 3, "Range.Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");

    AnsiString SummStr;
    unsigned short year,month,day;
    DateRep.DecodeDate(&year,&month,&day);
    long commsumm=0;
    for (int i=0;i<ZMySqlQuery->RecordCount;i++)
    {
        ZMySqlQuery->RecNo=i+1;

        macros.TablesCell(CountTables, i+2, 1, "Range.Text = \"" + AnsiString(i+1) + "\"");
        macros.TablesCell(CountTables, i+2, 2, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(1)->AsString);
        SummStr=GetSummCity(ZMySqlQuery->Fields->FieldByNumber(2)->AsString,AnsiString(month),AnsiString(year) + "\"");
        macros.TablesCell(CountTables, i+2, 3, "Range.Text = \"" + SummStr + "\"");
        commsumm+=SummStr.ToInt();
    }

    macros.TablesCell(CountTables, CountRows+1, 1, "Range.Select");
    macros.InsertLine("Selection.MoveDown Unit := wdLine");
    macros.SelectionTypeParagraph();
    macros.SelectionText("»того: обща¤ сумма зафиксированных выплат со стороны всех представительств составл¤ет "+AnsiString(commsumm)+" рублей.");

    macros.EndMacros();
    macros.RunMacros();
}
Exemple #3
0
//---------------------------------------------------------------------------
void __fastcall TFormOptsOplata::UpdateTable(TStringGrid* pTab)
{
  ClearTable(pTab);

  int i,j;
  TStringList* listIDStud = new TStringList;
  TStringList* listIDOpts = new TStringList;
  listIDOpts->Clear();
  listIDStud->Clear();

  ZMySqlQuery->SQL->Clear();
  ZMySqlQuery->SQL->Add("SELECT id FROM "+opts.DBStudTable+" WHERE deleted=0 AND grpid="+ToStr(AnsiString(IDGroup)));
  ZMySqlQuery->Active=true;
  for (i=1;i<=ZMySqlQuery->RecordCount;i++)
  {
    ZMySqlQuery->RecNo=i;
    listIDStud->Add(AnsiString(ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt()));
  }

  AnsiString IDOptsStr;
  for (i=0; i<listIDStud->Count; i++)
  {
    ZMySqlQuery->SQL->Clear();
    ZMySqlQuery->SQL->Add("SELECT idopts FROM "+opts.DBPayFacts+" WHERE deleted=0 AND idstud="+ToStr(listIDStud->Strings[i]));
    ZMySqlQuery->Active=true;

    for (j=1; j<=ZMySqlQuery->RecordCount;j++)
    {
      ZMySqlQuery->RecNo=j;
      IDOptsStr = ZMySqlQuery->Fields->FieldByNumber(1)->AsString;
      if (listIDOpts->IndexOf(IDOptsStr)==-1)
        listIDOpts->Add(IDOptsStr);
    }
  }


  int numCurRow=0;
  listIDs->Clear();
  listIDs->Add("NULL");
  listRealIDs->Clear();
  listRealIDs->Add("NULL");

for (j=0; j<listIDOpts->Count; j++)
{
  ZMySqlQuery->SQL->Clear();
  ZMySqlQuery->SQL->Add("SELECT id,idgroup,datestart,dateend,commoncountmoney FROM "+opts.DBPayOpts+" WHERE deleted=0 AND id="+ToStr(listIDOpts->Strings[j])+" ORDER BY datestart");
  ZMySqlQuery->Active=true;

  for (i=1;i<=ZMySqlQuery->RecordCount;i++)
  {
    ZMySqlQuery->RecNo=i;
    numCurRow++;
    pTab->RowCount=numCurRow+1;

    listIDs->Add(AnsiString(ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt()));
    pTab->Cells[0][numCurRow]=numCurRow;
    pTab->Cells[1][numCurRow]=WCGetTitleForKeyNum(GROUPS,ZMySqlQuery->Fields->FieldByNumber(2)->AsString.ToInt());
    pTab->Cells[2][numCurRow]=GetPeriodStr(ZMySqlQuery->Fields->FieldByNumber(3)->AsString,ZMySqlQuery->Fields->FieldByNumber(4)->AsString);
    pTab->Cells[3][numCurRow]=ZMySqlQuery->Fields->FieldByNumber(5)->AsString;

    pTab->Refresh();
  }
}
  delete listIDOpts;
  delete listIDStud;

  StrGridOptsClick(StrGridOpts);
}