unit U_DyeBSClothPSCList; 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, MovePanel, cxButtonEdit, cxTextEdit, cxTimeEdit, cxCalendar, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList; type TfrmDyeBSClothPSCList = class(TfrmBaseList) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBExport: TToolButton; TBClose: TToolButton; Panel1: TPanel; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; cxGridPopupMenu1: TcxGridPopupMenu; Label3: TLabel; C_Name: TEdit; Label1: TLabel; Label2: TLabel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; CDS_Main: TClientDataSet; Label6: TLabel; MJID: TEdit; MovePanel2: TMovePanel; cxGrid2: TcxGrid; TV1: TcxGridDBBandedTableView; cxGridLevel1: TcxGridLevel; TV1Column1: TcxGridDBBandedColumn; TV1Column3: TcxGridDBBandedColumn; TV1Column5: TcxGridDBBandedColumn; TV1Column6: TcxGridDBBandedColumn; TV1Column7: TcxGridDBBandedColumn; TV1Column10: TcxGridDBBandedColumn; ToolButton1: TToolButton; TV1Column12: TcxGridDBBandedColumn; TV1Column13: TcxGridDBBandedColumn; TV1Column14: TcxGridDBBandedColumn; TV1Column15: TcxGridDBBandedColumn; TV1Column2: TcxGridDBBandedColumn; 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); procedure C_NameChange(Sender: TObject); procedure PRTColorChange(Sender: TObject); procedure ToolButton1Click(Sender: TObject); private procedure InitGrid(); { Private declarations } public { Public declarations } end; var frmDyeBSClothPSCList: TfrmDyeBSClothPSCList; implementation uses U_DataLink, U_RTFun, U_ZDYHelp; {$R *.dfm} procedure TfrmDyeBSClothPSCList.FormDestroy(Sender: TObject); begin inherited; frmDyeBSClothPSCList := nil; end; procedure TfrmDyeBSClothPSCList.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; end; procedure TfrmDyeBSClothPSCList.FormCreate(Sender: TObject); begin inherited; BegDate.DateTime := SGetServerDateTime(ADOQueryTemp) - 30; EndDate.DateTime := SGetServerDateTime(ADOQueryTemp) end; procedure TfrmDyeBSClothPSCList.InitGrid(); begin try ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered := False; Close; sql.Clear; sql.Add('exec P_BS_Cloth_PSC '); sql.Add(' @STKName=''染色坯布'' '); sql.Add(',@Begdate=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime)))); sql.Add(',@Enddate=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime)))); Open; end; SCreateCDS(ADOQueryMain, CDS_Main); SInitCDSData(ADOQueryMain, CDS_Main); finally ADOQueryMain.EnableControls; end; end; procedure TfrmDyeBSClothPSCList.TBRafreshClick(Sender: TObject); begin MovePanel2.Visible := True; MovePanel2.Refresh; InitGrid(); MovePanel2.Visible := False; end; procedure TfrmDyeBSClothPSCList.ToolButton1Click(Sender: TObject); begin WriteCxBandedGrid(self.Caption + tv1.Name, Tv1, '成品仓库'); end; procedure TfrmDyeBSClothPSCList.ConNoMChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); end; end; procedure TfrmDyeBSClothPSCList.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmDyeBSClothPSCList.FormShow(Sender: TObject); begin inherited; ReadCxBandedGrid(self.Caption + tv1.Name, Tv1, '成品仓库'); end; procedure TfrmDyeBSClothPSCList.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then exit; TcxGridToExcel('库存汇总列表', cxGrid2); end; procedure TfrmDyeBSClothPSCList.TBFindClick(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_Main); SInitCDSData(ADOQueryMain, CDS_Main); end; end; procedure TfrmDyeBSClothPSCList.C_NameChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDyeBSClothPSCList.PRTColorChange(Sender: TObject); begin TBFind.Click; end; end.