📄 bustranamebookcomunit.~pas
字号:
if ListView2.Items[iRow-19].SubItems.Count<5 then
begin
ListView2.Items[iRow-19].SubItems.Add(Converter(ADOQuery1.FieldByName('报告期').AsFloat));
ListView2.Items[iRow-19].SubItems.Add(Converter(ADOQuery1.FieldByName('基期').AsFloat));
ListView2.Items[iRow-19].SubItems.Add(Converter(ADOQuery1.FieldByName('比较').AsFloat));
ListView2.Items[iRow-19].SubItems.Add('0');
end
else
begin
ListView2.Items[iRow-19].SubItems[1]:= Converter(ADOQuery1.FieldByName('报告期').AsFloat);
ListView2.Items[iRow-19].SubItems[2]:= Converter(ADOQuery1.FieldByName('基期').AsFloat);
ListView2.Items[iRow-19].SubItems[3]:= Converter(ADOQuery1.FieldByName('比较').AsFloat);
ListView2.Items[iRow-19].SubItems[4]:= '0';
end;
end
else if (iRow>=40) and (iRow<=51) then
begin
if ListView3.Items[iRow-40].SubItems.Count<5 then
begin
ListView3.Items[iRow-40].SubItems.Add(Converter(ADOQuery1.FieldByName('报告期').AsFloat));
ListView3.Items[iRow-40].SubItems.Add(Converter(ADOQuery1.FieldByName('基期').AsFloat));
ListView3.Items[iRow-40].SubItems.Add(Converter(ADOQuery1.FieldByName('比较').AsFloat));
ListView3.Items[iRow-40].SubItems.Add('0');
end
else
begin
ListView3.Items[iRow-40].SubItems[1]:= Converter(ADOQuery1.FieldByName('报告期').AsFloat);
ListView3.Items[iRow-40].SubItems[2]:= Converter(ADOQuery1.FieldByName('基期').AsFloat);
ListView3.Items[iRow-40].SubItems[3]:= Converter(ADOQuery1.FieldByName('比较').AsFloat);
ListView3.Items[iRow-40].SubItems[4]:= '0';
end;
end;
ADOQuery1.Next;
end;
BitBtn2.Enabled:=true;
iEspItem:='''' + 'MNS02' + '''' + ','
+'''' + 'MNS03' + '''' + ','
+'''' + 'MNS04' + '''' + ','
+'''' + 'MNS05' + '''' + ','
+'''' + 'MNS06' + '''';// + ','
//+'''' + 'MNS07' + '''';
{注册资本金比较}
sqlString:= 'select a.企业注册资本金 as 报告期,b.企业注册资本金 as 基期,(报告期-基期) as 比较 '//,((报告期-基期)/基期)*100 as 百分比'
+ ' from 公交行业名录统计年报表_z a,公交行业名录统计年报表_z b'
+ ' where a.统计年份=' + iYear + ' and b.统计年份=' + iLYear + ' and a.城市代码=' + '''' + '022' + ''''
+ ' and b.城市代码=a.城市代码 and b.指标代码=a.指标代码 '
+ ' and a.指标代码 in (' + iEspItem + ') order by a.指标代码';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlString);
ADOQuery1.Open;
{将注册资本金写入ListView}
for iRow:=0 to ADOQuery1.RecordCount-1 do
begin
if ListView3.Items[iRow+12].SubItems.Count<5 then
begin
ListView3.Items[iRow+12].SubItems.Add(Converter(ADOQuery1.FieldByName('报告期').AsFloat));
ListView3.Items[iRow+12].SubItems.Add(Converter(ADOQuery1.FieldByName('基期').AsFloat));
ListView3.Items[iRow+12].SubItems.Add(Converter(ADOQuery1.FieldByName('比较').AsFloat));
ListView3.Items[iRow+12].SubItems.Add('0');
end
else
begin
ListView3.Items[iRow+12].SubItems[1]:= Converter(ADOQuery1.FieldByName('报告期').AsFloat);
ListView3.Items[iRow+12].SubItems[2]:= Converter(ADOQuery1.FieldByName('基期').AsFloat);
ListView3.Items[iRow+12].SubItems[3]:= Converter(ADOQuery1.FieldByName('比较').AsFloat);
ListView3.Items[iRow+12].SubItems[4]:= '0';
end;
ADOQuery1.Next;
end;
{处理百分比3-30 }
//Page1
for iRow:=0 to 18 do
begin
ListView1.Items[iRow].SubItems[4]:=SpecDataDiv(Listview1.Items[iRow].SubItems[3],ListView1.Items[IRow].SubItems[2],100);
end;
//Page2
for iRow:=0 to 20 do
begin
ListView2.Items[iRow].SubItems[4]:=SpecDataDiv(Listview2.Items[iRow].SubItems[3],ListView2.Items[IRow].SubItems[2],100);
end;
//Page3
for iRow:=0 to 16 do
begin
ListView3.Items[iRow].SubItems[4]:=SpecDataDiv(Listview3.Items[iRow].SubItems[3],ListView3.Items[IRow].SubItems[2],100);
end;
end;
procedure TBusTraNameBookComFm.BitBtn2Click(Sender: TObject);
var
iRow:Integer;
iCol:Integer;
iRecNum:Integer;
iYear:String;
iLYear:String;
begin
{判断打印机状态}
if (DeviceDetect=0) then
begin
exit;
end;
iYear:=ComboBox2.Text;
iLYear:=ComboBox1.Text;
{获得填表人等数据}
if(PrnInfoFrm.ShowModal<>mrOK)then
begin
exit;
end;
OpenForEdit(ExtractFilePath(Application.ExeName),'BusTradeNameBookComTab');
iCol:=3;
for iRecNum := 0 to 56 do
begin
if (iRecNum>=0) and (iRecNum<=18) then
begin
iRow:=iRecNum+5;
WriteCellForEdit(iRow,iCol,ListView1.Items[iRecNum].SubItems[1]);
WriteCellForEdit(iRow,iCol+1,ListView1.Items[iRecNum].SubItems[2]);
WriteCellForEdit(iRow,iCol+2,ListView1.Items[iRecNum].SubItems[3]);
WriteCellForEdit(iRow,iCol+3,ListView1.Items[iRecNum].SubItems[4]);
end
else if (iRecNum>=19) and (iRecNum<=39) then
begin
iRow:=iRecNum+12;
WriteCellForEdit(iRow,iCol,ListView2.Items[iRecNum-19].SubItems[1]);
WriteCellForEdit(iRow,iCol+1,ListView2.Items[iRecNum-19].SubItems[2]);
WriteCellForEdit(iRow,iCol+2,ListView2.Items[iRecNum-19].SubItems[3]);
WriteCellForEdit(iRow,iCol+3,ListView2.Items[iRecNum-19].SubItems[4]);
end
else if (iRecNum>=40) and (iRecNum<=56) then
begin
iRow:=iRecNum+17;
WriteCellForEdit(iRow,iCol,ListView3.Items[iRecNum-40].SubItems[1]);
WriteCellForEdit(iRow,iCol+1,ListView3.Items[iRecNum-40].SubItems[2]);
WriteCellForEdit(iRow,iCol+2,ListView3.Items[iRecNum-40].SubItems[3]);
WriteCellForEdit(iRow,iCol+3,ListView3.Items[iRecNum-40].SubItems[4]);
end;
end;
{第一页}
WriteCellForEdit(2,1,'汇总单位:客管办');
WriteCellForEdit(2,3,'报告期:' + iYear+ ' 年 基期:'+ iLYear +' 年');
WriteCellForEdit(25,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
WriteCellForEdit(25,3,'统计人员:'+PrnInfoFrm.StatPerson);
WriteCellForEdit(25,7,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
{第二页}
WriteCellForEdit(28,1,'汇总单位:客管办');
WriteCellForEdit(28,3,'报告期:' + iYear+ ' 年 基期:'+ iLYear +' 年');
WriteCellForEdit(52,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
WriteCellForEdit(52,3,'统计人员:' + PrnInfoFrm.StatPerson);
WriteCellForEdit(52,7,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
{第三页}
WriteCellForEdit(54,1,'汇总单位:客管办');
WriteCellForEdit(54,3,'报告期:' + iYear+ ' 年 基期:'+ iLYear +' 年');
WriteCellForEdit(77,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
WriteCellForEdit(77,3,'统计人员:'+ PrnInfoFrm.StatPerson);
WriteCellForEdit(77,7,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
PrintExcelEdit;
end;
procedure TBusTraNameBookComFm.FormCreate(Sender: TObject);
begin
iAddFlag:=0;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -