📄 qu_cd.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Qu_Cd.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmQu_Cd *frmQu_Cd;
//---------------------------------------------------------------------------
__fastcall TfrmQu_Cd::TfrmQu_Cd(TComponent* Owner)
: TQueryBaseForm(Owner)
{
m_FilterStr=""; //查询条件字串
m_SQL=""; //查询语句
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::ClearControl(bool BringToNext)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::GetDataFromComObject()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::WaitUserInput()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::RefreshGridData(int mAction)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::DisplayBill()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::GetBill(AnsiString BillID)
{
return;
}
//---------------------------------------------------------------------------
bool __fastcall TfrmQu_Cd::ShowQueryWindow()
{
TfrmQuForm *FQuery=new TfrmQuForm(this,this->Name);
FQuery->ShowModal();
if(FQuery->CancelQuery)
return false;
m_FilterStr=FQuery->CreateSqlString;
delete FQuery;
return true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::FillGridWithData()
{
TComResultSet *RsQuery=NewResultSet();
AnsiString ItemStr="";
if(m_FilterStr=="")
m_FilterStr="";
else
m_FilterStr=" where "+m_FilterStr;
m_SQL=" select * from sdVW_Cd "+m_FilterStr+" order by CDFMONTH";
sgCdB->RowCount=1;
sgCdP->RowCount=1;
try
{
RsQuery->Open(m_SQL,"");
RsQuery->MoveFirst();
while( RsQuery->Eof == 0)
{
ItemStr="\t"+RsQuery->FieldByName("CdFmonth")+ //财务月份
"\t"+RsQuery->FieldByName("CdGoods")+ //物料编码
"\t"+RsQuery->FieldByName("GoodsName")+ //物料名称
"\t"+(RsQuery->FieldByName("CdInitFlg")=="1"? "是":"否")+ //初始化标志
"\t"+RsQuery->FieldByName("CdBopQty")+ //期初数量
"\t"+RsQuery->FieldByName("CdBopPrice")+ //期初单价
"\t"+RsQuery->FieldByName("CdBopAmt")+ //期初金额
"\t"+RsQuery->FieldByName("CdIopQty")+ //本期收入量
"\t"+RsQuery->FieldByName("CdIopAmt")+ //本期收入金额
"\t"+RsQuery->FieldByName("CdSopQty")+ //本期发出量
"\t"+RsQuery->FieldByName("CdSopAmt")+ //本期发出金额
"\t"+RsQuery->FieldByName("CdPopPrice")+ //前一笔单价
"\t"+RsQuery->FieldByName("CdNopPrice")+ //当前单价
"\t"+RsQuery->FieldByName("CdNopQty")+ //当前数量
"\t"+RsQuery->FieldByName("CdNopAmt"); //当前金额
sgCdB->AddItem(ItemStr);
ItemStr="\t"+RsQuery->FieldByName("CdGoods")+ //物料编码
"\t"+RsQuery->FieldByName("CdBoyQty")+ //年初数量
"\t"+RsQuery->FieldByName("CdBoyPrice")+ //年初单价
"\t"+RsQuery->FieldByName("CdBoyAmt")+ //年初金额
"\t"+RsQuery->FieldByName("CdIoyQty")+ //本年累计收入量
"\t"+RsQuery->FieldByName("CdIoyAmt")+ //本年累计收入金额
"\t"+RsQuery->FieldByName("CdSoyQty")+ //本年发出累计数量
"\t"+RsQuery->FieldByName("CdSoyAmt")+ //本年发出累计金额
"\t"+RsQuery->FieldByName("CdFopPrice")+ //结存单价
"\t"+RsQuery->FieldByName("CdFopQty")+ //结存数量
"\t"+RsQuery->FieldByName("CdFopAmt")+ //结存金额
"\t"+(RsQuery->FieldByName("CdClose")=="1"?"是":"否"); //关闭标志
sgCdP->AddItem(ItemStr);
RsQuery->MoveNext();
}
RsQuery->Close();
}
__finally
{
delete RsQuery;
}
}
//----------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::tbQueryClick(TObject *Sender)
{
if(!ShowQueryWindow())
return;
try{
StartWaitForm("正在查询,请稍候...");
FillGridWithData();
}
__finally
{
EndWaitForm();
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::tbRefreshClick(TObject *Sender)
{
if(m_SQL=="")
FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::muFirstClick(TObject *Sender)
{
if(sgCdB->RowCount > 1)
sgCdB->Row=1;
if(sgCdP->RowCount > 1)
sgCdP->Row=1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::muPreviousClick(TObject *Sender)
{
if( sgCdB->Row>1)
sgCdB->Row--;
if( sgCdP->Row>1)
sgCdP->Row--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::muNextClick(TObject *Sender)
{
if( sgCdB->Row < sgCdB->RowCount-1)
sgCdB->Row++;
if( sgCdP->Row < sgCdP->RowCount-1)
sgCdP->Row++;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Cd::muLastClick(TObject *Sender)
{
if(sgCdB->RowCount > 1)
sgCdB->Row=sgCdB->RowCount-1;
if(sgCdP->RowCount > 1)
sgCdP->Row=sgCdP->RowCount-1;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -