📄 busicount.~pas
字号:
close; Sql.Clear ;
Sql.Add('select Count(*) Reccount from ClientElecOut where zzflsj>=:A and zzflsj<=:B and (state=2 or state=7 or state=8 or state=9) and ELECOUT_LEVEL=1');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
Satisfy_total_WX:=Fieldbyname('RecCount').AsInteger;
//超期率
if Satisfy_month_WX=0 then SatisfyRate_month:='0' else SatisfyRate_month:=Format('%2.2f',[iSatisfymonth_Num/Satisfy_month_WX*100]);
if Satisfy_total_WX=0 then SatisfyRate_total:='0' else SatisfyRate_total:=Format('%2.2f',[iSatisfytotal_Num/Satisfy_total_WX*100]);
finally
free;
end;
end;
procedure TFrm_BusiCount.CalGYJL(const totaltime, starttime,
endtime: TDateTIme; var iSendmonth_Num, iSendtotal_Num, iFinishmonth_Num,
iFinishtotal_Num, iNoFinishmonth_Num, iNoFinishtotal_Num,
iOverTimeFinishmonth_Num, iOverTimeFinishtotal_Num, iSatisfymonth_Num,
iSatisfytotal_Num: integer; var OverTimeRate_month, OverTimeRate_total,
SatisfyRate_month, SatisfyRate_total: string);
//var
//Satisfy_month, Satisfy_total:integer;
begin
with TQuery.Create(nil) do
try
//总件数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iSendmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iSendtotal_Num:=Fieldbyname('RecCount').AsInteger;
//完成数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iFinishmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iFinishtotal_Num:=Fieldbyname('RecCount').AsInteger;
//未完成数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=0 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iNoFinishmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=0 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iNoFinishtotal_Num:=Fieldbyname('RecCount').AsInteger;
//超期完成数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
//Sql.Add('Select count(*) RecCount from ClientAsk where State=2 and xdsj<fhsj and slsj>=:A and slsj<=:B and urgentnum=1');
Sql.Add('Select ');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=1 and state=2 and datediff(minute,zzflsj,pcsj)>45 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=2 and state=2 and datediff(minute,zzflsj,pcsj)>90 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=3 and state=2 and datediff(hour,zzflsj,pcsj)>2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2) ');
Sql.Add('RecCount');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iOverTimeFinishmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
//Sql.Add('Select count(*) RecCount from ClientAsk where State=2 and xdsj<fhsj and slsj>=:A and slsj<=:B and urgentnum=1');
Sql.Add('Select ');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=1 and state=2 and datediff(minute,zzflsj,pcsj)>45 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=2 and state=2 and datediff(minute,zzflsj,pcsj)>90 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=3 and state=2 and datediff(hour,zzflsj,pcsj)>2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=2) ');
Sql.Add('RecCount');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iOverTimeFinishtotal_Num:=Fieldbyname('RecCount').AsInteger;
//超期率
if iFinishmonth_Num=0 then OverTimeRate_month:='0' else OverTimeRate_month:=Format('%2.2f',[iOverTimeFinishmonth_Num/iFinishmonth_Num*100]);
if iFinishtotal_Num=0 then OverTimeRate_total:='0' else OverTimeRate_total:=Format('%2.2f',[iOverTimeFinishtotal_Num/iFinishtotal_Num*100]);
//满意数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('select Count(*) Reccount from ClientElecOut where (usersatisfy=1 or usersatisfy=2 or usersatisfy=3) and zzflsj>=:A and zzflsj<=:B and (state=2 or state=7 or state=8 or state=9) and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iSatisfymonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('select Count(*) Reccount from ClientElecOut where (usersatisfy=1 or usersatisfy=2 or usersatisfy=3) and zzflsj>=:A and zzflsj<=:B and (state=2 or state=7 or state=8 or state=9) and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iSatisfytotal_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('select Count(*) Reccount from ClientElecOut where zzflsj>=:A and zzflsj<=:B and (state=2 or state=7 or state=8 or state=9) and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
Satisfy_month_GY:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('select Count(*) Reccount from ClientElecOut where zzflsj>=:A and zzflsj<=:B and (state=2 or state=7 or state=8 or state=9) and ELECOUT_LEVEL=2');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
Satisfy_Total_GY:=Fieldbyname('RecCount').AsInteger;
//超期率
if Satisfy_month_GY=0 then SatisfyRate_month:='0' else SatisfyRate_month:=Format('%2.2f',[iSatisfymonth_Num/Satisfy_month_GY*100]);
if Satisfy_total_GY=0 then SatisfyRate_total:='0' else SatisfyRate_total:=Format('%2.2f',[iSatisfytotal_Num/Satisfy_total_GY*100]);
finally
free;
end;
end;
procedure TFrm_BusiCount.CalDYJL(const totaltime, starttime,
endtime: TDateTIme; var iSendmonth_Num, iSendtotal_Num, iFinishmonth_Num,
iFinishtotal_Num, iNoFinishmonth_Num, iNoFinishtotal_Num,
iOverTimeFinishmonth_Num, iOverTimeFinishtotal_Num, iSatisfymonth_Num,
iSatisfytotal_Num: integer; var OverTimeRate_month, OverTimeRate_total,
SatisfyRate_month, SatisfyRate_total: string);
//var
//Satisfy_month, Satisfy_total:integer;
begin
with TQuery.Create(nil) do
try
//总件数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iSendmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iSendtotal_Num:=Fieldbyname('RecCount').AsInteger;
//完成数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iFinishmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iFinishtotal_Num:=Fieldbyname('RecCount').AsInteger;
//未完成数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=0 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iNoFinishmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('Select count(*) RecCount from ClientElecOut where State=0 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iNoFinishtotal_Num:=Fieldbyname('RecCount').AsInteger;
//超期完成数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
//Sql.Add('Select count(*) RecCount from ClientAsk where State=2 and xdsj<fhsj and slsj>=:A and slsj<=:B and urgentnum=2');
Sql.Add('Select ');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=1 and state=2 and datediff(minute,zzflsj,pcsj)>45 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=2 and state=2 and datediff(minute,zzflsj,pcsj)>90 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=3 and state=2 and datediff(hour,zzflsj,pcsj)>2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3) ');
Sql.Add('RecCount');
Parambyname('A').AsDateTime:=starttime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iOverTimeFinishmonth_Num:=Fieldbyname('RecCount').AsInteger;
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
//Sql.Add('Select count(*) RecCount from ClientAsk where State=2 and xdsj<fhsj and slsj>=:A and slsj<=:B and urgentnum=2');
Sql.Add('Select ');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=1 and state=2 and datediff(minute,zzflsj,pcsj)>45 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=2 and state=2 and datediff(minute,zzflsj,pcsj)>90 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3)+');
Sql.Add('(select Count(*) from ClientElecOut where IsOverTime=3 and state=2 and datediff(hour,zzflsj,pcsj)>2 and zzsbsj>=:A and zzsbsj<=:B and ELECOUT_LEVEL=3) ');
Sql.Add('RecCount');
Parambyname('A').AsDateTime:=totaltime; Parambyname('B').AsDateTime:=endtime;
Prepare; Open;
iOverTimeFinishtotal_Num:=Fieldbyname('RecCount').AsInteger;
//超期率
if iFinishmonth_Num=0 then OverTimeRate_month:='0' else OverTimeRate_month:=Format('%2.2f',[iOverTimeFinishmonth_Num/iFinishmonth_Num*100]);
if iFinishtotal_Num=0 then OverTimeRate_total:='0' else OverTimeRate_total:=Format('%2.2f',[iOverTimeFinishtotal_Num/iFinishtotal_Num*100]);
//满意数
Databasename:=SysDM.DBMain.databasename;
close; Sql.Clear ;
Sql.Add('select Count(*) Reccount from ClientElecOut where (usersatisfy=1 or usersatisfy=2 or usersatisfy=3) and zzflsj>=:A and zzflsj<=:B and (state=2 or state=7 or state=8 or state=9) and ELECOUT_LEVEL=3');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -