📄 fuzhu.cpp
字号:
m_query->SQL->Clear();
m_query->SQL->Add(sql);
m_con->Connected=true;
m_query->ExecSQL();
closeconnection();
//TODO: Add your source code here
}
void __fastcall TYuange::init(AnsiString constring)
{
m_connectstring=constring;
list_lbfzbh->Clear(); //TODO: Add your source code here
list_lbfzmc->Clear();
list_temp->Clear();
list_xmbh->Clear();
list_xmmc->Clear();
list_xmlb->Clear();
list_lbfz->Clear();
list_bscs->Clear();
list_mcbsmc->Clear();
list_mcbssj->Clear();
list_mcbszt->Clear();
list_mcbslqmc->Clear();
list_dfqk->Clear();
list_ycjdf->Clear();
list_pjlcj->Clear();
list_pjlmc->Clear();
list_pjldf->Clear();
list_xmxj->Clear();
list_sfgz->Clear();
list_sfdgbs->Clear();
list_cjdw->Clear();
list_gs->Clear();
list_xmgs->Clear();
m_con->Connected=false;
m_con->ConnectionString=m_connectstring;
//TODO: Add your source code here
}
void __fastcall TYuange::connectsql(AnsiString sql)
{
closeconnection();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
openconnection();
//TODO: Add your source code here
}
void __fastcall TYuange::initlist()
{
list_lbfzbh->Clear(); //TODO: Add your source code here
list_lbfzmc->Clear();
list_temp->Clear();
list_xmbh->Clear();
list_xmmc->Clear();
list_xmlb->Clear();
list_lbfz->Clear();
list_lbbh->Clear();
list_fzbh->Clear();
list_bscs->Clear();
list_mcbsmc->Clear();
list_mcbssj->Clear();
list_mcbszt->Clear();
list_mcbslqmc->Clear();
list_dfqk->Clear();
list_ycjdf->Clear();
list_pjlcj->Clear();
list_pjlmc->Clear();
list_pjldf->Clear();
list_xmxj->Clear();
list_sfgz->Clear();
list_sfdgbs->Clear();
list_cjdw->Clear();
list_gs->Clear();
list_xmgs->Clear();
list_jylq->Clear();
list_qn_xmxj->Clear();
list_qn_xmbh->Clear();
//TODO: Add your source code here
}
TYuange_::TYuange_(TYuange * yuang)
{
list_temp=new TStringList;
list_list_xmbh=new TStringList;
list_list_xmmc=new TStringList;
this->yuange=yuang;
list_zxmmc=new TStringList;
list_zxmbh=new TStringList;
list_zxmzt=new TStringList;
list_zxmgs=new TStringList;
list_zxmbssj=new TStringList;
//TODO: Add your source code here
}
bool __fastcall TYuange_::selectlbfz(AnsiString lbfz)
{
//// int index;
int index;
AnsiString m_xmbh,temp;
if(yuange->list_lbfzmc->Count<=0)return false;
index=yuange->list_lbfzmc->IndexOf(lbfz);
if(index<0)return false;
m_xmbh=yuange->list_lbfzbh->Strings[index].Trim();
list_list_xmmc->Clear();
list_list_xmbh->Clear();
for(i=0;i<yuange->list_xmmc->Count;i++){
temp=yuange->list_lbfz->Strings[i].Trim();
if(temp==m_xmbh){
list_list_xmbh->Add(yuange->list_xmbh->Strings[i].Trim());
list_list_xmmc->Add(yuange->list_xmmc->Strings[i].Trim());
}
}
//TODO: Add your source code here
}
TYuange_::~TYuange_()
{
delete list_temp;
delete list_list_xmbh;
delete list_list_xmmc;
delete list_zxmmc;
delete list_zxmbh;
delete list_zxmzt;
delete list_zxmgs;
delete list_zxmbssj;
//TODO: Add your source code here
}
AnsiString __fastcall TYuange_::getrandomtable()
{
AnsiString temp;
WORD hour;
WORD min;
WORD sec;
WORD msec;
Now().DecodeTime(&hour,&min,&sec,&msec);
temp.printf("yuange%d%d%d%d",hour,min,sec,msec);
return temp; //TODO: Add your source code here
}
AnsiString __fastcall TYuange_::selectbsxm(AnsiString xmmc)
{ int index;
index=list_list_xmmc->IndexOf(xmmc);
if(index<0)return "-1";
temp_str=list_list_xmbh->Strings[index].Trim();
return temp_str;
//TODO: Add your source code here
}
bool __fastcall TYuange_::setxminfo(AnsiString xmbh)
{ int index;
index=yuange->list_xmbh->IndexOf(xmbh);
if(index<0)return false;
list_lbfz=yuange->list_lbfz->Strings[index].Trim();
list_lbbh=yuange->list_lbbh->Strings[index].Trim();
list_fzbh=yuange->list_fzbh->Strings[index].Trim();
list_xmbh=yuange->list_xmbh->Strings[index].Trim();
list_xmlb=yuange->list_xmlb->Strings[index].Trim();
list_xmmc=yuange->list_xmmc->Strings[index].Trim();
list_mcbsmc=yuange->list_mcbsmc->Strings[index].Trim();
list_mcbszt=yuange->list_mcbszt->Strings[index].Trim();
list_mcbssj=yuange->list_mcbssj->Strings[index].Trim();
list_mcbslqmc=yuange->list_mcbslqmc->Strings[index].Trim();
list_bscs=yuange->list_bscs->Strings[index].Trim();
list_gs=yuange->list_gs->Strings[index].Trim();
list_bscs=yuange->list_bscs->Strings[index].Trim();
list_dfqk=yuange->list_dfqk->Strings[index].Trim();
list_ycjdf=yuange->list_ycjdf->Strings[index].Trim();
list_pjlcj=yuange->list_pjlcj->Strings[index].Trim();
list_pjlmc=yuange->list_pjlmc->Strings[index].Trim();
list_pjldf=yuange->list_pjldf->Strings[index].Trim();
list_xmxj=yuange->list_xmxj->Strings[index].Trim();
list_sfgz=yuange->list_sfgz->Strings[index].Trim();
list_sfdgbs=yuange->list_sfdgbs->Strings[index].Trim();
list_cjdw=yuange->list_cjdw->Strings[index].Trim();
list_xmgs=yuange->list_xmgs->Strings[index].Trim();
list_jylq=yuange->list_jylq->Strings[index].Trim();
return true;
//TODO: Add your source code here
}
void __fastcall TYuange_::getzxm(TStringList ** list)
{ int index;
////看看是否是单个项目......................
list_zxmmc->Clear();
list_zxmbh->Clear();
(*list)->Clear();
index=StrToInt(list_xmgs.Trim());
if(index>1){
temp_str="select DXCNMC,DXXMBH,DXXMZT,GS,DXBSSJ from qnxmsz where XMBH='"+list_xmbh+"'";
yuange->connectsql(temp_str);
if(yuange->m_query->RecordCount>0){
list_ppzxmmc=yuange->m_query->Fields->FieldByName("DXCNMC")->AsString.Trim();
list_ppzxmbh=yuange->m_query->Fields->FieldByName("DXXMBH")->AsString.Trim();
list_ppzxmzt=yuange->m_query->Fields->FieldByName("DXXMZT")->AsString.Trim();
list_ppzxmgs=yuange->m_query->Fields->FieldByName("GS")->AsString.Trim();
list_ppzxmbssj=yuange->m_query->Fields->FieldByName("DXBSSJ")->AsString.Trim();
parsestr(list_ppzxmmc,&list_zxmmc,';');
parsestr(list_ppzxmbh,&list_zxmbh,';');
parsestr(list_ppzxmzt,&list_zxmzt,';');
parsestr(list_ppzxmgs,&list_zxmgs,';');
parsestr(list_ppzxmbssj,&list_zxmbssj,';');
list_zxmmc->Add(list_xmmc);
list_zxmbh->Add(list_xmbh);
(*list)->Assign(list_zxmmc);
}
else
{
list_zxmmc->Add(list_xmmc);
list_zxmbh->Add(list_xmbh);
(*list)->Add(list_xmmc);
parsestr(list_mcbssj,&list_temp,';');
list_bssj= list_temp->Strings[0].Trim();
}
}
else
{
list_zxmmc->Add(list_xmmc);
list_zxmbh->Add(list_xmbh);
(*list)->Add(list_xmmc);
parsestr(list_mcbssj,&list_temp,';');
list_bssj= list_temp->Strings[0].Trim();
}
return ;
//TODO: Add your source code here
}
void __fastcall TYuange_::setzxminfo(int zxmindex)
{
zxm_index=zxmindex; //TODO: Add your source code here
if(StrToInt(list_xmgs)>1){
if(zxm_index<list_zxmgs->Count){
this->list_gs=list_zxmgs->Strings[zxm_index].Trim();
this->list_bssj=list_zxmbssj->Strings[zxm_index].Trim();
qn_xmbh=list_zxmbh->Strings[zxm_index].Trim();
int i=yuange->list_qn_xmbh->IndexOf(qn_xmbh);
qn_xmxz=yuange->list_qn_xmxj->Strings[i].Trim();
}
else{
this->list_gs="0";
qn_xmxz="-1";
}
}
}
bool __fastcall TYuange_SR::validebsfs(int bsfs)
{
int index;
curbsfs=bsfs+1;
if(StrToInt(list_xmgs)>1){
parsestr(list_ppzxmzt,&list_temp,';');
temp_str=list_temp->Strings[zxm_index].Trim();
index=StrToInt(temp_str);
i=(bsfs+1)*10;
if(index<i+2||index>=i+4)return false;
return true;
}
temp_str=list_mcbszt;
parsestr(temp_str,&list_temp,';');
if(bsfs>=list_temp->Count)return false;
temp_str=list_temp->Strings[bsfs].Trim();
index=StrToInt(temp_str);
i=(bsfs+1)*10;
if(index<i+2||index>=i+4)return false;
return true;
//TODO: Add your source code here
}
void __fastcall TYuange_SR::createsrtable(int type)
{
dropsrtable(type);
m_table_name=this->getrandomtable();
m_sql="CREATE TABLE "+m_table_name+"( \
XMBH char (20) ,\
YDYBH char (10) ,\
BSFS int , \
XZH int , \
PDH int , \
LBBH char (10) ,\
FZBH char (10) ,\
CJ numeric(18, 0) NULL ,\
DF numeric(18, 2) , \
MC int , \
PJLBZ char (20) ,\
PJLDF numeric(18, 2) ,\
XZMC int , \
CJBZ char (20) , \
DXBH char (20), \
JJBZ int, \
JLBZ int, \
BLBZ int \
) ";
exe(m_sql);
//TODO: Add your source code here
}
void TYuange_SR::close()
{
this->m_con->Connected=false; //TODO: Add your source code here
this->m_query->Active=false;
}
void TYuange_SR::open()
{
this->m_con->Connected=true; //TODO: Add your source code here
this->m_query->Active=true;
//TODO: Add your source code here
}
TYuange_SR::updatedata(TStringList * list_pydybh, TStringList * list_value, AnsiString field, int type)
{
if(type==1){
for(index=0;index<list_pydybh->Count;index++){
if(index>=list_value->Count)break;
m_sql="update "+m_table_name+" set "+field+"="+list_value->Strings[index].Trim()+" where YDYBH='"+list_pydybh->Strings[index].Trim()+"'";
exe(m_sql);
}
}else
if(type==2){
for(index=0;index<list_pydybh->Count;index++){
if(index>=list_value->Count)break;
m_sql="update "+m_table_name+" set "+field+"='"+list_value->Strings[index].Trim()+"' where YDYBH='"+list_pydybh->Strings[index].Trim()+"'";
exe(m_sql);
} //TODO: Add your source code here
}
//TODO: Add your source code here
}
void __fastcall TYuange_SR::sr_paiming()
{
int index;
//(*list_mc)->Clear();
AnsiString psfgz;
int mc_index;
TStringList *list_pydybh,*list_pmc,*list_pcj,*list_jingji;
list_pydybh=new TStringList;
list_pmc=new TStringList;
list_pcj=new TStringList;
list_jingji=new TStringList;
if(list_sfgz=="递增")psfgz=" ASC ";
if(list_sfgz=="递减")psfgz=" DESC ";
if(list_xmlb=="全能"){
if(qn_xmxz=="1")
psfgz=" ASC ";
if(qn_xmxz=="3"||qn_xmxz=="2")psfgz=" DESC ";
}
m_sql="select YDYBH,CJ from "+m_table_name+" where CJ<>0 order by CJ "+psfgz;
open(m_sql);
mc_index=1;
while(!m_query->Eof){
list_pydybh->Add(m_query->Fields->FieldByName("YDYBH")->AsString.Trim());
list_pcj->Add(m_query->Fields->FieldByName("CJ")->AsString.Trim());
list_pmc->Add(IntToStr(mc_index));
m_query->Next();
mc_index++;
}
m_sql="select YDYBH,CJ from "+m_table_name+" where CJ=0 order by CJ "+psfgz;
open(m_sql);
while(!m_query->Eof){
list_pydybh->Add(m_query->Fields->FieldByName("YDYBH")->AsString.Trim());
list_pcj->Add(m_query->Fields->FieldByName("CJ")->AsString.Trim());
list_pmc->Add(IntToStr(mc_index));
m_query->Next();
mc_index++;
}
updatedata(list_pydybh,list_pmc,"XZMC",1);
delete list_pydybh;
delete list_pmc;
delete list_pcj;
delete list_jingji;
//TODO: Add your source code here
//TODO: Add your source code here
}
void __fastcall TYuange_SR::exe(AnsiString sql)
{
close();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
m_con->Connected=true;
m_query->ExecSQL();
close();
//TODO: Add your source code here
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -