📄 hyyearcompareunit.~pas
字号:
showmessage('公交行业在'+ComboBox2.Text+'年的数据为空!请重新选择基期时间!');
exit;
end;
iBaseYear:=ComboBox1.Text;
iComYear:=ComboBox2.Text;
if scmode='生成值' then
sqlString:='SELECT a.指标代码, max(a.全年实际) AS 报告期实际,'
+' max(b.全年实际) AS 基期实际, 报告期实际-基期实际 AS 比较量'
+' FROM 公交行业统计年报_z AS a, 公交行业统计年报_z AS b '
+' WHERE a.统计年份='+iBaseYear+ ' And b.统计年份='+iComYear
+' And a.指标代码=b.指标代码 and a.城市代码='+''''+'022'+''''+' and b.城市代码=a.城市代码'
+' GROUP BY a.指标代码,a.统计年份,b.统计年份 ORDER BY a.指标代码'
else
sqlString:='SELECT a.指标代码, max(a.测算值) AS 报告期实际,'
+' max(b.测算值) AS 基期实际, 报告期实际-基期实际 AS 比较量'
+' FROM 公交行业统计年报_z AS a, 公交行业统计年报_z AS b '
+' WHERE a.统计年份='+iBaseYear+ ' And b.统计年份='+iComYear
+' And a.指标代码=b.指标代码 and a.城市代码='+''''+'022'+''''+' and b.城市代码=a.城市代码'
+' GROUP BY a.指标代码,a.统计年份,b.统计年份 ORDER BY a.指标代码';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlString);
ADOQuery1.Open;
if ADOQuery1.RecordCount<>0 then
begin
WriteListView(ListView1,23,ADOQuery1);
WriteListView(ListView2,23,ADOQuery1);
WriteListView(ListView3,21,ADOQuery1);
WriteListView(ListView4,19,ADOQuery1);
//......................................百分比.............................//
WritePercent(ListView1,23);
WritePercent(ListView2,23);
WritePercent(ListView3,21);
WritePercent(ListView4,19);
for j:=2 to 3 do
begin
IDiv:=strtoFloat(ListView2.Items[5].SubItems[j]);
IDivD:=strtofloat(ListView2.Items[10].SubItems[j])+
strtofloat(ListView2.Items[17].SubItems[j])+
strtofloat(ListView2.Items[21].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD)*100;
ListView2.Items[22].SubItems[j]:=Converter(Result);
end else
ListView2.Items[22].SubItems[j]:='0';
IDiv:=strtofloat(ListView3.Items[13].SubItems[j]);
IDivD:=strtofloat(ListView2.Items[4].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD)*100;
ListView3.Items[14].SubItems[j]:=Converter(Result);
end else
ListView3.Items[14].SubItems[j]:='0';
end;
if (StrToFloat(ListView2.Items[22].SubItems[2])-StrToFloat(ListView2.Items[22].SubItems[3])<>0) then
ListView2.Items[22].SubItems[4]:=Converter(StrToFloat(ListView2.Items[22].SubItems[2])-StrToFloat(ListView2.Items[22].SubItems[3]))
else
ListView2.Items[22].SubItems[4]:='0';
if (StrToFloat(ListView3.Items[14].SubItems[2])-StrToFloat(ListView3.Items[14].SubItems[3])<>0) then
ListView3.Items[14].SubItems[4]:=Converter(StrToFloat(ListView3.Items[14].SubItems[2])-StrToFloat(ListView3.Items[14].SubItems[3]))
else
ListView3.Items[14].SubItems[4]:='0';
if (StrToFloat(ListView2.Items[22].SubItems[3])<>0) then
ListView2.Items[22].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView2.Items[22].SubItems[4])/StrToFloat(ListView2.Items[22].SubItems[3])*100))
else
ListView2.Items[22].SubItems[5]:='0';
if (StrToFloat(ListView2.Items[14].SubItems[3])<>0) then
ListView3.Items[14].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView3.Items[14].SubItems[4])/StrToFloat(ListView3.Items[14].SubItems[3])*100))
else
ListView2.Items[14].SubItems[5]:='0';
BitBtn2.Enabled:=true;
BitBtn2.Visible:=true;
end;
end;
procedure THYYearCompare.BitBtn3Click(Sender: TObject);
var
iRow,iCol:integer;
begin
ComboBox1.Text:='';
ComboBox2.Text:='';
for iRow:=0 to 22 do
if ListView1.Items[iRow].SubItems.Count>3 then
for iCol:=2 to 5 do
ListView1.Items[iRow].SubItems[iCol]:='';
for iRow:=0 to 22 do
if ListView2.Items[iRow].SubItems.Count>3 then
for iCol:=2 to 5 do
ListView2.Items[iRow].SubItems[iCol]:='';
for iRow:=0 to 20 do
if ListView3.Items[iRow].SubItems.Count>3 then
for iCol:=2 to 5 do
ListView3.Items[iRow].SubItems[iCol]:='';
for iRow:=0 to 18 do
if ListView4.Items[iRow].SubItems.Count>3 then
for iCol:=2 to 5 do
ListView4.Items[iRow].SubItems[iCol]:='';
BitBtn2.Enabled:=false;
HYYearCompare.Close;
end;
procedure THYYearCompare.BitBtn2Click(Sender: TObject);
var
iRow:Integer;
iCol:Integer;
begin
if (DeviceDetect=0) then
begin
exit;
end;
if PrnInfoFrm.ShowModal=mrOK then
begin
OpenForEdit(ExtractFilePath(application.exeName),'BusTradeSelfYearComTab');
for iRow:=0 to 22 do
begin
for iCol:=2 to 5 do
WriteCellForEdit(iRow+8,iCol+2,ListView1.Items[iRow].SubItems[iCol]);
end;
for iRow:=0 to 22 do
begin
for iCol:=2 to 5 do
WriteCellForEdit(iRow+8,iCol+10,ListView2.Items[iRow].SubItems[iCol]);
end;
for iRow:=0 to 20 do
begin
for iCol:=2 to 5 do
WriteCellForEdit(iRow+39,iCol+2,ListView3.Items[iRow].SubItems[iCol]);
end;
for iRow:=0 to 18 do
begin
for iCol:=2 to 5 do
WriteCellForEdit(iRow+39,iCol+10,ListView4.Items[iRow].SubItems[iCol]);
end;
WriteCellForEdit(31,1,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(31,5,PrnInfoFrm.StatPerson);
WriteCellForEdit(31,8,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(31,9,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(31,13,PrnInfoFrm.StatPerson);
WriteCellForEdit(31,16,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(60,1,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(60,5,PrnInfoFrm.StatPerson);
WriteCellForEdit(60,8,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(60,9,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(60,13,PrnInfoFrm.StatPerson);
WriteCellForEdit(60,16,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(3,4,'报告期:'+ComboBox1.Text+'年 基期:'+ComboBox2.Text+'年');
WriteCellForEdit(3,12,'报告期:'+ComboBox1.Text+'年 基期:'+ComboBox2.Text+'年');
WriteCellForEdit(34,4,'报告期:'+ComboBox1.Text+'年 基期:'+ComboBox2.Text+'年');
WriteCellForEdit(34,12,'报告期:'+ComboBox1.Text+'年 基期:'+ComboBox2.Text+'年');
PrintExcelEdit;
end;
end;
procedure THYYearCompare.FormShow(Sender: TObject);
begin
TabSheet1.TabVisible:=true;
TabSheet2.TabVisible:=true;
TabSheet3.TabVisible:=true;
TabSheet4.TabVisible:=true;
PageControl1.ActivePage:=TabSheet4;
PageControl1.ActivePage:=TabSheet3;
PageControl1.ActivePage:=TabSheet2;
PageControl1.ActivePage:=TabSheet1;
IninLView(ListView1,0,22,2,5);
IninLView(ListView2,0,22,2,5);
IninLView(ListView3,0,20,2,5);
IninLView(ListView4,0,18,2,5);
BitBtn2.Enabled:=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -