新的宽假

This commit is contained in:
sgwp 2024-10-12 10:45:24 +08:00
parent 4661a115bf
commit 2e917bd27e
21 changed files with 10110 additions and 93 deletions

View File

@ -4,11 +4,12 @@ object BaseDataLink: TBaseDataLink
Height = 322
Width = 484
object dxSkinController1: TdxSkinController
Kind = lfOffice11
Kind = lfStandard
NativeStyle = False
ScrollbarMode = sbmClassic
SkinName = 'WXI'
RenderMode = rmGDIPlus
UseSkinsInPopupMenus = False
Left = 288
Top = 96
end
@ -18,7 +19,7 @@ object BaseDataLink: TBaseDataLink
Style.Color = clWhite
Style.Font.Charset = ANSI_CHARSET
Style.Font.Color = clWindowText
Style.Font.Height = -12
Style.Font.Height = -16
Style.Font.Name = #24494#36719#38597#40657
Style.Font.Style = []
Style.LookAndFeel.Kind = lfFlat
@ -43,7 +44,7 @@ object BaseDataLink: TBaseDataLink
PixelsPerInch = 96
end
object ThreeLookAndFeelCol: TcxLookAndFeelController
Kind = lfOffice11
Kind = lfStandard
NativeStyle = False
ScrollbarMode = sbmClassic
SkinName = 'WXI'
@ -51,21 +52,6 @@ object BaseDataLink: TBaseDataLink
Left = 253
Top = 12
end
object cxDefaultEditStyleController1: TcxDefaultEditStyleController
Style.Font.Charset = ANSI_CHARSET
Style.Font.Color = clWindowText
Style.Font.Height = -12
Style.Font.Name = #24494#36719#38597#40657
Style.Font.Style = []
Style.LookAndFeel.SkinName = 'WXI'
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = 'WXI'
StyleFocused.LookAndFeel.SkinName = 'WXI'
StyleHot.LookAndFeel.SkinName = 'WXI'
Left = 72
Top = 184
PixelsPerInch = 96
end
object cxImageList_bar: TcxImageList
SourceDPI = 96
Height = 24
@ -5934,6 +5920,14 @@ object BaseDataLink: TBaseDataLink
Font.Name = #24494#36719#38597#40657
Font.Style = []
end
object grid_head_black: TcxStyle
AssignedValues = [svFont]
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = #24494#36719#38597#40657
Font.Style = []
end
end
object dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList
Left = 376

View File

@ -31,7 +31,6 @@ type
dxSkinController1: TdxSkinController;
cxEditStyleController1: TcxEditStyleController;
ThreeLookAndFeelCol: TcxLookAndFeelController;
cxDefaultEditStyleController1: TcxDefaultEditStyleController;
cxImageList_bar: TcxImageList;
ThreeColorBase: TcxStyleRepository;
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
@ -49,6 +48,7 @@ type
grid_black_green: TcxStyle;
grid_black_yellow: TcxStyle;
grid_black_cyan: TcxStyle;
grid_head_black: TcxStyle;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
@ -61,7 +61,7 @@ var
implementation
uses
U_globalVar;
U_globalVar,U_FormLayOutDesign;
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
@ -88,6 +88,14 @@ begin
cxLocalizer1.Active := true;
cxLocalizer1.LanguageIndex := 1;
end;
//
if not isUseSkin() then
begin
dxSkinController1.UseSkins:=false;
dxSkinController1.SkinName:='';
end;
gGridNativeSet:=isGridNativeSet();
//
end;

File diff suppressed because it is too large Load Diff

View File

@ -5,13 +5,15 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,U_WindowFormdesign, Data.DB,
Data.Win.ADODB, System.ImageList, Vcl.ImgList, Vcl.ToolWin, Vcl.ComCtrls;
Data.Win.ADODB, System.ImageList, Vcl.ImgList, Vcl.ToolWin, Vcl.ComCtrls,
cxImageList, cxGraphics;
type
TfrmBaseInput = class(TForm)
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
ImageList_new32: TImageList;
cxImageList_bar: TcxImageList;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
@ -27,7 +29,7 @@ var
implementation
uses
U_RTFun ,U_globalVar;
U_RTFun ,U_globalVar,U_dataLink;
{$R *.dfm}
procedure TfrmBaseInput.FormCreate(Sender: TObject);
@ -42,6 +44,9 @@ end;
procedure TfrmBaseInput.FormShow(Sender: TObject);
begin
if trim(gStructVer)='' then
fWindowDesign.FormStyleInit10(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd)
else
fWindowDesign.FormStyleInit(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) ;
end;

View File

@ -17,15 +17,44 @@ object frmBaseList: TfrmBaseList
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 17
object cxProgressBar2: TcxProgressBar
Left = 288
Top = 120
Margins.Left = 1
Margins.Top = 1
Margins.Right = 1
Margins.Bottom = 1
ParentFont = False
Properties.AnimationSpeed = 2
Properties.BarStyle = cxbsGradientLEDs
Properties.BeginColor = 65408
Properties.Marquee = True
Properties.Text = 'loading...'
Style.Font.Charset = ANSI_CHARSET
Style.Font.Color = clSilver
Style.Font.Height = -14
Style.Font.Name = #24494#36719#38597#40657
Style.Font.Style = []
Style.LookAndFeel.SkinName = 'VS2010'
Style.Shadow = False
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = 'VS2010'
StyleFocused.LookAndFeel.SkinName = 'VS2010'
StyleHot.LookAndFeel.SkinName = 'VS2010'
TabOrder = 0
Transparent = True
Visible = False
Width = 153
end
object ADOQueryBaseCmd: TADOQuery
Parameters = <>
Left = 273
Top = 120
Left = 281
Top = 160
end
object ADOQueryBaseTemp: TADOQuery
LockType = ltReadOnly
Parameters = <>
Left = 233
Top = 65
Top = 121
end
end

View File

@ -10,12 +10,29 @@ uses
cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator,
dxDateRanges, dxScrollbarAnnotations, cxDBData, cxGridLevel, cxClasses,
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGrid;
cxGrid, cxContainer, cxProgressBar, 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,
dxSkinXmas2008Blue;
type
TfrmBaseList = class(TForm)
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
cxProgressBar2: TcxProgressBar;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
@ -33,7 +50,6 @@ type
fFormId: integer;
fIsCanDesign:boolean;
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
// procedure CreateCxGridColumn(tv1: TcxGridDBTableView; ADOQueryTmp: TADOQuery; mdesignCode, mGridName: string; HasFooter: boolean = true);
end;
var
@ -71,8 +87,9 @@ end;
procedure TfrmBaseList.FormCreate(Sender: TObject);
begin
fWindowDesign := TWindowFormdesign.Create();
//gIsCanDesign :=fWindowDesign.IsHasDesignRight(ADOQueryBaseTemp) ;
end;
procedure TfrmBaseList.FormDestroy(Sender: TObject);
@ -82,8 +99,14 @@ end;
procedure TfrmBaseList.FormShow(Sender: TObject);
begin
if DParameters8<>'1' then
begin
if trim(gStructVer)='' then
fWindowDesign.FormStyleInit1(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10)
else
fWindowDesign.FormStyleInit(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10);
end;
end;
end.

View File

@ -0,0 +1,92 @@
object frmBaseOneTableInput: TfrmBaseOneTableInput
Left = 0
Top = 0
Caption = 'frmBaseOneTableInput'
ClientHeight = 439
ClientWidth = 736
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object ToolBar1: TToolBar
Tag = 1
Left = 0
Top = 0
Width = 736
Height = 30
AutoSize = True
ButtonHeight = 30
ButtonWidth = 83
Caption = 'ToolBar1'
Color = clWhite
EdgeInner = esNone
EdgeOuter = esNone
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = #24494#36719#38597#40657
Font.Style = []
Images = DataLink_schedule.cxImageList_bar
List = True
ParentColor = False
ParentFont = False
ShowCaptions = True
TabOrder = 0
object TBSave: TToolButton
Left = 0
Top = 0
AutoSize = True
Caption = #20445#23384
ImageIndex = 37
OnClick = TBSaveClick
end
object Tsj: TToolButton
Left = 63
Top = 0
Caption = #20445#23384#35774#35745
ImageIndex = 16
OnClick = TsjClick
end
object TBClose: TToolButton
Left = 146
Top = 0
AutoSize = True
Caption = #20851#38381
ImageIndex = 7
OnClick = TBCloseClick
end
end
object dxLayoutControl_input: TdxLayoutControl
Left = 32
Top = 64
Width = 681
Height = 329
TabOrder = 1
object dxLayoutControl_inputGroup_Root: TdxLayoutGroup
AlignHorz = ahLeft
AlignVert = avTop
Hidden = True
ShowBorder = False
Index = -1
end
end
object ADOQueryBaseCmd: TADOQuery
Parameters = <>
Left = 105
Top = 155
end
object ADOQueryBaseTemp: TADOQuery
LockType = ltReadOnly
Parameters = <>
Left = 217
Top = 155
end
end

View File

@ -0,0 +1,136 @@
unit U_BaseOneTableInput;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics,
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
dxSkinsDefaultPainters, dxSkinWXI, cxClasses, dxLayoutContainer,
dxLayoutControl, Data.DB, Data.Win.ADODB,U_WindowFormdesign;
type
TfrmBaseOneTableInput = class(TForm)
ToolBar1: TToolBar;
TBSave: TToolButton;
Tsj: TToolButton;
TBClose: TToolButton;
dxLayoutControl_inputGroup_Root: TdxLayoutGroup;
dxLayoutControl_input: TdxLayoutControl;
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
procedure TBCloseClick(Sender: TObject);
procedure TsjClick(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
fWindowDesign:TWindowFormdesign;
function SaveData(): Boolean;
public
fKeyNo:string;
fTabelName:string;
end;
var
frmBaseOneTableInput: TfrmBaseOneTableInput;
implementation
uses
U_RTFun ,U_globalVar,U_dataLink,U_FormLayOutDesign;
{$R *.dfm}
procedure TfrmBaseOneTableInput.TBCloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmBaseOneTableInput.TBSaveClick(Sender: TObject);
begin
if not mustInCheck(application, dxLayoutControl_input,PWideChar('*')) then
exit;
if SaveData() then
begin
end;
end;
procedure TfrmBaseOneTableInput.TsjClick(Sender: TObject);
begin
saveLayOut(application,dxLayoutControl_input, ADOQueryBaseCmd,
PWideChar( fDllFileName + '|' + SELF.Name + '|' + dxLayoutControl_input.Name+ '.ini'));
end;
procedure TfrmBaseOneTableInput.FormCreate(Sender: TObject);
begin
fWindowDesign:=TWindowFormDeSign.Create();
end;
procedure TfrmBaseOneTableInput.FormDestroy(Sender: TObject);
begin
fWindowDesign.free;
end;
procedure TfrmBaseOneTableInput.FormShow(Sender: TObject);
begin
fWindowDesign.FormStyleInit10(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd)
end;
function TfrmBaseOneTableInput.SaveData(): Boolean;
var
maxno, Smaxno, maxorderno, MaxFNo: string;
begin
try
result := false;
ADOQueryBaseCmd.Connection.BeginTrans;
/// 保存主表
if trim(fKeyNo) = '' then
begin
if GetLSNo(ADOQueryBaseCmd, maxno, '', fTabelName, 3, 1) = false then
raise Exception.Create('取最大号失败!');
end
else
begin
maxno := trim(fKeyNo);
end;
with ADOQueryBaseCmd do
begin
close;
sql.Clear;
sql.Add('select * from '+fTabelName);
sql.Add('where recid=' +quotedstr(trim(fKeyNo)));
end;
with ADOQueryBaseCmd do
begin
if IsEmpty then
begin
Append;
fieldbyname('FillId').Value := trim(DCode);
fieldbyname('Filler').Value := trim(DName);
fieldbyname('status').Value := '0';
end
else
begin
Edit;
fieldbyname('EditId').Value := trim(DCode);
fieldbyname('Editer').Value := trim(DName);
fieldbyname('EditTime').Value := SGetServerDateTime(ADOQueryBaseTemp);
end;
LRTSetsavedata(ADOQueryBaseCmd, fTabelName, dxLayoutControl_input, 2);
fieldbyname('recid').Value := trim(maxno);
Post;
end;
fkeyNo := trim(maxno);
ADOQueryBaseCmd.Connection.CommitTrans;
result := True;
except
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
end;
end;
end.

View File

@ -0,0 +1,426 @@
object frmDetailBaseList: TfrmDetailBaseList
Left = 0
Top = 0
Caption = 'frmDetailBaseList'
ClientHeight = 605
ClientWidth = 1077
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 = 1077
Height = 30
AutoSize = True
ButtonHeight = 30
ButtonWidth = 115
Caption = 'ToolBar1'
GradientEndColor = clWindow
Images = DataLink_schedule.cxImageList_bar
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 = 71
Top = 0
AutoSize = True
Caption = #23548#20986'Excel'
ImageIndex = 28
OnClick = TprintClick
end
object TprintGrid: TToolButton
Left = 180
Top = 0
AutoSize = True
Caption = #25171#21360
ImageIndex = 21
OnClick = TprintGridClick
end
object TsaveGrid: TToolButton
Left = 251
Top = 0
AutoSize = True
Caption = #20445#23384#26684#24335
ImageIndex = 30
OnClick = TsaveGridClick
end
object TgridLiSet: TToolButton
Left = 354
Top = 0
AutoSize = True
Caption = #34920#26684#21015#35774#32622
ImageIndex = 16
OnClick = TgridLiSetClick
end
object Tclose: TToolButton
Left = 473
Top = 0
AutoSize = True
Caption = #20851#38381
ImageIndex = 7
OnClick = TcloseClick
end
end
object cxGrid1: TcxGrid
Left = 14
Top = 161
Width = 985
Height = 224
TabOrder = 1
object tv1: TcxGridDBTableView
Navigator.Buttons.CustomButtons = <>
ScrollbarAnnotations.CustomAnnotations = <>
OnFocusedRecordChanged = tv1FocusedRecordChanged
DataController.DataSource = DataSource1
DataController.Filter.AutoDataSetFilter = True
DataController.Summary.DefaultGroupSummaryItems = <>
DataController.Summary.FooterSummaryItems = <>
DataController.Summary.SummaryGroups = <>
OptionsData.Deleting = False
OptionsData.DeletingConfirmation = False
OptionsData.Inserting = False
OptionsView.Footer = True
OptionsView.GroupByBox = False
end
object cxGrid1Level1: TcxGridLevel
GridView = tv1
end
end
object dxLayoutControl_query: TdxLayoutControl
Left = 0
Top = 75
Width = 1077
Height = 45
Align = alTop
TabOrder = 2
AutoSize = True
LayoutLookAndFeel = BaseDataLink.dxLayoutSkinLookAndFeel1
OptionsItem.SizableHorz = True
OptionsItem.SizableVert = True
OnDblClick = dxLayoutControl_queryDblClick
ExplicitTop = 73
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 = 120
Width = 1077
Height = 37
Align = alTop
AutoSize = True
BevelInner = bvRaised
BevelOuter = bvLowered
TabOrder = 3
ExplicitTop = 118
DesignSize = (
1077
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
ExplicitTop = 7
end
object BTNP: TButton
Left = 532
Top = 5
Width = 78
Height = 30
Anchors = [akLeft]
Caption = #19979#19968#39029
TabOrder = 0
OnClick = BTNPClick
end
object BTLP: TButton
Left = 338
Top = 4
Width = 78
Height = 31
Anchors = [akLeft]
Caption = #19978#19968#39029
TabOrder = 1
OnClick = BTLPClick
end
object TCBNOR: TcxComboBox
Tag = 2
Left = 122
Top = 2
Properties.DropDownListStyle = lsEditFixedList
Properties.Items.Strings = (
'500'
'1000'
'5000'
'10000')
Properties.OnChange = TCBNORPropertiesChange
TabOrder = 2
Text = '500'
Width = 94
end
end
object cxSplitter1: TcxSplitter
Left = 0
Top = 401
Width = 1077
Height = 8
HotZoneClassName = 'TcxMediaPlayer8Style'
AlignSplitter = salBottom
end
object cxGrid2: TcxGrid
Left = 0
Top = 409
Width = 1077
Height = 196
Align = alBottom
TabOrder = 5
object TV2: TcxGridDBTableView
Navigator.Buttons.CustomButtons = <>
ScrollbarAnnotations.CustomAnnotations = <>
DataController.DataSource = DataSource2
DataController.Filter.AutoDataSetFilter = True
DataController.Options = [dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoImmediatePost]
DataController.Summary.DefaultGroupSummaryItems = <
item
Format = '0'
Position = spFooter
end
item
Format = '0'
Position = spFooter
end
item
Format = '0'
Position = spFooter
end>
DataController.Summary.FooterSummaryItems = <
item
Kind = skSum
end
item
Kind = skSum
end>
DataController.Summary.SummaryGroups = <>
OptionsBehavior.FocusCellOnTab = True
OptionsBehavior.GoToNextCellOnEnter = True
OptionsBehavior.FocusCellOnCycle = True
OptionsCustomize.ColumnFiltering = False
OptionsData.Deleting = False
OptionsView.Footer = True
OptionsView.GroupByBox = False
Styles.UseOddEvenStyles = bFalse
end
object cxGridLevel1: TcxGridLevel
GridView = TV2
end
end
inline frmFrameDateSel1: TfrmFrameDateSel10
Left = 0
Top = 30
Width = 1077
Height = 45
Align = alTop
AutoSize = True
Color = clBtnFace
ParentBackground = False
ParentColor = False
TabOrder = 6
ExplicitTop = 30
ExplicitWidth = 1077
inherited dxLayoutControl1: TdxLayoutControl
Width = 1077
ExplicitWidth = 1077
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 = 89
ExplicitHeight = 33
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 DataSource1: TDataSource
DataSet = CDS_Main
Left = 768
Top = 296
end
object ADOQueryMain: TADOQuery
Connection = DataLink_schedule.ADOLink
LockType = ltReadOnly
Parameters = <>
Left = 704
Top = 368
end
object cxGridPopupMenu1: TcxGridPopupMenu
Grid = cxGrid1
PopupMenus = <>
Left = 208
Top = 287
end
object ADOQueryBaseCmd: TADOQuery
Connection = DataLink_schedule.ADOLink
Parameters = <>
Left = 281
Top = 248
end
object ADOQueryBaseTemp: TADOQuery
Connection = DataLink_schedule.ADOLink
LockType = ltReadOnly
Parameters = <>
Left = 201
Top = 225
end
object CDS_Main: TClientDataSet
Aggregates = <>
Params = <>
Left = 395
Top = 280
end
object ADOQuerySub: TADOQuery
Connection = DataLink_schedule.ADOLink
Parameters = <>
Left = 320
Top = 513
end
object DataSource2: TDataSource
DataSet = CDS_Sub
Left = 408
Top = 505
end
object cxGridPopupMenu2: TcxGridPopupMenu
Grid = cxGrid2
PopupMenus = <>
Left = 232
Top = 383
end
object CDS_Sub: TClientDataSet
Aggregates = <>
Params = <>
Left = 211
Top = 504
end
end

View File

@ -0,0 +1,409 @@
unit U_DetailBaseList;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics,
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,U_WindowFormdesign,
dxSkinsDefaultPainters, dxSkinWXI, cxStyles, cxCustomData, cxFilter, cxData,
cxDataStorage, cxEdit, cxNavigator, dxDateRanges, dxScrollbarAnnotations,
Data.DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxGridCustomView, cxGrid, Data.Win.ADODB,math,
dxBarBuiltInMenu, cxGridCustomPopupMenu, cxGridPopupMenu, cxCheckBox,
cxContainer, dxCore, cxDateUtils, dxLayoutcxEditAdapters, dxLayoutContainer,
cxMaskEdit, cxDropDownEdit, cxCalendar, cxTextEdit, dxLayoutControl,
FrameDateSel, Datasnap.DBClient, cxMemo, Vcl.StdCtrls, Vcl.ExtCtrls,
cxGeometry, dxFramedControl, dxPanel, cxSplitter, cxButtonEdit, FrameDateSel10;
type
TfrmDetailBaseList = class(TForm)
ToolBar3: TToolBar;
Trefresh: TToolButton;
Tprint: TToolButton;
TprintGrid: TToolButton;
TsaveGrid: TToolButton;
Tclose: TToolButton;
cxGrid1: TcxGrid;
tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
DataSource1: TDataSource;
ADOQueryMain: TADOQuery;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
dxLayoutControl_query: TdxLayoutControl;
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
CDS_Main: TClientDataSet;
Panel_page: TPanel;
BTNP: TButton;
LBCPAP: TLabel;
BTLP: TButton;
TCBNOR: TcxComboBox;
Label31: TLabel;
cxSplitter1: TcxSplitter;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
ADOQuerySub: TADOQuery;
DataSource2: TDataSource;
cxGridPopupMenu2: TcxGridPopupMenu;
CDS_Sub: TClientDataSet;
TgridLiSet: TToolButton;
frmFrameDateSel1: TfrmFrameDateSel10;
procedure TrefreshClick(Sender: TObject);
procedure TprintClick(Sender: TObject);
procedure TprintGridClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TcloseClick(Sender: TObject);
procedure TsaveGridClick(Sender: TObject);
procedure BTLPClick(Sender: TObject);
procedure BTNPClick(Sender: TObject);
procedure TCBNORPropertiesChange(Sender: TObject);
procedure tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
ANewItemRecordFocusingChanged: Boolean);
procedure TgridLiSetClick(Sender: TObject);
procedure dxLayoutControl_queryDblClick(Sender: TObject);
private
fWindowDesign: TWindowFormdesign;
fDesignCode:string;
CurrentPage, RecordsNumber: Integer;
procedure doQuery();
procedure doQueryByCriteria();
procedure initGrid();
procedure InitSub();
protected
fParameters1: string;
fParameters2: string;
fParameters3: string;
fParameters4: string;
fParameters5: string;
fParameters10: string;
public
fFormId: integer;
fProcedureName:string; //存储过程名称
fProcedureSubName:string; //子存储过程名称
FLMType:string; //报表文件类型标志
ftimeType:string; //日期类型
fQueryType:String; //查询类型
FFiltration1:string; //打印参数条件
fCriteria:string; //条件参数
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
end;
var
frmDetailBaseList: TfrmDetailBaseList;
implementation
uses
U_RTFun, U_globalVar,U_cxGridCustomSet, U_dataLink,U_FormLayOutDesign, U_LabelPrint;
{$R *.dfm}
procedure TfrmDetailBaseList.BTLPClick(Sender: TObject);
begin
if CurrentPage > 1 then
CurrentPage := CurrentPage - 1;
doQuery();
end;
procedure TfrmDetailBaseList.BTNPClick(Sender: TObject);
begin
if CurrentPage < cds_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
CurrentPage := CurrentPage + 1;
doQuery();
end;
constructor TfrmDetailBaseList.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 TfrmDetailBaseList.TCBNORPropertiesChange(Sender: TObject);
begin
RecordsNumber := StrToInt(TCBNOR.Text);
CurrentPage := 1;
initGrid();
end;
procedure TfrmDetailBaseList.TcloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmDetailBaseList.TgridLiSetClick(Sender: TObject);
begin
if cxgrid2.IsFocused then
fWindowDesign.OpenGridDesignWin10(fDesignCode+'|'+'cxgrid2','cxgrid2',tv2)
else
fWindowDesign.OpenGridDesignWin10(fDesignCode+'|'+'cxgrid1','cxgrid1',tv1);
end;
procedure TfrmDetailBaseList.TprintClick(Sender: TObject);
begin
if cds_Main.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid1);
end;
procedure TfrmDetailBaseList.TprintGridClick(Sender: TObject);
begin
if cds_Main.IsEmpty then
Exit;
if trim(self.FLMType)='' then
begin
application.MessageBox('未设置打印报表类型,请先设置!','提示信息',0);
exit;
end;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := self.FLMType;
FFiltration1 := self.FFiltration1;
if ShowModal = 1 then
begin
// Self.InitGrid();
end;
end;
finally
frmLabelPrint.Free;
end;
end;
procedure TfrmDetailBaseList.TrefreshClick(Sender: TObject);
begin
if frmFrameDateSel1.BegDate.Visible then
begin
frmFrameDateSel1.BegDate.SetFocus;
end;
CurrentPage := 1;
initGrid();
end;
procedure TfrmDetailBaseList.TsaveGridClick(Sender: TObject);
begin
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
if gIsCanDesign then
begin
saveLayOut(application, dxLayoutControl_query, ADOQueryBaseCmd,PWideChar( fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_query.Name + '.ini'));
end;
end;
procedure TfrmDetailBaseList.tv1FocusedRecordChanged(
Sender: TcxCustomGridTableView; APrevFocusedRecord,
AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
InitSub();
end;
////////////////////////////////////
procedure TfrmDetailBaseList.doQuery();
var
strwhere: string;
begin
if fProcedureName='' then
begin
application.MessageBox('存储过程名称参数不能为空!','警告信息',0);
exit;
end;
strwhere := GetProcedureParam(dxLayoutControl_query);
try
Tv1.BeginUpdate();
cds_Main.DisableControls;
with ADOQueryMain 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(ADOQueryMain, cds_Main);
SInitCDSData(ADOQueryMain, cds_Main);
if Panel_page.Visible then
begin
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(cds_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
end;
finally
cds_Main.EnableControls;
Tv1.EndUpdate;
end;
end;
////////////////////////////////////
procedure TfrmDetailBaseList.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
Tv1.BeginUpdate();
CDS_Main.DisableControls;
with ADOQueryMain 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(ADOQueryMain, CDS_Main);
SInitCDSData(ADOQueryMain, CDS_Main);
if Panel_page.Visible then
begin
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
end;
finally
CDS_Main.EnableControls;
Tv1.EndUpdate;
end;
end;
procedure TfrmDetailBaseList.dxLayoutControl_queryDblClick(Sender: TObject);
begin
layoutDesign(TdxLayoutControl(Sender),ADOQueryBaseCmd,PWideChar(dcode));
end;
///
procedure TfrmDetailBaseList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Sendmessage(application.MainForm.Handle, WM_CloseForm, 4, 0);
Action:=cafree;
end;
procedure TfrmDetailBaseList.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
CurrentPage := 1;
RecordsNumber := 500;
fWindowDesign := TWindowFormdesign.Create();
frmFrameDateSel1.begdate.Date:=SGetServerDate(ADOQueryBaseTemp);
frmFrameDateSel1.enddate.Date:=frmFrameDateSel1.begdate.Date;
end;
procedure TfrmDetailBaseList.FormDestroy(Sender: TObject);
begin
fWindowDesign.free;
end;
procedure TfrmDetailBaseList.FormShow(Sender: TObject);
begin
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;
fdesignCode := fDllFileName +'|'+self.name+ '|' + intTostr(fformId) ;
CreateCxGridColumn(application, Tv1,ADOQueryBaseTemp,PWideChar(fdesignCode+'|cxgrid1'));
CreateCxGridColumn(application, Tv1,ADOQueryBaseTemp,PWideChar(fdesignCode+'|cxgrid2'));
//增加动态条件
addQryContionByLay(ADOQueryBaseTemp,fformId,'cxgrid1',dxLayoutControl_query,7);
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
initGrid();
end;
///////////////////////////////
///
procedure TfrmDetailBaseList.initGrid();
begin
if fQueryType='criteria' then
begin
doQueryByCriteria() ;
end
else
begin
frmFrameDateSel1.jqModel.Checked:=true;
doQuery() ;
end;
end;
/////////////////////////
procedure TfrmDetailBaseList.InitSub();
begin ADOQuerySub.close;
if fProcedureSubName='' then
begin
application.MessageBox('您还未设置子存储过程名称!','提示信息',0);
exit;
end;
if CDS_Main.IsEmpty then
Exit;
try
TV2.BeginUpdate();
CDS_SUB.DisableControls;
with ADOQuerySub do begin close;
sql.Clear;
sql.Add('exec '+fProcedureSubName);
sql.Add('@mainId =' + quotedstr((CDS_Main.fieldbyname('mainID')
.AsString)));
Open;
end;
SCreateCDS(ADOQuerySub, CDS_SUB);
SInitCDSData(ADOQuerySub, CDS_SUB);
finally
CDS_SUB.EnableControls;
TV2.EndUpdate;
end;
//
end;
end.

View File

@ -0,0 +1,9 @@
unit U_FormDesign;
interface
implementation
end.

View File

@ -5,7 +5,7 @@ uses
ExtCtrls, ComObj, DXCORE, ActiveX, cxMemo, cxButtons, Graphics, IniFiles,
Dialogs, Menus, DB, ADODB, cxLabel, BtnEdit, RTComboBox, cxTextEdit, cxMRUEdit,
cxDBData, cxGridLevel, cxButtonEdit, cxCurrencyEdit, cxGridTableView, cxGrid,
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl,
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit,dxSkinsCore, dxSkinWXI,dxSkinsDefaultPainters;
@ -18,12 +18,19 @@ procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions
function getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A';
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:PWideChar):boolean;stdcall;external 'rtCommon.dll' Name 'mustInCheck_A';
function isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A';
function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A';
function isGridNativeSet(): boolean;stdcall;external 'rtCommon.dll' Name 'isGridNativeSet_A';
//function readLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'readLayOut_A';
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'saveLayOut_A';
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:PWideChar )stdcall;external 'rtCommon.dll' Name 'layoutDesign_A';
procedure SetShowModalHide(mHandle:Thandle;form:Tform)stdcall;external 'rtCommon.dll';
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
function GetsysParam(AdoTmp:Tadoquery;StyleRepository:TcxStyleRepository;muserId: pchar; fparam1: pchar): Boolean;
procedure addQryCondition1(Application:Tapplication;AdoTmp:Tadoquery;Panel_zdy:Tpanel;layOut: TdxLayoutControl;mdesignCode:PWideChar;rowCount:integer=4)stdcall;external 'rtCommon.dll' Name 'addQryCondition';
procedure addQryCondition( AdoTmp:Tadoquery;formId:Integer;gridName:string;FlowPanel1:TFlowPanel;rowCount:integer=4);
procedure addQryContionByLay(AdoTmp:Tadoquery;formId:Integer;gridName:string;layOut:TdxLayoutControl;rowCount:integer=4);
procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string);
function GetProcedureParam(layoutControl: TdxLayoutControl; EquTag: Integer=0): string;
implementation
uses
U_globalVar;
@ -164,4 +171,366 @@ begin
result := true;
end;
procedure addQryCondition( AdoTmp:Tadoquery;formId:Integer;gridName:string;FlowPanel1:TFlowPanel;rowCount:integer=4);
var
i,k:integer;
textEdit:TcxTextEdit;
combox:TcxCombobox;
cxDateEdit:TcxDateEdit;
cxButtonEdit:TcxButtonEdit;
lable:Tlabel;
rows:integer;
mwidth:integer;
mdesignCode :String;
begin
mdesignCode := fDllFileName +'|'+FlowPanel1.Parent.name+ '|' + intTostr(formId) + '|' + gridName;
mwidth:=FlowPanel1.Width div rowCount ;
FlowPanel1.AutoSize:=true;
with AdoTmp do begin close;
sql.Clear;
sql.Add('select A.* ');
sql.Add('from SD_FormGrid_Design A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
sql.Add('and columnQuery=1');
sql.Add('order by queryControlOrder');
open;
if isEmpty then
begin
exit;
end;
end;
AdoTmp.First;
while not AdoTmp.eof do
begin
if FlowPanel1.Parent.FindComponent(trim(AdoTmp.FieldByName('fieldName').AsString))<>nil then
begin
AdoTmp.next;
continue;
end;
lable:=Tlabel.Create(nil);
lable.Alignment:=taCenter;
lable.AlignWithMargins:=true;
lable.Caption:=trim(AdoTmp.FieldByName('caption').AsString)+'';
lable.Parent:=FlowPanel1 ;
if trim(AdoTmp.FieldByName('queryControlType').AsString)='combox' then
begin
combox:= TcxCombobox.Create(nil);
combox.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
combox.Text:='';
combox.Parent:= FlowPanel1 ;
combox.AlignWithMargins:=true;
combox.Width:= mwidth - lable.Width - mwidth div rowCount;
//
if trim(AdoTmp.FieldByName('sqlStr').AsString)<>'' then
initWinData(AdoTmp,combox,trim(AdoTmp.FieldByName('sqlStr').AsString));
end
else if trim(AdoTmp.FieldByName('queryControlType').AsString)='date' then
begin
cxDateEdit:= TcxDateEdit.Create(nil);
cxDateEdit.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
cxDateEdit.Date:=date();
cxDateEdit.Properties.ShowTime:=false;
cxDateEdit.Parent:= FlowPanel1 ;
cxDateEdit.AlignWithMargins:=true;
cxDateEdit.Width:= mwidth - lable.Width - mwidth div rowCount;
end
else if trim(AdoTmp.FieldByName('queryControlType').AsString)='buttonedit' then
begin
cxButtonEdit:= TcxButtonEdit.Create(nil);
cxButtonEdit.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
cxButtonEdit.Text:='';
cxButtonEdit.Parent:= FlowPanel1 ;
cxButtonEdit.AlignWithMargins:=true;
cxButtonEdit.Width:= mwidth - lable.Width - mwidth div rowCount;
end
else
begin
textEdit:= TcxTextEdit.Create(nil);
textEdit.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
textEdit.Text:='';
textEdit.Parent:= FlowPanel1 ;
textEdit.AlignWithMargins:=true;
textEdit.Width:= mwidth - lable.Width - mwidth div rowCount;
end;
AdoTmp.Next ;
end;
end;
///////////////////////////////////////////////////////
procedure addQryContionByLay(AdoTmp:Tadoquery;formId:Integer;gridName:string;layOut:TdxLayoutControl;rowCount:integer=4);
var
ALayoutGroup: TdxLayoutGroup;
ALayoutGroup1: TdxLayoutGroup;
ALayoutItem: TdxLayoutItem;
itemGroup: TdxCustomLayoutItem ;
textEdit:TcxTextEdit;
combox:TcxCombobox;
cxDateEdit:TcxDateEdit;
cxButtonEdit:TcxButtonEdit;
mwidth,i,j,cnt:integer;
mdesignCode :String;
begin
mdesignCode := fDllFileName +'|'+layOut.Parent.name+ '|' + intTostr(formId) + '|' + gridName;
with AdoTmp do begin close;
sql.Clear;
sql.Add('select A.* ');
sql.Add('from SD_FormGrid_Design A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
sql.Add('and columnQuery=1');
sql.Add('order by queryControlOrder');
open;
if isEmpty then
begin
exit;
end;
end;
layOut.BeginUpdate; // Postpones updates
try
// Creates a child group within the root group
for i := 0 to layOut.Items.Count - 1 do
begin
itemGroup := layOut.Items[i];
// 检查项是否是组
if itemGroup is TdxLayoutGroup then
begin
ALayoutGroup:= TdxLayoutGroup(itemGroup);
break;
end;
end;
//
if (ALayoutGroup=nil) or (ALayoutGroup.Count> rowCount) then
ALayoutGroup := TdxLayoutGroup(layOut.CreateGroup(nil, layOut.Items));
ALayoutGroup.LayoutDirection:=ldHorizontal;
ALayoutGroup.Hidden:=true;
// ALayoutGroup.Name:='zdygroup1';
ALayoutGroup.CaptionOptions.Text := ''; // Specifies the group caption
ALayoutGroup.Padding.Top:=-5;
//
AdoTmp.First;
cnt:=1;
while not AdoTmp.eof do
begin
if layOut.Parent.FindComponent(trim(AdoTmp.FieldByName('fieldName').AsString))<>nil then
begin
AdoTmp.next;
continue;
end;
ALayoutItem:= TdxLayoutItem( layOut.FindItem('item_'+trim(AdoTmp.FieldByName('fieldName').AsString))) ;
if cnt mod rowCount=0 then
begin
ALayoutGroup:=TdxLayoutGroup(layOut.CreateGroup(nil, layOut.Items));
ALayoutGroup.LayoutDirection:=ldHorizontal;
ALayoutGroup.Hidden:=true;
ALayoutGroup.CaptionOptions.Text := '';
// ALayoutGroup.Padding.Top:=5;
ALayoutGroup.Offsets.Top:=5;
end;
if trim(AdoTmp.FieldByName('queryControlType').AsString)='combox' then
begin
combox:= TcxCombobox.Create(nil);
combox.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
combox.Text:='';
combox.Style.Font.Size:=gFontSize;
combox.AlignWithMargins:=true;
combox.TabOrder:=cnt;
combox.tag:=2;
//
if trim(AdoTmp.FieldByName('sqlStr').AsString)<>'' then
initWinData(AdoTmp,combox,trim(AdoTmp.FieldByName('sqlStr').AsString));
if ALayoutItem=nil then
ALayoutItem := TdxLayoutItem(layOut.CreateItem);
ALayoutItem.Control := combox;
ALayoutItem.CaptionOptions.Text:=trim(AdoTmp.FieldByName('caption').AsString) ;
ALayoutItem.Parent := ALayoutGroup;
ALayoutItem.Name:= 'item_'+trim(AdoTmp.FieldByName('fieldName').AsString) ;
end
else if trim(AdoTmp.FieldByName('queryControlType').AsString)='date' then
begin
cxDateEdit:= TcxDateEdit.Create(nil);
cxDateEdit.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
cxDateEdit.Date:=date();
cxDateEdit.Properties.ShowTime:=false;
cxDateEdit.AlignWithMargins:=true;
cxDateEdit.Style.Font.Size:=gFontSize;
cxDateEdit.TabOrder:=cnt;
//
if ALayoutItem=nil then
ALayoutItem := TdxLayoutItem(layOut.CreateItem);
ALayoutItem.Control := cxDateEdit;
ALayoutItem.CaptionOptions.Text:=trim(AdoTmp.FieldByName('caption').AsString) ;
ALayoutItem.Parent := ALayoutGroup;
ALayoutItem.Name:= 'item_'+trim(AdoTmp.FieldByName('fieldName').AsString) ;
end
else if trim(AdoTmp.FieldByName('queryControlType').AsString)='buttonedit' then
begin
cxButtonEdit:= TcxButtonEdit.Create(nil);
cxButtonEdit.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
cxButtonEdit.Text:='';
cxButtonEdit.AlignWithMargins:=true;
cxButtonEdit.Style.Font.Size:=gFontSize;
cxButtonEdit.TabOrder:=cnt;
cxButtonEdit.tag:=2;
//
if ALayoutItem=nil then
ALayoutItem := TdxLayoutItem(layOut.CreateItem);
ALayoutItem.Control := cxButtonEdit;
ALayoutItem.CaptionOptions.Text:=trim(AdoTmp.FieldByName('caption').AsString) ;
ALayoutItem.Parent := ALayoutGroup;
ALayoutItem.Name:= 'item_'+trim(AdoTmp.FieldByName('fieldName').AsString) ;
end
else
begin
textEdit:= TcxTextEdit.Create(nil);
textEdit.Name:= trim(AdoTmp.FieldByName('fieldName').AsString);
textEdit.Text:='';
textEdit.AlignWithMargins:=true;
textEdit.Style.Font.Size:=gFontSize;
textEdit.TabOrder:=cnt;
textEdit.tag:=2;
//
if ALayoutItem=nil then
ALayoutItem := TdxLayoutItem(layOut.CreateItem);
ALayoutItem.Control := textEdit;
ALayoutItem.CaptionOptions.Text:=trim(AdoTmp.FieldByName('caption').AsString) ;
ALayoutItem.Parent := ALayoutGroup;
ALayoutItem.Name:= 'item_'+trim(AdoTmp.FieldByName('fieldName').AsString) ;
end;
inc(cnt);
AdoTmp.Next ;
end;
//
for i := 0 to layOut.Items.Count - 1 do
begin
itemGroup := layOut.Items[i];
// 检查项是否是组
if itemGroup is TdxLayoutGroup then
begin
ALayoutGroup:= TdxLayoutGroup(itemGroup);
for j := ALayoutGroup.VisibleCount-1 downto 0 do
begin
if ALayoutGroup.VisibleItems[j] is TdxLayoutItem then
begin
if TdxLayoutItem( ALayoutGroup.VisibleItems[j] ).Control=nil then
ALayoutGroup.VisibleItems[j].Visible:=false;
end;
end;
end;
end;
finally
layOut.EndUpdate; // Resumes updates, even if an exception occurs
end;
end;
////////////////////////////////////////////////////////
procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string);
var
ado1:TadoQuery;
begin
try
ado1:=TadoQuery.Create(nil);
ado1.Connection:= AdoTmp.Connection;
with ado1 do
begin
close;
sql.Clear;
sql.add(sqlStr);
open;
if RecordCount>0 then
begin
if obj is TcxCombobox then
begin
while not Eof do
begin
TcxCombobox(obj).Properties.Items.Add(trim(fields[0].AsString));
next;
end;
end;
close;
end;
end;
finally
ado1.Free;
end;
end;
//
/// /////////////////////////////////////////
/// /************获取存储过程参数***********/////
/// /////////////////////////////////////////
function GetProcedureParam(layoutControl: TdxLayoutControl; EquTag: Integer=0): string;
var
i, j, k: Integer;
mControl:TControl;
begin
Result := '';
with layoutControl do
begin
for i := 0 to layoutControl.ControlCount -1 do
begin
mControl:=layoutControl.Controls[i];
if layoutControl.FindItem(mControl) =nil then continue;
if not layoutControl.FindItem(mControl).Visible then continue;
if mControl is TLabel or (mControl.Tag=99) then
continue;
if mControl is TcxTextEdit then
begin
Result := Result + ',@'+mControl.Name + '=' + quotedStr(Trim(TcxTextEdit(mControl).Text)) ;
end
else if mControl is TcxButtonEdit then
begin
if Trim(TBtnEditC(mControl).TxtCode) <> '' then
begin
Result := Result + ',@' + mControl.Name + '=' + quotedStr(Trim(TBtnEditC(mControl).TxtCode)) ;
end
else
begin
Result := Result + ',@' + mControl.Name + '=' + quotedStr(Trim(TBtnEditC(mControl).Text)) ;
end;
end
else if mControl is TcxComboBox then
begin
Result := Result + ',@' + mControl.Name + '=' + quotedStr(Trim(TcxComboBox(mControl).Text)) ;
end;
end;
end;
if Trim(Result) <> '' then
Result := Trim(RightStr(Result, Length(Result) - 1));
end;
end.

View File

@ -0,0 +1,350 @@
object frmQryBaseList: TfrmQryBaseList
Left = 0
Top = 0
Caption = 'frmQryBaseList'
ClientHeight = 538
ClientWidth = 1077
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 = 1077
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
OnClick = TprintGridClick
end
object TsaveGrid: TToolButton
Left = 182
Top = 0
AutoSize = True
Caption = #20445#23384#26684#24335
ImageIndex = 30
OnClick = TsaveGridClick
end
object TgridLiSet: TToolButton
Left = 262
Top = 0
AutoSize = True
Caption = #34920#26684#21015#35774#32622
ImageIndex = 16
OnClick = TgridLiSetClick
end
object Tclose: TToolButton
Left = 358
Top = 0
AutoSize = True
Caption = #20851#38381
ImageIndex = 7
OnClick = TcloseClick
end
end
object cxGrid1: TcxGrid
Left = 8
Top = 209
Width = 1033
Height = 321
TabOrder = 1
object tv1: TcxGridDBTableView
Navigator.Buttons.CustomButtons = <>
ScrollbarAnnotations.CustomAnnotations = <>
DataController.DataSource = DataSource1
DataController.Filter.AutoDataSetFilter = True
DataController.Summary.DefaultGroupSummaryItems = <>
DataController.Summary.FooterSummaryItems = <>
DataController.Summary.SummaryGroups = <>
OptionsData.Deleting = False
OptionsData.DeletingConfirmation = False
OptionsData.Inserting = False
OptionsView.Footer = True
OptionsView.GroupByBox = False
object tv1SSel: TcxGridDBColumn
Caption = #36873#25321
DataBinding.FieldName = 'SSel'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxCheckBoxProperties'
Properties.NullStyle = nssUnchecked
HeaderAlignmentHorz = taCenter
Width = 57
end
end
object cxGrid1Level1: TcxGridLevel
GridView = tv1
end
end
object dxLayoutControl_query: TdxLayoutControl
Tag = 999
Left = 0
Top = 72
Width = 1077
Height = 45
Align = alTop
ParentBackground = True
TabOrder = 2
Transparent = True
LayoutLookAndFeel = BaseDataLink.dxLayoutSkinLookAndFeel1
OptionsItem.SizableHorz = True
OptionsItem.SizableVert = True
OnDblClick = dxLayoutControl_queryDblClick
ExplicitTop = 73
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
inline frmFrameDateSel1: TfrmFrameDateSel10
Left = 0
Top = 27
Width = 1077
Height = 45
Align = alTop
AutoSize = True
Color = clBtnFace
ParentBackground = False
ParentColor = False
TabOrder = 3
ExplicitTop = 30
ExplicitWidth = 1077
inherited dxLayoutControl1: TdxLayoutControl
Width = 1077
inherited TimeType: TcxComboBox [0]
Left = 16
Top = 11
ExplicitLeft = 16
ExplicitTop = 11
end
inherited BegDate: TcxDateEdit [1]
Left = 116
Top = 11
ExplicitLeft = 116
ExplicitTop = 11
end
inherited EndDate: TcxDateEdit [2]
Left = 265
Top = 11
ExplicitLeft = 265
ExplicitTop = 11
end
inherited cxButton4: TcxButton [3]
Left = 385
Top = 11
ExplicitLeft = 385
ExplicitTop = 11
end
inherited cxButton1: TcxButton [4]
Left = 465
Top = 11
ExplicitLeft = 465
ExplicitTop = 11
end
inherited cxButton5: TcxButton [5]
Left = 545
Top = 11
ExplicitLeft = 545
ExplicitTop = 11
end
inherited cxButton2: TcxButton [6]
Left = 625
Top = 11
ExplicitLeft = 625
ExplicitTop = 11
end
inherited cbbType: TcxComboBox [7]
Left = 705
Top = 11
ExplicitLeft = 705
ExplicitTop = 11
end
inherited cxButton3: TcxButton [8]
Left = 756
Top = 11
ExplicitLeft = 756
ExplicitTop = 11
end
inherited jqModel: TcxCheckBox
Left = 859
Top = 11
ExplicitLeft = 859
ExplicitTop = 11
ExplicitWidth = 89
ExplicitHeight = 33
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
end
end
object Panel_page: TPanel
Left = 0
Top = 117
Width = 1077
Height = 37
Align = alTop
AutoSize = True
BevelInner = bvRaised
BevelOuter = bvLowered
TabOrder = 4
ExplicitTop = 118
DesignSize = (
1077
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
ExplicitTop = 7
end
object BTNP: TButton
Left = 532
Top = 5
Width = 78
Height = 30
Anchors = [akLeft]
Caption = #19979#19968#39029
TabOrder = 0
OnClick = BTNPClick
end
object BTLP: TButton
Left = 338
Top = 4
Width = 78
Height = 31
Anchors = [akLeft]
Caption = #19978#19968#39029
TabOrder = 1
OnClick = BTLPClick
end
object TCBNOR: TcxComboBox
Tag = 2
Left = 122
Top = 2
Properties.DropDownListStyle = lsEditFixedList
Properties.Items.Strings = (
'500'
'1000'
'5000'
'10000')
Properties.OnChange = TCBNORPropertiesChange
TabOrder = 2
Text = '500'
Width = 94
end
end
object DataSource1: TDataSource
DataSet = CDS_List
Left = 768
Top = 296
end
object ADOQueryList: TADOQuery
Connection = DataLink_schedule.ADOLink
LockType = ltReadOnly
Parameters = <>
Left = 704
Top = 368
end
object cxGridPopupMenu1: TcxGridPopupMenu
Grid = cxGrid1
PopupMenus = <>
Left = 208
Top = 287
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
end

View File

@ -0,0 +1,353 @@
unit U_QryBaseList;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics,
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,U_WindowFormdesign,
dxSkinsDefaultPainters, dxSkinWXI, cxStyles, cxCustomData, cxFilter, cxData,
cxDataStorage, cxEdit, cxNavigator, dxDateRanges, dxScrollbarAnnotations,
Data.DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxGridCustomView, cxGrid, Data.Win.ADODB,math,
dxBarBuiltInMenu, cxGridCustomPopupMenu, cxGridPopupMenu, cxCheckBox,
cxContainer, dxCore, cxDateUtils, dxLayoutcxEditAdapters, dxLayoutContainer,
cxMaskEdit, cxDropDownEdit, cxCalendar, cxTextEdit, dxLayoutControl,
Datasnap.DBClient, cxMemo, Vcl.StdCtrls, Vcl.ExtCtrls,
cxGeometry, dxFramedControl, dxPanel, FrameDateSel10;
type
TfrmQryBaseList = class(TForm)
ToolBar3: TToolBar;
Trefresh: TToolButton;
Tprint: TToolButton;
TprintGrid: TToolButton;
TsaveGrid: TToolButton;
Tclose: TToolButton;
cxGrid1: TcxGrid;
tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
DataSource1: TDataSource;
ADOQueryList: TADOQuery;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
tv1SSel: TcxGridDBColumn;
dxLayoutControl_query: TdxLayoutControl;
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
frmFrameDateSel1: TfrmFrameDateSel10;
CDS_List: TClientDataSet;
Panel_page: TPanel;
BTNP: TButton;
LBCPAP: TLabel;
BTLP: TButton;
TCBNOR: TcxComboBox;
Label31: TLabel;
TgridLiSet: TToolButton;
procedure TrefreshClick(Sender: TObject);
procedure TprintClick(Sender: TObject);
procedure TprintGridClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TcloseClick(Sender: TObject);
procedure TsaveGridClick(Sender: TObject);
procedure BTLPClick(Sender: TObject);
procedure BTNPClick(Sender: TObject);
procedure TCBNORPropertiesChange(Sender: TObject);
procedure dxLayoutControl_queryDblClick(Sender: TObject);
procedure TgridLiSetClick(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;
public
fFormId: integer;
fProcedureName:string; //存储过程名称
FLMType:string; //报表文件类型标志
ftimeType:string; //日期类型
fQueryType:String; //查询类型
FFiltration1:string; //打印参数条件
fCriteria:string; //条件参数
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
end;
var
frmQryBaseList: TfrmQryBaseList;
implementation
uses
U_RTFun, U_globalVar, U_dataLink,U_FormLayOutDesign, U_LabelPrint,U_cxGridCustomSet;
{$R *.dfm}
procedure TfrmQryBaseList.BTLPClick(Sender: TObject);
begin
if CurrentPage > 1 then
CurrentPage := CurrentPage - 1;
doQuery();
end;
procedure TfrmQryBaseList.BTNPClick(Sender: TObject);
begin
if CurrentPage < cds_List.FieldByName('TotalCount').AsInteger / RecordsNumber then
CurrentPage := CurrentPage + 1;
doQuery();
end;
constructor TfrmQryBaseList.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 TfrmQryBaseList.TCBNORPropertiesChange(Sender: TObject);
begin
RecordsNumber := StrToInt(TCBNOR.Text);
CurrentPage := 1;
initGrid();
end;
procedure TfrmQryBaseList.TcloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmQryBaseList.TgridLiSetClick(Sender: TObject);
begin
fWindowDesign.OpenGridDesignWin10(fDesignCode,'cxgrid1',tv1);
end;
procedure TfrmQryBaseList.TprintClick(Sender: TObject);
begin
if cds_List.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid1);
end;
procedure TfrmQryBaseList.TprintGridClick(Sender: TObject);
begin
if cds_List.IsEmpty then
Exit;
if trim(self.FLMType)='' then
begin
application.MessageBox('未设置打印报表类型,请先设置!','提示信息',0);
exit;
end;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := self.FLMType;
FFiltration1 := self.FFiltration1;
if ShowModal = 1 then
begin
// Self.InitGrid();
end;
end;
finally
frmLabelPrint.Free;
end;
end;
procedure TfrmQryBaseList.TrefreshClick(Sender: TObject);
begin
if frmFrameDateSel1.BegDate.Visible then
begin
frmFrameDateSel1.BegDate.SetFocus;
end;
CurrentPage := 1;
initGrid();
end;
procedure TfrmQryBaseList.TsaveGridClick(Sender: TObject);
begin
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
if gIsCanDesign then
begin
saveLayOut(application, dxLayoutControl_query, ADOQueryBaseCmd,PWideChar( fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_query.Name + '.ini'));
end;
end;
////////////////////////////////////
procedure TfrmQryBaseList.doQuery();
var
strwhere: string;
begin
if fProcedureName='' then
begin
application.MessageBox('存储过程名称参数不能为空!','警告信息',0);
exit;
end;
strwhere := GetProcedureParam(dxLayoutControl_query);
try
Tv1.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;
Tv1.EndUpdate;
end;
end;
////////////////////////////////////
procedure TfrmQryBaseList.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
Tv1.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;
Tv1.EndUpdate;
end;
end;
procedure TfrmQryBaseList.dxLayoutControl_queryDblClick(Sender: TObject);
begin
layoutDesign(TdxLayoutControl(Sender),ADOQueryBaseCmd,PWideChar(dcode));
end;
///
procedure TfrmQryBaseList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Sendmessage(application.MainForm.Handle, WM_CloseForm, 4, 0);
Action:=cafree;
end;
procedure TfrmQryBaseList.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
CurrentPage := 1;
RecordsNumber := 500;
fWindowDesign := TWindowFormdesign.Create();
frmFrameDateSel1.begdate.Date:=SGetServerDate(ADOQueryBaseTemp);
frmFrameDateSel1.enddate.Date:=frmFrameDateSel1.begdate.Date;
end;
procedure TfrmQryBaseList.FormDestroy(Sender: TObject);
begin
fWindowDesign.free;
end;
procedure TfrmQryBaseList.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;
CreateCxGridColumn(application, Tv1,ADOQueryBaseTemp,PWideChar(fdesignCode));
//增加动态条件
addQryContionByLay(ADOQueryBaseTemp,fformId,'cxgrid1',dxLayoutControl_query,7);
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
initGrid();
end;
///////////////////////////////
///
procedure TfrmQryBaseList.initGrid();
begin
if fQueryType='criteria' then
begin
doQueryByCriteria() ;
end
else
begin
frmFrameDateSel1.jqModel.Checked:=true;
doQuery() ;
end;
end;
end.

View File

@ -0,0 +1,444 @@
object frmTradeBaseList: TfrmTradeBaseList
Left = 0
Top = 0
Caption = 'frmTradeBaseList'
ClientHeight = 538
ClientWidth = 1077
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 = 1077
Height = 30
AutoSize = True
ButtonHeight = 30
ButtonWidth = 115
Caption = 'ToolBar1'
GradientEndColor = clWindow
Images = DataLink_schedule.cxImageList_bar
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 = 71
Top = 0
AutoSize = True
Caption = #23548#20986'Excel'
ImageIndex = 28
OnClick = TprintClick
end
object TprintGrid: TToolButton
Left = 180
Top = 0
AutoSize = True
Caption = #25171#21360
ImageIndex = 21
OnClick = TprintGridClick
end
object TsaveGrid: TToolButton
Left = 251
Top = 0
AutoSize = True
Caption = #20445#23384#26684#24335
ImageIndex = 30
OnClick = TsaveGridClick
end
object TgridLiSet: TToolButton
Left = 354
Top = 0
AutoSize = True
Caption = #34920#26684#21015#35774#32622
ImageIndex = 16
OnClick = TgridLiSetClick
end
object Tclose: TToolButton
Left = 473
Top = 0
AutoSize = True
Caption = #20851#38381
ImageIndex = 7
OnClick = TcloseClick
end
end
object cxGrid1: TcxGrid
Left = 8
Top = 209
Width = 1033
Height = 321
TabOrder = 1
object tv1: TcxGridDBTableView
Navigator.Buttons.CustomButtons = <>
ScrollbarAnnotations.CustomAnnotations = <>
DataController.DataSource = DataSource1
DataController.Filter.AutoDataSetFilter = True
DataController.Summary.DefaultGroupSummaryItems = <>
DataController.Summary.FooterSummaryItems = <>
DataController.Summary.SummaryGroups = <>
OptionsData.Deleting = False
OptionsData.DeletingConfirmation = False
OptionsData.Inserting = False
OptionsView.Footer = True
OptionsView.GroupByBox = False
object tv1SSel: TcxGridDBColumn
Caption = #36873#25321
DataBinding.FieldName = 'SSel'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxCheckBoxProperties'
Properties.NullStyle = nssUnchecked
HeaderAlignmentHorz = taCenter
Width = 57
end
object tv1OrderNo: TcxGridDBColumn
Caption = #35746#21333#21495
DataBinding.FieldName = 'OrderNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 102
end
object tv1custName: TcxGridDBColumn
Caption = #23458#25143#21517#31216
DataBinding.FieldName = 'custName'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 106
end
object tv1ConNo: TcxGridDBColumn
Caption = #21512#21516#21495
DataBinding.FieldName = 'ConNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 95
end
object tv1C_Name: TcxGridDBColumn
Caption = #21697#21517#20013#25991
DataBinding.FieldName = 'C_Name'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 86
end
object tv1C_Color: TcxGridDBColumn
Caption = #39068#33394
DataBinding.FieldName = 'C_Color'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 92
end
object tv1C_EColor: TcxGridDBColumn
Caption = #39068#33394'('#33521#25991')'
DataBinding.FieldName = 'C_EColor'
DataBinding.IsNullValueType = True
Options.Editing = False
Width = 95
end
object tv1C_ColorNo: TcxGridDBColumn
Caption = #33394#21495
DataBinding.FieldName = 'C_ColorNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 76
end
object tv1C_Pattern: TcxGridDBColumn
Caption = #33457#22411#33457#21495
DataBinding.FieldName = 'C_Pattern'
DataBinding.IsNullValueType = True
Options.Editing = False
end
object tv1C_StyleNo: TcxGridDBColumn
Caption = #27454#21495
DataBinding.FieldName = 'C_StyleNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
end
object tv1C_Width: TcxGridDBColumn
Caption = #38376#24133'(cm)'
DataBinding.FieldName = 'C_Width'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
end
object tv1C_GramWeight: TcxGridDBColumn
Caption = #20811#37325'(g/'#13217')'
DataBinding.FieldName = 'C_GramWeight'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
end
end
object cxGrid1Level1: TcxGridLevel
GridView = tv1
end
end
object dxLayoutControl_query: TdxLayoutControl
Left = 0
Top = 73
Width = 1077
Height = 45
Align = alTop
TabOrder = 2
LayoutLookAndFeel = BaseDataLink.dxLayoutSkinLookAndFeel1
OptionsItem.SizableHorz = True
OptionsItem.SizableVert = True
OnDblClick = dxLayoutControl_queryDblClick
object custName: TcxTextEdit
Tag = 2
Left = 262
Top = 11
ParentFont = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 1
Width = 109
end
object ConNo: TcxTextEdit
Tag = 2
Left = 436
Top = 11
ParentFont = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 2
Width = 105
end
object BuyConNo: TcxTextEdit
Tag = 2
Left = 10000
Top = 10000
ParentFont = False
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 3
Visible = False
Width = 121
end
object OrderNo: TcxTextEdit
Tag = 2
Left = 72
Top = 11
ParentFont = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 0
Width = 109
end
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
object dxLayoutItem1: TdxLayoutItem
Parent = dxLayoutControl_queryGroup_Root
CaptionOptions.Text = #35746#21333#21495
Control = OrderNo
ControlOptions.OriginalHeight = 33
ControlOptions.OriginalWidth = 109
ControlOptions.ShowBorder = False
Index = 0
end
object dxLayoutItem2: TdxLayoutItem
Parent = dxLayoutControl_queryGroup_Root
CaptionOptions.Text = #23458#25143#21517#31216
Control = custName
ControlOptions.OriginalHeight = 33
ControlOptions.OriginalWidth = 109
ControlOptions.ShowBorder = False
Index = 1
end
object dxLayoutItem_hth: TdxLayoutItem
Parent = dxLayoutControl_queryGroup_Root
CaptionOptions.Text = #21512#21516#21495
Control = ConNo
ControlOptions.OriginalHeight = 33
ControlOptions.OriginalWidth = 105
ControlOptions.ShowBorder = False
Index = 2
end
object dxLayoutItem_khdh: TdxLayoutItem
Tag = 99
Visible = False
CaptionOptions.Text = #23458#25143#21333#21495
Control = BuyConNo
ControlOptions.OriginalHeight = 33
ControlOptions.OriginalWidth = 121
ControlOptions.ShowBorder = False
Index = -1
end
end
inline frmFrameDateSel1: TfrmFrameDateSel
Left = 0
Top = 30
Width = 1077
Height = 43
Align = alTop
Color = clWhite
ParentBackground = False
ParentColor = False
TabOrder = 3
ExplicitTop = 30
ExplicitWidth = 1077
inherited lbl2: TLabel
Font.Charset = GB2312_CHARSET
end
inherited BegDate: TcxDateEdit
TabOrder = 1
end
inherited EndDate: TcxDateEdit
TabOrder = 0
end
inherited TimeType: TcxComboBox
ExplicitHeight = 33
end
inherited jqModel: TcxCheckBox
ExplicitWidth = 89
ExplicitHeight = 33
end
end
object Panel_page: TPanel
Left = 0
Top = 118
Width = 1077
Height = 37
Align = alTop
AutoSize = True
BevelInner = bvRaised
BevelOuter = bvLowered
TabOrder = 4
DesignSize = (
1077
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
ExplicitTop = 7
end
object BTNP: TButton
Left = 532
Top = 5
Width = 78
Height = 30
Anchors = [akLeft]
Caption = #19979#19968#39029
TabOrder = 0
OnClick = BTNPClick
end
object BTLP: TButton
Left = 338
Top = 4
Width = 78
Height = 31
Anchors = [akLeft]
Caption = #19978#19968#39029
TabOrder = 1
OnClick = BTLPClick
end
object TCBNOR: TcxComboBox
Tag = 2
Left = 122
Top = 2
ParentFont = False
Properties.DropDownListStyle = lsEditFixedList
Properties.Items.Strings = (
'500'
'1000'
'5000'
'10000')
Properties.OnChange = TCBNORPropertiesChange
TabOrder = 2
Text = '500'
Width = 94
end
end
object DataSource1: TDataSource
DataSet = CDS_List
Left = 768
Top = 296
end
object ADOQueryList: TADOQuery
Connection = DataLink_schedule.ADOLink
LockType = ltReadOnly
Parameters = <>
Left = 704
Top = 368
end
object cxGridPopupMenu1: TcxGridPopupMenu
Grid = cxGrid1
PopupMenus = <>
Left = 208
Top = 287
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
end

View File

@ -0,0 +1,372 @@
unit U_TradeBaseList;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics,
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,U_WindowFormdesign,
dxSkinsDefaultPainters, dxSkinWXI, cxStyles, cxCustomData, cxFilter, cxData,
cxDataStorage, cxEdit, cxNavigator, dxDateRanges, dxScrollbarAnnotations,
Data.DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxGridCustomView, cxGrid, Data.Win.ADODB,math,
dxBarBuiltInMenu, cxGridCustomPopupMenu, cxGridPopupMenu, cxCheckBox,
cxContainer, dxCore, cxDateUtils, dxLayoutcxEditAdapters, dxLayoutContainer,
cxMaskEdit, cxDropDownEdit, cxCalendar, cxTextEdit, dxLayoutControl,
FrameDateSel, Datasnap.DBClient, cxMemo, Vcl.StdCtrls, Vcl.ExtCtrls,
cxGeometry, dxFramedControl, dxPanel;
type
TfrmTradeBaseList = class(TForm)
ToolBar3: TToolBar;
Trefresh: TToolButton;
Tprint: TToolButton;
TprintGrid: TToolButton;
TsaveGrid: TToolButton;
Tclose: TToolButton;
cxGrid1: TcxGrid;
tv1: TcxGridDBTableView;
tv1custName: TcxGridDBColumn;
tv1OrderNo: TcxGridDBColumn;
tv1ConNo: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
DataSource1: TDataSource;
ADOQueryList: TADOQuery;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
tv1C_Name: TcxGridDBColumn;
tv1C_Color: TcxGridDBColumn;
tv1C_ColorNo: TcxGridDBColumn;
tv1C_EColor: TcxGridDBColumn;
tv1C_Pattern: TcxGridDBColumn;
tv1C_StyleNo: TcxGridDBColumn;
tv1C_Width: TcxGridDBColumn;
tv1C_GramWeight: TcxGridDBColumn;
tv1SSel: TcxGridDBColumn;
dxLayoutControl_query: TdxLayoutControl;
custName: TcxTextEdit;
ConNo: TcxTextEdit;
BuyConNo: TcxTextEdit;
OrderNo: TcxTextEdit;
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
dxLayoutItem1: TdxLayoutItem;
dxLayoutItem2: TdxLayoutItem;
dxLayoutItem_hth: TdxLayoutItem;
dxLayoutItem_khdh: TdxLayoutItem;
frmFrameDateSel1: TfrmFrameDateSel;
CDS_List: TClientDataSet;
Panel_page: TPanel;
BTNP: TButton;
LBCPAP: TLabel;
BTLP: TButton;
TCBNOR: TcxComboBox;
Label31: TLabel;
TgridLiSet: TToolButton;
procedure TrefreshClick(Sender: TObject);
procedure TprintClick(Sender: TObject);
procedure TprintGridClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TcloseClick(Sender: TObject);
procedure TsaveGridClick(Sender: TObject);
procedure BTLPClick(Sender: TObject);
procedure BTNPClick(Sender: TObject);
procedure TCBNORPropertiesChange(Sender: TObject);
procedure dxLayoutControl_queryDblClick(Sender: TObject);
procedure TgridLiSetClick(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;
public
fFormId: integer;
fProcedureName:string; //存储过程名称
FLMType:string; //报表文件类型标志
ftimeType:string; //日期类型
fQueryType:String; //查询类型
FFiltration1:string; //打印参数条件
fCriteria:string; //条件参数
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
end;
var
frmTradeBaseList: TfrmTradeBaseList;
implementation
uses
U_RTFun, U_globalVar, U_dataLink,U_FormLayOutDesign, U_LabelPrint;
{$R *.dfm}
procedure TfrmTradeBaseList.BTLPClick(Sender: TObject);
begin
if CurrentPage > 1 then
CurrentPage := CurrentPage - 1;
doQuery();
end;
procedure TfrmTradeBaseList.BTNPClick(Sender: TObject);
begin
if CurrentPage < cds_List.FieldByName('TotalCount').AsInteger / RecordsNumber then
CurrentPage := CurrentPage + 1;
doQuery();
end;
constructor TfrmTradeBaseList.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 TfrmTradeBaseList.TCBNORPropertiesChange(Sender: TObject);
begin
RecordsNumber := StrToInt(TCBNOR.Text);
CurrentPage := 1;
initGrid();
end;
procedure TfrmTradeBaseList.TcloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmTradeBaseList.TgridLiSetClick(Sender: TObject);
begin
fWindowDesign.OpenGridDesignWin10(fDesignCode,'cxgrid1',tv1);
end;
procedure TfrmTradeBaseList.TprintClick(Sender: TObject);
begin
if cds_List.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid1);
end;
procedure TfrmTradeBaseList.TprintGridClick(Sender: TObject);
begin
if cds_List.IsEmpty then
Exit;
if trim(self.FLMType)='' then
begin
application.MessageBox('未设置打印报表类型,请先设置!','提示信息',0);
exit;
end;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := self.FLMType;
FFiltration1 := self.FFiltration1;
if ShowModal = 1 then
begin
// Self.InitGrid();
end;
end;
finally
frmLabelPrint.Free;
end;
end;
procedure TfrmTradeBaseList.TrefreshClick(Sender: TObject);
begin
if frmFrameDateSel1.BegDate.Visible then
begin
frmFrameDateSel1.BegDate.SetFocus;
end;
CurrentPage := 1;
initGrid();
end;
procedure TfrmTradeBaseList.TsaveGridClick(Sender: TObject);
begin
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
if gIsCanDesign then
begin
saveLayOut(application, dxLayoutControl_query, ADOQueryBaseCmd,PWideChar( fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_query.Name + '.ini'));
end;
end;
////////////////////////////////////
procedure TfrmTradeBaseList.doQuery();
var
strwhere: string;
begin
if fProcedureName='' then
begin
application.MessageBox('存储过程名称参数不能为空!','警告信息',0);
exit;
end;
strwhere := GetProcedureParam(dxLayoutControl_query);
try
Tv1.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);
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;
Tv1.EndUpdate;
end;
end;
////////////////////////////////////
procedure TfrmTradeBaseList.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
Tv1.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;
Tv1.EndUpdate;
end;
end;
procedure TfrmTradeBaseList.dxLayoutControl_queryDblClick(Sender: TObject);
begin
layoutDesign(TdxLayoutControl(Sender),ADOQueryBaseCmd,PWideChar(dcode));
end;
///
procedure TfrmTradeBaseList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if WriteCloseWin(ADOQueryBaseCmd, self.Caption, fFormId, gDllFileName) then
begin
Sendmessage(application.MainForm.Handle, WM_CloseForm, 4, 0);
end;
Action:=cafree;
end;
procedure TfrmTradeBaseList.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
CurrentPage := 1;
RecordsNumber := 500;
fWindowDesign := TWindowFormdesign.Create();
frmFrameDateSel1.begdate.Date:=SGetServerDate(ADOQueryBaseTemp);
frmFrameDateSel1.enddate.Date:=frmFrameDateSel1.begdate.Date;
end;
procedure TfrmTradeBaseList.FormDestroy(Sender: TObject);
begin
fWindowDesign.free;
end;
procedure TfrmTradeBaseList.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);
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
initGrid();
end;
///////////////////////////////
///
procedure TfrmTradeBaseList.initGrid();
begin
if fQueryType='criteria' then
begin
doQueryByCriteria() ;
end
else
begin
frmFrameDateSel1.jqModel.Checked:=true;
doQuery() ;
end;
end;
end.

View File

@ -0,0 +1,569 @@
object frmTradeDetailBaseList: TfrmTradeDetailBaseList
Left = 0
Top = 0
Caption = 'frmTradeDetailBaseList'
ClientHeight = 605
ClientWidth = 1077
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 = 1077
Height = 30
AutoSize = True
ButtonHeight = 30
ButtonWidth = 105
Caption = 'ToolBar1'
GradientEndColor = clWindow
Images = DataLink_schedule.cxImageList_bar
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 = 71
Top = 0
AutoSize = True
Caption = #23548#20986'Excel'
ImageIndex = 28
OnClick = TprintClick
end
object TprintGrid: TToolButton
Left = 180
Top = 0
AutoSize = True
Caption = #25171#21360
ImageIndex = 21
OnClick = TprintGridClick
end
object TsaveGrid: TToolButton
Left = 251
Top = 0
AutoSize = True
Caption = #20445#23384#26684#24335
ImageIndex = 30
OnClick = TsaveGridClick
end
object Tclose: TToolButton
Left = 354
Top = 0
AutoSize = True
Caption = #20851#38381
ImageIndex = 7
OnClick = TcloseClick
end
end
object cxGrid1: TcxGrid
Left = 14
Top = 161
Width = 985
Height = 224
TabOrder = 1
object tv1: TcxGridDBTableView
Navigator.Buttons.CustomButtons = <>
ScrollbarAnnotations.CustomAnnotations = <>
OnFocusedRecordChanged = tv1FocusedRecordChanged
DataController.DataSource = DataSource1
DataController.Filter.AutoDataSetFilter = True
DataController.Summary.DefaultGroupSummaryItems = <>
DataController.Summary.FooterSummaryItems = <>
DataController.Summary.SummaryGroups = <>
OptionsData.Deleting = False
OptionsData.DeletingConfirmation = False
OptionsData.Inserting = False
OptionsView.Footer = True
OptionsView.GroupByBox = False
object tv1SSel: TcxGridDBColumn
Caption = #36873#25321
DataBinding.FieldName = 'SSel'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxCheckBoxProperties'
Properties.NullStyle = nssUnchecked
HeaderAlignmentHorz = taCenter
Width = 57
end
object tv1OrderNo: TcxGridDBColumn
Caption = #35746#21333#21495
DataBinding.FieldName = 'OrderNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 127
end
object tv1custName: TcxGridDBColumn
Caption = #23458#25143#21517#31216
DataBinding.FieldName = 'custName'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 126
end
object tv1salerser: TcxGridDBColumn
Caption = #19994#21153#21592
DataBinding.Expression = #1'salerser'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 95
end
object tv1ConNo: TcxGridDBColumn
Caption = #21512#21516#21495
DataBinding.FieldName = 'ConNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 95
end
end
object cxGrid1Level1: TcxGridLevel
GridView = tv1
end
end
object dxLayoutControl_query: TdxLayoutControl
Left = 0
Top = 30
Width = 1077
Height = 45
Align = alTop
TabOrder = 2
LayoutLookAndFeel = BaseDataLink.dxLayoutSkinLookAndFeel1
OptionsItem.SizableHorz = True
OptionsItem.SizableVert = True
ExplicitTop = 73
object custName: TcxTextEdit
Tag = 2
Left = 262
Top = 11
ParentFont = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 1
Width = 109
end
object ConNo: TcxTextEdit
Tag = 2
Left = 436
Top = 11
ParentFont = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 2
Width = 105
end
object BuyConNo: TcxTextEdit
Tag = 2
Left = 10000
Top = 10000
ParentFont = False
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 3
Visible = False
Width = 121
end
object OrderNo: TcxTextEdit
Tag = 2
Left = 72
Top = 11
ParentFont = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 0
Width = 109
end
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
object dxLayoutItem1: TdxLayoutItem
Parent = dxLayoutControl_queryGroup_Root
CaptionOptions.Text = #35746#21333#21495
Control = OrderNo
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 109
ControlOptions.ShowBorder = False
Index = 0
end
object dxLayoutItem2: TdxLayoutItem
Parent = dxLayoutControl_queryGroup_Root
CaptionOptions.Text = #23458#25143#21517#31216
Control = custName
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 109
ControlOptions.ShowBorder = False
Index = 1
end
object dxLayoutItem_hth: TdxLayoutItem
Parent = dxLayoutControl_queryGroup_Root
CaptionOptions.Text = #21512#21516#21495
Control = ConNo
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 105
ControlOptions.ShowBorder = False
Index = 2
end
object dxLayoutItem_khdh: TdxLayoutItem
Tag = 99
Visible = False
CaptionOptions.Text = #23458#25143#21333#21495
Control = BuyConNo
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 121
ControlOptions.ShowBorder = False
Index = -1
end
end
object Panel_page: TPanel
Left = 0
Top = 75
Width = 1077
Height = 37
Align = alTop
AutoSize = True
BevelInner = bvRaised
BevelOuter = bvLowered
TabOrder = 3
ExplicitTop = 118
DesignSize = (
1077
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
ExplicitTop = 7
end
object BTNP: TButton
Left = 532
Top = 5
Width = 78
Height = 30
Anchors = [akLeft]
Caption = #19979#19968#39029
TabOrder = 0
OnClick = BTNPClick
end
object BTLP: TButton
Left = 338
Top = 4
Width = 78
Height = 31
Anchors = [akLeft]
Caption = #19978#19968#39029
TabOrder = 1
OnClick = BTLPClick
end
object TCBNOR: TcxComboBox
Tag = 2
Left = 122
Top = 2
Properties.DropDownListStyle = lsEditFixedList
Properties.Items.Strings = (
'500'
'1000'
'5000'
'10000')
Properties.OnChange = TCBNORPropertiesChange
TabOrder = 2
Text = '500'
Width = 94
end
end
object cxSplitter1: TcxSplitter
Left = 0
Top = 401
Width = 1077
Height = 8
HotZoneClassName = 'TcxMediaPlayer8Style'
AlignSplitter = salBottom
end
object cxGrid2: TcxGrid
Left = 0
Top = 409
Width = 1077
Height = 196
Align = alBottom
TabOrder = 5
object TV2: TcxGridDBTableView
Navigator.Buttons.CustomButtons = <>
ScrollbarAnnotations.CustomAnnotations = <>
DataController.DataSource = DataSource2
DataController.Filter.AutoDataSetFilter = True
DataController.Options = [dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoImmediatePost]
DataController.Summary.DefaultGroupSummaryItems = <
item
Format = '0'
Position = spFooter
end
item
Format = '0'
Position = spFooter
Column = tv2OrdQty
end
item
Format = '0'
Position = spFooter
end>
DataController.Summary.FooterSummaryItems = <
item
Kind = skSum
Column = tv2OrdPiece
end
item
Kind = skSum
Column = tv2OrdQty
end>
DataController.Summary.SummaryGroups = <>
OptionsBehavior.FocusCellOnTab = True
OptionsBehavior.GoToNextCellOnEnter = True
OptionsBehavior.FocusCellOnCycle = True
OptionsCustomize.ColumnFiltering = False
OptionsData.Deleting = False
OptionsView.Footer = True
OptionsView.GroupByBox = False
Styles.UseOddEvenStyles = bFalse
object tv2SSel: TcxGridDBColumn
Tag = 99
Caption = #36873#25321
DataBinding.FieldName = 'SSel'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxCheckBoxProperties'
Properties.ImmediatePost = True
Properties.NullStyle = nssUnchecked
Visible = False
HeaderAlignmentHorz = taCenter
Options.Editing = False
Options.Sorting = False
Width = 66
end
object TV2C_Name: TcxGridDBColumn
Caption = #21697#21517#20013#25991
DataBinding.FieldName = 'C_Name'
DataBinding.IsNullValueType = True
Options.Editing = False
Width = 98
end
object TV2C_EName: TcxGridDBColumn
Caption = #21697#21517#33521#25991
DataBinding.FieldName = 'C_EName'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 91
end
object TV2C_spec: TcxGridDBColumn
Caption = #21697#21517#35268#26684
DataBinding.FieldName = 'C_spec'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 108
end
object TV2C_Color: TcxGridDBColumn
Caption = #20013#25991#39068#33394
DataBinding.FieldName = 'C_Color'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 119
end
object tv2C_EColor: TcxGridDBColumn
Caption = #33521#25991#39068#33394
DataBinding.FieldName = 'C_EColor'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxButtonEditProperties'
Properties.Buttons = <
item
Default = True
Kind = bkEllipsis
end>
Properties.ReadOnly = False
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 121
end
object cxGridDBColumn4: TcxGridDBColumn
Caption = #33394#21495
DataBinding.FieldName = 'C_ColorNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 94
end
object tv2C_Pattern: TcxGridDBColumn
Caption = #33457#22411
DataBinding.FieldName = 'C_Pattern'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxButtonEditProperties'
Properties.Buttons = <
item
Default = True
Kind = bkEllipsis
end>
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 87
end
object TV2Column1: TcxGridDBColumn
Caption = #27454#21495
DataBinding.FieldName = 'C_StyleNo'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 66
end
object tv2OrdPiece: TcxGridDBColumn
Caption = #21305#25968
DataBinding.FieldName = 'OrdPiece'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 97
end
object tv2OrdQty: TcxGridDBColumn
Caption = #25968#37327
DataBinding.FieldName = 'OrdQty'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxTextEditProperties'
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 84
end
object v1OrderUnit: TcxGridDBColumn
Caption = #21333#20301
DataBinding.FieldName = 'OrdUnit'
DataBinding.IsNullValueType = True
PropertiesClassName = 'TcxComboBoxProperties'
Properties.Items.Strings = (
'M'
'Y'
'Kg')
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 82
end
object tv2OrdSNote: TcxGridDBColumn
Caption = #22791#27880
DataBinding.FieldName = 'OrdSNote'
DataBinding.IsNullValueType = True
HeaderAlignmentHorz = taCenter
Options.Editing = False
Width = 135
end
end
object cxGridLevel1: TcxGridLevel
GridView = TV2
end
end
object DataSource1: TDataSource
DataSet = CDS_Main
Left = 768
Top = 296
end
object ADOQueryMain: TADOQuery
Connection = DataLink_schedule.ADOLink
LockType = ltReadOnly
Parameters = <>
Left = 704
Top = 368
end
object cxGridPopupMenu1: TcxGridPopupMenu
Grid = cxGrid1
PopupMenus = <>
Left = 208
Top = 287
end
object ADOQueryBaseCmd: TADOQuery
Connection = DataLink_schedule.ADOLink
Parameters = <>
Left = 281
Top = 248
end
object ADOQueryBaseTemp: TADOQuery
Connection = DataLink_schedule.ADOLink
LockType = ltReadOnly
Parameters = <>
Left = 201
Top = 225
end
object CDS_Main: TClientDataSet
Aggregates = <>
Params = <>
Left = 395
Top = 280
end
object ADOQuerySub: TADOQuery
Connection = DataLink_schedule.ADOLink
Parameters = <>
Left = 320
Top = 513
end
object DataSource2: TDataSource
DataSet = CDS_Sub
Left = 408
Top = 505
end
object cxGridPopupMenu2: TcxGridPopupMenu
Grid = cxGrid2
PopupMenus = <>
Left = 232
Top = 383
end
object CDS_Sub: TClientDataSet
Aggregates = <>
Params = <>
Left = 211
Top = 504
end
end

View File

@ -0,0 +1,415 @@
unit U_TradeDetailBaseList;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics,
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,U_WindowFormdesign,
dxSkinsDefaultPainters, dxSkinWXI, cxStyles, cxCustomData, cxFilter, cxData,
cxDataStorage, cxEdit, cxNavigator, dxDateRanges, dxScrollbarAnnotations,
Data.DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxGridCustomView, cxGrid, Data.Win.ADODB,math,
dxBarBuiltInMenu, cxGridCustomPopupMenu, cxGridPopupMenu, cxCheckBox,
cxContainer, dxCore, cxDateUtils, dxLayoutcxEditAdapters, dxLayoutContainer,
cxMaskEdit, cxDropDownEdit, cxCalendar, cxTextEdit, dxLayoutControl,
FrameDateSel, Datasnap.DBClient, cxMemo, Vcl.StdCtrls, Vcl.ExtCtrls,
cxGeometry, dxFramedControl, dxPanel, cxSplitter, cxButtonEdit;
type
TfrmTradeDetailBaseList = class(TForm)
ToolBar3: TToolBar;
Trefresh: TToolButton;
Tprint: TToolButton;
TprintGrid: TToolButton;
TsaveGrid: TToolButton;
Tclose: TToolButton;
cxGrid1: TcxGrid;
tv1: TcxGridDBTableView;
tv1custName: TcxGridDBColumn;
tv1OrderNo: TcxGridDBColumn;
tv1ConNo: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
DataSource1: TDataSource;
ADOQueryMain: TADOQuery;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryBaseCmd: TADOQuery;
ADOQueryBaseTemp: TADOQuery;
tv1SSel: TcxGridDBColumn;
dxLayoutControl_query: TdxLayoutControl;
custName: TcxTextEdit;
ConNo: TcxTextEdit;
BuyConNo: TcxTextEdit;
OrderNo: TcxTextEdit;
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
dxLayoutItem1: TdxLayoutItem;
dxLayoutItem2: TdxLayoutItem;
dxLayoutItem_hth: TdxLayoutItem;
dxLayoutItem_khdh: TdxLayoutItem;
CDS_Main: TClientDataSet;
Panel_page: TPanel;
BTNP: TButton;
LBCPAP: TLabel;
BTLP: TButton;
TCBNOR: TcxComboBox;
Label31: TLabel;
cxSplitter1: TcxSplitter;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
tv2SSel: TcxGridDBColumn;
tv2C_EColor: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
tv2C_Pattern: TcxGridDBColumn;
tv2OrdPiece: TcxGridDBColumn;
tv2OrdQty: TcxGridDBColumn;
v1OrderUnit: TcxGridDBColumn;
tv2OrdSNote: TcxGridDBColumn;
TV2Column1: TcxGridDBColumn;
TV2C_Color: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
tv1salerser: TcxGridDBColumn;
TV2C_EName: TcxGridDBColumn;
TV2C_spec: TcxGridDBColumn;
TV2C_Name: TcxGridDBColumn;
ADOQuerySub: TADOQuery;
DataSource2: TDataSource;
cxGridPopupMenu2: TcxGridPopupMenu;
CDS_Sub: TClientDataSet;
procedure TrefreshClick(Sender: TObject);
procedure TprintClick(Sender: TObject);
procedure TprintGridClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TcloseClick(Sender: TObject);
procedure TsaveGridClick(Sender: TObject);
procedure BTLPClick(Sender: TObject);
procedure BTNPClick(Sender: TObject);
procedure TCBNORPropertiesChange(Sender: TObject);
procedure tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
ANewItemRecordFocusingChanged: Boolean);
private
fWindowDesign: TWindowFormdesign;
CurrentPage, RecordsNumber: Integer;
procedure doQuery();
procedure doQueryByCriteria();
procedure initGrid();
procedure InitSub();
protected
fParameters1: string;
fParameters2: string;
fParameters3: string;
fParameters4: string;
fParameters5: string;
fParameters10: string;
public
fFormId: integer;
fProcedureName:string; //存储过程名称
fProcedureSubName:string; //子存储过程名称
FLMType:string; //报表文件类型标志
ftimeType:string; //日期类型
fQueryType:String; //查询类型
FFiltration1:string; //打印参数条件
fCriteria:string; //条件参数
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
end;
var
frmTradeDetailBaseList: TfrmTradeDetailBaseList;
implementation
uses
U_RTFun, U_globalVar, U_dataLink,U_FormLayOutDesign, U_LabelPrint;
{$R *.dfm}
procedure TfrmTradeDetailBaseList.BTLPClick(Sender: TObject);
begin
if CurrentPage > 1 then
CurrentPage := CurrentPage - 1;
doQuery();
end;
procedure TfrmTradeDetailBaseList.BTNPClick(Sender: TObject);
begin
if CurrentPage < cds_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
CurrentPage := CurrentPage + 1;
doQuery();
end;
constructor TfrmTradeDetailBaseList.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 TfrmTradeDetailBaseList.TCBNORPropertiesChange(Sender: TObject);
begin
RecordsNumber := StrToInt(TCBNOR.Text);
CurrentPage := 1;
initGrid();
end;
procedure TfrmTradeDetailBaseList.TcloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmTradeDetailBaseList.TprintClick(Sender: TObject);
begin
if cds_Main.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid1);
end;
procedure TfrmTradeDetailBaseList.TprintGridClick(Sender: TObject);
begin
if cds_Main.IsEmpty then
Exit;
if trim(self.FLMType)='' then
begin
application.MessageBox('未设置打印报表类型,请先设置!','提示信息',0);
exit;
end;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := self.FLMType;
FFiltration1 := self.FFiltration1;
if ShowModal = 1 then
begin
// Self.InitGrid();
end;
end;
finally
frmLabelPrint.Free;
end;
end;
procedure TfrmTradeDetailBaseList.TrefreshClick(Sender: TObject);
begin
if frmFrameDateSel1.BegDate.Visible then
begin
frmFrameDateSel1.BegDate.SetFocus;
end;
CurrentPage := 1;
initGrid();
end;
procedure TfrmTradeDetailBaseList.TsaveGridClick(Sender: TObject);
begin
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
if gIsCanDesign then
begin
saveLayOut(application, dxLayoutControl_query, ADOQueryBaseCmd,PWideChar( fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_query.Name + '.ini'));
end;
end;
procedure TfrmTradeDetailBaseList.tv1FocusedRecordChanged(
Sender: TcxCustomGridTableView; APrevFocusedRecord,
AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
InitSub();
end;
////////////////////////////////////
procedure TfrmTradeDetailBaseList.doQuery();
var
strwhere: string;
begin
if fProcedureName='' then
begin
application.MessageBox('存储过程名称参数不能为空!','警告信息',0);
exit;
end;
strwhere := GetProcedureParam(dxLayoutControl_query);
try
Tv1.BeginUpdate();
cds_Main.DisableControls;
with ADOQueryMain 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(ADOQueryMain, cds_Main);
SInitCDSData(ADOQueryMain, cds_Main);
if Panel_page.Visible then
begin
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(cds_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
end;
finally
cds_Main.EnableControls;
Tv1.EndUpdate;
end;
end;
////////////////////////////////////
procedure TfrmTradeDetailBaseList.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
Tv1.BeginUpdate();
CDS_Main.DisableControls;
with ADOQueryMain 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(ADOQueryMain, CDS_Main);
SInitCDSData(ADOQueryMain, CDS_Main);
if Panel_page.Visible then
begin
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
end;
finally
CDS_Main.EnableControls;
Tv1.EndUpdate;
end;
end;
///
procedure TfrmTradeDetailBaseList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if WriteCloseWin(ADOQueryBaseCmd, self.Caption, fFormId, gDllFileName) then
begin
Sendmessage(application.MainForm.Handle, WM_CloseForm, 4, 0);
end;
Action:=cafree;
end;
procedure TfrmTradeDetailBaseList.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
CurrentPage := 1;
RecordsNumber := 500;
fWindowDesign := TWindowFormdesign.Create();
frmFrameDateSel1.begdate.Date:=SGetServerDate(ADOQueryBaseTemp);
frmFrameDateSel1.enddate.Date:=frmFrameDateSel1.begdate.Date;
end;
procedure TfrmTradeDetailBaseList.FormDestroy(Sender: TObject);
begin
fWindowDesign.free;
end;
procedure TfrmTradeDetailBaseList.FormShow(Sender: TObject);
var
mdesignCode:string;
begin
if DParameters8<>'1' then
begin
fWindowDesign.FormStyleInit(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10);
end;
mdesignCode := fDllFileName +'|'+self.name+ '|' + intTostr(fformId) + '|' + 'cxgrid1';
//增加动态条件
addQryContionByLay(ADOQueryBaseTemp,fformId,'cxgrid1',dxLayoutControl_query,7);
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
initGrid();
end;
///////////////////////////////
///
procedure TfrmTradeDetailBaseList.initGrid();
begin
if fQueryType='criteria' then
begin
doQueryByCriteria() ;
end
else
begin
frmFrameDateSel1.jqModel.Checked:=true;
doQuery() ;
end;
end;
/////////////////////////
procedure TfrmTradeDetailBaseList.InitSub();
begin ADOQuerySub.close;
if fProcedureSubName='' then
begin
application.MessageBox('您还未设置子存储过程名称!','提示信息',0);
exit;
end;
if CDS_Main.IsEmpty then
Exit;
try
TV2.BeginUpdate();
CDS_SUB.DisableControls;
with ADOQuerySub do begin close;
sql.Clear;
sql.Add('exec '+fProcedureSubName);
sql.Add('@mainId =' + quotedstr((CDS_Main.fieldbyname('mainID')
.AsString)));
Open;
end;
SCreateCDS(ADOQuerySub, CDS_SUB);
SInitCDSData(ADOQuerySub, CDS_SUB);
finally
CDS_SUB.EnableControls;
TV2.EndUpdate;
end;
//
end;
end.

View File

@ -37,12 +37,16 @@ type
procedure OpenGridDesignWin(mCxGridView: TcxGridDBTableView);
function getChgDefaultValue(mValue: string): string;
procedure dxLayoutControl1DblClick(Sender: TObject);
procedure setGridClick(Sender: TObject);
function getColumnRelation(tv1:TcxGridDBTableView):TclientDataSet;
procedure cxGridViewCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
public
fProcedureName:string;
function FormStyleInit(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
function FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
function FormStyleInit10(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
procedure QueryDataPlus(ADOTmp: TADOQuery);
//function IsHasDesignRight(ADOTmp: TADOQuery): boolean;
procedure OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView);
end;
const
@ -74,16 +78,18 @@ var
mIsCustomBackColor: boolean;
mIsDrawGridHeader: boolean;
mdesignCode: string;
setGridButton: TToolButton;
begin
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
fFormName := Tform(mForm).name;
fFormName := mForm.name;
fFormId := mFormId;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
if trim(mStyleCode) = '' then
mStyleCode := '01';
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
//if trim(mStyleCode) = '' then
// mStyleCode := '01';
if gFontSize>=9 then
begin
@ -107,17 +113,11 @@ begin
begin
continue;
end;
// if (fFontSize > 9) then
// begin
if (mForm.Components[i] is Tlabel) or (mForm.Components[i] is Tcxlabel) then
begin
// mForm.Components[i] is TfrmFrameDateSel
//if (mForm.Components[i].Tag<>10) and (Tlabel(mForm.Components[i]).Font.Size<>fFontSize) then
// Tlabel(mForm.Components[i]).Font.Size:= fFontSize ;
// if Tlabel(mForm.Components[i]).Left >= fFontSize then
// Tlabel(mForm.Components[i]).Left := Tlabel(mForm.Components[i]).Left - fFontSize;
continue;
end;
if ((mForm.Components[i] is TcxTextEdit and TcxTextEdit(mForm.Components[i]).ParentFont)
or (mForm.Components[i] is TcxComboBox and TcxComboBox(mForm.Components[i]).ParentFont)
or (mForm.Components[i] is TcxdateEdit) and TcxdateEdit(mForm.Components[i]).ParentFont ) then
Continue;
if mForm.Components[i] is TcxTextEdit then
begin
if (mForm.Components[i].Tag<999) and not TcxTextEdit(mForm.Components[i]).ParentFont then
@ -141,6 +141,12 @@ begin
if mForm.Components[i].Tag<999 then
TcxdateEdit(mForm.Components[i]).ParentFont:=True;
continue;
end;
if mForm.Components[i] is TcxCurrencyEdit then
begin
if mForm.Components[i].Tag<999 then
TcxCurrencyEdit(mForm.Components[i]).ParentFont:=True;
continue;
end;
if mForm.Components[i] is TfrmFrameDateSel then
begin
@ -148,6 +154,7 @@ begin
TfrmFrameDateSel(mForm.Components[i]).cbbType.ParentFont:= true;
TfrmFrameDateSel(mForm.Components[i]).BegDate.ParentFont:=true;
TfrmFrameDateSel(mForm.Components[i]).endDate.ParentFont:=true;
// TfrmFrameDateSel(mForm.Components[i]).TimeType.ParentFont:=true;
continue;
end;
if mForm.Components[i] is TcxMemo then
@ -161,20 +168,39 @@ begin
begin
if mForm.Components[i].Tag<999 then
TcxgroupBox(mForm.Components[i]).ParentFont:=True;
if mIsCustomBackColor then
TcxgroupBox(mForm.Components[i]).Color := clPanelBack;
TcxgroupBox(mForm.Components[i]).Ctl3D := mCtl3D;
mdesignCode := fFormName + '_' + intTostr(fFormId) + '_' + TcxgroupBox(mForm.Components[i]).name;
// if mIsCustomBackColor then
// TcxgroupBox(mForm.Components[i]).Color := clPanelBack;
// TcxgroupBox(mForm.Components[i]).Ctl3D := mCtl3D;
// mdesignCode := fFormName + '_' + intTostr(fFormId) + '_' + TcxgroupBox(mForm.Components[i]).name;
continue;
end;
if mForm.Components[i] is TToolBar then
begin
if mForm.Components[i].Tag>=999 then exit;
if mForm.Components[i].Tag<999 then
TToolBar(mForm.Components[i]).ParentFont:=True;
TToolBar(mForm.Components[i]).AutoSize := true;
TToolBar(mForm.Components[i]).Flat := true;
//
if gIsCanDesign then
begin
if mForm.Components[i].FindComponent('TgridLiSet')=nil then
begin
TToolBar(mForm.Components[i]).Wrapable:=false;
setGridButton := TToolButton.Create(mForm); //
setGridButton.Left := TToolBar(mForm.Components[i]).ButtonWidth * TToolBar(mForm.Components[i]).ButtonCount;
setGridButton.Parent := TToolBar(mForm.Components[i]);
setGridButton.ImageIndex := 16; //
setGridButton.Caption:='表格列设置';
// setGridButton.Name:='TgridLiSet';
setGridButton.Style := tbsButton;
setGridButton.AutoSize:=true;
setGridButton.OnClick := setGridClick; //
end;
end;
if mIsCustomBackColor then
TToolBar(mForm.Components[i]).Color := clToolBarBack;
if mForm.Components[i].Tag = 0 then
@ -220,11 +246,11 @@ begin
if mIsCustomBackColor and (Tpanel(mForm.Components[i]).Tag < 99) then
Tpanel(mForm.Components[i]).Color := clPanelBack;
Tpanel(mForm.Components[i]).Ctl3D := mCtl3D;
mdesignCode := fFormName + '_' + intTostr(fFormId) + '_' + Tpanel(mForm.Components[i]).name;
// mdesignCode := fFormName + '_' + intTostr(fFormId) + '_' + Tpanel(mForm.Components[i]).name;
continue;
end;
// Tpanel
// TScrollBox
if mForm.Components[i] is TScrollBox then
begin
if mForm.Components[i].Tag<999 then
@ -283,16 +309,13 @@ begin
if mForm.Components[i].Tag>=999 then Continue;
TcxGrid(mForm.Components[i]).ParentFont:=true;
TcxGrid(mForm.Components[i]).LookAndFeel.ScrollbarMode := sbmClassic;
//TcxGrid(mForm.Components[i]).LookAndFeel.ScrollbarMode := sbmClassic;
//自动响应过滤
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).dataController.filter.AutoDataSetFilter := true;
//if mForm.Components[i].Tag < 99 then
// SetCxGridColumnBestWidth(TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]));
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnKeyDown := cxGridViewKeyDown;
// TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnKeyDown := cxGridViewKeyDown;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnSelectionChanged := cxGridViewSelectionChanged;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell;
@ -311,7 +334,155 @@ begin
showMessage('窗口初始化异常!');
end;
end;
/// //////////////////////////////////////////////////////
// 窗口样式,其它界面信息设置;
/// //////////////////////////////////////////////////////
function TWindowFormDeSign.FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
var
i: integer;
cxStyle_GridOddRow: TcxStyle;
cxStyle_GridEvenRow: TcxStyle;
cxStyle_active: TcxStyle;
cxStyle_gridGroupBox: TcxStyle;
cxStyle_gridFoot: TcxStyle;
cxStyle_selection: TcxStyle;
mvalue: TcxStyleValues;
mCtl3D, mToolBarList: boolean;
mIsCustomBackColor: boolean;
mIsDrawGridHeader: boolean;
mdesignCode: string;
setGridButton: TToolButton;
begin
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
fFormName := mForm.name;
fFormId := mFormId;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
if gFontSize>=9 then
begin
fFontSize:= gFontSize ;
end
else
begin
fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
if fFontSize < 9 then
fFontSize := 12;
gFontSize:=fFontSize;
end;
mForm.Font.Size := fFontSize;
// 窗口背景色
try
for i := 0 to mForm.ControlCount - 1 do
begin
if mForm.Components[i] is TcxGrid then
begin
if mForm.Components[i].Tag>=999 then Continue;
TcxGrid(mForm.Components[i]).ParentFont:=true;
//自动响应过滤
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).dataController.filter.AutoDataSetFilter := true;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnSelectionChanged := cxGridViewSelectionChanged;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).OnCustomDrawIndicatorCell := cxGridViewCustomDrawIndicatorCell;
TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]).optionsCustomize.columnfiltering := true;
mdesignCode := fDllFileName +'|'+mForm.name+ '|' + intTostr(fFormId) + '|' + TcxGrid(mForm.Components[i]).name;
CreateCxGridColumn(application, TcxGridDBTableView(TcxGrid(mForm.Components[i]).Views[0]),ADOQueryTmp,PWideChar(mdesignCode));
continue;
end;
//
if mForm.Components[i] is TToolBar then
begin
if mForm.Components[i].Tag>=999 then exit;
if mForm.Components[i].Tag<999 then
TToolBar(mForm.Components[i]).ParentFont:=True;
TToolBar(mForm.Components[i]).AutoSize := true;
TToolBar(mForm.Components[i]).Flat := true;
//
if gIsCanDesign then
begin
if mForm.Components[i].FindComponent('TgridLiSet')=nil then
begin
TToolBar(mForm.Components[i]).Wrapable:=false;
setGridButton := TToolButton.Create(mForm); //
setGridButton.Left := TToolBar(mForm.Components[i]).ButtonWidth * TToolBar(mForm.Components[i]).ButtonCount;
setGridButton.Parent := TToolBar(mForm.Components[i]);
setGridButton.ImageIndex := 16; //
setGridButton.Caption:='表格列设置';
// setGridButton.Name:='TgridLiSet';
setGridButton.Style := tbsButton;
setGridButton.AutoSize:=true;
setGridButton.OnClick := setGridClick; //
end;
end;
if mIsCustomBackColor then
TToolBar(mForm.Components[i]).Color := clToolBarBack;
if mForm.Components[i].Tag = 0 then
begin
if ADOTmp.IsEmpty then
TToolBar(mForm.Components[i]).List := false
else
TToolBar(mForm.Components[i]).List := mToolBarList;
end;
if mRightCaptions<>'' then
SetFormOperRight(application,TToolBar(mForm.Components[i]), PWideChar(mRightCaptions));
continue;
end;
end;
except
showMessage('窗口初始化异常!');
end;
end;
/// //////////////////////////////////////////////////////
// 窗口样式,其它界面信息设置;
/// //////////////////////////////////////////////////////
function TWindowFormDeSign.FormStyleInit10(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
var
i: integer;
cxStyle_GridOddRow: TcxStyle;
cxStyle_GridEvenRow: TcxStyle;
cxStyle_active: TcxStyle;
cxStyle_gridGroupBox: TcxStyle;
cxStyle_gridFoot: TcxStyle;
cxStyle_selection: TcxStyle;
mvalue: TcxStyleValues;
mCtl3D, mToolBarList: boolean;
mIsCustomBackColor: boolean;
mIsDrawGridHeader: boolean;
mdesignCode: string;
setGridButton: TToolButton;
begin
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
fFormName := mForm.name;
fFormId := mFormId;
gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
if gFontSize>=9 then
begin
fFontSize:= gFontSize ;
end
else
begin
fFontSize:= getSystemFontSize(ADOTmp,PWideChar(mStyleCode));
if fFontSize < 9 then
fFontSize := 12;
gFontSize:=fFontSize;
end;
mForm.Font.Size := fFontSize;
end;
/// ////////////////////////////////////////////////////////////////////
@ -599,13 +770,7 @@ end;
// 0: mGridType 查询; 1:输入
/// /////////////////////////////////////////////////////////////////
procedure TWindowFormDeSign.OpenGridDesignWin(mCxGridView: TcxGridDBTableView);
type
TMyFunc = function(App: Tapplication; FormH: hwnd; FormID: integer; UID: pchar; UName: pchar; dataBase: pchar; Title: pchar; Parameters1: pchar; Parameters2: pchar): hwnd; stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
newh: hwnd;
mGridType: integer;
mdesignCode: string;
mGridName: string;
@ -614,12 +779,23 @@ var
begin
/// ////////////////////////////////////
// 权限控制
mdesignCode := fFormName + '|' + intTostr(fFormId) + '|' + mCxGridView.name;
mGridName := TcxGrid(TcxGridLevel(mCxGridView.level).Control).name;
if not IsHasDesignRight(ADOQueryCmd,PWideChar(dcode)) then
mdesignCode :=fDllFileName+'|'+ fFormName + '|' + intTostr(fFormId) + '|' + mGridName;
if not gIsCanDesign then
exit;
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0);
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName));
CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end;
/// ////////////////////////////////////////////////////////////////
// 打开表格设计窗口 新的版本
/// /////////////////////////////////////////////////////////////////
procedure TWindowFormDeSign.OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView);
begin
ShowCxGridDesign(application, mCxGridView, getColumnRelation(mCxGridView),AdOQueryCmd,PWideChar(fFormName) ,PWideChar(mGridName),PWideChar(fDllFileName),fformId,0,PWideChar(fProcedureName));
CreateCxGridColumn(application, mCxGridView,ADOQueryTmp,PWideChar(mdesignCode));
end;
@ -876,5 +1052,35 @@ begin
result:=client1;
end;
/////////////////////////////////////////////
procedure TWindowFormDeSign.setGridClick(Sender: TObject);
var
i:integer;
view:TcxGridDBTableView;
begin
view:=nil;
with TToolButton( Sender ).Parent.Parent do
begin
for i:=0 to ComponentCount-1 do
begin
if Components[i] is TcxGrid then
begin
if TcxGrid(Components[i]).IsFocused then
begin
view:= TcxGridDBTableView(TcxGrid(Components[i]).Views[0]);
end;
end;
end;
end;
//
if view<>nil then
begin
OpenGridDesignWin(view);
end
else
begin
showMessage('请先选择要设计的表格!');
end;
end;
end.

