unit U_CKProductBCPOutList;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
  cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
  cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
  cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
  ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
  cxDropDownEdit, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System,
  RM_GridReport, cxCheckBox, Menus, MovePanel, RM_E_llPDF, cxCalendar, Math,
  Clipbrd, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
  dxSkinsDefaultPainters, dxSkinscxPCPainter, dxSkinBlack, dxSkinBlue,
  dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
  dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
  dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
  dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
  dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
  dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
  dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
  dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
  dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
  dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinXmas2008Blue;

type
  TfrmCKProductBCPOutList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBExport: TToolButton;
    TBClose: TToolButton;
    Panel1: TPanel;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    DataSource1: TDataSource;
    Label3: TLabel;
    Label4: TLabel;
    MPRTCodeName: TEdit;
    Label2: TLabel;
    BegDate: TDateTimePicker;
    EndDate: TDateTimePicker;
    CDS_Main: TClientDataSet;
    Tv1: TcxGridDBTableView;
    cxGrid2Level1: TcxGridLevel;
    cxGrid2: TcxGrid;
    v2Column1: TcxGridDBColumn;
    v2Column3: TcxGridDBColumn;
    v2Column5: TcxGridDBColumn;
    v2Column6: TcxGridDBColumn;
    v1Column1: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    Label5: TLabel;
    orderNo: TEdit;
    Label6: TLabel;
    MJID: TEdit;
    v1Column7: TcxGridDBColumn;
    v1Column6: TcxGridDBColumn;
    v1Column8: TcxGridDBColumn;
    v1Column9: TcxGridDBColumn;
    Label8: TLabel;
    MPRTKZ: TEdit;
    Label9: TLabel;
    MPRTMF: TEdit;
    Label7: TLabel;
    v1Column3: TcxGridDBColumn;
    RMXLSExport1: TRMXLSExport;
    v1Column4: TcxGridDBColumn;
    Label10: TLabel;
    CKZDH: TEdit;
    v1Column5: TcxGridDBColumn;
    v1Column10: TcxGridDBColumn;
    TBCKCX: TToolButton;
    v1Column11: TcxGridDBColumn;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    MovePanel2: TMovePanel;
    v1Column12: TcxGridDBColumn;
    DS_JuanPRT: TDataSource;
    cxGridPopupMenu2: TcxGridPopupMenu;
    Label11: TLabel;
    v1Column15: TcxGridDBColumn;
    v1Column18: TcxGridDBColumn;
    v1Column19: TcxGridDBColumn;
    v1Column20: TcxGridDBColumn;
    conNo: TEdit;
    Label15: TLabel;
    Label16: TLabel;
    KHConNo: TEdit;
    Label17: TLabel;
    apid: TEdit;
    v1Column21: TcxGridDBColumn;
    v1Column22: TcxGridDBColumn;
    begtime: TDateTimePicker;
    endTime: TDateTimePicker;
    ADOQueryPrint: TADOQuery;
    RMDB_Main: TRMDBDataSet;
    v1rkplace: TcxGridDBColumn;
    RKplace: TEdit;
    Label19: TLabel;
    RMDBHZ: TRMDBDataSet;
    CDS_HZ: TClientDataSet;
    RM3: TRMGridReport;
    v1Column24: TcxGridDBColumn;
    Label22: TLabel;
    KHName: TEdit;
    v1Column25: TcxGridDBColumn;
    Label24: TLabel;
    CRType: TComboBox;
    CPType: TComboBox;
    Panel6: TPanel;
    Label31: TLabel;
    LBCPAP: TLabel;
    BTLP: TButton;
    BTNP: TButton;
    TCBNOR: TComboBox;
    IsJYTime: TCheckBox;
    PRTColor: TEdit;
    ganghao: TEdit;
    v1Column13: TcxGridDBColumn;
    ComboBox1: TComboBox;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    v1Column14: TcxGridDBColumn;
    Label1: TLabel;
    KuanHao: TEdit;
    v1Column16: TcxGridDBColumn;
    CDS_Label: TClientDataSet;
    v1Column17: TcxGridDBColumn;
    Label12: TLabel;
    Label13: TLabel;
    PRTHX: TEdit;
    MPRTCode: TEdit;
    v1Column23: TcxGridDBColumn;
    ToolButton3: TToolButton;
    Tv1Column1: TcxGridDBColumn;
    Tv1Column2: TcxGridDBColumn;
    Label14: TLabel;
    SQKHKuanHao: TEdit;
    Tv1Column3: TcxGridDBColumn;
    Tv1Column4: TcxGridDBColumn;
    Label18: TLabel;
    BaoID: TEdit;
    CDS_PRT: TClientDataSet;
    CDS_CKNO: TClientDataSet;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ConNoMChange(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure TBCKCXClick(Sender: TObject);
    procedure orderNoKeyPress(Sender: TObject; var Key: Char);
    procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
    procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure BTNPClick(Sender: TObject);
    procedure BTLPClick(Sender: TObject);
    procedure TCBNORChange(Sender: TObject);
    procedure CPTypeChange(Sender: TObject);
    procedure CRTypeChange(Sender: TObject);
    procedure edtSMNOKeyPress(Sender: TObject; var Key: Char);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);
  private
    FLeft, FTop: Integer;
    CurrentPage, RecordsNumber: Integer;
    procedure InitGrid();
    procedure PrintMD(MStatus: string);
    { Private declarations }
  public
    canshu1: string;
    { Public declarations }
  end;

//var
//  frmCKProductBCPOutList: TfrmCKProductBCPOutList;

implementation

uses
  U_DataLink, U_Fun, U_SysLogHelp;

{$R *.dfm}
procedure TfrmCKProductBCPOutList.PrintMD(MStatus: string);
var
  fImagePath2, fPrintFile, fPrintFile10, FMainID, FKHName, FFPNo: string;
begin
  if CDS_Main.IsEmpty then
    Exit;
  with ADOQueryCmd do
  begin
    Close;
    sql.Clear;
    sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
    ExecSQL;
  end;
  with ADOQueryCmd do
  begin
    Close;
    sql.Clear;
    sql.Add('SELECT * FROM TBSubID where 1=2 ');
    open;
  end;
  FMainID := '';
  CDS_Main.DisableControls;
  try
    ADOQueryCmd.Connection.BeginTrans;
    with CDS_Main do
    begin
      First;
      while not Eof do
      begin
        if Fieldbyname('Ssel').AsBoolean then
        begin
          ADOQueryCmd.append;
          ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('MJID').AsString);
          ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
          ADOQueryCmd.post;
        end;
        Next;
      end;
    end;
    ADOQueryCmd.Connection.CommitTrans;
  except
    ADOQueryCmd.Connection.RollbackTrans;
  end;
  CDS_Main.EnableControls;

  ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);

  if CDS_Label.Locate('LMName', trim(ComboBox1.Text), []) then
  begin
    with ADOQueryPrint do
    begin
      Close;
      sql.Clear;
      sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @code=' + quotedstr(Trim(DCode)));
