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

📄 mc_dloptions.~pas

📁 1、系统环境要求:所有程序均在Windows98/XP操作系统下测试运行。 2、建议用户在系统上安装DELPHI7.0企业版。 3、如果数据库为SQL Server数据库
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit MC_DLOptions;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DBTables, Db, StdCtrls, Buttons, Grids, DBGrids, DBCtrls;

type
  TDLOptions = class(TForm)
    GroupBox1: TGroupBox;
    DBLookupComboBox1: TDBLookupComboBox;
    GroupBox2: TGroupBox;
    DBGrid1: TDBGrid;
    GroupBox3: TGroupBox;
    ListBox1: TListBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    Table2: TTable;
    Table2BDEDesigner2: TStringField;
    Table2BDEDesigner5: TIntegerField;
    Table2BDEDesigner6: TStringField;
    Table2BDEDesigner7: TStringField;
    Table2BDEDesigner: TStringField;
    Query1: TQuery;
    Query1BDEDesigner: TStringField;
    Query1BDEDesigner2: TStringField;
    procedure DBGrid1DblClick(Sender: TObject);
    procedure ListBox1DblClick(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DLOptions: TDLOptions;

implementation

uses MC_SFYL, MC_FWXXDJ;

{$R *.DFM}

procedure TDLOptions.DBGrid1DblClick(Sender: TObject);
var a,b:integer;
begin
     For a:=0 to ListBox1.Items.Count-1 do
     begin
          if ListBox1.Items.Strings[a]=Table2.FieldByName('大楼编号').AsString then
             begin
                  b:=0;
                  Break;
             end else b:=1;
     end;
     if b=0 then
        begin
             ShowMessage('此大楼以被选种!!');
        end
     else
        begin
             ListBox1.Items.Add(Table2.FieldByName('大楼编号').AsString);
        end;
end;

procedure TDLOptions.ListBox1DblClick(Sender: TObject);
begin
     if ListBox1.Items.Count<>0 then
        begin
             ListBox1.Items.Delete(ListBox1.ItemIndex);
        end;
end;

procedure TDLOptions.BitBtn3Click(Sender: TObject);
begin
     Close;
end;

procedure TDLOptions.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     DLOptions.Release;
     DLOptions:=Nil;
end;

procedure TDLOptions.BitBtn1Click(Sender: TObject);
var ZD: String;
    ZDZ: Array of String;
    a,b,c:integer;
    S,d:Real;
    Fi:STring;
begin
     if ListBox1.Items.Count=0 then
        begin
             ShowMessage('请选择要浏览的大楼.');
        end
     else
        begin
             SetLength(ZDZ,ListBox1.Items.Count);//分配动态变量,记得释放掉
             ZD:='大楼编号';
             //-----------------------------------------------------------------
             SFYL.Query1.Close;
             SFYL.Query1.SQL.Clear;
             SFYL.Query1.SQL.Add('Select * From 水费 Where');
             SFYL.Query1.SQL.Add('水表编号 in (Select 房间编号 From 房屋信息表 Where 大楼编号=:A');
             SFYL.Query1.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
             For a:=1 to ListBox1.Items.Count-1 do
                 begin
                      ZDZ[a]:=ListBox1.Items.Strings[a];
                      SFYL.Query1.SQL.Add('or 大楼编号='''+ZDZ[a]+'''');
                      //SFYL.Query1.ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
                 end;
             SFYL.Query1.SQL.Add(')');
             SFYL.Query1.Open;
             //-----------------------------------------------------------------
             SFYL.Query2.Close;
             SFYL.Query2.SQL.Clear;
             SFYL.Query2.SQL.Add('Select * From 电费 Where');
             SFYL.Query2.SQL.Add('电表编号 in (Select 房间编号 From 房屋信息表 Where 大楼编号=:A');
             SFYL.Query2.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
             For a:=1 to ListBox1.Items.Count-1 do
                 begin
                      ZDZ[a]:=ListBox1.Items.Strings[a];
                      SFYL.Query2.SQL.Add('or 大楼编号='''+ZDZ[a]+'''');
                      //SFYL.Query2.ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
                 end;
             SFYL.Query2.SQL.Add(')');
             SFYL.Query2.Open;
             //-----------------------------------------------------------------
             SFYL.Query3.Close;
             SFYL.Query3.SQL.Clear;
             SFYL.Query3.SQL.Add('Select * From 煤气费 Where');
             SFYL.Query3.SQL.Add('煤气表编号 in (Select 房间编号 From 房屋信息表 Where 大楼编号=:A');
             SFYL.Query3.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
             For a:=1 to ListBox1.Items.Count-1 do
                 begin
                      ZDZ[a]:=ListBox1.Items.Strings[a];
                      SFYL.Query3.SQL.Add('or 大楼编号='''+ZDZ[a]+'''');
                      //SFYL.Query3.ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
                 end;
             SFYL.Query3.SQL.Add(')');
             SFYL.Query3.Open;
             //-----------------------------------------------------------------
//--------------
             SFYL.StringGrid2.ColCount:=2;
             SFYL.StringGrid2.RowCount:=2;
             SFYL.StringGrid2.FixedRows:=1;
             SFYL.StringGrid2.FixedCols:=1;
             with SFYL.Query4 do
             begin
                  Close;
                  SQL.Clear;
                  SQL.Add('Select Distinct 费用科目 From 其它费用表 ORDER BY 费用科目 ASC');
                  Open;
                  with SFYL.StringGrid2 do
                       begin
                            ColCount:=2+1+2*RecordCount+1;
                            Cells[1,0]:='收费编号';
                            ColWidths[1]:=100;
                            Cells[2,0]:='姓名';
                            ColWidths[2]:=50;
                            Cells[ColCount-1,0]:='共余额';
                            ColWidths[ColCount-1]:=50;
                            a:=2;
                            while not EOF do
                            begin
                                 a:=a+1;
                                 Cells[A,0]:='应收'+FieldByName('费用科目').AsString;
                                 Colwidths[a]:=80;
                                 a:=a+1;
                                 Cells[A,0]:='实收'+FieldByName('费用科目').AsString;
                                 Colwidths[a]:=80;
                                 Next;
                            end;
                       end;
                  //-------
                  Close;
                  SQL.Clear;
                  SQL.Add('Select Distinct 收费编号 From 其它费用表');
                  SQL.Add('Where 收费编号 in (Select 房间编号 From 房屋信息表');
                  SQL.Add('Where 大楼编号=:A');
                  ParamByName('A').AsString:=ListBox1.Items.Strings[0];
                  For a:=1 to ListBox1.Items.Count-1 do
                      begin
                           ZDZ[a]:=ListBox1.Items.Strings[a];;
                           SQL.Add('or 大楼编号='''+ZDZ[a]+'''');
                           //ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];

⌨️ 快捷键说明

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