📄 otherhycompareunit.pas
字号:
+' And a.指标代码=b.指标代码 ORDER BY a.指标代码';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlString);
ADOQuery1.Open;
if ADOQuery1.RecordCount<>0 then
WriteListView(ListView1,20,ADOQuery1);
for j:=0 to 4 do
begin
if (ADOQuery1.fieldbyname('比较单位实际').AsString<>'') then
ListView2.Items[j].SubItems[2]:=Converter(ADOQuery1.fieldbyname('比较单位实际').AsFloat)
else
ListView2.Items[j].SubItems[2]:='0';
if (ADOQuery1.fieldbyname('被比较单位实际').AsString<>'') then
ListView2.Items[j].SubItems[3]:=Converter(ADOQuery1.fieldbyname('被比较单位实际').AsFloat)
else
ListView2.Items[j].SubItems[3]:='0';
if (ADOQuery1.fieldbyname('比较量').AsString<>'') then
ListView2.Items[j].SubItems[4]:=Converter(ADOQuery1.fieldbyname('比较量').AsFloat)
else
ListView2.Items[j].SubItems[4]:='0';
ADOQuery1.Next;
end;
//........................百分比........................//
WritePercent(ListView1,20);
WritePercent(ListView2,20);
WritePercent(ListView3,21);
WritePercent(ListView4,20);
for j:=2 to 3 do
begin
IDiv:=strtofloat(ListView4.Items[2].SubItems[j]);
IDivD:=strtofloat(ListView4.Items[3].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD)*10000;
ListView4.Items[1].SubItems[j]:=Converter(Result);
end else
ListView4.Items[1].SubItems[j]:='0';
IDiv:=strtofloat(ListView4.Items[5].SubItems[j]);
IDivD:=strtofloat(ListView4.Items[6].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD)*100;
ListView4.Items[4].SubItems[j]:=Converter(Result);
end else
ListView4.Items[4].SubItems[j]:='0';
IDiv:=strtofloat(ListView4.Items[8].SubItems[j]);
IDivD:=strtofloat(ListView4.Items[9].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD)*100;
ListView4.Items[7].SubItems[j]:=Converter(Result);
end else
ListView4.Items[7].SubItems[j]:='0';
IDiv:=strtofloat(ListView4.Items[11].SubItems[j]);
IDivD:=strtofloat(ListView4.Items[12].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD)*100;
ListView4.Items[10].SubItems[j]:=Converter(Result);
end else
ListView4.Items[10].SubItems[j]:='0';
IDiv:=strtofloat(ListView3.Items[13].SubItems[j]);
IDivD:=strtofloat(ListView4.Items[13].SubItems[j]);
if IDivD<>0 then begin
Result:=(IDiv/IDivD);
ListView4.Items[14].SubItems[j]:=Converter(Result);
end else
ListView4.Items[14].SubItems[j]:='0';
end;
if (StrToFloat(ListView4.Items[1].SubItems[2])-StrToFloat(ListView4.Items[1].SubItems[3])<>0) then
ListView4.Items[1].SubItems[4]:=Converter(StrToFloat(ListView4.Items[1].SubItems[2])-StrToFloat(ListView4.Items[1].SubItems[3]))
else
ListView4.Items[1].SubItems[4]:='0';
if (StrToFloat(ListView4.Items[4].SubItems[2])-StrToFloat(ListView4.Items[4].SubItems[3])<>0) then
ListView4.Items[4].SubItems[4]:=Converter(StrToFloat(ListView4.Items[4].SubItems[2])-StrToFloat(ListView4.Items[4].SubItems[3]))
else
ListView4.Items[4].SubItems[4]:='0';
if (StrToFloat(ListView4.Items[7].SubItems[2])-StrToFloat(ListView4.Items[7].SubItems[3])<>0) then
ListView4.Items[7].SubItems[4]:=Converter(StrToFloat(ListView4.Items[7].SubItems[2])-StrToFloat(ListView4.Items[7].SubItems[3]))
else
ListView4.Items[7].SubItems[4]:='0';
if (StrToFloat(ListView4.Items[10].SubItems[2])-StrToFloat(ListView4.Items[10].SubItems[3])<>0) then
ListView4.Items[10].SubItems[4]:=Converter(StrToFloat(ListView4.Items[10].SubItems[2])-StrToFloat(ListView4.Items[10].SubItems[3]))
else
ListView4.Items[10].SubItems[4]:='0';
if (StrToFloat(ListView4.Items[14].SubItems[2])-StrToFloat(ListView4.Items[14].SubItems[3])<>0) then
ListView4.Items[14].SubItems[4]:=Converter(StrToFloat(ListView4.Items[14].SubItems[3])-StrToFloat(ListView4.Items[14].SubItems[3]))
else
ListView4.Items[14].SubItems[4]:='0';
if (StrToFloat(ListView4.Items[1].SubItems[3])<>0) then
ListView4.Items[1].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView4.Items[1].SubItems[4])/StrToFloat(ListView4.Items[1].SubItems[3])*100))
else
ListView4.Items[1].SubItems[5]:='0';
if (StrToFloat(ListView4.Items[4].SubItems[3])<>0) then
ListView4.Items[4].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView4.Items[4].SubItems[4])/StrToFloat(ListView4.Items[4].SubItems[3])*100))
else
ListView4.Items[4].SubItems[5]:='0';
if (StrToFloat(ListView4.Items[7].SubItems[3])<>0) then
ListView4.Items[7].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView4.Items[7].SubItems[4])/StrToFloat(ListView4.Items[7].SubItems[3])*100))
else
ListView4.Items[7].SubItems[5]:='0';
if (StrToFloat(ListView4.Items[10].SubItems[3])<>0) then
ListView4.Items[10].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView4.Items[10].SubItems[4])/StrToFloat(ListView4.Items[10].SubItems[3])*100))
else
ListView4.Items[10].SubItems[5]:='0';
if (StrToFloat(ListView4.Items[14].SubItems[3])<>0) then
ListView4.Items[14].SubItems[5]:=ConverterPercent(FloatToStr(StrToFloat(ListView4.Items[14].SubItems[4])/StrToFloat(ListView4.Items[14].SubItems[3])*100))
else
ListView4.Items[14].SubItems[5]:='0';
BBPrint1.Enabled:=true;
BBPrint1.Visible:=true;
end;
procedure TOtherHYMonthFrm.BBPrint1Click(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),'BusTwTradeMonComTab');
for iRow:=0 to 19 do
begin
for iCol:=2 to 5 do
WriteCellForEdit(iRow+8,iCol+2,ListView1.Items[iRow].SubItems[iCol]);
end;
for iRow:=0 to 19 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+38,iCol+2,ListView3.Items[iRow].SubItems[iCol]);
end;
for iRow:=0 to 19 do
begin
for iCol:=2 to 5 do
WriteCellForEdit(iRow+38,iCol+10,ListView4.Items[iRow].SubItems[iCol]);
end;
WriteCellForEdit(2,1,'比较城市:'+Edit3.Text);
WriteCellForEdit(4,1,'被比较城市:'+Edit4.Text);
WriteCellForEdit(2,9,'比较城市:'+Edit3.Text);
WriteCellForEdit(4,9,'被比较城市:'+Edit4.Text);
WriteCellForEdit(32,1,'比较城市:'+Edit3.Text);
WriteCellForEdit(34,1,'被比较城市:'+Edit4.Text);
WriteCellForEdit(32,9,'比较城市:'+Edit3.Text);
WriteCellForEdit(34,9,'被比较城市:'+Edit4.Text);
WriteCellForEdit(3,4,ComboBox2.Text+'年'+ComboBox1.Text+'月至'+ComboBox3.Text+'月');
WriteCellForEdit(3,12,ComboBox2.Text+'年'+ComboBox1.Text+'月至'+ComboBox3.Text+'月');
WriteCellForEdit(33,4,ComboBox2.Text+'年'+ComboBox1.Text+'月至'+ComboBox3.Text+'月');
WriteCellForEdit(33,12,ComboBox2.Text+'年'+ComboBox1.Text+'月至'+ComboBox3.Text+'月');
WriteCellForEdit(28,1,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(28,5,PrnInfoFrm.StatPerson);
WriteCellForEdit(28,8,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(28,9,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(28,13,PrnInfoFrm.StatPerson);
WriteCellForEdit(28,16,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(59,1,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(59,5,PrnInfoFrm.StatPerson);
WriteCellForEdit(59,8,DateToStr(PrnInfoFrm.StatDate));
WriteCellForEdit(59,9,'统计负责人:'+PrnInfoFrm.StatMainPerson);
WriteCellForEdit(59,13,PrnInfoFrm.StatPerson);
WriteCellForEdit(59,16,DateToStr(PrnInfoFrm.StatDate));
PrintExcelEdit;
end;
end;
procedure TOtherHYMonthFrm.BitBtn2Click(Sender: TObject);
var
iRow,iCol:integer;
begin
Edit4.Text:='';
ComboBox1.Text:='';
ComboBox2.Text:='';
ComboBox3.Text:='';
for iRow:=0 to 19 do
if ListView1.Items[iRow].SubItems.Count>3 then
for iCol:=2 to 5 do
ListView1.Items[iRow].SubItems[iCol]:='';
for iRow:=0 to 19 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 19 do
if ListView4.Items[iRow].SubItems.Count>3 then
for iCol:=2 to 5 do
ListView4.Items[iRow].SubItems[iCol]:='';
BBPrint1.Enabled:=false;
OtherHYMonthFrm.Close;
end;
procedure TOtherHYMonthFrm.SpeedButton2Click(Sender: TObject);
begin
if CitySelectForm.ShowModal=mrOK then
begin
Edit4.Text:=CitySelectForm.Edit1.Text;
end;
CitySelectForm.Close;
end;
procedure TOtherHYMonthFrm.SpeedButton1Click(Sender: TObject);
begin
if CitySelectForm.ShowModal=mrOK then
begin
Edit3.Text:=CitySelectForm.Edit1.Text;
end;
CitySelectForm.Close;
end;
procedure TOtherHYMonthFrm.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,19,2,5);
IninLView(ListView2,0,19,2,5);
IninLView(ListView3,0,20,2,5);
IninLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.Edit3Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.ComboBox4Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.Edit4Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.ComboBox5Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.ComboBox2Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.ComboBox1Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
procedure TOtherHYMonthFrm.ComboBox3Change(Sender: TObject);
begin
ClearLView(ListView1,0,19,2,5);
ClearLView(ListView2,0,19,2,5);
ClearLView(ListView3,0,20,2,5);
ClearLView(ListView4,0,19,2,5);
BBPrint1.Enabled:=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -