unit U_HXKTJ_Type;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
  cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
  StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu,IniFiles,
  cxButtonEdit, BtnEdit, cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL,U_SLT_TJ,
  cxTLData, cxContainer, cxCurrencyEdit, cxCheckBox, cxSplitter,jpeg,Math, Menus, cxCalendar,
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP;

type
  TfrmHXKTJ_Type = class(TForm)
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    DataSource1: TDataSource;
    Ord_TJ: TClientDataSet;
    ADOConnection1: TADOConnection;
    ThreeImgList: TImageList;
    DataSource2: TDataSource;
    Panel4: TPanel;
    DataSource4: TDataSource;
    ADOQueryTree: TADOQuery;
    Order_Tree: TClientDataSet;
    cxGridPopupMenu1: TcxGridPopupMenu;
    cxStyleRepository1: TcxStyleRepository;
    cxStyle1: TcxStyle;
    cxStyleRepository2: TcxStyleRepository;
    cxStyle2: TcxStyle;
    adoqueryPicture: TADOQuery;
    ADOQuery1: TADOQuery;
    cxDBTreeList1: TcxDBTreeList;
    VColumn2: TcxDBTreeListColumn;
    SaveDialog1: TSaveDialog;
    ODPat: TOpenDialog;
    IdFTP1: TIdFTP;
    Panel16: TPanel;
    Panel3: TPanel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure cxDBTreeList1DblClick(Sender: TObject);
  private
    JS:integer;
    lstPat: TStringList;
		AJpeg: TJPEGImage;
    procedure initTree();
    procedure CreThumb(AJPeg:TJPEGImage;Image1:TImage;Width, Height: Integer);
    procedure ReadINIFile10();
    { Private declarations }
  public
    my,mz:integer;
    { Public declarations }
  end;
var
  frmHXKTJ_Type: TfrmHXKTJ_Type;
  Mach1: array of TfrmSLT_TJ;
implementation
uses
  U_DataLink,U_RTFun, U_BPZdy_HXK,U_CPTypePB,U_FileUp_TP
  ,U_FileUp,U_FileUp_PB,U_FileUp_TPSH,U_SLT_BF1;

{$R *.dfm}
procedure TfrmHXKTJ_Type.initTree();
begin
  with ADOQueryTree do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select *');
    sql.Add(',JS=(select Max(A.CPlevel) from CP_TypeTJ A)');
    sql.Add(', Case when isnull(CPNo,'''')<>'''' and CPlevel=''2'' then RTrim(CPNo)+''/''+CPName else CPName end as CP ');
    SQL.Add('from CP_TypeTJ order by CPlevel,CPOrder,CPName');
    Open;
  end;
  SCreateCDS20(ADOQueryTree,Order_Tree);
  SInitCDSData20(ADOQueryTree,Order_Tree);
  JS:=Order_Tree.fieldbyname('JS').AsInteger;
  cxDBTreeList1.Items[0].Expand(true);
end;


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


procedure TfrmHXKTJ_Type.FormShow(Sender: TObject);
begin
  initTree();
end;

procedure TfrmHXKTJ_Type.CreThumb(AJPeg:TJPEGImage;Image1:TImage;Width, Height: Integer);
begin

end;


procedure TfrmHXKTJ_Type.ReadINIFile10();
begin

end;


procedure TfrmHXKTJ_Type.cxDBTreeList1DblClick(Sender: TObject);
begin
  ModalResult:=1;
end;

end.
