📄 cwa500_03.pas.svn-base
字号:
unit Cwa500_03;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Bas100_01, Db, StdCtrls, Buttons, wwdbdatetimepicker, Mask,
ExtCtrls, ADODB, Menus;
type
TCwa500_03Form = class(TBas100_01Form)
Bevel1: TBevel;
lblType: TLabel;
lblDept: TLabel;
lblEmpID: TLabel;
lblEmpTo: TLabel;
lblDate: TLabel;
lblDateTo: TLabel;
cbType: TComboBox;
dtFromDate: TwwDBDateTimePicker;
dtToDate: TwwDBDateTimePicker;
bbtnOk: TBitBtn;
bbtnExit: TBitBtn;
cbDepart: TComboBox;
edtFromEmpID: TEdit;
SpeedButton1: TSpeedButton;
edtToEmpID: TEdit;
SpeedButton2: TSpeedButton;
rbCheck: TRadioButton;
rbUnCheck: TRadioButton;
qryHrm100: TADOQuery;
qryHrm150: TADOQuery;
qryHrm150H150_001: TAutoIncField;
qryHrm150H150_002: TStringField;
qryHrm150H150_003: TStringField;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbtnOkClick(Sender: TObject);
procedure bbtnExitClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure edtFromEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtToEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
procedure SetInterface;
{ Private declarations }
public
{ Public declarations }
end;
var
Cwa500_03Form: TCwa500_03Form;
implementation
uses SYSDATA, HwSelData, CommFun;
{$R *.DFM}
procedure TCwa500_03Form.SetInterface;
begin
Caption:=GetDBString('CWA50003001'); //审核
rbCheck.Caption:=GetDBString('CWA50003002'); //审核
rbUnCheck.Caption:=GetDBString('CWA50003003'); //反审核
lblType.Caption:=GetDBString('CWA50003004'); //事务类型
lblDept.Caption:=GetDBString('CWA50003005'); //部门编号
lblEmpID.Caption:=GetDBString('CWA50003006'); //员工编号
lblEmpTo.Caption:=GetDBString('CWA50003007'); //至
lblDate.Caption:=GetDBString('CWA50003008'); //日期范围
lblDateTo.Caption:=GetDBString('CWA50003007'); //至
bbtnOk.Caption:=GetDBString('CWA50003009'); //确定(&O)
bbtnExit.Caption:=GetDBString('CWA50003010'); //退出(&X)
end;
procedure TCwa500_03Form.FormCreate(Sender: TObject);
var
ADate:TDateTime;
begin
inherited;
//事务类型
cbType.Clear;
cbType.Items.Add(GetDBString('COM00004013')); //所有事务
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('select C150_003 from CWA150 where C150_004=0 and C150_008='+GetBoolean(True));
SYSDM.qryQuery.Open;
while not SYSDM.qryQuery.Eof do
begin
cbType.Items.Add(SYSDM.qryQuery.Fields[0].AsString);
SYSDM.qryQuery.Next;
end;
cbType.ItemIndex:=0;
//部门资料
cbDepart.Clear;
cbDepart.Items.Add(GetDBString('COM00004007')); //所有部门
qryHrm100.Close;
qryHrm100.Open;
while not qryHrm100.Eof do
begin
cbDepart.Items.Add(qryHrm100.FieldByName('H100_002').AsString);
qryHrm100.Next;
end;
cbDepart.ItemIndex:=0;
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, ASystemDate, SizeOf(ASystemDate));
ADate:=StrToDate(FormatDateTime(ASystemDate,GetServerDate));
dtFromDate.Date:=ADate;
dtToDate.Date:=ADate;
//设置界面信息
SetInterface;
end;
procedure TCwa500_03Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
//
end;
procedure TCwa500_03Form.bbtnOkClick(Sender: TObject);
var
AFromEmpID,AToEmpID:string;
ADeptNo,ATypeNo:Integer;
ACheckFlag:Boolean;
AFromDate,AToDate:TDateTime;
begin
inherited;
//确定
if trim(cbType.Text)='' then
begin
ShowMsg('UMS10000073'); //事务类型不能为空
cbType.SetFocus;
Abort;
end;
ACheckFlag:=rbCheck.Checked;
ATypeNo:=cbType.ItemIndex;
if ATypeNo<>0 then ATypeNo:=GetValue('select C150_001 from CWA150 where C150_003='+''''+cbType.Text+'''');
ADeptNo:=cbDepart.ItemIndex;
if ADeptNo<>0 then ADeptNo:=GetValue('select H100_001 from HRM100 where H100_002='+''''+cbDepart.Text+'''');
AFromEmpID:=trim(edtFromEmpID.Text);
AToEmpID:=trim(edtToEmpID.Text);
if AFromEmpID='' then AFromEmpID:=GetValue('select min(H150_002) from HRM150');
if AToEmpID='' then AToEmpID:=GetValue('select max(H150_002) from HRM150');
AFromDate:=dtFromDate.Date;
AToDate:=dtToDate.Date;
if AFromEmpID>AToEmpID then
begin
ShowMsg('UMS10000076'); //起始员工编号不能大于结束编号
edtFromEmpID.SetFocus;
Abort;
end;
if AFromDate>AToDate then
begin
ShowMsg('UMS10000044'); //起始日期不能大于结束日期
dtFromDate.SetFocus;
Abort;
end;
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update CWA500 set C500_010='+GetBoolean(ACheckFlag));
SYSDM.qryQuery.SQL.Add('where C500_005>='+GetDateString(AFromDate)+' and C500_005<='+GetDateString(AToDate));
if ATypeNo<>0 then SYSDM.qryQuery.SQL.Add(' and C500_001='+IntToStr(ATypeNo));
SYSDM.qryQuery.SQL.Add(' and exists(select 1 from HRM150 where H150_001=C500_004 and H150_002>='+''''+AFromEmpID+''''+' and H150_002<='+''''+AToEmpID+'''');
if ADeptNo<>0 then SYSDM.qryQuery.SQL.Add(' and H150_005='+IntToStr(ADeptNo));
SYSDM.qryQuery.SQL.Add(')');
SYSDM.qryQuery.ExecSQL;
ShowMsg('UMS10000083'); //审核或反审核处理成功
Close;
end;
procedure TCwa500_03Form.bbtnExitClick(Sender: TObject);
begin
inherited;
//退出
Close;
end;
procedure TCwa500_03Form.SpeedButton1Click(Sender: TObject);
begin
inherited;
//员工编号查询1
if not edtFromEmpID.Focused then edtFromEmpID.SetFocus;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryHrm150,nil);
if HwSelDataForm.ShowModal=1 then
begin
edtFromEmpID.Text:=qryHrm150.FieldByName('H150_002').AsString;
end;
end;
procedure TCwa500_03Form.SpeedButton2Click(Sender: TObject);
begin
inherited;
//员工编号查询2
if not edtToEmpID.Focused then edtToEmpID.SetFocus;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryHrm150,nil);
if HwSelDataForm.ShowModal=1 then
begin
edtToEmpID.Text:=qryHrm150.FieldByName('H150_002').AsString;
end;
end;
procedure TCwa500_03Form.edtFromEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then SpeedButton1.Click;
end;
procedure TCwa500_03Form.edtToEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then SpeedButton2.Click;
end;
initialization
RegisterClass(TCwa500_03Form);
finalization
UnRegisterClass(TCwa500_03Form);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -