yfdatjfrm.pas
来自「本人编写的有关军队营房工作的管理系统」· PAS 代码 · 共 148 行
PAS
148 行
unit yfdatjfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, db, Mask, DBCtrlsEh, StdCtrls, dxdbtrel, ExtCtrls, ImgList;
type
Tyfdatj = class(TForm)
Panel1: TPanel;
Label3: TLabel;
Label4: TLabel;
Label1: TLabel;
Label2: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
dxLookupTreeView1: TdxLookupTreeView;
Edit2: TEdit;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit3: TEdit;
DBNumberEditEh1: TDBNumberEditEh;
DBNumberEditEh2: TDBNumberEditEh;
Edit4: TEdit;
Panel2: TPanel;
SpeedButton12: TSpeedButton;
SpeedButton13: TSpeedButton;
ImageList2: TImageList;
procedure dxLookupTreeView1CloseUp(Sender: TObject; Accept: Boolean);
procedure ComboBox1Change(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
private
{ Private declarations }
public
da:boolean;
{ Public declarations }
end;
var
yfdatj: Tyfdatj;
implementation
uses datafrm,yfdafrm;
{$R *.dfm}
procedure Tyfdatj.dxLookupTreeView1CloseUp(Sender: TObject; Accept: Boolean);
var
s_value1:string;
begin
if yfdatj.dxLookupTreeView1.Text<>'' then
begin
yfdatj.Edit2.Text:=yfgldata.dwqk.Lookup('单位代码',yfdatj.dxLookupTreeView1.Text,'单位名称');
yfdatj.ComboBox1.Items.Clear;
yfgldata.Query1.Active:=false;
yfgldata.Query1.SQL.Clear;
yfgldata.Query1.SQL.Add('select distinct 坐落号 ');
yfgldata.Query1.SQL.Add(' from yfgl_yfzl ');
yfgldata.Query1.SQL.Add(' where 单位代码='''+yfdatj.dxLookupTreeView1.Text+''' ');
try
yfgldata.Query1.Active:=true;
except
messagebox(yfdatj.handle,'字段值列举出错。','营房工作管理系统',16);
exit;
end;
yfgldata.Query1.First;
while not yfgldata.Query1.Eof do
begin
s_value1:=yfgldata.Query1.fieldbyname('坐落号').AsString;
yfdatj.ComboBox1.Items.Add(s_value1);
yfgldata.Query1.Next;
end;
yfgldata.Query1.Active:=false;
end;
end;
procedure Tyfdatj.ComboBox1Change(Sender: TObject);
begin
if yfdatj.ComboBox1.Text<>'' then
begin
yfdatj.Edit1.Text:=yfgldata.yfzl.Lookup('坐落号',yfdatj.ComboBox1.Text,'坐落地址');
end;
end;
procedure Tyfdatj.SpeedButton12Click(Sender: TObject);
begin
if yfdatj.da then
begin
if yfdatj.dxLookupTreeView1.Text<>'' then
begin
if yfdatj.ComboBox1.Text<>'' then
begin
if yfdatj.Edit3.Text<>'' then
begin
yfgldata.yfda.Filter:='坐落号='''+yfdatj.ComboBox1.Text+'''';
yfgldata.yfda.Filtered:=true;
if yfgldata.yfda.Locate('档案资料名称',yfdatj.Edit3.Text,[loCaseInsensitive]) then
messagebox(yfdatj.handle,'档案资料名称发生重复。','营房工作管理系统',16)
else
begin
yfgldata.yfda.Filtered:=false;
yfgldata.yfda.Append;
yfgldata.yfda.FieldByName('序号').AsInteger:=yfgldata.yfda.RecordCount+1;
yfgldata.yfda.FieldByName('单位代码').AsString:=yfdatj.dxLookupTreeView1.Text;
yfgldata.yfda.FieldByName('住用单位').AsString:=yfdatj.Edit2.Text;
yfgldata.yfda.FieldByName('坐落号').AsString:=yfdatj.ComboBox1.Text;
yfgldata.yfda.FieldByName('坐落地址').AsString:=yfdatj.Edit1.Text;
yfgldata.yfda.FieldByName('档案资料名称').AsString:=yfdatj.Edit3.Text;
yfgldata.yfda.FieldByName('份数').AsInteger:=yfdatj.DBNumberEditEh1.Value;
yfgldata.yfda.FieldByName('页数').AsInteger:=yfdatj.DBNumberEditEh2.Value;
yfgldata.yfda.FieldByName('备注').AsString:=yfdatj.Edit4.Text;
yfgldata.yfda.Post;
close;
yfda.showda;
end;
yfgldata.yfda.Filtered:=false;
end
else
messagebox(yfdatj.handle,'档案资料名称不能为空。','营房工作管理系统',16);
end
else
messagebox(yfdatj.handle,'坐落号不能为空。','营房工作管理系统',16);
end
else
messagebox(yfdatj.handle,'单位代码不能为空。','营房工作管理系统',16);
end
else
begin
yfgldata.yfda.Edit;
yfgldata.yfda.FieldByName('档案资料名称').AsString:=yfdatj.Edit3.Text;
yfgldata.yfda.FieldByName('份数').AsInteger:=yfdatj.DBNumberEditEh1.Value;
yfgldata.yfda.FieldByName('页数').AsInteger:=yfdatj.DBNumberEditEh2.Value;
yfgldata.yfda.FieldByName('备注').AsString:=yfdatj.Edit4.Text;
yfgldata.yfda.Post;
close;
end;
end;
procedure Tyfdatj.SpeedButton13Click(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?