unit WinPhone;

interface

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

type
  TForm1 = class(TForm)
    Table1: TTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    Table1P1_FIO: TStringField;
    Table1P1_NOM: TStringField;
    Table1P1_ADR1: TStringField;
    Table1INDSTREET: TStringField;
    Table1P1_NDOM: TStringField;
    Table1P1_INDDOM: TStringField;
    Table1P1_NKVART: TStringField;
    Table1PARALEL: TSmallintField;
    StatusBar1: TStatusBar;
    Edit1: TEdit;
    procedure N2Click(Sender: TObject);
    procedure N3Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


procedure TForm1.N2Click(Sender: TObject);
begin
IF NOT FileExists('phone_ab.dbf') THEN BEGIN
   ShowMessage ('Нету базы даных абонентов')
END;
Table1.TableName:='phone_ab.dbf';
{Table1P1_FIO.name:='P1_FIO';
Table1P1_NOM.name:='P1_NOM';
DbGrid1.Columns[0].FieldName:='P1_FIO';
DbGrid1.Columns[1].FieldName:='P1_NOM';}

Table1.Open;
Table1.First;
{StatusBar1.Panels[0].Text:='Всего записей:';}
StatusBar1.Panels[0].Text:=Format('Всего записей: %d',[Table1.RecordCount]);
{StatusBar1.Panels[1].text:=Format('Текущая: %d',[DbGrid1.records.recno]);}

end;

procedure TForm1.N3Click(Sender: TObject);
begin
IF NOT FileExists('phoneor0.dbf') THEN BEGIN
   ShowMessage ('Нету базы даных абонентов')
END;
Table1.TableName:='phoneor0.dbf';
{Table1P1_FIO.name:='ORG';
Table1P1_NOM.name:='ADR'; }
DbGrid1.Columns[0].FieldName:='ORG';
DbGrid1.Columns[1].FieldName:='ADR';
Table1.Open;
Table1.First;

end;


procedure TForm1.Edit1Change(Sender: TObject);
begin
Table1.Filter:= 'P1_FIO=Edit1.Text';
Table1.Filtered:=True
{StatusBar1.Panels[0].Text:=Edit1.Text;}
end;

end.
