📄 process.pas
字号:
unit process;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,ADODB,DB, ComCtrls, DBTables, tread_atdprocess, RxLookup,
PicClip, ImgList, ToolWin, Buttons;
type
TFormprocess = class(TForm)
Animate1: TAnimate;
PBar1: TProgressBar;
Label2: TLabel;
cbrq2: TComboBox;
cbday2: TComboBox;
Button1: TButton;
Button2: TButton;
cbrq1: TComboBox;
cbday1: TComboBox;
Label3: TLabel;
Label1: TLabel;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
ADOQuery1workno: TStringField;
ADOQuery1name: TStringField;
ADOQuery1dept: TStringField;
PicClip: TPicClip;
ADOQuery1sexname: TStringField;
ImageList1: TImageList;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
speedbutton1: TSpeedButton;
Label6: TLabel;
Label7: TLabel;
CheckBox1: TCheckBox;
ADOCommand1: TADOCommand;
procedure Button1Click(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cbrq1Exit(Sender: TObject);
procedure cbrq2Exit(Sender: TObject);
procedure edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edit1GetImage(Sender: TObject; IsEmpty: Boolean;
var Graphic: TGraphic; var TextMargin: Integer);
procedure speedbutton1Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
atd:atdprocess;
public
{ Public declarations }
end;
var
Formprocess: TFormprocess;
f:Textfile;
c2:boolean;
implementation
uses datamol,main,publicfunction, process2;
{$R *.DFM}
procedure TFormprocess.Button1Click(Sender: TObject);
//用来记录User选了那一个条件
begin
if application.messagebox(pchar('你确定要处理从'''+cbrq1.text+'/'+cbday1.text+'''到'''+cbrq2.text+'/'+cbday2.text+'''的考勤?'),'齐协提示',mb_yesno+mb_iconquestion)=idyes then
begin
Button1.Enabled := False;
Button2.Enabled := True;
atd:=atdprocess.create(false);
atd.FreeOnTerminate:=true;
end;
end;
procedure TFormprocess.Button2Click(Sender: TObject);
begin
atd.Suspend;
atd.Terminate;
atd.Free;
Button1.Enabled := True;
Button2.Enabled := False;
Animate1.active:=false;
writeln(f,pchar(formatdatetime('yyyy/mm/dd hh:mm:ss',now)+'处理考勤时被使用者终止'));
closefile(f);
cbrq1.visible:=true; cbrq2.visible:=true; cbday1.visible:=true; cbday2.visible:=true; label3.visible:=true;
label1.caption:='开始日期:'; label1.update;
label2.caption:='起'; label2.update;
pbar1.position:=0;
end;
procedure TFormprocess.FormCreate(Sender: TObject);
var p:string;
begin
adoquery1.Close;
adoquery1.sql.clear;
adoquery1.sql.add('select workno,name,dept,sexname from per24010 order by workno ');
adoquery1.open;
radiobutton2.checked:=true;
p:=extractfilepath(application.exename)+'log\Atdprocess.log';
assignfile(f,p);
speedbutton1.Enabled:=false;
end;
procedure TFormprocess.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=vk_f1 then
begin
Application.helpfile :=extractfilepath(application.exename) +'help\pasahelp.hlp';
application.HelpJump('shm_contents0021');
end;
end;
procedure TFormprocess.FormShow(Sender: TObject);
var
month,year,item:string;
day,i:integer;
s,s1,s2:string;
begin
month:=formatdatetime('mm',now);
year:=formatdatetime('yyyy',now);
if (Cbrq1.Items.Count < 1) then
begin
cbrq1.Items.clear;
cbrq2.Items.Clear;
S := Formatdatetime('yyyy/mm', Date);
Cbrq1.Text := S;
cbrq2.text := s;
S1 := Copy(S, 1, 5);
S2 := Copy(S, 6, 2);
if StrtoINT(S2) > 1 then
begin
for i := 0 to Strtoint(S2) - 1 do
begin
if Length(S2) < 2 then
S2 := '0' + S2;
S := S1 + S2;
Cbrq1.Items.Add(S);
cbrq2.items.add(s);
S2 := inttoStr(Strtoint(S2) - 1);
end;
end else
begin
Cbrq1.Items.Add(S);
Cbrq2.Items.Add(s);
end;
end;
day:=getdays(month,year);
cbday1.items.clear;
cbday2.items.clear;
for i:=1 to day do
begin
item:=inttostr(i);
if length(item)=1 then
item:='0'+item;
cbday1.items.add(item);
cbday2.items.add(item);
end;
cbday1.text:=formatdatetime('dd',now);
cbday2.text:=formatdatetime('dd',now);
end;
procedure TFormprocess.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
selectnext(activecontrol,true,true);
end;
end;
procedure TFormprocess.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
formprocess:=nil;
action:=cafree;
end;
procedure TFormprocess.cbrq1Exit(Sender: TObject);
var
day,i:integer;
item:string;
begin
day:=getdays(copy(cbrq1.text,6,2),copy(cbrq1.text,1,4));
cbday1.items.Clear;
for i:=1 to day do
begin
item:=inttostr(i);
if length(item)=1 then
item:='0'+item;
cbday1.items.add(item);
end;
cbday1.text:='01';
end;
procedure TFormprocess.cbrq2Exit(Sender: TObject);
var
day,i:integer;
item:string;
begin
day:=getdays(copy(cbrq2.text,6,2),copy(cbrq2.text,1,4));
cbday2.items.Clear;
for i:=1 to day do
begin
item:=inttostr(i);
if length(item)=1 then
item:='0'+item;
cbday2.items.add(item);
end;
cbday2.text:=inttostr(day);
end;
procedure TFormprocess.edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=vk_f1 then
begin
Application.helpfile :=extractfilepath(application.exename) +'help\pasahelp.hlp';
application.HelpJump('shm_contents0031');
end;
end;
procedure TFormprocess.edit1GetImage(Sender: TObject; IsEmpty: Boolean;
var Graphic: TGraphic; var TextMargin: Integer);
var
PhoneExt: string;
begin
TextMargin := PicClip.Width + 2;
if not IsEmpty then
begin
PhoneExt := adoquery1.FieldByName('Sexname').AsString;
Graphic := PicClip.GraphicCell[8];
if PhoneExt ='女' then
Graphic := PicClip.GraphicCell[9];
end
else Graphic := PicClip.GraphicCell[10];
end;
procedure TFormprocess.speedbutton1Click(Sender: TObject);
begin
radiobutton3.onclick(radiobutton3);
if not assigned(formprocess2) then
formprocess2:=tformprocess2.create(self);
formprocess2.show;
end;
procedure TFormprocess.RadioButton3Click(Sender: TObject);
begin
if radiobutton2.Checked then
begin
speedbutton1.enabled:=false;
label6.Visible:=false;
label7.visible:=false;
end else if radiobutton3.checked then
begin
datamod.adoquery1.close;
datamod.adoquery1.sql.text:='select * from workno';
datamod.adoquery1.open;
if not datamod.adoquery1.eof then
begin
label7.caption:=inttostr(datamod.adoquery1.recordcount);
end
else
begin
label7.caption:='0';
end;
speedbutton1.enabled:=true;
label6.Visible:=true;
label7.visible:=true;
end;
end;
procedure TFormprocess.FormActivate(Sender: TObject);
begin
if fmat='/' then
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -