unit U_MLMange;

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, cxTextEdit,
  cxButtonEdit, Menus, cxLookAndFeelPainters, cxButtons, cxImage;

type
  TfrmMLMange = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBDel: TToolButton;
    TBClose: TToolButton;
    DataSource1: TDataSource;
    ADOQueryTree: TADOQuery;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    cxGridPopupMenu1: TcxGridPopupMenu;
    Panel1: TPanel;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    DataSource2: TDataSource;
    ADOQueryMain: TADOQuery;
    CDS_Main: TClientDataSet;
    ToolButton1: TToolButton;
    RM1: TRMGridReport;
    RMDB_Main: TRMDBDataSet;
    ODPat: TOpenDialog;
    IdFTP1: TIdFTP;
    SaveDialog1: TSaveDialog;
    DataSource3: TDataSource;
    cxGridPopupMenu2: TcxGridPopupMenu;
    Order_GX: TClientDataSet;
    DataSource4: TDataSource;
    cxGridPopupMenu3: TcxGridPopupMenu;
    ML_Col: TClientDataSet;
    DataSource5: TDataSource;
    cxGridPopupMenu4: TcxGridPopupMenu;
    CDS_Sub: TClientDataSet;
    TFH: TToolButton;
    ToZHADD: TToolButton;
    cxStyleRepository1: TcxStyleRepository;
    cxStyle1: TcxStyle;
    cxGridPopupMenu5: TcxGridPopupMenu;
    DataSource6: TDataSource;
    Ord_HX: TClientDataSet;
    TJS: TToolButton;
    ADOQuery1: TADOQuery;
    TCK: TToolButton;
    ToolButton11: TToolButton;
    Panel2: TPanel;
    cxButton1: TcxButton;
    cxButton2: TcxButton;
    Panel3: TPanel;
    cxButton3: TcxButton;
    cxButton4: TcxButton;
    Panel5: TPanel;
    Label2: TLabel;
    MLNo: TEdit;
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    MLName: TEdit;
    GSNo: TEdit;
    GYName: TEdit;
    cxGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    v1MLType: TcxGridDBColumn;
    v1MLNo: TcxGridDBColumn;
    v1MLName: TcxGridDBColumn;
    v1MLMF: TcxGridDBColumn;
    v1MLKZ: TcxGridDBColumn;
    v1Column1: TcxGridDBColumn;
    v1GYName: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1GYLXName: TcxGridDBColumn;
    v1SKID: TcxGridDBColumn;
    v1DLHXK: TcxGridDBColumn;
    v1GYLX: TcxGridDBColumn;
    v1GSNo: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    Panel4: TPanel;
    cxButton5: TcxButton;
    cxButton6: TcxButton;
    cxButton10: TcxButton;
    cxButton11: TcxButton;
    Panel6: TPanel;
    cxButton7: TcxButton;
    cxButton8: TcxButton;
    cxButton9: TcxButton;
    cxButton12: TcxButton;
    cxButton13: TcxButton;
    TPrint: TToolButton;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure TBDelClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure cxDBTreeList1DblClick(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure MLNoChange(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure TFHClick(Sender: TObject);
    procedure ToZHADDClick(Sender: TObject);
    procedure ToolButton10Click(Sender: TObject);
    procedure TV4CellClick(Sender: TcxCustomGridTableView;
      ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
      AShift: TShiftState; var AHandled: Boolean);
    procedure Tv1DblClick(Sender: TObject);
    procedure TCKClick(Sender: TObject);
    procedure ToolButton11Click(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton3Click(Sender: TObject);
    procedure cxButton5Click(Sender: TObject);
    procedure cxButton7Click(Sender: TObject);
    procedure cxButton6Click(Sender: TObject);
    procedure cxButton8Click(Sender: TObject);
    procedure cxButton9Click(Sender: TObject);
    procedure cxButton10Click(Sender: TObject);
    procedure cxButton11Click(Sender: TObject);
    procedure cxButton12Click(Sender: TObject);
    procedure TJSClick(Sender: TObject);
    procedure cxButton13Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure cxButton4Click(Sender: TObject);
    procedure TPrintClick(Sender: TObject);
  private
    { Private declarations }
    PState:Integer;
    FCPID,FTopID:String;
    procedure InitTree();
    procedure InitGrid();
    procedure ReadINIFile();
    procedure ButtonColorCSH();
  public
    { Public declarations }
  end;

var
  frmMLMange: TfrmMLMange;

implementation
uses
  U_DataLink,U_Fun,U_CPAdd,U_FileUp,U_MLManage_LR,U_BPZdy_LR,U_BPZdy_SH,U_MLManage_LRRS,
  U_MLManage_FHLR,U_MLManage_ZHLR,U_BPZdy_HXK,U_MLMange_CX,U_BPZdy_LRPB,U_BPZdy_LRGX,
  U_CPManage_TP,U_BPZdy_LRSHK, U_BPZdy_PanelCX;

{$R *.dfm}

procedure TfrmMLMange.InitTree();
begin
  
end;

procedure TfrmMLMange.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * ');
      sql.Add(',SKID=(select B.SKID from BP_ZDY B where B.BPID=A.MBPID)');
      sql.Add(' from ML_Manage A ');
      Open;
    end;
    SCreateCDS20(ADOQueryMain,CDS_Main);
    SInitCDSData20(ADOQueryMain,CDS_Main);
  finally
    ADOQueryMain.EnableControls;
  end;
end;

procedure TfrmMLMange.FormDestroy(Sender: TObject);
begin
  frmMLMange:=nil;
end;

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

procedure TfrmMLMange.TBCloseClick(Sender: TObject);
begin
  WriteCxGrid('面料YX',Tv1,'样品管理');
  Close;
end;
procedure TfrmMLMange.TBDelClick(Sender: TObject);
begin
  if CDS_Main.IsEmpty then Exit;
  if Application.MessageBox('确定要删除数据吗？','提示',32+4)<>IDYES then Exit;
  with ADOQueryCmd do
  begin
    Close;
    SQL.Clear;
    sql.Add('delete ML_Manage where MLID='''+Trim(CDS_Main.fieldbyname('MLID').AsString)+'''');
    sql.Add('delete ML_Manage_PB where MLID='''+Trim(CDS_Main.fieldbyname('MLID').AsString)+'''');
    sql.Add('delete ML_Manage_GX where MLID='''+Trim(CDS_Main.fieldbyname('MLID').AsString)+'''');
    ExecSQL;
  end;
  CDS_Main.Delete;
end;

procedure TfrmMLMange.FormShow(Sender: TObject);
begin
  InitGrid();
  ReadCxGrid('面料YX',Tv1,'样品管理');
end;

procedure TfrmMLMange.cxDBTreeList1DblClick(Sender: TObject);
begin
  InitGrid();
end;

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

procedure TfrmMLMange.ToolButton3Click(Sender: TObject);
begin
  if CDS_Main.IsEmpty then Exit;
  if CDS_Main.FieldByName('GYType').AsString='染色' then
  begin
    try
      frmMLManage_LRRS:=TfrmMLManage_LRRS.Create(Application);
      with frmMLManage_LRRS do
      begin
        FCYID:=Trim(Self.CDS_Main.fieldbyname('MLID').AsString);
        FGYName:='染色';
        if ShowModal=1 then
        begin
          Self.InitGrid();
        end;
      end;
    finally
      frmMLManage_LRRS.Free;
    end;
  end;
  if CDS_Main.FieldByName('GYType').AsString='印花' then
  begin
    try
      frmMLManage_LRRS:=TfrmMLManage_LRRS.Create(Application);
      with frmMLManage_LRRS do
      begin
        FCYID:=Trim(Self.CDS_Main.fieldbyname('MLID').AsString);
        if ShowModal=1 then
        begin
          Self.InitGrid();
        end;
      end;
    finally
      frmMLManage_LRRS.Free;
    end;
  end;
  if CDS_Main.FieldByName('MLType').AsString='复合' then
  begin
    try
      frmMLManage_FHLR:=TfrmMLManage_FHLR.Create(Application);
      with frmMLManage_FHLR do
      begin
        FCYID:=Self.CDS_Main.FieldByName('MLID').AsString;
        if ShowModal=1 then
        begin
          Self.InitGrid();
        end;
      end;
    finally
      frmMLManage_FHLR.Free;
    end;
  end;
  if CDS_Main.FieldByName('MLType').AsString='组合' then
  begin
    frmMLManage_ZHLR:=TfrmMLManage_ZHLR.Create(self);
    with frmMLManage_ZHLR do
    begin
      FCYID:=Self.CDS_Main.FieldByName('MLID').AsString;
      if ShowModal=1 then
      begin
        Self.InitGrid();
      end;
      free;
    end;
  end;
end;

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

procedure TfrmMLMange.MLNoChange(Sender: TObject);
begin
  ToolButton2.Click;
end;

procedure TfrmMLMange.ToolButton1Click(Sender: TObject);
begin
  if CDS_Main.IsEmpty then Exit;
  TcxGridToExcel('客户拿样',cxGrid1);
end;

procedure TfrmMLMange.ReadINIFile();
var
  programIni:Tinifile;  //配置文件名
  FileName:string;
begin
  FileName:=ExtractFilePath(Paramstr(0))+'SYSTEMSET.INI';
  programIni:=Tinifile.create(FileName);
  server:=programIni.ReadString('SERVER','服务器地址','127.0.0.1');
  programIni.Free;
end;

procedure TfrmMLMange.Tv1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  with ADOQueryCmd do
  begin
    Close;
    SQL.Clear;
    sql.Add(' select A.*,isnull(B.BPCode,C.MLNo) BPCode,isnull(B.BPName,C.MLName) BPName');
    sql.Add(' ,isnull(B.BPMF,C.MLMF) BPMF,isnull(B.BPKZ,C.MLKZ) BPKZ');
    sql.Add(',B.BPJS,B.BPWS,B.BPMiDu,B.BPUnit,C.MLDLNo,C.DLHXK');
    SQL.Add(' from ML_Manage_PB A left join BP_ZDY B on B.BPID=A.BPID ');
    sql.Add(' left join ML_Manage C on C.MLID=A.BPID');
    sql.Add(' where A.MLID='''+Trim(CDS_Main.fieldbyname('MLID').AsString)+'''');
    //ShowMessage(sql.Text);
    Open;
  end;
  SCreateCDS20(ADOQueryCmd,CDS_Sub);
  SInitCDSData20(ADOQueryCmd,CDS_Sub);
  with ADOQueryCmd do
  begin
    Close;
    SQL.Clear;
    sql.Add(' select A.*,B.*,C.* from ML_Manage_GX A inner join BP_ZDY B on B.BPID=A.BPID ');
    sql.Add('inner join BP_ZDY_Sub C on C.BPSubID=A.BPSubID');
    sql.Add(' where A.MLID='''+Trim(CDS_Main.fieldbyname('MLID').AsString)+'''');
    Open;
  end;
  SCreateCDS20(ADOQueryCmd,Order_GX);
  SInitCDSData20(ADOQueryCmd,Order_GX);
  //if CDS_Main.FieldByName('MLType').AsString<>'复合' then
  begin
    //if CDS_Main.FieldByName('MLType').AsString<>'组合' then
    begin
      with ADOQueryCmd do
      begin
        Close;
        SQL.Clear;
        sql.Add('select * from BP_ZDY_Sub ');
        sql.Add('where BPCode='''+Trim(CDS_Main.fieldbyname('MLDLNo').AsString)+''' and BPflag=''SHK''');
        Open;
      end;
      SCreateCDS20(ADOQueryCmd,ML_Col);
      SInitCDSData20(ADOQueryCmd,ML_Col);
    end;
    with ADOQueryCmd do
    begin
      Close;
      SQL.Clear;
      sql.Add('select A.*,B.* from BP_ZDY_Sub A ');
      Sql.Add('inner join KH_Zdy_Attachment B on A.HXATID=B.ATID and B.Type=''CPHX''');
      sql.Add(' where A.BPCode='''+trim(CDS_Main.fieldbyname('DLHXK').AsString)+'''');
      open;
    end;
    SCreateCDS20(ADOQueryCmd,Ord_HX);
    SInitCDSData20(ADOQueryCmd,Ord_HX);
  end;
end;

procedure TfrmMLMange.TFHClick(Sender: TObject);
begin
  try
    frmMLManage_FHLR:=TfrmMLManage_FHLR.Create(Application);
    with frmMLManage_FHLR do
    begin
      FCYID:='';
      if ShowModal=1 then
      begin
        Self.InitGrid();
      end;
    end;
  finally
    frmMLManage_FHLR.Free;
  end;
end;

procedure TfrmMLMange.ToZHADDClick(Sender: TObject);
begin
  frmMLManage_ZHLR:=TfrmMLManage_ZHLR.Create(self);
  with frmMLManage_ZHLR do
  begin
    FCYID:='';
    if ShowModal=1 then
    begin
      Self.InitGrid();
    end;
    free;
  end;
end;

procedure TfrmMLMange.ToolButton10Click(Sender: TObject);
begin
  {if RadioGroup1.ItemIndex=-1 then
  begin
    application.MessageBox('请选择工序','提示');
    exit;
  end;}
  
end;

procedure TfrmMLMange.TV4CellClick(Sender: TcxCustomGridTableView;
  ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
  AShift: TShiftState; var AHandled: Boolean);
begin
  //if CDS_Main.FieldByName('MLType').AsString='复合' then
  begin
    with ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      sql.Add('select * from BP_ZDY_Sub ');
      sql.Add('where BPCode='''+Trim(CDS_Sub.Fieldbyname('MLDLNo').AsString)+''' and BPflag=''SHK''');
      Open;
    end;
    SCreateCDS20(ADOQuery1,ML_Col);
    SInitCDSData20(ADOQuery1,ML_Col);
    with ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      sql.Add('select A.*,B.* from BP_ZDY_Sub A ');
      Sql.Add('inner join KH_Zdy_Attachment B on A.HXATID=B.ATID and B.Type=''CPHX''');
      sql.Add(' where A.BPCode='''+trim(CDS_Sub.Fieldbyname('DLHXK').AsString)+'''');
      open;
    end;
    SCreateCDS20(ADOQuery1,Ord_HX);
    SInitCDSData20(ADOQuery1,Ord_HX);
  end;
end;

procedure TfrmMLMange.Tv1DblClick(Sender: TObject);
begin
  TCK.Click;
end;

procedure TfrmMLMange.TCKClick(Sender: TObject);
begin
  if CDS_Main.FieldByName('GYType').AsString='染色' then
  begin
    try
      frmMLManage_LRRS:=TfrmMLManage_LRRS.Create(Application);
      with frmMLManage_LRRS do
      begin
        FCYID:=Trim(Self.CDS_Main.fieldbyname('MLID').AsString);
        FGYName:='染色';
        viewFlag:=True;
        if ShowModal=1 then
        begin
          Self.InitGrid();
        end;
      end;
    finally
      frmMLManage_LRRS.Free;
    end;
  end;
end;

procedure TfrmMLMange.ToolButton11Click(Sender: TObject);
begin
  ButtonColorCSH();
  if panel2.Visible=true then
  panel2.Visible:=false
  else
  panel2.Visible:=true;
  if Panel2.Visible=True  then
  begin
    Panel3.Visible:=False;
    Panel4.Visible:=False;
    Panel6.Visible:=False;
  end;
end;

procedure TfrmMLMange.cxButton1Click(Sender: TObject);
begin
  Panel2.Visible:=false;
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  try
    frmMLManage_LRRS:=TfrmMLManage_LRRS.Create(Application);
    with frmMLManage_LRRS do
    begin
      FCYID:='';
      FGYName:='染色';
      if ShowModal=1 then
      begin
        Self.InitGrid();
        Panel4.Visible:=false;
      end;
    end;
  finally
    frmMLManage_LRRS.Free;
  end;
end;

procedure TfrmMLMange.cxButton3Click(Sender: TObject);
begin
  Panel3.Visible:=true;
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  cxButton6.Colors.Default:=$0073E189;
  frmBPZDY_LRGX:=TfrmBPZDY_LRGX.Create(self);
  with frmBPZDY_LRGX do
  begin
    flag:='GXName';
    flagName:='染色';
    cxGrid3.Visible:=false;
    Panel3.Align:=alClient;
    frmBPZDY_LRGX.FGYName:='染色';
    Label12.Visible:=false;
    DASH.Visible:=false;
    if ShowModal=1 then
    begin
      Panel3.Visible:=false;
    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton5Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  frmBPZDY_LRPB:=TfrmBPZDY_LRPB.Create(self);
  with frmBPZDY_LRPB do
  begin
    flag:='PBName';
    flagName:='坯布';
    ToolButton1.Visible:=False;
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton7Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  cxButton13.Colors.Default:=$0073E189;
  frmBPZDY_LR:=TfrmBPZDY_LR.Create(self);
  with frmBPZDY_LR do
  begin
    flag:='MHName';
    flagName:='棉花';
    V1BPJS.Caption:='工艺成份';
    V1BPMF1.Visible:=false;
    //V1BPWS.Visible:=false;
    v1BPMiDu.Visible:=false;
    cxGrid3.Visible:=false;
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton6Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  if Panel3.Visible=true then
  Panel3.Visible:=false
  else
  Panel3.Visible:=true;
  if Panel3.Visible=True  then
  begin
    Panel2.Visible:=False;
    Panel6.Visible:=False;
    Panel3.Top:=Panel4.Top+Panel4.Height;
  end;
end;
procedure TfrmMLMange.ButtonColorCSH();
var
  i:Integer;
begin
  for i:=0 to Panel2.ControlCount-1 do
  begin
    with Panel2 do
    begin
      if Controls[i] is TcxButton then
      begin
        TcxButton(Controls[i]).Colors.Default:=clBtnFace;
      end;
    end;
  end;
  for i:=0 to Panel3.ControlCount-1 do
  begin
    with Panel3 do
    begin
      if Controls[i] is TcxButton then
      begin
        TcxButton(Controls[i]).Colors.Default:=clBtnFace;
      end;
    end;
  end;
  for i:=0 to Panel4.ControlCount-1 do
  begin
    with Panel4 do
    begin
      if Controls[i] is TcxButton then
      begin
        TcxButton(Controls[i]).Colors.Default:=clBtnFace;
      end;
    end;
  end;
  for i:=0 to Panel6.ControlCount-1 do
  begin
    with Panel6 do
    begin
      if Controls[i] is TcxButton then
      begin
        TcxButton(Controls[i]).Colors.Default:=clBtnFace;
      end;
    end;
  end;
end;

procedure TfrmMLMange.cxButton8Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  cxButton13.Colors.Default:=$0073E189;
  frmBPZDY_LR:=TfrmBPZDY_LR.Create(self);
  with frmBPZDY_LR do
  begin
    flag:='WFBDY';
    flagName:='无纺布';
    V1BPMF1.Visible:=false;
    V1BPJS.Caption:='工艺成份';
    //V1BPWS.Visible:=false;
    v1BPMiDu.Visible:=false;
    cxGrid3.Visible:=false;
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton9Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  cxButton13.Colors.Default:=$0073E189;
  frmBPZDY_LR:=TfrmBPZDY_LR.Create(self);
  with frmBPZDY_LR do
  begin
    flag:='XXName';
    flagName:='绣线';
    V1BPJS.Visible:=false;
    v1BPMiDu.Caption:='色号';
    V1BPMF1.Caption:='供应商';
    V1BPKZ.Visible:=false;
    Panel2.Visible:=false;
    cxGrid3.Visible:=false;
    cxGrid1.Align:=alClient;
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton10Click(Sender: TObject);
begin
  frmBPZDY_LRSHK:=TfrmBPZDY_LRSHK.Create(self);        //TfrmCPManage_TP
  with frmBPZDY_LRSHK do
  begin
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton11Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  frmBPZDY_HXK:=TfrmBPZDY_HXK.Create(self);
  with frmBPZDY_HXK do
  begin
    flag:='HXK';
    flagName:='花型库';
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.cxButton12Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  cxButton13.Colors.Default:=$0073E189;
  frmBPZDY_LR:=TfrmBPZDY_LR.Create(self);
  with frmBPZDY_LR do
  begin
    flag:='JSName';
    flagName:='胶水';
    Panel2.Visible:=false;
    cxGrid3.Visible:=false;
    cxGrid1.Align:=alClient;
    V1BPJS.Visible:=false;
    v1BPMiDu.Visible:=false;
    V1BPKZ.Visible:=false;
    V1BPMF1.Visible:=false;
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

procedure TfrmMLMange.TJSClick(Sender: TObject);
begin
  ButtonColorCSH();
  if panel4.Visible=true then
  begin
    panel4.Visible:=false;
    Panel3.Visible:=False;
    Panel2.Visible:=False;
    Panel6.Visible:=False;
  end
  else
  panel4.Visible:=true;
  if panel4.Visible=True  then
  begin
    Panel3.Visible:=False;
    Panel2.Visible:=False;
  end;
end;

procedure TfrmMLMange.cxButton13Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  if Panel6.Visible=true then
  Panel6.Visible:=false
  else
  Panel6.Visible:=true;
  if Panel6.Visible=True  then
  begin
    Panel2.Visible:=False;
    Panel3.Visible:=False;
  end;
end;

procedure TfrmMLMange.cxButton2Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
end;

procedure TfrmMLMange.cxButton4Click(Sender: TObject);
begin
  ButtonColorCSH();
  TcxButton(Sender).Colors.Default:=$0073E189;
  cxButton6.Colors.Default:=$0073E189;
end;

procedure TfrmMLMange.TPrintClick(Sender: TObject);
var i,j,x:Integer;
begin
  i:=0;
  j:=0;
  frmBPZDY_PanelCX:=TfrmBPZDY_PanelCX.create(self);
  with frmBPZDY_PanelCX do
  begin
    FColorFlag:=Trim(self.CDS_Main.fieldbyname('SKID').asstring);
    FBPID:=Trim(self.CDS_Main.fieldbyname('MBPID').asstring);
    FMLID:=Trim(Self.CDS_Main.fieldbyname('MLID').AsString);
    if ShowModal=1 then
    begin

    end;
    free;
  end;
end;

end.
