tradeoutputunit.~pas

来自「公交行业的管理系统」· ~PAS 代码 · 共 1,570 行 · 第 1/5 页

~PAS
1,570
字号
                showmessage('导出的源数据库没有所需数据!');
                judge:=false;
                exit;
        end;

        SrcQuery.First;
        while not SrcQuery.Eof do
        begin
                ClientDataSet1.Append;
                for i:=0 to ClientDataSet1.FieldCount-1 do
                        for j:=0 to SrcQuery.FieldCount-1 do
                        if(ClientDataSet1.Fields[i].FieldName=SrcQuery.Fields[j].FieldName)then
                        begin
                                        if(ClientDataSet1.Fields[i].FieldName<>'ID')then
                                        begin
                                                ClientDataSet1.Fields[i].Value:=SrcQuery.Fields[j].Value;
                                                break;
                                        end;
                        end;
                ClientDataSet1.Post;
                SrcQuery.Next;
        end;
        ClientDataSet1.SaveToFile(curPath);
        judge:=true;
end;

procedure TTradeOutputFrm.BitBtn16Click(Sender: TObject);
begin
        if ComboBox11.Text='' then
        begin
                showmessage('对不起!"起始年份"不能为空!请重新选择条件!');
                exit;
        end;
        if ComboBox12.Text='' then
        begin
                showmessage('对不起!"终止年份"不能为空!请重新选择条件!');
                exit;
        end;
        if (Length(ComboBox11.Text)<>4) or (Length(ComboBox12.Text)<>4) then
        begin
                showmessage('对不起!您选择的年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox11.Text);
        except
                showmessage('起始年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox12.Text);
        except
                showmessage('终止年份非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox11.Text)<1900) or (StrToInt(ComboBox11.Text)>3000) then
        begin
                showmessage('对不起!您选择的"起始年份"非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox12.Text)<1900) or (StrToInt(ComboBox12.Text)>3000) 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;
        Application.CreateForm(TLookImportData4, LookImportData4);

        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:=BusTradeDataModule.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 TTradeOutputFrm.BitBtn19Click(Sender: TObject);
begin
        judge:=true;
        if ComboBox11.Text='' then
        begin
                showmessage('对不起!"起始年份"不能为空!请重新选择条件!');
                exit;
        end;
        if ComboBox12.Text='' then
        begin
                showmessage('对不起!"终止年份"不能为空!请重新选择条件!');
                exit;
        end;
        if (Length(ComboBox11.Text)<>4) or (Length(ComboBox12.Text)<>4) then
        begin
                showmessage('对不起!您选择的年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox11.Text);
        except
                showmessage('起始年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox12.Text);
        except
                showmessage('终止年份非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox11.Text)<1900) or (StrToInt(ComboBox11.Text)>3000) then
        begin
                showmessage('对不起!您选择的"起始年份"非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox12.Text)<1900) or (StrToInt(ComboBox12.Text)>3000) then
        begin
                showmessage('对不起!您选择的"终止年份"非法!请重新选择!');
                exit;
        end;
        if ComboBox13.Text='' then
        begin
                showmessage('对不起!"起始月份"不能为空!请重新选择条件!');
                exit;
        end;
        if ComboBox14.Text='' then
        begin
                showmessage('对不起!"终止月份"不能为空!请重新选择条件!');
                exit;
        end;
        {if(not CheckFileSuc) or (Edit1.Text='')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
          Screen.Cursor:=crHourGlass;
          TradeTableToTableMonth('gjhymonth.data','公交行业统计月报表');
          if judge=false then StrToInt('sf');
          TradeTableToTableMonth('gjhymonth_z.data','公交行业统计月报_z');
          if judge=false then StrToInt('sf');
          showmessage('公交行业统计月报数据导出成功!');
          RichEdit1.Lines.Add('公交行业统计月报数据导出成功');
        except
          showmessage('数据导出失败!');
          RichEdit1.Lines.Add('公交行业统计月报表导出失败');
        end;
        Screen.Cursor:=crDefault;
end;

procedure TTradeOutputFrm.BitBtn20Click(Sender: TObject);
begin
        if ComboBox9.Text='' then
        begin
                showmessage('对不起!"起始年份"不能为空!请重新选择条件!');
                exit;
        end;
        if ComboBox10.Text='' then
        begin
                showmessage('对不起!"终止年份"不能为空!请重新选择条件!');
                exit;
        end;
        if (Length(ComboBox9.Text)<>4) or (Length(ComboBox10.Text)<>4) then
        begin
                showmessage('对不起!您选择的年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox9.Text);
        except
                showmessage('起始年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox10.Text);
        except
                showmessage('终止年份非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox9.Text)<1900) or (StrToInt(ComboBox9.Text)>3000) then
        begin
                showmessage('对不起!您选择的"起始年份"非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox10.Text)<1900) or (StrToInt(ComboBox10.Text)>3000) then
        begin
                showmessage('对不起!您选择的"终止年份"非法!请重新选择!');
                exit;
        end;
        if StrToInt(ComboBox9.Text)>StrToInt(ComboBox10.Text) then
        begin
                showmessage('对不起!"起始年份"不能大于"终止年份"!请重新选择条件!');
                exit;
        end;
        Application.CreateForm(TLookImportData5, LookImportData5);

        LookImportData5.Label1.Caption:='公交行业统计年报导出数据浏览';
        LookImportData5.Edit1.Text:=ComboBox9.Text;
        LookImportData5.Edit2.Text:=ComboBox10.Text;
        LookImportData5.ADOQuery1.Connection:=BusTradeDataModule.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 TTradeOutputFrm.BitBtn21Click(Sender: TObject);
begin
        judge:=true;
        {if(not CheckFileSuc) or (Edit1.Text='')then
        begin
                showmessage('请选择导出文件!');
                exit;
        end;}
        if ComboBox9.Text='' then
        begin
                showmessage('对不起!"起始年份"不能为空!请重新选择条件!');
                exit;
        end;
        if ComboBox10.Text='' then
        begin
                showmessage('对不起!"终止年份"不能为空!请重新选择条件!');
                exit;
        end;
        if (Length(ComboBox9.Text)<>4) or (Length(ComboBox10.Text)<>4) then
        begin
                showmessage('对不起!您选择的年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox9.Text);
        except
                showmessage('起始年份非法!请重新选择!');
                exit;
        end;
        try
                temp:=StrToInt(ComboBox10.Text);
        except
                showmessage('终止年份非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox9.Text)<1900) or (StrToInt(ComboBox9.Text)>3000) then
        begin
                showmessage('对不起!您选择的"起始年份"非法!请重新选择!');
                exit;
        end;
        if (StrToInt(ComboBox10.Text)<1900) or (StrToInt(ComboBox10.Text)>3000) then
        begin
                showmessage('对不起!您选择的"终止年份"非法!请重新选择!');
                exit;
        end;
        if StrToInt(ComboBox9.Text)>StrToInt(ComboBox10.Text) then
        begin
                showmessage('对不起!"起始年份"不能大于"终止年份"!请重新选择条件!');
                exit;
        end;
        try
          Screen.Cursor:=crHourGlass;
          TradeTableToTableYear('gjhyyear.data','公交行业统计年报表');
          if judge=false then StrToInt('sf');
          TradeTableToTableYear('gjhyyear_z.data','公交行业统计年报_z');
          if judge=false then StrToInt('sf');
          showmessage('公交行业统计年报数据导出成功!');
          RichEdit1.Lines.Add('公交行业统计年报数据导出成功');
        except
          showmessage('数据导出失败!');
          RichEdit1.Lines.Add('公交行业统计年报表导出失败');
        end;
        Screen.Cursor:=crDefault;
end;

procedure TTradeOutputFrm.BitBtn23Click(Sender: TObject);
begin
        judge:=true;
        {if(not CheckFileSuc)then

⌨️ 快捷键说明

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