unit U_PayConHelp;

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
  TfrmPayConHelp = class(TForm)
    dbGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    Tv1Paycode: TcxGridDBColumn;
    Tv1PayName: TcxGridDBColumn;
    dbGrid1Level1: TcxGridLevel;
    ADOConnection1: TADOConnection;
    DataSource1: TDataSource;
    ADOQueryHelp: TADOQuery;
    btOk: TBitBtn;
    btNo: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btOkClick(Sender: TObject);
    procedure btNoClick(Sender: TObject);
    procedure Tv1DblClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    procedure InitData();
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmPayConHelp: TfrmPayConHelp;

implementation
uses
  U_global;

{$R *.dfm}

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

procedure TfrmPayConHelp.InitData();
begin
  with ADOQueryHelp do
  begin
    close;
    sql.clear;
    sql.Add('select * from GY_PayCon');
    sql.Add('order by PayCode');
    Open;
  end;
end;

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

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

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

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

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

end.
