unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables;

type
  TDM = class(TDataModule)
    lectii: TTable;
    s_lectii: TDataSource;
    teste: TTable;
    itemi: TTable;
    rasp: TTable;
    elevi: TTable;
    rezult: TTable;
    S_teste: TDataSource;
    s_itemi: TDataSource;
    s_rasp: TDataSource;
    s_elevi: TDataSource;
    s_rezult: TDataSource;
    rezultCod_elev: TIntegerField;
    rezultCod_test: TIntegerField;
    rezultPuncte: TSmallintField;
    rezultNota: TSmallintField;
    rezultden_test: TStringField;
    info: TTable;
    s_info: TDataSource;
    procedure testeAfterScroll(DataSet: TDataSet);
    procedure itemiAfterScroll(DataSet: TDataSet);
    procedure eleviAfterScroll(DataSet: TDataSet);
    procedure DataModuleCreate(Sender: TObject);
    procedure DataModuleDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DM: TDM;

implementation

{$R *.DFM}

procedure TDM.testeAfterScroll(DataSet: TDataSet);
begin
itemi.filtered:=false;
if teste['cod']<>NULL then itemi.Filter:='cod_test='+inttostr(teste['cod']);
itemi.Filtered:=true;
end;

procedure TDM.itemiAfterScroll(DataSet: TDataSet);
begin
rasp.Filtered:=false;
if itemi['cod']<>NULL then rasp.Filter:='cod_itemi='+inttostr(itemi['cod']);
rasp.Filtered:=true;
end;

procedure TDM.eleviAfterScroll(DataSet: TDataSet);
begin
rezult.Filtered:=false;
if elevi['cod']<>NULL then rezult.Filter:='cod_elev='+inttostr(elevi['cod']);
rezult.Filtered:=true;
end;

procedure TDM.DataModuleCreate(Sender: TObject);
begin
lectii.Active:=true;
teste.Active:=true;
itemi.Active:=true;
rasp.Active:=true;
elevi.Active:=true;
rezult.Active:=true;
end;

procedure TDM.DataModuleDestroy(Sender: TObject);
begin
lectii.Active:=false;
teste.Active:=false;
itemi.Active:=false;
rasp.Active:=false;
elevi.Active:=false;
rezult.Active:=false;
end;

end.
