unit U_PKHZList; 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, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC, cxCheckBox, Menus, cxDropDownEdit; type TfrmPKHZList = class(TForm) ToolBar1: TToolBar; TBRafresh: TToolButton; TBClose: TToolButton; cxGridPopupMenu1: TcxGridPopupMenu; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; TBExport: TToolButton; Order_Main: TClientDataSet; RM1: TRMGridReport; RMDBMain: TRMDBDataSet; RMXLSExport1: TRMXLSExport; CDS_PRT: TClientDataSet; ToolButton3: TToolButton; cxGridPopupMenu2: TcxGridPopupMenu; Panel1: TPanel; Label2: TLabel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; FactoryName: TEdit; Label6: TLabel; cxGrid1: TcxGrid; Tv1: TcxGridDBTableView; v1Column6: TcxGridDBColumn; v1Column5: TcxGridDBColumn; v1Column3: TcxGridDBColumn; v1Column8: TcxGridDBColumn; v1Column4: TcxGridDBColumn; v1Column11: TcxGridDBColumn; v1Column7: TcxGridDBColumn; v1ShipDate: TcxGridDBColumn; v1Column12: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; Label1: TLabel; v1Column21: TcxGridDBColumn; v1Column22: TcxGridDBColumn; ToolButton1: TToolButton; v1Column1: TcxGridDBColumn; cxTabControl1: TcxTabControl; v1Column16: TcxGridDBColumn; v1Column17: TcxGridDBColumn; v1Column19: TcxGridDBColumn; v1Column20: TcxGridDBColumn; v1Column23: TcxGridDBColumn; v1Column24: TcxGridDBColumn; v1Column26: TcxGridDBColumn; CDS_FX: TClientDataSet; v1Column2: TcxGridDBColumn; v1Column9: TcxGridDBColumn; Label3: TLabel; Label4: TLabel; PayMent: TEdit; ComTaiTou: TEdit; Label5: TLabel; BZType: TComboBox; Label7: TLabel; JBPerson: TEdit; Label8: TLabel; PKName: 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 cxPageControl1Change(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure cxTabControl1Change(Sender: TObject); procedure FactoryNameChange(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure v1Column17PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); private FInt,PFInt:Integer; canshu1,canshu2:string; FNowDate:TDateTime; procedure InitGrid(); procedure InitForm(); { Private declarations } public { Public declarations } end; var frmPKHZList: TfrmPKHZList; implementation uses U_DataLink,U_RTFun,U_ModuleNote, U_ZDYHelp; {$R *.dfm} procedure TfrmPKHZList.FormDestroy(Sender: TObject); begin frmPKHZList:=nil; end; procedure TfrmPKHZList.FormClose(Sender: TObject; var Action: TCloseAction); begin Action:=caFree; end; procedure TfrmPKHZList.TBCloseClick(Sender: TObject); begin Close; WriteCxGrid('资金申请汇总列表',Tv1,'财务管理'); end; procedure TfrmPKHZList.InitGrid(); var fsj:String; begin try ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered:=False; Close; sql.Clear; sql.Add(' select A.*'); SQL.Add(' from YF_Money_PaiKuan A where 1=1 '); if cxTabControl1.TabIndex<>0 then begin sql.Add(' and A.PKDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+''''); sql.Add(' and A.PKDate<'''+Trim(FormatDateTime('yyyy-MM-dd',Enddate.Date+1))+''''); end; sql.Add(' and isnull(ChkStatus,'''')<>'''' '); if cxTabControl1.TabIndex=0 then begin sql.Add(' and isnull(ChkStatus,'''')=''已送审'' '); end else if cxTabControl1.TabIndex=1 then begin sql.Add(' and isnull(ChkStatus,'''')=''审核通过'' '); end else if cxTabControl1.TabIndex=2 then begin sql.Add(' and isnull(ChkStatus,'''')=''审核不通过'' '); end; Open; end; SCreateCDS20(ADOQueryMain,Order_Main); SInitCDSData20(ADOQueryMain,Order_Main); finally ADOQueryMain.EnableControls; end; end; procedure TfrmPKHZList.InitForm(); var fsj:string; begin FNowDate:=SGetServerDate(ADOQueryTemp); EndDate.Date:=FNowDate; begdate.DateTime:=StrToDate(Trim(FormatDateTime('yyyy-MM',SGetServerDate(ADOQueryTemp)))+'-01'); ReadCxGrid('资金申请汇总列表',Tv1,'财务管理'); end; procedure TfrmPKHZList.TBExportClick(Sender: TObject); begin if Order_Main.IsEmpty then Exit; TcxGridToExcel('资金申请汇总列表',cxGrid1); end; procedure TfrmPKHZList.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmPKHZList.FormShow(Sender: TObject); begin InitForm(); end; procedure TfrmPKHZList.cxPageControl1Change(Sender: TObject); begin InitGrid(); end; procedure TfrmPKHZList.ToolButton3Click(Sender: TObject); begin try frmModuleNote:=TfrmModuleNote.Create(Application); with frmModuleNote do begin flag:='资金申请审核'; if ShowModal=1 then begin end; end; finally frmModuleNote.Free; end; end; procedure TfrmPKHZList.FormCreate(Sender: TObject); begin canshu1:=Trim(DParameters1); canshu2:=Trim(DParameters2); end; procedure TfrmPKHZList.cxTabControl1Change(Sender: TObject); begin InitGrid(); end; procedure TfrmPKHZList.FactoryNameChange(Sender: TObject); begin if ADOQueryMain.Active=False then Exit; SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2)); SCreateCDS20(ADOQueryMain,Order_Main); SInitCDSData20(ADOQueryMain,Order_Main); end; procedure TfrmPKHZList.ToolButton1Click(Sender: TObject); begin if ADOQueryMain.Active=False then Exit; SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2)); SCreateCDS20(ADOQueryMain,Order_Main); SInitCDSData20(ADOQueryMain,Order_Main); end; procedure TfrmPKHZList.N1Click(Sender: TObject); begin SelOKNo(Order_Main,True); end; procedure TfrmPKHZList.N2Click(Sender: TObject); begin SelOKNo(Order_Main,False); end; procedure TfrmPKHZList.v1Column17PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='GSTT'; flagname:='公司抬头'; V1ZdyStr1.Visible:=True; V1ZdyStr2.Visible:=True; V1ZdyStr3.Visible:=True; V1ZdyStr4.Visible:=True; V1ZdyStr1.Caption:='简称'; V1ZdyStr2.Caption:='电话'; V1ZdyStr3.Caption:='传真'; V1ZdyStr4.Caption:='地址'; frmZDYHelp.Align:=alClient; if ShowModal=1 then begin with Self.Order_Main do begin Edit; FieldByName('ComTaiTou').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; end; finally frmZDYHelp.Free; end; end; end.