unit U_SingleFtyStatement; 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, cxDropDownEdit, RM_e_Xls, cxGridBandedTableView, cxGridDBBandedTableView, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, dxSkinBasic, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom, dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine, dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, dxScrollbarAnnotations, cxContainer, dxCore, cxDateUtils; type TfrmSingleFtyStatement = class(TForm) ToolBar1: TToolBar; TBRafresh: TToolButton; TBClose: TToolButton; ADOQueryTemp: TADOQuery; ADOQueryCmd: TADOQuery; Panel1: TPanel; Label1: TLabel; MPRTCodeName: TEdit; ADOQueryMain: TADOQuery; ToolButton1: TToolButton; Label3: TLabel; OrderNo: TEdit; cxGrid2: TcxGrid; cxGridLevel1: TcxGridLevel; Label2: TLabel; Label6: TLabel; cxGridPopupMenu2: TcxGridPopupMenu; DS_HZ: TDataSource; CDS_HZ: TClientDataSet; Label4: TLabel; OrdDefNote3: TComboBox; Label5: TLabel; ToolButton3: TToolButton; RMGridReport1: TRMGridReport; RMDBDataSet1: TRMDBDataSet; RMXLSExport1: TRMXLSExport; ADOQueryPrint: TADOQuery; TV1: TcxGridDBBandedTableView; V1Column2: TcxGridDBBandedColumn; V1Column4: TcxGridDBBandedColumn; V1Column5: TcxGridDBBandedColumn; V1Column6: TcxGridDBBandedColumn; V1Column7: TcxGridDBBandedColumn; V1Column8: TcxGridDBBandedColumn; V1Column9: TcxGridDBBandedColumn; V1Column12: TcxGridDBBandedColumn; V1Column15: TcxGridDBBandedColumn; V1Column3: TcxGridDBBandedColumn; V1Column10: TcxGridDBBandedColumn; V1Column14: TcxGridDBBandedColumn; V1Column16: TcxGridDBBandedColumn; V1Column17: TcxGridDBBandedColumn; V1Column20: TcxGridDBBandedColumn; V1Column21: TcxGridDBBandedColumn; V1Column22: TcxGridDBBandedColumn; V1Column23: TcxGridDBBandedColumn; V1Column25: TcxGridDBBandedColumn; V1Column26: TcxGridDBBandedColumn; V1Column33: TcxGridDBBandedColumn; V1Column34: TcxGridDBBandedColumn; ToolButton2: TToolButton; TV1Column1: TcxGridDBBandedColumn; TV1Column2: TcxGridDBBandedColumn; begdate: TcxDateEdit; Enddate: TcxDateEdit; OppCoName: TcxTextEdit; TV1Column3: TcxGridDBBandedColumn; TV1Column4: TcxGridDBBandedColumn; TV1Column5: 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 P_OrderNo_YSK(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure ToolButton2Click(Sender: TObject); private { Private declarations } procedure InitGrid(); public { Public declarations } FOppCoNo, FCurrency: string; end; var frmSingleFtyStatement: TfrmSingleFtyStatement; implementation uses U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint; {$R *.dfm} procedure TfrmSingleFtyStatement.InitGrid(); begin with ADOQueryMain do begin Close; SQL.Clear; Filtered := False; sql.Add(' exec P_Fin_FtyStatementSingle '); sql.Add(' @Begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.Date)))); sql.Add(' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.Date + 1)))); sql.Add(' ,@OppCoNo=' + QuotedStr(Trim(FOppCoNo))); sql.Add(' ,@Currency=' + QuotedStr(Trim(FCurrency))); Open; end; SCreateCDS(ADOQueryMain, CDS_HZ); SInitCDSData(ADOQueryMain, CDS_HZ); end; procedure TfrmSingleFtyStatement.FormDestroy(Sender: TObject); begin frmSingleFtyStatement := nil; end; procedure TfrmSingleFtyStatement.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; procedure TfrmSingleFtyStatement.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmSingleFtyStatement.FormShow(Sender: TObject); begin readCxBandedGrid(trim(self.Caption), Tv1, '财务管理'); InitGrid(); end; procedure TfrmSingleFtyStatement.TBRafreshClick(Sender: TObject); begin begdate.SetFocus; InitGrid(); end; procedure TfrmSingleFtyStatement.P_OrderNo_YSK(Sender: TObject); begin ToolButton2.Click; end; procedure TfrmSingleFtyStatement.ToolButton1Click(Sender: TObject); begin if ADOQueryMain.IsEmpty then Exit; TcxGridToExcel(self.Caption + '-' + trim(OppCoName.Text), cxgrid2); end; procedure TfrmSingleFtyStatement.ToolButton2Click(Sender: TObject); begin WriteCxBandedGrid(trim(self.Caption), Tv1, '财务管理'); end; procedure TfrmSingleFtyStatement.FormCreate(Sender: TObject); begin cxGrid2.Align := AlClient; Enddate.Date := SGetServerDate(ADOQueryTemp); begdate.Date := Enddate.Date; end; procedure TfrmSingleFtyStatement.ToolButton3Click(Sender: TObject); var WSql: string; begin if CDS_HZ.IsEmpty then exit; WSql := ' @Begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.Date))); WSql := WSql + ' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.Date + 1))); WSql := WSql + ' ,@OppCoNo=' + QuotedStr(Trim(FOppCoNo)); WSql := WSql + ' ,@Currency=' + QuotedStr(Trim(FCurrency)); try frmLabelPrint := TfrmLabelPrint.Create(Application); with frmLabelPrint do begin IsSql1 := True; FLMType := 'SingleFtyStatement'; FFiltration1 := WSql; if ShowModal = 1 then begin // Self.InitGrid(); end; end; finally frmLabelPrint.Free; end; end; end.