📄 ygxxwh.pas
字号:
unit Ygxxwh;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, StdCtrls, ExtCtrls, dmKqgl, KqglCommon,
ActnList;
type
TYgxxwhForm = class(TForm)
pnlToolBar: TPanel;
btDel: TButton;
dbYgxx: TDBGrid;
dsYgxx: TDataSource;
alYgxxwh: TActionList;
acDel: TAction;
acExit: TAction;
btExit: TButton;
procedure acDelExecute(Sender: TObject);
procedure acExitExecute(Sender: TObject);
procedure alYgxxwhUpdate(Action: TBasicAction; var Handled: Boolean);
private
FdmKqgl: TdmKqgl;
{ Private declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent; AdmKqgl: TdmKqgl); reintroduce;
end;
implementation
{$R *.dfm}
constructor TYgxxwhForm.Create(AOwner: TComponent; AdmKqgl: TdmKqgl);
begin
FdmKqgl := AdmKqgl;
inherited Create(AOwner);
end;
procedure TYgxxwhForm.acDelExecute(Sender: TObject);
var
l_Sql: string;
begin
if Application.MessageBox('是否删除此记录?', '确认', 1) = 1 then
begin
with FdmKqgl.qryCommon do
begin
Close;
l_Sql := 'Select Ygbh from Kqjl where Ygbh = ' +
QuotedStr(dsYgxx.DataSet.fieldByname('Ygbh').AsString);
Sql.Text := l_Sql;
Open;
if Recordcount > 0 then
Application.MessageBox('该员工已有考勤信息,不能删除!', '提示')
else
dsYgxx.DataSet.Delete;
Close;
end;
end;
end;
procedure TYgxxwhForm.acExitExecute(Sender: TObject);
begin
if dsYgxx.State in [dsEdit, dsInsert] then
dsYgxx.DataSet.Post;
Close;
end;
procedure TYgxxwhForm.alYgxxwhUpdate(Action: TBasicAction;
var Handled: Boolean);
begin
acDel.Enabled := not (dsYgxx.DataSet.Bof and dsYgxx.DataSet.Eof);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -