149 lines
4.1 KiB
ObjectPascal
149 lines
4.1 KiB
ObjectPascal
unit U_FYDJ_Tj;
|
||
|
||
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, cxPC;
|
||
|
||
type
|
||
TfrmFYDJ_TJ = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
TBfind: TToolButton;
|
||
Label1: TLabel;
|
||
FeeName: TEdit;
|
||
ADOQueryMain: TADOQuery;
|
||
TBexcel: TToolButton;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v2Column5: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Label2: TLabel;
|
||
Label6: TLabel;
|
||
begdate: TDateTimePicker;
|
||
Enddate: TDateTimePicker;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
v2Column9: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBfindClick(Sender: TObject);
|
||
procedure TBexcelClick(Sender: TObject);
|
||
procedure FeeTypeChange(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
fSYRName:string;
|
||
fflag:integer;
|
||
Feeflag:integer;
|
||
{ Public declarations }
|
||
|
||
end;
|
||
|
||
var
|
||
frmFYDJ_TJ: TfrmFYDJ_TJ;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun,U_ZDYHelp,U_FYDJInput,U_ZdyAttachGYS,U_ZdyAttachment;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmFYDJ_TJ.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered:=False;
|
||
SQL.Clear;
|
||
sql.Add(' select A.SYRName,A.FeeType,A.FeeName,sum(money) as money from YF_Money_Fee A ');
|
||
sql.Add(' where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
||
sql.Add(' and A.CRTime<'''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
|
||
sql.Add(' and SYRName='''+trim(fSyrname)+''' ');
|
||
sql.Add(' and Feeflag='''+inttostr(fflag)+''' ');
|
||
sql.Add(' and money<>0 ');
|
||
sql.Add(' group by A.SYRName,A.FeeType,A.FeeName ');
|
||
sql.Add(' order by A.SYRName,A.FeeType,A.FeeName ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
TBfind.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmFYDJ_TJ:=nil;
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(Self.Caption + Tv2.Name,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid(Self.Caption + Tv2.Name,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
||
begdate.DateTime:=strtodateTime(formatdateTime('yyyy-MM',Enddate.DateTime)+'-01');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.TBfindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
|
||
procedure TfrmFYDJ_TJ.TBexcelClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then Exit;
|
||
SelExportData(Tv2,ADOQueryMain,'<27><><EFBFBD>õǼ<C3B5>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>Ϣ');
|
||
end;
|
||
|
||
|
||
procedure TfrmFYDJ_TJ.FeeTypeChange(Sender: TObject);
|
||
begin
|
||
TBfind.Click;
|
||
end;
|
||
|
||
end.
|