View File

@ -25,7 +25,7 @@ procedure CreateCxGridColumn_A(application: TApplication;
procedure ShowCxGridDesign(application: TApplication;
mCxGridView: TcxGridDBTableView; client1: TClientDataSet; ADOCmd: TADOQuery;
mFormName: PWideChar; mGridName: PWideChar; mDllName: PWideChar;
mFormId: integer; mGridType: integer = 0); stdcall;
mFormId: integer; mGridType: integer = 0;mProcedureName: PWideChar=nil); stdcall;
external 'rtCommon.dll' Name 'ShowCxGridDesign_A';
function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView;
ADOCmd: TADOQuery; designCode: PWideChar): Boolean; stdcall;
@ -256,10 +256,19 @@ var
mWidth: integer;
mAvgWidth, mGridWidth: integer;
HeaderStyle: TcxStyle;
footsumitem:tcxdatasummaryitem;
begin mWidth := 12;
mGridWidth := TcxGrid(TcxGridLevel(tv1.level).Control).Width;
with ADOQueryTmp do begin close;
sql.Clear;
sql.Add('select A.* ');
sql.Add('from SD_FormGrid_Design A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
open;
if IsEmpty then exit;
end;
try
HeaderStyle := TcxStyle.Create(nil);
HeaderStyle.Font := TcxGrid(TcxGridLevel(tv1.level).Control).Font;
HeaderStyle.TextColor := clBlue;
@ -267,19 +276,18 @@ begin mWidth := 12;
// CreateCxGridColumn_A(application,tv1,ADOQueryTmp,mdesignCode);
with ADOQueryTmp do begin close;
sql.Clear;
sql.Add('select A.* ');
sql.Add('from SD_FormGrid_Design A');
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
open;
if IsEmpty then begin exit;
end;
with ADOQueryTmp do
begin
First;
while not Eof do
begin
if trim(fieldByName('fieldName').AsString)='' then
begin
Next;
continue;
end;
ADBColumn := tv1.GetColumnByFieldName
(trim(fieldByName('fieldName').AsString));
(trim(ADOQueryTmp.fieldByName('fieldName').AsString));
if ADBColumn <> nil then begin
// ×÷·Ï²»ÏÔʾ
if not fieldByName('valid').AsBoolean then
@ -289,8 +297,9 @@ begin mWidth := 12;
Next;
continue;
end;
ADBColumn.Name := trim(tv1.Name) +
trim(fieldByName('fieldName').AsString);
trim(ADOQueryTmp.fieldByName('fieldName').AsString);
if fieldByName('fixColumn').AsBoolean then
begin
@ -309,12 +318,33 @@ begin mWidth := 12;
end
else begin ADBColumn.Visible := fieldByName('Visible').AsBoolean;
end;
/// ´´½¨»ã×ÜÁÐ
///
if (trim(ADOQueryTmp.fieldByName('FooterType').AsString)<>'') and (ADBColumn.Summary.FooterKind=skNone) then
begin
footsumitem:=tv1.DataController.Summary.FooterSummaryItems.Add;
footsumitem.ItemLink:= ADBColumn ;
if (trim(fieldByName('FooterType').AsString)='sum') or (trim(fieldByName('FooterType').AsString)='ºÏ¼Æ') then
begin
footsumitem.Kind:=skSum;
end;
if (trim(fieldByName('FooterType').AsString)='count')or (trim(fieldByName('FooterType').AsString)='С¼Æ') then
begin
footsumitem.Kind:=skCount;
end;
// footsumitem.Format:='#';
footsumitem.Position:=spFooter;
end
else
begin
// ADBColumn.Summary.FooterKind:=skNone ;
end;
ADBColumn.Caption := trim(fieldByName('caption').AsString);
Next;
continue;
end;
//
if not fieldByName('valid').AsBoolean then
begin
ADOQueryTmp.Next;
@ -349,12 +379,31 @@ begin mWidth := 12;
ADBColumn.Visible := fieldByName('visible').AsBoolean;
// ADBColumn.Hidden := fieldByName('ColumnHide').AsBoolean;
ADBColumn.HeaderAlignmentHorz := taCenter;
ADBColumn.MinWidth := 100;
// ADBColumn.MinWidth := 50;
ADBColumn.Name := mColumnName;
ADBColumn.Options.Editing := not fieldByName('ReadOnly').AsBoolean;
ADBColumn.Options.Focusing := not fieldByName('ReadOnly').AsBoolean;
/// /////////////
/// ´´½¨»ã×ÜÁÐ
///
if (trim(ADOQueryTmp.fieldByName('FooterType').AsString)<>'') then
begin
footsumitem:=tv1.DataController.Summary.FooterSummaryItems.Add;
footsumitem.ItemLink:= ADBColumn ;
if (trim(fieldByName('FooterType').AsString)='sum') or (trim(fieldByName('FooterType').AsString)='ºÏ¼Æ') then
begin
footsumitem.Kind:=skSum;
end;
if (trim(fieldByName('FooterType').AsString)='count') or (trim(fieldByName('FooterType').AsString)='С¼Æ') then
begin
footsumitem.Kind:=skCount;
end;
// footsumitem.Format:='#';
footsumitem.Position:=spFooter;
end;
ADOQueryTmp.Next;
@ -363,6 +412,7 @@ begin mWidth := 12;
close;
end;
finally
tv1.EndUpdate;
end;
end;
@ -422,7 +472,7 @@ begin client1 := TClientDataSet.Create(nil);
client1.FieldDefs.Add('fieldName', ftString, 100);
client1.FieldDefs.Add('caption', ftString, 100);
client1.FieldDefs.Add('ValueType', ftString, 100);
client1.FieldDefs.Add('fieldValue', ftString, 100);
client1.CreateDataSet;
getColumnRelation(tv1, client1);
Result := checkColumnMustIn_A(app, tv1, client1, mFlag);
@ -448,7 +498,6 @@ begin
client1.fieldByName('caption').Value := tv1.Columns[i].Caption;
client1.fieldByName('ValueType').Value := tv1.Columns[i]
.DataBinding.ValueType;
client1.Post;
end;
end;

View File

@ -10,7 +10,10 @@ var
gDllFileCaption :string;
gConString:string ;
gIsCanDesign:Boolean;
gGridNativeSet:boolean;
gFontSize:integer;
gIsUseSkin:boolean;
gStructVer:string;
const
WM_CloseForm = WM_USER + 100 ;