⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bustrazhyearunit.pas

📁 公交行业的管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        //--------第三页------------
        iListVIew:=ListView3;
        for iRow := 0 to 21 do
        begin
                iListView.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                iListView.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                if (iListView.Items[iRow].SubItems[3]='') or (iListView.Items[iRow].SubItems[3]='0') then
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        //--------第四页------------
        iListVIew:=ListView4;
        for iRow := 0 to 21 do
        begin
                iListView.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                iListView.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                if (iListView.Items[iRow].SubItems[3]='') or (iListView.Items[iRow].SubItems[3]='0') then
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        //--------第五页------------
        iListVIew:=ListView5;
        for iRow := 0 to 21 do
        begin
                iListView.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                iListView.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                if (iListView.Items[iRow].SubItems[3]='') or (iListView.Items[iRow].SubItems[3]='0') then
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        //--------第二页------------
        iListVIew:=ListView6;
        for iRow := 0 to 22 do
        begin
                iListView.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                iListView.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                if (iListView.Items[iRow].SubItems[3]='') or (iListView.Items[iRow].SubItems[3]='0') then
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        //--------第七页------------
        iListVIew:=ListView7;
        for iRow := 0 to 22 do
        begin
                iListView.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                iListView.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                if (iListView.Items[iRow].SubItems[3]='') or (iListView.Items[iRow].SubItems[3]='0') then
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        //--------第八页------------
        iListVIew:=ListView8;
        for iRow := 0 to 22 do
        begin
                iListView.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                iListView.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                if (iListView.Items[iRow].SubItems[3]='') or (iListView.Items[iRow].SubItems[3]='0') then
                begin
                        iListView.Items[iRow].SubItems[4]:='0';
                end
                else
                begin
                        iListView.Items[iRow].SubItems[4]:= CalculatePercent(iListView.Items[iRow].SubItems[2],iListVIew.Items[iRow].SubItems[3],100);
                end;
                ADOQuery1.Next;
        end;

        {数据写入ListView
        for iRow:=0 to ADOQuery1.RecordCount-1 do
        begin
                if (iRow>=0) and (iRow<=21) then
                begin
                        ListView1.Items[iRow].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView1.Items[iRow].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView1.Items[iRow].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=22) and (iRow<=43) then
                begin
                        ListView2.Items[iRow-22].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView2.Items[iRow-22].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView2.Items[iRow-22].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=44) and (iRow<=65) then
                begin
                        ListView3.Items[iRow-44].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView3.Items[iRow-44].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView3.Items[iRow-44].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=66) and (iRow<=87) then
                begin
                        ListView4.Items[iRow-66].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView4.Items[iRow-66].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView4.Items[iRow-66].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=88) and (iRow<=109) then
                begin
                        ListView5.Items[iRow-88].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView5.Items[iRow-88].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView5.Items[iRow-88].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=110) and (iRow<=132) then
                begin
                        ListView6.Items[iRow-110].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView6.Items[iRow-110].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView6.Items[iRow-110].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=133) and (iRow<=155) then
                begin
                        ListView7.Items[iRow-133].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView7.Items[iRow-133].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView7.Items[iRow-133].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end
                else if (iRow>=156) and (iRow<=178) then
                begin
                        ListView8.Items[iRow-156].SubItems[2]:= Converter(ADOQuery1.FieldByName('全年实际').AsString);
                        ListView8.Items[iRow-156].SubItems[3]:= Converter(ADOQuery1.FieldByName('去年同期').AsString);
                        ListView8.Items[iRow-156].SubItems[4]:= Converter(ADOQuery1.FieldByName('比较').AsString);
                end;
                ADOQuery1.Next;

        end;}
        BitBtn2.Enabled:=true;

end;

procedure TBusTraZhYearFm.BitBtn2Click(Sender: TObject);
var
        iRow:Integer;
        iCol:Integer;
        iRecNum:Integer;
        iYear:String;
begin
        {判断打印机状态}
        if (DeviceDetect=0) then
        begin
                exit;
        end;

        iYear:=ComboBox1.Text;
        {获得填表人等数据}
        if(PrnInfoFrm.ShowModal<>mrOK)then
        begin
                exit;
        end;

        PrintInit(ExtractFilePath(Application.ExeName),'BusTradeZHYearTab');

        iCol:=4;
        for iRecNum := 0 to 21 do
        begin
                iRow:=iRecNum+8;
                WriteCell(iRow,iCol,ListView1.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView1.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView1.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 21 do
        begin
                iRow:=iRecNum+38;
                WriteCell(iRow,iCol,ListView2.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView2.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView2.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 21 do
        begin
                iRow:=iRecNum+68;
                WriteCell(iRow,iCol,ListView3.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView3.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView3.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 21 do
        begin
                iRow:=iRecNum+98;
                WriteCell(iRow,iCol,ListView4.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView4.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView4.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 21 do
        begin
                iRow:=iRecNum+128;
                WriteCell(iRow,iCol,ListView5.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView5.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView5.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 22 do
        begin
                iRow:=iRecNum+158;
                WriteCell(iRow,iCol,ListView6.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView6.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView6.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 22 do
        begin
                iRow:=iRecNum+189;
                WriteCell(iRow,iCol,ListView7.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView7.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView7.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 22 do
        begin
                iRow:=iRecNum+220;
                WriteCell(iRow,iCol,ListView8.Items[iRecNum].SubItems[2]);
                WriteCell(iRow,iCol+1,ListView8.Items[iRecNum].SubItems[3]);
                WriteCell(iRow,iCol+2,ListView8.Items[iRecNum].SubItems[4]);
        end;

        for iRecNum := 0 to 4 do
        begin
                WriteCell(4 + iRecNum*30,1,'汇总单位:'+Edit1.Text);
                WriteCell(2 + iRecNum*30,4,iYear+ ' 年');
                WriteCell(30+ iRecNum*30,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
                WriteCell(30+ iRecNum*30,4,'统计人员:' + PrnInfoFrm.StatPerson);
                WriteCell(30+ iRecNum*30,6,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
        end;

        for iRecNum := 0 to 2 do
        begin
                WriteCell(154 + iRecNum*31,1,'汇总单位:'+Edit1.Text);
                WriteCell(152 + iRecNum*31,4,iYear+ ' 年');
                WriteCell(181 + iRecNum*31,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
                WriteCell(181 + iRecNum*31,4,'统计人员:' + PrnInfoFrm.StatPerson);
                WriteCell(181 + iRecNum*31,6,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
        end;

        PrintExcelShow;
        PrintPreview;
        CloseActiveBook;

end;

procedure TBusTraZhYearFm.FormShow(Sender: TObject);
begin
        iExistFlag:=0;

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -