📄 ukqdatamanager.pas
字号:
decodedate(dmmain.CDSexecsql.fieldbyname('newdate').AsDateTime,yy,mm,dd);
tj:='T'+inttostr(dd-1);//前一天;;
sqls:='select * from dp_bcjg where bc_no='+''''+trim(cdsdata1.fieldbyname(tj).AsString)+'''';
add_data(cdsdata2,sqls);
end;
decodetime(cdsdata2.FieldByName('wsxb').AsDateTime,hh,ff,ss,msec);
tt:=ff;
tt:=tt-5;
zt5:=formatdatetime('hh'':''mm',encodetime(hh,ff,ss,msec));//早退
tt:=tt-30+5;//***************************//
if tt<0 then //小于0减去小时;
begin
hh:=hh-1;
tt:=tt+60;
end;
ff:=tt;
kg7:=formatdatetime('hh'':''mm',encodetime(hh,ff,ss,msec)); //************旷工时间
end else
begin
kg7:='00:00:00';
zt4:='00:00:00';
zt5:='00:00:00';
end;
if (dmmain.CDSexecsql.FieldByName('add_down').AsDateTime<>0) and (dmmain.CDSexecsql.FieldByName('ADD_down').AsString<>'1900-1-1') then
begin
zt6:=formatdatetime('hh'':''mm',dmmain.CDSexecsql.FieldByName('add_down').AsDateTime);
decodetime(cdsdata2.FieldByName('jbxb').AsDateTime,hh,ff,ss,msec);
tt:=ff;
tt:=tt-5;
zt7:=formatdatetime('hh'':''mm',encodetime(hh,ff,ss,msec));
tt:=tt-30+5;//***************************//
if tt<0 then //小于0减去小时;
begin
hh:=hh-1;
tt:=tt+60;
end;
ff:=tt;
kg8:=formatdatetime('hh'':''mm',encodetime(hh,ff,ss,msec)); //************旷工时间
end else
begin
kg8:='00:00:00';
zt6:='00:00:00';
zt7:='00:00:00';
end;
/////////进行时间判断////////////////////
//***************迟到统计***************///////
if cdsdata2.FieldByName('swsb').AsDateTime<>0 then
begin
if (cd<>'00:00:00') then //早上
begin
if (strtotime(cd)<strtotime(kg1)) then
begin
if (strtotime(cd)>=strtotime(cd1)) then
begin
cdtj:=cdtj+1;
end;
end else
begin
cou:=cou+1;
bz:=1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
if cdsdata2.FieldByName('xwsb').AsDateTime<>0 then
begin
if (cd2<>'00:00:00') then //中上
begin
if ((strtotime(cd2)<strtotime(kg2)) )and (bz<>1) then
begin
if (strtotime(cd2)>=strtotime(cd3)) then
begin
cdtj:=cdtj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
if cdsdata2.FieldByName('wssb').AsDateTime<>0 then
begin
if (cd4<>'00:00:00') then //晚上
begin
if ((strtotime(cd4)<strtotime(kg3)) )and (bz<>1) then
begin
if (strtotime(cd4)>=strtotime(cd5)) then
begin
cdtj:=cdtj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
if cdsdata2.FieldByName('jbsb').AsDateTime<>0 then
begin
if (cd6<>'00:00:00') then //加上
begin
if ((strtotime(cd6)<strtotime(kg4)) )and (bz<>1) then
begin
if (strtotime(cd6)>=strtotime(cd7)) then
begin
cdtj:=cdtj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
///////////////////////////////////迟到统计///////////////////////////////
//////////////////////////////////////////////////////////////////////////
//*****************早退****************************//
if cdsdata2.FieldByName('swxb').AsDateTime<>0 then
begin
if (zt<>'00:00:00') then //早下
begin
if ((strtotime(zt)>strtotime(kg5)) )and (bz<>1) then
begin
if (strtotime(zt)<=strtotime(zt1)) then
begin
zttj:=zttj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
if cdsdata2.FieldByName('xwxb').AsDateTime<>0 then
begin
if (zt2<>'00:00:00') then //中下
begin
if ((strtotime(zt2)>strtotime(kg6)) )and (bz<>1) then
begin
if (strtotime(zt2)<=strtotime(zt3)) then
begin
zttj:=zttj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
if cdsdata2.FieldByName('wsxb').AsDateTime<>0 then
begin
if (zt4<>'00:00:00') then //晚下
begin
if ((strtotime(zt4)>strtotime(kg7)) )and (bz<>1) then
begin
if (strtotime(zt4)<=strtotime(zt5)) then
begin
zttj:=zttj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
if cdsdata2.FieldByName('jbxb').AsDateTime<>0 then
begin
if (zt6<>'00:00:00') then //加下
begin
if ((strtotime(zt6)>strtotime(kg8)) )and (bz<>1) then
begin
if (strtotime(zt6)<=strtotime(zt7)) then
begin
zttj:=zttj+1;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end else
begin
if bz<>1 then
begin
cou:=cou+1;
bz:=1;
end ;
end;
end;
///////////////////////早退统计////////////////////////////////
//////////
dmmain.CDSexecsql.Next;
end;
decodedate(date,yy,mm,dd);
for ts:=1 to DaysInAMonth(yy,mm) do
begin
TJ:='T'+INTTOSTR(TS);
if trim(cdsdata1.FIELDBYNAME(TJ).AsString)='' then
begin
xxts:=xxts+1;
end;
end;
ts:=DaysInAMonth(yy,mm);
if dmmain.CDSexecsql.RecordCount>0 then
begin
cou:=cou+ts-dmmain.CDSexecsql.RecordCount-xxts;
end;
result:='迟到'+floattostr(cdtj)+'次'+chr(13)+'早退'+floattostr(zttj)+'次'+chr(13)+'旷工'+floattostr(cou)+'次';
cdtj:=0;
zttj:=0;
cou:=0;
dtj:=0;
end;
/////////////////////////////////
procedure TfmKqManager.FormShow(Sender: TObject);
var
b:boolean;
begin
inherited;
b:=binddata;
ReadTree('',nil);
end;
procedure TfmKqManager.TreeBaseDblClick(Sender: TObject);
var
i:integer;
rb:boolean;
begin
inherited;
if treebase.Selected<>nil then
begin
i:=ReadTree(copy(trim(treebase.Selected.Text),1,pos('_',trim(treebase.Selected.Text))-1),treebase.Selected);
rb:=false;
if treebase.Selected.Parent<>nil then
begin
Mmsg.Clear;
rb:= readdata(trim(copy(treebase.Selected.Text,1,pos('_',trim(treebase.Selected.Text))-1)));
if rb then
Mmsg.Text:=TOtal_kq(trim(copy(treebase.Selected.Text,1,pos('_',trim(treebase.Selected.Text))-1)))
else
application.MessageBox('没有考勤数据!',pchar(application.Title),mb_iconinformation);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -