📄 frmcxydy.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "frmcxydy.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "model"
#pragma resource "*.dfm"
Tcxydy *cxydy;
//---------------------------------------------------------------------------
__fastcall Tcxydy::Tcxydy(TComponent* Owner)
: TMDIChild(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::FormShow(TObject *Sender)
{
this->Width=620;
this->Height=510;
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::lbfzChange(TObject *Sender)
{
int index;
AnsiString str;
index=lbfz->ItemIndex;
if(index<0||lbfz->Items->Count<1)return;
str=lbfz->Items->Strings[index].Trim();
yuange_cx->selectlbfz(str);
xm->Items->Assign(yuange_cx->list_list_xmmc);
xm->ItemIndex=0;
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::open(AnsiString m_sql)
{
m_con->Connected=false;
m_query->Active=false;
m_query->SQL->Clear();
m_query->SQL->Add(m_sql);
m_con->Connected=true;
m_query->Active=true;
//TODO: Add your source code here
}
void __fastcall Tcxydy::FormDestroy(TObject *Sender)
{
////////////////////////
delete list_temp;
delete list_dwbh;
m_con->Connected=false;
m_query->Active=false;
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::FormCreate(TObject *Sender)
{
/////////////////
list_temp=new TStringList;
list_dwbh=new TStringList;
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::setvalue()
{
AnsiString temp_str;
int i, index;
if(!grid->DataSource)return;
temp_str=m_query->Fields->FieldByName("SBXM")->AsString.Trim();
parsestr(temp_str,&list_temp,';');
sbxm->Clear();
if(list_temp->Count>0)
for(i=0;i<list_temp->Count;i++){
temp_str=list_temp->Strings[i].Trim();
index=yuange_cx->list_list_xmbh->IndexOf(temp_str);
sbxm->Lines->Add(yuange_cx->list_list_xmmc->Strings[index].Trim());
} //TODO: Add your source code here
}
void __fastcall Tcxydy::BitBtn1Click(TObject *Sender)
{
////
if(lbfz->Text.Trim().IsEmpty()){
ShowMessage("请选择类别分组");
return;
}
AnsiString m_sql;
AnsiString m_where="";
grid->DataSource=this->source;
m_sql="select a.YDYBH,a.YDYXM,a.XB,b.DWMC,a.SBXM from ydyb a, jsdwb b where a.DWBH=b.BH ";
if(!ydyxm->Text.Trim().IsEmpty()){
m_where+=" and a.YDYXM='"+ydyxm->Text.Trim()+"' ";
}
if(!ydybh->Text.Trim().IsEmpty()){
m_where+=" and a.YDYBH='"+ydybh->Text.Trim()+"' ";
}
if(!xm->Text.Trim().IsEmpty()){
m_where+=" and a.SBXM like '%"+yuange_cx->list_xmbh+"%' ";
}
if(!dw->Text.Trim().IsEmpty()){
m_where+=" and b.DWJC like '%"+dw->Text.Trim()+"%' ";
}
open(m_sql+ m_where +" order by a.YDYBH");
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::xmChange(TObject *Sender)
{
bool res;
int index;
AnsiString temp_str;
index=xm->ItemIndex;
if(index<0)return ;
temp_str=xm->Text;
temp_str=yuange_cx->selectbsxm(temp_str);
if(temp_str=="-1"){
return;
}
res=yuange_cx->setxminfo(temp_str);
if(!res){
return;
}
}
//---------------------------------------------------------------------------
void __fastcall Tcxydy::m_queryAfterScroll(TDataSet *DataSet)
{
setvalue();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -