outputunit.~pas
来自「公交行业的管理系统」· ~PAS 代码 · 共 1,223 行 · 第 1/4 页
~PAS
1,223 行
showmessage('对不起!起始年份不能大于终止年份!请重新选择条件!');
exit;
end;
LookImportData5.Label1.Caption:='公用事业单位基本情况表';
LookImportData5.Edit1.Text:=ComboBox7.Text;
LookImportData5.Edit2.Text:=ComboBox8.Text;
LookImportData5.ADOQuery1.Connection:=ADOConnection1;
LookImportData5.ADOQuery1.SQL.Clear;
sqlstr:='select * from 公用事业单位基本情况表'
+' where 单位代码 in '+EprSelect.TotalEpr+' and 统计年份>='
+ ComboBox7.Text+' and 统计年份<='+ComboBox8.Text
+' ORDER BY 统计年份';
LookImportData5.ADOQuery1.SQL.Add(sqlstr);
LookImportData5.ADOQuery1.Open;
LookImportData5.ShowModal;
end;
procedure TOutputFrm.FormCreate(Sender: TObject);
begin
PageControl1.ActivePage:=TabSheet1;
end;
procedure TOutputFrm.TradeTableToTableMonth(src:string;des:string);
var
SrcQuery,DesQuery:TADOQuery;
i,j:integer;
begin
SrcQuery:=TADOQuery.create(self);
SrcQuery.Connection:=BusTradeDataModule.ADOConnection1;
SrcQuery.SQL.Add('select * from '+src+' where 城市代码='+''''+'022'+''''+' and 统计年份>='
+ComboBox11.text+ ' and 统计年份<='+ComboBox12.Text+
' and 统计月份>='+ComboBox13.text+' and 统计月份<='+ComboBox14.text);
SrcQuery.Open;
if (SrcQuery.RecordCount=0) then
begin
showmessage('导出的源数据库没有所需数据!');
judge:=false;
exit;
end;
DesQuery:=TADOQuery.create(self);
DesQuery.Connection:=ADOConnection1;
DesQuery.SQL.Add('delete from '+des);
DesQuery.ExecSQL;
DesQuery.SQL.Clear;
DesQuery.SQL.Add('select * from '+des+' where 城市代码='+''''+'022'+''''+' and 统计年份>='
+ComboBox11.text+' and 统计年份<='+ComboBox12.Text+
' and 统计月份>='+ComboBox13.text+' and 统计月份<='+ComboBox14.text);
DesQuery.Open;
SrcQuery.First;
while not SrcQuery.Eof do
begin
DesQuery.Append;
for i:=0 to SrcQuery.FieldCount-1 do
for j:=0 to DesQuery.FieldCount-1 do
if(SrcQuery.Fields[i].FieldName=DesQuery.Fields[j].FieldName)then
begin
if(SrcQuery.Fields[i].FieldName<>'ID')then
begin
DesQuery.Fields[j].Value:=SrcQuery.Fields[i].Value;
end;
end;
DesQuery.Post;
SrcQuery.Next;
end;
end;
procedure TOutputFrm.TradeTableToTableYear(src:string;des:string);
var
SrcQuery,DesQuery:TADOQuery;
i,j:integer;
Srcsqlstr,Dessqlstr:string;
begin
//导出公交行业统计年报
if(src='公交企业统计年报表')or(src='公交企业统计年报表_z')then
begin
Srcsqlstr:='select * from '+src+' where 企业代码 in '+EprSelect.TotalEpr
+' and 统计年份>='+combobox5.Text+' and 统计年份<='+combobox6.Text;
Dessqlstr:='select * from '+des+' where 企业代码 in '+EprSelect.TotalEpr
+' and 统计年份>='+combobox5.Text+' and 统计年份<='+combobox6.Text;
end;
IF(src='公交行业统计年报表') or(src='公交行业统计年报_z') then
begin
Srcsqlstr:='select * from '+src+' where 城市代码='+''''+'022'+''''+
' and 统计年份>='+ComboBox9.text+' and 统计年份<='+ComboBox10.text;
Dessqlstr:='select * from '+des+' where 城市代码='+''''+'022'+''''+
' and 统计年份>='+ComboBox9.text+' and 统计年份<='+ComboBox10.text;
end;
//导出公交行业综合年报
if(src='公交行业综合年报表') or (src='公交行业综合年报_z')then
begin
Srcsqlstr:='select * from '+src+' where '+
' 统计年份>='+ComboBox15.text+' and 统计年份<='+ComboBox16.text;
Dessqlstr:='select * from '+des+' where '+
' 统计年份>='+ComboBox15.text+' and 统计年份<='+ComboBox16.text;
end;
//导出公交行业城市交流指标表
if(src='公交行业城市交流指标表_z')or(src='公交行业城市交流指标表')then
begin
Srcsqlstr:='select * from '+src+' where 城市代码='+''''+'022'+''''+' and 统计年份>='
+combobox17.Text+' and 统计年份<='+combobox18.Text;
Dessqlstr:='select * from '+des+' where 城市代码='+''''+'022'+''''+' and 统计年份>='
+combobox17.Text+' and 统计年份<='+combobox18.Text;
end;
//导出公交行业城市规模指标表
if(src='公交行业城市规模指标表_z')or(src='公交行业城市规模指标表')then
begin
Srcsqlstr:='select * from '+src+' where 城市代码='+''''+'022'+''''+' and 统计年份>='
+combobox17.Text+' and 统计年份<='+combobox18.Text;
Dessqlstr:='select * from '+des+' where 城市代码='+''''+'022'+''''+' and 统计年份>='
+combobox17.Text+' and 统计年份<='+combobox18.Text;
end;
SrcQuery:=TADOQuery.create(self);
SrcQuery.Connection:=BusTradeDataModule.ADOConnection1;
SrcQuery.SQL.Add(Srcsqlstr);
SrcQuery.Open;
if (SrcQuery.RecordCount=0) then
begin
showmessage('导出的源数据库没有所需数据!');
judge:=false;
exit;
end;
DesQuery:=TADOQuery.create(self);
DesQuery.Connection:=ADOConnection1;
DesQuery.SQL.Add('delete from '+des);
DesQuery.ExecSQL;
DesQuery.SQL.Clear;
DesQuery.SQL.Add(Dessqlstr);
DesQuery.Open;
SrcQuery.First;
while not SrcQuery.Eof do
begin
DesQuery.Append;
for i:=0 to SrcQuery.FieldCount-1 do
for j:=0 to DesQuery.FieldCount-1 do
if(SrcQuery.Fields[i].FieldName=DesQuery.Fields[j].FieldName)then
begin
if(SrcQuery.Fields[i].FieldName<>'ID')then
begin
DesQuery.Fields[j].Value:=SrcQuery.Fields[i].Value;
end;
end;
DesQuery.Post;
SrcQuery.Next;
end;
end;
procedure TOutputFrm.BitBtn16Click(Sender: TObject);
begin
if ComboBox11.Text='' then
begin
showmessage('对不起!起始年份不能为空!请重新选择条件!');
exit;
end;
if ComboBox12.Text='' then
begin
showmessage('对不起!终止年份不能为空!请重新选择条件!');
exit;
end;
if StrToInt(ComboBox11.Text)>StrToInt(ComboBox12.Text) then
begin
showmessage('对不起!起始年份不能大于终止年份!请重新选择条件!');
exit;
end;
if ComboBox13.Text='' then
begin
showmessage('对不起!起始月份不能为空!请重新选择条件!');
exit;
end;
if ComboBox14.Text='' then
begin
showmessage('对不起!终止月份不能为空!请重新选择条件!');
exit;
end;
if StrToInt(ComboBox13.Text)>StrToInt(ComboBox14.Text) then
begin
showmessage('对不起!起始月份不能大于终止月份!请重新选择条件!');
exit;
end;
LookImportData4.Label1.Caption:='公交行业月报导出数据浏览';
LookImportData4.Edit1.Text:=ComboBox11.Text;
LookImportData4.Edit2.Text:=ComboBox12.Text;
LookImportData4.Edit3.Text:=ComboBox13.Text;
LookImportData4.Edit4.Text:=ComboBox14.Text;
LookImportData4.ADOQuery1.Connection:=ADOConnection1;
LookImportData4.ADOQuery1.SQL.Clear;
LookImportData4.ADOQuery1.SQL.Add('select a.统计年份 AS 统计年份, a.统计月份 AS 统计月份,'
+' b.指标名称 AS 指标名称, b.指标代码 AS 指标代码, b.单位 AS 单位, a.本月实际 AS 本月实际'
+' from 公交行业统计月报_z AS a, 公交行业统计月报指标定义表 AS b'
+' where 城市代码='+''''+'022'+''''+' and a.统计年份>='+ComboBox11.Text+' and a.统计年份<='+ComboBox12.Text+' and a.统计月份>='+ComboBox13.Text
+' and a.统计月份<='+ComboBox14.Text
+' and a.指标代码=b.指标代码 ORDER BY a.统计年份,a.统计月份,b.指标代码');
LookImportData4.ADOQuery1.Open;
LookImportData4.ShowModal;
end;
procedure TOutputFrm.BitBtn19Click(Sender: TObject);
begin
judge:=true;
if ComboBox11.Text='' then
begin
showmessage('对不起!起始年份不能为空!请重新选择条件!');
exit;
end;
if ComboBox12.Text='' then
begin
showmessage('对不起!终止年份不能为空!请重新选择条件!');
exit;
end;
if ComboBox13.Text='' then
begin
showmessage('对不起!起始月份不能为空!请重新选择条件!');
exit;
end;
if ComboBox14.Text='' then
begin
showmessage('对不起!终止月份不能为空!请重新选择条件!');
exit;
end;
if(not CheckFileSuc)then
begin
showmessage('请选择导出文件!');
exit;
end;
if StrToInt(ComboBox11.Text)>StrToInt(ComboBox12.Text) then
begin
showmessage('对不起!起始年份不能大于终止年份!请重新选择条件!');
exit;
end;
if StrToInt(ComboBox13.Text)>StrToInt(ComboBox14.Text) then
begin
showmessage('对不起!起始月份不能大于终止月份!请重新选择条件!');
exit;
end;
try
ReportName:='公交行业统计月报';
TradeTableToTableMonth('公交行业统计月报表','公交行业统计月报表');
if judge=false then exit;
TradeTableToTableMonth('公交行业统计月报_z','公交行业统计月报_z');
showmessage('公交行业统计月报数据导出成功!');
BitBtn18.Enabled:=true;
BitBtn5.Enabled:=true;
except
showmessage('数据导出失败!');
RichEdit1.Lines.Add('公交行业统计月报表导出失败');
end;
end;
procedure TOutputFrm.BitBtn20Click(Sender: TObject);
begin
if ComboBox9.Text='' then
begin
showmessage('对不起!起始年份不能为空!请重新选择条件!');
exit;
end;
if ComboBox10.Text='' then
begin
showmessage('对不起!终止年份不能为空!请重新选择条件!');
exit;
end;
if StrToInt(ComboBox9.Text)>StrToInt(ComboBox10.Text) then
begin
showmessage('对不起!起始年份不能大于终止年份!请重新选择条件!');
exit;
end;
LookImportData5.Label1.Caption:='公交行业统计年报导出数据浏览';
LookImportData5.Edit1.Text:=ComboBox9.Text;
LookImportData5.Edit2.Text:=ComboBox10.Text;
LookImportData5.ADOQuery1.Connection:=ADOConnection1;
LookImportData5.ADOQuery1.SQL.Clear;
LookImportData5.ADOQuery1.SQL.Add('select a.统计年份 as 统计年份,b.指标名称 as 指标名称,'
+' b.指标代码 as 指标代码, b.单位 as 单位,a.全年实际 as 全年实际'
+' from 公交行业统计年报_z as a, 公交行业统计年报指标定义表 as b'
+' where 城市代码='+''''+'022'+''''+' and a.统计年份>='+ComboBox9.Text+' and a.统计年份<='+ComboBox10.Text
+' and a.指标代码=b.指标代码 ORDER BY a.统计年份, b.指标代码');
LookImportData5.ADOQuery1.Open;
LookImportData5.ShowModal;
end;
procedure TOutputFrm.BitBtn21Click(Sender: TObject);
begin
judge:=true;
if(not CheckFileSuc)then
begin
showmessage('请选择导出文件!');
exit;
end;
if ComboBox9.Text='' then
begin
showmessage('对不起!起始年份不能为空!请重新选择条件!');
exit;
end;
if ComboBox10.Text='' then
begin
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?