【delphi开源代码栏目提醒】:网学会员,鉴于大家对delphi开源代码十分关注,论文会员在此为大家搜集整理了“frmDataStatistic.pas”一文,供大家参考学习!
unit frmDataStatistic;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, DBCtrls, Mask,DB, Grids,
DBGrids, StrUtils;
type
TCheckWorkTimeForm = class(TForm)
cmdClose: TButton;
grbPersonInfo: TGroupBox;
panWelcome: TPanel;
cmdOK: TButton;
Label1: TLabel;
txtPassword: TEdit;
Label2: TLabel;
cboRecordType: TComboBox;
txtPersonID: TEdit;
Label3: TLabel;
procedure txtPersonIDKeyPress(Sender: TObject; var Key: Char);
procedure cmdOKClick(Sender: TObject);
procedure cmdCloseClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CheckWorkTimeForm: TCheckWorkTimeForm;
implementation
uses mdDataBases, Common;
{$R *.dfm}
procedure TCheckWorkTimeForm.txtPersonIDKeyPress(Sender: TObject;
var Key: Char);
begin
if Key=chr(13) then
begin
with dmDataSource.tblPerson do
begin
DisableControls;
Locate('ID',txtPersonID.Text,[loCaseInsensitive]);
EnableControls;
end;
txtPassword.SetFocus;
end;
end;
procedure TCheckWorkTimeForm.cmdOKClick(Sender: TObject);
var
strPassword:string;
begin
strPass
word:=Base64Decode(dmDataSource.tblPerson['PERSON_PASSWORD']);
if UpperCase(Trim(txtPassword.Text))=UpperCase(strPassword) then
begin
if RightStr(cboRecordType.Text,2)='上班' then
begin
dmDataSource.qrySQLCommand.Active:=False;
with dmDataSource.qrySQLCommand.SQL do
begin
Clear;
Add('SELECT PERSON_ID ');
Add('FROM HOLIDAY_TABLE Holiday_table ');
Add('WHERE (ENDTIME >= :dtmStartTime ');
Add('AND PERSON_ID = :strID)');
end;
dmDataSource.qrySQLCommand.ParamByName('dtmStartTime').Value:=Now;
dmDataSource.qrySQLCommand.ParamByName('strID').Value:='0001';
dmDataSource.qrySQLCommand.Active:=True;
if dmDataSource.qrySQLCommand.RecordCount>0 then Exit;
end;
if RightStr(cboRecordType.Text,2)='下班' then
begin
dmDataSource.qrySQLCommand.Active:=False;
with dmDataSource.qrySQLCommand.SQL do
begin
Clear;
Add('SELECT PERSON_ID ');
Add('FROM HOLIDAY_TABLE Holiday_table ');
Add('WHERE (STARTTIME <= :dtmStartTime ');
Add('AND PERSON_ID = :strID)');
end;
dmDataSource.qrySQLCommand.ParamByName('dtmStartTime').Value:=Now;
dmDataSource.qrySQLCommand.ParamByName('strID').Value:='0001';
dmDataSource.qrySQLCommand.Active:=True;
if dmDataSource.qrySQLCommand.RecordCount>0 then Exit;
end;
dmDataSource.RecordWorkTime(cboRecordType.Text);
end
else
Messagebox(Application.Handle,'您输入的密码不对,请重新输入','密码错误',16);
end;
procedure TCheckWorkTimeForm.cmdCloseClick(Sender: TObject);
begin
CheckWorkTimeForm.Close;
end;
end.