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

📄 flfpbdy.pas

📁 北京铁路局住房分配系统,数据库为MSSql2000,依次执行crebas4.sql
💻 PAS
字号:
unit Flfpbdy;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtrls, CELLLib_TLB, ExtCtrls;

type
  TFormFLFPBDY = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Cell1: TCell;
    Label1: TLabel;
    Button1: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Panel3: TPanel;
    Button2: TButton;
    ComboBox1: TComboBox;
    Label2: TLabel;
    procedure Button6Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
    RC:smallint; //纪录行数
  public
    { Public declarations }
  end;

var
  FormFLFPBDY: TFormFLFPBDY;

implementation

uses datamodl,PublicFun;

{$R *.dfm}

procedure TFormFLFPBDY.Button6Click(Sender: TObject);
begin
  close;
end;

procedure TFormFLFPBDY.Button1Click(Sender: TObject);
var
  opendlg:TOpendialog;
  Sfilename:string;
  i,j:smallint;
begin
  opendlg:=TOpendialog.create(Application);
  opendlg.DefaultExt:='CLL';
  opendlg.filter:='报表格式文件(*.CLL)|*.CLL';
  if opendlg.execute then
  begin
     Sfilename :=opendlg.filename;
     if not comp(sfilename,'小区住房分配表') then
       begin
         showmessage('请打开指定名称结构文件!');
         exit;
       end;
     if cell1.DoOpenFile(Sfilename)>0 then
     begin
       cell1.DoRedrawAll ;
       for i:=0 to 8 do
         for j:=0 to 54 do
           cell1.DoSetCellReadOnly(i,j,true);
     end;
     button2.Enabled:=true;
     button3.Enabled:=true;
     button4.Enabled:=true;
     button5.Enabled:=true;
  end;
  opendlg.free;
end;

procedure TFormFLFPBDY.FormCreate(Sender: TObject);
begin
   cell1.DoLogin('北京金天鹏软件科技有限公司',363,'00FD18FF080193035CFE09FF9908');
   RC:=0;
   cell1.EnablePopMenu:=false;
   button2.Enabled:=false;
   button3.Enabled:=false;
   button4.Enabled:=false;
   button5.Enabled:=false;
  with datamodule1 do
  begin
    if ADOQry.Active= true then ADOQry.close;
    ADOQry.sql.Clear;
    ADOQry.sql.Add('select bh,mc from fwytb where bh<>''99''');
    ADOQry.open;
    ADOQry.first;
    while not ADOQry.Eof  do
    begin
      combobox1.Items.Add(ADOQry.fieldbyname('bh').AsString+' | '
                         +ADOQry.fieldbyname('mc').AsString);
      ADOQry.Next;
    end;
    ADOQry.Close;

  end;
end;

procedure TFormFLFPBDY.Button2Click(Sender: TObject);
var
  i:smallint;
  yt,ytmc:string;
begin
  if trim(combobox1.Text)<>'' then
    begin
      yt:= copy(trim(combobox1.Text),1,2);
      ytmc:= copy(trim(combobox1.Text),6,8);
      cell1.DoSetCellString(0,0,'小区'+ytmc+'住房分配表');
    end
  else
    begin
      showmessage('住房用途不能为空,请选择!');
      exit;
    end;
  if RC <> 0 then
    for i:=1 to RC do
    begin
      cell1.DoSetCellReadOnly(0,i+2,false);
      cell1.DoClearCell(0,i+2,1);
      cell1.DoSetCellReadOnly(0,i+2,true);
      cell1.DoSetCellReadOnly(1,i+2,false);
      cell1.DoClearCell(1,i+2,1);
      cell1.DoSetCellReadOnly(1,i+2,true);
      cell1.DoSetCellReadOnly(2,i+2,false);
      cell1.DoClearCell(2,i+2,1);
      cell1.DoSetCellReadOnly(2,i+2,true);
      cell1.DoSetCellReadOnly(3,i+2,false);
      cell1.DoClearCell(3,i+2,1);
      cell1.DoSetCellReadOnly(3,i+2,true);
      cell1.DoSetCellReadOnly(4,i+2,false);
      cell1.DoClearCell(4,i+2,1);
      cell1.DoSetCellReadOnly(4,i+2,true);
      cell1.DoSetCellReadOnly(5,i+2,false);
      cell1.DoClearCell(5,i+2,1);
      cell1.DoSetCellReadOnly(5,i+2,true);
      cell1.DoSetCellReadOnly(6,i+2,false);
      cell1.DoClearCell(6,i+2,1);
      cell1.DoSetCellReadOnly(6,i+2,true);
      cell1.DoSetCellReadOnly(7,i+2,false);
      cell1.DoClearCell(7,i+2,1);
      cell1.DoSetCellReadOnly(7,i+2,true);
      cell1.DoSetCellReadOnly(8,i+2,false);
      cell1.DoClearCell(8,i+2,1);
      cell1.DoSetCellReadOnly(8,i+2,true);
    end;
  cell1.DoRedrawAll;
  with datamodule1 do
  begin
    if ADOQry.Active= true then ADOQry.close;
    ADOQry.sql.Clear;
    Adoqry.SQL.Add('select dwmc,yjsl,ejsl,sjsl,fsej,fssj,qt,hj'+#10+
                   'from zgfpb a, dwxxb b '+#10+
                   'where a.dwbh =b.dwbh and a.ytbh=:ytbh');
    Adoqry.Parameters.ParamByName('ytbh').Value:=yt;
    ADOQry.open;
    ADOQry.First;
    RC:= ADOQry.RecordCount;
    if RC <= 26 then
      cell1.DoSetPrintRange(0,8,0,28);
    i:=1;
    while not ADOQry.Eof do
      begin
        Cell1.DoSetCellString(0,i+2,inttostr(i));
        Cell1.DoSetCellString(1,i+2,Adoqry.fieldbyname('dwmc').AsString);
        Cell1.DoSetCellString(2,i+2,Adoqry.fieldbyname('yjsl').AsString);
        Cell1.DoSetCellString(3,i+2,Adoqry.fieldbyname('ejsl').AsString);
        Cell1.DoSetCellString(4,i+2,Adoqry.fieldbyname('sjsl').AsString);
        Cell1.DoSetCellString(5,i+2,Adoqry.fieldbyname('fsej').AsString);
        Cell1.DoSetCellString(6,i+2,Adoqry.fieldbyname('fssj').AsString);
        Cell1.DoSetCellString(7,i+2,Adoqry.fieldbyname('qt').AsString);
        Cell1.DoSetCellString(8,i+2,Adoqry.fieldbyname('hj').AsString);
        ADOQry.Next;
        if not ADOQry.Eof then
          i:=i+1;
      end;
    ADOQry.Close;
    cell1.DoRedrawAll;
  end;
end;

procedure TFormFLFPBDY.Button3Click(Sender: TObject);
begin
   cell1.DoPrintPageSetup;
end;

procedure TFormFLFPBDY.Button4Click(Sender: TObject);
begin
  cell1.DoPrintPreview(true);
end;

procedure TFormFLFPBDY.Button5Click(Sender: TObject);
begin
  cell1.DoPrint(false);
end;

end.

⌨️ 快捷键说明

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