unit U_XcCustCodeHelp;

interface

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

type
  TfrmXcCustCodeHelp = class(TForm)
    ADOQueryHelp: TADOQuery;
    btOk: TBitBtn;
    btNo: TBitBtn;
    dbGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    Tv1code: TcxGridDBColumn;
    Tv1Name: TcxGridDBColumn;
    dbGrid1Level1: TcxGridLevel;
    DataSource1: TDataSource;
    ADOConnection1: TADOConnection;
    cxLookAndFeelController1: TcxLookAndFeelController;
    cxStyleRepository1: TcxStyleRepository;
    cxStyle1: TcxStyle;
    cxStyle2: TcxStyle;
    cxStyle_gridRow: TcxStyle;
    cxStyle_gridFoot: TcxStyle;
    cxStyle_gridHead: TcxStyle;
    cxStyle_gridGroupBox: TcxStyle;
    cxStyle_yellow: TcxStyle;
    cxStyle_Red: TcxStyle;
    cxStyle_fontBlack: TcxStyle;
    cxStyle_fontclFuchsia: TcxStyle;
    cxStyle_fontclPurple: TcxStyle;
    cxStyle_fontclGreen: TcxStyle;
    cxStyle_fontclBlue: TcxStyle;
    cxStyle_fontclTeal: TcxStyle;
    cxStyle_fontclOlive: TcxStyle;
    procedure btNoClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btOkClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Tv1DblClick(Sender: TObject);
  private
    procedure InitData();
  public
    Fflag:string;  //类型标志
    fDivChar:string;
    pColumns:integer;
    fSelResult:string;
  end;

var
  frmXcCustCodeHelp: TfrmXcCustCodeHelp;

implementation
uses
  U_global;
{$R *.dfm}

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

procedure TfrmXcCustCodeHelp.FormCreate(Sender: TObject);
begin
  with ADOConnection1 do
  begin
    Connected:=false;
    ConnectionString:=gConString;
    Connected:=true;
  end;
end;
////////////////////////////////////////////////
  //函数：
////////////////////////////////////////////////
procedure TfrmXcCustCodeHelp.InitData();
begin
  with ADOQueryHelp do
  begin
    close;
    sql.clear;
    sql.Add('select * from XC_Custcode');
    sql.Add('where flag='''+Fflag+'''');
    sql.Add('and Valid=''Y''');
    sql.Add('order by orderNo');
    Open;
  end;

end;
procedure TfrmXcCustCodeHelp.FormShow(Sender: TObject);
begin
  self.Caption :='输入帮助(类别：'+FFlag+')';
  InitData();
end;

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

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

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

end.
