多维度统计模版
This commit is contained in:
parent
821eecf691
commit
a0564ff5dd
321
public10/design/U_QryPivotBaseList.dfm
Normal file
321
public10/design/U_QryPivotBaseList.dfm
Normal file
|
@ -0,0 +1,321 @@
|
||||||
|
object frmQryPivotBaseList: TfrmQryPivotBaseList
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Caption = 'frmQryPivotBaseList'
|
||||||
|
ClientHeight = 453
|
||||||
|
ClientWidth = 1037
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = GB2312_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -16
|
||||||
|
Font.Name = #24494#36719#38597#40657
|
||||||
|
Font.Style = []
|
||||||
|
OldCreateOrder = False
|
||||||
|
OnClose = FormClose
|
||||||
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
|
OnShow = FormShow
|
||||||
|
PixelsPerInch = 96
|
||||||
|
TextHeight = 21
|
||||||
|
object ToolBar3: TToolBar
|
||||||
|
Tag = 1
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 1037
|
||||||
|
Height = 27
|
||||||
|
AutoSize = True
|
||||||
|
ButtonHeight = 27
|
||||||
|
ButtonWidth = 92
|
||||||
|
Caption = 'ToolBar1'
|
||||||
|
GradientEndColor = clWindow
|
||||||
|
List = True
|
||||||
|
GradientDrawingOptions = [gdoHotTrack]
|
||||||
|
ShowCaptions = True
|
||||||
|
TabOrder = 0
|
||||||
|
object Trefresh: TToolButton
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
AutoSize = True
|
||||||
|
Caption = #26597#35810
|
||||||
|
ImageIndex = 8
|
||||||
|
OnClick = TrefreshClick
|
||||||
|
end
|
||||||
|
object Tprint: TToolButton
|
||||||
|
Left = 48
|
||||||
|
Top = 0
|
||||||
|
AutoSize = True
|
||||||
|
Caption = #23548#20986'Excel'
|
||||||
|
ImageIndex = 28
|
||||||
|
OnClick = TprintClick
|
||||||
|
end
|
||||||
|
object TprintGrid: TToolButton
|
||||||
|
Left = 134
|
||||||
|
Top = 0
|
||||||
|
AutoSize = True
|
||||||
|
Caption = #25171#21360
|
||||||
|
ImageIndex = 21
|
||||||
|
end
|
||||||
|
object TsaveGrid: TToolButton
|
||||||
|
Left = 182
|
||||||
|
Top = 0
|
||||||
|
AutoSize = True
|
||||||
|
Caption = #20445#23384#26684#24335
|
||||||
|
ImageIndex = 30
|
||||||
|
end
|
||||||
|
object TgridLiSet: TToolButton
|
||||||
|
Left = 262
|
||||||
|
Top = 0
|
||||||
|
AutoSize = True
|
||||||
|
Caption = #34920#26684#21015#35774#32622
|
||||||
|
ImageIndex = 16
|
||||||
|
end
|
||||||
|
object Tclose: TToolButton
|
||||||
|
Left = 358
|
||||||
|
Top = 0
|
||||||
|
AutoSize = True
|
||||||
|
Caption = #20851#38381
|
||||||
|
ImageIndex = 7
|
||||||
|
OnClick = TcloseClick
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inline frmFrameDateSel1: TfrmFrameDateSel10
|
||||||
|
Left = 0
|
||||||
|
Top = 27
|
||||||
|
Width = 1037
|
||||||
|
Height = 45
|
||||||
|
Align = alTop
|
||||||
|
AutoSize = True
|
||||||
|
Color = clBtnFace
|
||||||
|
ParentBackground = False
|
||||||
|
ParentColor = False
|
||||||
|
TabOrder = 1
|
||||||
|
ExplicitTop = 27
|
||||||
|
ExplicitWidth = 1037
|
||||||
|
inherited dxLayoutControl1: TdxLayoutControl
|
||||||
|
Width = 1037
|
||||||
|
ExplicitWidth = 1037
|
||||||
|
inherited BegDate: TcxDateEdit
|
||||||
|
Left = 116
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 116
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited EndDate: TcxDateEdit
|
||||||
|
Left = 265
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 265
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited cxButton1: TcxButton
|
||||||
|
Left = 465
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 465
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited cxButton2: TcxButton
|
||||||
|
Left = 625
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 625
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited cxButton3: TcxButton
|
||||||
|
Left = 756
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 756
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited cbbType: TcxComboBox
|
||||||
|
Left = 705
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 705
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited cxButton4: TcxButton
|
||||||
|
Left = 385
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 385
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited cxButton5: TcxButton
|
||||||
|
Left = 545
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 545
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited TimeType: TcxComboBox
|
||||||
|
Left = 16
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 16
|
||||||
|
ExplicitTop = 11
|
||||||
|
end
|
||||||
|
inherited jqModel: TcxCheckBox
|
||||||
|
Left = 859
|
||||||
|
Top = 11
|
||||||
|
ExplicitLeft = 859
|
||||||
|
ExplicitTop = 11
|
||||||
|
ExplicitWidth = 82
|
||||||
|
ExplicitHeight = 25
|
||||||
|
end
|
||||||
|
inherited dxLayoutControl1Group_Root: TdxLayoutGroup
|
||||||
|
ItemIndex = 1
|
||||||
|
end
|
||||||
|
inherited dxLayoutItem1: TdxLayoutItem
|
||||||
|
CaptionOptions.Text = 'New Item'
|
||||||
|
end
|
||||||
|
inherited dxLayoutItem2: TdxLayoutItem
|
||||||
|
CaptionOptions.Text = 'New Item'
|
||||||
|
end
|
||||||
|
inherited dxLayoutItem8: TdxLayoutItem
|
||||||
|
CaptionOptions.Text = 'New Item'
|
||||||
|
end
|
||||||
|
inherited dxLayoutItem9: TdxLayoutItem
|
||||||
|
CaptionOptions.Text = 'New Item'
|
||||||
|
end
|
||||||
|
inherited dxLayoutItem10: TdxLayoutItem
|
||||||
|
ControlOptions.OriginalHeight = 25
|
||||||
|
ControlOptions.OriginalWidth = 82
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object dxLayoutControl_query: TdxLayoutControl
|
||||||
|
Tag = 999
|
||||||
|
Left = 0
|
||||||
|
Top = 72
|
||||||
|
Width = 1037
|
||||||
|
Height = 45
|
||||||
|
Align = alTop
|
||||||
|
ParentBackground = True
|
||||||
|
TabOrder = 2
|
||||||
|
Transparent = True
|
||||||
|
LayoutLookAndFeel = BaseDataLink.dxLayoutSkinLookAndFeel1
|
||||||
|
OptionsItem.SizableHorz = True
|
||||||
|
OptionsItem.SizableVert = True
|
||||||
|
object dxLayoutControl_queryGroup_Root: TdxLayoutGroup
|
||||||
|
AlignHorz = ahParentManaged
|
||||||
|
AlignVert = avParentManaged
|
||||||
|
CaptionOptions.AlignVert = tavCenter
|
||||||
|
SizeOptions.AssignedValues = [sovSizableHorz, sovSizableVert]
|
||||||
|
SizeOptions.SizableHorz = True
|
||||||
|
SizeOptions.SizableVert = True
|
||||||
|
Hidden = True
|
||||||
|
LayoutDirection = ldHorizontal
|
||||||
|
Padding.Bottom = -5
|
||||||
|
Padding.Top = -5
|
||||||
|
Padding.AssignedValues = [lpavBottom, lpavTop]
|
||||||
|
ShowBorder = False
|
||||||
|
Index = -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Panel_page: TPanel
|
||||||
|
Left = 0
|
||||||
|
Top = 117
|
||||||
|
Width = 1037
|
||||||
|
Height = 37
|
||||||
|
Align = alTop
|
||||||
|
AutoSize = True
|
||||||
|
BevelInner = bvRaised
|
||||||
|
BevelOuter = bvLowered
|
||||||
|
TabOrder = 3
|
||||||
|
DesignSize = (
|
||||||
|
1037
|
||||||
|
37)
|
||||||
|
object LBCPAP: TLabel
|
||||||
|
Left = 425
|
||||||
|
Top = 8
|
||||||
|
Width = 100
|
||||||
|
Height = 20
|
||||||
|
Alignment = taCenter
|
||||||
|
Anchors = [akLeft]
|
||||||
|
AutoSize = False
|
||||||
|
Caption = #24403#21069#39029'/'#24635#39029#25968
|
||||||
|
Layout = tlCenter
|
||||||
|
ExplicitTop = 7
|
||||||
|
end
|
||||||
|
object Label31: TLabel
|
||||||
|
Left = 14
|
||||||
|
Top = 8
|
||||||
|
Width = 96
|
||||||
|
Height = 21
|
||||||
|
Alignment = taCenter
|
||||||
|
Anchors = [akLeft]
|
||||||
|
Caption = #27599#39029#35760#24405#26465#25968
|
||||||
|
Layout = tlCenter
|
||||||
|
end
|
||||||
|
object BTNP: TButton
|
||||||
|
Left = 532
|
||||||
|
Top = 5
|
||||||
|
Width = 78
|
||||||
|
Height = 30
|
||||||
|
Anchors = [akLeft]
|
||||||
|
Caption = #19979#19968#39029
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object BTLP: TButton
|
||||||
|
Left = 338
|
||||||
|
Top = 4
|
||||||
|
Width = 78
|
||||||
|
Height = 31
|
||||||
|
Anchors = [akLeft]
|
||||||
|
Caption = #19978#19968#39029
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object TCBNOR: TcxComboBox
|
||||||
|
Tag = 2
|
||||||
|
Left = 122
|
||||||
|
Top = 2
|
||||||
|
Properties.DropDownListStyle = lsEditFixedList
|
||||||
|
Properties.Items.Strings = (
|
||||||
|
'500'
|
||||||
|
'1000'
|
||||||
|
'5000'
|
||||||
|
'10000')
|
||||||
|
TabOrder = 2
|
||||||
|
Text = '500'
|
||||||
|
Width = 94
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1: TcxDBPivotGrid
|
||||||
|
Left = 16
|
||||||
|
Top = 160
|
||||||
|
Width = 555
|
||||||
|
Height = 250
|
||||||
|
Groups = <>
|
||||||
|
ShowHint = False
|
||||||
|
TabOrder = 4
|
||||||
|
OnDblClick = cxDBPivotGrid1DblClick
|
||||||
|
end
|
||||||
|
object ADOQueryBaseCmd: TADOQuery
|
||||||
|
Parameters = <>
|
||||||
|
Left = 281
|
||||||
|
Top = 248
|
||||||
|
end
|
||||||
|
object ADOQueryBaseTemp: TADOQuery
|
||||||
|
LockType = ltReadOnly
|
||||||
|
Parameters = <>
|
||||||
|
Left = 201
|
||||||
|
Top = 225
|
||||||
|
end
|
||||||
|
object CDS_List: TClientDataSet
|
||||||
|
Aggregates = <>
|
||||||
|
Params = <>
|
||||||
|
Left = 395
|
||||||
|
Top = 280
|
||||||
|
end
|
||||||
|
object ADOQueryList: TADOQuery
|
||||||
|
Connection = DataLink_schedule.ADOLink
|
||||||
|
LockType = ltReadOnly
|
||||||
|
Parameters = <>
|
||||||
|
Left = 704
|
||||||
|
Top = 368
|
||||||
|
end
|
||||||
|
object DataSource1: TDataSource
|
||||||
|
DataSet = CDS_List
|
||||||
|
Left = 768
|
||||||
|
Top = 296
|
||||||
|
end
|
||||||
|
object cxGridPopupMenu1: TcxGridPopupMenu
|
||||||
|
PopupMenus = <>
|
||||||
|
Left = 208
|
||||||
|
Top = 287
|
||||||
|
end
|
||||||
|
end
|
298
public10/design/U_QryPivotBaseList.pas
Normal file
298
public10/design/U_QryPivotBaseList.pas
Normal file
|
@ -0,0 +1,298 @@
|
||||||
|
unit U_QryPivotBaseList;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||||
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin,cxExportPivotGridLink,
|
||||||
|
FrameDateSel10, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
|
||||||
|
dxSkinsCore, dxSkinsDefaultPainters, dxSkinWXI, cxClasses, dxLayoutContainer, cxPivotDrillDownFormUnit,
|
||||||
|
dxLayoutControl, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit,
|
||||||
|
Vcl.StdCtrls, Vcl.ExtCtrls, cxCustomData, cxStyles, dxBarBuiltInMenu,U_WindowFormdesign,
|
||||||
|
cxCustomPivotGrid, cxPivotGrid, cxGridCustomPopupMenu, cxGridPopupMenu, math,
|
||||||
|
Data.DB, Datasnap.DBClient, Data.Win.ADODB, cxDBPivotGrid;
|
||||||
|
|
||||||
|
type
|
||||||
|
TfrmQryPivotBaseList = class(TForm)
|
||||||
|
ToolBar3: TToolBar;
|
||||||
|
Trefresh: TToolButton;
|
||||||
|
Tprint: TToolButton;
|
||||||
|
TprintGrid: TToolButton;
|
||||||
|
TsaveGrid: TToolButton;
|
||||||
|
TgridLiSet: TToolButton;
|
||||||
|
Tclose: TToolButton;
|
||||||
|
frmFrameDateSel1: TfrmFrameDateSel10;
|
||||||
|
dxLayoutControl_query: TdxLayoutControl;
|
||||||
|
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
|
||||||
|
Panel_page: TPanel;
|
||||||
|
LBCPAP: TLabel;
|
||||||
|
Label31: TLabel;
|
||||||
|
BTNP: TButton;
|
||||||
|
BTLP: TButton;
|
||||||
|
TCBNOR: TcxComboBox;
|
||||||
|
ADOQueryBaseCmd: TADOQuery;
|
||||||
|
ADOQueryBaseTemp: TADOQuery;
|
||||||
|
CDS_List: TClientDataSet;
|
||||||
|
ADOQueryList: TADOQuery;
|
||||||
|
DataSource1: TDataSource;
|
||||||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||||
|
cxDBPivotGrid1: TcxDBPivotGrid;
|
||||||
|
procedure TprintClick(Sender: TObject);
|
||||||
|
procedure TrefreshClick(Sender: TObject);
|
||||||
|
procedure TcloseClick(Sender: TObject);
|
||||||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure cxDBPivotGrid1DblClick(Sender: TObject);
|
||||||
|
private
|
||||||
|
fWindowDesign: TWindowFormdesign;
|
||||||
|
CurrentPage, RecordsNumber: Integer;
|
||||||
|
fDesignCode:string;
|
||||||
|
procedure doQuery();
|
||||||
|
procedure doQueryByCriteria();
|
||||||
|
procedure initGrid();
|
||||||
|
protected
|
||||||
|
fParameters1: string;
|
||||||
|
fParameters2: string;
|
||||||
|
fParameters3: string;
|
||||||
|
fParameters4: string;
|
||||||
|
fParameters5: string;
|
||||||
|
fParameters10: string;
|
||||||
|
function GetPivotGrid: TcxCustomPivotGrid; virtual;
|
||||||
|
public
|
||||||
|
fExportFileName:string;
|
||||||
|
fFormId: integer;
|
||||||
|
fProcedureName:string; //存储过程名称
|
||||||
|
FLMType:string; //报表文件类型标志
|
||||||
|
ftimeType:string; //日期类型
|
||||||
|
fQueryType:String; //查询类型
|
||||||
|
FFiltration1:string; //打印参数条件
|
||||||
|
fCriteria:string; //条件参数
|
||||||
|
property PivotGrid: TcxCustomPivotGrid read GetPivotGrid;
|
||||||
|
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
frmQryPivotBaseList: TfrmQryPivotBaseList;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
uses
|
||||||
|
U_RTFun, U_globalVar, U_dataLink,U_FormLayOutDesign, U_LabelPrint;
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
constructor TfrmQryPivotBaseList.Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
if ACaption <> '' then
|
||||||
|
Caption := ACaption;
|
||||||
|
|
||||||
|
fParameters1 := Parameters1;
|
||||||
|
fParameters2 := Parameters2;
|
||||||
|
fParameters3 := Parameters3;
|
||||||
|
fParameters4 := Parameters4;
|
||||||
|
fParameters5 := Parameters5;
|
||||||
|
fParameters10 := Parameters10;
|
||||||
|
fFormId:= FormID ;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.FormClose(Sender: TObject;
|
||||||
|
var Action: TCloseAction);
|
||||||
|
begin
|
||||||
|
Sendmessage(application.MainForm.Handle, WM_CloseForm, 4, 0);
|
||||||
|
|
||||||
|
Action:=cafree;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
cxDBPivotGrid1.Align:=alClient;
|
||||||
|
CurrentPage := 1;
|
||||||
|
RecordsNumber := 500;
|
||||||
|
fWindowDesign := TWindowFormdesign.Create();
|
||||||
|
frmFrameDateSel1.begdate.Date:=SGetServerDate(ADOQueryBaseTemp);
|
||||||
|
frmFrameDateSel1.enddate.Date:=frmFrameDateSel1.begdate.Date;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
fWindowDesign.free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
fDesignCode := fDllFileName +'|'+self.name+ '|' + intTostr(fformId) + '|' + 'cxgrid1';
|
||||||
|
if DParameters8<>'1' then
|
||||||
|
begin
|
||||||
|
fWindowDesign.FormStyleInit10(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10);
|
||||||
|
end;
|
||||||
|
if dxLayoutControl_query.Tag<>999 then
|
||||||
|
readLayOut(dxLayoutControl_query,ADOQueryBaseTemp,PWideChar( fDllFileName+'|'+self.name+'|'+dxLayoutControl_query.Name+'.ini'));
|
||||||
|
fWindowDesign.fProcedureName:=fProcedureName;
|
||||||
|
//增加动态条件
|
||||||
|
addQryContionByLay(ADOQueryBaseTemp,fformId,'cxgrid1',dxLayoutControl_query,7);
|
||||||
|
initGrid();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.TcloseClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.TprintClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
cxExportPivotGridToXLSX(fExportFileName, cxDBPivotGrid1, True, True, '', nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.TrefreshClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if frmFrameDateSel1.BegDate.Visible then
|
||||||
|
begin
|
||||||
|
frmFrameDateSel1.BegDate.SetFocus;
|
||||||
|
end;
|
||||||
|
CurrentPage := 1;
|
||||||
|
initGrid();
|
||||||
|
end;
|
||||||
|
|
||||||
|
///////////////////////////////
|
||||||
|
///
|
||||||
|
procedure TfrmQryPivotBaseList.initGrid();
|
||||||
|
begin
|
||||||
|
if fQueryType='criteria' then
|
||||||
|
begin
|
||||||
|
doQueryByCriteria() ;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
frmFrameDateSel1.jqModel.Checked:=true;
|
||||||
|
doQuery() ;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
procedure TfrmQryPivotBaseList.cxDBPivotGrid1DblClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
ACrossCell: TcxPivotGridCrossCell;
|
||||||
|
begin
|
||||||
|
// with PivotGrid.HitTest do
|
||||||
|
// begin
|
||||||
|
// if HitAtDataCell then
|
||||||
|
// begin
|
||||||
|
// ACrossCell := (HitObject as TcxPivotGridDataCellViewInfo).CrossCell;
|
||||||
|
// if ACrossCell <> nil then
|
||||||
|
// cxShowDrillDownDataSource(ACrossCell);
|
||||||
|
// end;
|
||||||
|
// end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseList.doQuery();
|
||||||
|
var
|
||||||
|
strwhere: string;
|
||||||
|
begin
|
||||||
|
if fProcedureName='' then
|
||||||
|
begin
|
||||||
|
application.MessageBox('存储过程名称参数不能为空!','警告信息',0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
strwhere := GetProcedureParam(dxLayoutControl_query);
|
||||||
|
|
||||||
|
try
|
||||||
|
cxDBPivotGrid1.BeginUpdate();
|
||||||
|
CDS_List.DisableControls;
|
||||||
|
with ADOQueryList do
|
||||||
|
begin
|
||||||
|
close;
|
||||||
|
Filtered := false;
|
||||||
|
sql.Clear;
|
||||||
|
sql.Add('exec '+fProcedureName);
|
||||||
|
sql.Add('@timeType='+quotedstr(fTimeType));
|
||||||
|
sql.Add(',@begDate='+quotedstr(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.begdate.Date)));
|
||||||
|
sql.Add(',@endDate='+quotedstr(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.enddate.Date+1)));
|
||||||
|
if frmFrameDateSel1.jqModel.Checked then
|
||||||
|
sql.Add(',@jqModel=1')
|
||||||
|
else
|
||||||
|
sql.Add(',@jqModel=0');
|
||||||
|
if Panel_page.Visible then
|
||||||
|
begin
|
||||||
|
sql.Add(',@pageIndex=' + inttostr(CurrentPage));
|
||||||
|
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
||||||
|
end;
|
||||||
|
sql.Add(',@criteria='+ quotedstr(fcriteria));
|
||||||
|
if strwhere<>'' then
|
||||||
|
sql.Add(','+strwhere);
|
||||||
|
// showMessage(sql.Text);
|
||||||
|
//cxMemo1.Text:= sql.Text ;
|
||||||
|
open;
|
||||||
|
end;
|
||||||
|
SCreateCDS(ADOQueryList, CDS_List);
|
||||||
|
SInitCDSData(ADOQueryList, CDS_List);
|
||||||
|
if Panel_page.Visible then
|
||||||
|
begin
|
||||||
|
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(cds_list.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
CDS_List.EnableControls;
|
||||||
|
cxDBPivotGrid1.EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
procedure TfrmQryPivotBaseList.doQueryByCriteria();
|
||||||
|
var
|
||||||
|
mSqlWhere: string;
|
||||||
|
begin
|
||||||
|
if fProcedureName='' then
|
||||||
|
begin
|
||||||
|
application.MessageBox('存储过程名称参数不能为空!','警告信息',0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
mSqlWhere := SLGetFilters(dxLayoutControl_query, 1, 2);
|
||||||
|
if trim(mSqlWhere) <> '' then
|
||||||
|
begin
|
||||||
|
mSqlWhere := ' and ' + trim(mSqlWhere);
|
||||||
|
end;
|
||||||
|
mSqlWhere:=fCriteria + ' ' + mSqlWhere ;
|
||||||
|
try
|
||||||
|
cxDBPivotGrid1.BeginUpdate();
|
||||||
|
CDS_List.DisableControls;
|
||||||
|
with ADOQueryList do
|
||||||
|
begin
|
||||||
|
close;
|
||||||
|
Filtered := false;
|
||||||
|
sql.Clear;
|
||||||
|
sql.Add('exec '+fProcedureName);
|
||||||
|
sql.Add('@timeType='+quotedstr(fTimeType));
|
||||||
|
sql.Add(',@begDate='+quotedstr(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.begdate.Date)));
|
||||||
|
sql.Add(',@endDate='+quotedstr(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.enddate.Date+1)));
|
||||||
|
if Panel_page.Visible then
|
||||||
|
begin
|
||||||
|
sql.Add(',@pageIndex=' + inttostr(CurrentPage));
|
||||||
|
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
||||||
|
end;
|
||||||
|
sql.Add(',@criteria='+ quotedstr(mSqlWhere));
|
||||||
|
|
||||||
|
//cxMemo1.Text:= sql.Text ;
|
||||||
|
open;
|
||||||
|
end;
|
||||||
|
SCreateCDS(ADOQueryList, CDS_List);
|
||||||
|
SInitCDSData(ADOQueryList, CDS_List);
|
||||||
|
if Panel_page.Visible then
|
||||||
|
begin
|
||||||
|
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(cds_list.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
CDS_List.EnableControls;
|
||||||
|
cxDBPivotGrid1.EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TfrmQryPivotBaseList.GetPivotGrid: TcxCustomPivotGrid;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
156
public10/design/U_QryPivotBaseListExample.dfm
Normal file
156
public10/design/U_QryPivotBaseListExample.dfm
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
inherited frmQryPivotBaseListExample: TfrmQryPivotBaseListExample
|
||||||
|
Caption = 'frmQryPivotBaseListExample'
|
||||||
|
PixelsPerInch = 96
|
||||||
|
TextHeight = 21
|
||||||
|
inherited ToolBar3: TToolBar
|
||||||
|
Height = 30
|
||||||
|
ButtonHeight = 30
|
||||||
|
ButtonWidth = 115
|
||||||
|
Images = DataLink_schedule.cxImageList_bar
|
||||||
|
ExplicitHeight = 30
|
||||||
|
inherited Trefresh: TToolButton
|
||||||
|
ExplicitWidth = 71
|
||||||
|
ExplicitHeight = 30
|
||||||
|
end
|
||||||
|
inherited Tprint: TToolButton
|
||||||
|
Left = 71
|
||||||
|
ExplicitLeft = 71
|
||||||
|
ExplicitWidth = 109
|
||||||
|
ExplicitHeight = 30
|
||||||
|
end
|
||||||
|
inherited TprintGrid: TToolButton
|
||||||
|
Left = 180
|
||||||
|
ExplicitLeft = 180
|
||||||
|
ExplicitWidth = 71
|
||||||
|
ExplicitHeight = 30
|
||||||
|
end
|
||||||
|
inherited TsaveGrid: TToolButton
|
||||||
|
Left = 251
|
||||||
|
ExplicitLeft = 251
|
||||||
|
ExplicitWidth = 103
|
||||||
|
ExplicitHeight = 30
|
||||||
|
end
|
||||||
|
inherited TgridLiSet: TToolButton
|
||||||
|
Left = 354
|
||||||
|
ExplicitLeft = 354
|
||||||
|
ExplicitWidth = 119
|
||||||
|
ExplicitHeight = 30
|
||||||
|
end
|
||||||
|
inherited Tclose: TToolButton
|
||||||
|
Left = 473
|
||||||
|
ExplicitLeft = 473
|
||||||
|
ExplicitWidth = 71
|
||||||
|
ExplicitHeight = 30
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inherited frmFrameDateSel1: TfrmFrameDateSel10
|
||||||
|
Top = 30
|
||||||
|
ExplicitTop = 30
|
||||||
|
end
|
||||||
|
inherited dxLayoutControl_query: TdxLayoutControl
|
||||||
|
Top = 75
|
||||||
|
ExplicitTop = 75
|
||||||
|
end
|
||||||
|
inherited Panel_page: TPanel
|
||||||
|
Top = 120
|
||||||
|
Visible = False
|
||||||
|
ExplicitTop = 120
|
||||||
|
end
|
||||||
|
inherited cxDBPivotGrid1: TcxDBPivotGrid
|
||||||
|
Width = 783
|
||||||
|
DataSource = DataSource1
|
||||||
|
OptionsView.ColumnGrandTotalWidth = 170
|
||||||
|
OnDblClick = cxDBPivotGrid1DblClick
|
||||||
|
ExplicitWidth = 783
|
||||||
|
object cxDBPivotGrid1C_name: TcxDBPivotGridField
|
||||||
|
Area = faRow
|
||||||
|
AreaIndex = 1
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #21697#21517
|
||||||
|
DataBinding.ValueType = 'String'
|
||||||
|
DataBinding.FieldName = 'C_name'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #21697#21517
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1orderNo: TcxDBPivotGridField
|
||||||
|
Area = faRow
|
||||||
|
AreaIndex = 2
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #35746#21333#21495
|
||||||
|
DataBinding.ValueType = 'String'
|
||||||
|
DataBinding.FieldName = 'orderNo'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #35746#21333#21495
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1C_color: TcxDBPivotGridField
|
||||||
|
AreaIndex = 0
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #39068#33394
|
||||||
|
DataBinding.FieldName = 'C_color'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #39068#33394
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1meter: TcxDBPivotGridField
|
||||||
|
Area = faData
|
||||||
|
AreaIndex = 0
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #31859#25968
|
||||||
|
DataBinding.ValueType = 'FMTBcd'
|
||||||
|
DataBinding.FieldName = 'meter'
|
||||||
|
Options.Filtering = False
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #31859#25968
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1batchNo: TcxDBPivotGridField
|
||||||
|
AreaIndex = 1
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #32568#21495
|
||||||
|
DataBinding.ValueType = 'String'
|
||||||
|
DataBinding.FieldName = 'batchNo'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #32568#21495
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1year1: TcxDBPivotGridField
|
||||||
|
Area = faColumn
|
||||||
|
AreaIndex = 0
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #24180
|
||||||
|
DataBinding.ValueType = 'Integer'
|
||||||
|
DataBinding.FieldName = 'year1'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #24180
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1month: TcxDBPivotGridField
|
||||||
|
Area = faColumn
|
||||||
|
AreaIndex = 1
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #26376
|
||||||
|
DataBinding.ValueType = 'Integer'
|
||||||
|
DataBinding.FieldName = 'month1'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #26376
|
||||||
|
end
|
||||||
|
object cxDBPivotGrid1custName: TcxDBPivotGridField
|
||||||
|
Area = faRow
|
||||||
|
AreaIndex = 0
|
||||||
|
IsCaptionAssigned = True
|
||||||
|
Caption = #23458#25143
|
||||||
|
DataBinding.ValueType = 'String'
|
||||||
|
DataBinding.FieldName = 'custName'
|
||||||
|
Visible = True
|
||||||
|
UniqueName = #23458#25143
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inherited ADOQueryBaseCmd: TADOQuery
|
||||||
|
Connection = DataLink_schedule.ADOLink
|
||||||
|
Top = 208
|
||||||
|
end
|
||||||
|
inherited ADOQueryBaseTemp: TADOQuery
|
||||||
|
Connection = DataLink_schedule.ADOLink
|
||||||
|
Top = 201
|
||||||
|
end
|
||||||
|
inherited ADOQueryList: TADOQuery
|
||||||
|
Left = 344
|
||||||
|
Top = 200
|
||||||
|
end
|
||||||
|
end
|
52
public10/design/U_QryPivotBaseListExample.pas
Normal file
52
public10/design/U_QryPivotBaseListExample.pas
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
unit U_QryPivotBaseListExample;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||||
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, U_QryPivotBaseList, cxGraphics,
|
||||||
|
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
||||||
|
dxSkinsDefaultPainters, dxSkinWXI, cxContainer, cxEdit, cxClasses,
|
||||||
|
cxCustomData, cxStyles, dxBarBuiltInMenu, cxGridCustomPopupMenu,
|
||||||
|
cxGridPopupMenu, Data.DB, Datasnap.DBClient, Data.Win.ADODB,
|
||||||
|
cxCustomPivotGrid, cxPivotGrid, cxTextEdit, cxMaskEdit, cxDropDownEdit,
|
||||||
|
Vcl.StdCtrls, Vcl.ExtCtrls, dxLayoutContainer, dxLayoutControl,
|
||||||
|
FrameDateSel10, Vcl.ComCtrls, Vcl.ToolWin, cxDBPivotGrid;
|
||||||
|
|
||||||
|
type
|
||||||
|
TfrmQryPivotBaseListExample = class(TfrmQryPivotBaseList)
|
||||||
|
cxDBPivotGrid1orderNo: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1C_name: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1C_color: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1meter: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1batchNo: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1year1: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1month: TcxDBPivotGridField;
|
||||||
|
cxDBPivotGrid1custName: TcxDBPivotGridField;
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
{ Private declarations }
|
||||||
|
public
|
||||||
|
{ Public declarations }
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
frmQryPivotBaseListExample: TfrmQryPivotBaseListExample;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
uses
|
||||||
|
U_dataLink;
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
procedure TfrmQryPivotBaseListExample.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
fProcedureName:='P_pvoidGrid_test';
|
||||||
|
FLMType:='xxx';
|
||||||
|
frmFrameDateSel1.initTimeType('制单日期,交货日期');
|
||||||
|
fQueryType:='criteria';
|
||||||
|
//参数条件
|
||||||
|
FFiltration1:='';
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user