qu_scmbh.cpp
来自「一个以前收集的基于C/S架构的ERP客户端源代码」· C++ 代码 · 共 154 行
CPP
154 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Qu_Scmbh.h"
#include "Qu_Scmbd.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmQu_Scmbh *frmQu_Scmbh;
//---------------------------------------------------------------------------
__fastcall TfrmQu_Scmbh::TfrmQu_Scmbh(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
: TQueryBaseForm(Owner,chWnd,MidCode,WhereStr)
{
l_SQL=""; //查询语句
QueryGrid=sgScmbh;
l_chWnd=chWnd;
l_MidCode=MidCode;
l_WhereStr=WhereStr;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::ClearControl(bool BringToNext)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::GetDataFromComObject()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::WaitUserInput()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::RefreshGridData(int mAction)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::DisplayBill()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::GetBill(AnsiString BillID)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::FillGridWithData()
{
TComResultSet *RsQuery=new TComResultSet(Handle,g_ClientHandle);
AnsiString ItemStr="",l_FiStr="";
if(FilterStr=="")
l_FiStr="";
else
l_FiStr=" where "+FilterStr;
l_SQL=" select distinct ScmbhCode,ScmbhDate,ScmbhFmonth,ScmbhDesc, ScmbhOCost,ScmbhNCost,";
l_SQL=l_SQL+"ScmbhCheck,ScmbhUser,ScmbhChecker, ScmbhSysDate from sdVW_Scmbh "+l_FiStr+" order by ScmbhCODE";
sgScmbh->RowCount=1;
try
{
RsQuery->Open(l_SQL,"");
RsQuery->MoveFirst();
while( RsQuery->Eof == 0)
{
ItemStr="\t"+RsQuery->FieldByName("ScmbhCODE")+
"\t"+RsQuery->FieldByName("ScmbhDATE")+
"\t"+RsQuery->FieldByName("ScmbhFMONTH")+
"\t"+RsQuery->FieldByName("ScmbhDESC")+
"\t"+RsQuery->FieldByName("ScmbhOCost")+
"\t"+RsQuery->FieldByName("ScmbhNCost")+
"\t"+(RsQuery->FieldByName("ScmbhCheck")=="1" ?"是":"否")+
"\t"+RsQuery->FieldByName("ScmbhUser")+
"\t"+RsQuery->FieldByName("ScmbhChecker")+
"\t"+RsQuery->FieldByName("ScmbhSysDate");
sgScmbh->AddItem(ItemStr);
RsQuery->MoveNext();
}
RsQuery->Close();
}
__finally
{
delete RsQuery;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::tbQueryClick(TObject *Sender)
{
if(!ShowQueryWindow())
return;
try{
StartWaitForm("正在查询,请稍候...");
FillGridWithData();
}
__finally
{
EndWaitForm();
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::tbRefreshClick(TObject *Sender)
{
if(l_SQL!="")
FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muFirstClick(TObject *Sender)
{
if(sgScmbh->RowCount > 1)
sgScmbh->Row=1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muPreviousClick(TObject *Sender)
{
if( sgScmbh->RowCount > 2)
sgScmbh->Row=sgScmbh->Row-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muNextClick(TObject *Sender)
{
if(sgScmbh->RowCount > 1 && sgScmbh->Row < sgScmbh->RowCount-1)
sgScmbh->Row=sgScmbh->Row+1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muLastClick(TObject *Sender)
{
if(sgScmbh->RowCount > 1)
sgScmbh->Row=sgScmbh->RowCount-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::sgScmbhDblClick(TObject *Sender)
{
if(sgScmbh->Row>0 &&sgScmbh->Row<sgScmbh->RowCount) //当前行无效
{
TfrmQu_Scmbd *l_Scmbd= new TfrmQu_Scmbd(this,sgScmbh->TextMatrix[sgScmbh->Row][1]);
l_Scmbd->ShowModal();
delete l_Scmbd;
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?