⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tread_atdprocess.pas

📁 pasa人力资源考勤管理系统
💻 PAS
字号:
unit tread_atdprocess;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,ADODB,DB, ComCtrls, DBTables;

type
  atdprocess = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
    procedure paint;
  end;

implementation
uses process,datamol,main;
{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure atdprocess.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ atdprocess }

procedure atdprocess.Execute;
var
   startrq,endrq:TDate;

begin
  with formprocess do
  begin
     cbrq1.visible:=false; cbrq2.visible:=false; cbday1.visible:=false; cbday2.visible:=false; label3.visible:=false;
     append(f);
     if radiobutton2.checked then
      c2:=true
     else
      c2:=false;
      try
        Animate1.active:=TRUE;
        startrq:=strtodate(cbrq1.text+fmat+cbday1.text);
        endrq:=strtodate(cbrq2.text+fmat+cbday2.text);
        pbar1.max:=trunc(endrq-startrq)+1;
        pbar1.position:=0;
        pbar1.step:=1;
        try
        writeln(f,'-------------------------------------------------------');
        writeln(f,pchar(formatdatetime('yyyy/mm/dd hh:mm:ss',now)+'开始初始化考勤处理'));
        while startrq<=endrq do
        begin
             label1.caption:='开始日期'+formatdatetime('yyyy/mm/dd',startrq)+'的考勤处理';
             label1.update;
             label2.caption:='开始初始化考勤处理,读打卡资料和考勤分析';
             label2.update;
           try
               adocommand1.prepared:=false;
               if fmat='/' then
                 adocommand1.Parameters.ParamByName('@rq').Value:=startrq
               else
                 adocommand1.Parameters.ParamByName('@rq').Value:=startrq;
               adocommand1.Parameters.ParamByName('@qinakadata').value:=Formprocess.CheckBox1.Checked;
               Adocommand1.parameters.ParamByName('@allman').value:=c2;
               Adocommand1.Execute;
           except
               writeln(f,pchar('处理'+formatdatetime('yyyy/mm/dd',startrq)+'的考勤时出错'));
           end;
            pbar1.stepit;
           startrq:=startrq+1;
           Synchronize(paint);
        end;
        writeln(f,pchar(formatdatetime('yyyy/mm/dd hh:mm:ss',now)+'结束考勤处理'));
        writeln(f,'-------------------------------------------------------');
        except
          Application.messagebox('考勤处理和薪资计算时出错.','Error',mb_ok+mb_iconerror);
          exit;
        end;
        datamod.adoclock.close;
        datamod.adosalset.close;
        datamod.adoatdset.close;
     finally
        closefile(f);
     end;
   label1.caption:='考勤处理完毕';
   label1.update;
   terminate;
   Button1.Enabled := True;
   Button2.Enabled := False;
   Animate1.active:=false;
   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;
  application.messagebox('恭喜你,考勤处理成功!','成功',mb_ok+mb_iconinformation);
end;

procedure atdprocess.paint;
begin
//   formmain.update;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -