📄 uy_cd_cx.pas
字号:
unit uy_cd_cx;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, DBGrids,u_main, Tabs, Db, DBTables;
type
Ty_cd_cx = class(TForm)
DBGrid1: TDBGrid;
TabSet1: TTabSet;
dq_cdcx: TDataSource;
q_cdcx: TQuery;
q_cdcxcdbh: TStringField;
q_cdcxth: TStringField;
q_cdcxtht: TStringField;
q_cdcxkrs: TIntegerField;
q_cdcxfwyh: TStringField;
q_cdcxycsj: TDateTimeField;
q_cdcxjzsj: TDateTimeField;
q_cdcxtm: TStringField;
q_cdcxjzfs: TStringField;
y_jzfs: TTable;
y_jzfsJZFSH: TStringField;
y_jzfsJzfs: TStringField;
y_jzfsD_yn: TBooleanField;
q_cdcxjzfs1: TStringField;
q_cdcxzws: TIntegerField;
q_cdcxzt1: TStringField;
q_cdcxzt: TStringField;
procedure FormShow(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure DBGrid1KeyPress(Sender: TObject; var Key: Char);
procedure TabSet1Change(Sender: TObject; NewTab: Integer;
var AllowChange: Boolean);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
y_cd_cx: Ty_cd_cx;
implementation
{$R *.DFM}
procedure Ty_cd_cx.FormShow(Sender: TObject);
begin
if not y_jzfs.Active then y_jzfs.Active:=true;
TabSet1.TabIndex:=0;
s_sql:='SELECT cdbh,th,tm,tht,krs,zws,fwyh,ycsj,jzfs,jzsj,cd.zt,cd_zt.zt as zt1 FROM cd,t,tai,cd_zt where (cd.th=t.th) and (cd.tht=tai.tht) and (cd.zt=cd_zt.bh)';
//SELECT cdbh,th,tm,tht,krs,zws,fwyh,ycsj,jzfs,jzsj,cd.zt,cd_zt.zt as zt1 FROM cd,t,tai,cd_zt where (cd.th=t.th) and (cd.tht=tai.tht) and (cd.zt=cd_zt.bh)
with q_cdcx do
begin
DisableControls;
sql.Clear;
sql.add(s_sql);
active:=false;
active:=true;
EnableControls;
end;
end;
procedure Ty_cd_cx.DBGrid1DblClick(Sender: TObject);
begin
if (q_cdcx.RecordCount=0) or (q_cdcx.FieldByName('th').asstring='') then
esc_enter:=0
else
esc_enter:=1;
close;
end;
procedure Ty_cd_cx.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then
begin
esc_enter:=0;
close;
end;
end;
procedure Ty_cd_cx.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
if (q_cdcx.RecordCount=0) or (q_cdcx.FieldByName('th').asstring='') then
esc_enter:=0
else
esc_enter:=1;
close;
end;
end;
procedure Ty_cd_cx.TabSet1Change(Sender: TObject; NewTab: Integer;
var AllowChange: Boolean);
begin
case newtab of
0:s_sql:='SELECT cdbh,th,tm,tht,krs,zws,fwyh,ycsj,jzfs,jzsj,cd.zt,cd_zt.zt as zt1 FROM cd,t,tai,cd_zt where (cd.th=t.th) and (cd.tht=tai.tht) and (cd.zt=cd_zt.bh)';
1:s_sql:='SELECT cdbh,th,tm,tht,krs,zws,fwyh,ycsj,jzfs,jzsj,cd.zt,cd_zt.zt as zt1 FROM cd,t,tai,cd_zt where (cd.th=t.th) and (cd.tht=tai.tht) and (cd.zt=cd_zt.bh) and (cd.zt="1")';
2:s_sql:='SELECT cdbh,th,tm,tht,krs,zws,fwyh,ycsj,jzfs,jzsj,cd.zt,cd_zt.zt as zt1 FROM cd,t,tai,cd_zt where (cd.th=t.th) and (cd.tht=tai.tht) and (cd.zt=cd_zt.bh) and (cd.zt="2")';
3:s_sql:='SELECT cdbh,th,tm,tht,krs,zws,fwyh,ycsj,jzfs,jzsj,cd.zt,cd_zt.zt as zt1 FROM cd,t,tai,cd_zt where (cd.th=t.th) and (cd.tht=tai.tht) and (cd.zt=cd_zt.bh) and (cd.zt="3")';
end;
with q_cdcx do
begin
DisableControls;
sql.Clear;
sql.add(s_sql);
active:=false;
active:=true;
EnableControls;
end;
end;
procedure Ty_cd_cx.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case key of
83:tabset1.tabindex:=0;
71:tabset1.tabindex:=1;
72:tabset1.tabindex:=2;
74:tabset1.tabindex:=3;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -