unit U_DyeClothPSI; 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, cxCalendar, RM_System, RM_Common, RM_Class, RM_GridReport, RM_Dataset, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList; type TfrmDyeClothPSI = class(TfrmBaseList) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBExport: TToolButton; TBPrint: 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; cxGrid2Level1: TcxGridLevel; cxGrid2: TcxGrid; MovePanel2: TMovePanel; Label10: TLabel; RMGridReport1: TRMGridReport; Saleser: TEdit; Label16: TLabel; custName: TEdit; Label13: TLabel; TV1: TcxGridDBBandedTableView; TV1Column1: TcxGridDBBandedColumn; TV1Column2: TcxGridDBBandedColumn; TV1Column3: TcxGridDBBandedColumn; TV1Column8: TcxGridDBBandedColumn; TV1Column9: TcxGridDBBandedColumn; TV1Column11: TcxGridDBBandedColumn; TV1Column12: TcxGridDBBandedColumn; TV1Column14: TcxGridDBBandedColumn; TV1Column15: TcxGridDBBandedColumn; ThreeColorBase: TcxStyleRepository; SHuangSe: TcxStyle; SkyBlue: TcxStyle; Default: TcxStyle; QHuangSe: TcxStyle; Red: TcxStyle; FontBlue: TcxStyle; TextSHuangSe: TcxStyle; FonePurple: TcxStyle; FoneClMaroon: TcxStyle; FoneRed: TcxStyle; RowColor: TcxStyle; handBlack: TcxStyle; cxBlue: TcxStyle; cxStyle1: TcxStyle; RMDBMain: TRMDBDataSet; TV1Column7: TcxGridDBBandedColumn; TV1Column10: TcxGridDBBandedColumn; TV1Column13: TcxGridDBBandedColumn; TV1Column16: TcxGridDBBandedColumn; TV1Column17: TcxGridDBBandedColumn; TV1Column18: TcxGridDBBandedColumn; TV1Column5: TcxGridDBBandedColumn; TV1Column6: TcxGridDBBandedColumn; ToolButton1: TToolButton; 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 TBPrintClick(Sender: TObject); procedure ToolButton1Click(Sender: TObject); private FLeft, FTop: Integer; procedure InitGrid(); { Private declarations } public { Public declarations } end; var frmDyeClothPSI: TfrmDyeClothPSI; implementation uses U_DataLink, U_RTFun, U_ZDYHelp; {$R *.dfm} procedure TfrmDyeClothPSI.FormDestroy(Sender: TObject); begin inherited; frmDyeClothPSI := nil; end; procedure TfrmDyeClothPSI.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; end; procedure TfrmDyeClothPSI.FormCreate(Sender: TObject); begin inherited; BegDate.DateTime := SGetServerDateTime(ADOQueryTemp); EndDate.DateTime := SGetServerDateTime(ADOQueryTemp) end; procedure TfrmDyeClothPSI.InitGrid(); begin try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; sql.Clear; Filtered := False; sql.Add(' exec P_Dye_Cloth_PSI '); sql.Add(' @begdate=''' + formatdateTime('yyyy-MM-dd', begdate.DateTime) + ''' '); sql.Add(',@enddate=''' + formatdateTime('yyyy-MM-dd', enddate.DateTime + 1) + ''' '); Open; end; SCreateCDS(ADOQueryMain, CDS_Main); SInitCDSData(ADOQueryMain, CDS_Main); finally ADOQueryMain.EnableControls; end; end; procedure TfrmDyeClothPSI.TBRafreshClick(Sender: TObject); begin MovePanel2.Visible := True; MovePanel2.Refresh; InitGrid(); MovePanel2.Visible := False; end; procedure TfrmDyeClothPSI.ToolButton1Click(Sender: TObject); begin WriteCxBandedGrid(self.Caption + tv1.Name, Tv1, '成品仓库'); end; procedure TfrmDyeClothPSI.ConNoMChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); end; end; procedure TfrmDyeClothPSI.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmDyeClothPSI.FormShow(Sender: TObject); begin inherited; ReadCxBandedGrid(self.Caption + tv1.Name, Tv1, '成品仓库'); end; procedure TfrmDyeClothPSI.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then exit; TcxGridToExcel(self.Caption, cxgrid2); end; procedure TfrmDyeClothPSI.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 TfrmDyeClothPSI.C_NameChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDyeClothPSI.PRTColorChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDyeClothPSI.TBPrintClick(Sender: TObject); var fPrintFile: string; begin if CDS_Main.IsEmpty then Exit; fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\针织成品库存流水账.rmf'; if FileExists(fPrintFile) then begin RMGridReport1.LoadFromFile(fPrintFile); //MVariables['SYRName']:=Trim(SYRName); RMVariables['begdate'] := formatdateTime('yyyy-MM-dd', begdate.DateTime); RMVariables['enddate'] := formatdateTime('yyyy-MM-dd', enddate.DateTime); RMGridReport1.ShowReport; end else begin Application.MessageBox(PChar('没有找' + trim(fPrintFile)), '提示', 0); end; end; end.