📄 trendtjfrm.pas
字号:
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YKZX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to 12 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from YkGcZx where Year(SlTime)='''+Edt_OnlyMonthSelect.Text+''' and Month(Sltime)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YKZX ( Thedate,TheValue) values ('''+IntToStr(i)+'月'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------用户投诉
close; sql.Clear;
sql.Text:='drop Table T_YHTS';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YHTS ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to 12 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientComp where Year(Slsj)='''+Edt_OnlyMonthSelect.Text+''' and Month(Slsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YHTS ( Thedate,TheValue) values ('''+IntToStr(i)+'月'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------用户咨询
close; sql.Clear;
sql.Text:='drop Table T_YHZX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YHZX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to 12 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientAsk where Year(Slsj)='''+Edt_OnlyMonthSelect.Text+''' and Month(Slsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YHZX ( Thedate,TheValue) values ('''+IntToStr(i)+'月'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
close; sql.Clear;
sql.Text:='select a.TheDate,a.theValue gz,b.theValue Yk,c.thevalue ts,d.thevalue zx,a.thevalue+b.thevalue+c.thevalue+d.thevalue S from T_GZGX a,T_YKZX b,T_YHTS c,T_YHZX d where a.thedate=b.thedate and a.thedate=c.thedate and a.thedate=d.thedate';
Open;
end;
end;//按年统计
//============================================
if CmBox_SelectTJStyle.Text='按月统计' then
begin
QRLbl_DateRange.caption:=intToStr(CurYear)+'年'+Edt_OnlyMonthSelect.Text+'月';
with DM_TrendTJ.Qr_TrendTJ do
begin
TJPrBar.Position:=5;
TJPrBar.Update;
//------------故障报修
close; sql.Clear;
sql.Text:='drop Table T_GZGX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_GZGX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to DayNum do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientElecOut where Year(zzflsj)='''+IntToStr(CurYear)+''' and Month(zzflsj)='''+Edt_OnlyMonthSelect.Text+''' and Day(zzflsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_GZGX ( Thedate,TheValue) values ('''+IntToStr(i)+'日'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------业扩咨询
close; sql.Clear;
sql.Text:='drop Table T_YKZX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YKZX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to DayNum do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from YkGcZx where Year(SlTime)='''+IntToStr(CurYear)+''' and Month(Sltime)='''+Edt_OnlyMonthSelect.Text+''' and Day(Sltime)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YKZX ( Thedate,TheValue) values ('''+IntToStr(i)+'日'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------用户投诉
close; sql.Clear;
sql.Text:='drop Table T_YHTS';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YHTS ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to DayNum do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientComp where Year(Slsj)='''+IntToStr(CurYear)+''' and Month(Slsj)='''+Edt_OnlyMonthSelect.Text+''' and Day(Slsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YHTS ( Thedate,TheValue) values ('''+IntToStr(i)+'日'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------用户咨询
close; sql.Clear;
sql.Text:='drop Table T_YHZX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YHZX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to DayNum do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientAsk where Year(Slsj)='''+IntTostr(CurYear)+''' and Month(Slsj)='''+Edt_OnlyMonthSelect.Text+''' and Day(Slsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YHZX ( Thedate,TheValue) values ('''+IntToStr(i)+'日'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
close; sql.Clear;
sql.Text:='select a.TheDate,a.theValue gz,b.theValue Yk,c.thevalue ts,d.thevalue zx,a.thevalue+b.thevalue+c.thevalue+d.thevalue S from T_GZGX a,T_YKZX b,T_YHTS c,T_YHZX d where a.thedate=b.thedate and a.thedate=c.thedate and a.thedate=d.thedate';
Open;
end;
end;//按月统计
//============================================
if CmBox_SelectTJStyle.Text='按日统计' then
begin
QRLbl_DateRange.caption:=formatDateTime('yyyy"年"MM"月"DD"日"',DatePicker.date);
with DM_TrendTJ.Qr_TrendTJ do
begin
TJPrBar.Position:=5;
TJPrBar.Update;
//------------故障报修
close; sql.Clear;
sql.Text:='drop Table T_GZGX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_GZGX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=0 to 23 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientElecOut where year(zzflsj)='''+IntToStr(Uyear)+''' and Month(zzflsj)='''+IntToStr(UMonth)+''' and Day(zzflsj)='''+IntToStr(Uday)+''' and DateName(Hour,zzflsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_GZGX ( Thedate,TheValue) values ('''+IntToStr(i)+'时'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------业扩咨询
close; sql.Clear;
sql.Text:='drop Table T_YKZX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YKZX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=0 to 23 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from YkGcZx where year(SlTime)='''+IntToStr(Uyear)+''' and Month(SlTime)='''+IntToStr(UMonth)+''' and Day(SlTime)='''+IntToStr(Uday)+''' and DateName(Hour,SlTime)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YKZX ( Thedate,TheValue) values ('''+IntToStr(i)+'时'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------用户投诉
close; sql.Clear;
sql.Text:='drop Table T_YHTS';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YHTS ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=0 to 23 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientComp where year(Slsj)='''+IntToStr(Uyear)+''' and Month(Slsj)='''+IntToStr(UMonth)+''' and Day(Slsj)='''+IntToStr(Uday)+''' and DateName(Hour,Slsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YHTS ( Thedate,TheValue) values ('''+IntToStr(i)+'时'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
//--------------用户咨询
close; sql.Clear;
sql.Text:='drop Table T_YHZX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_YHZX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=0 to 23 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientAsk where year(Slsj)='''+IntToStr(Uyear)+''' and Month(Slsj)='''+IntToStr(UMonth)+''' and Day(Slsj)='''+IntToStr(Uday)+''' and DateName(Hour,Slsj)='''+IntToStr(i)+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_YHZX ( Thedate,TheValue) values ('''+IntToStr(i)+'时'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
close; sql.Clear;
sql.Text:='select a.TheDate,a.theValue gz,b.theValue Yk,c.thevalue ts,d.thevalue zx,a.thevalue+b.thevalue+c.thevalue+d.thevalue S from T_GZGX a,T_YKZX b,T_YHTS c,T_YHZX d where a.thedate=b.thedate and a.thedate=c.thedate and a.thedate=d.thedate';
Open;
end;
end;//按日统计
end;//-------------AllAgentSelected
if CkBox_AllAgent.Checked=False then
begin
QRLbl_Title.Caption:=RxDBLpCb_Agent.Text+'--工作量趋势统计';
//============================================
if CmBox_SelectTJStyle.Text='按年统计' then
begin
QRLbl_DateRange.caption:=Edt_OnlyMonthSelect.Text+'年度';
with DM_TrendTJ.Qr_TrendTJ do
begin
TJPrBar.Position:=5;
TJPrBar.Update;
//------------故障报修
close; sql.Clear;
sql.Text:='drop Table T_GZGX';
try
ExecSQL;
except
end;
close; sql.Clear;
sql.Text:='Create Table Ecsc_Sa.T_GZGX ( Thedate char(50),TheValue int)';
ExecSQL;
for i:=1 to 12 do
begin
DM_TrendTJ.Qr_Temp.Close;
DM_TrendTJ.Qr_Temp.SQL.Clear;
DM_TrendTJ.Qr_Temp.SQL.Text:='Select count(*) from ClientElecOut where Year(zzflsj)='''+Edt_OnlyMonthSelect.Text+''' and Month(zzflsj)='''+IntToStr(i)+''' and Slr='''+RxDBLpCb_Agent.Value+'''';
DM_TrendTJ.Qr_Temp.Open;
close; sql.Clear;
sql.Text:='insert into T_GZGX ( Thedate,TheValue) values ('''+IntToStr(i)+'月'+''','+DM_TrendTJ.Qr_Temp.fieldbyname('column1').asstring+')';
ExecSQL;
TJPrBar.Position:=TJPrBar.Position+1;
TJPrBar.Update;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -