unit U_KnitPlanProgress; 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, cxCalendar, cxButtonEdit, cxTextEdit, cxDBLookupComboBox, cxGridBandedTableView, cxGridDBBandedTableView, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, U_BaseHelp, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, System.ImageList, Vcl.ImgList, U_BaseList, dxSkinWXI, dxScrollbarAnnotations, cxContainer, dxCore, cxDateUtils, cxDropDownEdit; type TfrmKnitPlanProgress = class(TfrmBaseList) ToolBar1: TToolBar; TBRafresh: TToolButton; TBClose: TToolButton; ADOQueryTemp: TADOQuery; ADOQueryCmd: TADOQuery; Panel1: TPanel; ToolButton2: TToolButton; ToolButton1: TToolButton; RM1: TRMGridReport; RMDBHZ: TRMDBDataSet; Label3: TLabel; C_Name: TcxTextEdit; cxGridPopupMenu2: TcxGridPopupMenu; Label1: TLabel; C_Code: TcxTextEdit; EndDate: TcxDateEdit; Label4: TLabel; Label5: TLabel; Begdate: TcxDateEdit; cxGrid1: TcxGrid; TV1: TcxGridDBBandedTableView; cxGridDBBandedColumn35: TcxGridDBBandedColumn; cxGridDBBandedColumn42: TcxGridDBBandedColumn; cxGridDBBandedColumn51: TcxGridDBBandedColumn; cxGridDBBandedColumn52: TcxGridDBBandedColumn; cxGridDBBandedColumn61: TcxGridDBBandedColumn; cxGridDBBandedColumn63: TcxGridDBBandedColumn; cxGridDBBandedColumn77: TcxGridDBBandedColumn; cxGridDBBandedColumn79: TcxGridDBBandedColumn; cxGridDBBandedColumn87: TcxGridDBBandedColumn; cxGridDBBandedColumn91: TcxGridDBBandedColumn; cxGridLevel2: TcxGridLevel; V1Column26: TcxGridDBBandedColumn; V1Column27: TcxGridDBBandedColumn; V1Column5: TcxGridDBBandedColumn; V1Column7: TcxGridDBBandedColumn; Label6: TLabel; orderno: TcxTextEdit; CDSPRTHZ: TClientDataSet; CDSPRTMX: TClientDataSet; RMDBMX: TRMDBDataSet; ADOQueryMain: TADOQuery; DataSource1: TDataSource; CDS_HZ: TClientDataSet; V1Column3: TcxGridDBBandedColumn; V1Column8: TcxGridDBBandedColumn; V1Column9: TcxGridDBBandedColumn; V1Column11: TcxGridDBBandedColumn; TV1Column4: TcxGridDBBandedColumn; TV1Column16: TcxGridDBBandedColumn; TV1Column17: TcxGridDBBandedColumn; cxStyleRepository1: TcxStyleRepository; cxStyle1: TcxStyle; TV1Column1: TcxGridDBBandedColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure C_NameChange(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } canshu1: string; procedure InitGrid(); public fkhType: string; Fmanage: string; end; var frmKnitPlanProgress: TfrmKnitPlanProgress; implementation uses U_DataLink, U_RTFun, U_ZDYHelp; {$R *.dfm} procedure TfrmKnitPlanProgress.InitGrid(); var fwhere, Pwhere: string; begin // if trim(canshu1) <> '管理' then // begin // Saleser.text := trim(DName); // Saleser.Enabled := False; // end; Pwhere := SGetFilters(Panel1, 1, 2); if trim(Pwhere) <> '' then begin if fwhere <> '' then fwhere := fwhere + ' and ' + trim(Pwhere) else fwhere := ' and ' + trim(Pwhere); end; try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; SQL.Clear; sql.Add(' exec P_Knit_Plan_Progress @Begdate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', Begdate.Date)))); sql.Add(',@enddate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)))); sql.Add(',@criteria= ' + quotedstr(fwhere)); // ShowMessage(sql.text); Open; end; SCreateCDS(ADOQueryMain, CDS_HZ); SInitCDSData(ADOQueryMain, CDS_HZ); // CDS_HZ.Last; finally ADOQueryMain.EnableControls; end; end; procedure TfrmKnitPlanProgress.FormDestroy(Sender: TObject); begin inherited; frmKnitPlanProgress := nil; end; procedure TfrmKnitPlanProgress.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; end; procedure TfrmKnitPlanProgress.TBCloseClick(Sender: TObject); begin WriteCxBandedGrid(trim(self.caption), Tv1, '进度管理66'); Close; end; procedure TfrmKnitPlanProgress.FormShow(Sender: TObject); begin inherited; canshu1 := self.fParameters1; ReadCxBandedGrid(trim(self.caption), Tv1, '进度管理66'); // InitGrid(); end; procedure TfrmKnitPlanProgress.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmKnitPlanProgress.ToolButton2Click(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_HZ); SInitCDSData(ADOQueryMain, CDS_HZ); end; end; procedure TfrmKnitPlanProgress.C_NameChange(Sender: TObject); begin ToolButton2.Click; end; procedure TfrmKnitPlanProgress.ToolButton1Click(Sender: TObject); begin if ADOQueryMain.IsEmpty then Exit; TcxGridToExcel(self.Caption, cxgrid1); end; procedure TfrmKnitPlanProgress.FormCreate(Sender: TObject); begin inherited; canshu1 := Trim(DParameters1); EndDate.Date := SGetServerDate(ADOQueryTemp); BegDate.Date := EndDate.Date - 90; end; end.