//      sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @CKOrdNo=' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
      Open;
    end;
    SCreateCDS20(ADOQueryPrint, CDS_PRT);
    SInitCDSData20(ADOQueryPrint, CDS_PRT);

    if (ComboBox1.Text = '印花竖码单(米重量)') or (ComboBox1.Text = 'AZ') then
    begin
      with ADOQueryPrint do
      begin
        Close;
        sql.Clear;
        sql.add('exec P_Print_CKMD_DXHZ3 @code=' + quotedstr(Trim(DCode)));
        Open;
      end;
      SCreateCDS20(ADOQueryPrint, CDS_HZ);
      SInitCDSData20(ADOQueryPrint, CDS_HZ);
    end
    else
    begin
      with ADOQueryPrint do
      begin
        Close;
        sql.Clear;
        sql.add('exec P_Print_CKMD_DXHZ @code=' + quotedstr(Trim(DCode)));
        Open;
      end;
      SCreateCDS20(ADOQueryPrint, CDS_HZ);
      SInitCDSData20(ADOQueryPrint, CDS_HZ);
    end;
  end;

  fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
  if FileExists(fPrintFile) then
  begin
    if MStatus = 'Excel' then
    begin
      RM3.LoadFromFile(fPrintFile);
      fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
      if FileExists(fImagePath2) then
        DeleteFile(fImagePath2);
      fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.xls';
      RM3.PrepareReport;
      RM3.ExportTo(RMXLSExport1, fImagePath2);
    end
    else
    begin
      RM3.LoadFromFile(fPrintFile);
      RMVariables['ZDR'] := trim(DName);
      RM3.ShowReport;
    end;
  end
  else
  begin
    Application.MessageBox(PChar('没有找到' + fPrintFile), '提示', 0);
  end;
end;

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

procedure TfrmCKProductBCPOutList.FormCreate(Sender: TObject);
begin
  EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
  BegDate.DateTime := EndDate.DateTime - 20;
end;

procedure TfrmCKProductBCPOutList.InitGrid();
var
  fwhere, Pwhere: string;
begin
  MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
  MovePanel2.Visible := True;
  MovePanel2.Refresh;
  Pwhere := SGetFilters(Panel1, 1, 2);
//  if IsJYTime.Checked then
//  begin
//    fwhere := ' where CRTime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
//    fwhere := fwhere + ' and CRTime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
//    if trim(Pwhere) <> '' then
//      fwhere := fwhere + ' and ' + trim(Pwhere);
//  end
//  else
  begin
    if trim(Pwhere) <> '' then
      fwhere := fwhere + ' where ' + trim(Pwhere);
  end;

  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Close;
      sql.Clear;
      sql.Add(' select top ' + IntToStr(RecordsNumber) + ' *  from  ');
      sql.Add('(select row_number() over(order by AA.filltime desc) as rownumber');
      sql.Add(',COUNT(1) OVER() AS TotalCount');
      sql.Add(',* from (select A.*,CKZDH=A.CKOrdNo+''-''+ISNULL(cast(A.SQCKCS as varchar(10)),'''')  ');
      sql.Add(' ,B.orderNo,B.MPRTCode,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ,B.conNo,B.KHconNo ');
      sql.Add(' ,C.PRTColor,C.PRTEColor,C.PRTHX');
      sql.Add(' ,D.KHNmae,D.CKDate,D.CKType');
      sql.Add('   from CK_BanCP_CR A  inner join JYOrder_Main B on A.MainId=B.MainId inner join JYOrder_Sub C on A.SubId=C.SubId ');
      sql.Add(' left join CK_BanCP_CKList D on A.CKOrdNo=D.CKOrdNo  ');
      sql.Add(' where  A.CRFlag=''出库''  ');
      if IsJYTime.Checked then
      begin
        sql.Add(' and   A.CRTime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
        sql.Add(' and CRTime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
      end;
      sql.Add('  ) AA');
      sql.Add(fwhere);
      sql.Add(') temp_row');
      sql.Add(' where rownumber> ' + IntToStr((CurrentPage - 1) * RecordsNumber));
//      showmessage(sql.Text);
      Open;
    end;
//    with ADOQueryMain do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('exec P_Page_FinishClothCK ');
//      sql.Add('@pageIndex=' + inttostr(CurrentPage));
//      sql.Add(',@pageSize=' + inttostr(RecordsNumber));
//      sql.Add(',@criteria= ' + quotedstr(fwhere));
//      Open;
//    end;
    SCreateCDS20(ADOQueryMain, CDS_Main);
    SInitCDSData20(ADOQueryMain, CDS_Main);
    LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
    MovePanel2.Visible := false;
  finally
    ADOQueryMain.EnableControls;
    MovePanel2.Visible := false;
  end;

end;

procedure TfrmCKProductBCPOutList.TBRafreshClick(Sender: TObject);
begin
  CurrentPage := 1;
  InitGrid();
end;

procedure TfrmCKProductBCPOutList.ConNoMChange(Sender: TObject);
begin
  if ADOQueryMain.Active then
  begin
    SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
  end;
end;

procedure TfrmCKProductBCPOutList.TBCloseClick(Sender: TObject);
begin
  WriteCxGrid(trim(self.Caption), Tv1, '成品仓库');
  Close;
end;

procedure TfrmCKProductBCPOutList.FormShow(Sender: TObject);
var
  fsj: string;
begin
  ReadCxGrid(trim(self.Caption), Tv1, '成品仓库');
  fsj := 'select distinct(LMName) name from Lbael_Map where LMType=''出库码单''  ';
  SInitComBoxBySql(ADOQueryCmd, ComboBox1, true, fsj);

  with ADOQueryTemp do
  begin
    Filtered := False;
    Close;
    sql.Clear;
    Sql.Add('select * from Lbael_Map where LMType=''出库码单''');

    Open;
  end;
  SCreateCDS20(ADOQueryTemp, CDS_Label);
  SInitCDSData20(ADOQueryTemp, CDS_Label);
  CurrentPage := 1;
  RecordsNumber := 500;
  if Trim(canshu1) = '管理' then
  begin
    TBCKCX.Visible := True;
  end
  else
  begin
    TBCKCX.Visible := false;
  end;
end;

procedure TfrmCKProductBCPOutList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then
    exit;
  SelExportData(Tv1, ADOQueryMain, '');
end;

procedure TfrmCKProductBCPOutList.N1Click(Sender: TObject);
begin
  SelOKNo(CDS_Main, True);
end;

procedure TfrmCKProductBCPOutList.N2Click(Sender: TObject);
begin
  SelOKNo(CDS_Main, False);
end;

procedure TfrmCKProductBCPOutList.TBCKCXClick(Sender: TObject);
var
  FFMainId, FPrice, strsql, WSql, WLog: string;
begin
  if CDS_Main.IsEmpty then
    Exit;
  if CDS_Main.Locate('SSel', True, []) = False then
  begin
    Application.MessageBox('没有选择数据', '提示', 0);
    Exit;
  end;
  if Application.MessageBox('确定要撤销数据吗？', '提示', 32 + 4) <> IDYES then
    Exit;
  WSql := '';
  WLog := '';
  MovePanel2.Visible := True;
  MovePanel2.Refresh;

  CDS_Main.DisableControls;
  with CDS_Main do
  begin
    while CDS_Main.Locate('SSel', True, []) = True do
    begin
      begin

        if WSql = '' then
          WSql := quotedstr(Trim(CDS_Main.fieldbyname('mjid').AsString))
        else
          WSql := WSql + ',' + quotedstr(Trim(CDS_Main.fieldbyname('mjid').AsString));

        strsql := '卷ID：' + trim(CDS_Main.FieldByName('mjid').AsString) + ' 出库单号：' + trim(CDS_Main.FieldByName('CKORDNO').AsString);

        WLog := WLog + ' insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ';
        WLog := WLog + ' ' + quotedstr(trim(DName));
        WLog := WLog + ' ,getdate() ';
        WLog := WLog + ' ,' + quotedstr(trim(self.Caption));
        WLog := WLog + ' ,' + quotedstr(trim('出库撤销'));
        WLog := WLog + ' ,' + quotedstr(trim(strsql));
        WLog := WLog + ' ,' + quotedstr(trim('成功')) + ' )';

        CDS_Main.Delete;
      end;
    end;
  end;
  CDS_Main.EnableControls;

  if WSql = '' then
  begin
    MovePanel2.Visible := False;
    exit;
  end;

  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select distinct CKORDNO from  CK_BanCP_CR  ');
    sql.Add(' where mjid in (' + WSql + ')');
    sql.Add(' and CRFlag=''出库''');
    open;
  end;

  SCreateCDS20(ADOQueryTemp, CDS_CKNO);
  SInitCDSData20(ADOQueryTemp, CDS_CKNO);

  try
    ADOQueryCmd.Connection.BeginTrans;

    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
      sql.Add(WLog);
      ExecSQL;
    end;

    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
