unit U_ClothKCQty; 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; type TfrmClothKCQty = class(TForm) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBExport: TToolButton; TBPrint: TToolButton; TBClose: TToolButton; Panel1: TPanel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label5: TLabel; Label4: TLabel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; ConNoM: TEdit; C_CodeNameM: TEdit; C_Spec: TEdit; cxGrid1DBTableView1: TcxGridDBTableView; cxGrid1Level1: TcxGridLevel; cxGrid1: TcxGrid; Tv1: TcxGridDBBandedTableView; v1Column1: TcxGridDBBandedColumn; v1Column2: TcxGridDBBandedColumn; v1Column3: TcxGridDBBandedColumn; v1Column4: TcxGridDBBandedColumn; v1Column5: TcxGridDBBandedColumn; v1Column6: TcxGridDBBandedColumn; v1Column8: TcxGridDBBandedColumn; v1Column9: TcxGridDBBandedColumn; v1Column10: TcxGridDBBandedColumn; v1Column11: TcxGridDBBandedColumn; v1Column12: TcxGridDBBandedColumn; v1Column13: TcxGridDBBandedColumn; v1Column14: TcxGridDBBandedColumn; v1Column15: TcxGridDBBandedColumn; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; cxGridPopupMenu1: TcxGridPopupMenu; procedure FormDestroy(Sender: TObject); 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 TBFindClick(Sender: TObject); private procedure InitGrid(); { Private declarations } public { Public declarations } end; var frmClothKCQty: TfrmClothKCQty; implementation uses U_DataLink,U_Fun; {$R *.dfm} procedure TfrmClothKCQty.FormDestroy(Sender: TObject); begin frmClothKCQty:=nil; end; procedure TfrmClothKCQty.FormClose(Sender: TObject; var Action: TCloseAction); begin Action:=caFree; end; procedure TfrmClothKCQty.FormCreate(Sender: TObject); begin cxGrid1.Align:=alClient; BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7; EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp) end; procedure TfrmClothKCQty.InitGrid(); begin try ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered:=False; Close; sql.Clear; sql.Add('exec Cloth_KCQty :begdate,:enddate'); Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime)); Parameters.ParamByName('enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)); Open; end; finally ADOQueryMain.EnableControls; end; end; procedure TfrmClothKCQty.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmClothKCQty.ConNoMChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2)); end; end; procedure TfrmClothKCQty.TBCloseClick(Sender: TObject); begin WriteCxBandedGrid('矗票踱湔',Tv1,'矗票'); Close; end; procedure TfrmClothKCQty.FormShow(Sender: TObject); begin ReadCxBandedGrid('矗票踱湔',Tv1,'矗票'); InitGrid(); end; procedure TfrmClothKCQty.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then exit; TcxGridToExcel('矗票踱湔',cxGrid1); end; procedure TfrmClothKCQty.TBFindClick(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2)); end; end; end.