📄 pay550_03.pas.svn-base
字号:
unit Pay550_03;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Bas100_01, Buttons, StdCtrls, Db, ExtCtrls, ADODB, Menus;
type
TPay550_03Form = class(TBas100_01Form)
Bevel1: TBevel;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
cbDepart: TComboBox;
bbtnOk: TBitBtn;
bbtnExit: TBitBtn;
cbYear: TComboBox;
cbMonth: TComboBox;
edtFromEmpID: TEdit;
SpeedButton1: TSpeedButton;
edtToEmpID: TEdit;
SpeedButton2: TSpeedButton;
rbCheck: TRadioButton;
rbUnCheck: TRadioButton;
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);
procedure cbYearChange(Sender: TObject);
procedure cbMonthChange(Sender: TObject);
private
AStartDate,AEndDate:TDateTime;
APeriod:Integer;
procedure SetInterface;
{ Private declarations }
public
{ Public declarations }
end;
var
Pay550_03Form: TPay550_03Form;
implementation
uses SYSDATA, HwSelData, CommFun;
{$R *.DFM}
procedure TPay550_03Form.SetInterface;
begin
Caption:=GetDBString('PAY55003001'); //审核
rbCheck.Caption:=GetDBString('PAY55003002'); //审核
rbUnCheck.Caption:=GetDBString('PAY55003003'); //反审核
Label1.Caption:=GetDBString('PAY55003004'); //部门编号
Label3.Caption:=GetDBString('PAY55003005'); //员工编号
Label4.Caption:=GetDBString('PAY55003006'); //至
Label5.Caption:=GetDBString('PAY55003007'); //日期范围
Label6.Caption:=GetDBString('PAY55003006'); //至
bbtnOk.Caption:=GetDBString('PAY55003008'); //确定(&O)
bbtnExit.Caption:=GetDBString('PAY55003009'); //退出(&X)
end;
//薪资审核
procedure CheckPay(AFlag:Boolean;ADeptNo:Integer;AFromEmpID,AToEmpID:string;AYear,AMonth:Integer);
begin
if AFromEmpID='' then AFromEmpID:=GetValue('select min(H150_002) from HRM150');
if AToEmpID='' then AToEmpID:=GetValue('select max(H150_002) from HRM150');
if ADeptNo=0 then
begin
//薪资明细表
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update PAY550 set P550_006='+GetBoolean(AFlag));
SYSDM.qryQuery.SQL.Add('where P550_001='+IntToStr(AYear)+' and P550_002='+IntToStr(AMonth)+' and ');
SYSDM.qryQuery.SQL.Add('exists(select 1 from HRM150 where H150_001=P550_003 and H150_002>='+''''+AFromEmpID+''''+' and H150_002<='+''''+AToEmpID+''''+')');
try
SYSDM.qryQuery.ExecSQL;
except
ShowMsg(SYSDM.ADOC.Errors[0].Description+#13+SYSDM.qryQuery.SQL.Text,1);
Abort;
end;
end else
begin
//薪资明细表
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update PAY550 set P550_006='+GetBoolean(AFlag));
SYSDM.qryQuery.SQL.Add('where P550_001='+IntToStr(AYear)+' and P550_002='+IntToStr(AMonth));
SYSDM.qryQuery.SQL.Add('exists(select 1 from HRM150 where H150_001=P550_003 and H150_002>='+''''+AFromEmpID+''''+' and H150_002<='+''''+AToEmpID+''''+' and H150_005='+IntToStr(ADeptNo)+')');
try
SYSDM.qryQuery.ExecSQL;
except
ShowMsg(SYSDM.ADOC.Errors[0].Description+#13+SYSDM.qryQuery.SQL.Text,1);
Abort;
end;
end;
end;
procedure TPay550_03Form.FormCreate(Sender: TObject);
begin
inherited;
qryHrm150.Close;
qryHrm150.SQL.Clear;
if not ASuper then
qryHrm150.SQL.Add('select H150_001,H150_002,H150_003 from HRM150 where H150_020='+GetBoolean(True)+' and H150_005 in (select S500C_002 from SYS500C where S500C_003=''DEP'' and S500C_004='+GetBoolean(True)+' and S500C_001='+IntToStr(AUserID)+') order by H150_002')
else
qryHrm150.SQL.Add('select H150_001,H150_002,H150_003 from HRM150 where H150_020='+GetBoolean(True)+' order by H150_002');
qryHrm150.Open;
//部门资料
cbDepart.Items.Clear;
cbDepart.Items.Add(GetDBString('COM00004007')); //所有部门
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('select * from HRM100 where H100_004='+GetBoolean(True));
SYSDM.qryQuery.Open;
while not SYSDM.qryQuery.Eof do
begin
cbDepart.Items.Add(SYSDM.qryQuery.FieldByName('H100_002').AsString);
SYSDM.qryQuery.Next;
end;
cbDepart.ItemIndex:=0;
GetYears(cbYear);
GetMonths(StrToInt(cbYear.Text),cbMonth);
//设置界面信息
SetInterface;
end;
procedure TPay550_03Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
//
end;
procedure TPay550_03Form.bbtnOkClick(Sender: TObject);
var
ADeptName,AFromEmpID,AToEmpID:string;
ADeptNo,AYear,AMonth:Integer;
begin
inherited;
//确定
if edtFromEmpID.Text>edtToEmpID.Text then
begin
ShowMsg('UMS10000076'); //起始员工编号不能大于结束编号
Abort;
end;
if (cbYear.Text='') or (cbMonth.Text='') then
begin
ShowMsg('UMS10000245'); //请先设置薪资期段
Abort;
end;
ADeptName:=cbDepart.Text;
AFromEmpID:=edtFromEmpID.Text;
AToEmpID:=edtToEmpID.Text;
AYear:=StrToInt(cbYear.Text);
AMonth:=APeriod;
if cbDepart.ItemIndex=0 then
ADeptNo:=0
else
ADeptNo:=GetValue('select H100_001 from HRM100 where H100_002='+''''+ADeptName+'''');
CheckPay(rbCheck.Checked,ADeptNo,AFromEmpID,AToEmpID,AYear,AMonth);
ShowMsg('UMS10000083'); //审核或反审核处理成功
Close;
end;
procedure TPay550_03Form.bbtnExitClick(Sender: TObject);
begin
inherited;
//退出
Close;
end;
procedure TPay550_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 TPay550_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 TPay550_03Form.edtFromEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then SpeedButton1.Click;
end;
procedure TPay550_03Form.edtToEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then SpeedButton2.Click;
end;
procedure TPay550_03Form.cbYearChange(Sender: TObject);
begin
inherited;
GetMonths(StrToInt(cbYear.Text),cbMonth);
end;
procedure TPay550_03Form.cbMonthChange(Sender: TObject);
begin
inherited;
//取得期段的起始结束日期
GetPeriodDate(cbYear.Text,cbMonth.Text,AStartDate,AEndDate,APeriod);
end;
initialization
RegisterClass(TPay550_03Form);
finalization
UnRegisterClass(TPay550_03Form);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -