frm_c_bkpas.pas
来自「是一个用delphi设计的考勤系统」· PAS 代码 · 共 313 行
PAS
313 行
unit frm_c_bkpas;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ModalForm, Menus, StdCtrls, ExtCtrls, ComCtrls, ChangeImage,
YLabelButton, UErrDisplay;
type
Tfrm_c_bk = class(TMyModalForm)
GroupBox1: TGroupBox;
LBtnEdit: TLabelB;
BtnEdit: TChangeImg;
BtnHelp: TChangeImg;
LBtnHelp: TLabelB;
BtnRefresh: TChangeImg;
LBtnRefresh: TLabelB;
BtnFind: TChangeImg;
LBtnFind: TLabelB;
Label1: TLabel;
Label2: TLabel;
Label7: TLabel;
lblyhbh: TLabel;
lblyhxm: TLabel;
lblsfzh: TLabel;
Label3: TLabel;
Label4: TLabel;
Label8: TLabel;
lblCardye: TLabel;
lblczcs: TLabel;
lblsydate: TLabel;
Label5: TLabel;
Label9: TLabel;
BtnBrowse: TChangeImg;
lblsytype: TLabel;
lblbmmc: TLabel;
stb: TStatusBar;
Label6: TLabel;
lblGsdate: TLabel;
Label11: TLabel;
lblhsdate: TLabel;
GroupBox2: TGroupBox;
chb1: TCheckBox;
edtkyj: TEdit;
chb2: TCheckBox;
edtsxf: TEdit;
Label13: TLabel;
edtyhbh: TEdit;
chb3: TCheckBox;
Label10: TLabel;
lblcardsn: TLabel;
Label12: TLabel;
lblyhzh: TLabel;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
procedure edtyhbhKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure BtnEditClick(Sender: TObject);
procedure edtkyjKeyPress(Sender: TObject; var Key: Char);
procedure edtkyjExit(Sender: TObject);
procedure edtsxfExit(Sender: TObject);
procedure BtnBrowseClick(Sender: TObject);
procedure BtnRefreshClick(Sender: TObject);
procedure BtnHelpClick(Sender: TObject);
procedure BtnFindClick(Sender: TObject);
private
procedure IniForm;
procedure Show;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_c_bk: Tfrm_c_bk;
implementation
uses UGlobal, UTYhxx, frm_c_ksypas, UGeneralFunc, frm_c_getyhzhpas;
var
yhxx: Tyhxx;
{$R *.dfm}
procedure Tfrm_c_bk.edtyhbhKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if key = #13 then
begin
if yhxx.GetYhxx(edtyhbh.Text) then
begin
show;
stb.Panels[1].Text := '点击[补卡]进行补卡';
end
else
begin
IniForm;
stb.Panels[1].Text := '[' + inttostr(yhxx.RetVal) + ']' + yhxx.RetMsg;
end;
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
end;
end;
procedure Tfrm_c_bk.FormCreate(Sender: TObject);
begin
inherited;
yhxx := Tyhxx.create();
IniForm;
end;
procedure Tfrm_c_bk.IniForm;
begin
lblyhbh.Caption := '';
lblyhxm.Caption := '';
lblsfzh.Caption := '';
lblcardye.Caption := '';
lblczcs.Caption := '';
lblsydate.Caption := '';
lblsytype.Caption := '';
lblgsdate.Caption := '';
lblhsdate.Caption := '';
lblbmmc.Caption := '';
lblyhzh.Caption := '';
lblcardsn.Caption := '';
edtkyj.Text := '';
edtsxf.Text := '';
edtyhbh.Text := '';
stb.Panels[1].Text := '输入用户编号后按[ENTER]键 或 点击[查找]提取用户补卡信息';
end;
procedure Tfrm_c_bk.BtnEditClick(Sender: TObject);
var
sStr: string;
dSxf: double;
begin
inherited;
if trim(lblyhbh.Caption) = '' then
begin
stb.Panels[1].Text := '输入用户编号后按[ENTER]键 或 点击[查找]提取用户补卡信息';
exit;
end;
stb.Panels[1].Text := '';
if yhxx.sybz = 0 then stb.Panels[1].Text := '该用户还未发过卡!';
if yhxx.sybz = 1 then stb.Panels[1].Text := '该用户卡正在使用中,要先挂失后才能补卡!';
if yhxx.sybz = 6 then stb.Panels[1].Text := '该用户已被注销!,不能补卡!';
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
// if not gtSyscs.bRz then stb.Panels[1].Text := '系统未认证,不能补卡!';
if stb.Panels[1].Text <> '' then exit;
if chb1.Checked and (trim(edtkyj.text) <> '') then
yhxx.Cardyj := strtofloat(edtkyj.text)
else if chb1.Checked then
begin
stb.Panels[1].Text := '请输入卡押金金额!';
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
exit;
end
else
yhxx.Cardyj := 0;
if chb2.Checked and (trim(edtsxf.Text) <> '') then
dSxf := strtofloat(edtsxf.Text)
else if chb2.Checked then
begin
stb.Panels[1].Text := '请输入手续费金额!';
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
exit;
end
else
dSxf := 0;
if chb3.Checked then
begin
frm_c_getyhzh := Tfrm_c_getyhzh.Create(application);
frm_c_getyhzh.Yhxx := Yhxx;
frm_c_getyhzh.ShowModal;
frm_c_getyhzh.Free;
end;
if chb3.Checked and (yhxx.Track1 = '') then
begin
stb.Panels[1].Text := '补卡操作被取消';
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
exit;
end;
sStr := ' 用户编号:' + yhxx.Yhbh + #10#13 +
' 用户姓名:' + yhxx.Yhxm + #10#13 +
' 所属单位:' + yhxx.Bjmc + #10#13 +
' 银行帐号:' + yhxx.Track1 + #13#13 +
'将白卡放在发器上后按[确认]键继续';
if application.MessageBox(pchar(sStr), '用户补卡', mb_OkCancel + mb_iconquestion) = id_Cancel then
exit;
if yhxx.YhBk(dSxf) then
begin
sStr := '[' + inttostr(yhxx.RetVal) + ']' + yhxx.RetMsg;
if yhxx.GetYhxx(yhxx.Yhbh) then show;
stb.Panels[1].Text := sStr;
end
else
stb.Panels[1].Text := '[' + inttostr(yhxx.RetVal) + ']' + yhxx.RetMsg;
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
end;
procedure Tfrm_c_bk.Show;
begin
lblyhbh.Caption := yhxx.Yhbh;
lblyhxm.Caption := yhxx.Yhxm;
lblsfzh.Caption := yhxx.Sfzh;
lblcardye.Caption := trim(format('%12.2f', [yhxx.cardye]));
lblczcs.Caption := inttostr(yhxx.Gxcs);
lblyhzh.Caption := yhxx.Track1;
if yhxx.sybz = 0 then
lblcardsn.Caption := '未发卡'
else
lblcardsn.Caption := inttostr(yhxx.Cardsn);
if yhxx.SyDate = 0 then
lblsydate.Caption := ''
else
lblsydate.Caption := datetostr(yhxx.SyDate);
lblsytype.Caption := inttostr(yhxx.CardType);
if yhxx.GsDate = 0 then
lblgsdate.Caption := '未挂失'
else
lblgsdate.Caption := datetostr(yhxx.gsDate);
if yhxx.HsDate = 0 then
lblhsdate.Caption := '未回收'
else
lblhsdate.Caption := Datetostr(yhxx.hsDate);
lblbmmc.Caption := yhxx.Bjmc;
end;
procedure Tfrm_c_bk.edtkyjKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if key = char(vk_back) then exit;
if ((length(Tedit(sender).text) - pos('.', Tedit(sender).text)) = 2) and (pos('.', Tedit(sender).text) <> 0) then
begin
key := #0;
exit;
end;
//
if (length(Tedit(sender).Text) = 0) or (pos('.', Tedit(sender).text) <> 0) then
begin
if not (key in ['0'..'9']) then key := #0
end
else
begin
if not (key in ['0'..'9', '.']) then key := #0;
end;
end;
procedure Tfrm_c_bk.edtkyjExit(Sender: TObject);
begin
inherited;
if edtkyj.Text <> '' then
chb1.Checked := True
else
chb1.Checked := False;
end;
procedure Tfrm_c_bk.edtsxfExit(Sender: TObject);
begin
inherited;
if edtsxf.Text <> '' then
chb2.Checked := True
else
chb2.Checked := False;
end;
procedure Tfrm_c_bk.BtnBrowseClick(Sender: TObject);
begin
inherited;
if trim(lblsytype.Caption) = '' then
begin
stb.Panels[1].Text := '无卡使用类别显示';
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
exit;
end;
if not assigned(frm_c_ksy) then
frm_c_ksy := Tfrm_c_ksy.Create(application);
frm_c_ksy.CardType := strtoint(lblsytype.Caption);
frm_c_ksy.Show;
end;
procedure Tfrm_c_bk.BtnRefreshClick(Sender: TObject);
begin
inherited;
IniForm;
end;
procedure Tfrm_c_bk.BtnHelpClick(Sender: TObject);
begin
inherited;
HtmlHelp(Handle, gtSyscs.sHelpFileName, $0001, DWORD(PChar('Introduction.htm')));
end;
procedure Tfrm_c_bk.BtnFindClick(Sender: TObject);
begin
inherited;
if yhxx.GetYhxx(edtyhbh.Text) then
begin
show;
stb.Panels[1].Text := '点击[补卡]进行补卡';
end
else
begin
IniForm;
stb.Panels[1].Text := '[' + inttostr(yhxx.RetVal) + ']' + yhxx.RetMsg;
end;
ErrDisplay.ErrPrompt(stb.Panels[1].Text, '');
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?