publicfunction.pas
来自「pasa人力资源考勤管理系统」· PAS 代码 · 共 1,538 行 · 第 1/4 页
PAS
1,538 行
end;
end;
formjiben1.show;
end;
2:begin
if not assigned(formjiben2) then
begin
formjiben2:=Tformjiben.Create(application);
with formjiben2 do
begin
adotable1.TableName :='per11010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='职等职级编码';
ADOTable1.Fields[1].DisplayLabel :='底薪(最多)';
ADOTable1.Fields[2].DisplayLabel :='底薪(最少)';
ADOTable1.Fields[3].DisplayLabel :='职务津贴(最多)';
ADOTable1.Fields[4].DisplayLabel :='职务津贴(最少)';
ADOTable1.Fields[5].DisplayLabel :='技术津贴(最多)';
ADOTable1.Fields[6].DisplayLabel :='技术津贴(最少)';
Caption:='职等职级设定';
combobox1.Text:='02--级别代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben2.show;
end;
3:begin
if not assigned(formjiben3) then
begin
formjiben3:=Tformjiben.Create (application);
with formjiben3 do
begin
caption:='籍贯';
adotable1.tablename:='per03010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='籍贯代码';
ADOTable1.Fields[1].DisplayLabel :='籍贯名称';
combobox1.Text:='03--籍贯代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben3.show;
end;
4:begin
if not assigned(formjiben4) then
begin
formjiben4:=Tformjiben.Create(application);
with formjiben4 do
begin
caption:='学历';
adotable1.TableName:='per04010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='学历代码';
ADOTable1.Fields[1].DisplayLabel :='学历名称';
combobox1.Text:='04--学历代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben4.show;
end;
5:begin
if not assigned(formjiben5) then
begin
formjiben5:=Tformjiben.create(application);
with formjiben5 do
begin
caption:='科系';
adotable1.TableName:='per05010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='科系代码';
ADOTable1.Fields[1].DisplayLabel :='科系名称';
combobox1.Text:='05--科系代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben5.show;
end;
6:begin
if not assigned(formjiben6) then
begin
formjiben6:=formjiben.Create (application);
with formjiben6 do
begin
caption:='专长';
adotable1.TableName:='per06010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='专长代码';
ADOTable1.Fields[1].DisplayLabel :='专长名称';
combobox1.Text:='06--专长代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben6.show;
end;
7:begin
if not assigned(formjiben7) then
begin
formjiben7:=Tformjiben.create(application);
with formjiben7 do
begin
caption:='证件';
adotable1.TableName:='per07010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='证件代码';
ADOTable1.Fields[1].DisplayLabel :='证件名称';
combobox1.Text:='07--证件代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben7.show;
end;
8:begin
if not assigned(formjiben8) then
begin
formjiben8:=Tformjiben.create(application);
with formjiben8 do
begin
caption:='民族';
adotable1.TableName:='per08010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='民族代码';
ADOTable1.Fields[1].DisplayLabel :='民族名称';
combobox1.Text:='08--民族代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben8.show;
end;
9:begin
if not assigned(formjiben9) then
begin
formjiben9:=Tformjiben.create(application);
with formjiben9 do
begin
caption:='外语';
adotable1.TableName:='per09010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='外语代码';
ADOTable1.Fields[1].DisplayLabel :='外语名称';
combobox1.Text:='09--外语代码';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben9.show;
end;
10:begin
if not assigned(formjiben10) then
begin
formjiben10:=Tformjiben.create(application);
with formjiben10 do
begin
caption:='';
adotable1.tablename:='emp02010';
adotable1.open;
ADOTable1.Fields[0].DisplayLabel :='招聘来源代码';
ADOTable1.Fields[1].DisplayLabel :='招聘来源';
combobox1.Text:='10--招聘来源定义';
combobox1.Style :=csdropdownlist;
end;
end;
formjiben10.show;
end;
end;
end;
function showcombox(n:integer;s:string):string; //下拉combobox中的部门编号时,在另一框中显示部门名称
begin
with datamod.Query1 do
begin
close;
sql.text:='select dept from pub05010 where dno='''+s+'''';
open;
if not eof then
showcombox :=fields[0].asstring;
close;
end;
end;
function numstring(s:string):boolean;
var x:real;
begin
try
x:=strtofloat(s);
Result:=true;
except
Result:=false;
end;
end;
procedure getdata(workno:string;rq:string);
var
Qry:TADOQuery;
begin
with datamod do
begin
Qry:=TADOquery.create(application);
Qry.connection:=Query1.connection;
Qry.close;
Qry.sql.clear;
Qry.sql.add('Delete from tempatddata');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime1,a.fgotime1,a.outtime1,a.fouttime1,a.add1,a.decrease1,a.daytime1,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,0,a.unatdxia from atd25010 a where workno='''+workno+''' and gotime1 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime2,a.fgotime2,a.outtime2,a.fouttime2,a.add2,a.decrease2,a.daytime2,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,0,a.unatdxia from atd25010 a where workno='''+workno+''' and gotime2 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime3,a.fgotime3,a.outtime3,a.fouttime3,a.add3,a.decrease3,a.daytime3,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,0,a.unatdxia from atd25010 a where workno='''+workno+''' and gotime3 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime4,a.fgotime4,a.outtime4,a.fouttime4,a.add4,a.decrease4,a.daytime4,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,0,a.unatdxia from atd25010 a where workno='''+workno+''' and gotime4 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime5,a.fgotime5,a.outtime5,a.fouttime5,a.add5,a.decrease5,a.daytime5,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,0,a.unatdxia from atd25010 a where workno='''+workno+''' and gotime5 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime1,a.fgotime1,a.outtime1,a.fouttime1,a.add1,a.decrease1,a.daytime1,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,1,a.unatdxia from atd25011 a where workno='''+workno+''' and gotime1 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime2,a.fgotime2,a.outtime2,a.fouttime2,a.add2,a.decrease2,a.daytime2,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,1,a.unatdxia from atd25011 a where workno='''+workno+''' and gotime2 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime3,a.fgotime3,a.outtime3,a.fouttime3,a.add3,a.decrease3,a.daytime3,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,1,a.unatdxia from atd25011 a where workno='''+workno+''' and gotime3 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime4,a.fgotime4,a.outtime4,a.fouttime4,a.add4,a.decrease4,a.daytime4,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,1,a.unatdxia from atd25011 a where workno='''+workno+''' and gotime4 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('Insert into tempatddata Select a.workno,a.cardno,a.rq,a.scheno,a.schename,a.comcode,a.gotime5,a.fgotime5,a.outtime5,a.fouttime5,a.add5,a.decrease5,a.daytime5,a.dayhours,a.unatd,a.ot,a.notgive,a.otkind,a.mankind,1,a.unatdxia from atd25011 a where workno='''+workno+''' and gotime5 is not null and rq=convert(datetime,'''+rq+''') ');
Qry.sql.add('update tempatddata Set scheno=''加班单'',schename=''加班班次'' from atd11011 a where a.workno=tempatddata.workno and a.otdate=tempatddata.rq and (a.gotime1=tempatddata.mustgo and a.outtime1=tempatddata.mustout or a.gotime2=tempatddata.mustgo and a.outtime2='+
'tempatddata.mustout or a.gotime3=tempatddata.mustgo and a.outtime3='+
'tempatddata.mustout or a.gotime4=tempatddata.mustgo and a.outtime4=tempatddata.mustout or a.gotime5=tempatddata.mustgo and a.outtime5=tempatddata.mustout )');
Qry.execsql;
qry.free;
end;
end;
procedure getdata2; //获取考勤异动档中的资料并合并
var
Qry:TADOQuery;
begin
with datamod do
begin
Qry:=TADOquery.create(application);
Qry.connection:=Query1.connection;
Qry.close;
Qry.sql.clear;
Qry.sql.add('Delete from tempatd1');
Qry.sql.add('Insert into tempatd1 Select a.workno,a.cardno,a.rq,a.scheno,a.newsche,a.dothing,a.itemtime,a.mustgo,a.newmustgo,a.factgo,a.newfactgo,a.mustout,a.newmustout,'+
'a.factout,a.newfactout,a.musthours,a.addtime,a.continuetime,a.decrease,a.ot,a.otkind,''正常'' from atd25011 a ');
// Qry.sql.add('Insert into tempatd1 Select a.workno,a.cardno,a.rq,a.scheno,a.newsche,a.dothing,a.itemtime,a.mustgo,a.newmustgo,a.factgo,a.newfactgo,a.mustout,a.newmustout,'+
// 'a.factout,a.newfactout,a.musthours,a.addtime,a.continuetime,a.decrease,a.ot,a.otkind,'''' from atd27011 a ');
Qry.sql.add('Insert into tempatd1 Select a.workno,a.cardno,a.rq,a.scheno,a.newsche,a.dothing,a.itemtime,a.mustgo,a.newmustgo,a.factgo,a.newfactgo,a.mustout,a.newmustout,'+
'a.factout,a.newfactout,a.musthours,a.addtime,a.continuetime,a.decrease,a.ot,a.otkind,''换班'' from atd28011 a ');
Qry.sql.add('Insert into tempatd1 Select a.workno,a.cardno,a.rq,a.scheno,a.newsche,a.dothing,a.itemtime,a.mustgo,a.newmustgo,a.factgo,a.newfactgo,a.mustout,a.newmustout,'+
'a.factout,a.newfactout,a.musthours,a.addtime,a.continuetime,a.decrease,a.ot,a.otkind,''轮班'' from atd29011 a ');
Qry.sql.add('Insert into tempatd1 Select a.workno,a.cardno,a.rq,a.scheno,a.newsche,a.dothing,a.itemtime,a.mustgo,a.newmustgo,a.factgo,a.newfactgo,a.mustout,a.newmustout,'+
'a.factout,a.newfactout,a.musthours,a.addtime,a.continuetime,a.decrease,a.ot,a.otkind,''计件'' from atd30011 a ');
Qry.sql.add('Insert into tempatd1 Select a.workno,a.cardno,a.rq,a.scheno,a.newsche,a.dothing,a.itemtime,a.mustgo,a.newmustgo,a.factgo,a.newfactgo,a.mustout,a.newmustout,'+
'a.factout,a.newfactout,a.musthours,a.addtime,a.continuetime,a.decrease,a.ot,a.otkind,''工读'' from atd31011 a ');
Qry.execsql;
qry.free;
end;
end;
function TimeDec(Ts,Te:string):string; //时间差,Ts是开始时间,Te是结束时间(格式:hh:mm,24小时制)
var h1,h2,m1,m2:integer;
begin //返回的是多少小时多少分种
if (length(ts)<>5) or (length(te)<>5) then
begin
application.messagebox('对不起,请检查时间格式','Warning',mb_ok+mb_iconwarning);
exit;
end;
if (copy(ts,1,1)<'0') or (copy(ts,1,1)>'9') or (copy(ts,2,1)<'0') or (copy(ts,2,1)>'9') or (copy(ts,4,1)<'0') or (copy(ts,4,1)>'9') or (copy(ts,5,1)<'0') or (copy(ts,5,1)>'9') then
begin
application.messagebox('对不起,上下班时间中含有非法字符!!','Warning',mb_ok+mb_iconwarning);
exit;
end;
if (copy(te,1,1)<'0') or (copy(te,1,1)>'9') or (copy(te,2,1)<'0') or (copy(te,2,1)>'9') or (copy(te,4,1)<'0') or (copy(te,4,1)>'9') or (copy(te,5,1)<'0') or (copy(te,5,1)>'9') then
begin
application.messagebox('对不起,上下班时间中含有非法字符!!','Warning',mb_ok+mb_iconwarning);
exit;
end;
h2:=strtoint(copy(te,1,2));
m2:=strtoint(copy(te,4,2));
h1:=strtoint(copy(ts,1,2));
m1:=strtoint(copy(ts,4,2));
if h2<h1 then
h2:=h2+24-h1
else
h2:=h2-h1;
if m2<m1 then
begin
m2:=m2+60-m1;
h2:=h2-1;
end
else
m2:=m2-m1;
TimeDec:=inttostr(h2)+'小时'+inttostr(m2)+'分';
end;
function TimeDec1(Ts,Te:string):string; //时间差,Ts是开始时间,Te是结束时间(格式:hh:mm,24小时制)
var h1,m1,m2:string;
hours:double;
begin //返回的是多少小时多少分种
if (length(ts)<>16) or (length(te)<>16) then
begin
application.messagebox('对不起,请检查时间格式','Warning',mb_ok+mb_iconwarning);
exit;
end
else
begin
if te<ts then
begin
application.messagebox('对不起,输入的时间有误!','Warning',mb_ok+mb_iconwarning);
exit;
end;
hours:=(strtodatetime(te)-strtodatetime(ts))*24;
//hours:=hours*24.0;
h1:=copy(floattostr(hours),1,pos('.',floattostr(hours))-1);
//m1:=copy(floattostr(hours),pos('.',floattostr(hours))+1,length(floattostr(hours))-pos('.',floattostr(hours)));
m2:=floattostr((hours-strtoint(h1))*60);
m2:=inttostr(round(strtofloat(m2)));
TimeDec1:=h1+'小时'+m2+'分';
end;
end;
function DecDate(Ds,De:string):integer; //年相减,Ds是开始日期,De是结束日期(格式:yyyy/mm/dd);
var y,m,d:integer;
mD,dD:integer;
UseDays:integer;
begin
usedays:=0;
if (isdate(ds)) and (isdate(de)) then
begin
y:=strtoint(copy(ds,1,4));
m:=strtoint(copy(ds,6,2));
d:=strtoint(copy(ds,9,2));
if strtoint(copy(de,9,2))<d then
begin
dD:=strtoint(copy(de,9,2))+30-d;
if (strtoint(copy(de,6,2))-1)<m then
begin
mD:=strtoint(copy(de,6,2))+12-1-m;
if (strtoint(copy(de,1,4))-1)<y then
UseDays:=31
else
UseDays:=(strtoint(copy(de,1,4))-1-y)*360+mD*30+dD;
end
else if (strtoint(copy(de,6,2))-1)=m then
UseDays:=(strtoint(copy(de,1,4))-1-y)*360+dD
else if (strtoint(copy(de,6,2))-1)>m then
UseDays:=31;
end
else if strtoint(copy(de,9,2))>=d then
begin
if strtoint(copy(de,6,2))<>m then
UseDays:=31
else if strtoint(copy(de,1,4))<>y then
UseDays:=31
else
UseDays:=strtoint(copy(de,9,2))-d;
end;
if abs(UseDays)>30 then
Result:=31
else
result:=abs(usedays);
end;
end;
procedure inscal; //汇总保险金
var Qry1:TADOQuery;
begin
with datamod do
begin
Qry1:=TADOQuery.create(application);
Qry1.connection:=Query1.connection;
qry1.sql.clear;
qry1.sql.add('delete from ins04010');
qry1.sql.add('insert into ins04010 (workno,cardno,name,rq,insno,insname,instype,insmoney,operator) '+
' select b.workno,b.cardno,b.name,b.rq,b.insno,b.insname,b.instype,b.insmoney,'''+pubworkname+''' '+
' from ins02010 as b ');
qry1.sql.add('update ins04010 set returnrq=b.returnrq from ins04010 as a,ins03010 as b where a.workno=b.workno and b.insno=a.insno ');
qry1.sql.add('update ins04010 set months=datediff(mm,rq,returnrq)+1 where returnrq is not null ');
qry1.sql.add('update ins04010 set months=datediff(mm,rq,getdate())+1 where returnrq is null ');
qry1.sql.add('update ins04010 set instotalmoney=isnull(months,0)*insmoney ');
qry1.execsql;
end;
end;
procedure medcal; //汇总就诊金
var Qry1:TADOQuery;
begin
with datamod do
begin
Qry1:=TADOQuery.create(application);
Qry1.connection:=Query1.connection;
qry1.sql.Clear;
qry1.sql.Add('Delete from med04010 where rq='''+copy(formatdatetime('yyyy'+DateSeparator+'mm'+DateSeparator+'dd',now),1,7)+''' ');
Qry1.sql.add('Insert into med04010 (rq,workno,cardno,name,dept,totalmoney) select '''+copy(formatdatetime('yyyy'+DateSeparator+'mm'+DateSeparator+'dd',now),1,7)+''',workno,'+
' min(cardno)as cardno,min(name) as name,min(dept) as dept,sum(money) as summoney from med03010 where left(rq,7)='''+copy(formatdatetime('yyyy'+DateSeparator+'mm'+DateSeparator+'dd',now),1,7)+''' group by workno ');
qry1.ExecSQL;
qry1.Close;
end;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?