unit U_TransferWayHelp;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxDropDownEdit, StdCtrls, Buttons,
  ADODB, cxGridLevel, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid;

type
  TfrmTransferWayHelp = class(TForm)
    dbGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    Tv1Transferwaycode: TcxGridDBColumn;
    Tv1TransferWayName: TcxGridDBColumn;
    dbGrid1Level1: TcxGridLevel;
    DataSource1: TDataSource;
    ADOConnection1: TADOConnection;
    ADOQueryHelp: TADOQuery;
    btOk: TBitBtn;
    btNo: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btOkClick(Sender: TObject);
    procedure Tv1DblClick(Sender: TObject);
    procedure btNoClick(Sender: TObject);
  private
    procedure  InitData();
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmTransferWayHelp: TfrmTransferWayHelp;

implementation
uses
  U_global;

{$R *.dfm}

procedure TfrmTransferWayHelp.FormCreate(Sender: TObject);
begin
  with ADOConnection1 do
  begin
    Connected:=False;
    ConnectionString:=gConString;
    Connected:=True;
  end;
end;

procedure TfrmTransferWayHelp.InitData();
begin
  with ADOQueryHelp do
  begin
    close;
    sql.clear;
    sql.Add('select * from GY_TransferWay');
    sql.Add('order by TransferWayCode');
    Open;
  end;
end;

procedure TfrmTransferWayHelp.FormShow(Sender: TObject);
begin
  InitData();
end;

procedure TfrmTransferWayHelp.btOkClick(Sender: TObject);
begin
  if ADOQueryHelp.IsEmpty then Exit;
  ModalResult:=1;
end;

procedure TfrmTransferWayHelp.Tv1DblClick(Sender: TObject);
begin
  btOk.Click;
end;

procedure TfrmTransferWayHelp.btNoClick(Sender: TObject);
begin
  ModalResult:=-1;
end;

end.
