sdyhchaxunfrm.pas
来自「本人编写的有关军队营房工作的管理系统」· PAS 代码 · 共 107 行
PAS
107 行
unit sdyhchaxunfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Grids, DBGrids, StdCtrls, DBCtrls, Mask, DBCtrlsEh,
DBGridEh, Buttons, PrnDbgeh;
type
Tsdyhchaxun = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
SpeedButton6: TSpeedButton;
Label1: TLabel;
ComboBox1: TComboBox;
CheckBox1: TCheckBox;
DBNumberEditEh1: TDBNumberEditEh;
CheckBox2: TCheckBox;
DBNumberEditEh2: TDBNumberEditEh;
SpeedButton9: TSpeedButton;
PrintDBGridEh1: TPrintDBGridEh;
DBGridEh2: TDBGridEh;
procedure SpeedButton6Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
sdyhchaxun: Tsdyhchaxun;
implementation
uses datafrm,yhsdffrm;
{$R *.dfm}
procedure Tsdyhchaxun.SpeedButton6Click(Sender: TObject);
begin
yfgldata.yhsdf.Active:=false;
close;
end;
procedure Tsdyhchaxun.FormActivate(Sender: TObject);
var
i:integer;
present:tdatetime;
Year, Month, Day: Word;
begin
present:=now;
decodedate(present,year,month,day);
sdyhchaxun.DBNumberEditEh1.Value:=year;
sdyhchaxun.DBNumberEditEh2.Value:=month;
yfgldata.sdyh.First;
for i:=1 to yfgldata.sdyh.RecordCount do
begin
sdyhchaxun.ComboBox1.Items.Add(yfgldata.sdyh.FieldByName('姓名').AsString);
yfgldata.sdyh.Next;
end;
yfgldata.yhsdf.SQL.Text:='select * from yfgl_sdf where 姓名='' ''';
yfgldata.yhsdf.Active:=true;
end;
procedure Tsdyhchaxun.ComboBox1Change(Sender: TObject);
var
str0:string;
begin
str0:='';
if trim(sdyhchaxun.ComboBox1.Text)<>'' then
begin
if (sdyhchaxun.CheckBox1.Checked) and (sdyhchaxun.CheckBox2.Checked) then
begin
str0:='select * from yfgl_sdf where 姓名='+''''+sdyhchaxun.ComboBox1.Text+''''+' and 年度='+floattostr(sdyhchaxun.DBNumberEditEh1.Value)+' and 月份='+floattostr(sdyhchaxun.DBNumberEditEh2.Value)+' order by 年度,月份,序号';
end;
if (sdyhchaxun.CheckBox1.Checked) and (not sdyhchaxun.CheckBox2.Checked) then
begin
str0:='select * from yfgl_sdf where 姓名='+''''+sdyhchaxun.ComboBox1.Text+''''+' and 年度='+floattostr(sdyhchaxun.DBNumberEditEh1.Value)+' order by 年度,月份,序号';
end;
if (not sdyhchaxun.CheckBox1.Checked) and (sdyhchaxun.CheckBox2.Checked) then
begin
str0:='select * from yfgl_sdf where 姓名='+''''+sdyhchaxun.ComboBox1.Text+''''+' and 月份='+floattostr(sdyhchaxun.DBNumberEditEh2.Value)+' order by 年度,月份,序号';
end;
if (not sdyhchaxun.CheckBox1.Checked) and (not sdyhchaxun.CheckBox2.Checked) then
begin
str0:='select * from yfgl_sdf where 姓名='+''''+sdyhchaxun.ComboBox1.Text+''''+' order by 年度,月份,序号';
end;
yfgldata.yhsdf.SQL.Text:=str0;
yfgldata.yhsdf.Active:=true;
sdyhchaxun.SpeedButton9.Enabled:=yfgldata.yhsdf.RecordCount>0;
end
else
sdyhchaxun.SpeedButton9.Enabled:=false;
end;
procedure Tsdyhchaxun.SpeedButton9Click(Sender: TObject);
begin
sdyhchaxun.PrintDBGridEh1.PageHeader.CenterText.Clear;
sdyhchaxun.PrintDBGridEh1.PageHeader.CenterText.Add(sdyhchaxun.ComboBox1.Text+'水电费表');
sdyhchaxun.PrintDBGridEh1.Preview;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?