procedure TFLogin.BtnOkClick(Sender: TObject);
begin
LoginOK :=False;
AdoQuery1.Parameters.ParamByName('Cod').Value:= Edit1.Text;
AdoQuery1.Active:= True;
// Edit1.Text:= AdoQuery1.Fields[0].AsString;
If AdoQuery1.Fields[3].AsString = '1' then
// todo
begin
// todo
end;
If AdoQuery1.Fields[3].AsString = '2' then
// bodega
begin
FmainForm.BitBtn15.Enabled := False;
FmainForm.BitBtn14.Enabled := True;
FmainForm.BitBtn8.Enabled := True;
FmainForm.BitBtn23.Enabled := False;
FmainForm.BitBtn24.Enabled := False;
FmainForm.PopupMenu7.Items[7].Enabled:= False;
FmainForm.PopupMenu7.Items[8].Enabled:= False;
end;
If AdoQuery1.Fields[3].AsString = '3' then
// produccion, acabado, acrilico
begin
FmainForm.BitBtn6.Enabled := False;
FmainForm.BitBtn7.Enabled := False;
FmainForm.BitBtn1.Enabled := False;
FmainForm.BitBtn15.Enabled := False;
FmainForm.BitBtn13.Enabled := False;
FmainForm.BitBtn4.Enabled := False;
FmainForm.BitBtn14.Enabled := False;
FmainForm.BitBtn8.Enabled := False;
FmainForm.BitBtn27.Enabled := False;
FmainForm.BitBtn21.Enabled := False;
FmainForm.BitBtn22.Enabled := False;
FmainForm.PopupMenu7.Items[22].Enabled:= False;
FmainForm.PopupMenu7.Items[23].Enabled:= False;
FmainForm.PopupMenu7.Items[24].Enabled:= False;
FmainForm.PopupMenu7.Items[25].Enabled:= False;
FmainForm.PopupMenu7.Items[26].Enabled:= False;
end;
If AdoQuery1.Fields[3].AsString = '4' then
// recepcion
begin
FmainForm.BitBtn1.Enabled := False;
FmainForm.BitBtn3.Enabled := False;
FmainForm.BitBtn5.Enabled := False;
FmainForm.BitBtn7.Enabled := False;
FmainForm.BitBtn8.Enabled := False;
FmainForm.BitBtn27.Enabled := False;
FmainForm.BitBtn24.Enabled := False;
FmainForm.Timer2.Enabled := False;
FmainForm.PopupMenu7.Items[10].Enabled:= False;
FmainForm.PopupMenu7.Items[11].Enabled:= False;
FmainForm.PopupMenu7.Items[12].Enabled:= False;
FmainForm.PopupMenu7.Items[13].Enabled:= False;
FmainForm.PopupMenu7.Items[14].Enabled:= False;
FmainForm.PopupMenu7.Items[15].Enabled:= False;
FmainForm.PopupMenu7.Items[16].Enabled:= False;
FmainForm.PopupMenu7.Items[19].Enabled:= False;
end;
If AdoQuery1.Fields[3].AsString = '5' then
// asistente
begin
FmainForm.BitBtn17.Enabled := False;
FmainForm.BitBtn25.Enabled := False;
FmainForm.PopupMenu7.Items[15].Enabled:= False;
FmainForm.PopupMenu7.Items[16].Enabled:= False;
FmainForm.Recibos.Items[0].Enabled:= False;
end;
If AdoQuery1.RecordCount < 1 then
Begin
Cuenta := Cuenta + 1;
MessageDlg('Usuario no encontrado',mtError, [mbOK], 0);
Edit1.Text := '';
Edit2.Text := '';
AdoQuery1.Active := False;
If Cuenta = 3 then Close;
end
else
If AdoQuery1Clave.AsString = Edit2.Text then
Begin
LoginOk := True;
Usuario := AdoQuery1CodUsuario.AsString;
Nombre := AdoQuery1Nombre.AsString;
AdoQuery1.Active := False;
Close;
end
else
Begin
Cuenta := Cuenta + 1;
MessageDlg('Clave Inválida',mtError, [mbOK], 0);
Edit2.Text := '';
AdoQuery1.Active := False;
If Cuenta = 3 then Close;
end;
end;