unit U_JYColorOrdList;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus,
  MovePanel, cxTextEdit, cxContainer, cxCurrencyEdit, BtnEdit, RM_e_main, RM_e_htm, RM_e_Graphic, RM_e_Jpeg, RM_e_txt, RM_e_csv, RM_E_llPDF, Math,
  cxPC, Buttons;

type
  TfrmJYColorOrdList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBClose: TToolButton;
    TBExport: TToolButton;
    cxGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    v1Column4: TcxGridDBColumn;
    v1MLOrderNo: TcxGridDBColumn;
    v1MLConNo: TcxGridDBColumn;
    v1MLCodeName: TcxGridDBColumn;
    v1KHName: TcxGridDBColumn;
    v1Column31: TcxGridDBColumn;
    v1MLColorNo: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    v1Column1: TcxGridDBColumn;
    MovePanel2: TMovePanel;
    Order_Main: TClientDataSet;
    DataSource1: TDataSource;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    cxGridPopupMenu1: TcxGridPopupMenu;
    v1Column6: TcxGridDBColumn;
    Panel1: TPanel;
    Label12: TLabel;
    Label7: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    MPRTKZ: TEdit;
    status: TComboBox;
    FBegDate: TDateTimePicker;
    FEndDate: TDateTimePicker;
    MLOrderNo: TEdit;
    KHNameJC: TEdit;
    YWY: TEdit;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure MLOrderNoChange(Sender: TObject);
  private
    DQdate: TDateTime;
    FLeft, FTop: Integer;
    CurrentPage, RecordsNumber: Integer;
    canshu1: string;
    procedure InitGrid();
    procedure InitForm();
    { Private declarations }
  public
    FFInt: Integer;
    FNewMLID:String;
    { Public declarations }
  end;

var
  frmJYColorOrdList: TfrmJYColorOrdList;

implementation

uses
  U_DataLink, U_Fun, U_ZDYHelp,U_RTFun,U_JYOrdColorList;

{$R *.dfm}


procedure TfrmJYColorOrdList.FormDestroy(Sender: TObject);
begin
  frmJYColorOrdList := nil;
end;

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

procedure TfrmJYColorOrdList.TBCloseClick(Sender: TObject);
begin
  Close;
  WriteCxGrid('打卷产量统计查询Color', Tv1, '订单管理');
end;

procedure TfrmJYColorOrdList.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Close;
      SQL.Clear;
      Filtered:=False;
      sql.Add(' exec P_View_JYColorData :FBegdate,:FEndDate,:NewMLId ') ;
      Parameters.ParamByName('FBegdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',FBegDate.Date));
      Parameters.ParamByName('FEndDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',FEndDate.Date+1));
      Parameters.ParamByName('NewMLId').Value:=Trim(FNewMLID);
      Open;
    end;
    SCreateCDS20(ADOQueryMain,Order_Main);
    SInitCDSData20(ADOQueryMain,Order_Main);
  finally
    ADOQueryMain.EnableControls;
  end;
end;
procedure TfrmJYColorOrdList.InitForm();
begin
  ReadCxGrid('打卷产量统计查询Color', Tv1, '订单管理');
  InitGrid();
end;

procedure TfrmJYColorOrdList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then
    Exit;
  SelExportData(Tv1, ADOQueryMain, '颜色打卷产量统计查询');
end;

procedure TfrmJYColorOrdList.TBRafreshClick(Sender: TObject);
begin
  toolbar1.SetFocus;
  InitGrid();
end;

procedure TfrmJYColorOrdList.FormShow(Sender: TObject);
begin
  InitForm();
end;

procedure TfrmJYColorOrdList.MLOrderNoChange(Sender: TObject);
begin
  if ADOQueryMain.Active = False then Exit;
  SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
  SCreateCDS20(ADOQueryMain, Order_Main);
  SInitCDSData20(ADOQueryMain, Order_Main);
end;

end.


