📄 gzglunit.pas
字号:
unit GZGLUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ExtCtrls, SUIImagePanel, DB, SUIButton,
StdCtrls, SUIEdit, SUIComboBox, DBClient;
type
TGZGLForm = class(TForm)
suiPanel1: TsuiPanel;
ds1: TDataSource;
ds2: TClientDataSet;
suiPanel2: TsuiPanel;
DBGrid1: TDBGrid;
suiPanel3: TsuiPanel;
DBGrid2: TDBGrid;
DataSource1: TDataSource;
ClientDataSet1: TClientDataSet;
lbl1: TLabel;
suiComboBox1: TsuiComboBox;
suiEdit1: TsuiEdit;
btn1: TsuiButton;
btn2: TsuiButton;
lbl2: TLabel;
btn3: TsuiButton;
lbl3: TLabel;
ds3: TClientDataSet;
wdstrngfldClientDataSet1Jzjl_ywbh: TWideStringField;
wdstrngfldClientDataSet1Jzjl_sph: TWideStringField;
wdstrngfldClientDataSet1jzjl_khbh: TWideStringField;
ClientDataSet1Jzjl_xfje: TFloatField;
ClientDataSet1Jzjl_ysje: TFloatField;
ClientDataSet1Jzjl_dzje: TFloatField;
ClientDataSet1Jzjl_ssje: TFloatField;
ClientDataSet1jzjl_fby: TFloatField;
wdstrngfldClientDataSet1Jzjl_jsfs: TWideStringField;
wdstrngfldClientDataSet1Jzjl_skr: TWideStringField;
wdstrngfldClientDataSet1Jzjl_jzzt: TWideStringField;
ClientDataSet1name: TStringField;
suiComboBox2: TsuiComboBox;
wdstrngfldClientDataSet1Jzjl_jssj: TWideStringField;
procedure btn3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure ClientDataSet1AfterScroll(DataSet: TDataSet);
procedure DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure suiComboBox1Select(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure suiComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure suiComboBox2Select(Sender: TObject);
procedure suiComboBox2KeyPress(Sender: TObject; var Key: Char);
procedure suiComboBox2DropDown(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
GZGLForm: TGZGLForm;
implementation
uses LoginUnit, MainUnit, AbortUnit;
{$R *.dfm}
procedure TGZGLForm.btn3Click(Sender: TObject);
begin
Close;
end;
procedure TGZGLForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
mainform.RefrushRoomState(0);
MainForm.Enabled:=true;
end;
procedure TGZGLForm.FormCreate(Sender: TObject);
begin
self.suiComboBox1.Clear;
self.suiComboBox2.Clear;
self.suiEdit1.Clear;
self.ClientDataSet1.Close;
Self.ClientDataSet1.CommandText:='select * from bkjz where Jzjl_jzzt=''挂账''';
self.ClientDataSet1.Open;
end;
procedure TGZGLForm.ClientDataSet1AfterScroll(DataSet: TDataSet);
begin
self.ds2.Close;
self.ds2.Open;
end;
procedure TGZGLForm.DBGrid2DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if DBGrid2.DataSource.DataSet.RecNo mod 2 = 0 theN
DBGrid2.Canvas.Brush.Color:=clSilver
else
DBGrid2.Canvas.Brush.Color:=clYellow;
DBGrid2.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
procedure TGZGLForm.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if DBGrid1.DataSource.DataSet.RecNo mod 2 = 0 theN
DBGrid1.Canvas.Brush.Color:=clSilver
else
DBGrid1.Canvas.Brush.Color:=clYellow;
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
procedure TGZGLForm.suiComboBox1Select(Sender: TObject);
begin
self.suiComboBox2.SetFocus;
end;
procedure TGZGLForm.FormActivate(Sender: TObject);
begin
suiComboBox1.SetFocus;
end;
procedure TGZGLForm.suiComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
suiComboBox2.SetFocus;
end;
procedure TGZGLForm.suiComboBox2Select(Sender: TObject);
begin
Self.btn1.SetFocus;
end;
procedure TGZGLForm.suiComboBox2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
Self.btn1.SetFocus;
end;
procedure TGZGLForm.suiComboBox2DropDown(Sender: TObject);
var
temp:string;
begin
case suiComboBox1.ItemIndex of
0:LoginForm.AddCombobox(self.suiComboBox2,'select distinct Jzjl_ywbh from bkjz where Jzjl_jzzt=''挂账''');
1:begin
LoginForm.ExecuteSQL('select distinct jzjl_khbh from bkjz where Jzjl_jzzt=''挂账''');
LoginForm.dsQuery.First;
while not LoginForm.dsQuery.Eof do
begin
temp:=temp+loginform.dsQuery.Fields[0].AsString+'@';
LoginForm.dsQuery.Next;
end;
LoginForm.dsQuery.Close;
suiComboBox2.Items.Clear;
suiComboBox2.Items.BeginUpdate;
while Pos('@',temp)>0 do
begin
LoginForm.ExecuteSQL('select name from guest where id='+Copy(temp,1,pos('@',temp)-1));
Self.suiComboBox2.Items.Add(loginform.dsQuery.Fields[0].AsString);
LoginForm.dsQuery.Close;
Delete(temp,1,pos('@',temp));
end;
suiComboBox2.Items.EndUpdate;
end;
end;
end;
procedure TGZGLForm.btn1Click(Sender: TObject);
var
sql:string;
begin
sql:='select * from bkjz where Jzjl_jzzt=''挂账''';
case suiComboBox1.ItemIndex of
0:sql:=sql+' and Jzjl_ywbh='''+suicombobox2.Text+'''';
1:begin
LoginForm.ExecuteSQL('select id from guest where name='''+suicombobox2.Text+'''');
sql:=sql+' and jzjl_khbh='''+loginform.dsQuery.Fields[0].AsString+'''';
LoginForm.dsQuery.Close;
end;
end;
self.ClientDataSet1.Close;
Self.ClientDataSet1.CommandText:=sql;
self.ClientDataSet1.Open;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -