frm_conditionset.pas
来自「一个电力企业的后台管理程序」· PAS 代码 · 共 102 行
PAS
102 行
unit Frm_ConditionSet;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons, ComCtrls,Frm_Dst;
type
TForm_CondSet = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Lbl_TableName: TLabel;
Dtp_Start: TDateTimePicker;
Dtp_End: TDateTimePicker;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Ch_DelRec: TCheckBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
ConditionItem: String;
TempForm: TForm_Dts;
procedure SetForm(TableName: String);
public
{ Public declarations }
end;
var
Form_CondSet: TForm_CondSet;
implementation
uses dbtables,Systemdm;
{$R *.DFM}
procedure TForm_CondSet.FormCreate(Sender: TObject);
begin
//TableName :=
TempForm := Self.Owner as TForm_Dts;
Lbl_TableName.Caption := TempForm.Lv_Table.Selected.Caption;
SetForm(TempForm.Lv_Table.Selected.Caption);
end;
procedure TForm_CondSet.SetForm(TableName: String);
begin
with TQuery.Create(nil)do
try
DataBaseName := SysDM.DBMain.DatabaseName;
Sql.Text := Format('Select * from SysBakTable where TableName = ''%s'' and Property = ''2''',[TableName]);
Open;
if not IsEmpty then
begin
ConditionItem := FieldByName('ConditionItem').AsString;
end
else
begin
Dtp_Start.Enabled := False;
Dtp_end.Enabled := False;
Ch_DelRec.Enabled := False;
bitbtn1.Enabled := False;
end;
finally
Free;
end;
end;
procedure TForm_CondSet.BitBtn1Click(Sender: TObject);
var
Str: String;
begin
if Ch_DelRec.Checked then
TempForm.Lv_Table.Selected.SubItems.Insert(1,'是') //.Add('是')
else
TempForm.Lv_Table.Selected.SubItems.Insert(1,'');
Str := Format('%s >= ''%s'' and %s < ''%s''',[Conditionitem,FormatdateTime('YYYY-MM-DD',Dtp_Start.DateTime),Conditionitem,FormatdateTime('YYYY-MM-DD',Dtp_end.DateTime + 1)]);
TempForm.Lv_Table.Selected.SubItems.Insert(2,Str);//Add(Str);
Close;
end;
procedure TForm_CondSet.FormShow(Sender: TObject);
begin
//Lbl_TableName.Caption := Form_Dts.Lv_Table.Selected.Caption;
// SetForm(Form_Dts.Lv_Table.Selected.Caption);
end;
procedure TForm_CondSet.BitBtn2Click(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?