📄 bas200_05.pas.svn-base
字号:
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActDeleteExecute(Sender: TObject);
begin
inherited;
//删除
if ADOQuery2.IsEmpty then
begin
ShowMsg('UMS10000002'); //表记录为空,操作无效
Abort;
end;
if ShowDialog('UMS10000008')=IDNO then Abort; //确定要删除此记录吗?
try
Screen.Cursor:=crHourGlass;
DeleteEvent;
ActRefresh.Execute;
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActRefreshExecute(Sender: TObject);
var
ABookmark:TBookmark;
begin
inherited;
//刷新
ABookmark:=ADOQuery2.GetBookmark;
try
Screen.Cursor:=crHourGlass;
ADOQuery2.DisableControls;
ADOQuery2.Close;
ADOQuery2.Open;
ARecordCount:=GetDataSetCount(ADOQuery2);
if ADOQuery2.BookmarkValid(ABookmark) then ADOQuery2.GotoBookmark(ABookmark);
finally
ADOQuery2.FreeBookmark(ABookmark);
ADOQuery2.EnableControls;
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActLocateExecute(Sender: TObject);
begin
inherited;
//查找
if ADOQuery2.IsEmpty then
begin
ShowMsg('UMS10000002'); //表记录为空,操作无效
Abort;
end;
try
Screen.Cursor:=crHourGlass;
LocateDialog(DataSource2);
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActSearchExecute(Sender: TObject);
begin
inherited;
//查询
try
Screen.Cursor:=crHourGlass;
FilterDialog(DataSource2);
ARecordCount:=GetDataSetCount(ADOQuery2);
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActPrintExecute(Sender: TObject);
begin
inherited;
//打印
try
Screen.Cursor:=crHourGlass;
SelectReport(ADOQuery2,AProgramID,AReportName,ReportGetValue);
ActRefresh.Execute;
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActExportExecute(Sender: TObject);
begin
inherited;
//导出数据
if ADOQuery2.IsEmpty then
begin
ShowMsg('UMS10000002'); //表记录为空,操作无效
Abort;
end;
try
Screen.Cursor:=crHourGlass;
HwExportForm:=THwExportForm.Create(Application);
HwExportForm.GetDataFields(AProgramID,ADOQuery2);
HwExportForm.ShowModal;
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActExitExecute(Sender: TObject);
begin
inherited;
//退出
Close;
end;
procedure TBas200_05Form.ActClassInsertExecute(Sender: TObject);
begin
inherited;
//增类别
try
Screen.Cursor:=crHourGlass;
ABusy:=True;
InsertClassEvent;
GetAllClass;
ABusy:=False;
adsListsAfterScroll(adsLists);
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActClassUpdateExecute(Sender: TObject);
begin
inherited;
//改类别
if adsLists.IsEmpty then
begin
ShowMsg('UMS10000002'); //表记录为空,操作无效
Abort;
end;
try
Screen.Cursor:=crHourGlass;
ABusy:=True;
UpdateClassEvent;
GetAllClass;
ABusy:=False;
adsListsAfterScroll(adsLists);
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ActClassDeleteExecute(Sender: TObject);
begin
inherited;
//删类别
if adsLists.IsEmpty then
begin
ShowMsg('UMS10000002'); //表记录为空,操作无效
Abort;
end;
if tvLists.Selected.HasChildren then
begin
ShowMsg('UMS10000059'); //选中的记录含有子集,不能删除
Abort;
end;
if not ADOQuery2.IsEmpty then
begin
ShowMsg('UMS10000179'); //类别资料已被相关表引用,请先删除相关的资料,再删除类别资料
Abort;
end;
if ShowDialog('UMS10000008')=IDNO then Abort; //确定要删除此记录吗?
try
Screen.Cursor:=crHourGlass;
ABusy:=True;
DeleteClassEvent;
GetAllClass;
ABusy:=False;
adsListsAfterScroll(adsLists);
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.ADOQuery2AfterScroll(DataSet: TDataSet);
begin
inherited;
if ADOQuery2.IsEmpty then Exit;
DetailAfterScroll;
if not Active then Exit;
ActNext.Enabled:=not ADOQuery2.Eof;
ActLast.Enabled:=not ADOQuery2.Eof;
ActFirst.Enabled:=not ADOQuery2.Bof;
ActPrior.Enabled:=not ADOQuery2.Bof;
end;
procedure TBas200_05Form.FormShow(Sender: TObject);
begin
inherited;
// CreatePopmeun(dxDBGrid1);
end;
procedure TBas200_05Form.dxDBGrid1DblClick(Sender: TObject);
begin
inherited;
if ADOQuery2.IsEmpty then Exit;
try
Screen.Cursor:=crHourGlass;
BrowseEvent;
ActRefresh.Execute;
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TBas200_05Form.BrowseEvent;
begin
end;
procedure TBas200_05Form.DeleteClassEvent;
begin
end;
procedure TBas200_05Form.DeleteEvent;
begin
end;
procedure TBas200_05Form.InsertClassEvent;
begin
end;
procedure TBas200_05Form.InsertEvent;
begin
end;
procedure TBas200_05Form.ReportGetValue(const ParName: String;
var ParValue: Variant);
begin
if ParName='USENM' then ParValue:=AUserName
else if ParName='PRNDT' then ParValue:=GetDBString('COM00006006') //列印日期
else if ParName='PRNNM' then ParValue:=GetDBString('COM00006007') //列印人員
else if ParName='REPNM' then ParValue:=AReportTitle
else if ADOQuery2.FindField(ParName)<>nil then ParValue:=ADOQuery2.FieldByName(ParName).DisplayLabel;
end;
procedure TBas200_05Form.UpdateClassEvent;
begin
end;
procedure TBas200_05Form.UpdateEvent;
begin
end;
procedure TBas200_05Form.dxDBGrid1BackgroundDrawEvent(Sender: TObject;
ACanvas: TCanvas; ARect: TRect);
var
AText:string;
begin
inherited;
ARect.Left:=0;
ARect.Top:=0;
ACanvas.Brush.Color:=dxDBGrid1.GroupPanelColor;
ACanvas.Font.Color:=dxDBGrid1.GroupPanelFontColor;
//您可以把列标题拖放到此处使记录按此列进行分组
if dxDBGrid1.GroupColumnCount=0 then AText:=' '+GetDBString('NOT10001012') else AText:='';
Windows.FillRect(ACanvas.Handle, ARect, 0);
DrawText(ACanvas.Handle, PChar(AText), Length(AText), ARect, DT_LEFT or DT_EXPANDTABS or DT_NOPREFIX or DT_SINGLELINE or DT_VCENTER);
end;
procedure TBas200_05Form.ClassAfterScroll;
begin
end;
procedure TBas200_05Form.DetailAfterScroll;
begin
end;
procedure TBas200_05Form.ADOQuery2BeforeOpen(DataSet: TDataSet);
begin
inherited;
ADOQuery2.AfterScroll:=nil;
end;
procedure TBas200_05Form.ADOQuery2AfterOpen(DataSet: TDataSet);
begin
inherited;
ARecordCount:=GetDataSetCount(ADOQuery2);
ADOQuery2.AfterScroll:=ADOQuery2AfterScroll;
ADOQuery2AfterScroll(ADOQuery2);
end;
procedure TBas200_05Form.adsListsAfterOpen(DataSet: TDataSet);
begin
inherited;
adsLists.AfterScroll:=adsListsAfterScroll;
adsListsAfterScroll(adsLists);
end;
procedure TBas200_05Form.adsListsAfterScroll(DataSet: TDataSet);
begin
inherited;
if ABusy then Exit;
ClassAfterScroll;
end;
procedure TBas200_05Form.adsListsBeforeOpen(DataSet: TDataSet);
begin
inherited;
adsLists.AfterScroll:=nil;
end;
procedure TBas200_05Form.GetAllClass;
begin
end;
procedure TBas200_05Form.dxDBGrid1CustomDrawFooterNode(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxTreeListColumn; AFooterIndex: Integer; var AText: String;
var AColor: TColor; AFont: TFont; var AAlignment: TAlignment;
var ADone: Boolean);
begin
inherited;
if AColumn=dxDBGrid1.Columns[0] then
begin
AColor:=clWhite;
AText:=GetDBString('COM00004002')+IntToStr(ARecordCount); //记录总数:
ADone:=True;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -