📄 otherhyyearcompareunit.pas
字号:
ADOQuery1.SQL.Add(sqlString);
ADOQuery1.Open;
ADOQuery1.First;
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(ListView2.Items[14].SubItems[2])-StrToFloat(ListView2.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
ListView2.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(ListView3.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 TOtherHYYearCompareFrm.BitBtn3Click(Sender: TObject);
var
iRow,iCol:integer;
begin
Edit7.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;
OtherHYYearCompareFrm.Close;
end;
procedure TOtherHYYearCompareFrm.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),'BusTwTradeYearComTab');
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(2,1,'比较城市:'+Edit6.Text);
WriteCellForEdit(4,1,'被比较城市:'+Edit7.Text);
WriteCellForEdit(2,9,'比较城市:'+Edit6.Text);
WriteCellForEdit(4,9,'被比较城市:'+Edit7.Text);
WriteCellForEdit(33,1,'比较城市:'+Edit6.Text);
WriteCellForEdit(35,1,'被比较城市:'+Edit7.Text);
WriteCellForEdit(33,9,'比较城市:'+Edit6.Text);
WriteCellForEdit(35,9,'被比较城市:'+Edit7.Text);
WriteCellForEdit(3,4,'报告期:'+ComboBox2.Text+'年');
WriteCellForEdit(3,12,'报告期:'+ComboBox2.Text+'年');
WriteCellForEdit(34,4,'报告期:'+ComboBox2.Text+'年');
WriteCellForEdit(34,12,'报告期:'+ComboBox2.Text+'年');
PrintExcelEdit;
end;
end;
procedure TOtherHYYearCompareFrm.SpeedButton1Click(Sender: TObject);
begin
if CitySelectForm.ShowModal=mrOK then
Edit7.Text:=CitySelectForm.Edit1.Text;
CitySelectForm.Close;
end;
procedure TOtherHYYearCompareFrm.SpeedButton2Click(Sender: TObject);
begin
if CitySelectForm.ShowModal=mrOK then
Edit6.Text:=CitySelectForm.Edit1.Text;
CitySelectForm.Close;
end;
procedure TOtherHYYearCompareFrm.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;
procedure TOtherHYYearCompareFrm.Edit6Change(Sender: TObject);
begin
ClearLView(ListView1,0,22,2,5);
ClearLView(ListView2,0,22,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,18,2,5);
BitBtn2.Enabled:=false;
end;
procedure TOtherHYYearCompareFrm.ComboBox1Change(Sender: TObject);
begin
ClearLView(ListView1,0,22,2,5);
ClearLView(ListView2,0,22,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,18,2,5);
BitBtn2.Enabled:=false;
end;
procedure TOtherHYYearCompareFrm.Edit7Change(Sender: TObject);
begin
ClearLView(ListView1,0,22,2,5);
ClearLView(ListView2,0,22,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,18,2,5);
BitBtn2.Enabled:=false;
end;
procedure TOtherHYYearCompareFrm.ComboBox3Change(Sender: TObject);
begin
ClearLView(ListView1,0,22,2,5);
ClearLView(ListView2,0,22,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,18,2,5);
BitBtn2.Enabled:=false;
end;
procedure TOtherHYYearCompareFrm.ComboBox2Change(Sender: TObject);
begin
ClearLView(ListView1,0,22,2,5);
ClearLView(ListView2,0,22,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,18,2,5);
BitBtn2.Enabled:=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -