unit USOCIETESESELECT;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, Grids, DBGrids, ExtCtrls, Menus, Mask,
  ToolEdit, dxCore, dxButton, IBCustomDataSet, IBQuery;

type
  TfrmSOCIETESESELECT = class(TForm)
    Panel1: TPanel;
    GridClient: TDBGrid;
    Dssociete: TDataSource;
    BtnOk: TBitBtn;
    Panel5: TPanel;
    eCode: TEdit;
    Label1: TLabel;
    PopupMenuGrid: TPopupMenu;
    Ajouter1: TMenuItem;
    Modifier1: TMenuItem;
    Supprimer1: TMenuItem;
    societes: TIBQuery;
    societesMFISCALLIE: TIBStringField;
    societesAUTREIDENTIFIANT: TIBStringField;
    societesRAISONSOCIALE: TIBStringField;
    societesETATTERRITOIRE: TIBStringField;
    societesPOURCENTCAPITAL: TIBBCDField;
    societesPOURVENVOTE: TIBBCDField;
    societesQUALITE: TIBStringField;
    societesAUTREQUALITE: TIBStringField;
    BitBtn4: TBitBtn;
    procedure eCodeChange(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BtnOkClick(Sender: TObject);
    procedure GridClientKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure eCodeKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormShow(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmSOCIETESESELECT: TfrmSOCIETESESELECT;

implementation

{$R *.dfm}
uses UDATAPRIX, umain;

procedure TfrmSOCIETESESELECT.eCodeChange(Sender: TObject);
begin
 
if(DATAPRIX.devise.RecordCount = 0)then
  ActiveControl := eCode;
end;

procedure TfrmSOCIETESESELECT.FormClose(Sender: TObject;
  var Action: TCloseAction);
  begin
  Action := caFree;
end;

procedure TfrmSOCIETESESELECT.BtnOkClick(Sender: TObject);
begin
 frmmain.indice:=1;
 ModalResult := mrOk;
 close;
end;

procedure TfrmSOCIETESESELECT.GridClientKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if(Key in [VK_RETURN]) then
   BtnOkClick(Sender);
if((Key = VK_UP) and (GridClient.DataSource.DataSet.RecNo = 1)) then
  eCode.SetFocus;
end;

procedure TfrmSOCIETESESELECT.eCodeKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if(Key = VK_DOWN) then
    GridClient.SetFocus;
end;

procedure TfrmSOCIETESESELECT.FormShow(Sender: TObject);
begin
societes.Close;
societes.OPEN;
end;

procedure TfrmSOCIETESESELECT.BitBtn4Click(Sender: TObject);
begin
 close;
end;

end.
