📄 viewunit.pas
字号:
unit ViewUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids,ComCtrls, ExtCtrls,GDBGrid, StdCtrls, DBGrids, Buttons,
DBCtrls,db,dbtables, RXCtrls, RxCalc;
type
TView = class(TForm)
Panel3: TPanel;
PageControl1: TPageControl;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
Panel4: TPanel;
Panel5: TPanel;
Panel1: TPanel;
SpeedButton2: TSpeedButton;
ComboBox2: TComboBox;
SpeedButton5: TSpeedButton;
SpeedButton7: TSpeedButton;
Dbl: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Panel6: TPanel;
Panel7: TPanel;
SpeedButton3: TSpeedButton;
SpeedButton1: TSpeedButton;
SpeedButton4: TSpeedButton;
ComboBox1: TComboBox;
SpeedButton9: TSpeedButton;
ComboBox3: TComboBox;
Panel2: TPanel;
GDBGrid3: TGDBGrid;
Panel8: TPanel;
Panel9: TPanel;
Splitter2: TSplitter;
GDBGrid1: TGDBGrid;
GDBGrid4: TGDBGrid;
RxL: TRxLabel;
GDBGrid2: TGDBGrid;
Splitter1: TSplitter;
SpeedButton8: TSpeedButton;
RG1: TRadioGroup;
RxC: TRxCalculator;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
Edit1: TEdit;
Bevel1: TBevel;
UpDown1: TUpDown;
Bevel2: TBevel;
ImageList1: TImageList;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure SpeedButton9Click(Sender: TObject);
procedure GDBGrid2CellClick(Column: TColumn);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure GDBGrid2DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure GDBGrid1CellClick(Column: TColumn);
procedure GDBGrid1DblClick(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure GDBGrid2DblClick(Sender: TObject);
procedure GDBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure GDBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure GDBGrid3DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure GDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
View: TView;
implementation
{$R *.DFM}
uses DataTUnit, gzdata, NoInputUnit,bdeutils, DelRecUnit, KqDayUnit,
PassWordUnit;
procedure TView.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #27 then Close;
end;
procedure TView.FormShow(Sender: TObject);
begin
{datat.Table1.Close;
datat.Table4.Close;
try
datat.table1.Open;
datat.table4.Open;
except
Application.MessageBox('意外错误!!!请重新启动应用程序。','消息框',mb_ok+mb_iconstop);
abort;
end;
if datat.table1.Active then
ShowMessage('table1opeb');
if datat.table4.Active then
ShowMessage('table4opeb');}
{datat.Table4.DisableControls;
with datat.table4 do
begin
First;
//datat.Table4.DisableControls;
while not eof do
begin
edit;
FieldByName('tmp').AsString:='';
post;
Next;
end;
end;}
try
if data.query1.Active then
data.Query1.Close;
datat.Table4.Close;
datat.table1.Close;
data.Query1.Close;
datat.BmTable2.Close;
data.Query1.DisableControls;
speedbutton4.Caption:='查找';
with data.query1.sql do
begin
clear;
add('select riqi,count(riqi) from lyk group by riqi');
end;
data.Query1.Close;
data.Query1.Open;
combobox1.Clear;
// data.Query1.EnableControls;
with data.Query1 do
begin
First;
while not eof do
begin
combobox1.Items.Add(data.query1.fields[0].AsString);
combobox2.Items.Add(data.query1.fields[0].AsString);
Next;
end;
combobox1.Items.Add('全部数据');
combobox1.Items.Add(password.maskedit1.Text+'-'+password.edit4.text);
combobox1.ItemIndex:=combobox1.Items.Count - 1;
combobox2.Items.Add(password.maskedit1.Text+'-'+password.edit4.text);
combobox2.ItemIndex:=combobox2.Items.Count - 1;
end;
data.query1.Close;
if data.query1.Active then
data.Query1.Close;
//data.Query1.DisableControls;
speedbutton4.Caption:='查找';
with data.query1.sql do
begin
clear;
add('select bmno,bmname from bmk');
end;
data.Query1.Close;
data.Query1.Open;
combobox3.Clear;
with data.Query1 do
begin
First;
while not eof do
begin
combobox3.Items.Add(data.query1.fields[0].AsString+data.query1.Fields[1].asstring);
Next;
end;
combobox3.Items.Add('全部数据');
end;
data.query1.Close;
//
combobox3.ItemIndex:=0;
//combobox1.Items.Text:=password.maskedit1.Text+'-'+password.edit4.text;
// tabsheet4.Show;
except
Application.MessageBox('数据发生错误!!!请运行<维护>---><数据清理>菜单项!!!','提示框',mb_ok+mb_iconstop);
abort;
end;
data.Query1.EnableControls;
end;
procedure TView.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
datat.Table4.Close;
datat.table1.Close;
data.Query1.Close;
datat.BmTable2.Close;
end;
procedure TView.SpeedButton9Click(Sender: TObject);
var ll,nn:string;
begin
data.Query1.Close;
datat.BmTable2.Open;
with data.query1.sql do
begin
clear;
add('select * from lyk');
if (combobox1.Text<>'全部数据') and (combobox3.Text<>'全部数据') then
begin
ll:='';
ll:=copy(combobox3.Text,1,5);
add('where riqi='''+combobox1.Text+'''');
add('and bmno='''+ll+'''');
end;
if (combobox1.Text='全部数据') and (combobox3.Text<>'全部数据') then
begin
ll:='';
ll:=copy(combobox3.Text,1,5);
add('where bmno='''+ll+'''');
end;
if (combobox1.Text<>'全部数据') and (combobox3.Text='全部数据') then
begin
ll:='';
ll:=copy(combobox3.Text,1,5);
add('where riqi='''+combobox1.Text+'''');
end;
// add('order by bmno');
{ if combobox2.Text='人员编号'
then add('order by code')
else if combobox2.Text='姓名' then
add('order by name')
else if combobox2.Text='姓名代码' then
add('order by xmdm')
else if combobox2.Text='人员属性' then
add('order by rysx')
else if combobox2.Text='部门代号' then
add('order by bmno')
else if combobox2.Text='职称类别' then
add('order by zhichenglb')
else if combobox2.Text='机关科室' then
add('order by jgks')
else if combobox2.Text='性别' then
add('order by sex')
else if combobox2.Text='日期' then
add('order by riqi')
else if combobox2.Text='合计' then
add('order by bz_hj')
else if combobox2.Text='岗位' then
add('order by bz_gw')
else if combobox2.Text='技能' then
add('order by bz_jn')
else
begin
ShowMessage('请选择排序字段');
abort;
end; }
end;
// data.Query1.Close;
data.Query1.Open;
// data.Query1.RequestLive:=true;
// data.Query1.Edit;
nn:=IntToStr(data.Query1.RecordCount);
nn:=combobox1.Text+'月,共有记录:'+nn+'个';
messagebeep(1);
rxl.Caption:=nn;
rxl.Update;
messagebeep(1);
messagebeep(1);
// application.messagebox(PChar(nn),'提示框',mb_ok+mb_iconinformation);
tabsheet4.Show;
// speedbutton4.Caption:='查找'+combobox1.Text+'月数据';
gdbgrid2.SetFocus;
end;
procedure TView.GDBGrid2CellClick(Column: TColumn);
begin
data.query1.EnableControls;
// tstringgrid(gdbgrid2).fixedcols:=3;
//gdbgrid2.Refresh;
// tstringgrid(gdbgrid2).fixedcolor:=claqua;
// tstringgrid(Gdbgrid2).canvas.fillRect(rect);
// Gdbgrid2.canvas.brush.color := clwhite;
end;
procedure TView.SpeedButton4Click(Sender: TObject);
var
i:integer;
sy:string;
nn:string;
begin
if Length(combobox1.Text)=0 then
begin
application.MessageBox('您没有选择有效的月份,请重新选择!!!---》右边的小眼镜。','提示',mb_ok+mb_iconinformation);
abort;
end;
// if noinput=nil then
Application.CreateForm(Tnoinput,noinput);
if noinput.showmodal=mrok then
begin
IF (LENGTH(noinput.eDIT1.TEXT)=0) or (length(noinput.edit1.text)>5) THEN
begin
application.MessageBox('没有输入有效的字段值,请重输!!!','提示',mb_ok+mb_iconinformation);
abort;
end
else
with data.query1 do
begin
{ if not(data.query1.active) then
begin
application.MessageBox('数据没有产生,请重新选择日期!!!','提示',mb_ok+mb_iconinformation);
abort;
end;}
sy:=noinput.edit1.text;
if pchar(sy)<char('A') then
begin
for i:=1 to (5-Length(sy)) do
begin
sy:='0'+sy;
end;
data.Query1.Close;
with data.query1.sql do
begin
clear;
add('select * from lyk');
if combobox1.Text='全部数据' then
begin
add('where code='''+sy+'''');
end
else
begin
add('where riqi='''+combobox1.Text+'''');
add('and code='''+sy+'''');
end;
end;
data.Query1.Open;
nn:=IntToStr(data.Query1.RecordCount);
nn:=combobox1.Text+'月,共有纪录:'+nn+'个';
application.messagebox(PChar(nn),'提示框',mb_ok+mb_iconinformation);
tabsheet4.Show;
// if not(Locate('code',sy,[])) then
// begin
// application.MessageBox('不存在这条纪录CODE','提示',mb_ok+mb_iconinformation);
// first;
// abort;
// end
end
else
begin
data.Query1.Close;
with data.query1.sql do
begin
clear;
add('select * from lyk');
if combobox1.Text='全部数据' then
begin
add('where xmdm='''+sy+'''');
end
else
begin
add('where riqi='''+combobox1.Text+'''');
add('and xmdm='''+sy+'''');
end;
end;
data.Query1.Open;
nn:=IntToStr(data.Query1.RecordCount);
nn:=combobox1.Text+'月,共有纪录:'+nn+'个';
application.messagebox(PChar(nn),'提示框',mb_ok+mb_iconinformation);
tabsheet4.Show;
{ if not(Locate('xmdm',sy,[])) then
begin
application.MessageBox('不存在这条纪录XMDM','提示',mb_ok+mb_iconinformation);
first;
abort;
end;}
end;
end;
end;
noinput.release;
end;
procedure TView.SpeedButton3Click(Sender: TObject);
begin
try
data.Query1.Edit;
data.Query1.Post;
except
application.MessageBox('错误!!!数据没有打开!!!','提示',mb_ok+mb_iconinformation);
abort;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -