unit U_CarGlideHelp;

interface

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

type
  TfrmCarGlideHelp = class(TForm)
    cxGrid1: TcxGrid;
    TV1: TcxGridDBTableView;
    TV1carno: TcxGridDBColumn;
    TV1glideOrder: TcxGridDBColumn;
    TV1Glidename: TcxGridDBColumn;
    TV1devicename: TcxGridDBColumn;
    TV1sbman: TcxGridDBColumn;
    TV1carlen: TcxGridDBColumn;
    TV1MachInTime: TcxGridDBColumn;
    TV1Lbman: TcxGridDBColumn;
    V1machlen: TcxGridDBColumn;
    TV1MachOutTime: TcxGridDBColumn;
    V1MachInOper: TcxGridDBColumn;
    V1MachOutOper: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    ToolBar1: TToolBar;
    Tok: TToolButton;
    TBClose: TToolButton;
    ADOQueryHelp: TADOQuery;
    DS_help: TDataSource;
    ADOConnection1: TADOConnection;
    ImageList24: TImageList;
    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_focus: TcxStyle;
    cxStyle_fontclBlue: TcxStyle;
    cxStyle_fontclOlive: TcxStyle;
    cxStyle_fontBlack: TcxStyle;
    cxStyle_fontclFuchsia: TcxStyle;
    cxStyle_fontclPurple: TcxStyle;
    procedure FormCreate(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(Sender: TObject);
    procedure TokClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TV1DblClick(Sender: TObject);
  private
   procedure DoQuery();
  public
    fCarNO:string;
  end;

var
  frmCarGlideHelp: TfrmCarGlideHelp;

implementation
uses
  U_global;
{$R *.dfm}

procedure TfrmCarGlideHelp.FormCreate(Sender: TObject);
begin
  cxGrid1.Align :=alClient;
  with ADOConnection1 do
  begin
    Connected:=false;
    ConnectionString:=gConString;
    Connected:=true;
  end;
end;

procedure TfrmCarGlideHelp.TBCloseClick(Sender: TObject);
begin
  close;
end;

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

procedure TfrmCarGlideHelp.FormDestroy(Sender: TObject);
begin
  frmCarGlideHelp:=nil;
end;

procedure TfrmCarGlideHelp.TokClick(Sender: TObject);
begin
  if ADOQueryHelp.IsEmpty then exit;
  modalResult:=1;
end;
///////////////////////////////////////////
  //
///////////////////////////////////////////
procedure TfrmCarGlideHelp.DoQuery();
begin
  try
    ADOQueryHelp.DisableControls ;
    with ADOQueryHelp do
    begin
      close;
      sql.Clear;
      sql.Add('EXEC P_Get_carGlidehelp ');
      sql.Add(''+quotedstr(trim(fcarNO)));
      sql.Add(','+quotedstr(trim('')));
      sql.Add(','+quotedstr(trim('')));
      open;
    end;
  finally
    ADOQueryHelp.EnableControls;
  end;
end;

procedure TfrmCarGlideHelp.FormShow(Sender: TObject);
begin
  DoQuery();
end;

procedure TfrmCarGlideHelp.TV1DblClick(Sender: TObject);
begin
  Tok.Click ;
end;

end.
