unit U_PlanChgHisList;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxCurrencyEdit, ADODB, cxGridLevel,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
  cxControls, cxGridCustomView, cxGrid, ComCtrls, ToolWin;

type
  TfrmPlanChgHisList = class(TForm)
    ToolBar2: TToolBar;
    Tclose: TToolButton;
    cxGrid1: TcxGrid;
    TV2: TcxGridDBTableView;
    V2P_statusName: TcxGridDBColumn;
    V2P_ClassType: TcxGridDBColumn;
    tv2colorName: TcxGridDBColumn;
    tv2P_subNum: TcxGridDBColumn;
    tv2P_num: TcxGridDBColumn;
    V2P_pbPrice: TcxGridDBColumn;
    V2P_price: TcxGridDBColumn;
    V2otherMoney: TcxGridDBColumn;
    tv1YDnum: TcxGridDBColumn;
    tv2P_colStd: TcxGridDBColumn;
    tv1P_Csid: TcxGridDBColumn;
    tv2sid: TcxGridDBColumn;
    tv2P_other: TcxGridDBColumn;
    tv1P_Solid: TcxGridDBColumn;
    V2Sbtr4: TcxGridDBColumn;
    tv1P_Rltype: TcxGridDBColumn;
    tv1P_OutIndex: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    ADOQuery_his: TADOQuery;
    DS_his: TDataSource;
    V2P_chgTime: TcxGridDBColumn;
    V2P_chnNote: TcxGridDBColumn;
    V2planNO: TcxGridDBColumn;
    V2customName: TcxGridDBColumn;
    V2P_chnName: TcxGridDBColumn;
    V2P_spec: TcxGridDBColumn;
    V2P_BreadthTwo: TcxGridDBColumn;
    V2P_gramTwo: TcxGridDBColumn;
    ADOConnection1: TADOConnection;
    procedure TcloseClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    procedure DoQuery();
  public
    fPlanNO:string;
    fP_seqNO:string;
    fP_chgTime:integer;
  end;

var
  frmPlanChgHisList: TfrmPlanChgHisList;

implementation
uses
  U_global,U_formPas;
{$R *.dfm}

procedure TfrmPlanChgHisList.TcloseClick(Sender: TObject);
begin
  close;
end;

procedure TfrmPlanChgHisList.FormCreate(Sender: TObject);
begin
  cxGrid1.Align :=alClient;
  with ADOConnection1 do
  begin
    Connected:=false;
    ConnectionString:=gConString;
    Connected:=true;
  end;  
end;
/////////////////////////////////////////////////////////////
  //
/////////////////////////////////////////////////////////////
procedure TfrmPlanChgHisList.DoQuery();
begin
  try
    ADOQuery_his.DisableControls ;
    with ADOQuery_his do
    begin
      close;
      sql.clear;
      sql.Add('exec P_Select_PlanChgHisList');
      sql.Add(quotedStr('ZR'));
      Sql.Add(',1'); 
      sql.Add(','+quotedStr(fPlanNO));
      sql.Add(','+quotedStr(fP_seqNO));
      //sql.Add('and B.P_chgTime='+intTostr(fP_chgTime));
      Open;
    end;
  finally
    ADOQuery_his.EnableControls ;
  end;
end;

procedure TfrmPlanChgHisList.FormShow(Sender: TObject);
begin
  DoQuery();
end;

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

end.
