📄 szrdview.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "SzrdView.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DateEdit"
#pragma link "fpanel"
#pragma link "ListBaseForm"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmSzrdView *frmSzrdView;
//---------------------------------------------------------------------------
__fastcall TfrmSzrdView::TfrmSzrdView(TComponent* Owner)
: TListBaseForm(Owner,euSdSzrh,"")
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::InitEditControl()
{
FillEdit(scSzrhCurrency,"select CurrencyCode,CurrencyName from sdCurrency","CurrencyName","CurrencyCode");
FillEdit(scSzrhClient,"select ClientCode,ClientName from sdClient order by ClientCode","ClientName","ClientCode");
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::ClearControl()
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::GetDataFromComObject(int Section)
{
if (Section==1)
{
seSzrhCode->Text =GetHeadValue(fiSzrhCode);
scSzrhClient->LocateKey(GetHeadValue(fiSzrhClient));
scSzrhCurrency->LocateKey(GetHeadValue(fiSzrhCurrency));
}
else
{
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::SendDataToComObject(int Section)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::WaitUserInput(int Section)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::RefreshGridData(int mAction)
{
AnsiString ItemStr;
ItemStr="\t"+GetDetailValue(fiSzrdLine)+"\t"+GetDetailValue(fiSzrdSogCode)+"\t"+
GetDetailValue(fiSzrdSogdLine)+"\t"+GetDetailValue(fiSzrdSoCode)+"\t"+
GetDetailValue(fiSzrdSodLine)+"\t"+GetDetailValue(fiSzrdQty)+"\t"+
GetDetailValue(fiSzrdAmt)+"\t"+GetDetailValue(fiSzrdCashAmt);
sgSzrd->AddItem(ItemStr);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::DisplayBill()
{
GetDataFromComObject(1);
FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::GetBill(AnsiString BillID)
{
comServer->FilterString=WideString("SzrhCode='"+BillID+"'");
comServer->Query();
if (comServer->RecordCount!=0) //Found it
{
DisplayBill();
}
else
ShowMessageWindow("在数据库中没有查到记录:"+BillID+",请查证",mwsInformation);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::FillGridWithData()
{
int i;
sgSzrd->RowCount=1;
for (i=0;i<comServer->ItemCount;i++)
{
comServer->LocateItemByIndex(i);
RefreshGridData(0);
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmSzrdView::GetHeadValue(int Index)
{
WideString S;
S = ReadFieldValue(comServer,Index);
return S;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmSzrdView::GetDetailValue(int Index)
{
WideString S;
S = ReadItemValue(comServer,Index);
return S;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::SetHeadValue(int Index,AnsiString Value)
{
WriteFieldValue(comServer,Index,WideString(Value));
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::SetDetailValue(int Index,AnsiString Value)
{
WriteItemValue(comServer,Index,WideString(Value));
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::FormShow(TObject *Sender)
{
ClearControl();
GetBill(BillNumID);
ChangeToBrowseState(true);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::ChangeToBrowseState(bool Browse)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::btnOKClick(TObject *Sender)
{
ChangeToBrowseState(true);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSzrdView::FormClose(TObject *Sender,
TCloseAction &Action)
{
//...
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -