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

📄 xsthbb.pas

📁 已经给出使用的每个SQL Server数据库
💻 PAS
📖 第 1 页 / 共 2 页
字号:
            else
              tab(-2,Na,-2,-2,10)
          end;
        end;
        Print(Azdmc[Cols*i]);
        if Cols<>1 then
          if m=0 then //折行时最后一行字段数等于指定的字段数
          begin
            For l:=1 to Cols-1 do
            begin
              settab(na,pjcenter,Azdkd[Cols*i+l],0,boxlineall,0);
                if l=Cols-1 then
                  tab(na,-2,-2,-2,10)
                else
                  tab(na,Na,-2,-2,10);
              Print(Azdmc[Cols*i+l]);
            end;
          end
          else //折行时最后一行字段数不等于指定的字段数
          begin
            if i= n-1 then //最后一行
              For l :=1 to m-1 do
              begin
                if m>0 then
                begin
                  settab(na,pjcenter,Azdkd[Cols*i+l],0,boxlineall,0);
                    if l=m-1 then
                      tab(na,-2,-2,-2,10)
                    else
                      tab(na,Na,-2,-2,10);
                  Print(Azdmc[Cols*i+l]);
                end;
              end
            else
            begin
              For l := 1 to Cols-1 do
              begin
                settab(na,pjcenter,Azdkd[Cols*i+l],0,boxlineall,0);
                  if l=cols-1 then
                    tab(na,-2,-2,-2,10)
                  else
                    tab(na,na,-2,-2,10);
                Print(Azdmc[Cols*i+l]);
              end;
            end;
          end;
        ClearTabs;
        setFont(BgFont.RFontName,BgFont.RFontSize);
        FontColor := BgFont.RFontColor;
        if (fsBold in BgFont.RFontStyle) then
          Bold := True
        else
          Bold := False;
        if (fsUnderline	 in BgFont.RFontStyle) then
          underline := True
        else
          underline := False;
        if (fsItalic	 in BgFont.RFontStyle) then
          Italic := True
        else
          Italic := False;
        if (fsStrikeOut	in BgFont.RFontStyle) then
          Strikeout := True
        else
          Strikeout := False;
        Case Content.Bgdqfs of
          0: Justify := pjLeft;
          1: Justify := pjRight;
          2: Justify := pjCenter;
        end;
        settab(zbj,Justify,Azdkd[Cols*i],0,boxlineall,0);
        if Cols<>1 then
          if m=0 then //折行时最后一行字段数等于指定的字段数
          begin
            For l:=1 to Cols-1 do
            begin
              settab(na,Justify,Azdkd[Cols*i+l],0,boxlineall,0);
            end;
          end
          else //折行时最后一行字段数不等于指定的字段数
          begin
            if i= n-1 then //最后一行
            begin
              if m>1 then
                For l :=1 to m-1 do
                  settab(na,Justify,Azdkd[Cols*i+l],0,boxlineall,0);
            end
            else
            begin
              For l := 1 to Cols-1 do
                settab(na,Justify,Azdkd[Cols*i+l],0,boxlineall,0);
            end;
          end;
        Data.Query2.First;
        println('');
        while Not Data.Query2.Eof do
        begin
          if m = 0 then
          begin
            For l:=0 to Cols-1 do
            begin
              if l=0 then//第一列
                if Cols<>1 then
                  Tab(-2,na,na,na,0)
                else
                  Tab(-2,-2,na,na,0)
              else if l=Cols-1 then //最后一列
                Tab(na,-2,na,na,0)
              else
                Tab(na,na,na,na,0);
              Print(Data.Query2.Fields[i*Cols+l].AsString);
            end;
          end
          else
          begin
            if i = n-1 then
            begin
              For l :=0 to m-1 do
              begin
                if l=0 then //第一列
                  if m>1 then
                    Tab(-2,na,na,na,0)
                  else
                    Tab(-2,-2,na,na,0)
                else if l=m-1 then //最后一列
                  Tab(na,-2,na,na,0)
                else
                  Tab(na,na,na,na,0);
                Print(Data.Query2.Fields[i*Cols+l].AsString);
              end;
            end
            else
            begin
              For l :=0 to Cols-1 do
              begin
                if l=0 then //第一列
                  Tab(-2,na,na,na,0)
                else if l=Cols-1 then //最后一列
                  Tab(na,-2,na,na,0)
                else
                  Tab(na,na,na,na,0);
                Print(Data.Query2.Fields[i*Cols+l].AsString);
              end;
            end;
          end;
          Println('');
          Data.Query2.Next;
        end;
      end;
    end;
end;

procedure Tf_xsthbb.dyClick(Sender: TObject);
begin
  Rprinter.Execute;
end;

procedure Tf_xsthbb.ylClick(Sender: TObject);
begin
  Application.CreateForm(Tf_xsthdysz,f_xsthdysz);
  f_xsthdysz.ShowModal;
  f_xsthdysz.Free;
end;

procedure Tf_xsthbb.cxClick(Sender: TObject);
begin
  if check1.Checked = True then
  begin
    if (Trim(zd.Text)<>'')and(Trim(zhi.Text)<>'') then
    begin
      if check2.Checked = False then
      begin
        with Data.Query2 do
        begin
          Close;
          SQL.Clear;
          if TempField <>'spmc' then
            SQL.Add('select aa.thph,aa.kcmc,aa.spdm,bb.spmc,aa.jbdw,aa.sl,aa.zk,aa.je,aa.bzq from t_xsthmx aa inner join t_spjcxx bb on aa.spdm = bb.spdm and aa.'+TempField + ' =:a')
          else
            SQL.Add('select aa.thph,aa.kcmc,aa.spdm,bb.spmc,aa.jbdw,aa.sl,aa.zk,aa.je,aa.bzq from t_xsthmx aa inner join t_spjcxx bb on aa.spdm = bb.spdm and bb.'+TempField + ' =:a');
          ParamByName('a').AsString := Trim(zhi.Text);
          Open;
        end;
        if Data.Query2.RecordCount>0 then
        begin
          DataSource1.DataSet := Data.Query2;
          dy.Enabled := True;
        end
        else
        begin
          DataSource1.DataSet := Nil;
          dy.Enabled := False;
          Application.MessageBox('没有符合条件的记录.','提示',64);
        end;
      end
      else
      begin
        if zzsj.DateTime<qssj.DateTime then
        begin
          Application.MessageBox('起始时间不能大于终止时间.','提示',64);
          Exit;
        end;
        with Data.Query2 do
        begin
          Close;
          SQL.Clear;
          if TempField <>'spmc' then
            SQL.Add('select a.thph,a.kcmc,a.spdm,b.spmc,a.jbdw,a.sl,a.zk,a.je,a.bzq from t_xsthmx a inner join t_spjcxx b on a.spdm = b.spdm and a.'+TempField + ' =:aa and a.bsph in (select thph from t_xsthph where sj >=:bb and sj<:cc )')
          else
            SQL.Add('select a.thph,a.kcmc,a.spdm,b.spmc,a.jbdw,a.sl,a.zk,a.je,a.bzq from t_xsthmx a inner join t_spjcxx b on a.spdm = b.spdm and b.'+TempField + ' =:aa and a.bsph in (select thph from t_xsthph where sj >=:bb and sj<:cc )');
          ParamByName('aa').AsString := Trim(zhi.Text);
          ParamByName('bb').AsDate := Trunc(qssj.DateTime)-2;
          ParamByName('cc').AsDate := Trunc(zzsj.DateTime)-2+1;
          Open;
        end;
        if Data.Query2.RecordCount>0 then
        begin
          DataSource1.DataSet := Data.Query2;
          dy.Enabled := True;
        end
        else
        begin
          DataSource1.DataSet := Nil;
          dy.Enabled := False;
          Application.MessageBox('没有符合条件的记录.','提示',64);
        end;
      end;
    end;
  end
  else if check2.Checked = True then
  begin
    if zzsj.DateTime<qssj.DateTime then
    begin
      Application.MessageBox('起始时间不能大于终止时间.','提示',64);
      Exit;
    end;
    with Data.Query2 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select aa.thph,aa.kcmc,aa.spdm,bb.spmc,aa.jbdw,aa.sl,aa.zk,aa.je,aa.bzq from t_xsthmx aa inner join t_spjcxx bb on  aa.thph in (select thph from t_xsthph where sj>= :b and sj<:c)');
      ParamByName('b').AsDate := Trunc(qssj.DateTime)-2;
      ParamByName('c').AsDate := Trunc(zzsj.DateTime)-2+1;
      Open;
    end;
    if Data.Query2.RecordCount>0 then
    begin
      DataSource1.DataSet := Data.Query2;
      dy.Enabled := True;
    end
    else
    begin
      DataSource1.DataSet := Nil;
      dy.Enabled := False;
      Application.MessageBox('没有符合条件的记录.','提示',64);
    end;
  end
  else
    Application.MessageBox('请设置查询条件.','提示',64);
end;

end.

⌨️ 快捷键说明

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