diff --git a/components/rx/trunk/LazReport/img/TlrSelectPeriodControl.bmp b/components/rx/trunk/LazReport/img/TlrSelectPeriodControl.bmp new file mode 100644 index 000000000..0ccbc81ff Binary files /dev/null and b/components/rx/trunk/LazReport/img/TlrSelectPeriodControl.bmp differ diff --git a/components/rx/trunk/LazReport/img/mk_res.sh b/components/rx/trunk/LazReport/img/mk_res.sh index b99de9685..bc424c4bf 100755 --- a/components/rx/trunk/LazReport/img/mk_res.sh +++ b/components/rx/trunk/LazReport/img/mk_res.sh @@ -1,2 +1,2 @@ rm lrrxdbdialogcontrols_img.inc -/usr/local/share/lazarus/tools/lazres lrrxdbdialogcontrols_img.inc TlrRxDBLookupComboBox.bmp TlrRxDateEdit.bmp +/usr/local/share/lazarus/tools/lazres lrrxdbdialogcontrols_img.inc TlrRxDBLookupComboBox.bmp TlrRxDateEdit.bmp TlrSelectPeriodControl.bmp diff --git a/components/rx/trunk/LazReport/lrrxcontrols.pas b/components/rx/trunk/LazReport/lrrxcontrols.pas index 68e815700..4fc1566c7 100644 --- a/components/rx/trunk/LazReport/lrrxcontrols.pas +++ b/components/rx/trunk/LazReport/lrrxcontrols.pas @@ -37,7 +37,7 @@ interface uses Classes, SysUtils, Controls, LR_Class, LRDialogControls, Graphics, LResources, - rxlookup, DB; + rxlookup, DB, rxDateRangeEditUnit; type @@ -97,6 +97,44 @@ type property OnClick; end; + { TlrSelectPeriodControl } + + TlrSelectPeriodControl = class(TlrVisualControl) + private + function GetFlat: Boolean; + function GetHalfYear: word; + function GetMonth: word; + function GetOptions: TRxDateRangeEditOptions; + function GetPeriod: TDateTime; + function GetPeriodEnd: TDateTime; + function GetQuarter: word; + function GetYear: word; + procedure SetFlat(AValue: Boolean); + procedure SetHalfYear(AValue: word); + procedure SetMonth(AValue: word); + procedure SetOptions(AValue: TRxDateRangeEditOptions); + procedure SetPeriod(AValue: TDateTime); + procedure SetQuarter(AValue: word); + procedure SetYear(AValue: word); + protected + procedure PaintDesignControl; override; + function CreateControl:TControl;override; + public + constructor Create(AOwnerPage:TfrPage); override; + procedure LoadFromXML(XML: TLrXMLConfig; const Path: String); override; + procedure SaveToXML(XML: TLrXMLConfig; const Path: String); override; + published + property AutoSize; + property Quarter:word read GetQuarter write SetQuarter; + property HalfYear:word read GetHalfYear write SetHalfYear; + property Flat: Boolean read GetFlat write SetFlat default False; + property Year:word read GetYear write SetYear; + property Month:word read GetMonth write SetMonth; + property Period:TDateTime read GetPeriod write SetPeriod; + property PeriodEnd:TDateTime read GetPeriodEnd; + property Options:TRxDateRangeEditOptions read GetOptions write SetOptions default [reoMonth]; + end; + implementation uses DBPropEdits, LR_DBRel, LR_Utils, PropEdits, duallist, rxstrutils, tooledit, LCLIntf, LCLType, Forms, LR_DBComponent; @@ -113,15 +151,20 @@ begin end; var - lrBMP_LRDBLookupComboBox:TBitmap = nil; - lrBMP_LRRxDateEdit:TBitmap = nil; + lrBMP_LRDBLookupComboBox : TBitmap = nil; + lrBMP_LRRxDateEdit : TBitmap = nil; + lrBMP_LRSelectPeriod : TBitmap = nil; procedure InitLRComp; begin DoRegsiterControl(lrBMP_LRDBLookupComboBox, TlrRxDBLookupComboBox); DoRegsiterControl(lrBMP_LRRxDateEdit, TlrRxDateEdit); + DoRegsiterControl(lrBMP_lrSelectPeriod, TlrSelectPeriodControl); end; +var + lrBMP_SelectClient:TBitmap = nil; + { TlrRxDateEdit } function TlrRxDateEdit.GetDate: TDateTime; @@ -339,6 +382,123 @@ begin end; end; +{ TlrSelectPeriodControl } + +function TlrSelectPeriodControl.GetFlat: Boolean; +begin + Result:=TRxDateRangeEdit(Control).Flat; +end; + +function TlrSelectPeriodControl.GetHalfYear: word; +begin + Result:=TRxDateRangeEdit(Control).HalfYear; +end; + +function TlrSelectPeriodControl.GetMonth: word; +begin + Result:=TRxDateRangeEdit(Control).Month; +end; + +function TlrSelectPeriodControl.GetOptions: TRxDateRangeEditOptions; +begin + Result:=TRxDateRangeEdit(Control).Options; +end; + +function TlrSelectPeriodControl.GetPeriod: TDateTime; +begin + Result:=TRxDateRangeEdit(Control).Period; +end; + +function TlrSelectPeriodControl.GetPeriodEnd: TDateTime; +begin + Result:=TRxDateRangeEdit(Control).PeriodEnd; +end; + +function TlrSelectPeriodControl.GetQuarter: word; +begin + Result:=TRxDateRangeEdit(Control).Quarter; +end; + +function TlrSelectPeriodControl.GetYear: word; +begin + Result:=TRxDateRangeEdit(Control).Year; +end; + +procedure TlrSelectPeriodControl.SetFlat(AValue: Boolean); +begin + TRxDateRangeEdit(Control).Flat:=AValue; +end; + +procedure TlrSelectPeriodControl.SetHalfYear(AValue: word); +begin + TRxDateRangeEdit(Control).HalfYear:=AValue; +end; + +procedure TlrSelectPeriodControl.SetMonth(AValue: word); +begin + TRxDateRangeEdit(Control).Month:=AValue; +end; + +procedure TlrSelectPeriodControl.SetOptions(AValue: TRxDateRangeEditOptions); +begin + TRxDateRangeEdit(Control).Options:=AValue; +end; + +procedure TlrSelectPeriodControl.SetPeriod(AValue: TDateTime); +begin + TRxDateRangeEdit(Control).Period:=AValue; +end; + +procedure TlrSelectPeriodControl.SetQuarter(AValue: word); +begin + TRxDateRangeEdit(Control).Quarter:=AValue; +end; + +procedure TlrSelectPeriodControl.SetYear(AValue: word); +begin + TRxDateRangeEdit(Control).Year:=AValue; +end; + +procedure TlrSelectPeriodControl.PaintDesignControl; +begin + inherited PaintDesignControl; +end; + +function TlrSelectPeriodControl.CreateControl: TControl; +begin + Result:=TRxDateRangeEdit.Create(nil); + TRxDateRangeEdit(Result).AutoSize:=false; +end; + +constructor TlrSelectPeriodControl.Create(AOwnerPage: TfrPage); +begin + inherited Create(AOwnerPage); + BaseName:='lrSelectPeriod'; + AutoSize:=false; +end; + +procedure TlrSelectPeriodControl.LoadFromXML(XML: TLrXMLConfig; + const Path: String); +var + S: String; +begin + inherited LoadFromXML(XML, Path); + Flat:=XML.GetValue(Path+'Flat/Value'{%H-}, false); + S:=XML.GetValue(Path+'Options/Value',''); + if S<>'' then + RestoreProperty('Options',S) + else + Options:=[]; +end; + +procedure TlrSelectPeriodControl.SaveToXML(XML: TLrXMLConfig; const Path: String + ); +begin + inherited SaveToXML(XML, Path); + XML.SetValue(Path+'Flat/Value'{%H-}, Flat); + XML.SetValue(Path+'Options/Value', GetSaveProperty('Options')); +end; + type { TlrDBLookupComboBoxListSourceProperty } @@ -462,5 +622,11 @@ initialization finalization if Assigned(lrBMP_LRDBLookupComboBox) then FreeAndNil(lrBMP_LRDBLookupComboBox); + + if Assigned(lrBMP_LRRxDateEdit) then + FreeAndNil(lrBMP_LRRxDateEdit); + + if Assigned(lrBMP_LRSelectPeriod) then + FreeAndNil(lrBMP_LRSelectPeriod); end. diff --git a/components/rx/trunk/LazReport/lrrxdbdialogcontrols_img.inc b/components/rx/trunk/LazReport/lrrxdbdialogcontrols_img.inc index 68dab7d54..74e416e8f 100644 --- a/components/rx/trunk/LazReport/lrrxdbdialogcontrols_img.inc +++ b/components/rx/trunk/LazReport/lrrxdbdialogcontrols_img.inc @@ -164,3 +164,102 @@ LazarusResources.Add('TlrRxDateEdit','BMP',[ +#0#0#1#0#0#0#1#0#0#0#1#0#0#0#1#0#0#0#1#0#0#0#1#0#0#0#1#0#0#0#1#0#0#0#1#0#0#0 +#1#0#0#0#1#0#0#0#1#0 ]); +LazarusResources.Add('TlrSelectPeriodControl','BMP',[ + 'BM'#138#9#0#0#0#0#0#0#138#0#0#0'|'#0#0#0#24#0#0#0#24#0#0#0#1#0' '#0#3#0#0#0#0 + +#9#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#255#0#0#255#0#0#255#0#0#0#0#0#0 + +#255'BGRs'#128#194#245'(`'#184#30#21' '#133#235#1'@33'#19#128'ff&@ff'#6#160 + +#153#153#9'<'#10#215#3'$\'#143'2'#0#0#0#0#0#0#0#0#0#0#0#0#4#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#30#30#30#2' '#31#31#10'%%%' + +#28'2222<<;@...'#3#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#28 + +#28#28#3#30#30#30#13'''''''!3338@@?NJIIeQQP|UTT'#146'XWV'#169'\ZY'#192'ba`' + +#214'nlk'#234'zxv'#249#130#128'~'#254#131#129#127#254#145#143#141#255'PPP>'#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'100lVUT'#219'_^\'#239'eca'#252'ige' + +#254'khg'#254'mjh'#254'qnl'#254'vsq'#254'~{y'#254#138#136#133#254#147#145#143 + +#254#155#153#151#254#161#159#157#254#167#165#163#254#173#171#169#254#178#177 + +#175#254#186#185#183#254'lkkv'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'GFE' + +#161#134#131#129#254#136#134#132#255#136#134#131#255#138#136#134#254#142#139 + +#137#255#144#142#140#255#146#144#141#254#146#144#141#255#144#142#140#255#137 + +#135#133#255#138#136#135#254#144#143#141#255#152#151#149#254#161#160#159#255 + +#171#170#169#255#178#177#176#254#196#195#193#255'zyx'#172#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0'776srpm'#254'usq'#255'|{y'#255#131#130#129#254#139#138 + +#137#255#146#145#145#255#153#153#152#254#162#162#162#255#176#175#175#255#191 + +#191#191#255#199#199#199#254#203#203#203#255#207#207#207#254#211#211#211#255 + +#217#217#217#255#200#199#199#254#189#187#186#255#149#148#147#224'221'#1#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#20#20#20'*qom'#252#163#163#163#254#184#184#184#254 + +#187#187#187#254#190#190#190#254#194#194#194#254#198#198#198#254#201#201#201 + +#254#202#202#202#254#202#202#202#254#206#206#206#254#210#210#210#254#214#214 + +#214#254#217#217#217#254#223#223#223#254#214#214#214#254#174#172#171#254#184 + +#183#181#253'=<<'#25#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#30#30#30#5'ZYW'#213#155 + +#155#154#255#181#181#181#255#181#181#181#254#183#183#183#255#187#187#187#255 + +#190#190#190#254#196#196#196#255#201#201#201#255#208#208#208#255#215#215#215 + +#254#220#220#220#255#225#225#225#254#226#226#226#255#222#222#222#255#231#231 + +#231#254#168#167#166#255#189#188#186#255'\[[K'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 + +#0'hhh!'#155#155#155#230#174#174#174#255#183#183#183#255#190#190#190#254#202 + +#202#202#255#212#212#212#255#216#216#216#254#222#222#222#255#230#230#230#255 + +#220#220#220#255#205#205#205#254#244#244#244#255#244#244#244#254#244#244#244 + +#255#232#232#232#255#230#230#230#254#175#175#174#255#189#188#187#255'ssr'#127 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'WWWZ'#188#188#188#254#197#197#197 + +#254#207#207#207#254#194#194#194#254#129#129#129#254#224#224#224#254#238#238 + +#238#254#226#226#226#254#210#210#210#254'ppp'#254#172#172#172#254#234#234#234 + +#254#244#244#244#254#243#243#243#254#226#226#226#254#187#186#186#254#192#191 + +#189#254'}|{'#178#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#13#13#13#11#146#146 + +#146#232#216#216#216#255#224#224#224#254#236#236#236#255#149#149#149#255#145 + +#145#145#254#246#246#246#255#184#184#184#255'ggg'#255'iii'#254'hhh'#255#147 + +#147#147#254#245#245#245#255#244#244#244#255#235#235#235#254#197#197#197#255 + +#182#180#179#255#152#151#150#229'322'#1#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 + +#0'LKJ'#167#216#216#216#255#238#238#238#254#242#242#242#255#227#227#227#255 + +'jjj'#254#207#207#207#255#245#245#245#255#158#158#158#255#152#152#152#254#142 + +#142#142#255#152#152#152#254#246#246#246#255#244#244#244#255#243#243#243#254 + +#211#211#211#255#168#166#165#255#184#183#182#254'<<<'#27#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0',,,['#165#164#163#255#243#243#243#254#244#244#244#255 + +#247#247#247#255#151#151#151#254#142#142#142#255#247#247#247#255#245#245#245 + +#255#158#158#158#254'yyy'#255'iii'#254#230#230#230#255#244#244#244#255#243 + +#243#243#254#221#221#221#255#170#169#168#255#186#185#183#254'\\[N'#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#13#13#12#23'rrp'#245#236#236#235#254#244#244 + +#244#254#211#211#211#254#132#132#132#254'hhh'#254#222#222#222#254#245#245#245 + +#254#245#245#245#254#159#159#159#254'ggg'#254#171#171#171#254#245#245#245#254 + +#243#243#243#254#234#234#234#254#171#170#169#254#187#185#184#254'rrq'#129#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#10#10#10#2'RQP'#191#185#185#184#254#244 + +#244#244#255#240#240#240#255#193#193#193#254#130#130#130#255#161#161#161#255 + +#245#245#245#255#244#244#244#254#245#245#245#255#165#165#165#254#149#149#149 + +#255#244#244#244#255#243#243#243#254#244#244#244#255#177#177#177#255#189#187 + +#186#254'~}|'#180#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'877t'#138 + +#137#135#254#243#243#243#254#244#244#244#254#245#245#245#254#235#235#235#254 + +#203#203#203#254#244#244#244#254#243#243#243#254#244#244#244#254#245#245#245 + +#254#245#245#245#254#244#244#244#254#243#243#243#254#243#243#243#254#195#192 + +#188#254#173#172#170#254#152#152#150#229'433'#2#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 + ,#0#0#0#0#0#19#19#19'*onl'#252#224#211#195#255#233#212#184#255#233#205#169#254 + +#234#198#154#255#235#193#139#255#235#187'|'#255#236#182'l'#254#237#178'^'#255 + +#237#175'O'#254#238#172'?'#255#239#170'0'#255#239#168'!'#254#240#166#18#255 + +#211#155#26#255#163#160#154#254#182#181#180#254'=<<'#28#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#11#11#11#5'[ZY'#213#197'p&'#255#255#130#23#255#254#128#16 + +#254#255#130#13#255#255#135#12#255#255#141#12#255#254#146#12#254#255#153#14 + +#255#254#153#0#254#255#158#0#255#255#164#0#255#254#170#1#254#255#181#17#255 + +#245#185#13#255#155#147#132#254#185#183#182#255'ZZYM'#0#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0'A@@'#142#153'pE'#254#254#137#18#254#254#137#15#254 + +#254#142#14#254#254#150#21#254#254#156#21#254#254#166'"'#254#254#167#21#254 + +#254#188'E'#254#254#212#128#254#254#183#24#254#254#223#147#254#254#229#159 + +#254#254#226'y'#254#163#146'^'#254#185#183#182#254'ppo'#128#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#31#31#30'Aym]'#255#252#150#23#255#254#149#15 + +#254#255#151#9#255#255#158#12#255#255#162#8#255#254#167#6#254#255#175#13#255 + +#254#183#23#254#255#191'!'#255#255#188#8#255#254#196#19#254#255#198#12#255 + +#255#207#20#255#186#161'D'#254#182#180#179#255'}|{'#178#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#11#11#11#11'dca'#233#220#156':'#255#254#196'k'#254 + +#255#207#130#255#255#210#131#255#255#213#129#255#254#214'{'#254#241#212#137 + +#255#248#202'I'#254#255#192#1#255#255#196#6#255#216#170#15#254#237#190#18#255 + +#255#209#20#255#212#180'2'#254#167#166#164#255#149#148#147#227'443'#1#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'IHH'#167#178#136'8'#254#254#176#21 + +#254#211#151#26#254#186#151'C'#254#254#190#20#254#254#196#23#254#190#166'Z' + +#254#194#163'>'#254#234#190')'#254#226#186'.'#254#189#176#128#254#181#160'P' + +#254#205#177'A'#254#189#165'N'#254#169#167#165#254#173#172#171#252'444'#13#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'-,,['#132'{l'#255#152#136'h' + +#254#140#131'q'#255#176#173#165#255'pgT'#255'|th'#254#140#137#133#255#147#147 + +#147#254'qon'#255#138#136#134#255#150#149#147#254#144#143#143#255#135#133#131 + +#255#161#158#156#254#171#169#167#255#164#163#162#237'777'#4#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#16#16#16#21'pom'#221'rqo'#221'nmk'#209'nmm' + +#197'cba'#184'jhg'#173'kih'#160'fed'#148'ihg'#135'ihg{ffenba`b]]\VZYYJSRR?II' + +'I+'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'$$$'#1#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 +]);