unit U_login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, DBCtrls;

type
  Tfrm_Login = class(TForm)
    EditUsuario: TEdit;
    Label1: TLabel;
    EditSenha: TEdit;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Label3: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frm_Login: Tfrm_Login;

implementation

uses U_Quadrangular, U_configuracao, U_con_Membros, UDM_dados,
  U_relConMembros;

{$R *.dfm}

procedure Tfrm_Login.Button1Click(Sender: TObject);
begin
frmConfSist.checkbox1.Checked := true;
frmConfSist.checkbox16.Checked := true ;
frmConfSist.checkbox31.Checked := true ;
frmConfSist.checkbox46.Checked := true ;
frmConfSist.checkbox61.Checked := true ;
frmConfSist.checkbox76.Checked := true ;

if frm_Login.EditUsuario.Text = frmConfSist.DBEdit21.text then
  begin
     if frm_Login.EditSenha.Text = frmConfSist.DBEdit22.text then
       begin
       frmQuadrangular.EditLogin.Text := '1';

       frmQuadrangular.Edit1.Text := FormatDateTime('dd',Date);
       frmQuadrangular.Edit2.Text := FormatDateTime('MM',Date);
       frmCons_Membros.EditDatIni.Text := frmQuadrangular.Edit1.Text + '/' + frmQuadrangular.Edit2.Text + '/';
            if frmQuadrangular.DBEdit1.Text > '0' then
            begin
            ShowMessage(frmConfSist.DBEdit23.Text);
            frmRelConsMembros.QuickRep1.Preview;
            end;
       frm_Login.Hide ;
       end
  end

ELSE

if frm_Login.EditUsuario.Text <> frmConfSist.DBEdit21.text then
ShowMessage ('Senha Incorreta');
if frm_Login.EditSenha.Text <> frmConfSist.DBEdit22.text then
ShowMessage ('Senha Incorreta');









end;

procedure Tfrm_Login.Button2Click(Sender: TObject);
begin
     frmQuadrangular.EditLogin.Text := '1'  ;
     frmQuadrangular.close;
end;

procedure Tfrm_Login.FormKeyPress(Sender: TObject; var Key: Char);
begin
If key = #13 then
  Begin
  Key:= #0;
  Perform(Wm_NextDlgCtl,0,0);
  end;
end;

procedure Tfrm_Login.FormActivate(Sender: TObject);
begin
frmQuadrangular.foto.left := trunc((frmQuadrangular.width - frmQuadrangular.foto.width) / 2);
frmQuadrangular.foto.top := trunc((frmQuadrangular.height - frmQuadrangular.foto.height) / 2);
end;

procedure Tfrm_Login.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     frmQuadrangular.EditLogin.Text := '1'  ;
     frmQuadrangular.close;
end;

end.