//      sql.Add('Update CK_Cloth_CR Set CRFlag=''待出库'' ,CRType='''',CRTime=NULL ,CKNo='''' ');
//      sql.Add(' where JYID in (' + WSql + ')');
//      sql.Add(' and CRFlag=''出库''');
//
//      sql.Add(' UPdate CK_Cloth_KC Set Valid=''Y'' ');
//      sql.Add(' where JYID in (' + WSql + ')');
//
//      sql.Add(' Update JY_Cloth Set JYCRType=''已入库''  ');
//      sql.Add(' where JYID in (' + WSql + ')');

      sql.Add('Update CK_BanCP_CR Set CRFlag=''待出库'',SQKHKuanHao=NULL,CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''' ');
      sql.Add(' where MJID in (' + WSql + ')');
      sql.Add(' and CRFlag=''出库''');

      sql.Add(' UPdate CK_BanCP_KC Set KCValid=''Y'' ');
      SQL.Add(' where MJID in (' + WSql + ')');

      sql.Add(' Update WFB_MJJY Set MJStr2=''已入库'' where MJID in (' + WSql + ')');

      ExecSQL;
    end;

    with CDS_CKNO do
    begin
      first;
      while not eof do
      begin
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add('exec P_Do_FHSQ  ''' + Trim(Trim(CDS_CKNO.fieldbyname('CKOrdNo').AsString)) + '''');
          ExecSQL;
        end;
        next;
      end;
    end;
    ADOQueryCmd.Connection.CommitTrans;
    MovePanel2.Visible := False;
    Exit;
  except
    MovePanel2.Visible := False;
    CDS_Main.EnableControls;
    ADOQueryCmd.Connection.RollbackTrans;
    Application.MessageBox('撤销异常！', '提示', 0);
  end;

end;

procedure TfrmCKProductBCPOutList.orderNoKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    CurrentPage := 1;
    InitGrid();
  end;
end;

procedure TfrmCKProductBCPOutList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
  Clipboard.SetTextBuf(PChar(Trim(CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
end;

procedure TfrmCKProductBCPOutList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  FLeft := X;
  FTop := Y;
end;

procedure TfrmCKProductBCPOutList.BTNPClick(Sender: TObject);
begin
  if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
    CurrentPage := CurrentPage + 1;
  InitGrid();
end;

procedure TfrmCKProductBCPOutList.BTLPClick(Sender: TObject);
begin
  if CurrentPage > 1 then
    CurrentPage := CurrentPage - 1;
  InitGrid();
end;

procedure TfrmCKProductBCPOutList.TCBNORChange(Sender: TObject);
begin
  RecordsNumber := StrToInt(TCBNOR.Text);
  CurrentPage := 1;
  InitGrid();
end;

procedure TfrmCKProductBCPOutList.CPTypeChange(Sender: TObject);
begin
  CurrentPage := 1;
  InitGrid();
end;

procedure TfrmCKProductBCPOutList.CRTypeChange(Sender: TObject);
begin
  CurrentPage := 1;
  InitGrid();
end;

procedure TfrmCKProductBCPOutList.edtSMNOKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin

  end;
end;

procedure TfrmCKProductBCPOutList.ToolButton1Click(Sender: TObject);
begin
  PrintMD('Report');
end;

procedure TfrmCKProductBCPOutList.ToolButton2Click(Sender: TObject);
begin
  frmSysLogHelp := TfrmSysLogHelp.create(self);
  with frmSysLogHelp do
  begin
    fModel := self.caption;
  //  facction:='生产指示单删除';
    showmodal;
    free;
  end;
end;

procedure TfrmCKProductBCPOutList.ToolButton3Click(Sender: TObject);
begin
  PrintMD('Excel');
end;

end.

