unit U_ZdyAttachment_CX;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
  cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
  StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
  cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
  cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
  RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
  cxButtonEdit, cxTextEdit, cxDBLookupComboBox, cxDropDownEdit,
  cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;

type
  TfrmZdyAttachment_CX = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBClose: TToolButton;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    Panel1: TPanel;
    ToolButton2: TToolButton;
    ADOQueryMain: TADOQuery;
    TSsel: TToolButton;
    RM1: TRMGridReport;
    RMDB_Main: TRMDBDataSet;
    Label3: TLabel;
    ZdyName: TEdit;
    cxGridPopupMenu2: TcxGridPopupMenu;
    DS_HZ: TDataSource;
    CDS_HZ: TClientDataSet;
    Label1: TLabel;
    ZdyCode: TEdit;
    cxGrid2: TcxGrid;
    Tv2: TcxGridDBTableView;
    v2Column15: TcxGridDBColumn;
    v2Column6: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    DataSource1: TDataSource;
    Order_Sub: TClientDataSet;
    ADOQuery1: TADOQuery;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure ZdyNameChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure TSaveClick(Sender: TObject);
    procedure TSselClick(Sender: TObject);
  private

    { Private declarations }
    canshu1:string;
    procedure InitGrid();

  public
    fkhType:string;
    Fmanage:string;
  end;

var
  frmZdyAttachment_CX: TfrmZdyAttachment_CX;

implementation
uses
  U_DataLink,U_Fun,U_ZDYHelp,U_ZdyAttInput,U_ZdyInput,U_FjList_RZ;

{$R *.dfm}

procedure TfrmZdyAttachment_CX.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered:=False;
      Close;
      SQL.Clear;
      sql.Add(' select * from KH_Zdy_Attachment where Type=''KHName'' ');
      Open;
    end;
    SCreateCDS20(ADOQueryMain,CDS_HZ);
    SInitCDSData20(ADOQueryMain,CDS_HZ);
  finally
    ADOQueryMain.EnableControls;
  end;
end;


procedure TfrmZdyAttachment_CX.FormDestroy(Sender: TObject);
begin
  frmZdyAttachment_CX:=nil;
end;

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

procedure TfrmZdyAttachment_CX.TBCloseClick(Sender: TObject);
begin
  WriteCxGrid('客户资料FM',Tv2,'客户自定义');
  Close;
end;
procedure TfrmZdyAttachment_CX.FormShow(Sender: TObject);
begin
  ReadCxGrid('客户资料FM',Tv2,'客户自定义');
  InitGrid();
end;

procedure TfrmZdyAttachment_CX.TBRafreshClick(Sender: TObject);
begin
  InitGrid();
end;

procedure TfrmZdyAttachment_CX.ToolButton2Click(Sender: TObject);
begin
  if ADOQueryMain.Active then
  begin
    SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
    SCreateCDS20(ADOQueryMain,CDS_HZ);
    SInitCDSData20(ADOQueryMain,CDS_HZ);
  end;
end;

procedure TfrmZdyAttachment_CX.ZdyNameChange(Sender: TObject);
begin
  ToolButton2.Click;
end;


procedure TfrmZdyAttachment_CX.FormCreate(Sender: TObject);
begin
  canshu1:=Trim(DParameters1);
end;

procedure TfrmZdyAttachment_CX.TSaveClick(Sender: TObject);
var MaxLX:string;
begin
  
end;

procedure TfrmZdyAttachment_CX.TSselClick(Sender: TObject);
begin
  if CDS_HZ.IsEmpty then exit;
  ModalResult:=1;
end;

end.


