unit U_BatchMdyData;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, dxBarBuiltInMenu, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters,  
  cxPC, cxContainer, cxEdit, Vcl.Menus, Vcl.StdCtrls, cxButtons, cxTextEdit,
  cxMaskEdit, cxDropDownEdit;

type
  TfrmBatchMdyData = class(TForm)
    cxPageControl1: TcxPageControl;
    cxTabSheet1: TcxTabSheet;
    Label17: TLabel;
    Label18: TLabel;
    tzfs: TcxComboBox;
    tzsl: TcxTextEdit;
    cxOk1: TcxButton;
    cxclose: TcxButton;
    cxTabSheet2: TcxTabSheet;
    lenUnit: TcxComboBox;
    cxButton1: TcxButton;
    cxButton2: TcxButton;
    cxTabSheet3: TcxTabSheet;
    Label1: TLabel;
    tzsl1: TcxTextEdit;
    tzfs1: TcxComboBox;
    Label2: TLabel;
    Label3: TLabel;
    tzfield: TcxComboBox;
    cxButton3: TcxButton;
    cxButton4: TcxButton;
    procedure FormCreate(Sender: TObject);
    procedure cxcloseClick(Sender: TObject);
    procedure cxOk1Click(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure cxButton3Click(Sender: TObject);
  private
    { Private declarations }
  public
    fTabCaption:String;
  end;

var
  frmBatchMdyData: TfrmBatchMdyData;

implementation

{$R *.dfm}

procedure TfrmBatchMdyData.cxButton1Click(Sender: TObject);
begin
 if trim(lenunit.Text) = '' then
  begin
    Application.MessageBox('请先选择单位!', '提示', 0);
    Exit;
  end;

  ModalResult:=1;
end;

procedure TfrmBatchMdyData.cxButton3Click(Sender: TObject);
begin
 if trim(tzfield.Text) = '' then
  begin
    Application.MessageBox('调整字段不能为空!', '提示', 0);
    Exit;
  end;
  if trim(TZFS1.Text) = '' then
  begin
    Application.MessageBox('调整方式不能为空!', '提示', 0);
    Exit;
  end;
  if trim(TZSL1.Text) = '' then
  begin
    Application.MessageBox('调整数量不能为空!', '提示', 0);
    Exit;
  end;
  ModalResult:=1;
end;

procedure TfrmBatchMdyData.cxcloseClick(Sender: TObject);
begin
  close;
end;

procedure TfrmBatchMdyData.cxOk1Click(Sender: TObject);
begin
 if trim(TZFS.Text) = '' then
  begin
    Application.MessageBox('调整方式不能为空!', '提示', 0);
    Exit;
  end;
  if trim(TZSL.Text) = '' then
  begin
    Application.MessageBox('调整数量不能为空!', '提示', 0);
    Exit;
  end;
  ModalResult:=1;
end;

procedure TfrmBatchMdyData.FormCreate(Sender: TObject);
begin
  cxPageControl1.Align:=alClient;
end;

procedure TfrmBatchMdyData.FormShow(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to cxPageControl1.PageCount -1   do
  begin
    if fTabCaption= cxPageControl1.Pages[i].Caption then
    begin
       cxPageControl1.Pages[i].TabVisible:=True;
    end
    else
    begin
      cxPageControl1.Pages[i].TabVisible:=false;
    end;
  end;

end;

end.
